Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

userk.h File Reference

#include "wbasek.h"
#include "csrmsg.h"
#include <winnls.h>
#include <wincon.h>
#include <winuser.h>
#include <winuserp.h>
#include <wowuserp.h>
#include <user.h>
#include "ptag.h"
#include "globals.h"
#include "ddemlsvr.h"
#include "strid.h"
#include "ntuser.h"

Go to the source code of this file.

Classes

struct  tagPERFINFO
struct  _HANDLEPAGE
struct  tagWPINFO
struct  tagCRITSTACK
struct  tagGENERIC_DEVICE_INFO
struct  tagMOUSE_DEVICE_INFO
struct  tagKEYBOARD_DEVICE_INFO
struct  tagDEVICEINFO
struct  tagDEVICE_TEMPLATE
struct  tagMOUSEEVENT
struct  tagHARDERRORHANDLER
struct  tagTERMINAL
struct  tagWin32AllocStats
struct  tagPOOLRECORD
struct  tagAAS
struct  _LOCKRECORD
struct  _LOCK
struct  tagCVR
struct  tagSMWP
struct  tagCLIPDATA
struct  tagUSERSTARTUPINFO
struct  tagTLBLOCK
struct  tagKBDFILE
struct  tagKL
struct  tagKBDLANGTOGGLE
struct  tagDESKTOP
struct  tagDESKWND
struct  tagWINDOWSTATION
struct  tagCAPTIONCACHE
struct  tagSYSCFGICO
struct  tagACCELTABLE
struct  tagPOPUPMENU
struct  tagMENUWND
struct  tagCHECKPOINT
struct  tagCLIP
struct  tagSVR_INSTANCE_INFO
struct  tagPUBOBJ
struct  tagQMSG
struct  _MOVESIZEDATA
struct  tagMLIST
struct  tagQ
struct  tagATTACHINFO
struct  tagWOWTHREADINFO
struct  tagTDB
struct  tagMENUANIDC
struct  tagMENUSTATE
struct  tagLASTINPUT
struct  GRAYMENU
struct  tagTHREADINFO
struct  tagWOWPROCESSINFO
struct  tagDESKTOPVIEW
struct  tagW32JOB
struct  tagPROCESSINFO
struct  _LPKDRAWSWITCHWND
struct  tagDCE
struct  tagBWL
struct  tagSPB
struct  _CREATESTRUCTEX
struct  _MDICREATESTRUCTEX
struct  _CWPSTRUCTEX
struct  _CWPRETSTRUCTEX
struct  tagSMS
struct  tagINTERSENDMSGEX
struct  tagASYNCSENDMSG
struct  tagHOOKMSGSTRUCT
union  tagBROADCASTMSG
struct  tagHOTKEY
struct  tagDRAWICONCB
struct  SCANCODEMAP
struct  tagTIMER
struct  tagDISPLAYRESOURCE
struct  tagPROFILEVALUEINFO
struct  tagFREELIST
struct  tagDDEIMP
struct  tagDDECONV
struct  tagXSTATE
struct  tagMONITORPOS
struct  tagMONITORRECTS
struct  tagEVENTHOOK
struct  tagNOTIFY
struct  tagSwitchWndInfo
struct  tagSWITCHWND
struct  tagHOTKEYSTRUCT
struct  tagPOWERSTATE
struct  tagFADE
struct  tagTOOLTIP
struct  tagTOOLTIPWND
struct  tagPROFINTINFO

Defines

#define GET_X_LPARAM(lp)   ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp)   ((int)(short)HIWORD(lp))
#define BC_INVERT   0x00000001
#define BC_NOMIRROR   0x00000002
#define HEBREW_UI_LANGID()   (gpsi->UILangID == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT))
#define OEMRESOURCE   1
#define CCACHEDCAPTIONS   5
#define RIT_PROCESSINPUT   0x01
#define RIT_STOPINPUT   0x02
#define PtiCurrent()   (gptiCurrent)
#define PtiCurrentShared()   ((PTHREADINFO)(W32GetCurrentThread()))
#define CheckPtiSysPeek(where, pq, newIdSysPeek)
#define CheckSysLock(where, pq, pti)
#define SHUTDOWN_KNOWN_PROCESS   1
#define SHUTDOWN_UNKNOWN_PROCESS   2
#define SHUTDOWN_CANCEL   3
#define PpiCurrent()   ((PPROCESSINFO)(W32GetCurrentProcess()))
#define PtiFromThread(Thread)   ((PTHREADINFO)((Thread)->Tcb.Win32Thread))
#define PpiFromProcess(Process)   ((PPROCESSINFO)((PW32PROCESS)(Process)->Win32Process))
#define GetCurrentProcessId()   (PsGetCurrentThread()->Cid.UniqueProcess)
#define ISCSRSS()   (PsGetCurrentProcess() == gpepCSRSS)
#define CheckForClientDeath()
#define DATAALIGN   sizeof(DWORD)
#define CHARALIGN   sizeof(WCHAR)
#define ProbeForReadBuffer(Address, Count, Alignment)
#define ProbeForWriteBuffer(Address, Count, Alignment)
#define ProbeAndReadSize(Address)
#define ProbeAndReadBlendfunction(Address)
#define ProbePoint(Address)
#define ProbeAndReadPoint(Address)
#define ProbeRect(Address)
#define ProbeAndReadRect(Address)
#define ProbeMessage(Address)
#define ProbeAndReadMessage(Address)
#define ProbeAndReadLargeString(Address)
#define ProbeAndReadWindowPlacement(Address)
#define ProbeAndReadMenuItem(Address)
#define ProbeAndReadMenuInfo(Address)
#define ProbeAndReadScrollInfo(Address)
#define ProbeAndReadPopupParams(Address)
#define ProbeAndReadPaintStruct(Address)
#define ProbeAndReadCreateStruct(Address)
#define ProbeAndReadMDICreateStruct(Address)
#define ProbeAndReadCopyDataStruct(Address)
#define ProbeAndReadCompareItemStruct(Address)
#define ProbeAndReadDeleteItemStruct(Address)
#define ProbeAndReadHelp(Address)
#define ProbeAndReadHelpInfo(Address)
#define ProbeAndReadDrawItemStruct(Address)
#define ProbeAndReadHookInfo(Address)
#define ProbeAndReadCBTActivateStruct(Address)
#define ProbeAndReadKbdHook(Address)
#define ProbeAndReadMsllHook(Address)
#define ProbeAndReadMouseHook(Address)
#define ProbeAndReadCBTCreateStruct(Address)
#define ProbeAndReadTrackMouseEvent(Address)
#define ProbeAndReadWindowPos(Address)
#define ProbeAndReadCursorFind(Address)
#define ProbeAndReadSetClipBData(Address)
#define ProbeAndReadBroadcastSystemMsgParams(Address)
#define ProbeAndReadCursorData(Address)
#define ProbeForReadUnicodeStringBuffer(String)
#define ProbeForReadUnicodeStringFullBuffer(String)
#define ProbeForReadUnicodeStringBufferOrId(String)
#define ProbeAndReadCandidateForm(Address)
#define ProbeAndReadCompositionForm(Address)
#define ProbeAndReadLogFontW(Address)
#define ProbeForWritePoint(Address)
#define ProbeForWriteRect(Address)
#define ProbeForWriteMessage(Address)
#define ProbeForWritePaintStruct(Address)
#define ProbeForWriteDropStruct(Address)
#define ProbeForWriteScrollInfo(Address)
#define ProbeForWriteStyleStruct(Address)
#define ProbeForWriteMeasureItemStruct(Address)
#define ProbeForWriteCreateStruct(Address)
#define ProbeForWriteEvent(Address)
#define ProbeForWriteWindowPlacement(Address)
#define ProbeForWriteGetClipData(Address)
#define ProbeForWriteMDINextMenu(Address)
#define ProbeForWritePoint5(Address)
#define ProbeForWriteNCCalcSize(Address)
#define ProbeForWriteWindowPos(Address)
#define ProbeForWriteCandidateForm(Address)
#define ProbeForWriteCompositionForm(Address)
#define ProbeForWriteLogFontW(Address)
#define ProbeForWriteReconvertString(Address)
#define ProbeForReadReconvertString(pReconv)   ProbeForRead((pReconv), (pReconv)->dwSize, 1)
#define ProbeForWriteImeCharPosition(Address)
#define ProbeAndReadMenuGetObjectInfo(Address)
#define CheckLock(p)
#define TRACE_INIT(str)   {}
#define TRACE_SWITCH(str)   {}
#define TRACE(s)
#define TRACEVOID(s)
#define TRACETHUNK(t)
#define TRACECALLBACK(t)
#define TRACECALLBACKMSG(t)
#define RevalidateHwnd(hwnd)   HMValidateHandleNoSecure(hwnd, TYPE_WINDOW)
#define RevalidateCatHwnd(hwnd)   HMValidateCatHandleNoSecure(hwnd, TYPE_WINDOW)
#define HtoPq(h)   ((PVOID)HMObjectFromHandle(h))
#define HtoPqCat(h)   ((PVOID)HMCatObjectFromHandle(h))
#define HtoP(h)   ((PVOID)HMObjectFromHandle(h))
#define HtoPCat(h)   ((PVOID)HMCatObjectFromHandle(h))
#define PW(hwnd)   ((PWND)HtoP(hwnd))
#define PWCat(hwnd)   ((PWND)HtoPCat(hwnd))
#define TID(pti)   HandleToUlong((pti) == NULL ? NULL : (pti)->pEThread->Cid.UniqueThread)
#define TIDq(pti)   HandleToUlong((pti)->pEThread->Cid.UniqueThread)
#define Lock(ppobj, pobj)   HMAssignmentLock((PVOID *)ppobj, (PVOID)pobj)
#define Unlock(ppobj)   HMAssignmentUnlock((PVOID *)ppobj)
#define HMUnlockObject(pobj)   ( (--((PHEAD)pobj)->cLockObj == 0) ? HMUnlockObjectInternal(pobj) : pobj )
#define HMChangeOwnerProcess(pobj, pti)   HMChangeOwnerPheProcess(HMPheFromObject(pobj), pti)
#define HMLockObject(p)   (((PHEAD)p)->cLockObj++)
#define ThreadLock(_pobj_, _ptl_)
#define ThreadLockAlways(_pobj_, _ptl_)
#define ThreadLockNever(_ptl_)
#define ThreadLockAlwaysWithPti(_pti_, _pobj_, _ptl_)
#define ThreadLockNeverWithPti(_pti_, _ptl_)
#define ThreadLockWithPti(_pti_, _pobj_, _ptl_)
#define ThreadUnlock(ptl)   ThreadUnlock1()
#define LogDesktop(pdesk, tag, bLock, extra)
#define ThreadLockObject(pobj, ptl)
#define ThreadLockExchangeObject(pobj, ptl)
#define ThreadUnlockObject(ptl)
#define UnlockWinSta(ppwinsta)   UnlockObjectAssignment(ppwinsta)
#define LockWinSta(ppwinsta, pwinsta)
#define LockDesktop(ppdesk, pdesk, tag, extra)
#define UnlockDesktop(ppdesk, tag, extra)   UnlockObjectAssignment(ppdesk)
#define ThreadLockDesktop(pti, pdesk, ptl, tag)
#define ThreadLockExchangeDesktop(pti, pdesk, ptl, tag)
#define ThreadUnlockDesktop(pti, ptl, tag)   ThreadUnlockObject(ptl)
#define ThreadLockWinSta(pti, pwinsta, ptl)
#define ThreadLockExchangeWinSta(pti, pwinsta, ptl)
#define _ThreadLockPti(pti, pobj, ptl)   LockW32Thread((PW32THREAD)pobj, ptl)
#define ThreadLockPti(pti, pobj, ptl)
#define ThreadUnlockWinSta(pti, ptl)   ThreadUnlockObject(ptl)
#define ThreadUnlockPti(pti, ptl)   UnlockW32Thread(ptl)
#define ThreadLockPool(_pti_, _ppool_, _ptl_)   PushW32ThreadLock(_ppool_, _ptl_, UserFreePool)
#define ThreadUnlockPool(_pti_, _ptl_)   PopW32ThreadLock(_ptl_)
#define ThreadUnlockAndFreePool(_pti_, _ptl_)   PopAndFreeAlwaysW32ThreadLock(_ptl_)
#define ThreadLockPoolCleanup(_pti_, _ppool_, _ptl_, _pfn_)   PushW32ThreadLock(_ppool_, _ptl_, _pfn_)
#define ThreadUnlockPoolCleanup(_pti_, _ptl_)   PopW32ThreadLock(_ptl_)
#define ThreadUnlockAndCleanupPool(_pti_, _ptl_)   PopAndFreeAlwaysW32ThreadLock(_ptl_)
#define ThreadLockDesktopHandle(_pti, _ptl_, _hdesk_)   PushW32ThreadLock(_hdesk_, _ptl_, CloseProtectedHandle)
#define ThreadUnlockDesktopHandle(_ptl_)   PopAndFreeAlwaysW32ThreadLock(_ptl_)
#define ThreadLockSFWLockCount(_ptl_)
#define ThreadUnlockSFWLockCount(_ptl_)
#define HBITMAP_RLE   ((HBITMAP)0xffffffff)
#define MAX_MOUSEPOINTS   64
#define PREVPOINT(i)   ((i == 0) ? (MAX_MOUSEPOINTS - 1) : ((i - 1) % MAX_MOUSEPOINTS))
#define NEXTPOINT(i)   ((i + 1) % MAX_MOUSEPOINTS)
#define NEXTPOINTCOUNT(c)
#define SAVEPOINT(xc, yc, resX, resY, t, e)
#define MAX_STACK_CALLS   8
#define CheckCritIn()
#define CheckDeviceInfoListCritIn()
#define CheckCritInShared()
#define CheckCritOut()
#define CheckDeviceInfoListCritOut()
#define BEGINATOMICCHECK()
#define BEGINATOMICDEVICEINFOLISTCHECK()
#define BeginAtomicCheck()
#define BeginAtomicDeviceInfoListCheck()
#define ENDATOMICCHECK()
#define ENDATOMICDEVICEINFOLISTCHECK()
#define EndAtomicCheck()
#define EndAtomicDeviceInfoListCheck()
#define EXITATOMICCHECK()
#define ISATOMICCHECK()
#define ISATOMICDEVICEINFOLISTCHECK()
#define DIAGNOSE_IO   1
#define LOGTIME(gt)   gt = MonotonicTick();
#define MAXIMUM_ITEMS_READ   10
#define NELEM_BUTTONQUEUE   16
#define MAXIMUM_READ_RETRIES   5
#define DEVICE_TYPE_MOUSE   0
#define DEVICE_TYPE_KEYBOARD   1
#define DEVICE_TYPE_MAX   1
#define GDIAF_ARRIVED   (USHORT)0x0001
#define GDIAF_QUERYREMOVE   (USHORT)0x0002
#define GDIAF_REMOVECANCELLED   (USHORT)0x0004
#define GDIAF_DEPARTED   (USHORT)0x0008
#define GDIAF_IME_STATUS   (USHORT)0x0010
#define GDIAF_REFRESH_MOUSE   (USHORT)0x0020
#define GDIAF_FREEME   (USHORT)0x0080
#define GDIAF_PNPWAITING   (USHORT)0x0100
#define GDIAF_RETRYREAD   (USHORT)0x0200
#define GDIAF_RECONNECT   (USHORT)0x0400
#define GDIF_NOTPNP   0x01
#define GDIF_READING   0x02
#define GDIF_READERMUSTFREE   0x04
#define GDIF_PNPMUSTFREE   0x08
#define GDIF_DBGREAD   0x10
#define TEST_GTERMF(f)   TEST_FLAG(gdwGTERMFlags, f)
#define TEST_BOOL_GTERMF(f)   TEST_BOOL_FLAG(gdwGTERMFlags, f)
#define SET_GTERMF(f)   SET_FLAG(gdwGTERMFlags, f)
#define CLEAR_GTERMF(f)   CLEAR_FLAG(gdwGTERMFlags, f)
#define SET_OR_CLEAR_GTERMF(f, fSet)   SET_OR_CLEAR_FLAG(gdwGTERMFlags, f, fSet)
#define TOGGLE_GTERMF(f)   TOGGLE_FLAG(gdwGTERMFlags, f)
#define GTERMF_MOUSE   0x00000001
#define TERMF_INITIALIZED   0x00000001
#define TERMF_NOIO   0x00000002
#define TERMF_STOPINPUT   0x00000004
#define TERMF_DTINITSUCCESS   0x00000008
#define TERMF_DTINITFAILED   0x00000010
#define TERMF_DTDESTROYED   0x00000020
#define DEFINE_POOLTAG(value, index)   value
#define DECLARE_POOLTAG(name, value, index)
#define IsValidTag(p, tag)   TRUE
#define RECORD_STACK_TRACE_SIZE   6
#define POOL_HEAVY_ALLOCS   0x00000001
#define POOL_CAPTURE_STACK   0x00000002
#define POOL_FAIL_ALLOCS   0x00000004
#define POOL_FAIL_BY_INDEX   0x00000008
#define POOL_TAIL_CHECK   0x00000010
#define POOL_KEEP_FREE_RECORD   0x00000020
#define POOL_KEEP_FAIL_RECORD   0x00000040
#define POOL_BREAK_FOR_LEAKS   0x00000080
#define CleanupPoolAllocations()
#define InitPoolLimitations()
#define CleanUpPoolLimitations()
#define InitSectionTrace()
#define CleanUpSections()
#define CXYDESKPATTERN   8
#define CheckHwnd(x)   TRUE
#define CheckHwndNull(x)   TRUE
#define VALIDATECLASSANDSIZE(pwnd, message, wParam, lParam, inFNID, initmessage)
#define CopyRgn(hrgnDst, hrgnSrc)   GreCombineRgn(hrgnDst, hrgnSrc, NULL, RGN_COPY)
#define IntersectRgn(hrgnResult, hrgnA, hrgnB)   GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND)
#define SubtractRgn(hrgnResult, hrgnA, hrgnB)   GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF)
#define UnionRgn(hrgnResult, hrgnA, hrgnB)   GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR)
#define XorRgn(hrgnResult, hrgnA, hrgnB)   GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR)
#define IDC_DEFAULT   0x0001
#define IDC_CHILDRENONLY   0x0002
#define IDC_CLIENTONLY   0x0004
#define IDC_MOVEBLT   0x0008
#define IDC_NOMOUSE   0x0010
#define RSPB_NO_INVALIDATE   0
#define RSPB_INVALIDATE   1
#define RSPB_INVALIDATE_SSB   2
#define SCMS_FLAGS_ANSI   0x0001
#define SCMS_FLAGS_INONLY   0x0002
#define CallClientProcA(pwnd, msg, wParam, lParam, xpfn)
#define CallClientProcW(pwnd, msg, wParam, lParam, xpfn)
#define CallClientWorkerProc(pwnd, msg, wParam, lParam, xpfn)   SfnDWORD(pwnd, msg, wParam, lParam, 0, xpfn, TRUE, NULL)
#define ScSendMessageSMS(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms)
#define ScSendMessage(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags)   ScSendMessageSMS(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, NULL)
#define SERVERSTRINGMAXSIZE   40
#define ServerLoadString(hmod, id, p, cch)   RtlLoadStringOrError(id, p, cch, 0)
#define ServerLoadStringEx(hmod, id, p, cch, wLang)   RtlLoadStringOrError(id, p, cch, wLang)
#define AW_USE   1
#define AW_TRY   2
#define AW_SKIP   3
#define AW_TRY2   4
#define AW_SKIP2   5 /* used internally in xxxActivateWindow() */
#define AW_USE2   6 /* nc mouse activation added by craigc */
#define GETDESKINFO(pti)   ((pti)->pDeskInfo)
#define SET_TIME_LAST_READ(pti)   ((pti)->pcti->timeLastRead = NtGetTickCount())
#define GET_TIME_LAST_READ(pti)   ((pti)->pcti->timeLastRead)
#define abs(A)   (((A) < 0)? -(A) : (A))
#define N_ELEM(a)   (sizeof(a)/sizeof(a[0]))
#define LAST_ELEM(a)   ( (a) [ N_ELEM(a) - 1 ] )
#define PLAST_ELEM(a)   (&LAST_ELEM(a))
#define RETURN_IF_ACCESS_DENIED(amGranted, amRequested, r)   if (!CheckGrantedAccess((amGranted), (amRequested))) return r
#define LOCKRECORD_STACK   8
#define LOCKRECORD_MARKDESTROY   IntToPtr( 0xFFFFFFFF )
#define KERNEL_STACK_MINIMUM_RESERVE   (4*1024)
#define NEEDSSYNCPAINT(pwnd)   TestWF(pwnd, WFSENDERASEBKGND | WFSENDNCPAINT)
#define RE_VISNEW   0x0001
#define RE_VISOLD   0x0002
#define RE_VALID   0x0004
#define RE_INVALID   0x0008
#define RE_SPB   0x0010
#define RE_VALIDSUM   0x0020
#define RE_INVALIDSUM   0x0040
#define THREADS_PER_TLBLOCK   16
#define KL_UNLOADED   0x20000000
#define KL_RESET   0x40000000
#define KLT_ALT   1
#define KLT_LEFTSHIFT   2
#define KLT_ALTLEFTSHIFT   3
#define KLT_RIGHTSHIFT   4
#define KLT_ALTRIGHTSHIFT   5
#define KLT_ALTBOTHSHIFTS   7
#define KLT_NONE   8
#define DF_DYING   0x80000000
#define DF_DESKWNDDESTROYED   0x40000000
#define DF_DESTROYED   0x20000000
#define DF_HOTTRACKING   0x10000000
#define DF_TOOLTIPSHOWING   0x08000000
#define DF_TOOLTIPACTIVE   0x04000000
#define DF_TOOLTIP   (DF_TOOLTIPACTIVE | DF_TOOLTIPSHOWING)
#define DF_TRACKMOUSELEAVE   0x02000000
#define DF_TRACKMOUSEHOVER   0x01000000
#define DF_TRACKMOUSEEVENT   (DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER)
#define DF_MOUSEMOVETRK   (DF_HOTTRACKING | DF_TOOLTIPACTIVE | DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER)
#define DF_MENUINUSE   0x00800000
#define DF_NEWDISPLAYSETTINGS   0x00400000
#define DF_DESKCREATED   0x00200000
#define CAPTIONTOOLTIPLEN   100
#define GW_DESKTOP_ID   1
#define DESKTOP_ALLOC_TRACE_SIZE   6
#define DTAG_CLASS   0x0001
#define DTAG_DESKTOPINFO   0x0002
#define DTAG_CLIENTTHREADINFO   0x0003
#define DTAG_TEXT   0x0004
#define DTAG_HANDTABL   0x0005
#define DTAG_SBINFO   0x0006
#define DTAG_MENUITEM   0x0007
#define DTAG_MENUTEXT   0x0008
#define DTAG_IMETEXT   0x0009
#define DTAG_PROPLIST   0x000A
#define DesktopAllocAlways(pdesk, uSize, tag)   Win32HeapAlloc(pdesk->pheapDesktop, uSize, tag, 0)
#define DesktopFree(pdesk, p)   Win32HeapFree(pdesk->pheapDesktop, p)
#define WSF_SWITCHLOCK   0x0001
#define WSF_OPENLOCK   0x0002
#define WSF_NOIO   0x0004
#define WSF_SHUTDOWN   0x0008
#define WSF_DYING   0x0010
#define WSF_REALSHUTDOWN   0x0020
#define SYSICO(name)   (gasysico[OIC_##name##_DEFAULT - OIC_FIRST_DEFAULT].spcur)
#define SYSCUR(name)   (gasyscur[OCR_##name##_DEFAULT - OCR_FIRST_DEFAULT].spcur)
#define PWNDDESKTOP(p)   ((p)->head.rpdesk->pDeskInfo->spwnd)
#define PWNDMESSAGE(p)   ((p)->head.rpdesk->spwndMessage)
#define PWNDTOOLTIP(p)   ((p)->head.rpdesk->spwndTooltip)
#define PWNDPARENT(p)   (p->spwndParent ? p->spwndParent : PWNDDESKTOP(p))
#define ISAMENU(pwwnd)   (GETFNID(pwnd) == FNID_MENU)
#define dpHorzRes   HORZRES
#define dpVertRes   VERTRES
#define DUMMY_TEXT_HANDLE   0xFFFF
#define DATA_NOT_BANKED   0xFFFF
#define FREEHOLD   0
#define MOUSEHOLD   -1 /* Mouse button held down and dragging */
#define KEYBDHOLD   1
#define QEVENT_SHOWWINDOW   0x0001
#define QEVENT_CANCELMODE   0x0002
#define QEVENT_SETWINDOWPOS   0x0003
#define QEVENT_UPDATEKEYSTATE   0x0004
#define QEVENT_DEACTIVATE   0x0005
#define QEVENT_ACTIVATE   0x0006
#define QEVENT_POSTMESSAGE   0x0007
#define QEVENT_EXECSHELL   0x0008
#define QEVENT_CANCELMENU   0x0009
#define QEVENT_DESTROYWINDOW   0x000A
#define QEVENT_ASYNCSENDMSG   0x000B
#define QEVENT_HUNGTHREAD   0x000C
#define QEVENT_CANCELMOUSEMOVETRK   0x000D
#define QEVENT_NOTIFYWINEVENT   0x000E
#define QEVENT_RITACCESSIBILITY   0x000F
#define QEVENT_RITSOUND   0x0010
#define QEVENT_APPCOMMAND   0x0011
#define RITSOUND_UPSIREN   0x0000
#define RITSOUND_DOWNSIREN   0x0001
#define RITSOUND_LOWBEEP   0x0002
#define RITSOUND_HIGHBEEP   0x0003
#define RITSOUND_KEYCLICK   0x0004
#define RITSOUND_DOBEEP   0x0005
#define PEM_ACTIVATE_RESTORE   0x0001
#define PEM_ACTIVATE_NOZORDER   0x0002
#define DDR_START   0
#define DDR_ENDACCEPT   1
#define DDR_ENDCANCEL   2
#define PSEUDO_EVENT_ON   ((HANDLE)IntToPtr( 0xFFFFFFFF ))
#define PSEUDO_EVENT_OFF   ((HANDLE)IntToPtr( 0x00000000 ))
#define INIT_PSEUDO_EVENT(ph)   *ph = PSEUDO_EVENT_OFF;
#define SET_PSEUDO_EVENT(phE)
#define RESET_PSEUDO_EVENT(phE)
#define CLOSE_PSEUDO_EVENT(phE)
#define POLL_EVENT_CNT   5
#define IEV_IDLE   0
#define IEV_INPUT   1
#define IEV_EXEC   2
#define IEV_TASK   3
#define IEV_WOWEXEC   4
#define TDBF_SETUP   1
#define DTM_SETUPAPPRAN   (WM_USER+90)
#define LINP_KEYBOARD   0x00000001
#define LINP_SCREENSAVER   0x00000002
#define LINP_LOWPOWER   0x00000004
#define LINP_POWEROFF   0x00000008
#define LINP_POWERTIMEOUTS   (LINP_LOWPOWER | LINP_POWEROFF)
#define LINP_INPUTTIMEOUTS   (LINP_SCREENSAVER | LINP_LOWPOWER | LINP_POWEROFF)
#define IS_THREAD_RESTRICTED(pti, r)
#define IS_CURRENT_THREAD_RESTRICTED(r)
#define PWNDTOPSBTRACK(pwnd)   (((GETPTI(pwnd)->pSBTrack)))
#define CLIBS   32
#define GH_SIZE   8
#define JP_DELTA   4
#define LPK_TABBEDTEXTOUT   0x01
#define LPK_PSMTEXTOUT   0x02
#define LPK_DRAWTEXTEX   0x04
#define LPK_EDITCONTROL   0x08
#define LPK_INSTALLED   0x0f
#define CALL_LPK(ptiCurrent)
#define DCE_SIZE_CACHEINIT   5
#define DCE_SIZE_CACHETHRESHOLD   32
#define DCE_RELEASED   0
#define DCE_FREED   1
#define DCE_NORELEASE   2
#define DCUNUSED   0x00 /* Unused cache entry */
#define DCC   0x01 /* Client area */
#define DCW   0x02 /* Window area */
#define DCSAVEDVISRGN   0x04
#define DCCLIPRGN   0x08
#define DCNOCHILDCLIP   0x10 /* Nochildern clip */
#define DCSAVEVIS   0x20 /* Save visrgn before calculating */
#define DCCACHE   0x40
#define BWL_CHWNDINIT   32 /* initial # slots pre-allocated */
#define BWL_CHWNDMORE   8 /* # slots to obtain when required */
#define BWL_ENUMCHILDREN   1
#define BWL_ENUMLIST   2
#define BWL_ENUMOWNERLIST   4
#define BWL_ENUMIMELAST   0x08
#define BWL_REMOVEIMECHILD   0x10
#define SPB_SAVESCREENBITS   0x0001
#define SPB_LOCKUPDATE   0x0002
#define SPB_DRAWBUFFER   0x0004
#define AnySpbs()   (gpDispInfo->pspbFirst != NULL)
#define FJOURNALRECORD()   (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALRECORD + 1] != NULL)
#define FJOURNALPLAYBACK()   (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALPLAYBACK + 1] != NULL)
#define TESTHMODLOADED(pti, x)   ((pti)->ppi->dwhmodLibLoadedMask & (1 << (x)))
#define SETHMODLOADED(pti, x, hmod)
#define CLEARHMODLOADED(pti, x)
#define PFNHOOK(phk)
#define SMF_REPLY   0x0001
#define SMF_RECEIVERDIED   0x0002
#define SMF_SENDERDIED   0x0004
#define SMF_RECEIVERFREE   0x0008
#define SMF_RECEIVEDMESSAGE   0x0010
#define SMF_CB_REQUEST   0x0100
#define SMF_CB_REPLY   0x0200
#define SMF_CB_CLIENT   0x0400
#define SMF_CB_SERVER   0x0800
#define SMF_WOWRECEIVE   0x1000
#define SMF_WOWSEND   0x2000
#define SMF_RECEIVERBUSY   0x4000
#define ISM_CALLBACK   0x0001
#define ISM_TIMEOUT   0x0002
#define ISM_REQUEST   0x0010
#define ISM_REPLY   0x0020
#define ISM_CB_CLIENT   0x0100
#define IsHooked(pti, fsHook)   ((fsHook & (pti->fsHooks | pti->pDeskInfo->fsHooks)) != 0)
#define IsGlobalHooked(pti, fsHook)   ((fsHook & pti->pDeskInfo->fsHooks) != 0)
#define BMSG_SENDMSG   0x0000
#define BMSG_SENDNOTIFYMSG   0x0001
#define BMSG_POSTMSG   0x0002
#define BMSG_SENDMSGCALLBACK   0x0003
#define BMSG_SENDMSGTIMEOUT   0x0004
#define BMSG_SENDNOTIFYMSGPROCESS   0x0005
#define PWND_INPUTOWNER   (PWND)1
#define PWND_FOCUS   (PWND)NULL
#define PWND_ERROR   (PWND)0x10
#define PWND_TOP   (PWND)0
#define PWND_BOTTOM   (PWND)1
#define PWND_GROUPTOTOP   ((PWND)-1)
#define PWND_TOPMOST   ((PWND)-1)
#define PWND_NOTOPMOST   ((PWND)-2)
#define PWND_BROADCAST   ((PWND)-1)
#define IDHOT_DEBUG   (-5)
#define IDHOT_DEBUGSERVER   (-6)
#define IDHOT_WINDOWS   (-7)
#define KEYBOARD_MENU   ((LPARAM)-1)
#define NO_CAP_CLIENT   0 /* no capture; in client area */
#define NO_CAP_SYS   1 /* no capture; in sys area */
#define CLIENT_CAPTURE   2 /* client-relative capture */
#define WINDOW_CAPTURE   3 /* window-relative capture */
#define SCREEN_CAPTURE   4 /* screen-relative capture */
#define FULLSCREEN_CAPTURE   5 /* capture entire machine */
#define CLIENT_CAPTURE_INTERNAL   6 /* client-relative capture (Win 3.1 style; won't release) */
#define CH_HELPPREFIX   0x08
#define xxxRedrawScreen()
#define CCVR_WORKSPACE   4
#define KSPEED_MASK   0x001F
#define KDELAY_MASK   0x0060
#define KDELAY_SHIFT   5
#define PROP_CHECKPOINT   MAKEINTATOM(atomCheckpointProp)
#define PROP_DDETRACK   MAKEINTATOM(atomDDETrack)
#define PROP_QOS   MAKEINTATOM(atomQOS)
#define PROP_DDEIMP   MAKEINTATOM(atomDDEImp)
#define PROP_WNDOBJ   MAKEINTATOM(atomWndObj)
#define PROP_IMELEVEL   MAKEINTATOM(atomImeLevel)
#define PROP_LAYER   MAKEINTATOM(atomLayer)
#define WinFlags   ((WORD)(&__WinFlags))
#define MOUSE_SENSITIVITY_MIN   1
#define MOUSE_SENSITIVITY_DEFAULT   10
#define MOUSE_SENSITIVITY_MAX   20
#define SCANCODE_NUMPAD_PLUS   (0x4e)
#define SCANCODE_NUMPAD_DOT   (0x53)
#define NUMPAD_HEXMODE_LL   (1)
#define NUMPAD_HEXMODE_HL   (2)
#define MODIFIER_FOR_ALT_NUMPAD(wModBit)
#define WOAHACK_CHECKALTKEYSTATE   1
#define WOAHACK_IGNOREALTKEYDOWN   2
#define DSP_ERASE   0x0001
#define DSP_FRAME   0x0002
#define DSP_ENUMCLIPPEDCHILDREN   0x0004
#define DSP_WM_SYNCPAINT   0x0008
#define DSP_NOCHECKPARENTS   0x0010
#define DSP_ALLCHILDREN   0x0020
#define KILLRITTIMER(pwnd, nID)   FindTimer(pwnd, nID, TMRF_RIT, TRUE)
#define DPO   0x00FA0089 /* destination, pattern, or */
#define SMESSAGEPROTO(func)
#define xxxReceiveMessages(pti)   while ((pti)->pcti->fsWakeBits & QS_SENDMESSAGE) { xxxReceiveMessage((pti)); }
#define MINMAX_KEEPHIDDEN   0x1
#define MINMAX_ANIMATE   0x10000
#define WHT_IGNOREDISABLED   0x00000001
#define SFW_STARTUP   0x0001
#define SFW_SWITCH   0x0002
#define SFW_NOZORDER   0x0004
#define SFW_SETFOCUS   0x0008
#define SFW_ACTIVATERESTORE   0x0010
#define ATW_MOUSE   0x0001
#define ATW_SETFOCUS   0x0002
#define ATW_ASYNC   0x0004
#define ATW_NOZORDER   0x0008
#define NTW_PREVIOUS   1
#define NTW_IGNORETOOLWINDOW   2
#define UnlockProcess   ObDereferenceObject
#define UnlockThread   ObDereferenceObject
#define ValidateProcessSessionId(pEProcess)
#define ValidateThreadSessionId(pEThread)
#define DEFAULT_WINSTA   L"\\Windows\\WindowStations\\WinSta0"
#define POBJECT_NAME(pobj)
#define FindClassAtom(lpszClassName)   (IS_PTR(lpszClassName) ? UserFindAtom(lpszClassName) : PTR_TO_ID(lpszClassName))
#define DMI_INVERT   0x00000001
#define DMI_GRAYED   0x00000002
#define MNXBORDER   (SYSMET(CXBORDER) + SYSMET(CXEDGE))
#define MNYBORDER   (SYSMET(CYBORDER) + SYSMET(CYEDGE))
#define MNXSPACE   (SYSMET(CXEDGE))
#define MNLEFTMARGIN   (SYSMET(CXEDGE))
#define MNUS_DEFAULT   0x00000001
#define MNUS_DELETE   0x00000002
#define MNUS_DRAWFRAME   0x00000004
#define MNIS_MEASUREBMP   -1
#define MNSW_RETURNSIZE   0
#define MNSW_SIZE   MNUS_DEFAULT
#define MNSW_DRAWFRAME   MNUS_DRAWFRAME
#define PAS_RIGHT   (TPM_HORPOSANIMATION >> TPM_FIRSTANIBITPOS)
#define PAS_LEFT   (TPM_HORNEGANIMATION >> TPM_FIRSTANIBITPOS)
#define PAS_DOWN   (TPM_VERPOSANIMATION >> TPM_FIRSTANIBITPOS)
#define PAS_UP   (TPM_VERNEGANIMATION >> TPM_FIRSTANIBITPOS)
#define PAS_OUT   0x10
#define PAS_HORZ   (PAS_LEFT | PAS_RIGHT)
#define PAS_VERT   (PAS_UP | PAS_DOWN)
#define CXMENU3DEDGE   1
#define CYMENU3DEDGE   1
#define SCROLL_NORMAL   0
#define SCROLL_DIRECT   1
#define SCROLL_MENU   2
#define Validateppopupmenu(ppopupmenu)
#define MNGetpItemIndex   _MNGetpItemIndex
#define SMS_NOMENU   (PMENU)(-1)
#define NCA_ACTIVE   0x00000001
#define NCA_FORCEFRAMEOFF   0x00000002
#define UPIsDWORDRange(uSetting)   ((uSetting) >= SPI_STARTDWORDRANGE && (uSetting) < SPI_MAXDWORDRANGE)
#define UPDWORDIndex(uSetting)   (1 + (((uSetting) - SPI_STARTDWORDRANGE) / 2))
#define UPIsBOOLRange(uSetting)   ((uSetting) >= SPI_STARTBOOLRANGE && (uSetting) < SPI_MAXBOOLRANGE)
#define UPBOOLIndex(uSetting)   (((uSetting) - SPI_STARTBOOLRANGE) / 2)
#define UPBOOLPointer(pdw, uSetting)   (pdw + (UPBOOLIndex(uSetting) / 32))
#define UPBOOLMask(uSetting)   (1 << (UPBOOLIndex(uSetting) - ((UPBOOLIndex(uSetting) / 32) * 32)))
#define TestUPBOOL(pdw, uSetting)   (*UPBOOLPointer(pdw, uSetting) & UPBOOLMask(uSetting))
#define SetUPBOOL(pdw, uSetting)   (*UPBOOLPointer(pdw, uSetting) |= UPBOOLMask(uSetting))
#define ClearUPBOOL(pdw, uSetting)
#define TestUP(uSetting)   TestUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
#define SetUP(uSetting)   SetUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
#define ClearUP(uSetting)   ClearUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
#define IndexUP(uSetting)   (1 << (((uSetting) - SPI_STARTBOOLRANGE) / 2))
#define TestEffectUP(uSetting)
#define TestEffectInvertUP(uSetting)   (TestUP(uSetting) || !TestUP(UIEFFECTS))
#define PropagetUPBOOLTogpsi(uSetting)
#define UNDERLINE_RECALC   0x7FFFFFFF
#define UnrealizeObject(hbr)   /* NOP for NT */
#define RDW_HASWINDOWRGN   0x8000
#define GETTOPMOSTINSERTAFTER(pwnd)   (gHardErrorHandler.pti == NULL ? NULL : GetTopMostInsertAfter(pwnd))
#define SMIN_CLEAR   0
#define SMIN_SET   1
#define xxxPeekMessage(lpmsg, hwnd, wMsgMin, wMsgMax, wRemoveMsg)   xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, wRemoveMsg, FALSE)
#define xxxGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax)   xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, PM_REMOVE, TRUE)
#define WMSG_MAGIC_VALUE   0xBABE
#define TestRawKeyDown(vk)   TestKeyDownBit(gafRawKeyState, vk)
#define SetRawKeyDown(vk)   SetKeyDownBit(gafRawKeyState, vk)
#define ClearRawKeyDown(vk)   ClearKeyDownBit(gafRawKeyState, vk)
#define TestRawKeyToggle(vk)   TestKeyToggleBit(gafRawKeyState, vk)
#define SetRawKeyToggle(vk)   SetKeyToggleBit(gafRawKeyState, vk)
#define ClearRawKeyToggle(vk)   ClearKeyToggleBit(gafRawKeyState, vk)
#define ToggleRawKeyToggle(vk)   ToggleKeyToggleBit(gafRawKeyState, vk)
#define xxxSetWindowLongPtr   xxxSetWindowLong
#define __GetWindowLong(pwnd, index)   ((LONG)(*(DWORD UNALIGNED *)((BYTE *)((pwnd) + 1) + (index))))
#define __GetWindowLongPtr(pwnd, index)   ((LONG_PTR)(*(ULONG_PTR UNALIGNED *)((BYTE *)((pwnd) + 1) + (index))))
#define _GetWindowLong   __GetWindowLong
#define _GetWindowLongPtr   __GetWindowLongPtr
#define STW_SAME   ((PWND) 1)
#define FDoTray()   (SYSMET(ARRANGE) & ARW_HIDE)
#define FCallHookTray()   (IsHooked(PtiCurrent(), WHF_SHELL))
#define FPostTray(p)   (p->pDeskInfo->spwndTaskman)
#define FCallTray(p)   (FDoTray() && ( FCallHookTray()|| FPostTray(p) ))
#define FTopLevel(pwnd)   (pwnd->spwndParent == PWNDDESKTOP(pwnd))
#define FHas31TrayStyles(pwnd)
#define xxxSetScrollInfo(a, b, c, d)   xxxSetScrollBar((a),(b),(c),(d))
#define LockQCursor(pq, pcur)   Lock(&pq->spcurCurrent, pcur)
#define GETPCI(pcur)   ((PCURSINFO)&(pcur->CI_FIRST))
#define DbgValidateHooks(phk, iType)
#define CXF_IS_SERVER   0x0001
#define CXF_TERMINATE_POSTED   0x0002
#define CXF_PARTNER_WINDOW_DIED   0x0004
#define CXF_INTRA_PROCESS   0x8000
#define xxxSetClassLongPtr   xxxSetClassLong
#define ACTIVATE_ARRAY_SIZE   5
#define WHERE_NOONE_CAN_SEE_ME   ((int) -32000)
#define OCR_APPSTARTING   32650
#define WEF_USEPWNDTHREAD   0x0001
#define WEF_DEFERNOTIFY   0x0002
#define WEF_ASYNC   0x0004
#define WEF_POSTED   0x0008
#define DeferWinEventNotify()
#define IsWinEventNotifyDeferred()   (gdwDeferWinEvent > 0)
#define IsWinEventNotifyDeferredOK()   (!IsWinEventNotifyDeferred() || ISATOMICCHECK())
#define zzzEndDeferWinEventNotify()
#define EndDeferWinEventNotifyWithoutProcessing()
#define zzzWindowEvent(event, pwnd, idObject, idChild, dwFlags)
#define LANGTOGGLEKEYS_SIZE   3
#define ACCF_DEFAULTFILTERKEYSON   0x00000001
#define ACCF_DEFAULTSTICKYKEYSON   0x00000002
#define ACCF_DEFAULTMOUSEKEYSON   0x00000004
#define ACCF_DEFAULTTOGGLEKEYSON   0x00000008
#define ACCF_DEFAULTTIMEOUTON   0x00000010
#define ACCF_DEFAULTKEYBOARDPREF   0x00000020
#define ACCF_DEFAULTSCREENREADER   0x00000040
#define ACCF_DEFAULTHIGHCONTRASTON   0x00000080
#define ACCF_ACCESSENABLED   0x00000100
#define ACCF_IGNOREBREAKCODE   0x00000400
#define ACCF_FKMAKECODEPROCESSED   0x00000800
#define ACCF_MKVIRTUALMOUSE   0x00001000
#define ACCF_MKREPEATVK   0x00002000
#define ACCF_FIRSTTICK   0x00004000
#define ACCF_SHOWSOUNDSON   0x00008000
#define PUDF_ANIMATE   0x00010000
#define ACCF_KEYBOARDPREF   0x00020000
#define ACCF_SCREENREADER   0x00040000
#define PUDF_BEEP   0x00080000 /* Warning beeps allowed? */
#define PUDF_EXTENDEDSOUNDS   0x00100000 /* Extended sounds enabling */
#define PUDF_DRAGFULLWINDOWS   0x00200000 /* Drag xor rect or full windows */
#define PUDF_ICONTITLEWRAP   0x00400000 /* Wrap icon titles or just use single line */
#define PUDF_FONTSARELOADED   0x00800000
#define PUDF_POPUPINUSE   0x01000000
#define PUDF_MENUSTATEINUSE   0x02000000
#define PUDF_VDMBOUNDSACTIVE   0x04000000
#define PUDF_ALLOWFOREGROUNDACTIVATE   0x08000000
#define PUDF_DRAGGINGFULLWINDOW   0x10000000
#define PUDF_LOCKFULLSCREEN   0x20000000
#define PUDF_GSMWPINUSE   0x40000000
#define TEST_ACCF(f)   TEST_FLAG(gdwPUDFlags, f)
#define TEST_BOOL_ACCF(f)   TEST_BOOL_FLAG(gdwPUDFlags, f)
#define SET_ACCF(f)   SET_FLAG(gdwPUDFlags, f)
#define CLEAR_ACCF(f)   CLEAR_FLAG(gdwPUDFlags, f)
#define SET_OR_CLEAR_ACCF(f, fSet)   SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet)
#define TOGGLE_ACCF(f)   TOGGLE_FLAG(gdwPUDFlags, f)
#define TEST_PUDF(f)   TEST_FLAG(gdwPUDFlags, f)
#define TEST_BOOL_PUDF(f)   TEST_BOOL_FLAG(gdwPUDFlags, f)
#define SET_PUDF(f)   SET_FLAG(gdwPUDFlags, f)
#define CLEAR_PUDF(f)   CLEAR_FLAG(gdwPUDFlags, f)
#define SET_OR_CLEAR_PUDF(f, fSet)   SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet)
#define TOGGLE_PUDF(f)   TOGGLE_FLAG(gdwPUDFlags, f)
#define POWERON_PHASE   -1
#define LOWPOWER_PHASE   1
#define POWEROFF_PHASE   2
#define TestALPHA(uSetting)   (!gbDisableAlpha && TestEffectUP(uSetting))
#define HTEXSCROLLFIRST   60
#define HTSCROLLUP   60
#define HTSCROLLDOWN   61
#define HTSCROLLUPPAGE   62
#define HTSCROLLDOWNPAGE   63
#define HTSCROLLTHUMB   64
#define HTEXSCROLLLAST   64
#define HTEXMENUFIRST   65
#define HTMDISYSMENU   65
#define HTMDIMAXBUTTON   66
#define HTMDIMINBUTTON   67
#define HTMDICLOSE   68
#define HTMENUITEM   69
#define HTEXMENULAST   69
#define SHRSTR(ppi, s)   SharedRebaseToClient(ppi, gpsi->s)
#define STR_COLORSTART   STR_SCROLLBAR
#define STR_COLOREND   STR_GRADIENTINACTIVECAPTION
#define FADE_SHOW   0x00000001
#define FADE_COMPLETED   0x00000002
#define FADE_SHOWN   0x00000004
#define FADE_WINDOW   0x00000008
#define FADE_MENU   0x00000010
#define FADE_TOOLTIP   0x00000020
#define INITIAL_USER_HANDLE_QUOTA   10000
#define MINIMUM_USER_HANDLE_QUOTA   200
#define INITIAL_POSTMESSAGE_LIMIT   10000
#define MINIMUM_POSTMESSAGE_LIMIT   4000
#define PMAP_COLORS   0
#define PMAP_CURSORS   1
#define PMAP_WINDOWSM   2
#define PMAP_WINDOWSU   3
#define PMAP_DESKTOP   4
#define PMAP_ICONS   5
#define PMAP_FONTS   6
#define PMAP_TRUETYPE   7
#define PMAP_KBDLAYOUT   8
#define PMAP_INPUT   9
#define PMAP_COMPAT   10
#define PMAP_SUBSYSTEMS   11
#define PMAP_BEEP   12
#define PMAP_MOUSE   13
#define PMAP_KEYBOARD   14
#define PMAP_STICKYKEYS   15
#define PMAP_KEYBOARDRESPONSE   16
#define PMAP_MOUSEKEYS   17
#define PMAP_TOGGLEKEYS   18
#define PMAP_TIMEOUT   19
#define PMAP_SOUNDSENTRY   20
#define PMAP_SHOWSOUNDS   21
#define PMAP_AEDEBUG   22
#define PMAP_NETWORK   23
#define PMAP_METRICS   24
#define PMAP_UKBDLAYOUT   25
#define PMAP_UKBDLAYOUTTOGGLE   26
#define PMAP_WINLOGON   27
#define PMAP_KEYBOARDPREF   28
#define PMAP_SCREENREADER   29
#define PMAP_HIGHCONTRAST   30
#define PMAP_IMECOMPAT   31
#define PMAP_IMM   32
#define PMAP_POOLLIMITS   33
#define PMAP_COMPAT32   34
#define PMAP_SETUPPROGRAMNAMES   35
#define PMAP_INPUTMETHOD   36
#define PMAP_COMPAT2   37
#define PMAP_MOUCLASS_PARAMS   38
#define PMAP_KBDCLASS_PARAMS   39
#define PMAP_LAST   39
#define MAXPROFILEBUF   256
#define POLICY_NONE   0x0001
#define POLICY_USER   0x0002
#define POLICY_MACHINE   0x0004
#define POLICY_ALL   (POLICY_NONE | POLICY_USER | POLICY_MACHINE)
#define BORDER_EXTRA   3
#define DBGIncModalMenuCount()
#define DBGDecModalMenuCount()
#define UP(uSetting)   UPDWORDValue(SPI_GET ## uSetting)
#define IMESHOWSTATUS_NOTINITIALIZED   ((BOOL)0xffff)
#define IsWndImeRelated(pwnd)
#define HF_DESKTOPHOOK   0
#define HF_PROTECTED   1
#define HF_LIMIT   2
#define HMONITOR_PRIMARY   ((HMONITOR)0x00010000)
#define REBASESHAREDPTR(p)   (p)
#define REBASESHAREDPTRALWAYS(p)   (p)
#define REMOVE_FROM_LIST(type, pstart, pitem, next)
#define HH_DRIVERENTRY   0x00000001
#define HH_USERINITIALIZE   0x00000002
#define HH_INITVIDEO   0x00000004
#define HH_REMOTECONNECT   0x00000008
#define HH_REMOTEDISCONNECT   0x00000010
#define HH_REMOTERECONNECT   0x00000020
#define HH_REMOTELOGOFF   0x00000040
#define HH_DRIVERUNLOAD   0x00000080
#define HH_GRECLEANUP   0x00000100
#define HH_USERKCLEANUP   0x00000200
#define HH_INITIATEWIN32KCLEANUP   0x00000400
#define HH_ALLDTGONE   0x00000800
#define HH_RITGONE   0x00001000
#define HH_RITCREATED   0x00002000
#define HH_LOADCURSORS   0x00004000
#define HH_KBDLYOUTGLOBALCLEANUP   0x00008000
#define HH_KBDLYOUTFREEWINSTA   0x00010000
#define HH_CLEANUPRESOURCES   0x00020000
#define HH_DISCONNECTDESKTOP   0x00040000
#define HH_DTQUITPOSTED   0x00080000
#define HYDRA_HINT(ev)   (gdwHydraHint |= ev)
#define DbgTrackAddDesktop(pdesk)
#define DbgTrackRemoveDesktop(pdesk)
#define DbgDumpTrackedDesktops(b)
#define TRACE_HYDAPI(m)
#define TRACE_DESKTOP(m)
#define TRACE_RIT(m)

Typedefs

typedef tagEVENTHOOKPEVENTHOOK
typedef tagNOTIFYPNOTIFY
typedef tagPERFINFO PERFHANDLEINFO
typedef tagPERFINFOPPERFHANDLEINFO
typedef _HANDLEPAGE HANDLEPAGE
typedef _HANDLEPAGEPHANDLEPAGE
typedef tagWPINFO WPINFO
typedef tagCRITSTACK CRITSTACK
typedef tagCRITSTACKPCRITSTACK
typedef tagGENERIC_DEVICE_INFO GENERIC_DEVICE_INFO
typedef tagGENERIC_DEVICE_INFOPGENERIC_DEVICE_INFO
typedef tagMOUSE_DEVICE_INFO MOUSE_DEVICE_INFO
typedef tagMOUSE_DEVICE_INFOPMOUSE_DEVICE_INFO
typedef tagKEYBOARD_DEVICE_INFO KEYBOARD_DEVICE_INFO
typedef tagKEYBOARD_DEVICE_INFOPKEYBOARD_DEVICE_INFO
typedef tagDEVICEINFO DEVICEINFO
typedef tagDEVICEINFOPDEVICEINFO
typedef tagDEVICE_TEMPLATE DEVICE_TEMPLATE
typedef tagDEVICE_TEMPLATEPDEVICE_TEMPLATE
typedef tagMOUSEEVENT MOUSEEVENT
typedef tagMOUSEEVENTPMOUSEEVENT
typedef tagHARDERRORHANDLER HARDERRORHANDLER
typedef tagHARDERRORHANDLERPHARDERRORHANDLER
typedef tagTERMINAL TERMINAL
typedef tagTERMINALPTERMINAL
typedef tagWin32AllocStats Win32AllocStats
typedef tagWin32AllocStatsPWin32AllocStats
typedef tagPOOLRECORD POOLRECORD
typedef tagPOOLRECORDPPOOLRECORD
typedef tagAAS AAS
typedef _LOCKRECORD LOCKRECORD
typedef _LOCK LOCK
typedef _LOCKPLOCK
typedef tagCVR CVR
typedef tagCVRPCVR
typedef tagSMWP SMWP
typedef tagSMWPPSMWP
typedef tagCLIPDATA CLIPDATA
typedef tagCLIPDATAPCLIPDATA
typedef tagUSERSTARTUPINFO USERSTARTUPINFO
typedef tagUSERSTARTUPINFOPUSERSTARTUPINFO
typedef tagTLBLOCK TLBLOCK
typedef tagTLBLOCKPTLBLOCK
typedef tagKBDFILE KBDFILE
typedef tagKBDFILEPKBDFILE
typedef tagKL KL
typedef tagKLPKL
typedef tagKBDLANGTOGGLE KBDLANGTOGGLE
typedef tagDESKTOP DESKTOP
typedef tagDESKWND DESKWND
typedef tagDESKWNDPDESKWND
typedef tagWINDOWSTATION WINDOWSTATION
typedef tagCAPTIONCACHE CAPTIONCACHE
typedef tagSYSCFGICO SYSCFGICO
typedef tagACCELTABLE ACCELTABLE
typedef tagACCELTABLELPACCELTABLE
typedef tagPOPUPMENU POPUPMENU
typedef tagMENUWND MENUWND
typedef tagMENUWNDPMENUWND
typedef tagCHECKPOINT CHECKPOINT
typedef tagCHECKPOINTPCHECKPOINT
typedef tagCLIP CLIP
typedef tagCLIPPCLIP
typedef tagSVR_INSTANCE_INFO SVR_INSTANCE_INFO
typedef tagSVR_INSTANCE_INFOPSVR_INSTANCE_INFO
typedef tagPUBOBJ PUBOBJ
typedef tagPUBOBJPPUBOBJ
typedef tagQMSG QMSG
typedef _MOVESIZEDATA MOVESIZEDATA
typedef _MOVESIZEDATAPMOVESIZEDATA
typedef tagMLIST MLIST
typedef tagMLISTPMLIST
typedef tagQ Q
typedef tagATTACHINFO ATTACHINFO
typedef tagATTACHINFOPATTACHINFO
typedef tagWOWTHREADINFO WOWTHREADINFO
typedef tagWOWTHREADINFOPWOWTHREADINFO
typedef tagTDB TDB
typedef tagMENUANIDC MENUANIDC
typedef tagMENUSTATE MENUSTATE
typedef tagMENUSTATEPMENUSTATE
typedef tagLASTINPUT LASTINPUT
typedef tagLASTINPUT PLASTINPUT
typedef GRAYMENUPGRAYMENU
typedef tagSMS *KPTR_MODIFIER PSMS
typedef tagTHREADINFO THREADINFO
typedef tagWOWPROCESSINFO WOWPROCESSINFO
typedef tagWOWPROCESSINFOPWOWPROCESSINFO
typedef tagDESKTOPVIEW DESKTOPVIEW
typedef tagDESKTOPVIEWPDESKTOPVIEW
typedef tagW32JOB W32JOB
typedef tagW32JOBPW32JOB
typedef tagPROCESSINFO PROCESSINFO
typedef _LPKDRAWSWITCHWND LPKDRAWSWITCHWND
typedef tagDCE DCE
typedef tagBWL BWL
typedef tagBWLPBWL
typedef tagSPB SPB
typedef _CREATESTRUCTEX CREATESTRUCTEX
typedef _CREATESTRUCTEXPCREATESTRUCTEX
typedef _MDICREATESTRUCTEX MDICREATESTRUCTEX
typedef _MDICREATESTRUCTEXPMDICREATESTRUCTEX
typedef _CWPSTRUCTEX CWPSTRUCTEX
typedef _CWPSTRUCTEXPCWPSTRUCTEX
typedef _CWPRETSTRUCTEX CWPRETSTRUCTEX
typedef _CWPRETSTRUCTEXPCWPRETSTRUCTEX
typedef tagSMS SMS
typedef tagINTERSENDMSGEX INTRSENDMSGEX
typedef tagINTERSENDMSGEXPINTRSENDMSGEX
typedef tagASYNCSENDMSG ASYNCSENDMSG
typedef tagASYNCSENDMSGPASYNCSENDMSG
typedef tagHOOKMSGSTRUCT HOOKMSGSTRUCT
typedef tagHOOKMSGSTRUCTPHOOKMSGSTRUCT
typedef tagBROADCASTMSG BROADCASTMSG
typedef tagBROADCASTMSGPBROADCASTMSG
typedef tagHOTKEY HOTKEY
typedef tagHOTKEYPHOTKEY
typedef tagDRAWICONCB DRAWICONCB
typedef tagDRAWICONCBPDRAWICONCB
typedef * PSCANCODEMAP
typedef BITMAPINFOHEADER * PBMPHEADER
typedef BITMAPINFOHEADER * LPBMPHEADER
typedef tagTIMER TIMER
typedef tagTIMERPTIMER
typedef LRESULT(APIENTRY * SFNSCSENDMESSAGE )(PWND, UINT, WPARAM, LPARAM, ULONG_PTR, PROC, DWORD, PSMS)
typedef tagDISPLAYRESOURCE DISPLAYRESOURCE
typedef tagDISPLAYRESOURCEPDISPLAYRESOURCE
typedef tagPROFILEVALUEINFO PROFILEVALUEINFO
typedef tagPROFILEVALUEINFOPPROFILEVALUEINFO
typedef VOID(CALLBACK * MSGWAITCALLBACK )(DWORD DeviceType)
typedef tagFREELIST FREELIST
typedef tagFREELISTPFREELIST
typedef tagDDEIMP DDEIMP
typedef tagDDEIMPPDDEIMP
typedef tagDDECONV DDECONV
typedef tagDDECONVPDDECONV
typedef DWORDFNDDERESPONSE )(PDWORD pmsg, LPARAM *plParam, PDDECONV pDdeConv)
typedef FNDDERESPONSEPFNDDERESPONSE
typedef tagXSTATE XSTATE
typedef tagXSTATEPXSTATE
typedef tagMONITORPOS MONITORPOS
typedef tagMONITORPOSPMONITORPOS
typedef tagMONITORRECTS MONITORRECTS
typedef tagMONITORRECTSPMONITORRECTS
typedef tagEVENTHOOK EVENTHOOK
typedef tagNOTIFY NOTIFY
typedef HWND * PHWND
typedef tagSwitchWndInfo SWITCHWNDINFO
typedef tagSwitchWndInfoPSWINFO
typedef tagSWITCHWND SWITCHWND
typedef tagSWITCHWNDPSWITCHWND
typedef tagHOTKEYSTRUCT HOTKEYSTRUCT
typedef tagHOTKEYSTRUCTPHOTKEYSTRUCT
typedef tagPOWERSTATE POWERSTATE
typedef tagPOWERSTATEPPOWERSTATE
typedef tagFADE FADE
typedef tagFADEPFADE
typedef tagTOOLTIP TOOLTIP
typedef tagTOOLTIPWND TOOLTIPWND
typedef tagTOOLTIPWNDPTOOLTIPWND
typedef tagPROFINTINFO PROFINTINFO
typedef tagPROFINTINFOPPROFINTINFO

Functions

NTSTATUS OpenEffectiveToken (PHANDLE phToken)
NTSTATUS GetProcessLuid (PETHREAD Thread OPTIONAL, PLUID LuidProcess)
BOOLEAN IsRestricted (PETHREAD Thread)
NTSTATUS CreateSystemThread (PKSTART_ROUTINE lpThreadAddress, PVOID pvContext, PHANDLE phThread)
NTSTATUS InitSystemThread (PUNICODE_STRING pstrThreadName)
PKEVENT CreateKernelEvent (IN EVENT_TYPE Type, IN BOOLEAN State)
NTSTATUS ProtectHandle (IN HANDLE Handle, IN BOOLEAN Protect)
VOID __inline FreeKernelEvent (PVOID *pp)
BOOL HMInitHandleTable (PVOID pBase)
PVOID HMAllocObject (PTHREADINFO pti, PDESKTOP pdesk, BYTE btype, DWORD size)
BOOL HMFreeObject (PVOID pobj)
BOOL HMMarkObjectDestroy (PVOID pobj)
BOOL HMDestroyObject (PVOID pobj)
PVOID FASTCALL HMAssignmentLock (PVOID *ppobj, PVOID pobj)
PVOID FASTCALL HMAssignmentUnlock (PVOID *ppobj)
NTSTATUS HMGetStats (HANDLE hProcess, int iPidType, PVOID pResults, UINT cjResultSize)
HANDLE KernelPtoH (PVOID pObj)
void HMDestroyUnlockedObject (PHE phe)
void HMCleanupGrantedHandle (HANDLE h)
PVOID HMUnlockObjectInternal (PVOID pobj)
VOID HMChangeOwnerThread (PVOID pobj, PTHREADINFO pti)
VOID HMChangeOwnerPheProcess (PHE phe, PTHREADINFO pti)
PVOID __inline ThreadLockExchange (PVOID pobj, PTL ptl)
PVOID __inline ThreadLockExchangeAlways (PVOID pobj, PTL ptl)
PVOID ThreadUnlock1 (VOID)
VOID LockObjectAssignment (PVOID *, PVOID)
VOID UnlockObjectAssignment (PVOID *)
VOID UserDereferenceObject (PVOID pobj)
void CleanupDecSFWLockCount (PVOID pIgnore)
ULONG MonotonicTick ()
VOID ProcessKeyboardInput (PDEVICEINFO pDeviceInfo)
VOID ProcessMouseInput (PDEVICEINFO pDeviceInfo)
VOID RequestDeviceChange (PDEVICEINFO pDeviceInfo, USHORT usAction, BOOL fInDeviceInfoListCrit)
VOID RetryReadInput ()
VOID NTAPI InputApc (IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
ULONG GetDeviceChangeInfo (VOID)
VOID InitializeMediaChange (HANDLE)
NTSTATUS UserCommitDesktopMemory (PVOID pBase, PVOID *ppCommit, PSIZE_T pCommitSize)
NTSTATUS UserCommitSharedMemory (PVOID pBase, PVOID *ppCommit, PSIZE_T pCommitSize)
PWIN32HEAP UserCreateHeap (HANDLE hSection, ULONG ulViewOffset, PVOID pvBaseAddress, DWORD dwSize, PRTL_HEAP_COMMIT_ROUTINE pfnCommit)
PVOID __inline SharedAlloc (ULONG cb)
BOOL __inline SharedFree (PVOID pv)
NTSTATUS CommitReadOnlyMemory (HANDLE hSection, PSIZE_T pulCommit, DWORD dwCommitOffset, int *pdCommit)
void DeleteMaybeSpecialRgn (HRGN hrgn)
BOOL zzzInvalidateDCCache (PWND pwndInvalid, DWORD flags)
void RtlInitUnicodeStringOrId (PUNICODE_STRING pstrName, LPWSTR lpstrName)
int RtlLoadStringOrError (UINT, LPTSTR, int, WORD)
HANDLE xxxClientLoadImage (PUNICODE_STRING pstrName, ATOM atomModName, WORD wImageType, int cxSize, int cySize, UINT LR_flags, BOOL fWallpaper)
HANDLE xxxClientCopyImage (IN HANDLE hImage, IN UINT uImageType, IN int cxDesired, IN int cyDesired, IN UINT LR_flags)
PMENU xxxClientLoadMenu (HANDLE hmod, PUNICODE_STRING pstrName)
int xxxClientAddFontResourceW (PUNICODE_STRING, DWORD, DESIGNVECTOR *)
VOID ClientFontSweep (VOID)
VOID ClientLoadLocalT1Fonts ()
VOID ClientLoadRemoteT1Fonts ()
NTSTATUS InitializeClientPfnArrays (CONST PFNCLIENT *ppfnClientA, CONST PFNCLIENT *ppfnClientW, CONST PFNCLIENTWORKER *ppfnClientWorker, HANDLE hModUser)
VOID _SetRipFlags (DWORD, DWORD)
VOID _SetDbgTag (int, DWORD)
BOOL xxxActivateApp (PWND pwnd, AAS *paas)
void DestroySMWP (PSMWP psmwp)
PKL HKLtoPKL (PTHREADINFO pti, HKL hkl)
PVOID DesktopAlloc (PDESKTOP pdesk, UINT uSize, DWORD tag)
DWORD WaitOnPseudoEvent (HANDLE *phE, DWORD dwMilliseconds)
VOID xxxInternalKeyEventDirect (BYTE bVk, WORD wScan, DWORD dwFlags, DWORD dwTime, ULONG_PTR dwExtraInfo)
UINT xxxSendInput (UINT nInputs, LPINPUT pInputs)
BOOL _BlockInput (BOOL fBlockIt)
int _GetMouseMovePointsEx (CONST MOUSEMOVEPOINT *ppt, MOUSEMOVEPOINT *pptBuf, UINT nPoints, DWORD resolution)
VOID xxxProcessKeyEvent (PKE pke, ULONG_PTR ExtraInformation, BOOL bInjected)
VOID xxxButtonEvent (DWORD ButtonNumber, POINT ptPointer, BOOL fBreak, DWORD time, ULONG_PTR ExtraInfo, BOOL bInjected, BOOL fDblClk)
VOID xxxMoveEvent (LONG dx, LONG dy, DWORD dwFlags, ULONG_PTR dwExtraInfo, DWORD time, BOOL bInjected)
PDEVICEINFO StartDeviceRead (PDEVICEINFO pDeviceInfo)
NTSTATUS DeviceNotify (IN PPLUGPLAY_NOTIFY_HDR pNotification, IN PDEVICEINFO pDeviceInfo)
LONG CalculateMouseSensitivity (LONG lSens)
PDEVICEINFO FreeDeviceInfo (PDEVICEINFO pMouseInfo)
VOID QueueMouseEvent (USHORT ButtonFlags, USHORT ButtonData, ULONG_PTR ExtraInfo, POINT ptMouse, LONG time, BOOL bInjected, BOOL bWakeRIT)
BOOL UnqueueMouseEvent (PMOUSEEVENT pme)
BYTE VKFromVSC (PKE pke, BYTE bPrefix, LPBYTE afKeyState)
BOOL KEOEMProcs (PKE pke)
BOOL xxxKELocaleProcs (PKE pke)
BOOL xxxKENLSProcs (PKE pke, ULONG_PTR dwExtraInformation)
VOID xxxKeyEvent (USHORT usVk, WORD wScanCode, DWORD time, ULONG_PTR ExtraInfo, BOOL bInjected)
void xxxSimpleDoSyncPaint (PWND pwnd)
VOID xxxDoSyncPaint (PWND pwnd, DWORD flags)
void xxxInternalDoSyncPaint (PWND pwnd, DWORD flags)
BOOL xxxDrawAnimatedRects (PWND pwndClip, int idAnimation, LPRECT lprcStart, LPRECT lprcEnd)
UINT_PTR InternalSetTimer (PWND pwnd, UINT_PTR nIDEvent, UINT dwElapse, TIMERPROC_PWND pTimerFunc, UINT flags)
VOID FreeTimer (PTIMER ptmr)
 SMESSAGEPROTO (SENTDDEMSG)
 SMESSAGEPROTO (DDEINIT)
 SMESSAGEPROTO (DWORD)
 SMESSAGEPROTO (INWPARAMCHAR)
 SMESSAGEPROTO (INWPARAMDBCSCHAR)
 SMESSAGEPROTO (GETTEXTLENGTHS)
 SMESSAGEPROTO (GETDBCSTEXTLENGTHS)
 SMESSAGEPROTO (INLPCREATESTRUCT)
 SMESSAGEPROTO (INLPDROPSTRUCT)
 SMESSAGEPROTO (INOUTLPPOINT5)
 SMESSAGEPROTO (INOUTLPSCROLLINFO)
 SMESSAGEPROTO (INOUTLPRECT)
 SMESSAGEPROTO (INOUTNCCALCSIZE)
 SMESSAGEPROTO (OUTLPRECT)
 SMESSAGEPROTO (INLPMDICREATESTRUCT)
 SMESSAGEPROTO (INLPCOMPAREITEMSTRUCT)
 SMESSAGEPROTO (INLPDELETEITEMSTRUCT)
 SMESSAGEPROTO (INLPHLPSTRUCT)
 SMESSAGEPROTO (INLPHELPINFOSTRUCT)
 SMESSAGEPROTO (INLPDRAWITEMSTRUCT)
 SMESSAGEPROTO (INOUTLPMEASUREITEMSTRUCT)
 SMESSAGEPROTO (INSTRING)
 SMESSAGEPROTO (INPOSTEDSTRING)
 SMESSAGEPROTO (OUTSTRING)
 SMESSAGEPROTO (INCNTOUTSTRING)
 SMESSAGEPROTO (POUTLPINT)
 SMESSAGEPROTO (POPTINLPUINT)
 SMESSAGEPROTO (INOUTLPWINDOWPOS)
 SMESSAGEPROTO (INLPWINDOWPOS)
 SMESSAGEPROTO (INLBOXSTRING)
 SMESSAGEPROTO (OUTLBOXSTRING)
 SMESSAGEPROTO (INCBOXSTRING)
 SMESSAGEPROTO (OUTCBOXSTRING)
 SMESSAGEPROTO (INOUTDRAG)
 SMESSAGEPROTO (FULLSCREEN)
 SMESSAGEPROTO (INPAINTCLIPBRD)
 SMESSAGEPROTO (INSIZECLIPBRD)
 SMESSAGEPROTO (OUTDWORDDWORD)
 SMESSAGEPROTO (OUTDWORDINDWORD)
 SMESSAGEPROTO (OPTOUTLPDWORDOPTOUTLPDWORD)
 SMESSAGEPROTO (COPYGLOBALDATA)
 SMESSAGEPROTO (COPYDATA)
 SMESSAGEPROTO (INDESTROYCLIPBRD)
 SMESSAGEPROTO (INOUTNEXTMENU)
 SMESSAGEPROTO (INOUTSTYLECHANGE)
 SMESSAGEPROTO (IMAGEIN)
 SMESSAGEPROTO (IMAGEOUT)
 SMESSAGEPROTO (INDEVICECHANGE)
 SMESSAGEPROTO (INOUTMENUGETOBJECT)
 SMESSAGEPROTO (POWERBROADCAST)
 SMESSAGEPROTO (LOGONNOTIFY)
 SMESSAGEPROTO (IMECONTROL)
 SMESSAGEPROTO (IMEREQUEST)
 SMESSAGEPROTO (INLPKDRAWSWITCHWND)
DWORD _GetWindowContextHelpId (PWND pwnd)
BOOL _SetWindowContextHelpId (PWND pwnd, DWORD dwContextId)
void xxxSendHelpMessage (PWND pwnd, int iType, int iCtrlId, HANDLE hItemHandle, DWORD dwContextId)
HPALETTE _SelectPalette (HDC hdc, HPALETTE hpalette, BOOL fForceBackground)
int xxxRealizePalette (HDC hdc)
VOID xxxFlushPalette (PWND pwnd)
VOID xxxBroadcastPaletteChanged (PWND pwnd, BOOL fForceDesktop)
PCURSOR SearchIconCache (PCURSOR pCursorCache, ATOM atomModName, PUNICODE_STRING pstrResName, PCURSOR pCursorSrc, PCURSORFIND pcfSearch)
VOID ZombieCursor (PCURSOR pcur)
BOOL IsSmallerThanScreen (PWND pwnd)
BOOL zzzSetSystemCursor (PCURSOR pcur, DWORD id)
BOOL zzzSetSystemImage (PCURSOR pcur, PCURSOR pcurOld)
BOOL _InternalGetIconInfo (IN PCURSOR pcur, OUT PICONINFO piconinfo, OUT OPTIONAL PUNICODE_STRING pstrModName, OUT OPTIONAL PUNICODE_STRING pstrResName, OUT OPTIONAL LPDWORD pbpp, IN BOOL fInternalCursor)
VOID LinkCursor (PCURSOR pcur)
BOOL _SetCursorIconData (PCURSOR pcur, PUNICODE_STRING pstrModName, PUNICODE_STRING pstrResName, PCURSORDATA pData, DWORD cbData)
PCURSOR _GetCursorFrameInfo (PCURSOR pcur, int iFrame, PJIF pjifRate, LPINT pccur)
PCURSOR _FindExistingCursorIcon (ATOM atomModName, PUNICODE_STRING pstrResName, PCURSOR pcurSrc, PCURSORFIND pcfSearch)
HCURSOR _CreateEmptyCursorObject (BOOL fPublic)
BOOL _GetUserObjectInformation (HANDLE h, int nIndex, PVOID pvInfo, DWORD nLength, LPDWORD lpnLengthNeeded)
BOOL _SetUserObjectInformation (HANDLE h, int nIndex, PVOID pvInfo, DWORD nLength)
DWORD xxxWaitForInputIdle (ULONG_PTR idProcess, DWORD dwMilliseconds, BOOL fSharedWow)
VOID StartScreenSaver (BOOL bOnlyIfSecure)
UINT InternalMapVirtualKeyEx (UINT wCode, UINT wType, PKBDTABLES pKbdTbl)
SHORT InternalVkKeyScanEx (WCHAR cChar, PKBDTABLES pKbdTbl)
PWND ParentNeedsPaint (PWND pwnd)
VOID SetHungFlag (PWND pwnd, WORD wFlag)
VOID ClearHungFlag (PWND pwnd, WORD wFlag)
BOOL _DdeSetQualityOfService (PWND pwndClient, CONST PSECURITY_QUALITY_OF_SERVICE pqosNew, PSECURITY_QUALITY_OF_SERVICE pqosOld)
BOOL _DdeGetQualityOfService (PWND pwndClient, PWND pwndServer, PSECURITY_QUALITY_OF_SERVICE pqos)
BOOL QueryTrackMouseEvent (LPTRACKMOUSEEVENT lpTME)
void CancelMouseHover (PQ pq)
void ResetMouseTracking (PQ pq, PWND pwnd)
void _SetIMEShowStatus (BOOL fShow)
BOOL _GetIMEShowStatus (VOID)
PWND _FindWindowEx (PWND pwndParent, PWND pwndChild, LPCWSTR pszClass, LPCWSTR pszName, DWORD dwType)
UINT APIENTRY GreSetTextAlign (HDC, UINT)
UINT APIENTRY GreGetTextAlign (HDC)
PWND FASTCALL ValidateHwnd (HWND hwnd)
NTSTATUS ValidateHwinsta (HWINSTA, KPROCESSOR_MODE, ACCESS_MASK, PWINDOWSTATION *)
NTSTATUS ValidateHdesk (HDESK, KPROCESSOR_MODE, ACCESS_MASK, PDESKTOP *)
PMENU ValidateHmenu (HMENU hmenu)
PMONITOR ValidateHmonitor (HMONITOR hmonitor)
HRGN UserValidateCopyRgn (HRGN)
BOOL ValidateHandleSecure (HANDLE h)
NTSTATUS UserJobCallout (PKWIN32_JOBCALLOUT_PARAMETERS Parm)
BOOL RemoveProcessFromJob (PPROCESSINFO ppi)
BOOL xxxActivateDebugger (UINT fsModifiers)
void ClientDied (void)
VOID SendMsgCleanup (PTHREADINFO ptiCurrent)
VOID ReceiverDied (PSMS psms, PSMS *ppsmsUnlink)
LRESULT xxxInterSendMsgEx (PWND, UINT, WPARAM, LPARAM, PTHREADINFO, PTHREADINFO, PINTRSENDMSGEX)
VOID ClearSendMessages (PWND pwnd)
PPCLS GetClassPtr (ATOM atom, PPROCESSINFO ppi, HANDLE hModule)
BOOL ReferenceClass (PCLS pcls, PWND pwnd)
VOID DereferenceClass (PWND pwnd)
ULONG_PTR MapClientToServerPfn (ULONG_PTR dw)
VOID xxxReceiveMessage (PTHREADINFO)
PBWL BuildHwndList (PWND pwnd, UINT flags, PTHREADINFO ptiOwner)
VOID FreeHwndList (PBWL pbwl)
PWND xxxMinMaximize (PWND pwnd, UINT cmd, DWORD dwFlags)
void xxxMinimizeHungWindow (PWND pwnd)
VOID xxxInitSendValidateMinMaxInfo (PWND pwnd, LPMINMAXINFO lpmmi)
HRGN CreateEmptyRgn (void)
HRGN CreateEmptyRgnPublic (void)
HRGN SetOrCreateRectRgnIndirectPublic (HRGN *phrgn, LPCRECT lprc)
BOOL SetEmptyRgn (HRGN hrgn)
BOOL SetRectRgnIndirect (HRGN hrgn, LPCRECT lprc)
NTSTATUS xxxRegisterForDeviceClassNotifications ()
BOOL xxxInitInput (PTERMINAL)
VOID InitMice ()
void UpdateMouseInfo (void)
BOOL OpenMouse (PDEVICEINFO pMouseInfo)
void ProcessDeviceChanges (DWORD DeviceType)
PDEVICEINFO CreateDeviceInfo (DWORD DeviceType, PUNICODE_STRING SymbolicLinkName, BYTE bFlags)
void InitKeyboard (void)
UINT xxxHardErrorControl (DWORD, HANDLE, PDESKRESTOREDATA)
VOID SetKeyboardRate (UINT nKeySpeed)
VOID RecolorDeskPattern ()
BOOL xxxInitWindowStation (PWINDOWSTATION)
VOID zzzInternalSetCursorPos (int x, int y)
VOID UpdateKeyLights (BOOL bInjected)
VOID SetDebugHotKeys ()
VOID BoundCursor (LPPOINT lppt)
void DestroyKF (PKBDFILE pkf)
VOID DestroyKL (PKL pkl)
BOOL xxxSetDeskPattern (PUNICODE_STRING pProfileUserName, LPWSTR lpPat, BOOL fCreation)
BOOL xxxSetDeskWallpaper (PUNICODE_STRING pProfileUserName, LPWSTR lpszFile)
HPALETTE CreateDIBPalette (LPBITMAPINFOHEADER pbmih, UINT colors)
BOOL CalcVisRgn (HRGN *hrgn, PWND pwndOrg, PWND pwndClip, DWORD flags)
NTSTATUS xxxCreateThreadInfo (PETHREAD, BOOL)
BOOL DestroyProcessInfo (PW32PROCESS)
VOID xxxDesktopThread (PTERMINAL pTerm)
VOID ForceEmptyClipboard (PWINDOWSTATION)
NTSTATUS zzzInitTask (UINT dwExpWinVer, DWORD dwAppCompatFlags, PUNICODE_STRING pstrModName, PUNICODE_STRING pstrBaseFileName, DWORD hTaskWow, DWORD dwHotkey, DWORD idTask, DWORD dwX, DWORD dwY, DWORD dwXSize, DWORD dwYSize)
VOID DestroyTask (PPROCESSINFO ppi, PTHREADINFO ptiToRemove)
void PostInputMessage (PQ pq, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, DWORD time, ULONG_PTR dwExtraInfo)
BOOL xxxSleepThread (UINT fsWakeMask, DWORD Timeout, BOOL fForegroundIdle)
VOID SetWakeBit (PTHREADINFO pti, UINT wWakeBit)
VOID WakeSomeone (PQ pq, UINT message, PQMSG pqmsg)
VOID ClearWakeBit (PTHREADINFO pti, UINT wWakeBit, BOOL fSysCheck)
NTSTATUS xxxInitProcessInfo (PW32PROCESS)
PTHREADINFO PtiFromThreadId (DWORD idThread)
BOOL zzzAttachThreadInput (PTHREADINFO ptiAttach, PTHREADINFO ptiAttachTo, BOOL fAttach)
BOOL zzzReattachThreads (BOOL fJournalAttach)
PQ AllocQueue (PTHREADINFO, PQ)
VOID FreeQueue (PQ pq)
VOID FreeCachedQueues (VOID)
VOID CleanupGDI (VOID)
VOID CleanupResources (VOID)
void zzzDestroyQueue (PQ pq, PTHREADINFO pti)
PQMSG AllocQEntry (PMLIST pml)
__inline void FreeQEntry (PQMSG pqmsg)
void DelQEntry (PMLIST pml, PQMSG pqmsg)
void zzzAttachToQueue (PTHREADINFO pti, PQ pqAttach, PQ pqJournal, BOOL fJoiningForeground)
VOID xxxProcessEventMessage (PTHREADINFO ptiCurrent, PQMSG pqmsg)
VOID xxxProcessSetWindowPosEvent (PSMWP psmwpT)
VOID xxxProcessAsyncSendMessage (PASYNCSENDMSG pmsg)
BOOL PostEventMessage (PTHREADINFO pti, PQ pq, DWORD dwQEvent, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL DoPaint (PWND pwndFilter, LPMSG lpMsg)
BOOL DoTimer (PWND pwndFilter)
BOOL CheckPwndFilter (PWND pwnd, PWND pwndFilter)
HWND xxxWindowHitTest (PWND pwnd, POINT pt, int *pipos, DWORD dwHitTestFlags)
HWND xxxWindowHitTest2 (PWND pwnd, POINT pt, int *pipos, DWORD dwHitTestFlags)
PWND SpeedHitTest (PWND pwndParent, POINT pt)
VOID xxxDeactivate (PTHREADINFO pti, DWORD tidSetForeground)
BOOL xxxSetForegroundWindow2 (PWND pwnd, PTHREADINFO ptiCurrent, DWORD fFlags)
VOID SetForegroundThread (PTHREADINFO pti)
VOID xxxSendFocusMessages (PTHREADINFO pti, PWND pwndReceive)
BOOL FBadWindow (PWND pwnd)
BOOL xxxActivateThisWindow (PWND pwnd, DWORD tidLoseForeground, DWORD fFlags)
BOOL xxxActivateWindow (PWND pwnd, UINT cmd)
PWND NextTopWindow (PTHREADINFO pti, PWND pwnd, PWND pwndSkip, DWORD flags)
int xxxMouseActivate (PTHREADINFO pti, PWND pwnd, UINT message, WPARAM wParam, LPPOINT lppt, int ht)
int UT_GetParentDCClipBox (PWND pwnd, HDC hdc, LPRECT lprc)
VOID UpdateAsyncKeyState (PQ pq, UINT wVK, BOOL fBreak)
void PostUpdateKeyStateEvent (PQ pq)
void ProcessUpdateKeyStateEvent (PQ pq, CONST PBYTE pbKeyState, CONST PBYTE pbRecentDown)
BOOL InternalSetProp (PWND pwnd, LPWSTR pszKey, HANDLE hData, DWORD dwFlags)
HANDLE InternalRemoveProp (PWND pwnd, LPWSTR pszKey, BOOL fInternal)
VOID DeleteProperties (PWND pwnd)
CHECKPOINTCkptRestore (PWND pwnd, LPCRECT lprcWindow)
UINT_PTR _SetTimer (PWND pwnd, UINT_PTR nIDEvent, UINT dwElapse, TIMERPROC_PWND pTimerFunc)
BOOL KillTimer2 (PWND pwnd, UINT_PTR nIDEvent, BOOL fSystemTimer)
VOID DestroyThreadsTimers (PTHREADINFO pti)
VOID DecTimerCount (PTHREADINFO pti)
VOID zzzInternalShowCaret ()
VOID zzzInternalHideCaret ()
VOID zzzInternalDestroyCaret ()
VOID ChangeAcquireResourceType (VOID)
VOID EnterCrit (VOID)
VOID EnterSharedCrit (VOID)
VOID LeaveCrit (VOID)
VOID _AssertCritIn (VOID)
VOID _AssertDeviceInfoListCritIn (VOID)
VOID _AssertCritInShared (VOID)
VOID _AssertCritOut (VOID)
VOID _AssertDeviceInfoListCritOut (VOID)
NTSTATUS _KeUserModeCallback (IN ULONG ApiNumber, IN PVOID InputBuffer, IN ULONG InputLength, OUT PVOID *OutputBuffer, OUT PULONG OutputLength)
NTSTATUS __inline LockProcessByClientId (HANDLE dwProcessId, PEPROCESS *ppEProcess)
NTSTATUS __inline LockThreadByClientId (HANDLE dwThreadId, PETHREAD *ppEThread)
BOOL IsSAS (BYTE vk, UINT *pfsModifiers)
BOOL xxxDoHotKeyStuff (UINT vk, BOOL fBreak, DWORD fsReserveKeys)
PHOTKEY IsHotKey (UINT fsModifiers, UINT vk)
BOOL InitCreateUserCrit (VOID)
PMDEV InitVideo (BOOL bReenumerationNeeded)
BOOL InitUserScreen ()
VOID InitLoadResources ()
VOID xxxUserResetDisplayDevice ()
PSECURITY_DESCRIPTOR CreateSecurityDescriptor (PACCESS_ALLOWED_ACE paceList, DWORD cbAce, BOOLEAN fDaclDefaulted)
PACCESS_ALLOWED_ACE AllocAce (PACCESS_ALLOWED_ACE pace, BYTE bType, BYTE bFlags, ACCESS_MASK am, PSID psid, LPDWORD lpdwLength)
BOOL CheckGrantedAccess (ACCESS_MASK, ACCESS_MASK)
BOOL AccessCheckObject (PVOID, ACCESS_MASK, KPROCESSOR_MODE, CONST GENERIC_MAPPING *)
BOOL InitSecurity (VOID)
BOOL IsPrivileged (PPRIVILEGE_SET ppSet)
BOOL CheckWinstaWriteAttributesAccess (void)
NTSTATUS xxxUserDuplicateObject (HANDLE SourceProcessHandle, HANDLE SourceHandle, HANDLE TargetProcessHandle, PHANDLE TargetHandle, ACCESS_MASK DesiredAccess, ULONG HandleAttributes, ULONG Options)
HWINSTA xxxConnectService (PUNICODE_STRING, HDESK *)
NTSTATUS TestForInteractiveUser (PLUID pluidCaller)
NTSTATUS _UserTestForWinStaAccess (PUNICODE_STRING pstrWinSta, BOOL fInherit)
HDESK xxxResolveDesktop (HANDLE hProcess, PUNICODE_STRING pstrDesktop, HWINSTA *phwinsta, BOOL fInherit, BOOL *pbShutDown)
NTSTATUS xxxResolveDesktopForWOW (IN OUT PUNICODE_STRING pstrDesktop)
WORD xxxClientWOWGetProcModule (WNDPROC_PWND pfn)
PVOID _MapDesktopObject (HANDLE h)
PDESKTOPVIEW GetDesktopView (PPROCESSINFO ppi, PDESKTOP pdesk)
VOID TerminateConsole (PDESKTOP)
VOID DestroyWindowStation (IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG ProcessHandleCount, IN ULONG SystemHandleCount)
VOID FreeWindowStation (IN PWINDOWSTATION WindowStation)
NTSTATUS ParseWindowStation (IN PVOID ParseObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, IN ULONG Attributes, IN OUT PUNICODE_STRING CompleteName, IN OUT PUNICODE_STRING RemainingName, IN OUT PVOID Context OPTIONAL, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, OUT PVOID *Object)
BOOLEAN OkayToCloseWindowStation (IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN HANDLE Handle)
VOID MapDesktop (IN OB_OPEN_REASON OpenReason, IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG HandleCount)
VOID UnmapDesktop (IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG ProcessHandleCount, IN ULONG SystemHandleCount)
VOID FreeDesktop (IN PVOID Desktop)
NTSTATUS ParseDesktop (IN PVOID ParseObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, IN ULONG Attributes, IN OUT PUNICODE_STRING CompleteName, IN OUT PUNICODE_STRING RemainingName, IN OUT PVOID Context OPTIONAL, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, OUT PVOID *Object)
BOOLEAN OkayToCloseDesktop (IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN HANDLE Handle)
VOID UserSleep (DWORD dwMilliseconds)
BOOL UserBeep (DWORD dwFreq, DWORD dwDuration)
NTSTATUS UserRtlCreateAtomTable (ULONG NumberOfBuckets)
ATOM UserAddAtom (LPCWSTR lpAtom, BOOL bPin)
ATOM UserFindAtom (LPCWSTR lpAtom)
ATOM UserDeleteAtom (ATOM atom)
UINT UserGetAtomName (ATOM atom, LPWSTR lpch, int cchMax)
VOID ChangeForegroundKeyboardTable (PKL pklOld, PKL pklNew)
HKL xxxLoadKeyboardLayoutEx (PWINDOWSTATION, HANDLE, HKL, UINT, LPCWSTR, UINT, UINT)
HKL xxxActivateKeyboardLayout (PWINDOWSTATION pwinsta, HKL hkl, UINT Flags, PWND pwnd)
HKL xxxInternalActivateKeyboardLayout (PKL pkl, UINT Flags, PWND pwnd)
BOOL GetKbdLangSwitch (PUNICODE_STRING pProfileUserName)
BOOL xxxUnloadKeyboardLayout (PWINDOWSTATION, HKL)
VOID RemoveKeyboardLayoutFile (PKBDFILE pkf)
HKL _GetKeyboardLayout (DWORD idThread)
UINT _GetKeyboardLayoutList (PWINDOWSTATION pwinsta, UINT nItems, HKL *lpBuff)
VOID xxxFreeKeyboardLayouts (PWINDOWSTATION, BOOL bUnlock)
DWORD xxxDragObject (PWND pwndParent, PWND xhwndFrom, UINT wFmt, ULONG_PTR dwData, PCURSOR xpcur)
BOOL xxxDragDetect (PWND pwnd, POINT pt)
BOOL xxxIsDragging (PWND pwnd, POINT ptScreen, UINT uMsg)
HKL GetActiveHKL ()
void xxxDrawMenuItem (HDC hdc, PMENU pMenu, PITEM pItem, DWORD dwFlags)
BOOL xxxRealDrawMenuItem (HDC hdc, PGRAYMENU lpGray, int cx, int cy)
void xxxDrawMenuBarUnderlines (PWND pwnd, BOOL fShow)
__inline BOOL IsRootPopupMenu (PPOPUPMENU ppopupmenu)
__inline BOOL ExitMenuLoop (PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu)
__inline PMENUSTATE GetpMenuState (PWND pwnd)
__inline PPOPUPMENU GetpGlobalPopupMenu (PWND pwnd)
__inline BOOL IsInsideMenuLoop (PTHREADINFO pti)
__inline BOOL IsMenuStarted (PTHREADINFO pti)
__inline PITEM MNGetToppItem (PMENU pMenu)
__inline BOOL MNIsItemSelected (PPOPUPMENU ppopupmenu)
__inline PITEM MNGetSelectedpitem (PPOPUPMENU ppopupmenu)
__inline BOOL MNIsScrollArrowSelected (PPOPUPMENU ppopupmenu)
__inline BOOL IsModelessMenuNotificationWindow (PWND pwnd)
__inline BOOL IsRecursedMenuState (PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu)
__inline BOOL IsMDIItem (PITEM pitem)
void xxxDrawDragRect (PMOVESIZEDATA pmsd, LPRECT lprc, UINT flags)
void GetMonitorMaxArea (PWND pwnd, PMONITOR pMonitor, LPRECT *pprc)
VOID SetForegroundPriorityProcess (PPROCESSINFO ppi, PTHREADINFO pti, BOOL fSetForegound)
VOID SetForegroundPriority (PTHREADINFO pti, BOOL fSetForeground)
void xxxUpdateTray (PWND pwnd)
void xxxMNUpdateShownMenu (PPOPUPMENU ppopup, PITEM pItem, UINT uFlags)
UINT xxxMNFindChar (PMENU pMenu, UINT ch, INT idxC, INT *lpr)
UINT MNFindItemInColumn (PMENU pMenu, UINT idxB, int dir, BOOL fRoot)
void MNAnimate (PMENUSTATE pMenuState, BOOL fIterate)
void MNDrawFullNC (PWND pwnd, HDC hdcIn, PPOPUPMENU ppopup)
void MNDrawArrow (HDC hdcIn, PPOPUPMENU ppopup, UINT uArrow)
void MNEraseBackground (HDC hdc, PMENU pmenu, int x, int y, int cx, int cy)
PMENUSTATE xxxMNAllocMenuState (PTHREADINFO ptiCurrent, PTHREADINFO ptiNotify, PPOPUPMENU ppopupmenuRoot)
void xxxMNEndMenuState (BOOL fFreePopup)
BOOL MNEndMenuStateNotify (PMENUSTATE pMenuState)
void MNFlushDestroyedPopups (PPOPUPMENU ppopupmenu, BOOL fUnlock)
BOOL MNSetupAnimationDC (PMENUSTATE pMenuState)
BOOL MNCreateAnimationBitmap (PMENUSTATE pMenuState, UINT cx, UINT cy)
void MNDestroyAnimationBitmap (PMENUSTATE pMenuState)
PMENUSTATE xxxMNStartMenuState (PWND pwnd, DWORD cmd, LPARAM lParam)
__inline void LockMenuState (PMENUSTATE pMenuState)
BOOL xxxUnlockMenuState (PMENUSTATE pMenuState)
__inline UINT _MNGetpItemIndex (PMENU pmenu, PITEM pitem)
void xxxMNDismiss (PMENUSTATE pMenuState)
PITEM MNGetpItem (PPOPUPMENU ppopup, UINT uIndex)
void xxxMNSetCapture (PPOPUPMENU ppopup)
void xxxMNReleaseCapture (void)
void MNCheckButtonDownState (PMENUSTATE pMenuState)
PWND GetMenuStateWindow (PMENUSTATE pMenuState)
PVOID LockPopupMenu (PPOPUPMENU ppopup, PMENU *pspmenu, PMENU pmenu)
PVOID UnlockPopupMenu (PPOPUPMENU ppopup, PMENU *pspmenu)
PVOID LockWndMenu (PWND pwnd, PMENU *pspmenu, PMENU pmenu)
PVOID UnlockWndMenu (PWND pwnd, PMENU *pspmenu)
UINT MNSetTimerToCloseHierarchy (PPOPUPMENU ppopup)
BOOL xxxMNSetTop (PPOPUPMENU ppopup, int iNewTop)
LRESULT xxxMenuWindowProc (PWND, UINT, WPARAM, LPARAM)
VOID xxxMNButtonUp (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT posItemHit, LPARAM lParam)
VOID xxxMNButtonDown (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT posItemHit, BOOL fClick)
PITEM xxxMNSelectItem (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT itemPos)
BOOL xxxMNSwitchToAlternateMenu (PPOPUPMENU ppopupMenu)
void xxxMNCancel (PMENUSTATE pMenuState, UINT uMsg, UINT cmd, LPARAM lParam)
VOID xxxMNKeyDown (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT key)
BOOL xxxMNDoubleClick (PMENUSTATE pMenuState, PPOPUPMENU ppopup, int idxItem)
VOID xxxMNCloseHierarchy (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState)
PWND xxxMNOpenHierarchy (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState)
void LockMFMWFPWindow (PULONG_PTR puHitArea, ULONG_PTR uNewHitArea)
void UnlockMFMWFPWindow (PULONG_PTR puHitArea)
BOOL IsMFMWFPWindow (ULONG_PTR uHitArea)
LONG_PTR xxxMNFindWindowFromPoint (PPOPUPMENU ppopupMenu, PUINT pIndex, POINTS screenPt)
VOID xxxMNMouseMove (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, POINTS screenPt)
int xxxMNCompute (PMENU pMenu, PWND pwndNotify, DWORD yMenuTop, DWORD xMenuLeft, DWORD cxMax, LPDWORD lpdwHeight)
VOID xxxMNRecomputeBarIfNeeded (PWND pwndNotify, PMENU pMenu)
VOID xxxMenuDraw (HDC hdc, PMENU pMenu)
UINT MNFindNextValidItem (PMENU pMenu, int i, int dir, UINT flags)
VOID MNFreeItem (PMENU pMenu, PITEM pItem, BOOL fFreeItemPopup)
BOOL xxxMNStartMenu (PPOPUPMENU ppopupMenu, int mn)
VOID MNPositionSysMenu (PWND pwnd, PMENU pSysMenu)
PITEM xxxMNInvertItem (PPOPUPMENU ppopupmenu, PMENU pMenu, int itemNumber, PWND pwndNotify, BOOL fOn)
VOID xxxSendMenuSelect (PWND pwndNotify, PWND pwndMenu, PMENU pMenu, int idx)
BOOL xxxSetSystemMenu (PWND pwnd, PMENU pMenu)
BOOL xxxSetDialogSystemMenu (PWND pwnd)
VOID xxxMNChar (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT character)
PPOPUPMENU MNAllocPopup (BOOL fForceAlloc)
VOID MNFreePopup (PPOPUPMENU ppopupmenu)
VOID xxxMNKeyFilter (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, UINT ch)
int xxxMenuBarCompute (PMENU pMenu, PWND pwndNotify, DWORD yMenuTop, DWORD xMenuLeft, int cxMax)
VOID xxxEndMenu (PMENUSTATE pMenuState)
BOOL xxxCallHandleMenuMessages (PMENUSTATE pMenuState, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL xxxHandleMenuMessages (LPMSG lpmsg, PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu)
void xxxEndMenuLoop (PMENUSTATE pMenuState, PPOPUPMENU ppopupmenu)
int xxxMNLoop (PPOPUPMENU ppopupMenu, PMENUSTATE pMenuState, LPARAM lParam, BOOL fDblClk)
VOID xxxSetSysMenu (PWND pwnd)
PMENU xxxGetSysMenuHandle (PWND pwnd)
PMENU xxxGetSysMenu (PWND pwnd, BOOL fSubMenu)
PMENU MakeMenuRtoL (PMENU pMenu, BOOL bRtoL)
HDC CreateCompatiblePublicDC (HDC hdc, HBITMAP *pbmDCGray)
void xxxPSMTextOut (HDC hdc, int xLeft, int yTop, LPWSTR lpsz, int cch, DWORD dwFlags)
BOOL xxxPSMGetTextExtent (HDC hdc, LPWSTR lpstr, int cch, PSIZE psize)
void xxxClientPSMTextOut (HDC hdc, int xLeft, int yTop, PUNICODE_STRING lpsz, int cch, DWORD dwFlags)
int xxxClientLpkDrawTextEx (HDC hdc, int xLeft, int yTop, LPCWSTR lpsz, int nCount, BOOL fDraw, UINT wFormat, LPDRAWTEXTDATA lpDrawInfo, UINT bAction, int iCharSet)
BOOL xxxClientExtTextOutW (HDC hdc, int x, int y, int flOpts, RECT *prcl, LPCWSTR pwsz, UINT cwc, INT *pdx)
BOOL xxxClientGetTextExtentPointW (HDC hdc, LPCWSTR lpstr, int cch, PSIZE psize)
NTSTATUS xxxClientRegisterDragDrop (HWND hwnd)
NTSTATUS xxxClientRevokeDragDrop (HWND hwnd)
NTSTATUS xxxClientLoadOLE (VOID)
void xxxMNSetGapState (ULONG_PTR uHitArea, UINT uIndex, UINT uFlags, BOOL fSet)
BOOL xxxMNDragOver (POINT *ppt, PMNDRAGOVERINFO pmndoi)
BOOL xxxMNDragLeave (VOID)
void xxxMNUpdateDraggingInfo (PMENUSTATE pMenuState, ULONG_PTR uHitArea, UINT uIndex)
VOID xxxSBTrackInit (PWND pwnd, LPARAM lParam, int curArea, UINT uType)
VOID SBCtlSetup (PSBWND psbwnd)
void CalcSBStuff (PWND pwnd, PSBCALC pSBCalc, BOOL fVert)
void CalcSBStuff2 (PSBCALC pSBCalc, LPRECT lprc, CONST PSBDATA pw, BOOL fVert)
BOOL xxxEnableScrollBar (PWND pwnd, UINT wSBflags, UINT wArrows)
void DrawSize (PWND pwnd, HDC hdc, int cxFrame, int cyFrame)
int xxxScrollWindowEx (PWND pwnd, int dx, int dy, LPRECT prcScroll, LPRECT prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, DWORD flags)
void xxxDoScrollMenu (PWND pwndNotify, PWND pwndSB, BOOL fVert, LPARAM lParam)
BOOL xxxInternalEnumWindow (PWND pwndNext, WNDENUMPROC_PWND lpfn, LPARAM lParam, UINT fEnumChildren)
VOID ISV_InitMinMaxInfo (PWND pwnd, PPOINT aptMinMaxWnd)
VOID ISV_ValidateMinMaxInfo (PWND pwnd, PPOINT aptMinMaxWnd)
WORD _SetWindowWord (PWND pwnd, int index, WORD value)
DWORD xxxSetWindowLong (PWND pwnd, int index, DWORD value, BOOL bAnsi)
ULONG_PTR xxxSetWindowData (PWND pwnd, int index, ULONG_PTR dwData, BOOL bAnsi)
LONG xxxSetWindowStyle (PWND pwnd, int gwl, DWORD styleNew)
BOOL FCallerOk (PWND pwnd)
int IntersectVisRect (HDC, int, int, int, int)
PCURSOR xxxGetWindowSmIcon (PWND pwnd, BOOL fDontSendMsg)
VOID xxxDrawCaptionBar (PWND pwnd, HDC hdc, UINT fFlags)
VOID xxxDrawScrollBar (PWND pwnd, HDC hdc, BOOL fVert)
VOID xxxTrackBox (PWND, UINT, WPARAM, LPARAM, PSBCALC)
VOID xxxTrackThumb (PWND, UINT, WPARAM, LPARAM, PSBCALC)
VOID xxxEndScroll (PWND pwnd, BOOL fCancel)
VOID xxxDrawWindowFrame (PWND pwnd, HDC hdc, BOOL fHungRedraw, BOOL fActive)
BOOL xxxInternalPaintDesktop (PWND pwnd, HDC hdc, BOOL fPaint)
VOID xxxSysCommand (PWND pwnd, DWORD cmd, LPARAM lParam)
VOID xxxHandleNCMouseGuys (PWND pwnd, UINT message, int htArea, LPARAM lParam)
void xxxCreateClassSmIcon (PCLS pcls)
HICON xxxCreateWindowSmIcon (PWND pwnd, HICON hIconBig, BOOL fCopyFromRes)
BOOL DestroyWindowSmIcon (PWND pwnd)
BOOL DestroyClassSmIcon (PCLS pcls)
UINT DWP_GetHotKey (PWND)
UINT DWP_SetHotKey (PWND, DWORD)
VOID xxxDWP_DoNCActivate (PWND pwnd, DWORD dwFlags, HRGN hrgnClip)
VOID xxxDWP_ProcessVirtKey (UINT key)
BOOL xxxDWP_EraseBkgnd (PWND pwnd, UINT msg, HDC hdc)
VOID SetTiledRect (PWND pwnd, LPRECT lprc, PMONITOR pMonitor)
VOID LinkWindow (PWND pwnd, PWND pwndInsert, PWND pwndParent)
VOID UnlinkWindow (PWND pwndUnlink, PWND pwndParent)
VOID xxxDW_DestroyOwnedWindows (PWND pwndParent)
VOID xxxDW_SendDestroyMessages (PWND pwnd)
VOID xxxFreeWindow (PWND pwnd, PTL ptlpwndFree)
VOID xxxFW_DestroyAllChildren (PWND pwnd)
PHOTKEY FindHotKey (PTHREADINFO pti, PWND pwnd, int id, UINT fsModifiers, UINT vk, BOOL fUnregister, PBOOL pfKeysExist)
NTSTATUS _BuildNameList (PWINDOWSTATION pwinsta, PNAMELIST pNameList, UINT cbNameList, PUINT pcbNeeded)
VOID xxxHelpLoop (PWND pwnd)
NTSTATUS _BuildPropList (PWND pwnd, PROPSET aPropSet[], UINT cPropMax, PUINT pcPropReturned)
BOOL xxxSendEraseBkgnd (PWND pwnd, HDC hdcBeginPaint, HRGN hrgnUpdate)
LONG xxxSetScrollBar (PWND pwnd, int code, LPSCROLLINFO lpsi, BOOL fRedraw)
VOID IncPaintCount (PWND pwnd)
VOID DecPaintCount (PWND pwnd)
PPROP CreateProp (PWND pwnd)
VOID xxxRecreateSmallIcons (PWND pwnd)
VOID TransferWakeBit (PTHREADINFO pti, UINT message)
BOOL SysHasKanji (VOID)
LONG xxxBroadcastMessage (PWND, UINT, WPARAM, LPARAM, UINT, PBROADCASTMSG)
VOID zzzSetFMouseMoved ()
VOID TimersProc (VOID)
VOID PostMove (PQ pq)
VOID DestroyWindowsTimers (PWND pwnd)
UINT_PTR StartTimers (VOID)
LRESULT xxxTooltipWndProc (PWND, UINT, WPARAM, LPARAM)
LRESULT xxxSwitchWndProc (PWND, UINT, WPARAM, LPARAM)
LRESULT xxxDesktopWndProc (PWND, UINT, WPARAM, LPARAM)
LRESULT xxxSBWndProc (PSBWND, UINT, WPARAM, LPARAM)
VOID DrawThumb2 (PWND, PSBCALC, HDC, HBRUSH, BOOL, UINT)
UINT GetWndSBDisableFlags (PWND, BOOL)
HANDLE _ConvertMemHandle (LPBYTE lpData, int cbData)
VOID zzzRegisterSystemThread (DWORD flags, DWORD reserved)
VOID zzzUpdateCursorImage ()
void zzzCalcStartCursorHide (PW32PROCESS Process, DWORD timeAdd)
BOOL FinalUserInit ()
BOOL LW_RegisterWindows (BOOL fSystem)
BOOL xxxSystemParametersInfo (UINT wFlag, DWORD wParam, LPVOID lParam, UINT flags)
PWINDOWSTATION CheckClipboardAccess (void)
PCLIP FindClipFormat (PWINDOWSTATION pwinsta, UINT format)
BOOL InternalSetClipboardData (PWINDOWSTATION pwinsta, UINT format, HANDLE hData, BOOL fGlobalHandle, BOOL fIncSerialNumber)
VOID DisownClipboard (PWND pwndClipOwner)
VOID CaretBlinkProc (PWND pwnd, UINT message, UINT_PTR id, LPARAM lParam)
VOID xxxRedrawFrame (PWND pwnd)
VOID xxxRedrawFrameAndHook (PWND pwnd)
VOID BltColor (HDC, HBRUSH, HDC, int, int, int, int, int, int, UINT)
VOID StoreMessage (LPMSG pmsg, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, DWORD time)
VOID StoreQMessage (PQMSG pqmsg, PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, DWORD time, DWORD dwQEvent, ULONG_PTR dwExtraInfo)
void __inline StoreQMessagePti (PQMSG pqmsg, PTHREADINFO pti)
VOID xxxSendSizeMessage (PWND pwnd, UINT cmdSize)
VOID xxxCheckFocus (PWND pwnd)
VOID OffsetChildren (PWND pwnd, int dx, int dy, LPRECT prcHitTest)
VOID xxxMoveSize (PWND pwnd, UINT cmdMove, DWORD wptStart)
VOID xxxShowOwnedWindows (PWND pwndOwner, UINT cmdShow, HRGN hrgnHung)
VOID xxxAdjustSize (PWND pwnd, LPINT lpcx, LPINT lpcy)
VOID xxxNextWindow (PQ pq, DWORD wParam)
VOID xxxOldNextWindow (UINT flags)
VOID xxxCancelCoolSwitch (void)
VOID xxxCancelTracking (VOID)
VOID xxxCancelTrackingForThread (PTHREADINFO ptiCancel)
VOID xxxCapture (PTHREADINFO pti, PWND pwnd, UINT code)
UINT SystoChar (UINT message, LPARAM lParam)
PHOOK PhkFirstValid (PTHREADINFO pti, int nFilterType)
PHOOK PhkFirstGlobalValid (PTHREADINFO pti, int nFilterType)
VOID FreeHook (PHOOK phk)
int xxxCallHook (int, WPARAM, LPARAM, int)
LRESULT xxxCallHook2 (PHOOK, int, WPARAM, LPARAM, LPBOOL)
BOOL xxxCallMouseHook (UINT message, PMOUSEHOOKSTRUCTEX pmhs, BOOL fRemove)
VOID xxxCallJournalRecordHook (PQMSG pqmsg)
DWORD xxxCallJournalPlaybackHook (PQMSG pqmsg)
VOID SetJournalTimer (DWORD dt, UINT msgJournal)
VOID FreeThreadsWindowHooks (VOID)
BOOL xxxSnapWindow (PWND pwnd)
BOOL DefSetText (PWND pwnd, PLARGE_STRING pstrText)
PWND DSW_GetTopLevelCreatorWindow (PWND pwnd)
VOID xxxCalcClientRect (PWND pwnd, LPRECT lprc, BOOL fHungRedraw)
VOID xxxUpdateClientRect (PWND pwnd)
BOOL AllocateUnicodeString (PUNICODE_STRING pstrDst, PUNICODE_STRING pstrSrc)
HANDLE CreateDesktopHeap (PWIN32HEAP *ppheapRet, ULONG ulHeapSize)
BOOL xxxSetInternalWindowPos (PWND pwnd, UINT cmdShow, LPRECT lprcWin, LPPOINT lpptMin)
VOID xxxMetricsRecalc (UINT wFlags, int dx, int dy, int dyCaption, int dyMenu)
VOID xxxBroadcastDisplaySettingsChange (PDESKTOP, BOOL)
BOOL xxxUpdatePerUserSystemParameters (HANDLE hToken, BOOL bUserLoggedOn)
VOID SaveVolatileUserSettings (VOID)
void MenuRecalc (void)
int GetHmodTableIndex (PUNICODE_STRING pstrName)
VOID AddHmodDependency (int iatom)
VOID RemoveHmodDependency (int iatom)
HANDLE xxxLoadHmodIndex (int iatom, BOOL bWx86KnownDll)
VOID xxxDoSysExpunge (PTHREADINFO pti)
VOID DestroyThreadsObjects (VOID)
VOID MarkThreadsObjects (PTHREADINFO pti)
VOID FreeMessageList (PMLIST pml)
VOID DestroyThreadsHotKeys (VOID)
VOID DestroyWindowsHotKeys (PWND pwnd)
VOID DestroyClass (PPCLS ppcls)
VOID PatchThreadWindows (PTHREADINFO)
VOID DestroyCacheDCEntries (PTHREADINFO)
VOID DestroyProcessesClasses (PPROCESSINFO)
VOID InsertTask (PPROCESSINFO ppi, PTDB ptdbNew)
BOOL xxxSleepTask (BOOL fInputIdle, HANDLE)
BOOL xxxUserYield (PTHREADINFO pti)
VOID xxxDirectedYield (DWORD dwThreadId)
VOID DirectedScheduleTask (PTHREADINFO ptiOld, PTHREADINFO ptiNew, BOOL bSendMsg, PSMS psms)
VOID WakeWowTask (PTHREADINFO Pti)
_inline VOID EnterWowCritSect (PTHREADINFO pti, PWOWPROCESSINFO pwpi)
_inline VOID ExitWowCritSect (PTHREADINFO pti, PWOWPROCESSINFO pwpi)
BOOL xxxFillWindow (PWND pwndBrush, PWND pwndPaint, HDC hdc, HBRUSH hbr)
HBRUSH xxxGetControlBrush (PWND pwnd, HDC hdc, UINT msg)
HBRUSH xxxGetControlColor (PWND pwndParent, PWND pwndCtl, HDC hdc, UINT message)
PSBINFO _InitPwSB (PWND)
BOOL _KillSystemTimer (PWND pwnd, UINT_PTR nIDEvent)
BOOL xxxPaintRect (PWND, PWND, HDC, HBRUSH, LPRECT)
PCLS InternalRegisterClassEx (LPWNDCLASSEX lpwndcls, WORD fnid, DWORD flags)
PCURSOR GetClassIcoCur (PWND pwnd, int index)
PCURSOR xxxSetClassIcon (PWND pwnd, PCLS pcls, PCURSOR pCursor, int gcw)
ULONG_PTR xxxSetClassData (PWND pwnd, int index, ULONG_PTR dwData, BOOL bAnsi)
ULONG_PTR SetClassCursor (PWND pwnd, PCLS pcls, DWORD index, ULONG_PTR dwData)
PWND xxxCreateWindowEx (DWORD dwStyle, PLARGE_STRING pstrClass, PLARGE_STRING pstrName, DWORD style, int x, int y, int cx, int cy, PWND pwndParent, PMENU pmenu, HANDLE hModule, LPVOID pCreateParams, DWORD dwExpWinVerAndFlags)
BOOL xxxDestroyWindow (PWND pwnd)
LRESULT xxxSendMessageFF (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LONG xxxSendMessageBSM (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, LPBROADCASTSYSTEMMSGPARAMS pbsmParams)
LRESULT xxxSendMessageEx (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LRESULT xxxSendMessage (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
LRESULT xxxSendMessageTimeout (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT fuFlags, UINT uTimeout, PLONG_PTR lpdwResult)
BOOL xxxSendNotifyMessage (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
void QueueNotifyMessage (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL xxxSendMessageCallback (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, SENDASYNCPROC lpResultCallBack, ULONG_PTR dwData, BOOL bClientReqest)
BOOL _ReplyMessage (LRESULT lRet)
int xxxTranslateAccelerator (PWND pwnd, LPACCELTABLE pat, LPMSG lpMsg)
BOOL xxxSetMenu (PWND pwnd, PMENU pmenu, BOOL fRedraw)
VOID ChangeMenuOwner (PMENU pMenu, PPROCESSINFO ppi)
int xxxMenuBarDraw (PWND pwnd, HDC hdc, int cxFrame, int cyFrame)
BOOL xxxDrawMenuBar (PWND pwnd)
BOOL xxxSetMenuItemInfo (PMENU pMenu, UINT nPos, BOOL fByPosition, LPMENUITEMINFOW lpmii, PUNICODE_STRING pstrItem)
BOOL _SetMenuContextHelpId (PMENU pMenu, DWORD dwContextHelpId)
BOOL _SetMenuFlagRtoL (PMENU pMenu)
BOOL xxxInsertMenuItem (PMENU pMenu, UINT wIndex, BOOL fByPosition, LPMENUITEMINFOW lpmii, PUNICODE_STRING pstrItem)
BOOL xxxRemoveMenu (PMENU pMenu, UINT nPos, UINT dwFlags)
BOOL xxxDeleteMenu (PMENU pMenu, UINT nPos, UINT dwFlags)
BOOL xxxSetMenuInfo (PMENU pMenu, LPCMENUINFO lpmi)
BOOL xxxTrackPopupMenuEx (PMENU pmenu, UINT dwFlags, int x, int y, PWND pwnd, CONST TPMPARAMS *pparams)
LONG FindBestPos (int x, int y, int cx, int cy, LPRECT prcExclude, UINT wFlags, PPOPUPMENU ppopupmenu, PMONITOR pMonitor)
BOOL _SetMenuDefaultItem (PMENU pMenu, UINT wId, BOOL fByPosition)
int xxxMenuItemFromPoint (PWND pwnd, PMENU pMenu, POINT ptScreen)
BOOL xxxGetMenuItemRect (PWND pwnd, PMENU pMenu, UINT uIndex, LPRECT lprcScreen)
PPOPUPMENU MNGetPopupFromMenu (PMENU pMenu, PMENUSTATE *ppMenuState)
PVOID LockDesktopMenu (PMENU *ppmenu, PMENU pmenu)
PVOID UnlockDesktopMenu (PMENU *ppmenu)
PMENU xxxLoadSysDesktopMenu (PMENU *ppmenu, UINT uMenuId)
__inline PVOID UnlockDesktopSysMenu (PMENU *ppmenu)
BOOL xxxShowWindow (PWND pwnd, DWORD cmdShowAnimate)
BOOL _ShowWindowAsync (PWND pwnd, int cmdShow, UINT uWPFlags)
BOOL xxxShowOwnedPopups (PWND pwndOwner, BOOL fShow)
BOOL xxxSetWindowRgn (PWND pwnd, HRGN hrgn, BOOL fRedraw)
void SelectWindowRgn (PWND pwnd, HRGN hrgnClip)
PWND GetTopMostInsertAfter (PWND pwnd)
__inline BOOL FSwpTopmost (PWND pwnd)
PWND CalcForegroundInsertAfter (PWND pwnd)
BOOL xxxSetWindowPos (PWND pwnd, PWND pwndInsertAfter, int x, int y, int cx, int cy, UINT flags)
PSMWP InternalBeginDeferWindowPos (int cwndGuess)
BOOL AllocateCvr (PSMWP psmwp, int cwndHint)
PSMWP _BeginDeferWindowPos (int cwndGuess)
PSMWP _DeferWindowPos (PSMWP psmwp, PWND pwnd, PWND pwndInsertAfter, int x, int y, int cx, int cy, UINT rgf)
BOOL xxxEndDeferWindowPosEx (PSMWP psmwp, BOOL fAsync)
BOOL xxxMoveWindow (PWND pwnd, int x, int y, int cx, int cy, BOOL fRedraw)
VOID xxxHandleWindowPosChanged (PWND pwnd, PWINDOWPOS ppos)
VOID IncVisWindows (PWND pwnd)
VOID DecVisWindows (PWND pwnd)
BOOL FVisCountable (PWND pwnd)
VOID SetVisible (PWND pwnd, UINT flags)
VOID ClrFTrueVis (PWND pwnd)
VOID SetWindowState (PWND pwnd, DWORD flags)
VOID ClearWindowState (PWND pwnd, DWORD flags)
BOOL xxxUpdateWindows (PWND pwnd, HRGN hrgn)
VOID SetMinimize (PWND pwnd, UINT uFlags)
LRESULT xxxDefWindowProc (PWND, UINT, WPARAM, LPARAM)
PWND DWP_GetEnabledPopup (PWND pwndStart)
BOOL xxxWaitMessage (VOID)
VOID IdleTimerProc (VOID)
VOID zzzWakeInputIdle (PTHREADINFO pti)
VOID SleepInputIdle (PTHREADINFO pti)
BOOL xxxInternalGetMessage (LPMSG lpmsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg, BOOL fGetMessage)
DWORD _GetMessagePos (VOID)
LRESULT xxxDispatchMessage (LPMSG lpmsg)
UINT GetMouseKeyFlags (PQ pq)
BOOL _PostMessage (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam)
BOOL IPostQuitMessage (PTHREADINFO pti, int nExitCode)
BOOL _PostQuitMessage (int nExitCode)
BOOL _PostThreadMessage (PTHREADINFO pti, UINT message, WPARAM wParam, LPARAM lParam)
BOOL xxxTranslateMessage (LPMSG pmsg, UINT flags)
BOOL _GetInputState (VOID)
DWORD _GetQueueStatus (UINT)
DWORD xxxMsgWaitForMultipleObjects (DWORD nCount, PVOID *apObjects, MSGWAITCALLBACK pfnNonMsg, PKWAIT_BLOCK WaitBlockArray)
BOOL FHungApp (PTHREADINFO pti, DWORD dwTimeFromLastRead)
VOID xxxRedrawHungWindow (PWND pwnd, HRGN hrgnFullDrag)
VOID xxxRedrawHungWindowFrame (PWND pwnd, BOOL fActive)
void zzzActiveCursorTracking (PWND pwnd)
PWND GetActiveTrackPwnd (PWND pwnd, Q **ppq)
int xxxActiveWindowTracking (PWND pwnd, UINT uMsg, int iHitTest)
VOID xxxHungAppDemon (PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
VOID xxxSwitchToThisWindow (PWND pwnd, BOOL fAltTab)
int xxxToUnicodeEx (UINT wVirtKey, UINT wScanCode, CONST BYTE *lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL hkl)
int xxxInternalToUnicode (UINT wVirtKey, UINT wScanCode, CONST IN PBYTE pfvk, OUT PWCHAR awchChars, INT cChar, UINT uiTMFlags, OUT PDWORD pdwFlags, HKL hkl)
BOOL _RegisterHotKey (PWND pwnd, int id, UINT fsModifiers, UINT vk)
BOOL _UnregisterHotKey (PWND pwnd, int id)
PWND xxxSetFocus (PWND pwnd)
BOOL CanForceForeground (PPROCESSINFO ppi)
BOOL xxxStubSetForegroundWindow (PWND pwnd)
BOOL xxxSetForegroundWindow (PWND pwnd, BOOL fFlash)
PWND xxxSetActiveWindow (PWND pwnd)
BOOL xxxAllowSetForegroundWindow (DWORD dwProcessId)
BOOL _LockSetForegroundWindow (UINT uLockCode)
BOOL xxxInvalidateRect (PWND pwnd, LPRECT lprc, BOOL fErase)
BOOL xxxValidateRect (PWND pwnd, LPRECT lprc)
BOOL xxxInvalidateRgn (PWND pwnd, HRGN hrgn, BOOL fErase)
BOOL xxxValidateRgn (PWND pwnd, HRGN hrgn)
BOOL xxxUpdateWindow (PWND pwnd)
BOOL xxxGetUpdateRect (PWND pwnd, LPRECT lprc, BOOL fErase)
int xxxGetUpdateRgn (PWND pwnd, HRGN hrgn, BOOL fErase)
int _ExcludeUpdateRgn (HDC hdc, PWND pwnd)
int CalcWindowRgn (PWND pwnd, HRGN hrgn, BOOL fClient)
VOID DeleteUpdateRgn (PWND pwnd)
BOOL xxxRedrawWindow (PWND pwnd, LPRECT lprcUpdate, HRGN hrgnUpdate, DWORD flags)
BOOL IntersectWithParents (PWND pwnd, LPRECT lprc)
VOID xxxInternalInvalidate (PWND pwnd, HRGN hrgnUpdate, DWORD flags)
BOOL xxxEnableWindow (PWND pwnd, BOOL fEnable)
int xxxGetWindowText (PWND pwnd, LPWSTR psz, int cchMax)
PWND xxxSetParent (PWND pwnd, PWND pwndNewParent)
BOOL xxxFlashWindow (PWND pwnd, DWORD dwFlags, DWORD dwTimeout)
__inline DWORD GetFlashWindowState (PWND pwnd)
__inline void SetFlashWindowState (PWND pwnd, DWORD dwState)
__inline void RemoveFlashWindowState (PWND pwnd)
BOOL _GetWindowPlacement (PWND pwnd, PWINDOWPLACEMENT pwp)
BOOL xxxSetWindowPlacement (PWND pwnd, PWINDOWPLACEMENT pwp)
BOOL ValidateParentDepth (PWND pwnd, PWND pwndParent)
BOOL ValidateOwnerDepth (PWND pwnd, PWND pwndOwner)
void WPUpdateCheckPointSettings (PWND pwnd, UINT uWPFlags)
HDC _GetDC (PWND pwnd)
HDC _GetDCEx (PWND pwnd, HRGN hrgnClip, DWORD flags)
HDC _GetWindowDC (PWND pwnd)
BOOL _ReleaseDC (HDC hdc)
UINT ReleaseCacheDC (HDC hdc, BOOL fEndPaint)
HDC CreateCacheDC (PWND, DWORD, PMONITOR)
BOOL DestroyCacheDC (PDCE *, HDC)
VOID InvalidateDce (PDCE pdce)
void DeleteHrgnClip (PDCE pdce)
PWND WindowFromCacheDC (HDC hdc)
PWND FastWindowFromDC (HDC hdc)
VOID DelayedDestroyCacheDC (VOID)
PDCE LookupDC (HDC hdc)
HDC GetMonitorDC (PDCE pdceOrig, PMONITOR pMonitor)
BOOL GetDCOrgOnScreen (HDC hdc, LPPOINT ppt)
__inline VOID MarkDCEInvalid (PDCE pdce)
HDC xxxBeginPaint (PWND pwnd, PAINTSTRUCT *lpps)
BOOL xxxEndPaint (PWND pwnd, PAINTSTRUCT *lpps)
PWND xxxSetCapture (PWND pwnd)
BOOL xxxReleaseCapture (VOID)
SHORT _GetAsyncKeyState (int vk)
BOOL _SetKeyboardState (CONST BYTE *pKeyboard)
int _GetKeyboardType (int nTypeFlag)
VOID RegisterPerUserKeyboardIndicators (PUNICODE_STRING pProfileUserName)
VOID UpdatePerUserKeyboardIndicators (PUNICODE_STRING pProfileUserName)
int _GetKeyNameText (LONG lParam, LPWSTR lpString, int nSize)
BOOL _KillTimer (PWND pwnd, UINT_PTR nIDEvent)
PTIMER FindTimer (PWND pwnd, UINT_PTR nID, UINT flags, BOOL fKill)
VOID xxxSystemTimerProc (PWND pwnd, UINT msg, UINT_PTR id, LPARAM lParam)
BOOL zzzDestroyCaret (VOID)
BOOL xxxCreateCaret (PWND, HBITMAP, int, int)
BOOL zzzShowCaret (PWND)
BOOL zzzHideCaret (PWND)
BOOL _SetCaretBlinkTime (UINT)
BOOL zzzSetCaretPos (int, int)
BOOL xxxOldMessageBeep (VOID)
BOOL xxxMessageBeep (UINT wType)
VOID PlayEventSound (UINT idSound)
PWND _ChildWindowFromPointEx (PWND pwndParent, POINT pt, UINT i)
PWND xxxWindowFromPoint (POINT pt)
PWND FAR SizeBoxHwnd (PWND pwnd)
BOOL xxxOpenClipboard (PWND pwnd, LPBOOL lpfEmptyClient)
BOOL xxxCloseClipboard (PWINDOWSTATION pwinsta)
UINT _EnumClipboardFormats (UINT fmt)
BOOL xxxEmptyClipboard (PWINDOWSTATION pwinsta)
HANDLE xxxGetClipboardData (PWINDOWSTATION pwinsta, UINT fmt, PGETCLIPBDATA gcd)
BOOL _IsClipboardFormatAvailable (UINT fmt)
int _GetPriorityClipboardFormat (UINT *lpPriorityList, int cfmts)
PWND xxxSetClipboardViewer (PWND pwndClipViewerNew)
BOOL xxxChangeClipboardChain (PWND pwndRemove, PWND pwndNewNext)
VOID SetDialogPointer (PWND pwnd, LONG_PTR lPtr)
VOID ZapActiveAndFocus (VOID)
BOOL xxxSetShellWindow (PWND pwnd, PWND pwndBkGnd)
BOOL _SetProgmanWindow (PWND pwnd)
BOOL _SetTaskmanWindow (PWND pwnd)
void xxxSetTrayWindow (PDESKTOP pdesk, PWND pwnd, PMONITOR pMonitor)
BOOL xxxAddFullScreen (PWND pwnd, PMONITOR pMonitor)
BOOL xxxRemoveFullScreen (PWND pwnd, PMONITOR pMonitor)
BOOL xxxCheckFullScreen (PWND pwnd, PSIZERECT psrc)
BOOL IsTrayWindow (PWND)
BOOL IsVSlick (PWND pwnd)
BOOL Is31TrayWindow (PWND pwnd)
BOOL xxxMakeWindowForegroundWithState (PWND, BYTE)
void FullScreenCleanup ()
LONG xxxUserChangeDisplaySettings (PUNICODE_STRING pstrDeviceName, LPDEVMODEW pDevMode, HWND hwnd, PDESKTOP pdesk, DWORD dwFlags, PVOID lParam, MODE PreviousMode)
BOOL xxxbFullscreenSwitch (BOOL bFullscreenSwitch, HWND hwnd)
BOOL xxxShowScrollBar (PWND, UINT, BOOL)
BOOL xxxDrawState (HDC hdcDraw, HBRUSH hbrFore, LPARAM lData, int x, int y, int cx, int cy, UINT uFlags)
BOOL _ScrollDC (HDC, int, int, LPRECT, LPRECT, HRGN, LPRECT)
VOID SpbCheckRect (PWND pwnd, LPRECT lprc, DWORD flags)
VOID SpbCheck (VOID)
PSPB FindSpb (PWND pwnd)
VOID FreeSpb (PSPB pspb)
VOID FreeAllSpbs (void)
VOID CreateSpb (PWND pwnd, UINT flags, HDC hdcScreen)
UINT RestoreSpb (PWND pwnd, HRGN hrgnUncovered, HDC *phdcScreen)
VOID SpbCheckPwnd (PWND pwnd)
VOID SpbCheckDce (PDCE pdce)
BOOL LockWindowUpdate2 (PWND pwndLock, BOOL fThreadOverride)
BOOL FAR BitBltSysBmp (HDC hdc, int x, int y, UINT i)
BOOL APIENTRY xxxSetSysColors (PUNICODE_STRING pProfileUserName, int count, PUINT pIndex, LPDWORD pClrVal, UINT uOptions)
VOID SetSysColor (UINT icol, DWORD rgb, UINT uOptions)
UINT xxxArrangeIconicWindows (PWND pwnd)
BOOL _SetSystemMenu (PWND pwnd, PMENU pMenu)
PICON _CreateIconIndirect (PICONINFO piconinfo)
PCURSOR _CreateCursor (HANDLE hModule, int iXhotspot, int iYhotspot, int iWidth, int iHeight, LPBYTE lpANDplane, LPBYTE lpXORplane)
PICON _CreateIcon (HANDLE hModule, int iWidth, int iHeight, BYTE bPlanes, BYTE bBitsPixel, LPBYTE lpANDplane, LPBYTE lpXORplane)
void DestroyUnlockedCursor (void *)
BOOL _DestroyCursor (PCURSOR, DWORD)
HANDLE _CreateAcceleratorTable (LPACCEL, int)
BOOL _GetCursorPos (LPPOINT)
PCURSOR zzzSetCursor (PCURSOR pcur)
BOOL zzzSetCursorPos (int x, int y)
int zzzShowCursor (BOOL fShow)
BOOL zzzClipCursor (LPCRECT prcClip)
BOOL _SetCursorContents (PCURSOR pcur, PCURSOR pcurNew)
void SetPointer (BOOL fSet)
void zzzHideCursorNoCapture (void)
BOOL _DrawIconEx (HDC hdc, int x, int y, PCURSOR pcur, int cx, int cy, UINT istepIfAniCur, HBRUSH hbrush, UINT diFlags)
BOOL BltIcon (HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, PCURSOR pcursor, BOOL fMask, LONG rop)
void DBGValidateQueueStates (PDESKTOP pdesk)
HDESK xxxCreateDesktop (POBJECT_ATTRIBUTES, KPROCESSOR_MODE, PUNICODE_STRING, LPDEVMODEW, DWORD, DWORD)
HDESK xxxOpenDesktop (POBJECT_ATTRIBUTES, KPROCESSOR_MODE, DWORD, DWORD, BOOL *)
BOOL OpenDesktopCompletion (PDESKTOP pdesk, HDESK hdesk, DWORD dwFlags, BOOL *)
BOOL xxxSwitchDesktop (PWINDOWSTATION, PDESKTOP, BOOL)
VOID zzzSetDesktop (PTHREADINFO pti, PDESKTOP pdesk, HDESK hdesk)
HDESK xxxGetInputDesktop (VOID)
BOOL xxxSetThreadDesktop (HDESK, PDESKTOP)
HDESK xxxGetThreadDesktop (DWORD, HDESK, KPROCESSOR_MODE)
BOOL xxxCloseDesktop (HDESK, KPROCESSOR_MODE)
BOOL xxxEnumDesktops (FARPROC, LONG, BOOL)
DWORD _SetDesktopConsoleThread (PDESKTOP pdesk, DWORD dwThreadId)
VOID xxxRealizeDesktop (PWND pwnd)
NTSTATUS CreateGlobalAtomTable (PVOID *ppAtomTable)
HWINSTA xxxCreateWindowStation (POBJECT_ATTRIBUTES ObjA, KPROCESSOR_MODE OwnershipMode, DWORD amRequest, HANDLE hKbdLayoutFile, DWORD offTable, PCWSTR pwszKLID, UINT uKbdInputLocale)
HWINSTA _OpenWindowStation (POBJECT_ATTRIBUTES, DWORD, KPROCESSOR_MODE)
BOOL _CloseWindowStation (HWINSTA hwinsta)
BOOL xxxSetProcessWindowStation (HWINSTA, KPROCESSOR_MODE)
BOOL _LockWorkStation (VOID)
NTSTATUS ReferenceWindowStation (PETHREAD Thread, HWINSTA hwinsta, ACCESS_MASK amDesiredAccess, PWINDOWSTATION *ppwinsta, BOOL fUseDesktop)
PROC zzzSetWindowsHookAW (int nFilterType, PROC pfnFilterProc, DWORD dwFlags)
BOOL zzzUnhookWindowsHookEx (PHOOK phk)
BOOL zzzUnhookWindowsHook (int nFilterType, PROC pfnFilterProc)
LRESULT xxxCallNextHookEx (int nCode, WPARAM wParam, LPARAM lParam)
BOOL _CallMsgFilter (LPMSG lpMsg, int nCode)
void zzzCancelJournalling (void)
LRESULT fnHkINLPCWPEXSTRUCT (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
LRESULT fnHkINLPCWPRETEXSTRUCT (PWND pwnd, UINT message, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam)
__inline BOOL IsShellProcess (PPROCESSINFO ppi)
__inline DWORD GetAppCompatFlags2ForPti (PTHREADINFO pti, WORD wVer)
VOID ClearWakeMask (VOID)
ULONG GetTaskName (PTHREADINFO pti, PWSTR Buffer, ULONG BufferLength)
PQMSG FindQMsg (PTHREADINFO, PMLIST, PWND, UINT, UINT, BOOL)
void zzzShowStartGlass (DWORD dwTimeout)
DWORD _GetChangeBits (VOID)
NTSTATUS xxxSetCsrssThreadDesktop (PDESKTOP pdesk, PDESKRESTOREDATA pdrdRestore)
NTSTATUS xxxRestoreCsrssThreadDesktop (PDESKRESTOREDATA pdrdRestore)
PQ GetJournallingQueue (PTHREADINFO pti)
void ClearAppStarting (PPROCESSINFO ppi)
LONG xxxClientShutdown (PWND pwnd, WPARAM wParam)
BOOL xxxRegisterUserHungAppHandlers (PFNW32ET pfnW32EndTask, HANDLE hEventWowExec)
BOOL CreateTerminalInput (PTERMINAL)
VOID LW_LoadSomeStrings (VOID)
VOID LW_LoadProfileInitData ()
VOID xxxODI_ColorInit (PUNICODE_STRING pProfileUserName)
HRGN InitCreateRgn (VOID)
VOID xxxUpdateSystemCursorsFromRegistry (PUNICODE_STRING pProfileUserName)
VOID xxxUpdateSystemIconsFromRegistry (PUNICODE_STRING pProfileUserName)
void RegisterLPK (DWORD)
HBITMAP CreateCaptionStrip ()
BOOL LW_BrushInit (VOID)
VOID xxxLW_LoadFonts (BOOL bRemote)
VOID _LoadCursorsAndIcons (VOID)
void UnloadCursorsAndIcons (VOID)
void IncrMBox (void)
void DecrMBox (void)
void InitAnsiOem (PCHAR pOemToAnsi, PCHAR pAnsiToOem)
int xxxAddFontResourceW (LPWSTR lpFile, FLONG flags, DESIGNVECTOR *pdv)
void EnforceColorDependentSettings (void)
VOID xxxUpdatePerUserAccessPackSettings (PUNICODE_STRING pProfileUserName)
VOID GetWindowNCMetrics (LPNONCLIENTMETRICS lpnc)
HFONT FAR PASCAL CreateFontFromWinIni (PUNICODE_STRING pProfileUserName, LPLOGFONT lplf, UINT idFont)
VOID SetMinMetrics (PUNICODE_STRING pProfileUserName, LPMINIMIZEDMETRICS lpmin)
BOOL xxxSetWindowNCMetrics (PUNICODE_STRING pProfileUserName, LPNONCLIENTMETRICS lpnc, BOOL fSizeChange, int clNewBorder)
BOOL SetIconMetrics (PUNICODE_STRING pProfileUserName, LPICONMETRICS lpicon)
BOOL xxxSetNCFonts (PUNICODE_STRING pProfileUserName, LPNONCLIENTMETRICS lpnc)
BOOL CreateBitmapStrip (VOID)
BOOL UpdateWinIniInt (PUNICODE_STRING pProfileUserName, UINT idSection, UINT wKeyNameId, int value)
void FAR SetDesktopMetrics ()
void SetMsgBox (PWND pwnd)
BOOL _RegisterShellHookWindow (PWND pwnd)
BOOL _DeregisterShellHookWindow (PWND pwnd)
BOOL xxxSendMinRectMessages (PWND pwnd, RECT *lpRect)
void PostShellHookMessages (UINT message, LPARAM lParam)
VOID _ResetDblClk (VOID)
VOID xxxSimulateShiftF10 (VOID)
BOOL VWPLAdd (PVWPL *ppvwpl, PWND pwnd, DWORD dwThreshold)
BOOL VWPLRemove (PVWPL *ppvwpl, PWND pwnd)
PWND VWPLNext (PVWPL pvwpl, PWND pwndPrev, DWORD *pnPrev)
BOOL xxxDDETrackSendHook (PWND pwndTo, DWORD message, WPARAM wParam, LPARAM lParam)
DWORD xxxDDETrackPostHook (PUINT pmessage, PWND pwndTo, WPARAM wParam, LPARAM *plParam, BOOL fSent)
VOID FreeDdeXact (PXSTATE pxs)
VOID xxxDDETrackGetMessageHook (PMSG pmsg)
VOID xxxDDETrackWindowDying (PWND pwnd, PDDECONV pDdeConv)
VOID FreeDdeConv (PDDECONV pDdeConv)
BOOL _ImpersonateDdeClientWindow (PWND pwndClient, PWND pwndServer)
HBITMAP _ConvertBitmap (HBITMAP hBitmap)
PMONITORRECTS SnapshotMonitorRects (void)
void xxxDesktopRecalc (PMONITORRECTS pmrOld)
BOOL _SetDoubleClickTime (UINT)
BOOL APIENTRY _SwapMouseButton (BOOL fSwapButtons)
VOID xxxDestroyThreadInfo (VOID)
PMENU xxxGetSystemMenu (PWND pWnd, BOOL bRevert)
BOOL _DestroyMenu (PMENU pMenu)
DWORD _CheckMenuItem (PMENU pMenu, UINT wIDCheckItem, UINT wCheck)
DWORD xxxEnableMenuItem (PMENU pMenu, UINT wIDEnableItem, UINT wEnable)
WINUSERAPI UINT _GetMenuItemID (PMENU pMenu, int nPos)
WINUSERAPI UINT _GetMenuItemCount (PMENU pMenu)
PMENU _GetMenu (PWND pWnd)
PWND _GetNextQueueWindow (PWND pwnd, BOOL fDir, BOOL fAltEsc)
UINT_PTR _SetSystemTimer (PWND pwnd, UINT_PTR nIDEvent, DWORD dwElapse, TIMERPROC_PWND pTimerFunc)
BOOL _SetClipboardData (UINT fmt, HANDLE hData, BOOL fGlobalHandle, BOOL fIncSerialNumber)
WORD _SetClassWord (PWND pwnd, int index, WORD value)
DWORD xxxSetClassLong (PWND pwnd, int index, DWORD value, BOOL bAnsi)
ATOM xxxRegisterClassEx (LPWNDCLASSEX pwc, PCLSMENUNAME pcmn, WORD fnid, DWORD dwFlags, LPDWORD pdwWOW)
BOOL xxxHiliteMenuItem (PWND pwnd, PMENU pmenu, UINT cmd, UINT flags)
HANDLE xxxGetInputEvent (DWORD dwWakeMask)
BOOL _UnregisterClass (LPCWSTR lpszClassName, HANDLE hModule, PCLSMENUNAME pcmn)
ATOM _GetClassInfoEx (HANDLE hModule, LPCWSTR lpszClassName, LPWNDCLASSEX pwc, LPWSTR *ppszMenuName, BOOL bAnsi)
PWND _WindowFromDC (HDC hdc)
PCLS _GetWOWClass (HANDLE hModule, LPCWSTR lpszClassName)
LRESULT xxxHkCallHook (PHOOK phk, int nCode, WPARAM wParam, LPARAM lParam)
PHOOK zzzSetWindowsHookEx (HANDLE hmod, PUNICODE_STRING pstrLib, PTHREADINFO ptiThread, int nFilterType, PROC pfnFilterProc, DWORD dwFlags)
DWORD GetDebugHookLParamSize (WPARAM wParam, PDEBUGHOOKINFO pdebughookstruct)
BOOL _RegisterLogonProcess (DWORD dwProcessId, BOOL fSecure)
UINT _LockWindowStation (PWINDOWSTATION pwinsta)
BOOL _UnlockWindowStation (PWINDOWSTATION pwinsta)
UINT _SetWindowStationUser (PWINDOWSTATION pwinsta, PLUID pluidUser, PSID psidUser, DWORD cbsidUser)
BOOL _SetDesktopBitmap (PDESKTOP pdesk, HBITMAP hbitmap, DWORD dwStyle)
BOOL _SetLogonNotifyWindow (PWND pwnd)
BOOL _RegisterTasklist (PWND pwndTasklist)
LONG_PTR _SetMessageExtraInfo (LONG_PTR)
VOID xxxRemoveEvents (PQ pq, int nQueue, DWORD flags)
PPCLS _InnerGetClassPtr (ATOM atom, PPCLS ppclsList, HANDLE hModule)
DWORD ClientGetListboxString (PWND hwnd, UINT msg, WPARAM wParam, PVOID lParam, ULONG_PTR xParam, PROC xpfn, DWORD dwSCMSFlags, BOOL bNotString, PSMS psms)
HANDLE ClientLoadLibrary (PUNICODE_STRING pstrLib, BOOL bWx86KnownDll)
BOOL ClientFreeLibrary (HANDLE hmod)
BOOL xxxClientGetCharsetInfo (LCID lcid, PCHARSETINFO pcs)
BOOL ClientExitProcess (PFNW32ET pfn, DWORD dwExitCode)
BOOL ClientGrayString (GRAYSTRINGPROC pfnOutProc, HDC hdc, DWORD lpData, int nCount)
BOOL CopyFromClient (LPBYTE lpByte, LPBYTE lpByteClient, DWORD cch, BOOL fString, BOOL fAnsi)
BOOL CopyToClient (LPBYTE lpByte, LPBYTE lpByteClient, DWORD cchMax, BOOL fAnsi)
VOID ClientNoMemoryPopup (VOID)
NTSTATUS ClientThreadSetup (VOID)
VOID ClientDeliverUserApc (VOID)
BOOL ClientImmLoadLayout (HKL, PIMEINFOEX)
DWORD ClientImmProcessKey (HWND, HKL, UINT, LPARAM, DWORD)
NTSTATUS xxxUserModeCallback (ULONG uApi, PVOID pIn, ULONG cbIn, PVOID pOut, ULONG cbOut)
PCURSOR ClassSetSmallIcon (PCLS pcls, PCURSOR pcursor, BOOL fServerCreated)
BOOL _GetTextMetricsW (HDC hdc, LPTEXTMETRICW ptm)
int xxxDrawMenuBarTemp (PWND pwnd, HDC hdc, LPRECT lprc, PMENU pMenu, HFONT hFont)
BOOL xxxDrawCaptionTemp (PWND pwnd, HDC hdc, LPRECT lprc, HFONT hFont, PCURSOR pcursor, PUNICODE_STRING pstrText OPTIONAL, UINT flags)
WORD xxxTrackCaptionButton (PWND pwnd, UINT hit)
void GiveForegroundActivateRight (HANDLE hPid)
BOOL HasForegroundActivateRight (HANDLE hPid)
BOOL FRemoveForegroundActivate (PTHREADINFO pti)
void RestoreForegroundActivate ()
void CancelForegroundActivate ()
BOOL MinToTray (PWND pwnd)
void xxxUpdateThreadsWindows (PTHREADINFO pti, PWND pwnd, HRGN hrgnFullDrag)
NTSTATUS xxxQueryInformationThread (IN HANDLE hThread, IN USERTHREADINFOCLASS ThreadInfoClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
NTSTATUS xxxSetInformationThread (IN HANDLE hThread, IN USERTHREADINFOCLASS ThreadInfoClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
NTSTATUS SetInformationProcess (IN HANDLE hProcess, IN USERPROCESSINFOCLASS ProcessInfoClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength)
NTSTATUS xxxConsoleControl (IN CONSOLECONTROL ConsoleControl, IN PVOID ConsoleInformation, IN ULONG ConsoleInformationLength)
VOID xxxWindowEvent (DWORD event, PWND pwnd, LONG idObject, LONG idChild, DWORD dwFlags)
VOID xxxFlushDeferredWindowEvents ()
BOOL xxxClientCallWinEventProc (WINEVENTPROC pfn, PEVENTHOOK pEventHook, PNOTIFY pNotify)
void DestroyEventHook (PEVENTHOOK)
VOID FreeThreadsWinEvents (PTHREADINFO pti)
BOOL _UnhookWinEvent (PEVENTHOOK peh)
VOID DestroyNotify (PNOTIFY pNotify)
PEVENTHOOK xxxProcessNotifyWinEvent (PNOTIFY pNotify)
PEVENTHOOK _SetWinEventHook (DWORD eventMin, DWORD eventMax, HMODULE hmodWinEventProc, PUNICODE_STRING pstrLib, WINEVENTPROC pfnWinEventProc, HANDLE hEventProcess, DWORD idEventThread, DWORD dwFlags)
BOOL _GetGUIThreadInfo (PTHREADINFO pti, PGUITHREADINFO pgui)
BOOL xxxGetTitleBarInfo (PWND pwnd, PTITLEBARINFO ptbi)
BOOL _GetComboBoxInfo (PWND pwnd, PCOMBOBOXINFO ptbi)
DWORD _GetListBoxInfo (PWND pwnd)
BOOL _GetScrollBarInfo (PWND pwnd, LONG idObject, PSCROLLBARINFO ptbi)
PWND _GetAncestor (PWND pwnd, UINT gaFlags)
PWND _RealChildWindowFromPoint (PWND pwndParent, POINT pt)
BOOL _GetAltTabInfo (int iItem, PALTTABINFO pati, LPWSTR lpszItemText, UINT cchItemText, BOOL bAnsi)
BOOL xxxGetMenuBarInfo (PWND pwnd, long idObject, long idItem, PMENUBARINFO pmbi)
NTSTATUS InitializePowerRequestList (HANDLE hPowerRequestEvent)
VOID CleanupPowerRequestList (VOID)
VOID DeletePowerRequestList (VOID)
VOID xxxUserPowerCalloutWorker (VOID)
int FindNCHitEx (PWND pwnd, int ht, POINT pt)
void xxxTrackMouseMove (PWND pwnd, int htEx, UINT message)
BOOL xxxHotTrack (PWND pwnd, int htEx, BOOL fDraw)
void xxxResetTooltip (PTOOLTIPWND pttwnd)
void xxxCancelMouseMoveTracking (DWORD dwDTFlags, PWND pwndTrack, int htEx, DWORD dwDTCancel)
__inline PVOID DesktopRebaseToClient (PTHREADINFO pti, PVOID p)
__inline PVOID SharedRebaseToClient (PPROCESSINFO ppi, PVOID p)
HDC CreateFade (PWND pwnd, RECT *prc, DWORD dwTime, DWORD dwFlags)
void StartFade (void)
void StopFade (void)
void ShowFade (void)
void AnimateFade (void)
__inline DWORD TestFadeFlags (DWORD dwFlags)
HANDLE xxxSetLayeredWindow (PWND pwnd, BOOL fRepaintBehind)
BOOL UnsetLayeredWindow (PWND pwnd)
void TrackLayeredZorder (PWND pwnd)
VOID UpdateLayeredSprite (PDCE pdce)
BOOL _UpdateLayeredWindow (PWND pwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags)
BOOL _SetLayeredWindowAttributes (PWND pwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
BOOL RecreateRedirectionBitmap (PWND pwnd)
PWND GetLayeredWindow (PWND pwnd)
__inline BOOL FLayeredOrRedirected (PWND pwnd)
void InternalInvalidate3 (PWND pwnd, HRGN hrgn, DWORD flags)
BOOL UserSetFont (PUNICODE_STRING pProfileUserName, LPLOGFONTW lplf, UINT idFont, HFONT *phfont)
HICON DWP_GetIcon (PWND pwnd, UINT uType)
BOOL xxxRedrawTitle (PWND pwnd, UINT wFlags)
DWORD GetContextHelpId (PWND pwnd)
HANDLE xxxClientCopyImage (HANDLE hImage, UINT type, int cxNew, int cyNew, UINT flags)
VOID _WOWCleanup (HANDLE hInstance, DWORD hTaskWow)
VOID _WOWModuleUnload (HANDLE hModule)
PUNICODE_STRING CreateProfileUserName (TL *ptl)
void FreeProfileUserName (PUNICODE_STRING pProfileUserName, TL *ptl)
HANDLE OpenCacheKeyEx (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, ACCESS_MASK amRequest, PDWORD pdwPolicyFlags)
BOOL CheckDesktopPolicy (PUNICODE_STRING pProfileUserName OPTIONAL, PCWSTR lpKeyName)
BOOL CheckDesktopPolicyChange (PUNICODE_STRING pProfileUserName OPTIONAL)
DWORD FastGetProfileKeysW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR pszDefault, LPWSTR *ppszKeys)
DWORD FastGetProfileDwordW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, DWORD dwDefault)
DWORD FastGetProfileStringW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize)
UINT FastGetProfileIntW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT nDefault)
BOOL FastWriteProfileStringW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpString)
int FastGetProfileIntFromID (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, int def)
DWORD FastGetProfileStringFromIDW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD cch)
BOOL FastWriteProfileValue (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT uType, LPBYTE lpStruct, UINT cbSizeStruct)
DWORD FastGetProfileValue (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPBYTE lpDefault, LPBYTE lpReturn, UINT cbSizeReturn)
BOOL FastGetProfileIntsW (PUNICODE_STRING pProfileUserName OPTIONAL, PPROFINTINFO ppii)
BOOL FastUpdateWinIni (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT wKeyNameId, LPWSTR lpszValue)
VOID RecreateSmallIcons (PWND pwnd)
__inline int GetCaptionHeight (PWND pwnd)
__inline void InitTooltipDelay (PTOOLTIPWND pttwnd)
__inline PPROFILEVALUEINFO UPDWORDPointer (UINT uSetting)
__inline int ComputeTickDelta (IN DWORD dwCurTick, IN DWORD dwLastTick)
__inline int ComputePastTickDelta (IN DWORD dwCurTick, IN DWORD dwLastTick)
__inline DWORD SubtractTick (IN DWORD dwTime, IN int nDelta)
__inline BOOL IsTimeFromLastInput (DWORD dwTimeout)
__inline BOOL IsTimeFromLastRITEvent (DWORD dwTimeout)
__inline BOOL IsForegroundLocked ()
__inline BOOL GiveUpForeground ()
__inline void IncSFWLockCount ()
__inline void DecSFWLockCount ()
__inline DWORD UPDWORDValue (UINT uSetting)
PIMC CreateInputContext (IN ULONG_PTR dwClientImcData)
BOOL DestroyInputContext (IN PIMC pImc)
VOID FreeInputContext (IN PIMC pImc)
HIMC AssociateInputContext (IN PWND pWnd, IN PIMC pImc)
AIC_STATUS AssociateInputContextEx (IN PWND pWnd, IN PIMC pImc, IN DWORD dwFlag)
BOOL UpdateInputContext (IN PIMC pImc, IN UPDATEINPUTCONTEXTCLASS UpdateType, IN ULONG_PTR UpdateValue)
VOID xxxFocusSetInputContext (IN PWND pwnd, IN BOOL fActivate, IN BOOL fQueueMsg)
UINT BuildHimcList (PTHREADINFO pti, UINT cHimcMax, HIMC *phimcFirst)
PWND xxxCreateDefaultImeWindow (IN PWND pwnd, IN ATOM atomT, IN HANDLE hInst)
BOOL xxxImmActivateThreadsLayout (PTHREADINFO pti, PTLBLOCK ptlBlockPrev, PKL pkl)
VOID xxxImmActivateAndUnloadThreadsLayout (IN PTHREADINFO *ptiList, IN UINT nEntries, IN PTLBLOCK ptlBlockPrev, PKL pklCurrent, DWORD dwHklReplace)
VOID xxxImmActivateLayout (IN PTHREADINFO pti, IN PKL pkl)
VOID xxxImmUnloadThreadsLayout (IN PTHREADINFO *ptiList, IN UINT nEntry, IN PTLBLOCK ptlBlockPrev, IN DWORD dwFlag)
VOID xxxImmUnloadLayout (IN PTHREADINFO pti, IN DWORD dwFlag)
PIMEINFOEX xxxImmLoadLayout (IN HKL hKL)
BOOL GetImeInfoEx (IN PWINDOWSTATION pwinsta, IN PIMEINFOEX piiex, IN IMEINFOEXCLASS SearchType)
BOOL SetImeInfoEx (IN PWINDOWSTATION pwinsta, IN PIMEINFOEX piiex)
DWORD xxxImmProcessKey (IN PQ pq, IN PWND pwnd, IN UINT message, IN WPARAM wParam, IN LPARAM lParam)
BOOL GetImeHotKey (DWORD dwHotKeyID, PUINT puModifiers, PUINT puVKey, HKL *phKL)
BOOL SetImeHotKey (DWORD dwHotKeyID, UINT uModifiers, UINT uVKey, HKL hKL, DWORD dwAction)
PIMEHOTKEYOBJ CheckImeHotKey (PQ pq, UINT uVKey, LPARAM lParam)
BOOL ImeCanDestroyDefIME (IN PWND pwndDefaultIme, IN PWND pwndDestroy)
BOOL IsChildSameThread (IN PWND pwndParent, IN PWND pwndChild)
BOOL ImeCanDestroyDefIMEforChild (IN PWND pwndDefaultIme, IN PWND pwndDestroy)
VOID ImeCheckTopmost (IN PWND pwnd)
VOID ImeSetFutureOwner (IN PWND pwndDefaultIme, IN PWND pwndOrgOwner)
VOID ImeSetTopmostChild (IN PWND pwndRoot, IN BOOL fFlag)
VOID ImeSetTopmost (IN PWND pwndRoot, IN BOOL fFlag, IN PWND pwndInsertBefore)
PSOFTKBDDATA ProbeAndCaptureSoftKbdData (PSOFTKBDDATA Source)
VOID xxxNotifyIMEStatus (IN PWND pwnd, IN DWORD dwOpen, IN DWORD dwConversion)
BOOL xxxSetIMEShowStatus (IN BOOL fShow)
VOID xxxBroadcastImeShowStatusChange (IN PWND pwndDefIme, IN BOOL fShow)
VOID xxxCheckImeShowStatusInThread (IN PWND pwndDefIme)
__inline VOID EnterMouseCrit ()
__inline VOID LeaveMouseCrit ()
__inline VOID EnterDeviceInfoListCrit ()
__inline VOID LeaveDeviceInfoListCrit ()
__inline VOID LockCaptureWindow (PQ pq, PWND pwnd)
__inline VOID UnlockCaptureWindow (PQ pq)
BOOL SetHandleFlag (HANDLE, DWORD, BOOL)
BOOL CheckHandleFlag (HANDLE, DWORD)
VOID SetHandleInUse (HANDLE)
BOOL CheckHandleInUse (HANDLE)
__inline NTSTATUS CloseProtectedHandle (HANDLE handle)
__inline VOID EnterHandleFlagsCrit ()
__inline VOID LeaveHandleFlagsCrit ()
BOOL xxxEnumDisplayMonitors (HDC hdc, LPRECT lprcClip, MONITORENUMPROC lpfnEnum, LPARAM dwData, BOOL fInternal)
BOOL xxxClientMonitorEnumProc (HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprc, LPARAM dwData, MONITORENUMPROC xpfnProc)
void ClipPointToDesktop (LPPOINT lppt)
void DestroyMonitor (PMONITOR pMonitor)
BOOL GetHDevName (HMONITOR hMon, PWCHAR pName)
ULONG HdevFromMonitor (PMONITOR pMonitor)
__inline PDISPLAYINFO GetDispInfo (void)
__inline PMONITOR GetPrimaryMonitor (void)
VOID _QueryUserHandles (IN LPDWORD lpIn, IN DWORD dwInLength, OUT DWORD pdwResult[][TYPE_CTYPES])
NTSTATUS RemoteConnect (IN PDOCONNECTDATA pDoConnectData, IN ULONG DisplayDriverNameLength, IN PWCHAR DisplayDriverName)
NTSTATUS xxxRemoteDisconnect (VOID)
NTSTATUS xxxRemoteReconnect (IN PDORECONNECTDATA pDoReconnectData)
NTSTATUS RemoteLogoff (VOID)
BOOL PrepareForLogoff (UINT uFlags)
NTSTATUS xxxRemoteStopScreenUpdates (BOOL fDisableGraphics)
VOID xxxPushKeyEvent (BYTE bVk, BYTE bScan, DWORD dwFlags, DWORD dwExtraInfo)
NTSTATUS RemoteThinwireStats (OUT PVOID Stats)
NTSTATUS RemoteNtSecurity (VOID)
NTSTATUS xxxRemoteShadowSetup (VOID)
NTSTATUS RemoteShadowStart (IN PVOID pThinwireData, ULONG ThinwireDataLength)
NTSTATUS xxxRemoteShadowStop (VOID)
NTSTATUS RemoteShadowCleanup (IN PVOID pThinwireData, ULONG ThinwireDataLength)
NTSTATUS xxxRemotePassthruEnable (VOID)
NTSTATUS RemotePassthruDisable (VOID)
NTSTATUS CtxDisplayIOCtl (ULONG DisplayIOCtlFlags, PUCHAR pDisplayIOCtlData, ULONG cbDisplayIOCtlData)
DWORD RemoteConnectState (VOID)
BOOL _GetWinStationInfo (WSINFO *pWsInfo)
NTSTATUS RemoteRedrawRectangle (WORD Left, WORD Top, WORD Right, WORD Bottom)
NTSTATUS RemoteRedrawScreen (VOID)
NTSTATUS RemoteDisableScreen (VOID)
VOID NlsKbdSendIMEProc (DWORD dwImeOpen, DWORD dwImeConversion)

Variables

PTHREADINFO _ptiCrit (VOID)
PTHREADINFO _ptiCritShared (VOID)
POBJECT_TYPEExWindowStationObjectType
POBJECT_TYPEExDesktopObjectType
POBJECT_TYPEExEventObjectType
DEVICE_TEMPLATE aDeviceTemplate []
PWIN32HEAP gpvSharedAlloc
PWND PwndForegroundCapture (VOID)
ULONG gSessionId
PWND HotKeyToWindow (DWORD)
PWND GetLastTopMostWindow (VOID)
PWND _GetActiveWindow (VOID)
ATOM gaFlashWState
PCURSOR _GetCursor (VOID)
PWINDOWSTATION _GetProcessWindowStation (HWINSTA *)
PMENU _CreateMenu (VOID)
PMENU _CreatePopupMenu (VOID)
HANDLE ghCanActivateForegroundPIDs [ACTIVATE_ARRAY_SIZE]


Define Documentation

#define __GetWindowLong pwnd,
index   )     ((LONG)(*(DWORD UNALIGNED *)((BYTE *)((pwnd) + 1) + (index))))
 

Definition at line 5789 of file userk.h.

Referenced by DBGGetWindowLong().

#define __GetWindowLongPtr pwnd,
index   )     ((LONG_PTR)(*(ULONG_PTR UNALIGNED *)((BYTE *)((pwnd) + 1) + (index))))
 

Definition at line 5790 of file userk.h.

Referenced by DBGGetWindowLongPtr().

#define _GetWindowLong   __GetWindowLong
 

Definition at line 5797 of file userk.h.

Referenced by GetWindowWord(), NtUserQueryWindow(), and xxxRedrawHungWindow().

#define _GetWindowLongPtr   __GetWindowLongPtr
 

Definition at line 5798 of file userk.h.

#define _ThreadLockPti pti,
pobj,
ptl   )     LockW32Thread((PW32THREAD)pobj, ptl)
 

Definition at line 1680 of file userk.h.

#define abs  )     (((A) < 0)? -(A) : (A))
 

Definition at line 2354 of file userk.h.

Referenced by ComboBoxWndProcWorker(), ConsoleWindowProc(), DIBtoDIBV5(), DoMouseAccel(), KeSetBasePriorityThread(), MLEditWndProc(), ReaderMouseMove(), ReaderProcInternal(), SBSetParms(), SizeOfDib(), SizeRect(), TestRectBogus(), xxxLBBlockHilite(), and xxxNewITopEx().

#define ACCF_ACCESSENABLED   0x00000100
 

Definition at line 6573 of file userk.h.

Referenced by ProcessKeyboardInput(), ProcessMouseInput(), and SetAccessEnabledFlag().

#define ACCF_DEFAULTFILTERKEYSON   0x00000001
 

Definition at line 6565 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTHIGHCONTRASTON   0x00000080
 

Definition at line 6572 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTKEYBOARDPREF   0x00000020
 

Definition at line 6570 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTMOUSEKEYSON   0x00000004
 

Definition at line 6567 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTSCREENREADER   0x00000040
 

Definition at line 6571 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTSTICKYKEYSON   0x00000002
 

Definition at line 6566 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTTIMEOUTON   0x00000010
 

Definition at line 6569 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_DEFAULTTOGGLEKEYSON   0x00000008
 

Definition at line 6568 of file userk.h.

Referenced by xxxUpdatePerUserAccessPackSettings().

#define ACCF_FIRSTTICK   0x00004000
 

Definition at line 6578 of file userk.h.

Referenced by SoundSentryTimer().

#define ACCF_FKMAKECODEPROCESSED   0x00000800
 

Definition at line 6575 of file userk.h.

Referenced by FilterKeys(), and xxxFKAcceptanceDelayTimer().

#define ACCF_IGNOREBREAKCODE   0x00000400
 

Definition at line 6574 of file userk.h.

Referenced by FilterKeys().

#define ACCF_KEYBOARDPREF   0x00020000
 

Definition at line 6586 of file userk.h.

Referenced by LoadCPUserPreferences(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define ACCF_MKREPEATVK   0x00002000
 

Definition at line 6577 of file userk.h.

Referenced by MouseKeys(), TurnOffMouseKeys(), xxxMKButtonClick(), xxxMKMouseMove(), and xxxMKToggleMouseKeys().

#define ACCF_MKVIRTUALMOUSE   0x00001000
 

Definition at line 6576 of file userk.h.

Referenced by InitMice(), MKHideMouseCursor(), and MKShowMouseCursor().

#define ACCF_SCREENREADER   0x00040000
 

Definition at line 6587 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define ACCF_SHOWSOUNDSON   0x00008000
 

Definition at line 6579 of file userk.h.

Referenced by SetAccessEnabledFlag(), xxxAccessTimeOutTimer(), xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define ACTIVATE_ARRAY_SIZE   5
 

Definition at line 6335 of file userk.h.

Referenced by GiveForegroundActivateRight(), and HasForegroundActivateRight().

 
#define AnySpbs  )     (gpDispInfo->pspbFirst != NULL)
 

Definition at line 3657 of file userk.h.

Referenced by _ScrollDC(), BltValidInit(), CreateCacheDC(), CreateSpb(), FreeAllSpbs(), FreeSpb(), SpbCheck(), xxxDWP_SetRedraw(), xxxInternalInvalidate(), xxxScrollWindowEx(), and zzzBltValidBits().

#define ATW_ASYNC   0x0004
 

Definition at line 4446 of file userk.h.

Referenced by xxxActivateThisWindow(), and xxxProcessEventMessage().

#define ATW_MOUSE   0x0001
 

Definition at line 4444 of file userk.h.

Referenced by xxxActivateThisWindow(), and xxxActivateWindow().

#define ATW_NOZORDER   0x0008
 

Definition at line 4447 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxActiveWindowTracking(), and xxxProcessEventMessage().

#define ATW_SETFOCUS   0x0002
 

Definition at line 4445 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxActivateWindow(), xxxMenuWindowProc(), xxxProcessEventMessage(), and xxxSetForegroundWindow2().

#define AW_SKIP   3
 

Definition at line 2325 of file userk.h.

Referenced by xxxActivateWindow(), xxxDestroyWindow(), xxxMinMaximize(), and xxxShowWindow().

#define AW_SKIP2   5 /* used internally in xxxActivateWindow() */
 

Definition at line 2327 of file userk.h.

Referenced by xxxActivateWindow(), and xxxMenuWindowProc().

#define AW_TRY   2
 

Definition at line 2324 of file userk.h.

Referenced by xxxActivateWindow(), xxxDestroyWindow(), and xxxMouseActivate().

#define AW_TRY2   4
 

Definition at line 2326 of file userk.h.

Referenced by xxxActivateWindow(), and xxxMouseActivate().

#define AW_USE   1
 

Definition at line 2323 of file userk.h.

Referenced by xxxActivateWindow(), xxxSetActiveWindow(), xxxSetForegroundWindow(), xxxShowWindow(), and xxxSwpActivate().

#define AW_USE2   6 /* nc mouse activation added by craigc */
 

Definition at line 2328 of file userk.h.

Referenced by xxxActivateWindow(), and xxxHandleNCMouseGuys().

#define BC_INVERT   0x00000001
 

Definition at line 28 of file userk.h.

#define BC_NOMIRROR   0x00000002
 

Definition at line 29 of file userk.h.

Referenced by BltColor(), and DrawMenuItemCheckMark().

 
#define BeginAtomicCheck  ) 
 

Definition at line 1840 of file userk.h.

Referenced by xxxCreateDesktop().

 
#define BEGINATOMICCHECK  ) 
 

Definition at line 1838 of file userk.h.

Referenced by CreateDeviceInfo(), CreateFade(), CreateRedirectionBitmap(), DestroyProcessInfo(), DestroyTask(), DestroyThreadsObjects(), HMDestroyUnlockedObject(), LockWindowUpdate2(), ProcessDeviceChanges(), ResetSystemColors(), SpbTransfer(), UnsetLayeredWindow(), UpdateLayeredSprite(), UserJobCallout(), xxxCapture(), xxxCreateThreadInfo(), xxxCreateWindowStation(), xxxHardErrorControl(), xxxProcessNotifyWinEvent(), xxxRedrawHungWindow(), xxxSetLayeredWindow(), zzzBltValidBits(), zzzChangeStates(), zzzReattachThreads(), and zzzRecalc2().

 
#define BeginAtomicDeviceInfoListCheck  ) 
 

Definition at line 1841 of file userk.h.

 
#define BEGINATOMICDEVICEINFOLISTCHECK  ) 
 

Definition at line 1839 of file userk.h.

Referenced by NlsKbdSendIMENotification(), and ProcessDeviceChanges().

#define BMSG_POSTMSG   0x0002
 

Definition at line 3791 of file userk.h.

Referenced by _PostMessage().

#define BMSG_SENDMSG   0x0000
 

Definition at line 3789 of file userk.h.

Referenced by xxxSendMessageTimeout(), and xxxSystemBroadcastMessage().

#define BMSG_SENDMSGCALLBACK   0x0003
 

Definition at line 3792 of file userk.h.

Referenced by xxxSendMessageCallback().

#define BMSG_SENDMSGTIMEOUT   0x0004
 

Definition at line 3793 of file userk.h.

Referenced by xxxSendMessageTimeout().

#define BMSG_SENDNOTIFYMSG   0x0001
 

Definition at line 3790 of file userk.h.

Referenced by xxxBroadcastDisplaySettingsChange(), xxxSendMessageCallback(), xxxSendNotifyMessage(), xxxSystemBroadcastMessage(), and xxxUserResetDisplayDevice().

#define BMSG_SENDNOTIFYMSGPROCESS   0x0005
 

Definition at line 3794 of file userk.h.

#define BORDER_EXTRA   3
 

Definition at line 6913 of file userk.h.

Referenced by SetNCMetrics(), xxxMoveSize(), and xxxSystemParametersInfo().

#define BWL_CHWNDINIT   32 /* initial # slots pre-allocated */
 

Definition at line 3630 of file userk.h.

#define BWL_CHWNDMORE   8 /* # slots to obtain when required */
 

Definition at line 3631 of file userk.h.

Referenced by ExpandWindowList().

#define BWL_ENUMCHILDREN   1
 

Definition at line 3633 of file userk.h.

Referenced by AssociateInputContextEx(), DestroyInputContext(), InternalBuildHwndList(), NtUserBuildHwndList(), xxxHelpLoop(), and xxxMetricsRecalc().

#define BWL_ENUMIMELAST   0x08
 

Definition at line 3637 of file userk.h.

Referenced by BuildHwndList(), and NtUserBuildHwndList().

#define BWL_ENUMLIST   2
 

Definition at line 3634 of file userk.h.

Referenced by _FindWindowEx(), AssociateInputContextEx(), CancelInputState(), DestroyInputContext(), InitSwitchWndInfo(), InternalBuildHwndList(), NtUserBuildHwndList(), xxxActivateThisWindow(), xxxArrangeIconicWindows(), xxxCheckImeShowStatus(), xxxClientShutdown(), xxxDeactivate(), xxxDefWindowProc(), xxxDesktopRecalc(), xxxDWPPrint(), xxxInternalDoSyncPaint(), xxxMetricsRecalc(), xxxSendBSMtoDesktop(), xxxSetClassIcon(), and xxxShowOwnedWindows().

#define BWL_ENUMOWNERLIST   4
 

Definition at line 3635 of file userk.h.

Referenced by BuildHwndList().

#define BWL_REMOVEIMECHILD   0x10
 

Definition at line 3638 of file userk.h.

Referenced by BuildHwndList().

#define CALL_LPK ptiCurrent   ) 
 

Value:

((PpiCurrent()->dwLpkEntryPoints & LPK_INSTALLED) && \ !((ptiCurrent)->TIF_flags & (TIF_INCLEANUP | TIF_SYSTEMTHREAD)))

Definition at line 3529 of file userk.h.

Referenced by DrawTextExWorker(), DT_DrawStr(), DT_GetExtentMinusPrefixes(), GetNextWordbreak(), MNRecalcTabStrings(), xxxDrawCaptionTemp(), xxxDrawItemUnderline(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxMB_FindLongestString(), and xxxPSMTextOut().

#define CallClientProcA pwnd,
msg,
wParam,
lParam,
xpfn   ) 
 

Value:

SfnDWORD(pwnd, msg, wParam, lParam, xpfn, \ ((PROC)(gpsi->apfnClientW.pfnDispatchMessage)), TRUE, NULL)

Definition at line 2251 of file userk.h.

Referenced by xxxDispatchMessage(), xxxReceiveMessage(), and xxxSendMessageCallback().

#define CallClientProcW pwnd,
msg,
wParam,
lParam,
xpfn   ) 
 

Value:

SfnDWORD(pwnd, msg, wParam, lParam, xpfn, \ ((PROC)(gpsi->apfnClientW.pfnDispatchMessage)), TRUE, NULL)

Definition at line 2254 of file userk.h.

Referenced by xxxDispatchMessage().

#define CallClientWorkerProc pwnd,
msg,
wParam,
lParam,
xpfn   )     SfnDWORD(pwnd, msg, wParam, lParam, 0, xpfn, TRUE, NULL)
 

Definition at line 2257 of file userk.h.

Referenced by xxxFreeWindow().

#define CAPTIONTOOLTIPLEN   100
 

Definition at line 2595 of file userk.h.

Referenced by xxxShowTooltip().

#define CCACHEDCAPTIONS   5
 

Definition at line 37 of file userk.h.

Referenced by _DestroyCursor(), CreateBitmapStrip(), and DrawCaptionIcon().

#define CCVR_WORKSPACE   4
 

Definition at line 3871 of file userk.h.

#define CH_HELPPREFIX   0x08
 

Definition at line 3855 of file userk.h.

Referenced by xxxMNCompute(), xxxMNFindChar(), and xxxRealDrawMenuItem().

#define CHARALIGN   sizeof(WCHAR)
 

Definition at line 148 of file userk.h.

Referenced by MESSAGECALL(), NtUserDrawCaptionTemp(), NtUserfnHkINLPCBTCREATESTRUCT(), NtUserGetAltTabInfo(), NtUserGetClipboardFormatName(), NtUserGetIconInfo(), NtUserGetKeyboardLayoutName(), NtUserGetKeyNameText(), NtUserInternalGetWindowText(), NtUserLoadKeyboardLayoutEx(), NtUserOpenWindowStation(), NtUserSystemParametersInfo(), and NtUserToUnicodeEx().

 
#define CheckCritIn  ) 
 

Definition at line 1833 of file userk.h.

Referenced by _CsDdeUninitialize(), _CsUpdateInstance(), _GetClassInfoEx(), _GetKeyboardLayout(), _GetWinStationInfo(), _ReleaseDC(), _ReplyMessage(), _SetClassWord(), _UnregisterClass(), _UserSoundSentryWorker(), _UserTestForWinStaAccess(), AccessProceduresStream(), BuildHwndList(), ChangeForegroundKeyboardTable(), CleanupDirtyDesktops(), CloseDevice(), CreateDeviceInfo(), CreateProfileUserName(), DecTimerCount(), DestroyProcessInfo(), DestroySMWP(), DestroyTask(), DirectedScheduleTask(), DoTimer(), FilterKeys(), FKActivationTimer(), FKBounceKeyTimer(), FreeHwndList(), FreeListFree(), FreeProfileUserName(), FreeTimer(), GetActiveHKL(), GetActiveTrackPwnd(), GetCPD(), GetHDevName(), GetModifierBits(), HighContrastHotKey(), HMAllocObject(), IdleTimerProc(), InitPreviousUserString(), InsertTask(), InternalBeginDeferWindowPos(), InternalRegisterClassEx(), InternalSetTimer(), InterQueueMsgCleanup(), IsHotKey(), IsSAS(), JobCalloutAddProcess(), JobCalloutTerminate(), KEOEMProcs(), MapScancode(), MouseKeys(), OpenCacheKeyEx(), OpenDevice(), OpenMultiplePortDevice(), PhkFirstGlobalValid(), PhkFirstValid(), PostEventMessage(), PostMove(), PrepareForLogoff(), ProcessDeviceChanges(), RegisterForDeviceChangeNotifications(), RemoteDisableScreen(), RemoteOpenCacheKeyEx(), RemoteRedrawRectangle(), RemoteRedrawScreen(), RemoteSyncToggleKeys(), RemoveProcessFromJob(), SendMsgCleanup(), SetProcessFlags(), SetWakeBit(), StoreMessage(), StoreQMessage(), ToggleKeys(), UnlinkHook(), UnregisterForDeviceChangeNotifications(), UpdateAsyncKeyState(), UpdateJob(), UpdateKeyLights(), UpdateMouseInfo(), UpdateRawKeyState(), UserAssociateHwnd(), UserGetClientRgn(), UserGetCurrentDesktopId(), UserGetHwnd(), UserVisrgnFromHwnd(), UtilityManager(), VKFromVSC(), WaitOnPseudoEvent(), xxxAccessTimeOutTimer(), xxxBroadcastImeShowStatusChange(), xxxButtonEvent(), xxxCallHook2(), xxxCancelCoolSwitch(), xxxChangeMonitorFlags(), xxxCleanupDdeConv(), xxxCreateDesktop(), xxxCreateDesktop2(), xxxCreateThreadInfo(), xxxCsDdeInitialize(), xxxCsEvent(), xxxDesktopThread(), xxxDestroyThreadDDEObject(), xxxDirectedYield(), xxxDoButtonEvent(), xxxDoHotKeyStuff(), xxxEventWndProc(), xxxFKAcceptanceDelayTimer(), xxxFKRepeatRateTimer(), xxxFreeListFree(), xxxHardwareMouseKeyUp(), xxxICO_00(), xxxInitProcessInfo(), xxxInitTerminal(), xxxInternalGetMessage(), xxxInterSendMsgEx(), xxxKELocaleProcs(), xxxKENLSProcs(), xxxKeyEvent(), xxxMessageEvent(), xxxMKButtonSetState(), xxxMKMoveAccelCursorTimer(), xxxMKMoveConstCursorTimer(), xxxNumpadCursor(), xxxProcessKeyEvent(), xxxReceiveMessage(), xxxRedrawHungWindow(), xxxRegisterForDeviceClassNotifications(), xxxRemoteStopScreenUpdates(), xxxResolveDesktop(), xxxSendMessageCallback(), xxxSendMessageTimeout(), xxxSendMessageToUI(), xxxSetClassLongPtr(), xxxSetDeskPattern(), xxxSetIMEShowStatus(), xxxSetProcessInitState(), xxxSleepTask(), xxxSleepThread(), xxxStickyKeys(), xxxSwitchDesktop(), xxxToggleKeysTimer(), xxxTurnOffStickyKeys(), xxxUpdateModifierState(), xxxUserDuplicateObject(), xxxUserNotifyProcessCreate(), and zzzAttachThreadInput().

 
#define CheckCritInShared  ) 
 

Definition at line 1835 of file userk.h.

Referenced by _GetWOWClass(), GetModificationNumber(), PhkNextValid(), and ValidateHandleSecure().

 
#define CheckCritOut  ) 
 

Definition at line 1836 of file userk.h.

Referenced by CreateSystemThread(), DeviceCDROMNotify(), DeviceClassCDROMNotify(), DeviceClassNotify(), DeviceNotify(), EnterCrit(), InitSystemThread(), LeaveCrit(), LockProcessByClientId(), ProcessMouseInput(), QueueMouseEvent(), RawInputThread(), RequestDeviceChange(), UserBeep(), xxxMoveEvent(), and xxxMoveEventAbsolute().

 
#define CheckDeviceInfoListCritIn  ) 
 

Definition at line 1834 of file userk.h.

Referenced by FreeDeviceInfo(), and RequestDeviceChange().

 
#define CheckDeviceInfoListCritOut  ) 
 

Definition at line 1837 of file userk.h.

Referenced by DeviceNotify(), EnterCrit(), ProcessMouseInput(), and RequestDeviceChange().

 
#define CheckForClientDeath  ) 
 

Definition at line 97 of file userk.h.

Referenced by xxxGetInputEvent(), xxxInternalGetMessage(), xxxMsgWaitForMultipleObjects(), xxxSleepTask(), xxxSleepThread(), and xxxWaitForInputIdle().

#define CheckHwnd  )     TRUE
 

Definition at line 2159 of file userk.h.

#define CheckHwndNull  )     TRUE
 

Definition at line 2160 of file userk.h.

#define CheckLock  ) 
 

Definition at line 1080 of file userk.h.

#define CheckPtiSysPeek where,
pq,
newIdSysPeek   ) 
 

Definition at line 69 of file userk.h.

Referenced by DestroyThreadsMessages(), RedistributeInput(), xxxScanSysQueue(), and xxxSkipSysMsg().

#define CheckSysLock where,
pq,
pti   ) 
 

Definition at line 70 of file userk.h.

Referenced by RedistributeInput(), xxxInternalGetMessage(), xxxScanSysQueue(), and zzzDestroyQueue().

 
#define CleanupPoolAllocations  ) 
 

Definition at line 2120 of file userk.h.

Referenced by Win32KDriverUnload().

 
#define CleanUpPoolLimitations  ) 
 

Definition at line 2122 of file userk.h.

Referenced by Win32KDriverUnload().

 
#define CleanUpSections  ) 
 

Definition at line 2128 of file userk.h.

Referenced by Win32KDriverUnload().

#define CLEAR_ACCF  )     CLEAR_FLAG(gdwPUDFlags, f)
 

Definition at line 6604 of file userk.h.

Referenced by FilterKeys(), InitMice(), MKHideMouseCursor(), MouseKeys(), SoundSentryTimer(), TurnOffMouseKeys(), xxxAccessTimeOutTimer(), and xxxUpdatePerUserAccessPackSettings().

#define CLEAR_GTERMF  )     CLEAR_FLAG(gdwGTERMFlags, f)
 

Definition at line 1999 of file userk.h.

Referenced by InitMice(), MKHideMouseCursor(), and ProcessDeviceChanges().

#define CLEAR_PUDF  )     CLEAR_FLAG(gdwPUDFlags, f)
 

Definition at line 6611 of file userk.h.

Referenced by CancelForegroundActivate(), DestroySMWP(), EndShutdown(), FullScreenCleanup(), MNFreePopup(), SetVDMCursorBounds(), xxxMakeWindowForegroundWithState(), xxxMNEndMenuState(), and xxxMoveSize().

#define CLEARHMODLOADED pti,
 ) 
 

Value:

((pti)->ppi->ahmodLibLoaded[x] = NULL, \ (pti)->ppi->dwhmodLibLoadedMask &= ~(1 << (x)))

Definition at line 3668 of file userk.h.

Referenced by xxxDoSysExpunge().

#define ClearRawKeyDown vk   )     ClearKeyDownBit(gafRawKeyState, vk)
 

Definition at line 5736 of file userk.h.

Referenced by ResetPushState(), and UpdateRawKeyState().

#define ClearRawKeyToggle vk   )     ClearKeyToggleBit(gafRawKeyState, vk)
 

Definition at line 5739 of file userk.h.

Referenced by ChangeForegroundKeyboardTable(), ResetPushState(), UpdateKeyLights(), and UpdatePerUserKeyboardIndicators().

#define ClearUP uSetting   )     ClearUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
 

Definition at line 5264 of file userk.h.

#define ClearUPBOOL pdw,
uSetting   ) 
 

Value:

{ \ UserAssert(UPIsBOOLRange(uSetting)); \ *UPBOOLPointer(pdw, uSetting) &= ~UPBOOLMask(uSetting); \ }

Definition at line 5253 of file userk.h.

Referenced by xxxSystemParametersInfo().

#define CLIBS   32
 

Definition at line 3404 of file userk.h.

Referenced by GetHmodTableIndex().

#define CLIENT_CAPTURE   2 /* client-relative capture */
 

Definition at line 3849 of file userk.h.

Referenced by xxxCapture(), xxxScanSysQueue(), and xxxSetCapture().

#define CLIENT_CAPTURE_INTERNAL   6 /* client-relative capture (Win 3.1 style; won't release) */
 

Definition at line 3853 of file userk.h.

Referenced by xxxCapture(), and xxxMoveSize().

#define CLOSE_PSEUDO_EVENT phE   ) 
 

Value:

CheckCritIn(); \ if (*(phE) == PSEUDO_EVENT_ON) *(phE) = PSEUDO_EVENT_OFF; \ else if (*(phE) != PSEUDO_EVENT_OFF) { \ KeSetEvent(*(phE), EVENT_INCREMENT, FALSE); \ ObDereferenceObject(*(phE)); \ *(phE) = PSEUDO_EVENT_OFF; \ }

Definition at line 3078 of file userk.h.

Referenced by DestroyProcessInfo(), and DestroyTask().

#define CopyRgn hrgnDst,
hrgnSrc   )     GreCombineRgn(hrgnDst, hrgnSrc, NULL, RGN_COPY)
 

Definition at line 2217 of file userk.h.

Referenced by _ExcludeUpdateRgn(), _GetDCEx(), CombineOldNewVis(), GetNCUpdateRgn(), InternalInvalidate3(), InternalScrollDC(), UserValidateCopyRgn(), xxxRedrawHungWindow(), xxxRedrawWindow(), xxxScrollWindowEx(), and zzzBltValidBits().

#define CXF_INTRA_PROCESS   0x8000
 

Definition at line 6184 of file userk.h.

#define CXF_IS_SERVER   0x0001
 

Definition at line 6181 of file userk.h.

Referenced by AddConvProp(), NewConversation(), xxxCleanupDdeConv(), xxxDDETrackGetMessageHook(), and xxxDDETrackPostHook().

#define CXF_PARTNER_WINDOW_DIED   0x0004
 

Definition at line 6183 of file userk.h.

Referenced by xxxCleanupDdeConv(), xxxDDETrackPostHook(), and xxxDDETrackWindowDying().

#define CXF_TERMINATE_POSTED   0x0002
 

Definition at line 6182 of file userk.h.

Referenced by AbnormalDDEPost(), FreeDdeConv(), SpontaneousTerminate(), xxxCleanupDdeConv(), xxxDDETrackGetMessageHook(), xxxDDETrackPostHook(), and xxxDDETrackWindowDying().

#define CXMENU3DEDGE   1
 

Definition at line 4819 of file userk.h.

Referenced by MNDrawMenu3DHotTracking(), and xxxRealDrawMenuItem().

#define CXYDESKPATTERN   8
 

Definition at line 2154 of file userk.h.

Referenced by RecolorDeskPattern(), and xxxSetDeskPattern().

#define CYMENU3DEDGE   1
 

Definition at line 4820 of file userk.h.

Referenced by MNDrawMenu3DHotTracking(), and xxxRealDrawMenuItem().

#define DATA_NOT_BANKED   0xFFFF
 

Definition at line 2935 of file userk.h.

#define DATAALIGN   sizeof(DWORD)
 

Definition at line 147 of file userk.h.

Referenced by _GetComboBoxInfo(), _GetListBoxInfo(), _GetWinStationInfo(), NtUserCopyAcceleratorTable(), NtUserCreateAcceleratorTable(), NtUserDdeGetQualityOfService(), NtUserDrawIconEx(), NtUserEvent(), NtUserfnHkINLPDEBUGHOOKSTRUCT(), NtUserGetAltTabInfo(), NtUserGetClassInfo(), NtUserGetComboBoxInfo(), NtUserGetCursorInfo(), NtUserGetGUIThreadInfo(), NtUserGetIconInfo(), NtUserGetKeyboardLayoutList(), NtUserGetMouseMovePointsEx(), NtUserGetPriorityClipboardFormat(), NtUserGetScrollBarInfo(), NtUserGetTitleBarInfo(), NtUserOpenWindowStation(), NtUserSendInput(), NtUserSetObjectInformation(), NtUserSetSysColors(), and NtUserSystemParametersInfo().

 
#define DBGDecModalMenuCount  ) 
 

Definition at line 7019 of file userk.h.

Referenced by xxxMNEndMenuState(), and xxxMNLoop().

#define DbgDumpTrackedDesktops  ) 
 

Definition at line 7417 of file userk.h.

Referenced by Win32kNtUserCleanup().

 
#define DBGIncModalMenuCount  ) 
 

Definition at line 7018 of file userk.h.

Referenced by xxxMNAllocMenuState().

#define DbgTrackAddDesktop pdesk   ) 
 

Definition at line 7415 of file userk.h.

Referenced by xxxCreateDesktop2().

#define DbgTrackRemoveDesktop pdesk   ) 
 

Definition at line 7416 of file userk.h.

Referenced by FreeDesktop().

#define DbgValidateHooks phk,
iType   ) 
 

Definition at line 6024 of file userk.h.

Referenced by FreeHook(), PhkFirstGlobalValid(), PhkFirstValid(), PhkNextValid(), xxxHkCallHook(), and zzzSetWindowsHookEx().

#define DCC   0x01 /* Client area */
 

Definition at line 3608 of file userk.h.

#define DCCACHE   0x40
 

Definition at line 3614 of file userk.h.

#define DCCLIPRGN   0x08
 

Definition at line 3611 of file userk.h.

#define DCE_FREED   1
 

Definition at line 3601 of file userk.h.

Referenced by ReleaseCacheDC(), and xxxFreeWindow().

#define DCE_NORELEASE   2
 

Definition at line 3602 of file userk.h.

Referenced by _ReleaseDC(), ReleaseCacheDC(), and xxxFreeWindow().

#define DCE_RELEASED   0
 

Definition at line 3600 of file userk.h.

Referenced by ReleaseCacheDC(), and xxxFreeWindow().

#define DCE_SIZE_CACHEINIT   5
 

Definition at line 3597 of file userk.h.

Referenced by InitUserScreen().

#define DCE_SIZE_CACHETHRESHOLD   32
 

Definition at line 3598 of file userk.h.

Referenced by ReleaseCacheDC().

#define DCNOCHILDCLIP   0x10 /* Nochildern clip */
 

Definition at line 3612 of file userk.h.

#define DCSAVEDVISRGN   0x04
 

Definition at line 3610 of file userk.h.

#define DCSAVEVIS   0x20 /* Save visrgn before calculating */
 

Definition at line 3613 of file userk.h.

#define DCUNUSED   0x00 /* Unused cache entry */
 

Definition at line 3607 of file userk.h.

#define DCW   0x02 /* Window area */
 

Definition at line 3609 of file userk.h.

#define DDR_ENDACCEPT   1
 

Definition at line 3048 of file userk.h.

Referenced by xxxMS_TrackMove().

#define DDR_ENDCANCEL   2
 

Definition at line 3049 of file userk.h.

Referenced by xxxCancelTrackingForThread(), xxxMS_TrackMove(), xxxReleaseCapture(), and xxxTrackInitSize().

#define DDR_START   0
 

Definition at line 3047 of file userk.h.

Referenced by xxxDrawDragRect(), and xxxMoveSize().

#define DECLARE_POOLTAG name,
value,
index   ) 
 

Definition at line 2048 of file userk.h.

#define DEFAULT_WINSTA   L"\\Windows\\WindowStations\\WinSta0"
 

Definition at line 4567 of file userk.h.

Referenced by _UserTestForWinStaAccess().

 
#define DeferWinEventNotify  ) 
 

Value:

Definition at line 6469 of file userk.h.

Referenced by DestroyProcessInfo(), LockWindowUpdate2(), xxxCapture(), xxxCreateCaret(), xxxCreateDesktop(), xxxCreateThreadInfo(), xxxCreateWindowStation(), xxxHardErrorControl(), xxxSetProcessInitState(), zzzBltValidBits(), zzzCancelJournalling(), zzzInitTask(), zzzReattachThreads(), zzzRecalc2(), zzzSetFMouseMoved(), and zzzShowCursor().

#define DEFINE_POOLTAG value,
index   )     value
 

Definition at line 2046 of file userk.h.

#define DESKTOP_ALLOC_TRACE_SIZE   6
 

Definition at line 2604 of file userk.h.

#define DesktopAllocAlways pdesk,
uSize,
tag   )     Win32HeapAlloc(pdesk->pheapDesktop, uSize, tag, 0)
 

Definition at line 2694 of file userk.h.

Referenced by ClassAlloc(), and zzzSetDesktop().

#define DesktopFree pdesk,
 )     Win32HeapFree(pdesk->pheapDesktop, p)
 

Definition at line 2697 of file userk.h.

Referenced by _DestroyMenu(), ClassFree(), CreateProp(), DefSetText(), DeleteProperties(), FreeItemString(), HMFreeObject(), UnlockSubMenu(), xxxCreateDefaultImeWindow(), xxxDestroyThreadInfo(), xxxFreeWindow(), xxxInsertMenuItem(), xxxRemoveDeleteMenuHelper(), xxxSetLPITEMInfo(), xxxSetScrollBar(), and zzzSetDesktop().

#define DEVICE_TYPE_KEYBOARD   1
 

Definition at line 1895 of file userk.h.

Referenced by DeviceClassNotify(), NlsKbdSendIMENotification(), OpenDevice(), ProcessDeviceChanges(), ProcessKeyboardInput(), RawInputThread(), and UpdateKeyLights().

#define DEVICE_TYPE_MAX   1
 

Definition at line 1896 of file userk.h.

Referenced by CreateDeviceInfo(), OpenMultiplePortDevice(), Win32kNtUserCleanup(), and xxxRegisterForDeviceClassNotifications().

#define DEVICE_TYPE_MOUSE   0
 

Definition at line 1894 of file userk.h.

Referenced by DeviceClassNotify(), OpenDevice(), ProcessDeviceChanges(), RawInputThread(), UpdateMouseInfo(), xxxDesktopThread(), and xxxMsgWaitForMultipleObjects().

#define DF_DESKCREATED   0x00200000
 

Definition at line 2591 of file userk.h.

Referenced by CleanupDirtyDesktops(), OkayToCloseDesktop(), and xxxCreateDesktop().

#define DF_DESKWNDDESTROYED   0x40000000
 

Definition at line 2579 of file userk.h.

Referenced by FreeDesktop(), GNT_NextTopScan(), ValidateHdesk(), xxxCreateWindowEx(), xxxDesktopThread(), xxxSwitchDesktop(), and zzzSetDesktop().

#define DF_DESTROYED   0x20000000
 

Definition at line 2580 of file userk.h.

Referenced by DesktopAlloc(), DestroyDesktop(), RemoteRedrawScreen(), ValidateHdesk(), xxxCreateThreadInfo(), xxxCreateWindowEx(), xxxSetCsrssThreadDesktop(), and xxxSwitchDesktop().

#define DF_DYING   0x80000000
 

Definition at line 2578 of file userk.h.

Referenced by FreeDesktop(), ValidateHdesk(), xxxCreateWindowEx(), xxxDesktopThread(), xxxSwitchDesktop(), and zzzSetDesktop().

#define DF_HOTTRACKING   0x10000000
 

Definition at line 2581 of file userk.h.

Referenced by xxxCancelMouseMoveTracking(), and xxxTrackMouseMove().

#define DF_MENUINUSE   0x00800000
 

Definition at line 2589 of file userk.h.

Referenced by MNFreePopup(), xxxMNCloseHierarchy(), xxxMNEndMenuState(), and xxxMNOpenHierarchy().

#define DF_MOUSEMOVETRK   (DF_HOTTRACKING | DF_TOOLTIPACTIVE | DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER)
 

Definition at line 2588 of file userk.h.

Referenced by xxxDesktopThread(), xxxFreeWindow(), xxxProcessEventMessage(), xxxTrackMouseMove(), and zzzSetFMouseMoved().

#define DF_NEWDISPLAYSETTINGS   0x00400000
 

Definition at line 2590 of file userk.h.

Referenced by UserSetDelayedChangeBroadcastForAllDesktops(), and xxxSwitchDesktop().

#define DF_TOOLTIP   (DF_TOOLTIPACTIVE | DF_TOOLTIPSHOWING)
 

Definition at line 2584 of file userk.h.

Referenced by xxxCancelMouseMoveTracking(), xxxProcessEventMessage(), xxxResetTooltip(), xxxTooltipWndProc(), and xxxTrackMouseMove().

#define DF_TOOLTIPACTIVE   0x04000000
 

Definition at line 2583 of file userk.h.

Referenced by xxxProcessEventMessage(), and xxxTrackMouseMove().

#define DF_TOOLTIPSHOWING   0x08000000
 

Definition at line 2582 of file userk.h.

Referenced by xxxCancelMouseMoveTracking(), xxxDesktopThread(), xxxFreeWindow(), and xxxProcessEventMessage().

#define DF_TRACKMOUSEEVENT   (DF_TRACKMOUSELEAVE | DF_TRACKMOUSEHOVER)
 

Definition at line 2587 of file userk.h.

Referenced by QueryTrackMouseEvent(), xxxCapture(), and xxxTrackMouseMove().

#define DF_TRACKMOUSEHOVER   0x01000000
 

Definition at line 2586 of file userk.h.

Referenced by QueryTrackMouseEvent(), TrackMouseEvent(), xxxCancelMouseMoveTracking(), xxxScanSysQueue(), and xxxSystemTimerProc().

#define DF_TRACKMOUSELEAVE   0x02000000
 

Definition at line 2585 of file userk.h.

Referenced by QueryTrackMouseEvent(), TrackMouseEvent(), xxxCancelMouseMoveTracking(), and xxxProcessEventMessage().

#define DIAGNOSE_IO   1
 

Definition at line 1852 of file userk.h.

#define DMI_GRAYED   0x00000002
 

Definition at line 4708 of file userk.h.

#define DMI_INVERT   0x00000001
 

Definition at line 4707 of file userk.h.

Referenced by xxxDrawMenuItem(), and xxxMNInvertItem().

#define dpHorzRes   HORZRES
 

Definition at line 2927 of file userk.h.

#define DPO   0x00FA0089 /* destination, pattern, or */
 

Definition at line 4073 of file userk.h.

#define dpVertRes   VERTRES
 

Definition at line 2928 of file userk.h.

#define DSP_ALLCHILDREN   0x0020
 

Definition at line 4036 of file userk.h.

Referenced by DoQueuedSyncPaint(), xxxInternalDoSyncPaint(), and xxxInternalInvalidate().

#define DSP_ENUMCLIPPEDCHILDREN   0x0004
 

Definition at line 4033 of file userk.h.

Referenced by DoQueuedSyncPaint(), xxxEndDeferWindowPosEx(), xxxInternalDoSyncPaint(), and xxxInternalInvalidate().

#define DSP_ERASE   0x0001
 

Definition at line 4031 of file userk.h.

Referenced by xxxSimpleDoSyncPaint().

#define DSP_FRAME   0x0002
 

Definition at line 4032 of file userk.h.

Referenced by xxxSimpleDoSyncPaint().

#define DSP_NOCHECKPARENTS   0x0010
 

Definition at line 4035 of file userk.h.

#define DSP_WM_SYNCPAINT   0x0008
 

Definition at line 4034 of file userk.h.

#define DTAG_CLASS   0x0001
 

Definition at line 2624 of file userk.h.

Referenced by ClassAlloc().

#define DTAG_CLIENTTHREADINFO   0x0003
 

Definition at line 2626 of file userk.h.

Referenced by zzzSetDesktop().

#define DTAG_DESKTOPINFO   0x0002
 

Definition at line 2625 of file userk.h.

Referenced by xxxCreateDesktop2().

#define DTAG_HANDTABL   0x0005
 

Definition at line 2628 of file userk.h.

Referenced by HMAllocObject().

#define DTAG_IMETEXT   0x0009
 

Definition at line 2632 of file userk.h.

Referenced by xxxCreateDefaultImeWindow().

#define DTAG_MENUITEM   0x0007
 

Definition at line 2630 of file userk.h.

Referenced by xxxInsertMenuItem(), xxxRemoveDeleteMenuHelper(), and xxxSetLPITEMInfo().

#define DTAG_MENUTEXT   0x0008
 

Definition at line 2631 of file userk.h.

Referenced by xxxSetLPITEMInfo().

#define DTAG_PROPLIST   0x000A
 

Definition at line 2633 of file userk.h.

Referenced by CreateProp().

#define DTAG_SBINFO   0x0006
 

Definition at line 2629 of file userk.h.

Referenced by _InitPwSB().

#define DTAG_TEXT   0x0004
 

Definition at line 2627 of file userk.h.

Referenced by DefSetText().

#define DTM_SETUPAPPRAN   (WM_USER+90)
 

Definition at line 3187 of file userk.h.

Referenced by DestroyTask(), and xxxDestroyThreadInfo().

#define DUMMY_TEXT_HANDLE   0xFFFF
 

Definition at line 2934 of file userk.h.

 
#define EndAtomicCheck  ) 
 

Definition at line 1844 of file userk.h.

Referenced by xxxCreateDesktop().

 
#define ENDATOMICCHECK  ) 
 

Definition at line 1842 of file userk.h.

Referenced by CreateDeviceInfo(), CreateFade(), CreateRedirectionBitmap(), DestroyProcessInfo(), DestroyTask(), DestroyThreadsObjects(), HMDestroyUnlockedObject(), LockWindowUpdate2(), ProcessDeviceChanges(), ResetSystemColors(), SpbTransfer(), UnsetLayeredWindow(), UpdateLayeredSprite(), UserJobCallout(), xxxCapture(), xxxCreateThreadInfo(), xxxCreateWindowStation(), xxxHardErrorControl(), xxxProcessNotifyWinEvent(), xxxRedrawHungWindow(), xxxSetLayeredWindow(), zzzBltValidBits(), zzzChangeStates(), zzzReattachThreads(), and zzzRecalc2().

 
#define EndAtomicDeviceInfoListCheck  ) 
 

Definition at line 1845 of file userk.h.

 
#define ENDATOMICDEVICEINFOLISTCHECK  ) 
 

Definition at line 1843 of file userk.h.

Referenced by NlsKbdSendIMENotification(), and ProcessDeviceChanges().

 
#define EndDeferWinEventNotifyWithoutProcessing  ) 
 

Value:

UserAssert(IsWinEventNotifyDeferred()); \ UserAssert(FWINABLE() || gnDeferredWinEvents == 0); \ CheckCritIn(); \ --gdwDeferWinEvent

Definition at line 6488 of file userk.h.

Referenced by DestroyProcessInfo(), xxxCreateThreadInfo(), and xxxSetProcessInitState().

 
#define EXITATOMICCHECK  ) 
 

Definition at line 1846 of file userk.h.

Referenced by CreateDeviceInfo(), xxxCreateWindowStation(), and zzzReattachThreads().

#define FADE_COMPLETED   0x00000002
 

Definition at line 6743 of file userk.h.

Referenced by AnimateFade(), and StopFade().

#define FADE_MENU   0x00000010
 

Definition at line 6746 of file userk.h.

Referenced by MNAnimate(), and xxxMenuWindowProc().

#define FADE_SHOW   0x00000001
 

Definition at line 6742 of file userk.h.

Referenced by AnimateFade(), ShowFade(), StopFade(), xxxMenuWindowProc(), and xxxTooltipWndProc().

#define FADE_SHOWN   0x00000004
 

Definition at line 6744 of file userk.h.

Referenced by ShowFade().

#define FADE_TOOLTIP   0x00000020
 

Definition at line 6747 of file userk.h.

Referenced by xxxTooltipWndProc().

#define FADE_WINDOW   0x00000008
 

Definition at line 6745 of file userk.h.

Referenced by CreateFade(), DeleteFadeSprite(), and UpdateFade().

 
#define FCallHookTray  )     (IsHooked(PtiCurrent(), WHF_SHELL))
 

Definition at line 5831 of file userk.h.

Referenced by IsTrayWindow(), xxxMinMaximize(), xxxSetTrayWindow(), xxxSysCommand(), xxxSystemParametersInfo(), and xxxUpdateTray().

#define FCallTray  )     (FDoTray() && ( FCallHookTray()|| FPostTray(p) ))
 

Definition at line 5833 of file userk.h.

Referenced by xxxAddFullScreen(), and xxxRemoveFullScreen().

 
#define FDoTray  )     (SYSMET(ARRANGE) & ARW_HIDE)
 

Definition at line 5830 of file userk.h.

Referenced by IsTrayWindow(), xxxDefWindowProc(), xxxMinMaximize(), xxxSysCommand(), and xxxUpdateTray().

#define FHas31TrayStyles pwnd   ) 
 

Value:

(TestWF(pwnd, WFFULLSCREEN) || \ (TestWF(pwnd, WFSYSMENU | WFMINBOX) && \ (TestWF(pwnd, WFCAPTION) || TestWF(pwnd, WFMINIMIZED))))

Definition at line 5845 of file userk.h.

Referenced by Is31TrayWindow(), IsTrayWindow(), and xxxUpdateTray().

#define FindClassAtom lpszClassName   )     (IS_PTR(lpszClassName) ? UserFindAtom(lpszClassName) : PTR_TO_ID(lpszClassName))
 

Definition at line 4682 of file userk.h.

Referenced by _FindWindowEx(), _GetClassInfoEx(), _UnregisterClass(), and InternalRegisterClassEx().

 
#define FJOURNALPLAYBACK  )     (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALPLAYBACK + 1] != NULL)
 

Definition at line 3663 of file userk.h.

Referenced by ClearWakeBit(), xxxInternalGetMessage(), xxxKeyEvent(), xxxScanSysQueue(), zzzAttachThreadInput(), zzzInitTask(), and zzzRegisterSystemThread().

 
#define FJOURNALRECORD  )     (GETDESKINFO(PtiCurrent())->aphkStart[WH_JOURNALRECORD + 1] != NULL)
 

Definition at line 3662 of file userk.h.

Referenced by xxxInternalGetMessage(), xxxKeyEvent(), zzzAttachThreadInput(), zzzInitTask(), and zzzRegisterSystemThread().

#define FPostTray  )     (p->pDeskInfo->spwndTaskman)
 

Definition at line 5832 of file userk.h.

Referenced by IsTrayWindow(), xxxMinMaximize(), xxxSetTrayWindow(), xxxSysCommand(), and xxxUpdateTray().

#define FREEHOLD   0
 

Definition at line 2968 of file userk.h.

#define FTopLevel pwnd   )     (pwnd->spwndParent == PWNDDESKTOP(pwnd))
 

Definition at line 5844 of file userk.h.

Referenced by FVisCountable(), IsTrayWindow(), VisWindow(), xxxDrawDragRect(), xxxSetLayeredWindow(), and xxxUpdateTray().

#define FULLSCREEN_CAPTURE   5 /* capture entire machine */
 

Definition at line 3852 of file userk.h.

Referenced by xxxCapture(), and xxxMakeWindowForegroundWithState().

#define GDIAF_ARRIVED   (USHORT)0x0001
 

Definition at line 1899 of file userk.h.

Referenced by CreateDeviceInfo(), ProcessDeviceChanges(), and UpdateMouseInfo().

#define GDIAF_DEPARTED   (USHORT)0x0008
 

Definition at line 1902 of file userk.h.

Referenced by DeviceNotify(), and ProcessDeviceChanges().

#define GDIAF_FREEME   (USHORT)0x0080
 

Definition at line 1905 of file userk.h.

Referenced by FreeDeviceInfo(), InputApc(), RequestDeviceChange(), and StartDeviceRead().

#define GDIAF_IME_STATUS   (USHORT)0x0010
 

Definition at line 1903 of file userk.h.

Referenced by NlsKbdSendIMENotification(), and ProcessDeviceChanges().

#define GDIAF_PNPWAITING   (USHORT)0x0100
 

Definition at line 1906 of file userk.h.

Referenced by DeviceNotify(), FreeDeviceInfo(), ProcessDeviceChanges(), RequestDeviceChange(), and Win32kNtUserCleanup().

#define GDIAF_QUERYREMOVE   (USHORT)0x0002
 

Definition at line 1900 of file userk.h.

Referenced by DeviceNotify(), and ProcessDeviceChanges().

#define GDIAF_RECONNECT   (USHORT)0x0400
 

Definition at line 1908 of file userk.h.

Referenced by ProcessDeviceChanges(), and UpdateMouseInfo().

#define GDIAF_REFRESH_MOUSE   (USHORT)0x0020
 

Definition at line 1904 of file userk.h.

Referenced by ProcessDeviceChanges(), and ProcessMouseInput().

#define GDIAF_REMOVECANCELLED   (USHORT)0x0004
 

Definition at line 1901 of file userk.h.

Referenced by DeviceNotify(), and ProcessDeviceChanges().

#define GDIAF_RETRYREAD   (USHORT)0x0200
 

Definition at line 1907 of file userk.h.

Referenced by ProcessDeviceChanges(), and StartDeviceRead().

#define GDIF_DBGREAD   0x10
 

Definition at line 1917 of file userk.h.

Referenced by StartDeviceRead().

#define GDIF_NOTPNP   0x01
 

Definition at line 1911 of file userk.h.

Referenced by OpenDevice(), OpenMultiplePortDevice(), RegisterForDeviceChangeNotifications(), and UnregisterForDeviceChangeNotifications().

#define GDIF_PNPMUSTFREE   0x08
 

Definition at line 1915 of file userk.h.

Referenced by FreeDeviceInfo().

#define GDIF_READERMUSTFREE   0x04
 

Definition at line 1914 of file userk.h.

Referenced by FreeDeviceInfo().

#define GDIF_READING   0x02
 

Definition at line 1912 of file userk.h.

Referenced by FreeDeviceInfo(), InputApc(), StartDeviceRead(), and Win32kNtUserCleanup().

#define GET_TIME_LAST_READ pti   )     ((pti)->pcti->timeLastRead)
 

Definition at line 2348 of file userk.h.

Referenced by FHungApp().

#define GET_X_LPARAM lp   )     ((int)(short)LOWORD(lp))
 

Definition at line 25 of file userk.h.

#define GET_Y_LPARAM lp   )     ((int)(short)HIWORD(lp))
 

Definition at line 26 of file userk.h.

 
#define GetCurrentProcessId  )     (PsGetCurrentThread()->Cid.UniqueProcess)
 

Definition at line 92 of file userk.h.

Referenced by _LockWindowStation(), _SetLogonNotifyWindow(), _SetWindowStationUser(), _UnlockWindowStation(), CheckDesktopPolicy(), GetColorMatchingModule(), ImmGetImeMenuItemsWorker(), NtUserGetThreadState(), NtUserProcessConnect(), ServiceMessageBox(), SetLastDDEMLError(), xxxRedrawHungWindow(), xxxSnapWindow(), and xxxUpdatePerUserSystemParameters().

#define GETDESKINFO pti   )     ((pti)->pDeskInfo)
 

Definition at line 2345 of file userk.h.

Referenced by _SetProgmanWindow(), _SetTaskmanWindow(), DestroyTask(), InitSwitchWndInfo(), PostShellHookMessages(), xxxDestroyThreadInfo(), xxxDoHotKeyStuff(), xxxMetricsRecalc(), xxxSendMinRectMessages(), and xxxSetShellWindow().

#define GETPCI pcur   )     ((PCURSINFO)&(pcur->CI_FIRST))
 

Definition at line 5956 of file userk.h.

Referenced by SetPointer(), and zzzUpdateCursorImage().

#define GETTOPMOSTINSERTAFTER pwnd   )     (gHardErrorHandler.pti == NULL ? NULL : GetTopMostInsertAfter(pwnd))
 

Definition at line 5501 of file userk.h.

Referenced by CheckTopmost(), and xxxCreateWindowEx().

#define GH_SIZE   8
 

Definition at line 3433 of file userk.h.

Referenced by NtUserUserHandleGrantAccess().

#define GTERMF_MOUSE   0x00000001
 

Definition at line 2003 of file userk.h.

Referenced by AllocQueue(), InitMice(), MKHideMouseCursor(), MKShowMouseCursor(), ProcessDeviceChanges(), xxxSetThreadDesktop(), and zzzSetDesktop().

#define GW_DESKTOP_ID   1
 

Definition at line 2601 of file userk.h.

Referenced by InitVideo(), and xxxCreateDesktop2().

#define HBITMAP_RLE   ((HBITMAP)0xffffffff)
 

Definition at line 1745 of file userk.h.

 
#define HEBREW_UI_LANGID  )     (gpsi->UILangID == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT))
 

Definition at line 33 of file userk.h.

Referenced by BitBltSysBmp(), and xxxDrawCaptionBar().

#define HF_DESKTOPHOOK   0
 

Definition at line 7289 of file userk.h.

Referenced by _GetUserObjectInformation(), _SetUserObjectInformation(), OpenDesktopCompletion(), xxxCloseDesktop(), xxxCreateDesktop(), and zzzSetDesktop().

#define HF_LIMIT   2
 

Definition at line 7291 of file userk.h.

Referenced by CheckHandleFlag(), and SetHandleFlag().

#define HF_PROTECTED   1
 

Definition at line 7290 of file userk.h.

Referenced by EnterHandleFlagsCrit(), NtUserOpenInputDesktop(), OkayToCloseDesktop(), OkayToCloseWindowStation(), xxxCreateDesktop(), xxxGetInputDesktop(), xxxGetThreadDesktop(), xxxOpenDesktop(), xxxSetProcessWindowStation(), and zzzSetDesktop().

#define HH_ALLDTGONE   0x00000800
 

Definition at line 7394 of file userk.h.

Referenced by InitiateWin32kCleanup().

#define HH_CLEANUPRESOURCES   0x00020000
 

Definition at line 7400 of file userk.h.

Referenced by CleanupResources().

#define HH_DISCONNECTDESKTOP   0x00040000
 

Definition at line 7401 of file userk.h.

Referenced by xxxCreateDesktop().

#define HH_DRIVERENTRY   0x00000001
 

Definition at line 7383 of file userk.h.

#define HH_DRIVERUNLOAD   0x00000080
 

Definition at line 7390 of file userk.h.

Referenced by Win32KDriverUnload().

#define HH_DTQUITPOSTED   0x00080000
 

Definition at line 7402 of file userk.h.

Referenced by InitiateWin32kCleanup().

#define HH_GRECLEANUP   0x00000100
 

Definition at line 7391 of file userk.h.

Referenced by Win32KDriverUnload().

#define HH_INITIATEWIN32KCLEANUP   0x00000400
 

Definition at line 7393 of file userk.h.

Referenced by InitiateWin32kCleanup().

#define HH_INITVIDEO   0x00000004
 

Definition at line 7385 of file userk.h.

Referenced by InitVideo().

#define HH_KBDLYOUTFREEWINSTA   0x00010000
 

Definition at line 7399 of file userk.h.

Referenced by FreeWindowStation().

#define HH_KBDLYOUTGLOBALCLEANUP   0x00008000
 

Definition at line 7398 of file userk.h.

Referenced by Win32kNtUserCleanup().

#define HH_LOADCURSORS   0x00004000
 

Definition at line 7397 of file userk.h.

Referenced by _LoadCursorsAndIcons().

#define HH_REMOTECONNECT   0x00000008
 

Definition at line 7386 of file userk.h.

Referenced by RemoteConnect().

#define HH_REMOTEDISCONNECT   0x00000010
 

Definition at line 7387 of file userk.h.

Referenced by xxxRemoteDisconnect().

#define HH_REMOTELOGOFF   0x00000040
 

Definition at line 7389 of file userk.h.

Referenced by RemoteLogoff().

#define HH_REMOTERECONNECT   0x00000020
 

Definition at line 7388 of file userk.h.

Referenced by xxxRemoteReconnect().

#define HH_RITCREATED   0x00002000
 

Definition at line 7396 of file userk.h.

Referenced by RawInputThread().

#define HH_RITGONE   0x00001000
 

Definition at line 7395 of file userk.h.

Referenced by InitiateWin32kCleanup().

#define HH_USERINITIALIZE   0x00000002
 

Definition at line 7384 of file userk.h.

Referenced by UserInitialize().

#define HH_USERKCLEANUP   0x00000200
 

Definition at line 7392 of file userk.h.

Referenced by Win32KDriverUnload().

#define HMChangeOwnerProcess pobj,
pti   )     HMChangeOwnerPheProcess(HMPheFromObject(pobj), pti)
 

Definition at line 1191 of file userk.h.

Referenced by LockDesktopMenu(), ZombieCursor(), and zzzSetSystemImage().

#define HMLockObject  )     (((PHEAD)p)->cLockObj++)
 

Definition at line 1197 of file userk.h.

Referenced by AddConvProp(), HMAssignmentLock(), ThreadLockExchange(), and ThreadLockExchangeAlways().

#define HMONITOR_PRIMARY   ((HMONITOR)0x00010000)
 

Definition at line 7319 of file userk.h.

#define HMUnlockObject pobj   )     ( (--((PHEAD)pobj)->cLockObj == 0) ? HMUnlockObjectInternal(pobj) : pobj )
 

Definition at line 1186 of file userk.h.

Referenced by HMAssignmentLock(), HMAssignmentUnlock(), ThreadLockExchange(), ThreadLockExchangeAlways(), ThreadUnlock1(), UnlinkConv(), and xxxLoadKeyboardLayoutEx().

#define HTEXMENUFIRST   65
 

Definition at line 6704 of file userk.h.

Referenced by xxxSystemTimerProc().

#define HTEXMENULAST   69
 

Definition at line 6710 of file userk.h.

Referenced by xxxSystemTimerProc().

#define HTEXSCROLLFIRST   60
 

Definition at line 6697 of file userk.h.

Referenced by xxxSystemTimerProc().

#define HTEXSCROLLLAST   64
 

Definition at line 6703 of file userk.h.

Referenced by xxxSystemTimerProc().

#define HTMDICLOSE   68
 

Definition at line 6708 of file userk.h.

Referenced by FindNCHitEx(), IsTooltipHittest(), and xxxHotTrack().

#define HTMDIMAXBUTTON   66
 

Definition at line 6706 of file userk.h.

Referenced by FindNCHitEx(), IsTooltipHittest(), and xxxHotTrack().

#define HTMDIMINBUTTON   67
 

Definition at line 6707 of file userk.h.

Referenced by FindNCHitEx(), IsTooltipHittest(), and xxxHotTrack().

#define HTMDISYSMENU   65
 

Definition at line 6705 of file userk.h.

Referenced by FindNCHitEx().

#define HTMENUITEM   69
 

Definition at line 6709 of file userk.h.

Referenced by FindNCHitEx(), and xxxHotTrack().

#define HtoP  )     ((PVOID)HMObjectFromHandle(h))
 

Definition at line 1170 of file userk.h.

Referenced by NtUserDdeInitialize(), SLEditWndProc(), xxxGetMenuBarInfo(), xxxImmProcessKey(), and xxxUpdateSystemIconsFromRegistry().

#define HtoPCat  )     ((PVOID)HMCatObjectFromHandle(h))
 

Definition at line 1171 of file userk.h.

#define HtoPq  )     ((PVOID)HMObjectFromHandle(h))
 

Definition at line 1168 of file userk.h.

#define HtoPqCat  )     ((PVOID)HMCatObjectFromHandle(h))
 

Definition at line 1169 of file userk.h.

Referenced by HMFreeObject().

#define HTSCROLLDOWN   61
 

Definition at line 6699 of file userk.h.

Referenced by HitTestScrollBar(), and xxxHotTrack().

#define HTSCROLLDOWNPAGE   63
 

Definition at line 6701 of file userk.h.

Referenced by HitTestScrollBar(), and xxxHotTrack().

#define HTSCROLLTHUMB   64
 

Definition at line 6702 of file userk.h.

Referenced by HitTestScrollBar(), and xxxHotTrack().

#define HTSCROLLUP   60
 

Definition at line 6698 of file userk.h.

Referenced by HitTestScrollBar(), and xxxHotTrack().

#define HTSCROLLUPPAGE   62
 

Definition at line 6700 of file userk.h.

Referenced by HitTestScrollBar(), and xxxHotTrack().

#define HYDRA_HINT ev   )     (gdwHydraHint |= ev)
 

Definition at line 7404 of file userk.h.

Referenced by _LoadCursorsAndIcons(), CleanupResources(), FreeWindowStation(), InitiateWin32kCleanup(), InitVideo(), RawInputThread(), RemoteConnect(), RemoteLogoff(), UserInitialize(), Win32KDriverUnload(), Win32kNtUserCleanup(), xxxCreateDesktop(), xxxRemoteDisconnect(), and xxxRemoteReconnect().

#define IDC_CHILDRENONLY   0x0002
 

Definition at line 2233 of file userk.h.

Referenced by xxxScrollWindowEx(), zzzBltValidBits(), and zzzInvalidateDCCache().

#define IDC_CLIENTONLY   0x0004
 

Definition at line 2234 of file userk.h.

Referenced by xxxScrollWindowEx(), zzzBltValidBits(), and zzzInvalidateDCCache().

#define IDC_DEFAULT   0x0001
 

Definition at line 2232 of file userk.h.

Referenced by LockWindowUpdate2(), UnsetLayeredWindow(), xxxDWP_SetRedraw(), xxxMinimizeHungWindow(), xxxSetLayeredWindow(), xxxSetParent(), xxxSetWindowStyle(), and zzzInvalidateDCCache().

#define IDC_MOVEBLT   0x0008
 

Definition at line 2235 of file userk.h.

Referenced by zzzBltValidBits(), and zzzInvalidateDCCache().

#define IDC_NOMOUSE   0x0010
 

Definition at line 2236 of file userk.h.

Referenced by UnsetLayeredWindow(), xxxSetLayeredWindow(), and zzzInvalidateDCCache().

#define IDHOT_DEBUG   (-5)
 

Definition at line 3835 of file userk.h.

Referenced by SetDebugHotKeys(), and xxxDoHotKeyStuff().

#define IDHOT_DEBUGSERVER   (-6)
 

Definition at line 3836 of file userk.h.

Referenced by SetDebugHotKeys(), and xxxDoHotKeyStuff().

#define IDHOT_WINDOWS   (-7)
 

Definition at line 3837 of file userk.h.

Referenced by RawInputThread(), and xxxDoHotKeyStuff().

#define IEV_EXEC   2
 

Definition at line 3151 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject().

#define IEV_IDLE   0
 

Definition at line 3149 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject().

#define IEV_INPUT   1
 

Definition at line 3150 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject().

#define IEV_TASK   3
 

Definition at line 3152 of file userk.h.

Referenced by xxxSleepTask().

#define IEV_WOWEXEC   4
 

Definition at line 3153 of file userk.h.

Referenced by xxxSleepTask().

#define IMESHOWSTATUS_NOTINITIALIZED   ((BOOL)0xffff)
 

Definition at line 7072 of file userk.h.

Referenced by xxxSetIMEShowStatus(), and xxxUpdatePerUserSystemParameters().

#define IndexUP uSetting   )     (1 << (((uSetting) - SPI_STARTBOOLRANGE) / 2))
 

Definition at line 5266 of file userk.h.

#define INIT_PSEUDO_EVENT ph   )     *ph = PSEUDO_EVENT_OFF;
 

Definition at line 3060 of file userk.h.

Referenced by xxxUserNotifyProcessCreate().

#define INITIAL_POSTMESSAGE_LIMIT   10000
 

Definition at line 6833 of file userk.h.

#define INITIAL_USER_HANDLE_QUOTA   10000
 

Definition at line 6830 of file userk.h.

Referenced by Win32UserInitialize().

 
#define InitPoolLimitations  ) 
 

Definition at line 2121 of file userk.h.

 
#define InitSectionTrace  ) 
 

Definition at line 2127 of file userk.h.

#define IntersectRgn hrgnResult,
hrgnA,
hrgnB   )     GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_AND)
 

Definition at line 2219 of file userk.h.

Referenced by _GetDCEx(), CalcWindowRgn(), CalcWindowVisRgn(), CreateSpb(), GetNCUpdateRgn(), GetTrueClipRgn(), InternalInvalidate2(), InternalScrollDC(), RestoreSpb(), SetMonitorRegion(), SmartRectInRegion(), UserSetDCVisRgn(), ValidateParents(), xxxDrawDragRect(), xxxGetUpdateRgn(), xxxRedrawHungWindow(), and zzzBltValidBits().

#define IS_CURRENT_THREAD_RESTRICTED  ) 
 

Value:

((PtiCurrent()->TIF_flags & TIF_RESTRICTED) ? \ (PtiCurrent()->ppi->pW32Job->restrictions & (r)) : \ FALSE)

Definition at line 3289 of file userk.h.

Referenced by NtUserActivateKeyboardLayout(), NtUserChangeDisplaySettings(), NtUserCreateDesktop(), NtUserGetDC(), NtUserGetDCEx(), NtUserSetClipboardData(), NtUserSwitchDesktop(), and NtUserSystemParametersInfo().

#define IS_THREAD_RESTRICTED pti,
 ) 
 

Value:

((pti->TIF_flags & TIF_RESTRICTED) ? \ (pti->ppi->pW32Job->restrictions & (r)) : \ FALSE)

Definition at line 3284 of file userk.h.

Referenced by NtUserGetClipboardData(), NtUserSetSysColors(), UserGetDesktopDC(), UserGlobalAtomTableCallout(), and ValidateHwnd().

#define ISAMENU pwwnd   )     (GETFNID(pwnd) == FNID_MENU)
 

Definition at line 2800 of file userk.h.

Referenced by xxxMenuWindowProc().

 
#define ISATOMICCHECK  ) 
 

Definition at line 1847 of file userk.h.

Referenced by ChangeAcquireResourceType(), EnterCrit(), EnterSharedCrit(), LeaveCrit(), and zzzSetDesktop().

 
#define ISATOMICDEVICEINFOLISTCHECK  ) 
 

Definition at line 1848 of file userk.h.

 
#define ISCSRSS  )     (PsGetCurrentProcess() == gpepCSRSS)
 

Definition at line 95 of file userk.h.

Referenced by GetDeviceChangeInfo(), InitializeClientPfnArrays(), RemoteConnect(), RemoteLogoff(), RemoteNtSecurity(), RemotePassthruDisable(), RemoteRedrawRectangle(), RemoteShadowCleanup(), RemoteShadowStart(), RemoteThinwireStats(), SetInformationProcess(), VideoPortCalloutThread(), xxxConsoleControl(), xxxHardErrorControl(), xxxQueryInformationThread(), xxxRemoteDisconnect(), xxxRemotePassthruEnable(), xxxRemoteReconnect(), xxxRemoteShadowSetup(), xxxRemoteShadowStop(), xxxRemoteStopScreenUpdates(), xxxRestoreCsrssThreadDesktop(), xxxSetCsrssThreadDesktop(), xxxSetInformationThread(), xxxUserChangeDisplaySettings(), and xxxUserPowerEventCalloutWorker().

#define IsGlobalHooked pti,
fsHook   )     ((fsHook & pti->pDeskInfo->fsHooks) != 0)
 

Definition at line 3777 of file userk.h.

Referenced by xxxCapture(), xxxMoveEventAbsolute(), and zzzInvalidateDCCache().

#define IsHooked pti,
fsHook   )     ((fsHook & (pti->fsHooks | pti->pDeskInfo->fsHooks)) != 0)
 

Definition at line 3774 of file userk.h.

#define ISM_CALLBACK   0x0001
 

Definition at line 3755 of file userk.h.

Referenced by _ReplyMessage(), ReceiverDied(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSendMessageCallback().

#define ISM_CB_CLIENT   0x0100
 

Definition at line 3759 of file userk.h.

Referenced by _ReplyMessage(), ReceiverDied(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSendMessageCallback().

#define ISM_REPLY   0x0020
 

Definition at line 3758 of file userk.h.

Referenced by _ReplyMessage(), ReceiverDied(), xxxInterSendMsgEx(), and xxxReceiveMessage().

#define ISM_REQUEST   0x0010
 

Definition at line 3757 of file userk.h.

#define ISM_TIMEOUT   0x0002
 

Definition at line 3756 of file userk.h.

Referenced by xxxCallHook2(), and xxxSendMessageTimeout().

#define IsValidTag p,
tag   )     TRUE
 

Definition at line 2069 of file userk.h.

 
#define IsWinEventNotifyDeferred  )     (gdwDeferWinEvent > 0)
 

Definition at line 6471 of file userk.h.

Referenced by xxxEndScroll(), xxxNextWindow(), and zzzRecalcThreadAttachment().

 
#define IsWinEventNotifyDeferredOK  )     (!IsWinEventNotifyDeferred() || ISATOMICCHECK())
 

Definition at line 6472 of file userk.h.

Referenced by LeaveCrit(), LockWindowUpdate2(), ResetSharedDesktops(), xxxBeginPaint(), xxxCalcClientRect(), xxxCallJournalPlaybackHook(), xxxCancelCoolSwitch(), xxxCapture(), xxxCreateCaret(), xxxCreateDesktop(), xxxCreateThreadInfo(), xxxCreateWindowEx(), xxxCreateWindowStation(), xxxDesktopThread(), xxxDesktopWndProc(), xxxDestroyThreadInfo(), xxxDoHotKeyStuff(), xxxDragObject(), xxxDWP_SetCursor(), xxxDWP_SetRedraw(), xxxEnableSBCtlArrows(), xxxEnableWindow(), xxxEnableWndSBArrows(), xxxEndDeferWindowPosEx(), xxxFlushDeferredWindowEvents(), xxxGetInputEvent(), xxxHelpLoop(), xxxInternalGetMessage(), xxxMakeWindowForegroundWithState(), xxxMoveSize(), xxxMoveSwitchWndHilite(), xxxMS_TrackMove(), xxxMsgWaitForMultipleObjects(), xxxOldNextWindow(), xxxProcessEventMessage(), xxxSBTrackLoop(), xxxSBWndProc(), xxxScanSysQueue(), xxxScrollWindowEx(), xxxSetProcessInitState(), xxxSetScrollBar(), xxxSetWindowData(), xxxSetWindowStyle(), xxxShowSwitchWindow(), xxxSleepThread(), xxxSwitchDesktop(), xxxSwitchWndProc(), xxxSystemParametersInfo(), xxxTrackBox(), xxxTrackCaptionButton(), xxxTrackInitSize(), and xxxUpdatePerUserSystemParameters().

#define IsWndImeRelated pwnd   ) 
 

Value:

(pwnd->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME] || \ TestCF(pwnd, CFIME))

Definition at line 7226 of file userk.h.

Referenced by NtUserSetImeOwnerWindow().

#define JP_DELTA   4
 

Definition at line 3438 of file userk.h.

Referenced by JobCalloutAddProcess().

#define KDELAY_MASK   0x0060
 

Definition at line 3886 of file userk.h.

Referenced by SetKeyboardRate(), and xxxSystemParametersInfo().

#define KDELAY_SHIFT   5
 

Definition at line 3887 of file userk.h.

Referenced by SetKeyboardRate(), and xxxSystemParametersInfo().

#define KERNEL_STACK_MINIMUM_RESERVE   (4*1024)
 

Definition at line 2385 of file userk.h.

Referenced by xxxSendMessageTimeout().

#define KEYBDHOLD   1
 

Definition at line 2970 of file userk.h.

Referenced by xxxHandleMenuMessages(), xxxMNKeyFilter(), xxxMNMouseMove(), and xxxMNOpenHierarchy().

#define KEYBOARD_MENU   ((LPARAM)-1)
 

Definition at line 3842 of file userk.h.

Referenced by xxxDefWindowProc(), and xxxScanSysQueue().

#define KILLRITTIMER pwnd,
nID   )     FindTimer(pwnd, nID, TMRF_RIT, TRUE)
 

Definition at line 4068 of file userk.h.

Referenced by AccessTimeOutReset(), FilterKeys(), FKActivationTimer(), MouseKeys(), ProcessMouseInput(), StopFilterKeysTimers(), ToggleKeys(), UserKillTimer(), and zzzUpdateCursorImage().

#define KL_RESET   0x40000000
 

Definition at line 2521 of file userk.h.

#define KL_UNLOADED   0x20000000
 

Definition at line 2520 of file userk.h.

Referenced by _GetKeyboardLayoutList(), FreeWindowStation(), HKLtoPKL(), xxxInternalUnloadKeyboardLayout(), and xxxLoadKeyboardLayoutEx().

#define KLT_ALT   1
 

Definition at line 2542 of file userk.h.

#define KLT_ALTBOTHSHIFTS   7
 

Definition at line 2567 of file userk.h.

Referenced by xxxScanSysQueue().

#define KLT_ALTLEFTSHIFT   3
 

Definition at line 2552 of file userk.h.

Referenced by xxxScanSysQueue().

#define KLT_ALTRIGHTSHIFT   5
 

Definition at line 2562 of file userk.h.

Referenced by xxxScanSysQueue().

#define KLT_LEFTSHIFT   2
 

Definition at line 2547 of file userk.h.

#define KLT_NONE   8
 

Definition at line 2572 of file userk.h.

Referenced by xxxNextWindow(), and xxxScanSysQueue().

#define KLT_RIGHTSHIFT   4
 

Definition at line 2557 of file userk.h.

#define KSPEED_MASK   0x001F
 

Definition at line 3885 of file userk.h.

Referenced by SetKeyboardRate(), and xxxSystemParametersInfo().

#define LANGTOGGLEKEYS_SIZE   3
 

Definition at line 6558 of file userk.h.

Referenced by xxxScanSysQueue().

#define LAST_ELEM  )     ( (a) [ N_ELEM(a) - 1 ] )
 

Definition at line 2357 of file userk.h.

#define LINP_INPUTTIMEOUTS   (LINP_SCREENSAVER | LINP_LOWPOWER | LINP_POWEROFF)
 

Definition at line 3272 of file userk.h.

Referenced by ProcessQueuedMouseEvents(), xxxProcessKeyEvent(), and xxxSystemParametersInfo().

#define LINP_KEYBOARD   0x00000001
 

Definition at line 3267 of file userk.h.

Referenced by ProcessQueuedMouseEvents(), xxxProcessKeyEvent(), xxxTrackPopupMenuEx(), and zzzActiveCursorTracking().

#define LINP_LOWPOWER   0x00000004
 

Definition at line 3269 of file userk.h.

Referenced by IdleTimerProc(), and xxxSysCommand().

#define LINP_POWEROFF   0x00000008
 

Definition at line 3270 of file userk.h.

Referenced by IdleTimerProc(), and xxxSysCommand().

#define LINP_POWERTIMEOUTS   (LINP_LOWPOWER | LINP_POWEROFF)
 

Definition at line 3271 of file userk.h.

Referenced by ProcessQueuedMouseEvents(), xxxProcessKeyEvent(), xxxSysCommand(), and xxxSystemParametersInfo().

#define LINP_SCREENSAVER   0x00000002
 

Definition at line 3268 of file userk.h.

#define Lock ppobj,
pobj   )     HMAssignmentLock((PVOID *)ppobj, (PVOID)pobj)
 

Definition at line 1181 of file userk.h.

#define LockDesktop ppdesk,
pdesk,
tag,
extra   ) 
 

Value:

{ \ if (pdesk != NULL) \ { \ UserAssert(OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType); \ } \ LockObjectAssignment(ppdesk, pdesk); \ }

Definition at line 1640 of file userk.h.

Referenced by _DestroyMenu(), CleanupDirtyDesktops(), DestroyClass(), DestroyDesktop(), DestroyWindowStation(), HMAllocObject(), HMChangeOwnerThread(), InternalRegisterClassEx(), ReferenceClass(), RemoteDisableScreen(), RemoteRedrawScreen(), xxxCreateDesktop2(), xxxCreateThreadInfo(), xxxDesktopThread(), xxxDestroyThreadInfo(), xxxSetThreadDesktop(), xxxSwitchDesktop(), and zzzSetDesktop().

#define LockQCursor pq,
pcur   )     Lock(&pq->spcurCurrent, pcur)
 

Definition at line 5944 of file userk.h.

Referenced by AllocQueue(), CleanupResources(), zzzAttachToQueue(), zzzDestroyQueue(), and zzzSetCursor().

#define LOCKRECORD_MARKDESTROY   IntToPtr( 0xFFFFFFFF )
 

Definition at line 2372 of file userk.h.

Referenced by HMMarkObjectDestroy().

#define LOCKRECORD_STACK   8
 

Definition at line 2371 of file userk.h.

Referenced by Idf().

#define LockWinSta ppwinsta,
pwinsta   ) 
 

Value:

{ \ if (pwinsta != NULL) \ { \ UserAssert(OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType); \ } \ LockObjectAssignment(ppwinsta, pwinsta); \ }

Definition at line 1631 of file userk.h.

Referenced by xxxCreateDesktop2(), xxxCreateWindowStation(), and xxxSetProcessWindowStation().

#define LogDesktop pdesk,
tag,
bLock,
extra   ) 
 

Definition at line 1539 of file userk.h.

Referenced by _GetUserObjectInformation(), _SetUserObjectInformation(), LockObjectAssignment(), NtUserBuildHwndList(), NtUserSetThreadDesktop(), NtUserSwitchDesktop(), UnlockObjectAssignment(), ValidateHdesk(), xxxCloseDesktop(), xxxConsoleControl(), xxxCreateDesktop(), xxxCreateDesktop2(), xxxCreateDisconnectDesktop(), xxxCreateWindowStation(), xxxGetThreadDesktop(), xxxOpenDesktop(), xxxResolveDesktop(), xxxRestoreCsrssThreadDesktop(), xxxSetCsrssThreadDesktop(), and zzzSetDesktop().

#define LOGTIME gt   )     gt = MonotonicTick();
 

Definition at line 1855 of file userk.h.

Referenced by ProcessMouseInput(), QueueMouseEvent(), StartDeviceRead(), and UnqueueMouseEvent().

#define LOWPOWER_PHASE   1
 

Definition at line 6630 of file userk.h.

Referenced by IdleTimerProc(), and xxxSysCommand().

#define LPK_DRAWTEXTEX   0x04
 

Definition at line 3525 of file userk.h.

Referenced by DT_InitDrawTextInfo().

#define LPK_EDITCONTROL   0x08
 

Definition at line 3526 of file userk.h.

#define LPK_INSTALLED   0x0f
 

Definition at line 3527 of file userk.h.

Referenced by xxxDrawItemUnderline().

#define LPK_PSMTEXTOUT   0x02
 

Definition at line 3524 of file userk.h.

#define LPK_TABBEDTEXTOUT   0x01
 

Definition at line 3523 of file userk.h.

#define MAX_MOUSEPOINTS   64
 

Definition at line 1758 of file userk.h.

Referenced by _GetMouseMovePointsEx(), NtUserGetMouseMovePointsEx(), and UpdateUserScreen().

#define MAX_STACK_CALLS   8
 

Definition at line 1788 of file userk.h.

#define MAXIMUM_ITEMS_READ   10
 

Definition at line 1863 of file userk.h.

#define MAXIMUM_READ_RETRIES   5
 

Definition at line 1869 of file userk.h.

Referenced by StartDeviceRead().

#define MAXPROFILEBUF   256
 

Definition at line 6881 of file userk.h.

#define MINIMUM_POSTMESSAGE_LIMIT   4000
 

Definition at line 6834 of file userk.h.

Referenced by Win32UserInitialize().

#define MINIMUM_USER_HANDLE_QUOTA   200
 

Definition at line 6831 of file userk.h.

Referenced by Win32UserInitialize().

#define MINMAX_ANIMATE   0x10000
 

Definition at line 4323 of file userk.h.

Referenced by xxxMinMaximize(), and xxxShowWindow().

#define MINMAX_KEEPHIDDEN   0x1
 

Definition at line 4322 of file userk.h.

Referenced by NtUserMinMaximize(), xxxCreateWindowEx(), xxxMinMaximize(), and xxxProcessHungThreadEvent().

#define MNGetpItemIndex   _MNGetpItemIndex
 

Definition at line 4892 of file userk.h.

Referenced by xxxInsertMenuItem(), and xxxRemoveDeleteMenuHelper().

#define MNIS_MEASUREBMP   -1
 

Definition at line 4793 of file userk.h.

Referenced by MenuRecalc(), xxxInsertMenuItem(), xxxMNGetBitmapSize(), xxxMNItemSize(), and xxxSetLPITEMInfo().

#define MNLEFTMARGIN   (SYSMET(CXEDGE))
 

Definition at line 4783 of file userk.h.

Referenced by xxxMNCompute(), xxxMNItemSize(), and xxxRealDrawMenuItem().

#define MNSW_DRAWFRAME   MNUS_DRAWFRAME
 

Definition at line 4802 of file userk.h.

Referenced by xxxMenuWindowProc().

#define MNSW_RETURNSIZE   0
 

Definition at line 4800 of file userk.h.

Referenced by xxxMenuWindowProc().

#define MNSW_SIZE   MNUS_DEFAULT
 

Definition at line 4801 of file userk.h.

Referenced by xxxMNOpenHierarchy(), and xxxTrackPopupMenuEx().

#define MNUS_DEFAULT   0x00000001
 

Definition at line 4788 of file userk.h.

Referenced by xxxEnableMenuItem(), xxxSetLPITEMInfo(), and xxxSetMenuInfo().

#define MNUS_DELETE   0x00000002
 

Definition at line 4789 of file userk.h.

Referenced by xxxMNUpdateShownMenu(), and xxxRemoveDeleteMenuHelper().

#define MNUS_DRAWFRAME   0x00000004
 

Definition at line 4790 of file userk.h.

Referenced by xxxMNUpdateShownMenu(), and xxxSetMenuInfo().

#define MNXBORDER   (SYSMET(CXBORDER) + SYSMET(CXEDGE))
 

Definition at line 4780 of file userk.h.

Referenced by MNEraseBackground(), and xxxMenuWindowProc().

#define MNXSPACE   (SYSMET(CXEDGE))
 

Definition at line 4782 of file userk.h.

Referenced by xxxDrawMenuBarUnderlines(), xxxMNCompute(), xxxMNItemSize(), and xxxRealDrawMenuItem().

#define MNYBORDER   (SYSMET(CYBORDER) + SYSMET(CYEDGE))
 

Definition at line 4781 of file userk.h.

Referenced by MNEraseBackground(), and xxxMenuWindowProc().

#define MODIFIER_FOR_ALT_NUMPAD wModBit   ) 
 

Value:

(((wModBits) == KBDALT) || ((wModBits) == (KBDALT | KBDSHIFT)) || \ ((wModBits) == (KBDKANA | KBDALT)) || ((wModBits) == (KBDKANA | KBDALT | KBDSHIFT)))

Definition at line 3996 of file userk.h.

#define MOUSE_SENSITIVITY_DEFAULT   10
 

Definition at line 3956 of file userk.h.

Referenced by GetMouseCoord(), and xxxUpdatePerUserSystemParameters().

#define MOUSE_SENSITIVITY_MAX   20
 

Definition at line 3957 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define MOUSE_SENSITIVITY_MIN   1
 

Definition at line 3955 of file userk.h.

#define MOUSEHOLD   -1 /* Mouse button held down and dragging */
 

Definition at line 2969 of file userk.h.

Referenced by xxxHandleMenuMessages(), xxxMNLoop(), xxxMNMouseMove(), xxxSendMenuSelect(), and xxxTrackPopupMenuEx().

#define N_ELEM  )     (sizeof(a)/sizeof(a[0]))
 

Definition at line 2356 of file userk.h.

#define NCA_ACTIVE   0x00000001
 

Definition at line 5035 of file userk.h.

Referenced by xxxDefWindowProc(), xxxDWP_DoNCActivate(), xxxEndMenuLoop(), and xxxMenuWindowProc().

#define NCA_FORCEFRAMEOFF   0x00000002
 

Definition at line 5036 of file userk.h.

Referenced by xxxDWP_DoNCActivate(), xxxEndMenuLoop(), and xxxMenuWindowProc().

#define NEEDSSYNCPAINT pwnd   )     TestWF(pwnd, WFSENDERASEBKGND | WFSENDNCPAINT)
 

Definition at line 2402 of file userk.h.

Referenced by xxxFreeWindow().

#define NELEM_BUTTONQUEUE   16
 

Definition at line 1864 of file userk.h.

Referenced by QueueMouseEvent(), and UnqueueMouseEvent().

#define NEXTPOINT  )     ((i + 1) % MAX_MOUSEPOINTS)
 

Definition at line 1763 of file userk.h.

#define NEXTPOINTCOUNT c   ) 
 

Value:

{ \ if (c < MAX_MOUSEPOINTS) \ c++; \ }

Definition at line 1766 of file userk.h.

#define NO_CAP_CLIENT   0 /* no capture; in client area */
 

Definition at line 3847 of file userk.h.

Referenced by xxxCancelTrackingForThread(), xxxCapture(), xxxMouseActivate(), xxxReleaseCapture(), and xxxScanSysQueue().

#define NO_CAP_SYS   1 /* no capture; in sys area */
 

Definition at line 3848 of file userk.h.

Referenced by MNItemHitTest(), and xxxScanSysQueue().

#define NTW_IGNORETOOLWINDOW   2
 

Definition at line 4454 of file userk.h.

Referenced by IsTopmostRealApp(), NextTopWindow(), and xxxActivateWindow().

#define NTW_PREVIOUS   1
 

Definition at line 4453 of file userk.h.

Referenced by NextTopWindow(), xxxNextWindow(), and xxxOldNextWindow().

#define NUMPAD_HEXMODE_HL   (2)
 

Definition at line 3994 of file userk.h.

Referenced by NumPadScanCodeToHex(), xxxInternalToUnicode(), xxxScanSysQueue(), and xxxTranslateAccelerator().

#define NUMPAD_HEXMODE_LL   (1)
 

Definition at line 3993 of file userk.h.

Referenced by xxxDoHotKeyStuff(), and xxxKeyEvent().

#define OCR_APPSTARTING   32650
 

Definition at line 6424 of file userk.h.

#define OEMRESOURCE   1
 

Definition at line 35 of file userk.h.

#define PAS_DOWN   (TPM_VERPOSANIMATION >> TPM_FIRSTANIBITPOS)
 

Definition at line 4809 of file userk.h.

Referenced by FindBestPos(), xxxMNPositionHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_HORZ   (PAS_LEFT | PAS_RIGHT)
 

Definition at line 4812 of file userk.h.

Referenced by FindBestPos(), MNAnimate(), xxxMenuWindowProc(), xxxMNPositionHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_LEFT   (TPM_HORNEGANIMATION >> TPM_FIRSTANIBITPOS)
 

Definition at line 4808 of file userk.h.

Referenced by FindBestPos(), MNAnimate(), xxxMNOpenHierarchy(), xxxMNPositionHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_OUT   0x10
 

Definition at line 4811 of file userk.h.

Referenced by xxxMenuWindowProc(), xxxMNOpenHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_RIGHT   (TPM_HORPOSANIMATION >> TPM_FIRSTANIBITPOS)
 

Definition at line 4807 of file userk.h.

Referenced by FindBestPos(), xxxMNOpenHierarchy(), xxxMNPositionHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_UP   (TPM_VERNEGANIMATION >> TPM_FIRSTANIBITPOS)
 

Definition at line 4810 of file userk.h.

Referenced by FindBestPos(), MNAnimate(), xxxMNPositionHierarchy(), and xxxTrackPopupMenuEx().

#define PAS_VERT   (PAS_UP | PAS_DOWN)
 

Definition at line 4813 of file userk.h.

Referenced by FindBestPos(), MNAnimate(), xxxMenuWindowProc(), and xxxTrackPopupMenuEx().

#define PEM_ACTIVATE_NOZORDER   0x0002
 

Definition at line 3018 of file userk.h.

Referenced by xxxProcessEventMessage(), and xxxSetForegroundWindow2().

#define PEM_ACTIVATE_RESTORE   0x0001
 

Definition at line 3017 of file userk.h.

Referenced by xxxProcessEventMessage(), and xxxSetForegroundWindow2().

#define PFNHOOK phk   ) 
 

Value:

(phk->ihmod == -1 ? (PROC)phk->offPfn : \ (PROC)(((ULONG_PTR)(PtiCurrent()->ppi->ahmodLibLoaded[phk->ihmod])) + \ ((ULONG_PTR)(phk->offPfn))))

Definition at line 3670 of file userk.h.

Referenced by xxxGetEventProc(), xxxHkCallHook(), and zzzUnhookWindowsHook().

#define PLAST_ELEM  )     (&LAST_ELEM(a))
 

Definition at line 2358 of file userk.h.

#define PMAP_AEDEBUG   22
 

Definition at line 6861 of file userk.h.

Referenced by SetDebugHotKeys().

#define PMAP_BEEP   12
 

Definition at line 6851 of file userk.h.

Referenced by LW_LoadResources(), and xxxSystemParametersInfo().

#define PMAP_COLORS   0
 

Definition at line 6839 of file userk.h.

Referenced by xxxODI_ColorInit().

#define PMAP_COMPAT   10
 

Definition at line 6849 of file userk.h.

#define PMAP_COMPAT2   37
 

Definition at line 6876 of file userk.h.

Referenced by SetAppCompatFlags().

#define PMAP_COMPAT32   34
 

Definition at line 6873 of file userk.h.

Referenced by SetAppCompatFlags().

#define PMAP_CURSORS   1
 

Definition at line 6840 of file userk.h.

Referenced by xxxUpdateSystemCursorsFromRegistry().

#define PMAP_DESKTOP   4
 

Definition at line 6843 of file userk.h.

Referenced by CheckDesktopPolicy(), CheckDesktopPolicyChange(), GetDeskWallpaperName(), OpenCacheKeyEx(), xxxSetDeskPattern(), xxxSetDeskWallpaper(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PMAP_FONTS   6
 

Definition at line 6845 of file userk.h.

Referenced by bEnumerateRegistryFonts().

#define PMAP_HIGHCONTRAST   30
 

Definition at line 6869 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_ICONS   5
 

Definition at line 6844 of file userk.h.

Referenced by xxxUpdateSystemIconsFromRegistry().

#define PMAP_IMECOMPAT   31
 

Definition at line 6870 of file userk.h.

Referenced by SetAppImeCompatFlags().

#define PMAP_IMM   32
 

Definition at line 6871 of file userk.h.

Referenced by IsIMMEnabledSystem().

#define PMAP_INPUT   9
 

Definition at line 6848 of file userk.h.

Referenced by OpenMultiplePortDevice().

#define PMAP_INPUTMETHOD   36
 

Definition at line 6875 of file userk.h.

Referenced by xxxSetIMEShowStatus(), and xxxUpdatePerUserSystemParameters().

#define PMAP_KBDCLASS_PARAMS   39
 

Definition at line 6878 of file userk.h.

#define PMAP_KBDLAYOUT   8
 

Definition at line 6847 of file userk.h.

Referenced by InitScancodeMap().

#define PMAP_KEYBOARD   14
 

Definition at line 6853 of file userk.h.

Referenced by RegisterPerUserKeyboardIndicators(), UpdatePerUserKeyboardIndicators(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PMAP_KEYBOARDPREF   28
 

Definition at line 6867 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_KEYBOARDRESPONSE   16
 

Definition at line 6855 of file userk.h.

Referenced by SetFilterKeys(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_LAST   39
 

Definition at line 6879 of file userk.h.

Referenced by FastGetProfileDwordW(), FastGetProfileIntFromID(), FastGetProfileIntW(), FastGetProfileKeysW(), FastGetProfileStringFromIDW(), FastGetProfileStringW(), FastGetProfileValue(), FastUpdateWinIni(), FastWriteProfileStringW(), FastWriteProfileValue(), OpenCacheKeyEx(), and RemoteOpenCacheKeyEx().

#define PMAP_METRICS   24
 

Definition at line 6863 of file userk.h.

Referenced by CreateFontFromWinIni(), MetricGetID(), SetWindowMetricFont(), SetWindowMetricInt(), and xxxUpdatePerUserSystemParameters().

#define PMAP_MOUCLASS_PARAMS   38
 

Definition at line 6877 of file userk.h.

#define PMAP_MOUSE   13
 

Definition at line 6852 of file userk.h.

Referenced by LW_LoadResources(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PMAP_MOUSEKEYS   17
 

Definition at line 6856 of file userk.h.

Referenced by SetMouseKeys(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_NETWORK   23
 

Definition at line 6862 of file userk.h.

Referenced by xxxUpdatePerUserSystemParameters().

#define PMAP_POOLLIMITS   33
 

Definition at line 6872 of file userk.h.

#define PMAP_SCREENREADER   29
 

Definition at line 6868 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_SETUPPROGRAMNAMES   35
 

Definition at line 6874 of file userk.h.

Referenced by CreateSetupNameArray().

#define PMAP_SHOWSOUNDS   21
 

Definition at line 6860 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_SOUNDSENTRY   20
 

Definition at line 6859 of file userk.h.

Referenced by SetSoundSentry(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_STICKYKEYS   15
 

Definition at line 6854 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_SUBSYSTEMS   11
 

Definition at line 6850 of file userk.h.

Referenced by InitCreateUserSubsystem().

#define PMAP_TIMEOUT   19
 

Definition at line 6858 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_TOGGLEKEYS   18
 

Definition at line 6857 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define PMAP_TRUETYPE   7
 

Definition at line 6846 of file userk.h.

Referenced by xxxUpdatePerUserSystemParameters().

#define PMAP_UKBDLAYOUT   25
 

Definition at line 6864 of file userk.h.

Referenced by xxxUpdatePerUserSystemParameters().

#define PMAP_UKBDLAYOUTTOGGLE   26
 

Definition at line 6865 of file userk.h.

Referenced by GetKbdLangSwitch().

#define PMAP_WINDOWSM   2
 

Definition at line 6841 of file userk.h.

Referenced by LW_LoadProfileInitData(), and Win32UserInitialize().

#define PMAP_WINDOWSU   3
 

Definition at line 6842 of file userk.h.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PMAP_WINLOGON   27
 

Definition at line 6866 of file userk.h.

Referenced by bEnumerateRegistryFonts().

#define POBJECT_NAME pobj   ) 
 

Value:

Definition at line 4569 of file userk.h.

Referenced by _GetUserObjectInformation(), ParseDesktop(), xxxHardErrorControl(), and xxxSwitchDesktop().

#define POLICY_ALL   (POLICY_NONE | POLICY_USER | POLICY_MACHINE)
 

Definition at line 6886 of file userk.h.

Referenced by OpenCacheKeyEx().

#define POLICY_MACHINE   0x0004
 

Definition at line 6885 of file userk.h.

Referenced by CheckDesktopPolicy(), CheckDesktopPolicyChange(), and OpenCacheKeyEx().

#define POLICY_NONE   0x0001
 

Definition at line 6883 of file userk.h.

Referenced by OpenCacheKeyEx().

#define POLICY_USER   0x0002
 

Definition at line 6884 of file userk.h.

Referenced by CheckDesktopPolicy(), CheckDesktopPolicyChange(), and OpenCacheKeyEx().

#define POLL_EVENT_CNT   5
 

Definition at line 3147 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject(), and xxxSleepTask().

#define POOL_BREAK_FOR_LEAKS   0x00000080
 

Definition at line 2084 of file userk.h.

#define POOL_CAPTURE_STACK   0x00000002
 

Definition at line 2078 of file userk.h.

#define POOL_FAIL_ALLOCS   0x00000004
 

Definition at line 2079 of file userk.h.

#define POOL_FAIL_BY_INDEX   0x00000008
 

Definition at line 2080 of file userk.h.

#define POOL_HEAVY_ALLOCS   0x00000001
 

Definition at line 2077 of file userk.h.

#define POOL_KEEP_FAIL_RECORD   0x00000040
 

Definition at line 2083 of file userk.h.

#define POOL_KEEP_FREE_RECORD   0x00000020
 

Definition at line 2082 of file userk.h.

#define POOL_TAIL_CHECK   0x00000010
 

Definition at line 2081 of file userk.h.

#define POWEROFF_PHASE   2
 

Definition at line 6631 of file userk.h.

Referenced by IdleTimerProc(), and xxxSysCommand().

#define POWERON_PHASE   -1
 

Definition at line 6629 of file userk.h.

Referenced by xxxSysCommand().

 
#define PpiCurrent  )     ((PPROCESSINFO)(W32GetCurrentProcess()))
 

Definition at line 84 of file userk.h.

Referenced by _DestroyCursor(), _FindExistingCursorIcon(), _GetComboBoxInfo(), _GetDCEx(), _GetListBoxInfo(), _GetProcessWindowStation(), _LockSetForegroundWindow(), _MapDesktopObject(), _SetClassWord(), _SetDoubleClickTime(), _SetSystemTimer(), _SetTimer(), _SwapMouseButton(), _WOWCleanup(), _WOWModuleUnload(), CheckHandleFlag(), CheckWHFBits(), CheckWinstaWriteAttributesAccess(), CleanupResources(), DelayedDestroyCacheDC(), DestroyCacheDC(), DestroyClassBrush(), DT_InitDrawTextInfo(), FinalUserInit(), HMChangeOwnerThread(), IsHandleEntrySecure(), NtUserAlterWindowStyle(), NtUserGetAsyncKeyState(), NtUserGetCaretBlinkTime(), NtUserGetClipCursor(), NtUserGetDoubleClickTime(), NtUserInitTask(), NtUserModifyUserStartupInfoFlags(), NtUserSetAppImeLevel(), NtUserSetWindowFNID(), NtUserSystemParametersInfo(), OpenDesktopCompletion(), RegisterLPK(), SetAppCompatFlags(), SetAppImeCompatFlags(), SetDialogPointer(), SetHandleFlag(), TestWindowProcess(), UnlinkCursor(), UnloadCursorsAndIcons(), UserCommitDesktopMemory(), UserCommitSharedMemory(), xxxAllowSetForegroundWindow(), xxxClientLoadOLE(), xxxCloseDesktop(), xxxCreateDesktop(), xxxCreateThreadInfo(), xxxDestroyThreadInfo(), xxxDrawItemUnderline(), xxxFreeWindow(), xxxGetControlColor(), xxxGetThreadDesktop(), xxxHkCallHook(), xxxImmActivateThreadsLayout(), xxxInterSendMsgEx(), xxxRegisterUserHungAppHandlers(), xxxSetClassLongPtr(), xxxSetWindowData(), xxxSetWindowLongPtr(), xxxSetWindowStyle(), xxxSystemParametersInfo(), xxxUserNotifyConsoleApplication(), xxxWindowHitTest2(), and zzzShowStartGlass().

#define PpiFromProcess Process   )     ((PPROCESSINFO)((PW32PROCESS)(Process)->Win32Process))
 

Definition at line 89 of file userk.h.

Referenced by CheckAllowForeground(), FreeView(), GetThreadsWithPKL(), InitiateShutdown(), MapDesktop(), ProcessDeviceChanges(), ReferenceWindowStation(), SetGlobalCursorLevel(), SetInformationProcess(), xxxAllowSetForegroundWindow(), xxxCreateDesktop(), xxxGetThreadDesktop(), xxxResolveDesktop(), xxxSetProcessWindowStation(), and xxxUserNotifyConsoleApplication().

#define PREVPOINT  )     ((i == 0) ? (MAX_MOUSEPOINTS - 1) : ((i - 1) % MAX_MOUSEPOINTS))
 

Definition at line 1760 of file userk.h.

Referenced by _GetMouseMovePointsEx().

#define ProbeAndReadBlendfunction Address   ) 
 

Value:

(((Address) >= (BLENDFUNCTION * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile BLENDFUNCTION * const)MM_USER_PROBE_ADDRESS) : (*(volatile BLENDFUNCTION *)(Address)))

Definition at line 169 of file userk.h.

Referenced by NtUserUpdateLayeredWindow().

#define ProbeAndReadBroadcastSystemMsgParams Address   ) 
 

Value:

(((Address) >= (BROADCASTSYSTEMMSGPARAMS * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile BROADCASTSYSTEMMSGPARAMS * const)MM_USER_PROBE_ADDRESS) : (*(volatile BROADCASTSYSTEMMSGPARAMS *)(Address)))

Definition at line 575 of file userk.h.

Referenced by xxxWrapSendMessageBSM().

#define ProbeAndReadCandidateForm Address   ) 
 

Value:

(((Address) >= (CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) : (*(volatile CANDIDATEFORM *)(Address)))

Definition at line 668 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadCBTActivateStruct Address   ) 
 

Value:

(((Address) >= (CBTACTIVATESTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CBTACTIVATESTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile CBTACTIVATESTRUCT *)(Address)))

Definition at line 441 of file userk.h.

Referenced by NtUserfnHkINLPCBTACTIVATESTRUCT().

#define ProbeAndReadCBTCreateStruct Address   ) 
 

Value:

(((Address) >= (CBT_CREATEWND * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CBT_CREATEWND * const)MM_USER_PROBE_ADDRESS) : (*(volatile CBT_CREATEWND *)(Address)))

Definition at line 510 of file userk.h.

Referenced by NtUserfnHkINLPCBTCREATESTRUCT().

#define ProbeAndReadCompareItemStruct Address   ) 
 

Value:

(((Address) >= (COMPAREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile COMPAREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile COMPAREITEMSTRUCT *)(Address)))

Definition at line 363 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadCompositionForm Address   ) 
 

Value:

(((Address) >= (COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) : (*(volatile COMPOSITIONFORM *)(Address)))

Definition at line 681 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadCopyDataStruct Address   ) 
 

Value:

(((Address) >= (COPYDATASTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile COPYDATASTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile COPYDATASTRUCT *)(Address)))

Definition at line 350 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadCreateStruct Address   ) 
 

Value:

(((Address) >= (CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) : (*(volatile CREATESTRUCTW *)(Address)))

Definition at line 324 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadCursorData Address   ) 
 

Value:

(((Address) >= (CURSORDATA * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CURSORDATA * const)MM_USER_PROBE_ADDRESS) : (*(volatile CURSORDATA *)(Address)))

Definition at line 588 of file userk.h.

Referenced by NtUserSetCursorIconData().

#define ProbeAndReadCursorFind Address   ) 
 

Value:

(((Address) >= (CURSORFIND * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile CURSORFIND * const)MM_USER_PROBE_ADDRESS) : (*(volatile CURSORFIND *)(Address)))

Definition at line 549 of file userk.h.

Referenced by NtUserFindExistingCursorIcon().

#define ProbeAndReadDeleteItemStruct Address   ) 
 

Value:

(((Address) >= (DELETEITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DELETEITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile DELETEITEMSTRUCT *)(Address)))

Definition at line 376 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadDrawItemStruct Address   ) 
 

Value:

(((Address) >= (DRAWITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DRAWITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile DRAWITEMSTRUCT *)(Address)))

Definition at line 415 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadHelp Address   ) 
 

Value:

(((Address) >= (HLP * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile HLP * const)MM_USER_PROBE_ADDRESS) : (*(volatile HLP *)(Address)))

Definition at line 389 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadHelpInfo Address   ) 
 

Value:

(((Address) >= (HELPINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile HELPINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile HELPINFO *)(Address)))

Definition at line 402 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadHookInfo Address   ) 
 

Value:

(((Address) >= (DEBUGHOOKINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DEBUGHOOKINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile DEBUGHOOKINFO *)(Address)))

Definition at line 428 of file userk.h.

Referenced by NtUserfnHkINLPDEBUGHOOKSTRUCT().

#define ProbeAndReadKbdHook Address   ) 
 

Value:

(((Address) >= (KBDLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile KBDLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile KBDLLHOOKSTRUCT *)(Address)))

Definition at line 454 of file userk.h.

Referenced by NtUserfnHkINLPKBDLLHOOKSTRUCT().

#define ProbeAndReadLargeString Address   ) 
 

Value:

(((Address) >= (LARGE_STRING * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile LARGE_STRING * const)MM_USER_PROBE_ADDRESS) : (*(volatile LARGE_STRING *)(Address)))

Definition at line 233 of file userk.h.

Referenced by NtUserCreateWindowEx(), NtUserDefSetText(), and NtUserSendNotifyMessage().

#define ProbeAndReadLogFontW Address   ) 
 

Value:

(((Address) >= (LOGFONTW * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile LOGFONTW * const)MM_USER_PROBE_ADDRESS) : (*(volatile LOGFONTW *)(Address)))

Definition at line 694 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadMDICreateStruct Address   ) 
 

Value:

(((Address) >= (MDICREATESTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MDICREATESTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile MDICREATESTRUCT *)(Address)))

Definition at line 337 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadMenuGetObjectInfo Address   ) 
 

Value:

(((Address) >= (MENUGETOBJECTINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MENUGETOBJECTINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUGETOBJECTINFO *)(Address)))

Definition at line 1069 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeAndReadMenuInfo Address   ) 
 

Value:

(((Address) >= (MENUINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MENUINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUINFO *)(Address)))

Definition at line 272 of file userk.h.

Referenced by NtUserThunkedMenuInfo().

#define ProbeAndReadMenuItem Address   ) 
 

Value:

(((Address) >= (MENUITEMINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MENUITEMINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile MENUITEMINFO *)(Address)))

Definition at line 259 of file userk.h.

Referenced by NtUserThunkedMenuItemInfo().

#define ProbeAndReadMessage Address   ) 
 

Value:

(((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MSG * const)MM_USER_PROBE_ADDRESS) : (*(volatile MSG *)(Address)))

Definition at line 220 of file userk.h.

Referenced by NtUserDispatchMessage(), NtUserfnHkINLPMSG(), NtUserTranslateAccelerator(), and NtUserTranslateMessage().

#define ProbeAndReadMouseHook Address   ) 
 

Value:

(((Address) >= (MOUSEHOOKSTRUCTEX * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MOUSEHOOKSTRUCTEX * const)MM_USER_PROBE_ADDRESS) : (*(volatile MOUSEHOOKSTRUCTEX *)(Address)))

Definition at line 479 of file userk.h.

Referenced by NtUserfnHkINLPMOUSEHOOKSTRUCTEX().

#define ProbeAndReadMsllHook Address   ) 
 

Value:

(((Address) >= (MSLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile MSLLHOOKSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile MSLLHOOKSTRUCT *)(Address)))

Definition at line 466 of file userk.h.

Referenced by NtUserfnHkINLPMSLLHOOKSTRUCT().

#define ProbeAndReadPaintStruct Address   ) 
 

Value:

(((Address) >= (PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) : (*(volatile PAINTSTRUCT *)(Address)))

Definition at line 311 of file userk.h.

Referenced by MESSAGECALL(), and NtUserEndPaint().

#define ProbeAndReadPoint Address   ) 
 

Value:

(((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile POINT * const)MM_USER_PROBE_ADDRESS) : (*(volatile POINT *)(Address)))

Definition at line 186 of file userk.h.

Referenced by NtUserMNDragOver(), NtUserSetInternalWindowPos(), and NtUserUpdateLayeredWindow().

#define ProbeAndReadPopupParams Address   ) 
 

Value:

(((Address) >= (TPMPARAMS * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile TPMPARAMS * const)MM_USER_PROBE_ADDRESS) : (*(volatile TPMPARAMS *)(Address)))

Definition at line 298 of file userk.h.

Referenced by NtUserTrackPopupMenuEx().

#define ProbeAndReadRect Address   ) 
 

Value:

(((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile RECT * const)MM_USER_PROBE_ADDRESS) : (*(volatile RECT *)(Address)))

Definition at line 203 of file userk.h.

Referenced by MESSAGECALL(), NtUserClipCursor(), NtUserDrawAnimatedRects(), NtUserDrawCaption(), NtUserDrawCaptionTemp(), NtUserDrawMenuBarTemp(), NtUserEnumDisplayMonitors(), NtUserfnHkINLPRECT(), NtUserInvalidateRect(), NtUserRedrawWindow(), NtUserScrollDC(), NtUserScrollWindowEx(), NtUserSetInternalWindowPos(), and NtUserValidateRect().

#define ProbeAndReadScrollInfo Address   ) 
 

Value:

(((Address) >= (SCROLLINFO * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile SCROLLINFO * const)MM_USER_PROBE_ADDRESS) : (*(volatile SCROLLINFO *)(Address)))

Definition at line 285 of file userk.h.

Referenced by NtUserSetScrollInfo().

#define ProbeAndReadSetClipBData Address   ) 
 

Value:

(((Address) >= (SETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile SETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) : (*(volatile SETCLIPBDATA *)(Address)))

Definition at line 562 of file userk.h.

Referenced by NtUserSetClipboardData().

#define ProbeAndReadSize Address   ) 
 

Value:

(((Address) >= (SIZE * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile SIZE * const)MM_USER_PROBE_ADDRESS) : (*(volatile SIZE *)(Address)))

Definition at line 165 of file userk.h.

Referenced by NtUserUpdateLayeredWindow().

#define ProbeAndReadTrackMouseEvent Address   ) 
 

Value:

(((Address) >= (TRACKMOUSEEVENT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile TRACKMOUSEEVENT * const)MM_USER_PROBE_ADDRESS) : (*(volatile TRACKMOUSEEVENT *)(Address)))

Definition at line 523 of file userk.h.

Referenced by NtUserTrackMouseEvent().

#define ProbeAndReadWindowPlacement Address   ) 
 

Value:

(((Address) >= (WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) : (*(volatile WINDOWPLACEMENT *)(Address)))

Definition at line 246 of file userk.h.

Referenced by NtUserSetWindowPlacement().

#define ProbeAndReadWindowPos Address   ) 
 

Value:

(((Address) >= (WINDOWPOS * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile WINDOWPOS * const)MM_USER_PROBE_ADDRESS) : (*(volatile WINDOWPOS *)(Address)))

Definition at line 536 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForReadBuffer Address,
Count,
Alignment   ) 
 

Value:

{ \ if ((ULONG)(Count) > (ULONG)(MAXULONG / sizeof(*(Address)))) { \ ExRaiseAccessViolation(); \ } \ ProbeForRead(Address, (ULONG)(Count) * sizeof(*(Address)), Alignment); \ }

Definition at line 151 of file userk.h.

Referenced by MESSAGECALL(), NtUserCreateAcceleratorTable(), NtUserGetPriorityClipboardFormat(), NtUserSendInput(), NtUserSetSysColors(), and ProbeAndCaptureSoftKbdData().

#define ProbeForReadReconvertString pReconv   )     ProbeForRead((pReconv), (pReconv)->dwSize, 1)
 

Definition at line 1039 of file userk.h.

#define ProbeForReadUnicodeStringBuffer String   ) 
 

Value:

if (((ULONG_PTR)((String).Buffer) & (sizeof(WCHAR) - 1)) != 0) { \ ExRaiseDatatypeMisalignment(); \ } else if ((((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) < (ULONG_PTR)((String).Buffer)) || \ (((ULONG_PTR)((String).Buffer) + ((String).Length) + sizeof(UNICODE_NULL)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ ExRaiseAccessViolation(); \ } else if (((String).Length) > ((String).MaximumLength)) { \ ExRaiseAccessViolation(); \ }

Definition at line 612 of file userk.h.

Referenced by GetHmodTableIndex(), NtUserCreateWindowStation(), NtUserFindExistingCursorIcon(), NtUserFindWindowEx(), NtUserGetWOWClass(), NtUserInitTask(), NtUserRegisterWindowMessage(), NtUserResolveDesktop(), NtUserSendNotifyMessage(), NtUserSetCursorIconData(), NtUserSystemParametersInfo(), NtUserThunkedMenuItemInfo(), and SetAppCompatFlags().

#define ProbeForReadUnicodeStringBufferOrId String   ) 
 

Value:

if (IS_PTR((String).Buffer)) { \ ProbeForReadUnicodeStringBuffer(String); \ }

Definition at line 654 of file userk.h.

Referenced by NtUserFindExistingCursorIcon(), NtUserFindWindowEx(), NtUserGetClassInfo(), NtUserRegisterClassExWOW(), NtUserSetClassLongPtr(), NtUserSetCursorIconData(), and NtUserUnregisterClass().

#define ProbeForReadUnicodeStringFullBuffer String   ) 
 

Value:

if (((ULONG_PTR)((String).Buffer) & (sizeof(WCHAR) - 1)) != 0) { \ ExRaiseDatatypeMisalignment(); \ } else if ((((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) < (ULONG_PTR)((String).Buffer)) || \ (((ULONG_PTR)((String).Buffer) + ((String).MaximumLength)) > (ULONG_PTR)MM_USER_PROBE_ADDRESS)) { \ ExRaiseAccessViolation(); \ } else if (((String).Length) > ((String).MaximumLength)) { \ ExRaiseAccessViolation(); \ }

Definition at line 634 of file userk.h.

Referenced by NtUserResolveDesktopForWOW().

#define ProbeForWriteBuffer Address,
Count,
Alignment   ) 
 

Value:

{ \ if ((ULONG)(Count) > (ULONG)(MAXULONG / sizeof(*(Address)))) { \ ExRaiseAccessViolation(); \ } \ ProbeForWrite(Address, (ULONG)(Count) * sizeof(*(Address)), Alignment); \ }

Definition at line 158 of file userk.h.

Referenced by MESSAGECALL(), NtUserBuildHimcList(), NtUserBuildHwndList(), NtUserBuildPropList(), NtUserCopyAcceleratorTable(), NtUserGetAltTabInfo(), NtUserGetClipboardFormatName(), NtUserGetKeyboardLayoutList(), NtUserGetKeyNameText(), NtUserGetMouseMovePointsEx(), NtUserInternalGetWindowText(), NtUserSystemParametersInfo(), and NtUserToUnicodeEx().

#define ProbeForWriteCandidateForm Address   ) 
 

Value:

{ \ if ((Address) >= (CANDIDATEFORM * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile CANDIDATEFORM *)(Address) = *(volatile CANDIDATEFORM *)(Address); \ }

Definition at line 981 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteCompositionForm Address   ) 
 

Value:

{ \ if ((Address) >= (COMPOSITIONFORM * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile COMPOSITIONFORM *)(Address) = *(volatile COMPOSITIONFORM *)(Address);\ }

Definition at line 998 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteCreateStruct Address   ) 
 

Value:

{ \ if ((Address) >= (CREATESTRUCTW * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile CREATESTRUCTW *)(Address) = *(volatile CREATESTRUCTW *)(Address);\ }

Definition at line 844 of file userk.h.

Referenced by NtUserfnHkINLPCBTCREATESTRUCT().

#define ProbeForWriteDropStruct Address   ) 
 

Value:

{ \ if ((Address) >= (DROPSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile DROPSTRUCT *)(Address) = *(volatile DROPSTRUCT *)(Address); \ }

Definition at line 776 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteEvent Address   ) 
 

Value:

{ \ if ((Address) >= (EVENTMSG * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile EVENTMSG *)(Address) = *(volatile EVENTMSG *)(Address); \ }

Definition at line 861 of file userk.h.

Referenced by NtUserfnHkOPTINLPEVENTMSG().

#define ProbeForWriteGetClipData Address   ) 
 

Value:

{ \ if ((Address) >= (GETCLIPBDATA * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile GETCLIPBDATA *)(Address) = *(volatile GETCLIPBDATA *)(Address);\ }

Definition at line 895 of file userk.h.

#define ProbeForWriteImeCharPosition Address   ) 
 

Value:

{ \ if ((Address) >= (PrivateIMECHARPOSITION* const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG* const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile PrivateIMECHARPOSITION*)(Address) = *(volatile PrivateIMECHARPOSITION*)(Address); \ }

Definition at line 1050 of file userk.h.

#define ProbeForWriteLogFontW Address   ) 
 

Value:

{ \ if ((Address) >= (LOGFONTW * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile LOGFONTW *)(Address) = *(volatile LOGFONTW *)(Address); \ }

Definition at line 1015 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteMDINextMenu Address   ) 
 

Value:

{ \ if ((Address) >= (MDINEXTMENU * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile MDINEXTMENU *)(Address) = *(volatile MDINEXTMENU *)(Address); \ }

Definition at line 912 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteMeasureItemStruct Address   ) 
 

Value:

{ \ if ((Address) >= (MEASUREITEMSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile MEASUREITEMSTRUCT *)(Address) = *(volatile MEASUREITEMSTRUCT *)(Address);\ }

Definition at line 827 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteMessage Address   ) 
 

Value:

{ \ if ((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile MSG *)(Address) = *(volatile MSG *)(Address); \ }

Definition at line 742 of file userk.h.

Referenced by NtUserCallMsgFilter(), and NtUserQuerySendMessage().

#define ProbeForWriteNCCalcSize Address   ) 
 

Value:

{ \ if ((Address) >= (NCCALCSIZE_PARAMS * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile NCCALCSIZE_PARAMS *)(Address) = *(volatile NCCALCSIZE_PARAMS *)(Address);\ }

Definition at line 946 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWritePaintStruct Address   ) 
 

Value:

{ \ if ((Address) >= (PAINTSTRUCT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile PAINTSTRUCT *)(Address) = *(volatile PAINTSTRUCT *)(Address); \ }

Definition at line 759 of file userk.h.

#define ProbeForWritePoint Address   ) 
 

Value:

{ \ if ((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile POINT *)(Address) = *(volatile POINT *)(Address); \ }

Definition at line 708 of file userk.h.

Referenced by NtUserGetCaretPos(), and NtUserGetInternalWindowPos().

#define ProbeForWritePoint5 Address   ) 
 

Value:

{ \ if ((Address) >= (POINT5 * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile POINT5 *)(Address) = *(volatile POINT5 *)(Address);\ }

Definition at line 929 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteReconvertString Address   ) 
 

Value:

{ \ if ((Address) >= (RECONVERTSTRING* const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG* const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile RECONVERTSTRING*)(Address) = *(volatile RECONVERTSTRING*)(Address); \ *((volatile BYTE*)(Address) + (Address)->dwSize) = *((volatile BYTE*)(Address) + (Address)->dwSize); \ }

Definition at line 1030 of file userk.h.

#define ProbeForWriteRect Address   ) 
 

Value:

{ \ if ((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile RECT *)(Address) = *(volatile RECT *)(Address); \ }

Definition at line 725 of file userk.h.

Referenced by MESSAGECALL(), NtUserGetClipCursor(), and NtUserGetInternalWindowPos().

#define ProbeForWriteScrollInfo Address   ) 
 

Value:

{ \ if ((Address) >= (SCROLLINFO * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile SCROLLINFO *)(Address) = *(volatile SCROLLINFO *)(Address); \ }

Definition at line 793 of file userk.h.

Referenced by MESSAGECALL(), and NtUserSBGetParms().

#define ProbeForWriteStyleStruct Address   ) 
 

Value:

{ \ if ((Address) >= (STYLESTRUCT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile STYLESTRUCT *)(Address) = *(volatile STYLESTRUCT *)(Address); \ }

Definition at line 810 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeForWriteWindowPlacement Address   ) 
 

Value:

{ \ if ((Address) >= (WINDOWPLACEMENT * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile WINDOWPLACEMENT *)(Address) = *(volatile WINDOWPLACEMENT *)(Address);\ }

Definition at line 878 of file userk.h.

Referenced by NtUserGetWindowPlacement().

#define ProbeForWriteWindowPos Address   ) 
 

Value:

{ \ if ((Address) >= (WINDOWPOS * const)MM_USER_PROBE_ADDRESS) { \ *(volatile ULONG * const)MM_USER_PROBE_ADDRESS = 0; \ } \ \ *(volatile WINDOWPOS *)(Address) = *(volatile WINDOWPOS *)(Address);\ }

Definition at line 963 of file userk.h.

Referenced by MESSAGECALL().

#define ProbeMessage Address   ) 
 

Value:

(((Address) >= (MSG * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address)))

Definition at line 216 of file userk.h.

#define ProbePoint Address   ) 
 

Value:

(((Address) >= (POINT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address)))

Definition at line 182 of file userk.h.

#define ProbeRect Address   ) 
 

Value:

(((Address) >= (RECT * const)MM_USER_PROBE_ADDRESS) ? \ (*(volatile DWORD * const)MM_USER_PROBE_ADDRESS) : (*(volatile DWORD *)(Address)))

Definition at line 199 of file userk.h.

#define PROP_CHECKPOINT   MAKEINTATOM(atomCheckpointProp)
 

Definition at line 3892 of file userk.h.

Referenced by CkptRestore(), ParkIcon(), xxxArrangeIconicWindows(), xxxCalcValidRects(), xxxDesktopRecalc(), xxxInitSendValidateMinMaxInfo(), and xxxMetricsRecalc().

#define PROP_DDEIMP   MAKEINTATOM(atomDDEImp)
 

Definition at line 3895 of file userk.h.

Referenced by AddConvProp(), MESSAGECALL(), and xxxFreeWindow().

#define PROP_DDETRACK   MAKEINTATOM(atomDDETrack)
 

Definition at line 3893 of file userk.h.

Referenced by AddConvProp(), FindDdeConv(), UnlinkConv(), xxxCleanupDdeConv(), and xxxFreeWindow().

#define PROP_IMELEVEL   MAKEINTATOM(atomImeLevel)
 

Definition at line 3897 of file userk.h.

Referenced by NtUserGetAppImeLevel(), and NtUserSetAppImeLevel().

#define PROP_LAYER   MAKEINTATOM(atomLayer)
 

Definition at line 3898 of file userk.h.

Referenced by _GetDCEx(), _SetLayeredWindowAttributes(), _UpdateLayeredWindow(), CreateRedirectionBitmap(), RecreateRedirectionBitmap(), RemoveRedirectionBitmap(), UpdateLayeredSprite(), and zzzBltValidBits().

#define PROP_QOS   MAKEINTATOM(atomQOS)
 

Definition at line 3894 of file userk.h.

Referenced by _DdeGetQualityOfService(), _DdeSetQualityOfService(), and MESSAGECALL().

#define PROP_WNDOBJ   MAKEINTATOM(atomWndObj)
 

Definition at line 3896 of file userk.h.

Referenced by InvalidateGDIWindows(), UserAssociateHwnd(), UserGetHwnd(), and xxxFreeWindow().

#define PropagetUPBOOLTogpsi uSetting   ) 
 

Value:

UserAssert((DWORD)(PUSIF_ ## uSetting) == (DWORD)UPBOOLMask(SPI_GET ## uSetting)); \ COPY_FLAG(gpsi->PUSIFlags, TestUP(## uSetting), PUSIF_ ## uSetting)

Definition at line 5286 of file userk.h.

Referenced by LoadCPUserPreferences(), and xxxSystemParametersInfo().

#define PSEUDO_EVENT_OFF   ((HANDLE)IntToPtr( 0x00000000 ))
 

Definition at line 3059 of file userk.h.

Referenced by WaitOnPseudoEvent().

#define PSEUDO_EVENT_ON   ((HANDLE)IntToPtr( 0xFFFFFFFF ))
 

Definition at line 3058 of file userk.h.

Referenced by WaitOnPseudoEvent().

 
#define PtiCurrent  )     (gptiCurrent)
 

Definition at line 58 of file userk.h.

Referenced by _BeginDeferWindowPos(), _BlockInput(), _CallMsgFilter(), _CreateAcceleratorTable(), _CreateEmptyCursorObject(), _CsDdeUninitialize(), _DestroyMenu(), _EnumClipboardFormats(), _GetClassInfoEx(), _GetDC(), _GetDCEx(), _GetDesktopWindow(), _GetKeyboardLayout(), _GetMessagePos(), _GetMessageWindow(), _GetNextQueueWindow(), _PostMessage(), _PostQuitMessage(), _RegisterHotKey(), _ReplyMessage(), _ResetDblClk(), _SetCaretBlinkTime(), _SetKeyboardState(), _SetMessageExtraInfo(), _SetProgmanWindow(), _SetTaskmanWindow(), _SetUserObjectInformation(), _SetWinEventHook(), _UnhookWinEvent(), _UnregisterClass(), _UnregisterHotKey(), _WOWModuleUnload(), AnimateWindow(), AssociateInputContextEx(), AsyncWindowPos(), bEnumerateRegistryFonts(), BMPtoDIB(), BuildHimcList(), BuildHwndList(), CancelInputState(), CaretBlinkProc(), CleanupGDI(), ClearQueueServerEvent(), ClearWakeMask(), ClearWindowState(), CreateCacheDC(), CreateProfileUserName(), Createpxs(), DestroyClass(), DestroyInputContext(), DestroyNotify(), DestroyThreadsHotKeys(), DestroyThreadsObjects(), DisownClipboard(), DispatchMessageWorker(), DoPaint(), DoTimer(), DrawSwitchWndHilite(), ECGetControlBrush(), ExitWindowsWorker(), FAllowForegroundActivate(), FCallerOk(), FindImeHotKeyByKey(), FreeDDEHandle(), FreeProfileUserName(), FreeThreadsWindowHooks(), GetCPD(), GetCursorHeight(), GetLastTopMostWindow(), GetTopMostInsertAfter(), GetWindowThreadProcessId(), ImmRequestMessageAorW(), ImmSetActiveContext(), InitiateWin32kCleanup(), InitSwitchWndInfo(), InternalCreateMenu(), InternalInvalidate3(), InternalRegisterClassEx(), InternalSetClipboardData(), IsTopmostRealApp(), LockDesktopMenu(), LockWindowUpdate2(), MNFreePopup(), MNItemHitTest(), MungeClipData(), NtUserBuildHimcList(), NtUserBuildHwndList(), NtUserCallNextHookEx(), NtUserCreateWindowEx(), NtUserDdeGetQualityOfService(), NtUserDdeInitialize(), NtUserDdeSetQualityOfService(), NtUserDisableThreadIme(), NtUserDrawCaptionTemp(), NtUserEndMenu(), NtUserFlashWindowEx(), NtUserGetClipboardData(), NtUserGetDC(), NtUserGetDCEx(), NtUserImpersonateDdeClientWindow(), NtUserPaintDesktop(), NtUserPostThreadMessage(), NtUserResolveDesktop(), NtUserResolveDesktopForWOW(), NtUserSendInput(), NtUserSetSysColors(), NtUserSetThreadDesktop(), NtUserSetThreadLayoutHandles(), NtUserSetThreadState(), NtUserSwitchDesktop(), NtUserSystemParametersInfo(), NtUserToUnicodeEx(), NtUserTrackPopupMenuEx(), NtUserTranslateAccelerator(), NtUserYieldTask(), PhkNextValid(), PlayEventSound(), PostShellHookMessages(), PrepareForLogoff(), PseudoDestroyClassWindows(), QueryTrackMouseEvent(), QueuePowerRequest(), ResetSharedDesktops(), SendIMEMessageAll(), SendMessageWorker(), SetJournalTimer(), SetWindowState(), TestInputContextProcess(), TestWindowProcess(), ThreadUnlock1(), TrackFullscreenMode(), TrackMouseEvent(), TranslateInjectedVKey(), UpdateInputContext(), UpdateKeyLights(), UpdatePerUserKeyboardIndicators(), UserGetCurrentDesktopId(), UserGetDesktopDC(), UserRedrawDesktop(), UserThreadCallout(), UT_CaretSet(), UT_InvertCaret(), ValidateHdesk(), WantImeWindow(), xxxActivateKeyboardLayout(), xxxActivateOnMinimize(), xxxActivateThisWindow(), xxxActivateWindow(), xxxBeginPaint(), xxxButtonEvent(), xxxCallHook(), xxxCallHook2(), xxxCallJournalPlaybackHook(), xxxCallJournalRecordHook(), xxxCallMouseHook(), xxxCallNextHookEx(), xxxCancelCoolSwitch(), xxxCancelMouseMoveTracking(), xxxCancelTracking(), xxxChangeClipboardChain(), xxxCheckFocus(), xxxCheckImeShowStatus(), xxxClientShutdown2(), xxxCloseClipboard(), xxxCloseDesktop(), xxxConnectService(), xxxConsoleControl(), xxxCreateCaret(), xxxCreateDesktop(), xxxCreateWindowEx(), xxxCreateWindowStation(), xxxCsDdeInitialize(), xxxCsEvent(), xxxDDETrackPostHook(), xxxDDETrackSendHook(), xxxDeactivate(), xxxDefWindowProc(), xxxDesktopWndProc(), xxxDestroyThreadInfo(), xxxDestroyWindow(), xxxDirectedYield(), xxxDispatchMessage(), xxxDoButtonEvent(), xxxDoHotKeyStuff(), xxxDoSend(), xxxDoSyncPaint(), xxxDragObject(), xxxDrawClipboard(), xxxDrawDragRect(), xxxDW_SendDestroyMessages(), xxxDWP_DoCancelMode(), xxxDWP_ProcessVirtKey(), xxxDWP_SetCursor(), xxxEnableWindow(), xxxEndDeferWindowPosEx(), xxxEndMenu(), xxxEndPaint(), xxxEndScroll(), xxxEnumDisplayMonitors(), xxxFreeKeyboardLayouts(), xxxFreeListFree(), xxxFreeWindow(), xxxFW_DestroyAllChildren(), xxxGetClipboardData(), xxxGetEventProc(), xxxGetInputEvent(), xxxGetScrollMenu(), xxxGetSysMenuHandle(), xxxGetThreadDesktop(), xxxHandleMenuMessages(), xxxHardErrorControl(), xxxHelpLoop(), xxxHkCallHook(), xxxHotTrackMenu(), xxxImmLoadLayout(), xxxImmProcessKey(), xxxInitSendValidateMinMaxInfo(), xxxInternalActivateKeyboardLayout(), xxxInternalDoSyncPaint(), xxxInternalGetMessage(), xxxInternalKeyEventDirect(), xxxInternalUnloadKeyboardLayout(), xxxInterSendMsgEx(), xxxInvalidateDesktopOnPaletteChange(), xxxIsDragging(), xxxKeyEvent(), xxxLoadHmodIndex(), xxxLoadKeyboardLayoutEx(), xxxMenuDraw(), xxxMenuWindowProc(), xxxMessageBeep(), xxxMessageEvent(), xxxMetricsRecalc(), xxxMinMaximize(), xxxMNAllocMenuState(), xxxMNCancel(), xxxMNCloseHierarchy(), xxxMNCompute(), xxxMNDragLeave(), xxxMNDragOver(), xxxMNEndMenuState(), xxxMNKeyDown(), xxxMNLoop(), xxxMNOpenHierarchy(), xxxMNReleaseCapture(), xxxMNSetCapture(), xxxMNStartMenuState(), xxxMouseEventDirect(), xxxMoveSize(), xxxMS_TrackMove(), xxxMsgWaitForMultipleObjects(), xxxNextWindow(), xxxNotifyImeShowStatus(), xxxOldNextWindow(), xxxOpenClipboard(), xxxOpenDesktop(), xxxPaintRect(), xxxPollAndWaitForSingleObject(), xxxProcessEventMessage(), xxxProcessNotifyWinEvent(), xxxQueryInformationThread(), xxxRealDrawMenuItem(), xxxRedrawWindow(), xxxRegisterClassEx(), xxxReleaseCapture(), xxxResetDisplayDevice(), xxxResolveDesktop(), xxxRestoreCsrssThreadDesktop(), xxxSBTrackInit(), xxxSBTrackLoop(), xxxSBWndProc(), xxxScrollWindowEx(), xxxSendBSMtoDesktop(), xxxSendClipboardMessage(), xxxSendEraseBkgnd(), xxxSendInput(), xxxSendMessageBSM(), xxxSendMessageCallback(), xxxSendMessageTimeout(), xxxSendMessageToUI(), xxxSendMinRectMessages(), xxxSendNCPaint(), xxxSetActiveWindow(), xxxSetCapture(), xxxSetClassIcon(), xxxSetClipboardViewer(), xxxSetCsrssThreadDesktop(), xxxSetDeskWallpaper(), xxxSetFocus(), xxxSetForegroundWindow(), xxxSetForegroundWindow2(), xxxSetShellWindow(), xxxSetThreadDesktop(), xxxSetWindowPlacement(), xxxShowTooltip(), xxxShowWindow(), xxxSimpleDoSyncPaint(), xxxSleepTask(), xxxSleepThread(), xxxSnapWindow(), xxxSwitchDesktop(), xxxSwitchWndProc(), xxxSwpActivate(), xxxSysCommand(), xxxSystemBroadcastMessage(), xxxSystemParametersInfo(), xxxTM_MoveDragRect(), xxxTrackCaptionButton(), xxxTrackInitSize(), xxxTrackMouseMove(), xxxTrackPopupMenuEx(), xxxTranslateAccelerator(), xxxTranslateMessage(), xxxUnloadKeyboardLayout(), xxxUpdateOtherThreadsWindows(), xxxUpdateWindows(), xxxUserChangeDisplaySettings(), xxxUserPowerCalloutWorker(), xxxUserPowerStateCalloutWorker(), xxxWaitForInputIdle(), xxxWindowEvent(), xxxWindowHitTest2(), ZapActiveAndFocus(), zzzChangeStates(), zzzClipCursor(), zzzInitTask(), zzzInternalDestroyCaret(), zzzInternalHideCaret(), zzzInternalShowCaret(), zzzInvalidateDCCache(), zzzReattachThreads(), zzzRecalc2(), zzzRecalcThreadAttachment(), zzzRegisterSystemThread(), zzzSetCaretPos(), zzzSetCursor(), zzzSetDesktop(), zzzSetSBCaretPos(), zzzSetSystemImage(), zzzSetWindowsHookAW(), zzzSetWindowsHookEx(), zzzShowCursor(), and zzzUnhookWindowsHook().

 
#define PtiCurrentShared  )     ((PTHREADINFO)(W32GetCurrentThread()))
 

Definition at line 59 of file userk.h.

Referenced by _GetGUIThreadInfo(), _GetKeyboardLayout(), _GetKeyNameText(), _GetKeyState(), _GetQueueStatus(), _GetUserObjectInformation(), _GetWOWClass(), CheckClipboardAccess(), CreateInputContext(), DrawTextExWorker(), DT_DrawStr(), DT_GetExtentMinusPrefixes(), GetAppCompatFlags(), GetAppCompatFlags2(), GetAppImeCompatFlags(), GetNextWordbreak(), InitSystemThread(), MNRecalcTabStrings(), NtUserGetAppImeLevel(), NtUserGetAsyncKeyState(), NtUserGetCaretPos(), NtUserGetForegroundWindow(), NtUserGetKeyboardLayoutName(), NtUserGetKeyboardState(), NtUserGetKeyState(), NtUserGetThreadState(), NtUserMapVirtualKeyEx(), NtUserQuerySendMessage(), NtUserQueryWindow(), NtUserVkKeyScanEx(), OpenDevice(), ProcessDeviceChanges(), ProcessMouseInput(), RawInputThread(), RegisterForDeviceChangeNotifications(), RemoteDisableScreen(), RemoteRedrawScreen(), UnregisterForDeviceChangeNotifications(), UserGetDesktopDC(), UserScreenAccessCheck(), ValidateHmenu(), ValidateHwnd(), xxxCreateDefaultImeWindow(), xxxDesktopThread(), xxxDrawCaptionTemp(), xxxDrawItemUnderline(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxImmActivateAndUnloadThreadsLayout(), xxxImmActivateLayout(), xxxImmActivateThreadsLayout(), xxxImmUnloadLayout(), xxxImmUnloadThreadsLayout(), xxxInternalToUnicode(), xxxMB_FindLongestString(), xxxPSMTextOut(), and zzzHideCursorNoCapture().

#define PtiFromThread Thread   )     ((PTHREADINFO)((Thread)->Tcb.Win32Thread))
 

Definition at line 87 of file userk.h.

Referenced by InitiateShutdown(), PtiFromThreadId(), ReferenceWindowStation(), TerminateConsole(), UserGlobalAtomTableCallout(), xxxHardErrorControl(), xxxQueryInformationThread(), xxxSetInformationThread(), and xxxUserNotifyProcessCreate().

#define PUDF_ALLOWFOREGROUNDACTIVATE   0x08000000
 

Definition at line 6596 of file userk.h.

Referenced by CancelForegroundActivate(), RestoreForegroundActivate(), xxxInitProcessInfo(), xxxSetProcessInitState(), xxxUserNotifyConsoleApplication(), and zzzShowStartGlass().

#define PUDF_ANIMATE   0x00010000
 

Definition at line 6584 of file userk.h.

Referenced by _ShowWindowAsync(), NtUserMinMaximize(), NtUserShowWindow(), xxxbFullscreenSwitch(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyWindow(), xxxMinimizeHungWindow(), xxxMNCloseHierarchy(), xxxSetInternalWindowPos(), xxxSetParent(), xxxSetSPIMetrics(), xxxSetWindowPlacement(), xxxShowScrollBar(), xxxSysCommand(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PUDF_BEEP   0x00080000 /* Warning beeps allowed? */
 

Definition at line 6588 of file userk.h.

Referenced by LW_LoadResources(), xxxMessageBeep(), xxxOldMessageBeep(), and xxxSystemParametersInfo().

#define PUDF_DRAGFULLWINDOWS   0x00200000 /* Drag xor rect or full windows */
 

Definition at line 6590 of file userk.h.

Referenced by xxxMoveSize(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define PUDF_DRAGGINGFULLWINDOW   0x10000000
 

Definition at line 6597 of file userk.h.

Referenced by xxxBeginPaint(), and xxxMoveSize().

#define PUDF_EXTENDEDSOUNDS   0x00100000 /* Extended sounds enabling */
 

Definition at line 6589 of file userk.h.

Referenced by LW_LoadResources(), and PlayEventSound().

#define PUDF_FONTSARELOADED   0x00800000
 

Definition at line 6592 of file userk.h.

Referenced by bEnumerateRegistryFonts(), and EndShutdown().

#define PUDF_GSMWPINUSE   0x40000000
 

Definition at line 6599 of file userk.h.

Referenced by DestroySMWP(), and InternalBeginDeferWindowPos().

#define PUDF_ICONTITLEWRAP   0x00400000 /* Wrap icon titles or just use single line */
 

Definition at line 6591 of file userk.h.

Referenced by SetIconMetrics(), and xxxSystemParametersInfo().

#define PUDF_LOCKFULLSCREEN   0x20000000
 

Definition at line 6598 of file userk.h.

Referenced by FullScreenCleanup(), LockWindowUpdate2(), xxxMakeWindowForegroundWithState(), and xxxUserChangeDisplaySettings().

#define PUDF_MENUSTATEINUSE   0x02000000
 

Definition at line 6594 of file userk.h.

Referenced by xxxMNAllocMenuState(), and xxxMNEndMenuState().

#define PUDF_POPUPINUSE   0x01000000
 

Definition at line 6593 of file userk.h.

Referenced by MNAllocPopup(), and MNFreePopup().

#define PUDF_VDMBOUNDSACTIVE   0x04000000
 

Definition at line 6595 of file userk.h.

Referenced by BoundCursor(), and SetVDMCursorBounds().

#define PW hwnd   )     ((PWND)HtoP(hwnd))
 

Definition at line 1172 of file userk.h.

Referenced by CheckTopmost(), TrackZorder(), ValidateSmwp(), xxxArrangeIconicWindows(), xxxCalcValidRects(), xxxDoHotKeyStuff(), xxxEndDeferWindowPosEx(), xxxHkCallHook(), ZOrderByOwner(), ZOrderByOwner2(), and zzzBltValidBits().

#define PWCat hwnd   )     ((PWND)HtoPCat(hwnd))
 

Definition at line 1173 of file userk.h.

Referenced by ValidateZorder().

#define PWND_BOTTOM   (PWND)1
 

Definition at line 3829 of file userk.h.

Referenced by LinkWindow(), ValidateZorder(), xxxCreateDesktop(), xxxCreateWindowEx(), xxxNextWindow(), xxxOldNextWindow(), xxxSetShellWindow(), and xxxSwitchToThisWindow().

#define PWND_BROADCAST   ((PWND)-1)
 

Definition at line 3833 of file userk.h.

Referenced by _PostMessage(), NtUserPostMessage(), NtUserSendMessageCallback(), NtUserSendNotifyMessage(), xxxActivateThisWindow(), xxxBroadcastPaletteChanged(), xxxDesktopWndProc(), xxxSendMessageCallback(), xxxSendMessageFF(), xxxSendMessageTimeout(), xxxSendNotifyMessage(), xxxSetDeskPattern(), xxxSetSysColors(), and xxxSystemParametersInfo().

#define PWND_ERROR   (PWND)0x10
 

Definition at line 3827 of file userk.h.

#define PWND_FOCUS   (PWND)NULL
 

Definition at line 3826 of file userk.h.

Referenced by _RegisterHotKey(), DestroyThreadsHotKeys(), and FindHotKey().

#define PWND_GROUPTOTOP   ((PWND)-1)
 

Definition at line 3830 of file userk.h.

#define PWND_INPUTOWNER   (PWND)1
 

Definition at line 3825 of file userk.h.

Referenced by _RegisterHotKey(), DestroyThreadsHotKeys(), FindHotKey(), RawInputThread(), SetDebugHotKeys(), and xxxDoHotKeyStuff().

#define PWND_NOTOPMOST   ((PWND)-2)
 

Definition at line 3832 of file userk.h.

#define PWND_TOP   (PWND)0
 

Definition at line 3828 of file userk.h.

Referenced by CheckOnTop(), ImeSetTopmost(), LinkWindow(), ResetSharedDesktops(), ValidateZorder(), xxxActivateThisWindow(), xxxCreateWindowEx(), xxxMenuWindowProc(), xxxMetricsRecalc(), xxxMNOpenHierarchy(), xxxProcessEventMessage(), xxxSetForegroundWindow2(), xxxSetInternalWindowPos(), xxxSetWindowPlacement(), xxxSetWindowRgn(), xxxShowTooltip(), xxxSysCommand(), and xxxTrackPopupMenuEx().

#define PWND_TOPMOST   ((PWND)-1)
 

Definition at line 3831 of file userk.h.

Referenced by xxxMNOpenHierarchy(), xxxShowSwitchWindow(), and xxxTrackPopupMenuEx().

#define PWNDDESKTOP  )     ((p)->head.rpdesk->pDeskInfo->spwnd)
 

Definition at line 2790 of file userk.h.

Referenced by _ChildWindowFromPointEx(), _GetAncestor(), _GetWindowPlacement(), _RealChildWindowFromPoint(), _UserSoundSentryWorker(), CkptRestore(), CreateSpb(), DoQueuedSyncPaint(), ImeCanDestroyDefIMEforChild(), LinkWindow(), LockWindowUpdate2(), NextTopWindow(), SelectWindowRgn(), SetHungFlag(), SetTiledRect(), ValidateWindowPos(), xxxActivateThisWindow(), xxxBroadcastPaletteChanged(), xxxCalcValidRects(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyWindow(), xxxDrawAnimatedRects(), xxxDrawDragRect(), xxxDWP_SetCursor(), xxxDWPPrint(), xxxEndDeferWindowPosEx(), xxxGetUpdateRect(), xxxGetUpdateRgn(), xxxHandleWindowPosChanged(), xxxInitSendValidateMinMaxInfo(), xxxMakeWindowForegroundWithState(), xxxMetricsRecalc(), xxxMinimizeHungWindow(), xxxMinMaximize(), xxxMouseActivate(), xxxMoveSize(), xxxMoveWindow(), xxxMS_TrackMove(), xxxPaintRect(), xxxRedrawHungWindow(), xxxRedrawWindow(), xxxScrollWindowEx(), xxxSetInternalWindowPos(), xxxSetParent(), xxxSetWindowData(), xxxSetWindowPlacement(), xxxSetWindowStyle(), xxxShowOwnedWindows(), xxxShowWindow(), xxxSnapWindow(), xxxTooltipHandleTimer(), xxxUpdateWindow2(), zzzBltValidBits(), zzzChangeStates(), and zzzInvalidateDCCache().

#define PWNDMESSAGE  )     ((p)->head.rpdesk->spwndMessage)
 

Definition at line 2791 of file userk.h.

Referenced by _GetAncestor(), LinkWindow(), xxxCreateWindowEx(), xxxResetTooltip(), and xxxSetParent().

#define PWNDPARENT  )     (p->spwndParent ? p->spwndParent : PWNDDESKTOP(p))
 

Definition at line 2798 of file userk.h.

#define PWNDTOOLTIP  )     ((p)->head.rpdesk->spwndTooltip)
 

Definition at line 2792 of file userk.h.

Referenced by xxxCancelMouseMoveTracking().

#define PWNDTOPSBTRACK pwnd   )     (((GETPTI(pwnd)->pSBTrack)))
 

Definition at line 3397 of file userk.h.

Referenced by _SBGetParms(), DrawThumb2(), xxxContScroll(), xxxDrawScrollBar(), xxxDWP_DoCancelMode(), xxxEndScroll(), xxxMoveThumb(), xxxSBTrackInit(), xxxSBTrackLoop(), xxxSetScrollBar(), xxxTrackBox(), and xxxTrackThumb().

#define QEVENT_ACTIVATE   0x0006
 

Definition at line 2993 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxProcessEventMessage(), xxxSetForegroundWindow(), xxxSetForegroundWindow2(), and zzzReattachThreads().

#define QEVENT_APPCOMMAND   0x0011
 

Definition at line 3005 of file userk.h.

Referenced by xxxKeyEvent(), and xxxProcessEventMessage().

#define QEVENT_ASYNCSENDMSG   0x000B
 

Definition at line 2998 of file userk.h.

Referenced by CleanEventMessage(), xxxProcessEventMessage(), and xxxScanSysQueue().

#define QEVENT_CANCELMENU   0x0009
 

Definition at line 2996 of file userk.h.

#define QEVENT_CANCELMODE   0x0002
 

Definition at line 2989 of file userk.h.

Referenced by xxxButtonEvent(), and xxxProcessEventMessage().

#define QEVENT_CANCELMOUSEMOVETRK   0x000D
 

Definition at line 3000 of file userk.h.

Referenced by xxxProcessEventMessage(), xxxTrackMouseMove(), and zzzSetFMouseMoved().

#define QEVENT_DEACTIVATE   0x0005
 

Definition at line 2992 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxProcessEventMessage(), and xxxSetForegroundWindow2().

#define QEVENT_DESTROYWINDOW   0x000A
 

Definition at line 2997 of file userk.h.

Referenced by xxxFW_DestroyAllChildren(), and xxxProcessEventMessage().

#define QEVENT_EXECSHELL   0x0008
 

Definition at line 2995 of file userk.h.

#define QEVENT_HUNGTHREAD   0x000C
 

Definition at line 2999 of file userk.h.

Referenced by xxxMinimizeHungWindow(), and xxxProcessEventMessage().

#define QEVENT_NOTIFYWINEVENT   0x000E
 

Definition at line 3001 of file userk.h.

Referenced by CleanEventMessage(), xxxProcessEventMessage(), and xxxProcessNotifyWinEvent().

#define QEVENT_POSTMESSAGE   0x0007
 

Definition at line 2994 of file userk.h.

Referenced by xxxProcessEventMessage(), and xxxSwitchToThisWindow().

#define QEVENT_RITACCESSIBILITY   0x000F
 

Definition at line 3002 of file userk.h.

Referenced by PostAccessibility(), and xxxProcessEventMessage().

#define QEVENT_RITSOUND   0x0010
 

Definition at line 3003 of file userk.h.

Referenced by FKActivationTimer(), PostRitSound(), and xxxProcessEventMessage().

#define QEVENT_SETWINDOWPOS   0x0003
 

Definition at line 2990 of file userk.h.

Referenced by AsyncWindowPos(), CleanEventMessage(), and xxxProcessEventMessage().

#define QEVENT_SHOWWINDOW   0x0001
 

Definition at line 2988 of file userk.h.

Referenced by _ShowWindowAsync(), and xxxProcessEventMessage().

#define QEVENT_UPDATEKEYSTATE   0x0004
 

Definition at line 2991 of file userk.h.

Referenced by CleanEventMessage(), PostUpdateKeyStateEvent(), RedistributeInput(), xxxProcessEventMessage(), and xxxScanSysQueue().

#define RDW_HASWINDOWRGN   0x8000
 

Definition at line 5492 of file userk.h.

Referenced by InternalInvalidate2().

#define RE_INVALID   0x0008
 

Definition at line 2428 of file userk.h.

Referenced by zzzBltValidBits().

#define RE_INVALIDSUM   0x0040
 

Definition at line 2431 of file userk.h.

Referenced by zzzBltValidBits().

#define RE_SPB   0x0010
 

Definition at line 2429 of file userk.h.

#define RE_VALID   0x0004
 

Definition at line 2427 of file userk.h.

Referenced by zzzBltValidBits().

#define RE_VALIDSUM   0x0020
 

Definition at line 2430 of file userk.h.

Referenced by zzzBltValidBits().

#define RE_VISNEW   0x0001
 

Definition at line 2425 of file userk.h.

Referenced by CombineOldNewVis(), and zzzBltValidBits().

#define RE_VISOLD   0x0002
 

Definition at line 2426 of file userk.h.

Referenced by BltValidInit(), CombineOldNewVis(), and zzzBltValidBits().

#define REBASESHAREDPTR  )     (p)
 

Definition at line 7343 of file userk.h.

Referenced by _MonitorFromPoint(), and _MonitorFromRect().

#define REBASESHAREDPTRALWAYS  )     (p)
 

Definition at line 7344 of file userk.h.

Referenced by _MonitorFromPoint(), and _MonitorFromRect().

#define RECORD_STACK_TRACE_SIZE   6
 

Definition at line 2071 of file userk.h.

#define REMOVE_FROM_LIST type,
pstart,
pitem,
next   ) 
 

Value:

{ \ type** pp; \ \ for (pp = &pstart; *pp != NULL; pp = &(*pp)->next) { \ if (*pp == pitem) { \ *pp = pitem->next; \ break; \ } \ } \ } \

Definition at line 7370 of file userk.h.

Referenced by ClearAppStarting(), DestroyMonitor(), DestroyProcessInfo(), and JobCalloutTerminate().

#define RESET_PSEUDO_EVENT phE   ) 
 

Value:

CheckCritIn(); \ if (*(phE) == PSEUDO_EVENT_ON) *(phE) = PSEUDO_EVENT_OFF; \ else if (*(phE) != PSEUDO_EVENT_OFF) { \ KeClearEvent(*(phE)); \ }

Definition at line 3071 of file userk.h.

Referenced by SleepInputIdle(), and xxxUserNotifyProcessCreate().

#define RETURN_IF_ACCESS_DENIED amGranted,
amRequested,
 )     if (!CheckGrantedAccess((amGranted), (amRequested))) return r
 

Definition at line 2364 of file userk.h.

Referenced by _SwapMouseButton(), CreateInputContext(), InternalCreateMenu(), NtUserGetClipCursor(), ReferenceWindowStation(), xxxCreateWindowEx(), and xxxSystemParametersInfo().

#define RevalidateCatHwnd hwnd   )     HMValidateCatHandleNoSecure(hwnd, TYPE_WINDOW)
 

Definition at line 1166 of file userk.h.

Referenced by ValidateZorder(), and xxxDDETrackGetMessageHook().

#define RevalidateHwnd hwnd   )     HMValidateHandleNoSecure(hwnd, TYPE_WINDOW)
 

Definition at line 1165 of file userk.h.

#define RIT_PROCESSINPUT   0x01
 

Definition at line 39 of file userk.h.

#define RIT_STOPINPUT   0x02
 

Definition at line 40 of file userk.h.

#define RITSOUND_DOBEEP   0x0005
 

Definition at line 3012 of file userk.h.

Referenced by FKActivationTimer(), and xxxProcessEventMessage().

#define RITSOUND_DOWNSIREN   0x0001
 

Definition at line 3008 of file userk.h.

Referenced by FKActivationTimer(), HighContrastHotKey(), TurnOffMouseKeys(), xxxAccessTimeOutTimer(), xxxProcessEventMessage(), xxxStickyKeys(), xxxToggleKeysTimer(), and xxxTwoKeysDown().

#define RITSOUND_HIGHBEEP   0x0003
 

Definition at line 3010 of file userk.h.

Referenced by ToggleKeys(), xxxMKToggleMouseKeys(), xxxProcessEventMessage(), and xxxStickyKeys().

#define RITSOUND_KEYCLICK   0x0004
 

Definition at line 3011 of file userk.h.

Referenced by FilterKeys(), xxxFKAcceptanceDelayTimer(), xxxFKRepeatRateTimer(), and xxxProcessEventMessage().

#define RITSOUND_LOWBEEP   0x0002
 

Definition at line 3009 of file userk.h.

Referenced by ToggleKeys(), xxxMKToggleMouseKeys(), xxxProcessEventMessage(), and xxxStickyKeys().

#define RITSOUND_UPSIREN   0x0000
 

Definition at line 3007 of file userk.h.

Referenced by FKActivationTimer(), HighContrastHotKey(), MouseKeys(), xxxProcessEventMessage(), xxxStickyKeys(), and xxxToggleKeysTimer().

#define RSPB_INVALIDATE   1
 

Definition at line 2243 of file userk.h.

Referenced by RestoreSpb().

#define RSPB_INVALIDATE_SSB   2
 

Definition at line 2244 of file userk.h.

Referenced by RestoreSpb(), and zzzBltValidBits().

#define RSPB_NO_INVALIDATE   0
 

Definition at line 2242 of file userk.h.

Referenced by RestoreSpb(), and zzzBltValidBits().

#define SAVEPOINT xc,
yc,
resX,
resY,
t,
 ) 
 

Value:

{ \ /* \ * (xc, yc) is the point and (resX, resY) is the resolution \ */ \ gaptMouse[gptInd].x = MAKELONG(LOWORD(xc), LOWORD(resX)); \ gaptMouse[gptInd].y = MAKELONG(LOWORD(yc), LOWORD(resY)); \ gaptMouse[gptInd].time = t; \ gaptMouse[gptInd].dwExtraInfo = e; \ \ gptInd = NEXTPOINT(gptInd); \ }

Definition at line 1772 of file userk.h.

Referenced by GetMouseCoord(), and zzzSetCursorPos().

#define SCANCODE_NUMPAD_DOT   (0x53)
 

Definition at line 3984 of file userk.h.

Referenced by xxxInternalToUnicode(), and xxxKeyEvent().

#define SCANCODE_NUMPAD_PLUS   (0x4e)
 

Definition at line 3981 of file userk.h.

Referenced by xxxInternalToUnicode(), and xxxKeyEvent().

#define SCMS_FLAGS_ANSI   0x0001
 

Definition at line 2248 of file userk.h.

Referenced by xxxHkCallHook(), and xxxWrapCallWindowProc().

#define SCMS_FLAGS_INONLY   0x0002
 

Definition at line 2249 of file userk.h.

Referenced by xxxHkCallHook().

#define SCREEN_CAPTURE   4 /* screen-relative capture */
 

Definition at line 3851 of file userk.h.

Referenced by MNItemHitTest(), xxxHelpLoop(), xxxMNSetCapture(), and xxxOldNextWindow().

#define SCROLL_DIRECT   1
 

Definition at line 4826 of file userk.h.

Referenced by xxxSBTrackInit(), xxxSBWndProc(), and xxxSysCommand().

#define SCROLL_MENU   2
 

Definition at line 4827 of file userk.h.

Referenced by xxxDoScrollMenu(), and xxxSBTrackInit().

#define SCROLL_NORMAL   0
 

Definition at line 4825 of file userk.h.

Referenced by xxxSBWndProc(), and xxxSysCommand().

#define ScSendMessage pwnd,
msg,
wParam,
lParam,
xParam,
xpfn,
dwSCMSFlags   )     ScSendMessageSMS(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, NULL)
 

Definition at line 2263 of file userk.h.

Referenced by xxxWrapCallWindowProc().

#define ScSendMessageSMS pwnd,
msg,
wParam,
lParam,
xParam,
xpfn,
dwSCMSFlags,
psms   ) 
 

Value:

(((msg) & ~MSGFLAG_MASK) >= WM_USER) ? \ SfnDWORD(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms) : \ gapfnScSendMessage[MessageTable[msg & 0xffff].iFunction](pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms)

Definition at line 2259 of file userk.h.

Referenced by xxxHkCallHook().

#define ServerLoadString hmod,
id,
p,
cch   )     RtlLoadStringOrError(id, p, cch, 0)
 

Definition at line 2272 of file userk.h.

Referenced by _EndTask(), CheckDesktopPolicy(), FastGetProfileIntFromID(), FastGetProfileIntsW(), FastGetProfileStringFromIDW(), FastGetProfileValue(), FastUpdateWinIni(), FastWriteProfileValue(), GetDeskWallpaperName(), GetHardErrorText(), GetVersionInfo(), LW_LoadSomeStrings(), SetEndTaskDlgStatus(), UpdateWinIniInt(), xxxDesktopPaintCallback(), xxxSetDeskPattern(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define ServerLoadStringEx hmod,
id,
p,
cch,
wLang   )     RtlLoadStringOrError(id, p, cch, wLang)
 

Definition at line 2274 of file userk.h.

#define SERVERSTRINGMAXSIZE   40
 

Definition at line 2269 of file userk.h.

Referenced by FastGetProfileValue(), and FastWriteProfileValue().

#define SET_ACCF  )     SET_FLAG(gdwPUDFlags, f)
 

Definition at line 6603 of file userk.h.

Referenced by FilterKeys(), MKShowMouseCursor(), SoundSentryTimer(), xxxFKAcceptanceDelayTimer(), and xxxUpdatePerUserAccessPackSettings().

#define SET_GTERMF  )     SET_FLAG(gdwGTERMFlags, f)
 

Definition at line 1998 of file userk.h.

Referenced by MKShowMouseCursor(), and ProcessDeviceChanges().

#define SET_OR_CLEAR_ACCF f,
fSet   )     SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet)
 

Definition at line 6605 of file userk.h.

Referenced by MouseKeys(), SetAccessEnabledFlag(), xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define SET_OR_CLEAR_GTERMF f,
fSet   )     SET_OR_CLEAR_FLAG(gdwGTERMFlags, f, fSet)
 

Definition at line 2000 of file userk.h.

#define SET_OR_CLEAR_PUDF f,
fSet   )     SET_OR_CLEAR_FLAG(gdwPUDFlags, f, fSet)
 

Definition at line 6612 of file userk.h.

Referenced by LW_LoadResources(), SetIconMetrics(), xxxMoveSize(), xxxSetSPIMetrics(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define SET_PSEUDO_EVENT phE   ) 
 

Value:

CheckCritIn(); \ if (*(phE) == PSEUDO_EVENT_OFF) *(phE) = PSEUDO_EVENT_ON; \ else if (*(phE) != PSEUDO_EVENT_ON) { \ KeSetEvent(*(phE), EVENT_INCREMENT, FALSE); \ ObDereferenceObject(*(phE)); \ *(phE) = PSEUDO_EVENT_ON; \ }

Definition at line 3062 of file userk.h.

Referenced by xxxSetProcessInitState(), and zzzWakeInputIdle().

#define SET_PUDF  )     SET_FLAG(gdwPUDFlags, f)
 

Definition at line 6610 of file userk.h.

Referenced by bEnumerateRegistryFonts(), InternalBeginDeferWindowPos(), MNAllocPopup(), RestoreForegroundActivate(), SetVDMCursorBounds(), xxxMakeWindowForegroundWithState(), xxxMNAllocMenuState(), xxxSetProcessInitState(), xxxUserNotifyConsoleApplication(), and zzzShowStartGlass().

#define SET_TIME_LAST_READ pti   )     ((pti)->pcti->timeLastRead = NtGetTickCount())
 

Definition at line 2347 of file userk.h.

Referenced by NtUserGetThreadState(), xxxCallHook2(), xxxCreateThreadInfo(), xxxInternalGetMessage(), xxxSetInformationThread(), and xxxSleepThread().

#define SETHMODLOADED pti,
x,
hmod   ) 
 

Value:

((pti)->ppi->ahmodLibLoaded[x] = hmod, \ (pti)->ppi->dwhmodLibLoadedMask |= (1 << (x)))

Definition at line 3666 of file userk.h.

Referenced by xxxLoadHmodIndex().

#define SetRawKeyDown vk   )     SetKeyDownBit(gafRawKeyState, vk)
 

Definition at line 5735 of file userk.h.

Referenced by UpdateRawKeyState().

#define SetRawKeyToggle vk   )     SetKeyToggleBit(gafRawKeyState, vk)
 

Definition at line 5738 of file userk.h.

Referenced by ChangeForegroundKeyboardTable(), UpdateKeyLights(), and UpdatePerUserKeyboardIndicators().

#define SetUP uSetting   )     SetUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
 

Definition at line 5263 of file userk.h.

#define SetUPBOOL pdw,
uSetting   )     (*UPBOOLPointer(pdw, uSetting) |= UPBOOLMask(uSetting))
 

Definition at line 5250 of file userk.h.

Referenced by xxxSystemParametersInfo().

#define SFW_ACTIVATERESTORE   0x0010
 

Definition at line 4438 of file userk.h.

Referenced by xxxKeyEvent(), xxxNextWindow(), and xxxSetForegroundWindow2().

#define SFW_NOZORDER   0x0004
 

Definition at line 4436 of file userk.h.

Referenced by xxxActiveWindowTracking(), and xxxSetForegroundWindow2().

#define SFW_SETFOCUS   0x0008
 

Definition at line 4437 of file userk.h.

Referenced by xxxSetFocus(), and xxxSetForegroundWindow2().

#define SFW_STARTUP   0x0001
 

Definition at line 4434 of file userk.h.

Referenced by xxxMinMaximize(), and xxxSetForegroundWindow2().

#define SFW_SWITCH   0x0002
 

Definition at line 4435 of file userk.h.

Referenced by xxxActiveWindowTracking(), xxxKeyEvent(), xxxNextWindow(), and xxxSetForegroundWindow2().

#define SHRSTR ppi,
 )     SharedRebaseToClient(ppi, gpsi->s)
 

Definition at line 6729 of file userk.h.

#define SHUTDOWN_CANCEL   3
 

Definition at line 78 of file userk.h.

Referenced by ConsoleClientShutdown(), UnlockConsole(), and UserClientShutdown().

#define SHUTDOWN_KNOWN_PROCESS   1
 

Definition at line 76 of file userk.h.

Referenced by ConsoleClientShutdown(), NonConsoleProcessShutdown(), UnlockConsole(), UserClientShutdown(), and xxxQueryInformationThread().

#define SHUTDOWN_UNKNOWN_PROCESS   2
 

Definition at line 77 of file userk.h.

Referenced by ConsoleClientShutdown(), UserClientShutdown(), and xxxQueryInformationThread().

#define SMESSAGEPROTO func   ) 
 

Value:

LRESULT CALLBACK Sfn ## func( \ PWND pwnd, UINT msg, WPARAM wParam, LPARAM lParam, \ ULONG_PTR xParam, PROC xpfnWndProc, DWORD dwSCMSFlags, PSMS psms)

Definition at line 4081 of file userk.h.

#define SMF_CB_CLIENT   0x0400
 

Definition at line 3734 of file userk.h.

Referenced by _ReplyMessage(), ReceiverDied(), xxxInterSendMsgEx(), and xxxReceiveMessage().

#define SMF_CB_REPLY   0x0200
 

Definition at line 3733 of file userk.h.

Referenced by NtUserGetThreadState(), xxxInterSendMsgEx(), and xxxReceiveMessage().

#define SMF_CB_REQUEST   0x0100
 

Definition at line 3732 of file userk.h.

Referenced by _ReplyMessage(), NtUserGetThreadState(), ReceiverDied(), xxxInterSendMsgEx(), and xxxReceiveMessage().

#define SMF_CB_SERVER   0x0800
 

Definition at line 3735 of file userk.h.

Referenced by xxxInterSendMsgEx().

#define SMF_RECEIVEDMESSAGE   0x0010
 

Definition at line 3731 of file userk.h.

Referenced by xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSleepTask().

#define SMF_RECEIVERBUSY   0x4000
 

Definition at line 3738 of file userk.h.

Referenced by ReceiverDied(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSleepTask().

#define SMF_RECEIVERDIED   0x0002
 

Definition at line 3728 of file userk.h.

Referenced by ReceiverDied(), and xxxReceiveMessage().

#define SMF_RECEIVERFREE   0x0008
 

Definition at line 3730 of file userk.h.

Referenced by ReceiverDied(), xxxInterSendMsgEx(), and xxxReceiveMessage().

#define SMF_REPLY   0x0001
 

Definition at line 3727 of file userk.h.

Referenced by _ReplyMessage(), NtUserGetThreadState(), ReceiverDied(), xxxHkCallHook(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSleepTask().

#define SMF_SENDERDIED   0x0004
 

Definition at line 3729 of file userk.h.

Referenced by _ReplyMessage(), ReceiverDied(), xxxHkCallHook(), and xxxReceiveMessage().

#define SMF_WOWRECEIVE   0x1000
 

Definition at line 3736 of file userk.h.

Referenced by DirectedScheduleTask().

#define SMF_WOWSEND   0x2000
 

Definition at line 3737 of file userk.h.

Referenced by DirectedScheduleTask().

#define SMIN_CLEAR   0
 

Definition at line 5534 of file userk.h.

Referenced by xxxCreateWindowEx(), xxxMinMaximize(), and xxxMS_TrackMove().

#define SMIN_SET   1
 

Definition at line 5535 of file userk.h.

Referenced by SetMinimize(), and xxxMinMaximize().

#define SMS_NOMENU   (PMENU)(-1)
 

Definition at line 4936 of file userk.h.

Referenced by xxxMNCancel(), and xxxSendMenuSelect().

#define SPB_DRAWBUFFER   0x0004
 

Definition at line 3655 of file userk.h.

#define SPB_LOCKUPDATE   0x0002
 

Definition at line 3654 of file userk.h.

Referenced by CreateSpb(), FBitsTouch(), FindSpb(), and LockWindowUpdate2().

#define SPB_SAVESCREENBITS   0x0001
 

Definition at line 3653 of file userk.h.

Referenced by CreateSpb(), FreeSpb(), and RestoreSpb().

#define STR_COLOREND   STR_GRADIENTINACTIVECAPTION
 

Definition at line 6737 of file userk.h.

Referenced by xxxODI_ColorInit().

#define STR_COLORSTART   STR_SCROLLBAR
 

Definition at line 6736 of file userk.h.

Referenced by xxxODI_ColorInit().

#define STW_SAME   ((PWND) 1)
 

Definition at line 5823 of file userk.h.

Referenced by xxxAddFullScreen(), xxxEndDeferWindowPosEx(), xxxRemoveFullScreen(), and xxxSetTrayWindow().

#define SubtractRgn hrgnResult,
hrgnA,
hrgnB   )     GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_DIFF)
 

Definition at line 2221 of file userk.h.

Referenced by _ExcludeUpdateRgn(), _GetDCEx(), CalcWindowVisRgn(), InternalInvalidate2(), InternalInvalidate3(), InternalScrollDC(), LockWindowUpdate2(), PreventInterMonitorBlts(), RestoreSpb(), SpbCheckRect2(), UserSetDCVisRgn(), xxxDrawDragRect(), and zzzBltValidBits().

#define SYSCUR name   )     (gasyscur[OCR_##name##_DEFAULT - OCR_FIRST_DEFAULT].spcur)
 

Definition at line 2773 of file userk.h.

Referenced by AllocQueue(), LW_RegisterWindows(), xxxCreateThreadInfo(), xxxDragObject(), xxxDWP_SetCursor(), xxxHelpLoop(), xxxMoveSize(), xxxScanSysQueue(), xxxTrackInitSize(), and zzzUpdateCursorImage().

#define SYSICO name   )     (gasysico[OIC_##name##_DEFAULT - OIC_FIRST_DEFAULT].spcur)
 

Definition at line 2772 of file userk.h.

Referenced by _LoadCursorsAndIcons(), DrawIconCallBack(), xxxGetWindowSmIcon(), xxxPaintIconsInSwitchWindow(), and xxxRealDrawMenuItem().

#define TDBF_SETUP   1
 

Definition at line 3177 of file userk.h.

Referenced by DestroyTask(), and zzzInitTask().

#define TERMF_DTDESTROYED   0x00000020
 

Definition at line 2011 of file userk.h.

Referenced by xxxDesktopThread().

#define TERMF_DTINITFAILED   0x00000010
 

Definition at line 2010 of file userk.h.

Referenced by xxxDesktopThread(), and xxxInitTerminal().

#define TERMF_DTINITSUCCESS   0x00000008
 

Definition at line 2009 of file userk.h.

Referenced by xxxDesktopThread().

#define TERMF_INITIALIZED   0x00000001
 

Definition at line 2006 of file userk.h.

Referenced by xxxCreateWindowStation(), and xxxInitTerminal().

#define TERMF_NOIO   0x00000002
 

Definition at line 2007 of file userk.h.

Referenced by xxxCreateDesktop(), xxxCreateWindowStation(), xxxDesktopThread(), and xxxInitTerminal().

#define TERMF_STOPINPUT   0x00000004
 

Definition at line 2008 of file userk.h.

#define TEST_ACCF  )     TEST_FLAG(gdwPUDFlags, f)
 

Definition at line 6601 of file userk.h.

Referenced by FilterKeys(), MKHideMouseCursor(), MouseKeys(), ProcessKeyboardInput(), ProcessMouseInput(), SetAccessEnabledFlag(), SoundSentryTimer(), xxxAccessTimeOutTimer(), xxxMKButtonClick(), xxxMKMouseMove(), and xxxMKToggleMouseKeys().

#define TEST_BOOL_ACCF  )     TEST_BOOL_FLAG(gdwPUDFlags, f)
 

Definition at line 6602 of file userk.h.

Referenced by LoadCPUserPreferences(), SoundSentryTimer(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxSystemParametersInfo(), and xxxUpdatePerUserAccessPackSettings().

#define TEST_BOOL_GTERMF  )     TEST_BOOL_FLAG(gdwGTERMFlags, f)
 

Definition at line 1997 of file userk.h.

#define TEST_BOOL_PUDF  )     TEST_BOOL_FLAG(gdwPUDFlags, f)
 

Definition at line 6609 of file userk.h.

Referenced by xxxMoveSize(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

#define TEST_GTERMF  )     TEST_FLAG(gdwGTERMFlags, f)
 

Definition at line 1996 of file userk.h.

Referenced by AllocQueue(), MKShowMouseCursor(), xxxSetThreadDesktop(), and zzzSetDesktop().

#define TEST_PUDF  )     TEST_FLAG(gdwPUDFlags, f)
 

Definition at line 6608 of file userk.h.

Referenced by _ShowWindowAsync(), BoundCursor(), CancelForegroundActivate(), DestroySMWP(), EndShutdown(), InternalBeginDeferWindowPos(), LockWindowUpdate2(), MNAllocPopup(), MNFreePopup(), NtUserMinMaximize(), NtUserShowWindow(), PlayEventSound(), xxxBeginPaint(), xxxbFullscreenSwitch(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyWindow(), xxxInitProcessInfo(), xxxMessageBeep(), xxxMinimizeHungWindow(), xxxMNAllocMenuState(), xxxMNCloseHierarchy(), xxxMNEndMenuState(), xxxOldMessageBeep(), xxxSetInternalWindowPos(), xxxSetParent(), xxxSetWindowPlacement(), xxxShowScrollBar(), xxxSysCommand(), and xxxUserChangeDisplaySettings().

#define TestALPHA uSetting   )     (!gbDisableAlpha && TestEffectUP(uSetting))
 

Definition at line 6672 of file userk.h.

Referenced by CreateBitmapStrip(), FCursorShadowed(), MNFadeSelection(), xxxAnimateCaption(), xxxDrawCaptionBar(), xxxMenuWindowProc(), and xxxTooltipWndProc().

#define TestEffectInvertUP uSetting   )     (TestUP(uSetting) || !TestUP(UIEFFECTS))
 

Definition at line 5280 of file userk.h.

Referenced by xxxDrawMenuBarUnderlines(), and xxxDrawMenuItemText().

#define TestEffectUP uSetting   ) 
 

Value:

((*gpdwCPUserPreferencesMask & \ (IndexUP(SPI_GET ## uSetting) | IndexUP(SPI_GETUIEFFECTS))) == \ (IndexUP(SPI_GET ## uSetting) | IndexUP(SPI_GETUIEFFECTS)))

Definition at line 5272 of file userk.h.

Referenced by xxxMenuWindowProc(), xxxShowTooltip(), xxxTooltipWndProc(), and xxxTrackMouseMove().

#define TESTHMODLOADED pti,
 )     ((pti)->ppi->dwhmodLibLoadedMask & (1 << (x)))
 

Definition at line 3665 of file userk.h.

Referenced by xxxCallHook2(), xxxDoSysExpunge(), xxxGetEventProc(), and xxxLoadHmodIndex().

#define TestRawKeyDown vk   )     TestKeyDownBit(gafRawKeyState, vk)
 

Definition at line 5734 of file userk.h.

Referenced by AdjustPushState(), NlsNumpadModeProc(), UpdateRawKeyState(), xxxAltGr(), xxxKeyEvent(), xxxNumpadCursor(), and xxxProcessKeyEvent().

#define TestRawKeyToggle vk   )     TestKeyToggleBit(gafRawKeyState, vk)
 

Definition at line 5737 of file userk.h.

Referenced by RemoteSyncToggleKeys(), and xxxNumpadCursor().

#define TestUP uSetting   )     TestUPBOOL(gpdwCPUserPreferencesMask, SPI_GET ## uSetting)
 

Definition at line 5262 of file userk.h.

Referenced by xxxActiveWindowTracking(), xxxDWP_SetCursor(), xxxMouseActivate(), xxxProcessEventMessage(), xxxSetForegroundWindow2(), xxxSystemParametersInfo(), xxxSystemTimerProc(), and xxxTrackMouseMove().

#define TestUPBOOL pdw,
uSetting   )     (*UPBOOLPointer(pdw, uSetting) & UPBOOLMask(uSetting))
 

Definition at line 5247 of file userk.h.

Referenced by xxxSystemParametersInfo().

#define ThreadLock _pobj_,
_ptl_   ) 
 

Value:

{ \ \ PTHREADINFO _pti_; \ PVOID __pobj_ = (_pobj_); \ \ _pti_ = PtiCurrent(); \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = __pobj_; \ if (__pobj_ != NULL) { \ HMLockObject(__pobj_); \ } \ }

Definition at line 1203 of file userk.h.

#define ThreadLockAlways _pobj_,
_ptl_   ) 
 

Value:

{ \ \ PTHREADINFO _pti_; \ PVOID __pobj_ = (_pobj_); \ \ _pti_ = PtiCurrent(); \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = __pobj_; \ HMLockObject(__pobj_); \ }

Definition at line 1227 of file userk.h.

#define ThreadLockAlwaysWithPti _pti_,
_pobj_,
_ptl_   ) 
 

Value:

{ \ PVOID __pobj_ = (_pobj_); \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = __pobj_; \ HMLockObject(__pobj_); \ }

Definition at line 1268 of file userk.h.

#define ThreadLockDesktop pti,
pdesk,
ptl,
tag   ) 
 

Value:

{ \ UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ ThreadLockObject(pdesk, ptl); \ }

Definition at line 1652 of file userk.h.

Referenced by NtUserSwitchDesktop(), RemoteDisableScreen(), RemoteRedrawScreen(), xxxCreateThreadInfo(), xxxDesktopThread(), xxxFreeWindow(), xxxSendMessageBSM(), xxxSystemBroadcastMessage(), and zzzSetDesktop().

#define ThreadLockDesktopHandle _pti,
_ptl_,
_hdesk_   )     PushW32ThreadLock(_hdesk_, _ptl_, CloseProtectedHandle)
 

Definition at line 1722 of file userk.h.

Referenced by xxxSwitchDesktop().

#define ThreadLockExchangeDesktop pti,
pdesk,
ptl,
tag   ) 
 

Value:

{ \ UserAssert(pdesk == NULL || OBJECT_TO_OBJECT_HEADER(pdesk)->Type == *ExDesktopObjectType);\ ThreadLockExchangeObject(pdesk, ptl); \ }

Definition at line 1658 of file userk.h.

Referenced by xxxSendMessageBSM(), and xxxSystemBroadcastMessage().

#define ThreadLockExchangeObject pobj,
ptl   ) 
 

Value:

{ \ UserAssert(!(PpiCurrent()->W32PF_Flags & W32PF_TERMINATED)); \ UserAssert(pobj == NULL || OBJECT_TO_OBJECT_HEADER(pobj)->PointerCount != 0); \ if (pobj != NULL) { \ ObReferenceObject(pobj); \ } \ ExchangeW32ThreadLock(pobj, ptl); \ }

Definition at line 1565 of file userk.h.

#define ThreadLockExchangeWinSta pti,
pwinsta,
ptl   ) 
 

Value:

{ \ UserAssert(pwinsta == NULL || OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType);\ ThreadLockExchangeObject(pwinsta, ptl); \ }

Definition at line 1674 of file userk.h.

Referenced by xxxSendMessageBSM(), and xxxSystemBroadcastMessage().

#define ThreadLockNever _ptl_   ) 
 

Value:

{ \ \ PTHREADINFO _pti_; \ \ _pti_ = PtiCurrent(); \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = NULL; \ }

Definition at line 1247 of file userk.h.

Referenced by xxxRedrawHungWindow(), xxxScrollWindowEx(), xxxSendChildNCPaint(), xxxUpdateOtherThreadsWindows(), xxxUpdateThreadsWindows(), xxxUpdateWindow2(), and xxxWindowHitTest().

#define ThreadLockNeverWithPti _pti_,
_ptl_   ) 
 

Value:

{ \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = NULL; \ }

Definition at line 1285 of file userk.h.

#define ThreadLockObject pobj,
ptl   ) 
 

Value:

{ \ UserAssert(!(PpiCurrent()->W32PF_Flags & W32PF_TERMINATED)); \ UserAssert(pobj == NULL || OBJECT_TO_OBJECT_HEADER(pobj)->PointerCount != 0); \ PushW32ThreadLock(pobj, ptl, UserDereferenceObject); \ if (pobj != NULL) { \ ObReferenceObject(pobj); \ } \ }

Definition at line 1555 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject().

#define ThreadLockPool _pti_,
_ppool_,
_ptl_   )     PushW32ThreadLock(_ppool_, _ptl_, UserFreePool)
 

Definition at line 1704 of file userk.h.

Referenced by bEnumerateRegistryFonts(), BMPtoDIB(), CreateProfileUserName(), MESSAGECALL(), NtUserDrawCaptionTemp(), NtUserResolveDesktop(), NtUserResolveDesktopForWOW(), NtUserSendInput(), NtUserSetSysColors(), NtUserSystemParametersInfo(), NtUserToUnicodeEx(), QueuePowerRequest(), xxxConnectService(), xxxCsEvent(), xxxDragObject(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxImmLoadLayout(), xxxMessageEvent(), xxxNextWindow(), xxxOldNextWindow(), xxxResetDisplayDevice(), and xxxSystemParametersInfo().

#define ThreadLockPoolCleanup _pti_,
_ppool_,
_ptl_,
_pfn_   )     PushW32ThreadLock(_ppool_, _ptl_, _pfn_)
 

Definition at line 1713 of file userk.h.

Referenced by xxxEndDeferWindowPosEx(), xxxFreeListFree(), xxxProcessEventMessage(), and xxxUserPowerCalloutWorker().

#define ThreadLockPti pti,
pobj,
ptl   ) 
 

Value:

{ \ _ThreadLockPti(pti, pobj, ptl); \ }

Definition at line 1692 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxCancelTracking(), xxxDeactivate(), xxxImmActivateAndUnloadThreadsLayout(), xxxImmActivateThreadsLayout(), xxxImmUnloadThreadsLayout(), xxxSetForegroundWindow2(), and xxxWindowEvent().

#define ThreadLockSFWLockCount _ptl_   ) 
 

Value:

{ \ IncSFWLockCount(); \ /* Pass a fake pObj or the cleanup function won't be called */ \ PushW32ThreadLock(&guSFWLockCount, _ptl_, CleanupDecSFWLockCount); \ }

Definition at line 1729 of file userk.h.

Referenced by xxxHkCallHook().

#define ThreadLockWinSta pti,
pwinsta,
ptl   ) 
 

Value:

{ \ UserAssert(pwinsta == NULL || OBJECT_TO_OBJECT_HEADER(pwinsta)->Type == *ExWindowStationObjectType);\ ThreadLockObject(pwinsta, ptl); \ }

Definition at line 1668 of file userk.h.

Referenced by DisownClipboard(), NtUserGetClipboardData(), xxxChangeClipboardChain(), xxxCloseClipboard(), xxxDesktopThread(), xxxEmptyClipboard(), xxxSendMessageBSM(), xxxSetClipboardViewer(), xxxSnapWindow(), and xxxSystemBroadcastMessage().

#define ThreadLockWithPti _pti_,
_pobj_,
_ptl_   ) 
 

Value:

{ \ PVOID __pobj_ = (_pobj_); \ (_ptl_)->next = _pti_->ptl; \ _pti_->ptl = (_ptl_); \ (_ptl_)->pobj = __pobj_; \ if (__pobj_ != NULL) { \ HMLockObject(__pobj_); \ } \ }

Definition at line 1301 of file userk.h.

#define THREADS_PER_TLBLOCK   16
 

Definition at line 2473 of file userk.h.

Referenced by xxxImmActivateAndUnloadThreadsLayout(), xxxImmActivateThreadsLayout(), and xxxImmUnloadThreadsLayout().

#define ThreadUnlock ptl   )     ThreadUnlock1()
 

Definition at line 1362 of file userk.h.

#define ThreadUnlockAndCleanupPool _pti_,
_ptl_   )     PopAndFreeAlwaysW32ThreadLock(_ptl_)
 

Definition at line 1719 of file userk.h.

#define ThreadUnlockAndFreePool _pti_,
_ptl_   )     PopAndFreeAlwaysW32ThreadLock(_ptl_)
 

Definition at line 1710 of file userk.h.

Referenced by bEnumerateRegistryFonts(), FreeProfileUserName(), MESSAGECALL(), NtUserDrawCaptionTemp(), NtUserResolveDesktop(), NtUserResolveDesktopForWOW(), NtUserSystemParametersInfo(), NtUserToUnicodeEx(), xxxCsEvent(), xxxDragObject(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), xxxImmLoadLayout(), xxxMessageEvent(), xxxResetDisplayDevice(), and xxxSystemParametersInfo().

#define ThreadUnlockDesktop pti,
ptl,
tag   )     ThreadUnlockObject(ptl)
 

Definition at line 1664 of file userk.h.

Referenced by NtUserSwitchDesktop(), RemoteDisableScreen(), RemoteRedrawScreen(), xxxCreateThreadInfo(), xxxDesktopThread(), xxxFreeWindow(), xxxSendMessageBSM(), xxxSystemBroadcastMessage(), and zzzSetDesktop().

#define ThreadUnlockDesktopHandle _ptl_   )     PopAndFreeAlwaysW32ThreadLock(_ptl_)
 

Definition at line 1725 of file userk.h.

Referenced by xxxSwitchDesktop().

#define ThreadUnlockObject ptl   ) 
 

Value:

{ \ PopAndFreeW32ThreadLock(ptl); \ } \

Definition at line 1575 of file userk.h.

Referenced by xxxPollAndWaitForSingleObject().

#define ThreadUnlockPool _pti_,
_ptl_   )     PopW32ThreadLock(_ptl_)
 

Definition at line 1707 of file userk.h.

Referenced by BMPtoDIB(), NtUserSendInput(), NtUserSetSysColors(), QueuePowerRequest(), xxxConnectService(), xxxImmLoadLayout(), xxxNextWindow(), and xxxOldNextWindow().

#define ThreadUnlockPoolCleanup _pti_,
_ptl_   )     PopW32ThreadLock(_ptl_)
 

Definition at line 1716 of file userk.h.

Referenced by xxxEndDeferWindowPosEx(), xxxFreeListFree(), xxxProcessEventMessage(), and xxxUserPowerCalloutWorker().

#define ThreadUnlockPti pti,
ptl   )     UnlockW32Thread(ptl)
 

Definition at line 1699 of file userk.h.

Referenced by xxxActivateThisWindow(), xxxCancelTracking(), xxxDeactivate(), xxxImmActivateAndUnloadThreadsLayout(), xxxImmActivateThreadsLayout(), xxxImmUnloadThreadsLayout(), xxxSetForegroundWindow2(), and xxxWindowEvent().

#define ThreadUnlockSFWLockCount _ptl_   ) 
 

Value:

{ \ DecSFWLockCount(); \ PopW32ThreadLock(_ptl_); \ }

Definition at line 1736 of file userk.h.

Referenced by xxxHkCallHook().

#define ThreadUnlockWinSta pti,
ptl   )     ThreadUnlockObject(ptl)
 

Definition at line 1698 of file userk.h.

Referenced by DisownClipboard(), NtUserGetClipboardData(), xxxChangeClipboardChain(), xxxCloseClipboard(), xxxDesktopThread(), xxxEmptyClipboard(), xxxSendMessageBSM(), xxxSetClipboardViewer(), xxxSnapWindow(), and xxxSystemBroadcastMessage().

#define TID pti   )     HandleToUlong((pti) == NULL ? NULL : (pti)->pEThread->Cid.UniqueThread)
 

Definition at line 1174 of file userk.h.

Referenced by xxxSetForegroundWindow2().

#define TIDq pti   )     HandleToUlong((pti)->pEThread->Cid.UniqueThread)
 

Definition at line 1175 of file userk.h.

Referenced by CancelInputState(), CreateNotify(), UT_CaretSet(), xxxActivateThisWindow(), xxxCallHook2(), xxxCreateCaret(), xxxSetForegroundWindow2(), xxxWindowEvent(), and zzzSetDesktop().

#define TOGGLE_ACCF  )     TOGGLE_FLAG(gdwPUDFlags, f)
 

Definition at line 6606 of file userk.h.

#define TOGGLE_GTERMF  )     TOGGLE_FLAG(gdwGTERMFlags, f)
 

Definition at line 2001 of file userk.h.

#define TOGGLE_PUDF  )     TOGGLE_FLAG(gdwPUDFlags, f)
 

Definition at line 6613 of file userk.h.

#define ToggleRawKeyToggle vk   )     ToggleKeyToggleBit(gafRawKeyState, vk)
 

Definition at line 5740 of file userk.h.

Referenced by UpdateRawKeyState().

#define TRACE  ) 
 

Definition at line 1118 of file userk.h.

#define TRACE_DESKTOP  ) 
 

Definition at line 7443 of file userk.h.

Referenced by DestroyDesktop(), xxxDesktopThread(), and xxxSwitchDesktop().

#define TRACE_HYDAPI  ) 
 

Definition at line 7427 of file userk.h.

Referenced by CtxDisplayIOCtl(), InitiateWin32kCleanup(), RemoteConnect(), RemoteDisableScreen(), RemoteLogoff(), RemoteNtSecurity(), RemotePassthruDisable(), RemoteRedrawRectangle(), RemoteRedrawScreen(), RemoteShadowCleanup(), RemoteShadowStart(), RemoteThinwireStats(), UnloadCursorsAndIcons(), Win32KDriverUnload(), Win32kNtUserCleanup(), xxxRemoteDisconnect(), xxxRemotePassthruEnable(), xxxRemoteReconnect(), xxxRemoteShadowSetup(), xxxRemoteShadowStop(), and xxxRemoteStopScreenUpdates().

#define TRACE_INIT str   )     {}
 

Definition at line 1116 of file userk.h.

Referenced by InitCreateObjectDirectory(), InitCreateSharedSection(), InitCreateUserCrit(), InitCreateUserSubsystem(), InitFunctionTables(), InitLoadResources(), InitMapSharedSection(), InitMessageTables(), InitOLEFormats(), InitUserScreen(), NtUserInitialize(), NtUserProcessConnect(), UpdateUserScreen(), UserInitialize(), UserThreadCallout(), Win32UserInitialize(), xxxbFullscreenSwitch(), xxxConnectService(), xxxCreateDesktop(), xxxOpenDesktop(), xxxSwitchDesktop(), xxxUserChangeDisplaySettings(), xxxUserProcessCallout(), and xxxUserResetDisplayDevice().

#define TRACE_RIT  ) 
 

Definition at line 7444 of file userk.h.

Referenced by InitiateWin32kCleanup().

#define TRACE_SWITCH str   )     {}
 

Definition at line 1117 of file userk.h.

Referenced by FullScreenCleanup(), ResetSharedDesktops(), xxxMakeWindowForegroundWithState(), and xxxUserChangeDisplaySettings().

#define TRACECALLBACK  ) 
 

Definition at line 1121 of file userk.h.

#define TRACECALLBACKMSG  ) 
 

Definition at line 1122 of file userk.h.

#define TRACETHUNK  ) 
 

Definition at line 1120 of file userk.h.

Referenced by MESSAGECALL().

#define TRACEVOID  ) 
 

Definition at line 1119 of file userk.h.

Referenced by NtUserAlterWindowStyle(), NtUserEndMenu(), NtUserModifyUserStartupInfoFlags(), NtUserNotifyIMEStatus(), NtUserNotifyWinEvent(), NtUserSetDbgTag(), NtUserSetRipFlags(), NtUserSetThreadLayoutHandles(), and NtUserSetThreadState().

#define UNDERLINE_RECALC   0x7FFFFFFF
 

Definition at line 5295 of file userk.h.

Referenced by _SetMenuDefaultItem(), MenuRecalc(), xxxDrawItemUnderline(), and xxxSetLPITEMInfo().

#define UnionRgn hrgnResult,
hrgnA,
hrgnB   )     GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_OR)
 

Definition at line 2223 of file userk.h.

Referenced by InternalInvalidate3(), InternalScrollDC(), PreventInterMonitorBlts(), UpdateUserScreen(), xxxBeginPaint(), xxxShowOwnedWindows(), and zzzBltValidBits().

#define Unlock ppobj   )     HMAssignmentUnlock((PVOID *)ppobj)
 

Definition at line 1182 of file userk.h.

#define UnlockDesktop ppdesk,
tag,
extra   )     UnlockObjectAssignment(ppdesk)
 

Definition at line 1649 of file userk.h.

Referenced by _DestroyMenu(), CleanupDirtyDesktops(), DestroyClass(), DestroyDesktop(), DestroyProcessInfo(), DestroyWindowStation(), HMFreeObject(), InitiateWin32kCleanup(), InternalRegisterClassEx(), UnlinkHook(), UserDeleteW32Thread(), xxxCloseDesktop(), xxxCreateDesktop(), xxxDesktopThread(), and xxxDestroyThreadInfo().

#define UnlockProcess   ObDereferenceObject
 

Definition at line 4486 of file userk.h.

Referenced by CheckAllowForeground(), SetInformationProcess(), UserSetConsoleProcessWindowStation(), xxxActivateDebugger(), xxxAllowSetForegroundWindow(), xxxUserNotifyConsoleApplication(), xxxUserNotifyProcessCreate(), and xxxWaitForInputIdle().

#define UnlockThread   ObDereferenceObject
 

Definition at line 4487 of file userk.h.

Referenced by PtiFromThreadId(), TerminateConsole(), xxxHardErrorControl(), xxxQueryInformationThread(), xxxSetInformationThread(), and xxxUserNotifyProcessCreate().

#define UnlockWinSta ppwinsta   )     UnlockObjectAssignment(ppwinsta)
 

Definition at line 1628 of file userk.h.

Referenced by DestroyProcessInfo(), DestroyWindowStation(), and FreeDesktop().

#define UnrealizeObject hbr   )     /* NOP for NT */
 

Definition at line 5308 of file userk.h.

#define UP uSetting   )     UPDWORDValue(SPI_GET ## uSetting)
 

Definition at line 7066 of file userk.h.

Referenced by CanForceForeground(), LoadCPUserPreferences(), xxxDWP_SetCursor(), xxxSetForegroundWindow(), and xxxTrackMouseMove().

#define UPBOOLIndex uSetting   )     (((uSetting) - SPI_STARTBOOLRANGE) / 2)
 

Definition at line 5232 of file userk.h.

#define UPBOOLMask uSetting   )     (1 << (UPBOOLIndex(uSetting) - ((UPBOOLIndex(uSetting) / 32) * 32)))
 

Definition at line 5244 of file userk.h.

#define UPBOOLPointer pdw,
uSetting   )     (pdw + (UPBOOLIndex(uSetting) / 32))
 

Definition at line 5238 of file userk.h.

#define UPDWORDIndex uSetting   )     (1 + (((uSetting) - SPI_STARTDWORDRANGE) / 2))
 

Definition at line 5220 of file userk.h.

#define UPIsBOOLRange uSetting   )     ((uSetting) >= SPI_STARTBOOLRANGE && (uSetting) < SPI_MAXBOOLRANGE)
 

Definition at line 5226 of file userk.h.

Referenced by NtUserSystemParametersInfo(), and xxxSystemParametersInfo().

#define UPIsDWORDRange uSetting   )     ((uSetting) >= SPI_STARTDWORDRANGE && (uSetting) < SPI_MAXDWORDRANGE)
 

Definition at line 5213 of file userk.h.

Referenced by NtUserSystemParametersInfo(), and xxxSystemParametersInfo().

#define VALIDATECLASSANDSIZE pwnd,
message,
wParam,
lParam,
inFNID,
initmessage   ) 
 

Definition at line 2174 of file userk.h.

#define Validateppopupmenu ppopupmenu   ) 
 

Definition at line 4885 of file userk.h.

Referenced by LockPopupMenu(), MNFreePopup(), xxxMenuWindowProc(), xxxMNCancel(), xxxMNChar(), xxxMNCloseHierarchy(), xxxMNDestroyHandler(), and xxxMNLoop().

#define ValidateProcessSessionId pEProcess   ) 
 

Definition at line 4498 of file userk.h.

Referenced by InitMapSharedSection(), UserCommitSharedMemory(), and xxxCreateThreadInfo().

#define ValidateThreadSessionId pEThread   ) 
 

Definition at line 4499 of file userk.h.

Referenced by InitSystemThread().

#define WEF_ASYNC   0x0004
 

Definition at line 6466 of file userk.h.

Referenced by CreateNotify(), FreeThreadsWinEvents(), UpdateLayeredSprite(), xxxDestroyThreadInfo(), xxxFlushDeferredWindowEvents(), xxxProcessEventMessage(), xxxProcessNotifyWinEvent(), xxxSetConsoleCaretInfo(), and xxxWindowEvent().

#define WEF_DEFERNOTIFY   0x0002
 

Definition at line 6465 of file userk.h.

Referenced by RemoveNotify(), xxxFlushDeferredWindowEvents(), xxxProcessNotifyWinEvent(), and xxxWindowEvent().

#define WEF_POSTED   0x0008
 

Definition at line 6467 of file userk.h.

Referenced by FreeThreadsWinEvents(), xxxProcessEventMessage(), and xxxProcessNotifyWinEvent().

#define WEF_USEPWNDTHREAD   0x0001
 

Definition at line 6464 of file userk.h.

Referenced by NtUserNotifyWinEvent(), xxxActivateThisWindow(), xxxCalcClientRect(), xxxCancelCoolSwitch(), xxxCapture(), xxxDestroyWindow(), xxxEnableSBCtlArrows(), xxxEnableWndSBArrows(), xxxMinMaximize(), xxxMoveSwitchWndHilite(), xxxSBWndProc(), xxxSendChangedMsgs(), xxxSetParent(), xxxSetScrollBar(), xxxShowSwitchWindow(), xxxWindowEvent(), zzzChangeStates(), zzzDrawInvertScrollArea(), and zzzUpdateCursorImage().

#define WHERE_NOONE_CAN_SEE_ME   ((int) -32000)
 

Definition at line 6365 of file userk.h.

Referenced by ParkIcon(), xxxArrangeIconicWindows(), and xxxCalcValidRects().

#define WHT_IGNOREDISABLED   0x00000001
 

Definition at line 4415 of file userk.h.

Referenced by xxxScanSysQueue(), xxxWindowFromPoint(), and xxxWindowHitTest2().

#define WINDOW_CAPTURE   3 /* window-relative capture */
 

Definition at line 3850 of file userk.h.

Referenced by xxxSBTrackInit(), and xxxScanSysQueue().

#define WinFlags   ((WORD)(&__WinFlags))
 

Definition at line 3900 of file userk.h.

#define WMSG_MAGIC_VALUE   0xBABE
 

Definition at line 5563 of file userk.h.

#define WOAHACK_CHECKALTKEYSTATE   1
 

Definition at line 4016 of file userk.h.

Referenced by xxxHandleMenuMessages(), and xxxMNKeyDown().

#define WOAHACK_IGNOREALTKEYDOWN   2
 

Definition at line 4017 of file userk.h.

Referenced by xxxHandleMenuMessages(), and xxxMNKeyDown().

#define WSF_DYING   0x0010
 

Definition at line 2706 of file userk.h.

Referenced by ForceEmptyClipboard(), FreeWindowStation(), and xxxEmptyClipboard().

#define WSF_NOIO   0x0004
 

Definition at line 2704 of file userk.h.

Referenced by _BlockInput(), _GetUserObjectInformation(), CheckAllowForeground(), FreeWindowStation(), InitiateShutdown(), NtUserGetAsyncKeyState(), NtUserOpenInputDesktop(), NtUserSwitchDesktop(), ReorderKeyboardLayouts(), WantImeWindow(), xxxButtonEvent(), xxxCreateDesktop(), xxxCreateDesktop2(), xxxCreateWindowStation(), xxxDesktopThread(), xxxFreeImeKeyboardLayouts(), xxxInternalKeyEventDirect(), xxxLoadKeyboardLayoutEx(), xxxMouseEventDirect(), xxxQueryInformationThread(), xxxResolveDesktop(), xxxSetProcessWindowStation(), xxxSnapWindow(), xxxSwitchDesktop(), xxxTrackMouseMove(), xxxUpdatePerUserSystemParameters(), and zzzSetWindowsHookEx().

#define WSF_OPENLOCK   0x0002
 

Definition at line 2703 of file userk.h.

Referenced by _LockWindowStation(), _UnlockWindowStation(), DestroyProcessInfo(), EndShutdown(), InitiateShutdown(), OpenDesktopCompletion(), and xxxCreateDesktop2().

#define WSF_REALSHUTDOWN   0x0020
 

Definition at line 2708 of file userk.h.

Referenced by InitiateShutdown(), OpenDesktopCompletion(), and xxxQueryInformationThread().

#define WSF_SHUTDOWN   0x0008
 

Definition at line 2705 of file userk.h.

Referenced by _LockWindowStation(), _UnlockWindowStation(), EndShutdown(), InitiateShutdown(), and xxxCreateDesktop2().

#define WSF_SWITCHLOCK   0x0001
 

Definition at line 2702 of file userk.h.

Referenced by _LockWindowStation(), _UnlockWindowStation(), InitiateShutdown(), RemoteDisableScreen(), RemoteRedrawScreen(), xxxDesktopThread(), xxxDoHotKeyStuff(), and xxxSwitchDesktop().

#define XorRgn hrgnResult,
hrgnA,
hrgnB   )     GreCombineRgn(hrgnResult, hrgnA, hrgnB, RGN_XOR)
 

Definition at line 2225 of file userk.h.

#define xxxGetMessage lpmsg,
hwnd,
wMsgMin,
wMsgMax   )     xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, PM_REMOVE, TRUE)
 

Definition at line 5555 of file userk.h.

Referenced by NtUserGetMessage(), xxxHelpLoop(), and xxxSBTrackLoop().

#define xxxPeekMessage lpmsg,
hwnd,
wMsgMin,
wMsgMax,
wRemoveMsg   )     xxxInternalGetMessage(lpmsg, hwnd, wMsgMin, wMsgMax, wRemoveMsg, FALSE)
 

Definition at line 5553 of file userk.h.

Referenced by NtUserPeekMessage(), xxxDefWindowProc(), xxxDesktopThread(), xxxDragObject(), xxxHelpLoop(), xxxIsDragging(), xxxMNDoubleClick(), xxxMNLoop(), xxxMNRemoveMessage(), xxxMoveSize(), xxxMS_FlushWigglies(), xxxOldNextWindow(), xxxRestoreCsrssThreadDesktop(), xxxSetCsrssThreadDesktop(), and xxxTrackCaptionButton().

#define xxxReceiveMessages pti   )     while ((pti)->pcti->fsWakeBits & QS_SENDMESSAGE) { xxxReceiveMessage((pti)); }
 

Definition at line 4316 of file userk.h.

Referenced by RawInputThread(), xxxInternalGetMessage(), xxxPollAndWaitForSingleObject(), xxxSleepThread(), and xxxUserYield().

 
#define xxxRedrawScreen  ) 
 

Value:

xxxInternalInvalidate(PtiCurrent()->rpdesk->pDeskInfo->spwnd, \ HRGN_FULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN)

Definition at line 3863 of file userk.h.

Referenced by SPISetIconMetrics(), xxxSetAndDrawMinMetrics(), xxxSetAndDrawNCMetrics(), xxxSetDeskPattern(), xxxSetSysColors(), and xxxSystemParametersInfo().

#define xxxSetClassLongPtr   xxxSetClassLong
 

Definition at line 6242 of file userk.h.

Referenced by NtUserSetClassLongPtr().

#define xxxSetScrollInfo a,
b,
c,
 )     xxxSetScrollBar((a),(b),(c),(d))
 

Definition at line 5881 of file userk.h.

#define xxxSetWindowLongPtr   xxxSetWindowLong
 

Definition at line 5787 of file userk.h.

Referenced by NtUserSetWindowLongPtr(), and xxxCsDdeInitialize().

 
#define zzzEndDeferWinEventNotify  ) 
 

Value:

UserAssert(IsWinEventNotifyDeferred()); \ UserAssert(FWINABLE() || gnDeferredWinEvents == 0); \ CheckCritIn(); \ if (--gdwDeferWinEvent == 0) { \ if (FWINABLE() && (gpPendingNotifies != NULL)) { \ xxxFlushDeferredWindowEvents(); \ } \ } \ UserAssert(FWINABLE() || gnDeferredWinEvents == 0)

Definition at line 6473 of file userk.h.

Referenced by LockWindowUpdate2(), xxxCapture(), xxxCreateCaret(), xxxCreateDesktop(), xxxCreateWindowStation(), xxxHardErrorControl(), zzzBltValidBits(), zzzCancelJournalling(), zzzInitTask(), zzzReattachThreads(), zzzRecalc2(), zzzSetFMouseMoved(), and zzzShowCursor().

#define zzzWindowEvent event,
pwnd,
idObject,
idChild,
dwFlags   ) 
 

Value:

xxxWindowEvent(event, pwnd, idObject, idChild, \ IsWinEventNotifyDeferred() ? (dwFlags) | WEF_DEFERNOTIFY : (dwFlags))

Definition at line 6494 of file userk.h.

Referenced by xxxCapture(), zzzChangeStates(), zzzDrawInvertScrollArea(), zzzInternalDestroyCaret(), zzzInternalHideCaret(), zzzInternalShowCaret(), zzzSetCaretPos(), and zzzUpdateCursorImage().


Typedef Documentation

typedef struct tagAAS AAS
 

Referenced by xxxDeactivate().

typedef struct tagACCELTABLE ACCELTABLE
 

typedef struct tagASYNCSENDMSG ASYNCSENDMSG
 

typedef struct tagATTACHINFO ATTACHINFO
 

Referenced by zzzAttachThreadInput().

typedef union tagBROADCASTMSG BROADCASTMSG
 

Referenced by xxxSendMessageTimeout().

typedef struct tagBWL BWL
 

Referenced by BuildHwndList().

typedef struct tagCAPTIONCACHE CAPTIONCACHE
 

Referenced by DrawCaptionIcon().

typedef struct tagCHECKPOINT CHECKPOINT
 

Referenced by xxxArrangeIconicWindows().

typedef struct tagCLIP CLIP
 

Referenced by InternalSetClipboardData().

typedef struct tagCLIPDATA CLIPDATA
 

Referenced by _ConvertMemHandle().

typedef struct _CREATESTRUCTEX CREATESTRUCTEX
 

Referenced by MESSAGECALL(), and xxxCreateWindowEx().

typedef struct tagCRITSTACK CRITSTACK
 

typedef struct tagCVR CVR
 

Referenced by _DeferWindowPos(), and DestroySMWP().

typedef struct _CWPRETSTRUCTEX CWPRETSTRUCTEX
 

Referenced by xxxSendMessageTimeout().

typedef struct _CWPSTRUCTEX CWPSTRUCTEX
 

Referenced by xxxSendMessageTimeout().

typedef struct tagDCE DCE
 

Referenced by CreateCacheDC().

typedef struct tagDDECONV DDECONV
 

Referenced by NewConversation().

typedef struct tagDDEIMP DDEIMP
 

Referenced by MESSAGECALL().

typedef struct tagDESKTOP DESKTOP
 

Referenced by Win32UserInitialize(), xxxCreateDesktop2(), and xxxSetDeskPattern().

typedef struct tagDESKTOPVIEW DESKTOPVIEW
 

typedef struct tagDESKWND DESKWND
 

Referenced by LW_RegisterWindows().

typedef struct tagDEVICE_TEMPLATE DEVICE_TEMPLATE
 

typedef struct tagDEVICEINFO DEVICEINFO
 

Referenced by UpdateMouseInfo().

typedef struct tagDISPLAYRESOURCE DISPLAYRESOURCE
 

Referenced by InitLoadResources().

typedef struct tagDRAWICONCB DRAWICONCB
 

typedef struct tagEVENTHOOK EVENTHOOK
 

typedef struct tagFADE FADE
 

typedef DWORD( FNDDERESPONSE)(PDWORD pmsg, LPARAM *plParam, PDDECONV pDdeConv)
 

Definition at line 6166 of file userk.h.

typedef struct tagFREELIST FREELIST
 

Referenced by FreeListAdd().

typedef struct tagGENERIC_DEVICE_INFO GENERIC_DEVICE_INFO
 

typedef struct _HANDLEPAGE HANDLEPAGE
 

Referenced by HMInitHandleTable().

typedef struct tagHARDERRORHANDLER HARDERRORHANDLER
 

typedef struct tagHOOKMSGSTRUCT HOOKMSGSTRUCT
 

Referenced by xxxCallHook2().

typedef struct tagHOTKEY HOTKEY
 

Referenced by _RegisterHotKey().

typedef struct tagHOTKEYSTRUCT HOTKEYSTRUCT
 

Referenced by DWP_SetHotKey().

typedef struct tagINTERSENDMSGEX INTRSENDMSGEX
 

Referenced by _ReplyMessage(), and xxxCallHook2().

typedef struct tagKBDFILE KBDFILE
 

typedef struct tagKBDLANGTOGGLE KBDLANGTOGGLE
 

typedef struct tagKEYBOARD_DEVICE_INFO KEYBOARD_DEVICE_INFO
 

typedef struct tagKL KL
 

typedef struct tagLASTINPUT LASTINPUT
 

typedef struct _LOCK LOCK
 

Referenced by KiIA32InterceptLock().

typedef struct _LOCKRECORD LOCKRECORD
 

Referenced by Idf().

typedef struct tagACCELTABLE * LPACCELTABLE
 

Referenced by _CreateAcceleratorTable().

typedef BITMAPINFOHEADER * LPBMPHEADER
 

Definition at line 4010 of file userk.h.

typedef struct _LPKDRAWSWITCHWND LPKDRAWSWITCHWND
 

typedef struct _MDICREATESTRUCTEX MDICREATESTRUCTEX
 

Referenced by MESSAGECALL().

typedef struct tagMENUANIDC MENUANIDC
 

Referenced by xxxMNAllocMenuState().

typedef struct tagMENUSTATE MENUSTATE
 

Referenced by xxxMNAllocMenuState().

typedef struct tagMENUWND MENUWND
 

Referenced by InitFunctionTables().

typedef struct tagMLIST MLIST
 

typedef struct tagMONITORPOS MONITORPOS
 

Referenced by SnapshotMonitorRects().

typedef struct tagMONITORRECTS MONITORRECTS
 

Referenced by SnapshotMonitorRects().

typedef struct tagMOUSE_DEVICE_INFO MOUSE_DEVICE_INFO
 

typedef struct tagMOUSEEVENT MOUSEEVENT
 

typedef struct _MOVESIZEDATA MOVESIZEDATA
 

Referenced by xxxMoveSize().

typedef VOID(CALLBACK* MSGWAITCALLBACK)(DWORD DeviceType)
 

Definition at line 5571 of file userk.h.

Referenced by xxxDesktopThread(), and xxxMsgWaitForMultipleObjects().

typedef struct tagNOTIFY NOTIFY
 

typedef struct tagASYNCSENDMSG * PASYNCSENDMSG
 

Referenced by CleanEventMessage().

typedef struct tagATTACHINFO * PATTACHINFO
 

typedef BITMAPINFOHEADER* PBMPHEADER
 

Definition at line 4010 of file userk.h.

typedef union tagBROADCASTMSG * PBROADCASTMSG
 

Referenced by xxxSendMessageTimeout().

typedef struct tagBWL * PBWL
 

typedef struct tagCHECKPOINT * PCHECKPOINT
 

Referenced by ParkIcon().

typedef struct tagCLIP * PCLIP
 

typedef struct tagCLIPDATA * PCLIPDATA
 

Referenced by _ConvertMemHandle(), and NtUserCreateLocalMemHandle().

typedef struct _CREATESTRUCTEX * PCREATESTRUCTEX
 

Referenced by xxxDefWindowProc().

typedef struct tagCRITSTACK * PCRITSTACK
 

typedef struct tagCVR * PCVR
 

typedef struct _CWPRETSTRUCTEX * PCWPRETSTRUCTEX
 

Referenced by xxxHkCallHook().

typedef struct _CWPSTRUCTEX * PCWPSTRUCTEX
 

Referenced by xxxHkCallHook().

typedef struct tagDDECONV * PDDECONV
 

Referenced by xxxFreeWindow().

typedef struct tagDDEIMP * PDDEIMP
 

Referenced by MESSAGECALL(), and xxxFreeWindow().

typedef struct tagDESKTOPVIEW * PDESKTOPVIEW
 

typedef struct tagDESKWND * PDESKWND
 

typedef struct tagDEVICE_TEMPLATE * PDEVICE_TEMPLATE
 

Referenced by InputApc().

typedef struct tagDEVICEINFO * PDEVICEINFO
 

typedef struct tagDISPLAYRESOURCE * PDISPLAYRESOURCE
 

typedef struct tagDRAWICONCB * PDRAWICONCB
 

typedef struct tagPERFINFO PERFHANDLEINFO
 

typedef struct tagEVENTHOOK * PEVENTHOOK
 

Definition at line 62 of file userk.h.

typedef struct tagFADE * PFADE
 

typedef FNDDERESPONSE* PFNDDERESPONSE
 

Definition at line 6167 of file userk.h.

typedef struct tagFREELIST * PFREELIST
 

typedef struct tagGENERIC_DEVICE_INFO * PGENERIC_DEVICE_INFO
 

typedef GRAYMENU* PGRAYMENU
 

Definition at line 3281 of file userk.h.

Referenced by xxxDrawMenuItem().

typedef struct _HANDLEPAGE * PHANDLEPAGE
 

typedef struct tagHARDERRORHANDLER * PHARDERRORHANDLER
 

typedef struct tagHOOKMSGSTRUCT * PHOOKMSGSTRUCT
 

Referenced by xxxReceiveMessage().

typedef struct tagHOTKEY * PHOTKEY
 

typedef struct tagHOTKEYSTRUCT * PHOTKEYSTRUCT
 

typedef HWND* PHWND
 

Definition at line 6522 of file userk.h.

Referenced by _RemoveNonTaskWindows(), DrawIconCallBack(), InitSwitchWndInfo(), NextPrevPhwnd(), xxxCheckImeShowStatus(), xxxDesktopRecalc(), xxxMetricsRecalc(), and xxxPaintIconsInSwitchWindow().

typedef struct tagINTERSENDMSGEX * PINTRSENDMSGEX
 

Referenced by xxxSendMessageTimeout().

typedef struct tagKBDFILE * PKBDFILE
 

typedef struct tagKEYBOARD_DEVICE_INFO * PKEYBOARD_DEVICE_INFO
 

typedef struct tagKL * PKL
 

typedef struct tagLASTINPUT PLASTINPUT
 

typedef struct _LOCK * PLOCK
 

typedef struct _MDICREATESTRUCTEX * PMDICREATESTRUCTEX
 

typedef struct tagMENUSTATE * PMENUSTATE
 

Referenced by IsMDIItem(), and LockMenuState().

typedef struct tagMENUWND * PMENUWND
 

Referenced by xxxDesktopThread().

typedef struct tagMLIST * PMLIST
 

Referenced by AdjustForCoalescing().

typedef struct tagMONITORPOS * PMONITORPOS
 

Referenced by SnapshotMonitorRects().

typedef struct tagMONITORRECTS * PMONITORRECTS
 

Referenced by xxxResetDisplayDevice().

typedef struct tagMOUSE_DEVICE_INFO * PMOUSE_DEVICE_INFO
 

typedef struct tagMOUSEEVENT * PMOUSEEVENT
 

Referenced by UnqueueMouseEvent().

typedef struct _MOVESIZEDATA * PMOVESIZEDATA
 

typedef struct tagNOTIFY * PNOTIFY
 

Definition at line 63 of file userk.h.

typedef struct tagPOOLRECORD POOLRECORD
 

typedef struct tagPOPUPMENU POPUPMENU
 

typedef struct tagPOWERSTATE POWERSTATE
 

typedef struct tagPERFINFO * PPERFHANDLEINFO
 

typedef struct tagPOOLRECORD * PPOOLRECORD
 

typedef struct tagPOWERSTATE * PPOWERSTATE
 

typedef struct tagPROFILEVALUEINFO * PPROFILEVALUEINFO
 

Referenced by LoadCPUserPreferences().

typedef struct tagPROFINTINFO * PPROFINTINFO
 

Referenced by FastGetProfileIntsW().

typedef struct tagPUBOBJ * PPUBOBJ
 

Referenced by DestroyProcessInfo().

typedef struct tagPROCESSINFO PROCESSINFO
 

Referenced by ClearAppStarting().

typedef struct tagPROFILEVALUEINFO PROFILEVALUEINFO
 

typedef struct tagPROFINTINFO PROFINTINFO
 

Referenced by xxxSetDeskWallpaper().

typedef * PSCANCODEMAP
 

Referenced by InitScancodeMap().

typedef struct tagSMS* KPTR_MODIFIER PSMS
 

Definition at line 3297 of file userk.h.

Referenced by _ReplyMessage(), AllocSMS(), DoQueuedSyncPaint(), InitiateWin32kCleanup(), InterQueueMsgCleanup(), NtUserQuerySendMessage(), ReceiverDied(), SendMsgCleanup(), Win32kNtUserCleanup(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSleepTask().

typedef struct tagSMWP * PSMWP
 

Referenced by xxxArrangeIconicWindows().

typedef struct tagSVR_INSTANCE_INFO * PSVR_INSTANCE_INFO
 

typedef struct tagSwitchWndInfo * PSWINFO
 

typedef struct tagSWITCHWND * PSWITCHWND
 

Referenced by Getpswi().

typedef struct tagTERMINAL * PTERMINAL
 

typedef struct tagTIMER * PTIMER
 

typedef struct tagTLBLOCK * PTLBLOCK
 

Referenced by xxxImmActivateThreadsLayout().

typedef struct tagTOOLTIPWND * PTOOLTIPWND
 

Referenced by xxxFreeWindow(), and xxxProcessEventMessage().

typedef struct tagPUBOBJ PUBOBJ
 

Referenced by AddPublicObject().

typedef struct tagUSERSTARTUPINFO * PUSERSTARTUPINFO
 

Referenced by xxxCreateThreadInfo().

typedef struct tagW32JOB * PW32JOB
 

Referenced by PrepareForLogoff().

typedef struct tagWin32AllocStats * PWin32AllocStats
 

typedef struct tagWOWPROCESSINFO * PWOWPROCESSINFO
 

Referenced by xxxRegisterUserHungAppHandlers().

typedef struct tagWOWTHREADINFO * PWOWTHREADINFO
 

typedef struct tagXSTATE * PXSTATE
 

Referenced by FindQMsg().

typedef struct tagQ Q
 

typedef struct tagQMSG QMSG
 

Referenced by xxxScanSysQueue().

typedef LRESULT(APIENTRY * SFNSCSENDMESSAGE)(PWND, UINT, WPARAM, LPARAM, ULONG_PTR, PROC, DWORD, PSMS)
 

Definition at line 4078 of file userk.h.

typedef struct tagSMS SMS
 

Referenced by InitSMSLookaside().

typedef struct tagSMWP SMWP
 

Referenced by AsyncWindowPos().

typedef struct tagSPB SPB
 

Referenced by CreateSpb().

typedef struct tagSVR_INSTANCE_INFO SVR_INSTANCE_INFO
 

Referenced by xxxCsDdeInitialize().

typedef struct tagSWITCHWND SWITCHWND
 

Referenced by LW_RegisterWindows().

typedef struct tagSwitchWndInfo SWITCHWNDINFO
 

Referenced by InitSwitchWndInfo().

typedef struct tagSYSCFGICO SYSCFGICO
 

typedef struct tagTDB TDB
 

Referenced by zzzInitTask().

typedef struct tagTERMINAL TERMINAL
 

typedef struct tagTHREADINFO THREADINFO
 

Referenced by SetGlobalCursorLevel().

typedef struct tagTIMER TIMER
 

Referenced by InternalSetTimer().

typedef struct tagTLBLOCK TLBLOCK
 

Referenced by xxxImmActivateThreadsLayout().

typedef struct tagTOOLTIP TOOLTIP
 

Referenced by ZeroTooltip().

typedef struct tagTOOLTIPWND TOOLTIPWND
 

Referenced by LW_RegisterWindows(), and ZeroTooltip().

typedef struct tagUSERSTARTUPINFO USERSTARTUPINFO
 

typedef struct tagW32JOB W32JOB
 

Referenced by CreateW32Job().

typedef struct tagWin32AllocStats Win32AllocStats
 

typedef struct tagWINDOWSTATION WINDOWSTATION
 

Referenced by Win32UserInitialize(), and xxxCreateWindowStation().

typedef struct tagWOWPROCESSINFO WOWPROCESSINFO
 

Referenced by DestroyProcessInfo(), and xxxRegisterUserHungAppHandlers().

typedef struct tagWOWTHREADINFO WOWTHREADINFO
 

Referenced by xxxUserNotifyProcessCreate().

typedef struct tagWPINFO WPINFO
 

typedef struct tagXSTATE XSTATE
 

Referenced by Createpxs().


Function Documentation

VOID _AssertCritIn VOID   ) 
 

VOID _AssertCritInShared VOID   ) 
 

VOID _AssertCritOut VOID   ) 
 

VOID _AssertDeviceInfoListCritIn VOID   ) 
 

VOID _AssertDeviceInfoListCritOut VOID   ) 
 

PSMWP _BeginDeferWindowPos int  cwndGuess  ) 
 

Definition at line 272 of file swp.c.

References AllocateCvr(), tagSMWP::bHandle, DBGCheskSMWP, HMAllocObject(), HMFreeObject(), NULL, PtiCurrent, TRUE, and TYPE_SETWINDOWPOS.

00273 { 00274 PSMWP psmwp; 00275 00276 psmwp = (PSMWP)HMAllocObject(PtiCurrent(), NULL, TYPE_SETWINDOWPOS, sizeof(SMWP)); 00277 if (psmwp == NULL) { 00278 return NULL; 00279 } 00280 00281 if (cwndHint == 0) { 00282 cwndHint = 8; 00283 } 00284 00285 if (!AllocateCvr(psmwp, cwndHint)) { 00286 HMFreeObject(psmwp); 00287 return NULL; 00288 } 00289 00290 psmwp->bHandle = TRUE; 00291 DBGCheskSMWP(psmwp); 00292 return psmwp; 00293 }

BOOL _BlockInput BOOL  fBlockIt  ) 
 

Definition at line 3498 of file ntinput.c.

References tagTHREADINFO::amdesk, tagWINDOWSTATION::dwWSF_Flags, FALSE, gptiBlockInput, grpdeskRitInput, NULL, PtiCurrent, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, RtlAreAllAccessesGranted(), tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, and WSF_NOIO.

Referenced by NtUserBlockInput().

03499 { 03500 PTHREADINFO ptiCurrent; 03501 03502 ptiCurrent = PtiCurrent(); 03503 03504 /* 03505 * The calling thread must be on the active desktop and have journal 03506 * playback access to that desktop if it wants to block input. 03507 * (Unblocking is less restricted) 03508 */ 03509 if (fBlockIt && 03510 (ptiCurrent->rpdesk != grpdeskRitInput || 03511 !RtlAreAllAccessesGranted(ptiCurrent->amdesk, DESKTOP_JOURNALPLAYBACK))) { 03512 03513 RIPNTERR0(STATUS_ACCESS_DENIED, RIP_WARNING, 03514 "BlockInput failed: Non active desktop or access denied"); 03515 return FALSE; 03516 } 03517 UserAssert(!(ptiCurrent->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)); 03518 03519 /* 03520 * If we are enabling input 03521 * * Is it disabled? No, then fail the call 03522 * * Is it disabled but we aren't the dude in control? Yes, then 03523 * fail the call. 03524 * If we are disabling input 03525 * * Is it enabled? No, then fail the call 03526 * * Set us up as the dude in control 03527 */ 03528 03529 if (fBlockIt) { 03530 /* 03531 * Is input blocked right now? 03532 */ 03533 if (gptiBlockInput != NULL) { 03534 return FALSE; 03535 } 03536 03537 /* 03538 * Is this thread exiting? If so, fail the call now. User's 03539 * cleanup code won't get a chance to whack this back if so. 03540 */ 03541 if (ptiCurrent->TIF_flags & TIF_INCLEANUP) { 03542 return FALSE; 03543 } 03544 03545 /* 03546 * Set blocking on. 03547 */ 03548 gptiBlockInput = ptiCurrent; 03549 } else { 03550 /* 03551 * Fail if input is not blocked, or blocked by another thread 03552 */ 03553 if (gptiBlockInput != ptiCurrent) { 03554 return FALSE; 03555 } 03556 03557 /* 03558 * This thread was blocking input, so now clear the block. 03559 */ 03560 gptiBlockInput = NULL; 03561 } 03562 03563 return TRUE; 03564 }

NTSTATUS _BuildNameList PWINDOWSTATION  pwinsta,
PNAMELIST  pNameList,
UINT  cbNameList,
PUINT  pcbNeeded
 

Definition at line 1264 of file winsta.c.

References AccessCheckObject(), tagNAMELIST::awchNames, tagNAMELIST::cb, tagNAMELIST::cNames, DesktopMapping, DWORD, FALSE, grpWinStaList, KernelMode, _OBJECT_HEADER_NAME_INFO::Name, NTSTATUS(), NULL, OBJECT_HEADER_TO_NAME_INFO, OBJECT_TO_OBJECT_HEADER, PBYTE, tagWINDOWSTATION::rpdeskList, Status, UINT, and WinStaMapping.

Referenced by NtUserBuildNameList().

01269 { 01270 PBYTE pobj; 01271 PWCHAR ccxpwchDest, ccxpwchMax; 01272 ACCESS_MASK amDesired; 01273 POBJECT_HEADER pHead; 01274 POBJECT_HEADER_NAME_INFO pNameInfo; 01275 DWORD iNext; 01276 NTSTATUS Status; 01277 CONST GENERIC_MAPPING *pGenericMapping; 01278 01279 /* 01280 * Note -- NameList is client-side, and so must be protected. 01281 */ 01282 01283 try { 01284 ccxpNameList->cNames = 0; 01285 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01286 return STATUS_ACCESS_VIOLATION; 01287 } 01288 01289 ccxpwchDest = ccxpNameList->awchNames; 01290 ccxpwchMax = (PWCHAR)((PBYTE)ccxpNameList + cbNameList - sizeof(WCHAR)); 01291 01292 /* 01293 * If we're enumerating windowstations, pwinsta is NULL. Otherwise, 01294 * we're enumerating desktops. 01295 */ 01296 if (pwinsta == NULL) { 01297 pobj = (PBYTE)grpWinStaList; 01298 amDesired = WINSTA_ENUMERATE; 01299 pGenericMapping = &WinStaMapping; 01300 iNext = FIELD_OFFSET(WINDOWSTATION, rpwinstaNext); 01301 } else { 01302 pobj = (PBYTE)pwinsta->rpdeskList; 01303 amDesired = DESKTOP_ENUMERATE; 01304 pGenericMapping = &DesktopMapping; 01305 iNext = FIELD_OFFSET(DESKTOP, rpdeskNext); 01306 } 01307 01308 Status = STATUS_SUCCESS; 01309 *pcbNeeded = 0; 01310 while (pobj != NULL) { 01311 01312 if (AccessCheckObject(pobj, amDesired, KernelMode, pGenericMapping)) { 01313 01314 /* 01315 * Find object name 01316 */ 01317 pHead = OBJECT_TO_OBJECT_HEADER(pobj); 01318 pNameInfo = OBJECT_HEADER_TO_NAME_INFO(pHead); 01319 01320 /* 01321 * If we run out of space, reset the buffer 01322 * and continue so we can compute the needed 01323 * space. 01324 */ 01325 if ((PWCHAR)((PBYTE)ccxpwchDest + pNameInfo->Name.Length + 01326 sizeof(WCHAR)) >= ccxpwchMax) { 01327 *pcbNeeded += (UINT)((PBYTE)ccxpwchDest - (PBYTE)ccxpNameList); 01328 ccxpwchDest = ccxpNameList->awchNames; 01329 Status = STATUS_BUFFER_TOO_SMALL; 01330 } 01331 01332 try { 01333 ccxpNameList->cNames++; 01334 01335 /* 01336 * Copy and terminate the string 01337 */ 01338 RtlCopyMemory(ccxpwchDest, pNameInfo->Name.Buffer, 01339 pNameInfo->Name.Length); 01340 (PBYTE)ccxpwchDest += pNameInfo->Name.Length; 01341 *ccxpwchDest++ = 0; 01342 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01343 return STATUS_ACCESS_VIOLATION; 01344 } 01345 } 01346 01347 pobj = *(PBYTE*)(pobj + iNext); 01348 } 01349 01350 /* 01351 * Put an empty string on the end. 01352 */ 01353 try { 01354 *ccxpwchDest++ = 0; 01355 01356 ccxpNameList->cb = (UINT)((PBYTE)ccxpwchDest - (PBYTE)ccxpNameList); 01357 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01358 return STATUS_ACCESS_VIOLATION; 01359 } 01360 01361 *pcbNeeded += (UINT)((PBYTE)ccxpwchDest - (PBYTE)ccxpNameList); 01362 01363 return Status; 01364 }

NTSTATUS _BuildPropList PWND  pwnd,
PROPSET  aPropSet[],
UINT  cPropMax,
PUINT  pcPropReturned
 

Definition at line 141 of file kernel/winprop.c.

References tagPROPLIST::aprop, _PROPSET::atom, tagPROP::atomKey, DWORD, tagPROP::fs, _PROPSET::hData, tagPROP::hData, tagPROPLIST::iFirstFree, NTSTATUS(), NULL, tagWND::ppropList, PROPF_INTERNAL, Status, and UINT.

Referenced by NtUserBuildPropList().

00146 { 00147 UINT i; 00148 PPROPLIST ppropList; 00149 PPROP pProp; 00150 DWORD iRetCnt = 0; // The number of Props returned 00151 DWORD iProp = 0; 00152 PPROPSET pPropSetLast = (aPropSet + cPropMax - 1); 00153 NTSTATUS Status; 00154 00155 /* 00156 * If the Window does not have a property list then we're done 00157 */ 00158 ppropList = pwnd->ppropList; 00159 if (ppropList == NULL) { 00160 *pcPropNeeded = 0; 00161 return STATUS_SUCCESS; 00162 } 00163 00164 /* 00165 * For each element in the property list enumerate it. 00166 * (only if it is not internal!) 00167 */ 00168 Status = STATUS_SUCCESS; 00169 pProp = ppropList->aprop; 00170 for (i = ppropList->iFirstFree; i > 0; i--) { 00171 00172 /* 00173 * if we run out of space in shared memory return 00174 * STATUS_BUFFER_TOO_SMALL 00175 */ 00176 if (&aPropSet[iProp] > pPropSetLast) { 00177 00178 /* 00179 * Reset to the beginning of the output 00180 * buffer so we can continue and compute 00181 * the needed space. 00182 */ 00183 iProp = 0; 00184 Status = STATUS_BUFFER_TOO_SMALL; 00185 } 00186 00187 if (!(pProp->fs & PROPF_INTERNAL)) { 00188 aPropSet[iProp].hData = pProp->hData; 00189 aPropSet[iProp].atom = pProp->atomKey; 00190 iProp++; 00191 iRetCnt++; 00192 } 00193 pProp++; 00194 } 00195 00196 /* 00197 * Return the number of PROPLISTs given back to the client 00198 */ 00199 00200 *pcPropNeeded = iRetCnt; 00201 00202 return Status; 00203 }

BOOL _CallMsgFilter LPMSG  lpMsg,
int  nCode
 

Definition at line 1210 of file hooks.c.

References BOOL, FALSE, IsHooked, PtiCurrent, TRUE, WHF_MSGFILTER, WHF_SYSMSGFILTER, and xxxCallHook().

Referenced by NtUserCallMsgFilter(), xxxMNLoop(), xxxMoveSize(), xxxOldNextWindow(), xxxSBTrackLoop(), and xxxSendMenuSelect().

01213 { 01214 PTHREADINFO pti; 01215 01216 pti = PtiCurrent(); 01217 01218 /* 01219 * First call WH_SYSMSGFILTER. If it returns non-zero, don't 01220 * bother calling WH_MSGFILTER, just return TRUE. Otherwise 01221 * return what WH_MSGFILTER gives us. 01222 */ 01223 if (IsHooked(pti, WHF_SYSMSGFILTER) && xxxCallHook(nCode, 0, (LPARAM)pmsg, 01224 WH_SYSMSGFILTER)) { 01225 return TRUE; 01226 } 01227 01228 if (IsHooked(pti, WHF_MSGFILTER)) { 01229 return (BOOL)xxxCallHook(nCode, 0, (LPARAM)pmsg, WH_MSGFILTER); 01230 } 01231 01232 return FALSE; 01233 }

DWORD _CheckMenuItem PMENU  pMenu,
UINT  wIDCheckItem,
UINT  wCheck
 

Definition at line 546 of file mnsys.c.

References DWORD, MenuItemState(), NULL, and UINT.

Referenced by NtUserCheckMenuItem().

00550 { 00551 return MenuItemState(pMenu, wIDCheckItem, wCheck, (UINT)MF_CHECKED, NULL); 00552 }

PWND _ChildWindowFromPointEx PWND  pwndParent,
POINT  pt,
UINT  i
 

Definition at line 47 of file winwhere.c.

References tagWND::hrgnClip, LayerHitTest(), NULL, PtInRect(), PWNDDESKTOP, tagWND::rcClient, tagWND::rcWindow, tagWND::spwndChild, tagWND::spwndNext, TestWF, WEFLAYERED, WEFTRANSPARENT, WFDISABLED, and WFVISIBLE.

Referenced by NtUserChildWindowFromPointEx(), and xxxQueryDropObject().

00051 { 00052 if (pwnd != PWNDDESKTOP(pwnd)) { 00053 #ifdef USE_MIRRORING 00054 if (TestWF(pwnd, WEFLAYOUTRTL)) { 00055 pt.x = pwnd->rcClient.right - pt.x; 00056 } else 00057 #endif 00058 { 00059 pt.x += pwnd->rcClient.left; 00060 } 00061 pt.y += pwnd->rcClient.top; 00062 } 00063 00064 // _ClientToScreen(pwndParent, (LPPOINT)&pt); 00065 00066 if (PtInRect(&pwnd->rcClient, pt)) { 00067 00068 PWND pwndChild; 00069 00070 if (pwnd->hrgnClip != NULL) { 00071 if (!GrePtInRegion(pwnd->hrgnClip, pt.x, pt.y)) 00072 return NULL; 00073 } 00074 00075 if (TestWF(pwnd, WEFLAYERED)) { 00076 if (!LayerHitTest(pwnd, pt)) 00077 return NULL; 00078 } 00079 00080 /* 00081 * Enumerate the children, skipping disabled and invisible ones 00082 * if so desired. Still doesn't work for WS_EX_TRANSPARENT windows. 00083 */ 00084 for (pwndChild = pwnd->spwndChild; 00085 pwndChild; 00086 pwndChild = pwndChild->spwndNext) { 00087 00088 /* 00089 * Skip windows as desired. 00090 */ 00091 if ((uFlags & CWP_SKIPINVISIBLE) && !TestWF(pwndChild, WFVISIBLE)) 00092 continue; 00093 00094 if ((uFlags & CWP_SKIPDISABLED) && TestWF(pwndChild, WFDISABLED)) 00095 continue; 00096 00097 if ((uFlags & CWP_SKIPTRANSPARENT) && TestWF(pwndChild, WEFTRANSPARENT)) 00098 continue; 00099 00100 if (PtInRect(&pwndChild->rcWindow, pt)) { 00101 00102 if (pwndChild->hrgnClip != NULL) { 00103 if (!GrePtInRegion(pwndChild->hrgnClip, pt.x, pt.y)) 00104 continue; 00105 } 00106 if (TestWF(pwndChild, WEFLAYERED)) { 00107 if (!LayerHitTest(pwndChild, pt)) 00108 continue; 00109 } 00110 return(pwndChild); 00111 } 00112 } 00113 00114 return pwnd; 00115 } 00116 00117 return NULL; 00118 }

BOOL _CloseWindowStation HWINSTA  hwinsta  ) 
 

Definition at line 1055 of file winsta.c.

References _GetProcessWindowStation(), BOOL, FALSE, and NT_SUCCESS.

Referenced by NtUserCloseWindowStation(), and NtUserResolveDesktop().

01057 { 01058 HWINSTA hwinstaCurrent; 01059 01060 _GetProcessWindowStation(&hwinstaCurrent); 01061 if (hwinsta != hwinstaCurrent) { 01062 return NT_SUCCESS(ZwClose(hwinsta)); 01063 } 01064 return FALSE; 01065 }

HBITMAP _ConvertBitmap HBITMAP  hBitmap  ) 
 

HANDLE _ConvertMemHandle LPBYTE  lpData,
int  cbData
 

Definition at line 88 of file ntuser/kernel/clipbrd.c.

References tagCLIPDATA::abData, tagCLIPDATA::cbData, CLIPDATA, FALSE, HMAllocObject(), HMFreeObject(), NULL, PCLIPDATA, PtoHq, and TYPE_CLIPDATA.

Referenced by MungeClipData(), NtUserConvertMemHandle(), xxxGetDummyDib(), and xxxGetDummyDibV5().

00091 { 00092 PCLIPDATA pClipData; 00093 00094 pClipData = HMAllocObject(NULL, 00095 NULL, 00096 TYPE_CLIPDATA, 00097 FIELD_OFFSET(CLIPDATA, abData) + cbData); 00098 00099 if (pClipData == NULL) 00100 return NULL; 00101 00102 pClipData->cbData = cbData; 00103 00104 try { 00105 RtlCopyMemory(&pClipData->abData, ccxlpData, cbData); 00106 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00107 HMFreeObject(pClipData); 00108 return NULL; 00109 } 00110 00111 return PtoHq(pClipData); 00112 }

HANDLE _CreateAcceleratorTable LPACCEL  ,
int 
 

Definition at line 217 of file mnaccel.c.

References tagACCELTABLE::accel, APIENTRY, tagACCELTABLE::cAccel, FALSE, FLASTKEY, HMAllocObject(), HMFreeObject(), LPACCELTABLE, NULL, PtiCurrent, and TYPE_ACCELTABLE.

Referenced by NtUserCreateAcceleratorTable().

00220 { 00221 LPACCELTABLE pat; 00222 int size; 00223 00224 size = cbAccel + sizeof(ACCELTABLE) - sizeof(ACCEL); 00225 00226 pat = (LPACCELTABLE)HMAllocObject(PtiCurrent(), NULL, TYPE_ACCELTABLE, size); 00227 if (pat == NULL) 00228 return NULL; 00229 00230 try { 00231 RtlCopyMemory(pat->accel, ccxpaccel, cbAccel); 00232 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00233 HMFreeObject(pat); 00234 return NULL; 00235 } 00236 00237 pat->cAccel = cbAccel / sizeof(ACCEL); 00238 pat->accel[pat->cAccel - 1].fVirt |= FLASTKEY; 00239 00240 return pat; 00241 }

PCURSOR _CreateCursor HANDLE  hModule,
int  iXhotspot,
int  iYhotspot,
int  iWidth,
int  iHeight,
LPBYTE  lpANDplane,
LPBYTE  lpXORplane
 

HCURSOR _CreateEmptyCursorObject BOOL  fPublic  ) 
 

Definition at line 26 of file loadbits.c.

References ACON, HMAllocObject(), max, NULL, PtiCurrent, PtoH, TIF_CSRSSTHREAD, TIF_SYSTEMTHREAD, and TYPE_CURSOR.

00028 { 00029 PCURSOR pcurT; 00030 00031 /* 00032 * Create the cursor object. 00033 */ 00034 pcurT = (PCURSOR)HMAllocObject(PtiCurrent(), 00035 NULL, 00036 TYPE_CURSOR, 00037 max(sizeof(CURSOR), 00038 sizeof(ACON))); 00039 00040 if (fPublic && (pcurT != NULL)) { 00041 pcurT->head.ppi = NULL; 00042 UserAssert(PtiCurrent()->TIF_flags & (TIF_CSRSSTHREAD | TIF_SYSTEMTHREAD)); 00043 } 00044 00045 return (HCURSOR)PtoH(pcurT); 00046 }

PICON _CreateIcon HANDLE  hModule,
int  iWidth,
int  iHeight,
BYTE  bPlanes,
BYTE  bBitsPixel,
LPBYTE  lpANDplane,
LPBYTE  lpXORplane
 

PICON _CreateIconIndirect PICONINFO  piconinfo  ) 
 

BOOL _DdeGetQualityOfService PWND  pwndClient,
PWND  pwndServer,
PSECURITY_QUALITY_OF_SERVICE  pqos
 

Definition at line 2218 of file kernel/ddetrack.c.

References _GetProp(), BOOL, FALSE, FindDdeConv(), GETPWNDPPI, gqosDefault, NULL, tagDDECONV::pddei, PROP_QOS, PROPF_INTERNAL, tagDDEIMP::qos, and TRUE.

Referenced by NtUserDdeGetQualityOfService().

02222 { 02223 PDDECONV pDdeConv; 02224 PSECURITY_QUALITY_OF_SERVICE pqosClient; 02225 02226 if (pwndServer == NULL) { 02227 /* 02228 * Special case to support DDEML-RAW conversations that need to get 02229 * the QOS prior to initiation completion. 02230 */ 02231 pqosClient = _GetProp(pwndClient, PROP_QOS, PROPF_INTERNAL); 02232 if (pqosClient == NULL) { 02233 *pqos = gqosDefault; 02234 } else { 02235 *pqos = *pqosClient; 02236 } 02237 return(TRUE); 02238 } 02239 if (GETPWNDPPI(pwndClient) == GETPWNDPPI(pwndServer)) { 02240 *pqos = gqosDefault; 02241 return(TRUE); 02242 } 02243 pDdeConv = FindDdeConv(pwndClient, pwndServer); 02244 if (pDdeConv == NULL) { 02245 return(FALSE); 02246 } 02247 if (pDdeConv->pddei == NULL) { 02248 return(FALSE); 02249 } 02250 *pqos = pDdeConv->pddei->qos; 02251 return(TRUE); 02252 }

BOOL _DdeSetQualityOfService PWND  pwndClient,
CONST PSECURITY_QUALITY_OF_SERVICE  pqosNew,
PSECURITY_QUALITY_OF_SERVICE  pqosOld
 

Definition at line 2176 of file kernel/ddetrack.c.

References BOOL, FALSE, gqosDefault, InternalRemoveProp(), InternalSetProp(), NULL, PROP_QOS, PROPF_INTERNAL, and TRUE.

Referenced by NtUserDdeSetQualityOfService().

02180 { 02181 PSECURITY_QUALITY_OF_SERVICE pqosUser; 02182 PSECURITY_QUALITY_OF_SERVICE pqosAlloc = NULL; 02183 BOOL fRet; 02184 02185 /* 02186 * ASSUME: calling process is owner of pwndClient - ensured in thunk. 02187 */ 02188 pqosUser = (PSECURITY_QUALITY_OF_SERVICE)InternalRemoveProp(pwndClient, 02189 PROP_QOS, PROPF_INTERNAL); 02190 if (pqosUser == NULL) { 02191 if (RtlEqualMemory(pqosNew, &gqosDefault, sizeof(SECURITY_QUALITY_OF_SERVICE))) { 02192 return(TRUE); // no PROP_QOS property implies default QOS 02193 } 02194 pqosAlloc = (PSECURITY_QUALITY_OF_SERVICE)UserAllocPoolZInit( 02195 sizeof(SECURITY_QUALITY_OF_SERVICE), TAG_DDE2); 02196 if (pqosAlloc == NULL) { 02197 return(FALSE); // memory allocation failure - can't change from default 02198 } 02199 pqosUser = pqosAlloc; 02200 } 02201 *pqosOld = *pqosUser; 02202 *pqosUser = *pqosNew; 02203 02204 fRet = InternalSetProp(pwndClient, PROP_QOS, pqosUser, PROPF_INTERNAL); 02205 if ((fRet == FALSE) && (pqosAlloc != NULL)) { 02206 UserFreePool(pqosAlloc); 02207 } 02208 02209 return fRet; 02210 }

PSMWP _DeferWindowPos PSMWP  psmwp,
PWND  pwnd,
PWND  pwndInsertAfter,
int  x,
int  y,
int  cx,
int  cy,
UINT  rgf
 

Definition at line 365 of file swp.c.

References tagSMWP::acvr, tagSMWP::ccvr, tagSMWP::ccvrAlloc, CVR, cy, DBGCheskSMWP, DestroySMWP(), DWORD, tagCVR::hrgnClip, tagCVR::hrgnInterMonitor, HWInsertAfter(), HWq, NULL, tagCVR::pos, ppos, TestWF, and WFBOTTOMMOST.

Referenced by AddSelfAndOwnees(), NtUserDeferWindowPos(), xxxArrangeIconicWindows(), xxxDesktopRecalc(), xxxMinMaximize(), xxxSetWindowPos(), and xxxSetWindowRgn().

00374 { 00375 PWINDOWPOS ppos; 00376 PCVR pcvr; 00377 00378 DBGCheskSMWP(psmwp); 00379 if (psmwp->ccvr + 1 > psmwp->ccvrAlloc) { 00380 00381 /* 00382 * Make space for 4 more windows 00383 */ 00384 DWORD dwNewAlloc = psmwp->ccvrAlloc + 4; 00385 00386 pcvr = (PCVR)UserReAllocPoolWithQuota(psmwp->acvr, 00387 psmwp->ccvrAlloc * sizeof(CVR), 00388 sizeof(CVR) * dwNewAlloc, 00389 TAG_SWP); 00390 00391 if (pcvr == NULL) { 00392 DestroySMWP(psmwp); 00393 return NULL; 00394 } 00395 00396 psmwp->acvr = pcvr; 00397 psmwp->ccvrAlloc = dwNewAlloc; 00398 } 00399 00400 pcvr = &psmwp->acvr[psmwp->ccvr++]; 00401 ppos = &pcvr->pos; 00402 00403 ppos->hwnd = HWq(pwnd); 00404 ppos->hwndInsertAfter = (TestWF(pwnd, WFBOTTOMMOST)) ? 00405 HWND_BOTTOM : HWInsertAfter(pwndInsertAfter); 00406 ppos->x = x; 00407 ppos->y = y; 00408 ppos->cx = cx; 00409 ppos->cy = cy; 00410 ppos->flags = flags; 00411 00412 pcvr->hrgnClip = NULL; 00413 pcvr->hrgnInterMonitor = NULL; 00414 00415 return psmwp; 00416 }

BOOL _DeregisterShellHookWindow PWND  pwnd  ) 
 

Definition at line 3655 of file rare.c.

References BOOL, ClrWF, FALSE, tagWND::head, NULL, tagDESKTOPINFO::pvwplShellHook, TRUE, VWPLRemove(), and WFSHELLHOOKWND.

Referenced by xxxFreeWindow().

03655 { 03656 PDESKTOPINFO pdeskinfo; 03657 03658 if (pwnd->head.rpdesk == NULL) 03659 return FALSE; 03660 03661 pdeskinfo = pwnd->head.rpdesk->pDeskInfo; 03662 03663 if (VWPLRemove(&(pdeskinfo->pvwplShellHook), pwnd)) { 03664 ClrWF(pwnd, WFSHELLHOOKWND); 03665 } 03666 return TRUE; 03667 }

BOOL _DestroyCursor PCURSOR  ,
DWORD 
 

Definition at line 539 of file loadbits.c.

References BOOL, CCACHEDCAPTIONS, CURSOR_ALWAYSDESTROY, CURSOR_CALLFROMCLIENT, CURSOR_THREADCLEANUP, CURSORF_ACON, CURSORF_FROMRESOURCE, CURSORF_LRSHARED, CURSORF_SECRET, DestroyAniIcon(), DestroyEmptyCursorObject(), FALSE, gcachedCaptions, GETPPI, HMMarkObjectDestroy(), NULL, pacon, PpiCurrent, tagCAPTIONCACHE::spcursor, TRUE, Unlock, and UserDeleteAtom().

Referenced by _SetCursorContents(), DestroyAniIcon(), DestroyClassSmIcon(), DestroyUnlockedCursor(), DestroyWindowSmIcon(), NtUserDestroyCursor(), xxxDWP_SetIcon(), and zzzSetSystemImage().

00542 { 00543 PPROCESSINFO ppi; 00544 PPROCESSINFO ppiCursor; 00545 int i; 00546 extern BOOL DestroyAniIcon(PACON pacon); 00547 00548 if (pcur == NULL) { 00549 UserAssert(FALSE); 00550 return(TRUE); 00551 } 00552 ppi = PpiCurrent(); 00553 ppiCursor = GETPPI(pcur); 00554 00555 /* 00556 * Remove this icon from the caption icon cache. 00557 */ 00558 for (i = 0; i < CCACHEDCAPTIONS; i++) { 00559 if (gcachedCaptions[i].spcursor == pcur) { 00560 Unlock( &(gcachedCaptions[i].spcursor) ); 00561 } 00562 } 00563 00564 /* 00565 * First step in destroying an cursor 00566 */ 00567 switch (cmdDestroy) { 00568 00569 case CURSOR_ALWAYSDESTROY: 00570 00571 /* 00572 * Always destroy? then don't do any checking... 00573 */ 00574 break; 00575 00576 case CURSOR_CALLFROMCLIENT: 00577 00578 /* 00579 * Can't destroy public cursors/icons. 00580 */ 00581 if (ppiCursor == NULL) 00582 /* 00583 * Fake success if its a resource loaded icon because 00584 * this is how win95 responded. 00585 */ 00586 return !!(pcur->CURSORF_flags & CURSORF_FROMRESOURCE); 00587 00588 /* 00589 * If this cursor was loaded from a resource, don't free it till the 00590 * process exits. This is the way we stay compatible with win3.0's 00591 * cursors which were actually resources. Resources under win3 have 00592 * reference counting and other "features" like handle values that 00593 * never change. Read more in the comment in 00594 * ServerLoadCreateCursorIcon(). 00595 */ 00596 if (pcur->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_SECRET)) { 00597 return TRUE; 00598 } 00599 00600 /* 00601 * One thread can't destroy the objects created by another. 00602 */ 00603 if (ppiCursor != ppi) { 00604 RIPERR0(ERROR_DESTROY_OBJECT_OF_OTHER_THREAD, RIP_ERROR, "DestroyCursor: cursor belongs to another process"); 00605 return FALSE; 00606 } 00607 00608 /* 00609 * fall through. 00610 */ 00611 00612 case CURSOR_THREADCLEANUP: 00613 00614 /* 00615 * Don't destroy public objects either (pretend it worked though). 00616 */ 00617 if (ppiCursor == NULL) 00618 return TRUE; 00619 break; 00620 } 00621 00622 /* 00623 * First mark the object for destruction. This tells the locking code that 00624 * we want to destroy this object when the lock count goes to 0. If this 00625 * returns FALSE, we can't destroy the object yet. 00626 */ 00627 if (!HMMarkObjectDestroy((PHEAD)pcur)) 00628 return FALSE; 00629 00630 if (pcur->strName.Length != 0) { 00631 UserFreePool((LPSTR)pcur->strName.Buffer); 00632 } 00633 00634 if (pcur->atomModName != 0) { 00635 UserDeleteAtom(pcur->atomModName); 00636 } 00637 00638 /* 00639 * If this is an ACON call its special routine to destroy it. 00640 */ 00641 if (pcur->CURSORF_flags & CURSORF_ACON) { 00642 DestroyAniIcon((PACON)pcur); 00643 } else { 00644 if (pcur->hbmMask != NULL) { 00645 GreDeleteObject(pcur->hbmMask); 00646 GreDecQuotaCount((PW32PROCESS)(pcur->head.ppi)); 00647 } 00648 if (pcur->hbmColor != NULL) { 00649 GreDeleteObject(pcur->hbmColor); 00650 GreDecQuotaCount((PW32PROCESS)(pcur->head.ppi)); 00651 } 00652 if (pcur->hbmAlpha != NULL) { 00653 /* 00654 * This is an internal GDI object, and so not covered by quota. 00655 */ 00656 GreDeleteObject(pcur->hbmAlpha); 00657 } 00658 } 00659 00660 /* 00661 * Ok to destroy... Free the handle (which will free the object and the 00662 * handle). 00663 */ 00664 DestroyEmptyCursorObject(pcur); 00665 return TRUE; 00666 }

BOOL _DestroyMenu PMENU  pMenu  ) 
 

Definition at line 27 of file mndstry.c.

References BOOL, tagMENU::cItems, DesktopFree, FALSE, tagMENU::head, HMFreeObject(), HMMarkObjectDestroy(), LockDesktop, MNFreeItem(), NULL, PtiCurrent, tagMENU::rgItems, tagMENU::spwndNotify, TRUE, Unlock, and UnlockDesktop.

Referenced by MNFreeItem(), NtUserDestroyMenu(), xxxDesktopThread(), xxxFreeWindow(), xxxGetSystemMenu(), xxxLoadSysDesktopMenu(), xxxSetLPITEMInfo(), xxxSetSystemMenu(), and xxxUpdatePerUserSystemParameters().

00029 { 00030 PITEM pItem; 00031 int i; 00032 PDESKTOP rpdeskLock; 00033 00034 if (pMenu == NULL) 00035 return FALSE; 00036 00037 /* 00038 * If the object is locked, just mark it for destroy and don't 00039 * free it yet. 00040 */ 00041 if (!HMMarkObjectDestroy(pMenu)) 00042 return TRUE; 00043 00044 /* 00045 * Go down the item list and free the items 00046 */ 00047 pItem = pMenu->rgItems; 00048 for (i = pMenu->cItems; i--; ++pItem) 00049 MNFreeItem(pMenu, pItem, TRUE); 00050 00051 /* 00052 * free the menu items 00053 */ 00054 if (pMenu->rgItems) 00055 DesktopFree(pMenu->head.rpdesk, pMenu->rgItems); 00056 00057 /* 00058 * Because menus are the only objects on the desktop owned 00059 * by the process and process cleanup is done after thread 00060 * cleanup, this may be the last reference to the desktop. 00061 * We must lock the desktop before unlocking 00062 * the parent desktop reference and freeing the menu to 00063 * ensure that the desktop will not be freed until after 00064 * the menu is freed. Don't use static locks because 00065 * the pti for this thread will not be valid during 00066 * process cleanup. 00067 */ 00068 rpdeskLock = NULL; 00069 LockDesktop(&rpdeskLock, pMenu->head.rpdesk, LDL_FN_DESTROYMENU, (ULONG_PTR)PtiCurrent()); 00070 00071 /* 00072 * Unlock all menu objects. 00073 */ 00074 Unlock(&pMenu->spwndNotify); 00075 00076 HMFreeObject(pMenu); 00077 00078 UnlockDesktop(&rpdeskLock, LDU_FN_DESTROYMENU, (ULONG_PTR)PtiCurrent()); 00079 00080 return TRUE; 00081 }

BOOL _DrawIconEx HDC  hdc,
int  x,
int  y,
PCURSOR  pcur,
int  cx,
int  cy,
UINT  istepIfAniCur,
HBRUSH  hbrush,
UINT  diFlags
 

Definition at line 93 of file wmicon.c.

References BltIcon(), BOOL, CURSORF_ACON, cy, FALSE, GetCHeight, GetCWidth, ghdcMem, NULL, and TRUE.

Referenced by DrawCaptionIcon(), NtUserDrawIconEx(), xxxPaintIconsInSwitchWindow(), and xxxRealDrawMenuItem().

00103 { 00104 BOOL fSuccess = FALSE; 00105 00106 /* 00107 * If this is an animated cursor, just grab the ith frame and use it 00108 * for drawing. 00109 */ 00110 if (pcur->CURSORF_flags & CURSORF_ACON) { 00111 00112 if ((int)istepIfAniCur >= ((PACON)pcur)->cicur) { 00113 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "DrawIconEx, icon step out of range."); 00114 goto Done; 00115 } 00116 00117 pcur = ((PACON)pcur)->aspcur[((PACON)pcur)->aicur[istepIfAniCur]]; 00118 } 00119 00120 /* 00121 * Setup defaults. 00122 */ 00123 cx = GetCWidth(cx, diFlags, pcur->cx); 00124 cy = GetCHeight(cy, diFlags, (pcur->cy / 2)); 00125 00126 if (hbr) { 00127 00128 HBITMAP hbmpT = NULL; 00129 HDC hdcT; 00130 HBITMAP hbmpOld; 00131 POLYPATBLT PolyData; 00132 00133 if (hdcT = GreCreateCompatibleDC(hdc)) { 00134 00135 if (hbmpT = GreCreateCompatibleBitmap(hdc, cx, cy)) { 00136 POINT pt; 00137 BOOL bRet; 00138 00139 hbmpOld = GreSelectBitmap(hdcT, hbmpT); 00140 00141 /* 00142 * Set new dc's brush origin in same relative 00143 * location as passed-in dc's. 00144 */ 00145 bRet = GreGetBrushOrg(hdc, &pt); 00146 /* 00147 * Bug 292396 - joejo 00148 * Stop overactive asserts by replacing with RIPMSG. 00149 */ 00150 if (bRet != TRUE) { 00151 RIPMSG0(RIP_WARNING, "DrawIconEx, GreGetBrushOrg failed."); 00152 } 00153 00154 bRet = GreSetBrushOrg(hdcT, pt.x, pt.y, NULL); 00155 if (bRet != TRUE) { 00156 RIPMSG0(RIP_WARNING, "DrawIconEx, GreSetBrushOrg failed."); 00157 } 00158 00159 PolyData.x = 0; 00160 PolyData.y = 0; 00161 PolyData.cx = cx; 00162 PolyData.cy = cy; 00163 PolyData.BrClr.hbr = hbr; 00164 00165 bRet = GrePolyPatBlt(hdcT, PATCOPY, &PolyData, 1, PPB_BRUSH); 00166 if (bRet != TRUE) { 00167 RIPMSG0(RIP_WARNING, "DrawIconEx, GrePolyPatBlt failed."); 00168 } 00169 00170 /* 00171 * Output the image to the temporary memoryDC. 00172 */ 00173 BltIcon(hdcT, 0, 0, cx, cy, ghdcMem, pcur, TRUE, SRCAND); 00174 BltIcon(hdcT, 0, 0, cx, cy, ghdcMem, pcur, FALSE, SRCINVERT); 00175 00176 /* 00177 * Blt the bitmap to the original DC. 00178 */ 00179 GreBitBlt(hdc, x, y, cx, cy, hdcT, 0, 0, SRCCOPY, (COLORREF)-1); 00180 00181 GreSelectBitmap(hdcT, hbmpOld); 00182 00183 bRet = GreDeleteObject(hbmpT); 00184 if (bRet != TRUE) { 00185 RIPMSG0(RIP_WARNING, "DrawIconEx, GreDeleteObject failed. Possible Leak"); 00186 } 00187 00188 fSuccess = TRUE; 00189 } 00190 00191 GreDeleteDC(hdcT); 00192 } 00193 00194 } else { 00195 00196 if (diFlags & DI_MASK) { 00197 00198 BltIcon(hdc, 00199 x, 00200 y, 00201 cx, 00202 cy, 00203 ghdcMem, 00204 pcur, 00205 TRUE, 00206 ((diFlags & DI_IMAGE) ? SRCAND : SRCCOPY)); 00207 } 00208 00209 if (diFlags & DI_IMAGE) { 00210 00211 BltIcon(hdc, 00212 x, 00213 y, 00214 cx, 00215 cy, 00216 ghdcMem, 00217 pcur, 00218 FALSE, 00219 ((diFlags & DI_MASK) ? SRCINVERT : SRCCOPY)); 00220 } 00221 00222 fSuccess = TRUE; 00223 } 00224 00225 Done: 00226 00227 return fSuccess; 00228 }

UINT _EnumClipboardFormats UINT  fmt  ) 
 

Definition at line 597 of file ntuser/kernel/clipbrd.c.

References CheckClipboardAccess(), tagWINDOWSTATION::cNumClipFormats, FindClipFormat(), tagCLIP::fmt, NULL, tagWINDOWSTATION::pClipBase, tagWINDOWSTATION::ptiClipLock, PtiCurrent, and UINT.

00599 { 00600 PWINDOWSTATION pwinsta; 00601 UINT fmtRet; 00602 00603 if ((pwinsta = CheckClipboardAccess()) == NULL) 00604 return 0; 00605 00606 /* 00607 * If the current thread doesn't have the clipboard open or if there 00608 * is no clipboard, return 0 for no formats. 00609 */ 00610 if (pwinsta->ptiClipLock != PtiCurrent()) { 00611 RIPERR0(ERROR_CLIPBOARD_NOT_OPEN, RIP_WARNING, "EnumClipboardFormat: clipboard not open"); 00612 return 0; 00613 } 00614 00615 fmtRet = 0; 00616 00617 if (pwinsta->pClipBase != NULL) { 00618 00619 PCLIP pClip; 00620 00621 /* 00622 * Find the next clipboard format. If the format is 0, start from 00623 * the beginning. 00624 */ 00625 if (fmt != 0) { 00626 00627 /* 00628 * Find the next clipboard format. NOTE that this routine locks 00629 * the clipboard handle and updates pwinsta->pClipBase with the 00630 * starting address of the clipboard. 00631 */ 00632 if ((pClip = FindClipFormat(pwinsta, fmt)) != NULL) 00633 pClip++; 00634 00635 } else { 00636 pClip = pwinsta->pClipBase; 00637 } 00638 00639 /* 00640 * Find the new format before unlocking the clipboard. 00641 */ 00642 if (pClip && (pClip < &pwinsta->pClipBase[pwinsta->cNumClipFormats])) { 00643 00644 fmtRet = pClip->fmt; 00645 } 00646 } 00647 00648 /* 00649 * Return the new clipboard format. 00650 */ 00651 return fmtRet; 00652 }

int _ExcludeUpdateRgn HDC  hdc,
PWND  pwnd
 

Definition at line 1462 of file update.c.

References CopyRgn, FALSE, ghrgnInv1, gpDispInfo, HRGN_FULL, tagDISPLAYINFO::hrgnScreen, tagWND::hrgnUpdate, NULL, and SubtractRgn.

Referenced by NtUserExcludeUpdateRgn(), and UT_InvertCaret().

01465 { 01466 POINT pt; 01467 01468 if (pwnd->hrgnUpdate == NULL) { 01469 01470 RECT rc; 01471 01472 /* 01473 * Pass FALSE for fXForm since &rc isn't used. 01474 */ 01475 return GreGetClipBox(hdc, &rc, FALSE); 01476 01477 } else if (pwnd->hrgnUpdate == HRGN_FULL) { 01478 01479 return GreIntersectClipRect(hdc, 0, 0, 0, 0); 01480 01481 } else { 01482 01483 /* 01484 * If no clip rgn exists, then subtract from a device-sized clip rgn. 01485 * (GetClipRgn returns clip rgn in screen coordinates). 01486 */ 01487 GreGetDCOrg(hdc, &pt); 01488 if (GreGetRandomRgn(hdc, ghrgnInv1, 1) != 1) { 01489 CopyRgn(ghrgnInv1, gpDispInfo->hrgnScreen); 01490 } else { 01491 01492 /* 01493 * Gets returned in dc coords - translate to screen. 01494 */ 01495 GreOffsetRgn(ghrgnInv1, pt.x, pt.y); 01496 } 01497 01498 SubtractRgn(ghrgnInv1, ghrgnInv1, pwnd->hrgnUpdate); 01499 01500 /* 01501 * Map to dc coords before select 01502 */ 01503 GreOffsetRgn(ghrgnInv1, -pt.x, -pt.y); 01504 01505 return GreExtSelectClipRgn(hdc, ghrgnInv1, RGN_COPY); 01506 } 01507 }

PCURSOR _FindExistingCursorIcon ATOM  atomModName,
PUNICODE_STRING  pstrResName,
PCURSOR  pcurSrc,
PCURSORFIND  pcfSearch
 

Definition at line 357 of file loadbits.c.

References gpcurFirst, NULL, PpiCurrent, tagCURSORFIND::rt, and SearchIconCache().

Referenced by NtUserFindExistingCursorIcon().

00362 { 00363 PCURSOR pcurT = NULL; 00364 00365 /* 00366 * If rt is zero we're doing an indirect create, so matching with 00367 * a previously loaded cursor/icon would be inappropriate. 00368 */ 00369 if (pcfSearch->rt && atomModName) { 00370 00371 pcurT = SearchIconCache(PpiCurrent()->pCursorCache, 00372 atomModName, 00373 cczpstrResName, 00374 pcurSrc, 00375 pcfSearch); 00376 if (pcurT == NULL) { 00377 pcurT = SearchIconCache(gpcurFirst, 00378 atomModName, 00379 cczpstrResName, 00380 pcurSrc, 00381 pcfSearch); 00382 } 00383 } 00384 00385 return pcurT; 00386 }

PWND _FindWindowEx PWND  pwndParent,
PWND  pwndChild,
LPCWSTR  pszClass,
LPCWSTR  pszName,
DWORD  dwType
 

Definition at line 524 of file kernel/winmgr.c.

References _GetDesktopWindow(), _GetMessageWindow(), tagCLS::atomClassName, BOOL, _LARGE_UNICODE_STRING::Buffer, BuildHwndList(), BWL_ENUMLIST, FALSE, FindClassAtom, FreeHwndList(), FW_16BIT, FW_32BIT, FW_BOTH, GETPTI, _LARGE_UNICODE_STRING::Length, NULL, tagWND::pcls, RevalidateHwnd, tagBWL::rghwnd, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndParent, tagWND::strName, szNull, TIF_16BIT, and TRUE.

Referenced by NtUserFindWindowEx().

00530 { 00531 /* 00532 * Note that the Class and Name pointers are client-side addresses. 00533 */ 00534 00535 PBWL pbwl; 00536 HWND *phwnd; 00537 PWND pwnd; 00538 WORD atomClass = 0; 00539 LPCWSTR lpName; 00540 BOOL fTryMessage = FALSE; 00541 00542 if (ccxlpszClass != NULL) { 00543 00544 atomClass = FindClassAtom(ccxlpszClass); 00545 00546 if (atomClass == 0) { 00547 return NULL; 00548 } 00549 } 00550 00551 /* 00552 * Setup parent window 00553 */ 00554 if (!pwndParent) { 00555 pwndParent = _GetDesktopWindow(); 00556 /* 00557 * If we are starting from the root and no child window 00558 * was specified, then check the message window tree too 00559 * in case we don't find it on the desktop tree. 00560 */ 00561 00562 if (!pwndChild) 00563 fTryMessage = TRUE; 00564 } 00565 00566 TryAgain: 00567 /* 00568 * Setup first child 00569 */ 00570 if (!pwndChild) { 00571 pwndChild = pwndParent->spwndChild; 00572 } else { 00573 if (pwndChild->spwndParent != pwndParent) { 00574 RIPMSG0(RIP_WARNING, 00575 "FindWindowEx: Child window doesn't have proper parent"); 00576 return NULL; 00577 } 00578 00579 pwndChild = pwndChild->spwndNext; 00580 } 00581 00582 /* 00583 * Generate a list of top level windows. 00584 */ 00585 if ((pbwl = BuildHwndList(pwndChild, BWL_ENUMLIST, NULL)) == NULL) { 00586 return NULL; 00587 } 00588 00589 /* 00590 * Set pwnd to NULL in case the window list is empty. 00591 */ 00592 pwnd = NULL; 00593 00594 try { 00595 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00596 00597 /* 00598 * Validate this hwnd since we left the critsec earlier (below 00599 * in the loop we send a message! 00600 */ 00601 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 00602 continue; 00603 00604 /* 00605 * make sure this window is of the right type 00606 */ 00607 if (dwType != FW_BOTH) { 00608 if (((dwType == FW_16BIT) && !(GETPTI(pwnd)->TIF_flags & TIF_16BIT)) || 00609 ((dwType == FW_32BIT) && (GETPTI(pwnd)->TIF_flags & TIF_16BIT))) 00610 continue; 00611 } 00612 00613 /* 00614 * If the class is specified and doesn't match, skip this window 00615 */ 00616 if (!atomClass || (atomClass == pwnd->pcls->atomClassName)) { 00617 if (!ccxlpszName) 00618 break; 00619 00620 if (pwnd->strName.Length) { 00621 lpName = pwnd->strName.Buffer; 00622 } else { 00623 lpName = szNull; 00624 } 00625 00626 /* 00627 * Is the text the same? If so, return with this window! 00628 */ 00629 if (_wcsicmp(ccxlpszName, lpName) == 0) 00630 break; 00631 } 00632 00633 /* 00634 * The window did not match. 00635 */ 00636 pwnd = NULL; 00637 } 00638 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00639 pwnd = NULL; 00640 } 00641 00642 FreeHwndList(pbwl); 00643 00644 if (!pwnd && fTryMessage) { 00645 fTryMessage = FALSE; 00646 pwndParent = _GetMessageWindow(); 00647 pwndChild = NULL; 00648 goto TryAgain; 00649 } 00650 00651 return ((*phwnd == (HWND)1) ? NULL : pwnd); 00652 }

BOOL _GetAltTabInfo int  iItem,
PALTTABINFO  pati,
LPWSTR  lpszItemText,
UINT  cchItemText,
BOOL  bAnsi
 

Definition at line 2635 of file tmswitch.c.

References _LARGE_UNICODE_STRING::Buffer, CXICONSLOT, CYICONSLOT, FALSE, Getpswi(), gspwndAltTab, tagSwitchWndInfo::iCurCol, tagSwitchWndInfo::iCurRow, tagSwitchWndInfo::iNoOfColumns, tagSwitchWndInfo::iNoOfRows, tagSwitchWndInfo::iTotalTasks, _LARGE_UNICODE_STRING::Length, NULL, NullTerminateString(), tagSwitchWndInfo::pbwl, tagSwitchWndInfo::ptFirstRowStart, RevalidateHwnd, tagBWL::rghwnd, RtlUnicodeToMultiByteN(), tagWND::strName, TextCopy(), and TRUE.

Referenced by NtUserGetAltTabInfo().

02641 { 02642 PSWINFO pswCurrent; 02643 02644 if (!gspwndAltTab || ((pswCurrent = Getpswi(gspwndAltTab)) == NULL)) { 02645 RIPERR0(ERROR_NOT_FOUND, RIP_WARNING, "no Alt-Tab window"); 02646 return FALSE; 02647 } 02648 02649 /* 02650 * Fill in general information 02651 */ 02652 pati->cItems = pswCurrent->iTotalTasks; 02653 pati->cColumns = pswCurrent->iNoOfColumns; 02654 pati->cRows = pswCurrent->iNoOfRows; 02655 02656 pati->iColFocus = pswCurrent->iCurCol; 02657 pati->iRowFocus = pswCurrent->iCurRow; 02658 02659 pati->cxItem = CXICONSLOT; 02660 pati->cyItem = CYICONSLOT; 02661 pati->ptStart = pswCurrent->ptFirstRowStart; 02662 02663 /* 02664 * Fill in specific information if asked. 02665 */ 02666 if (cchItemText && (iItem >= 0)) { 02667 PWND pwndCur; 02668 02669 pwndCur = NULL; 02670 02671 try { 02672 if ((iItem < pswCurrent->iTotalTasks) && 02673 (pwndCur = RevalidateHwnd(pswCurrent->pbwl->rghwnd[iItem]))) { 02674 if (bAnsi) { 02675 LPSTR ccxpszItemText = (LPSTR)ccxpwszItemText; 02676 ULONG cch; 02677 RtlUnicodeToMultiByteN(ccxpszItemText, cchItemText - 1, 02678 &cch, pwndCur->strName.Buffer, pwndCur->strName.Length); 02679 ccxpszItemText[cch] = '\0'; 02680 } else { 02681 TextCopy(&pwndCur->strName, ccxpwszItemText, cchItemText); 02682 } 02683 } else { 02684 // no such item 02685 NullTerminateString(ccxpwszItemText, bAnsi); 02686 } 02687 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 02688 return FALSE; 02689 } 02690 } 02691 02692 return TRUE; 02693 }

PWND _GetAncestor PWND  pwnd,
UINT  gaFlags
 

Definition at line 460 of file winable2.c.

References _GetParent(), NULL, PWNDDESKTOP, PWNDMESSAGE, and tagWND::spwndParent.

Referenced by NtUserGetAncestor().

00461 { 00462 PWND pwndParent; 00463 00464 /* 00465 * If we start with the desktop return NULL. 00466 */ 00467 if (pwnd == PWNDDESKTOP(pwnd)) 00468 return NULL; 00469 00470 switch (gaFlags) { 00471 case GA_PARENT: 00472 pwnd = pwnd->spwndParent; 00473 break; 00474 00475 case GA_ROOT: 00476 while ((pwnd->spwndParent != PWNDDESKTOP(pwnd)) && 00477 (pwnd->spwndParent != PWNDMESSAGE(pwnd))) { 00478 pwnd = pwnd->spwndParent; 00479 } 00480 break; 00481 00482 case GA_ROOTOWNER: 00483 while (pwndParent = _GetParent(pwnd)) { 00484 pwnd = pwndParent; 00485 } 00486 break; 00487 } 00488 00489 return pwnd; 00490 }

SHORT _GetAsyncKeyState int  vk  ) 
 

Definition at line 87 of file keyboard.c.

References ClearAsyncKeyStateRecentDown, CVKKEYSTATE, SHORT, TestAsyncKeyStateDown, TestAsyncKeyStateRecentDown, and UINT.

Referenced by NtUserGetAsyncKeyState(), xxxMNOpenHierarchy(), xxxNextWindow(), xxxPaintIconsInSwitchWindow(), xxxPaintSwitchWindow(), and xxxShowSwitchWindow().

00089 { 00090 SHORT sKeyState; 00091 00092 if ((UINT)vk >= CVKKEYSTATE) { 00093 RIPERR1(ERROR_INVALID_PARAMETER, 00094 RIP_WARNING, 00095 "Invalid parameter \"vk\" (%ld) to _GetAsyncKeyState", 00096 vk); 00097 00098 return 0; 00099 } 00100 00101 /* 00102 * See if this key went down since the last time state for it was 00103 * read. Clear the flag if so. 00104 */ 00105 sKeyState = 0; 00106 if (TestAsyncKeyStateRecentDown(vk)) { 00107 ClearAsyncKeyStateRecentDown(vk); 00108 sKeyState = 1; 00109 } 00110 00111 /* 00112 * Set the keyup/down bit. 00113 */ 00114 if (TestAsyncKeyStateDown(vk)) 00115 sKeyState |= 0x8000; 00116 00117 /* 00118 * Don't return the toggle bit since it's a new bit and might 00119 * cause compatibility problems. 00120 */ 00121 return sKeyState; 00122 }

DWORD _GetChangeBits VOID   ) 
 

ATOM _GetClassInfoEx HANDLE  hModule,
LPCWSTR  lpszClassName,
LPWNDCLASSEX  pwc,
LPWSTR *  ppszMenuName,
BOOL  bAnsi
 

Definition at line 678 of file class.c.

References tagCLS::atomClassName, CheckCritIn, CPD_ANSI_TO_UNICODE, CPD_CLASS, CPD_UNICODE_TO_ANSI, CSF_ANSIPROC, tagCLS::CSF_flags, CSF_SERVERSIDEPROC, CURSORF_SECRET, tagTHREADINFO::dwExpWinVer, DWORD, FindClassAtom, tagCLS::fnid, GetClassPtr(), GetCPD(), hModClient, hModuleWin, tagCLS::lpszClientAnsiMenuName, tagCLS::lpszClientUnicodeMenuName, MapClientNeuterToClientPfn(), MapServerToClientPfn(), NULL, tagTHREADINFO::ppi, PtiCurrent, PtoH, TIF_16BIT, tagTHREADINFO::TIF_flags, and VER40.

Referenced by NtUserGetClassInfo().

00684 { 00685 PCLS pcls; 00686 PPCLS ppcls; 00687 ATOM atomT; 00688 PTHREADINFO ptiCurrent; 00689 DWORD dwCPDType = 0; 00690 00691 CheckCritIn(); 00692 00693 ptiCurrent = PtiCurrent(); 00694 00695 /* 00696 * These are done first so if we don't find the class, and therefore 00697 * fail, the return thank won't try to copy back these (nonexistant) 00698 * strings. 00699 */ 00700 pwc->lpszMenuName = NULL; 00701 pwc->lpszClassName = NULL; 00702 00703 /* 00704 * Is this class registered as a private class? 00705 */ 00706 00707 /* 00708 * bradg (3/9/95) - Must first check to see if an ATOM has been passed. 00709 */ 00710 atomT = FindClassAtom(ccxlpszClassName); 00711 00712 /* 00713 * Windows 3.1 does not perform the class search with 00714 * a null hModule. If an application supplies a NULL 00715 * hModule, they search on hModuleWin instead. 00716 */ 00717 00718 if (hModule == NULL) 00719 hModule = hModClient; 00720 00721 ppcls = GetClassPtr(atomT, ptiCurrent->ppi, hModule); 00722 00723 00724 if (ppcls == NULL) { 00725 RIPERR0(ERROR_CLASS_DOES_NOT_EXIST, RIP_VERBOSE, "GetClassInfo: Class does not exist"); 00726 return 0; 00727 } 00728 00729 pcls = *ppcls; 00730 00731 /* 00732 * Copy all the fields common to CLS and WNDCLASS structures except 00733 * the lpszMenuName and lpszClassName which will be filled in by the 00734 * client-side piece of GetClassInfo. 00735 */ 00736 00737 /* 00738 * Return public bits only 00739 */ 00740 pwc->style = pcls->style & CS_VALID; 00741 00742 /* 00743 * Corel Depth 6.0 calls GetClassInfo (COMBOBOX) and registers a class 00744 * using the same name and style bits. This works OK on Win95 because 00745 * their "system" (combo, edit, etc) classes are not CS_GLOBALCLASS 00746 * So we got to mask this bit out for our classes 00747 */ 00748 00749 /* 00750 * Bug 17998. If the app is 32bit and WinVer is less than 4.0 don't mask 00751 * out the CS_GLOBALCLASS bit. 00752 */ 00753 00754 if ( (pcls->fnid != 0) && 00755 ((LOWORD(ptiCurrent->dwExpWinVer) >= VER40) || (ptiCurrent->TIF_flags & TIF_16BIT)) ) { 00756 pwc->style &= ~CS_GLOBALCLASS; 00757 } 00758 00759 00760 pwc->cbClsExtra = pcls->cbclsExtra; 00761 pwc->cbWndExtra = pcls->cbwndExtra; 00762 00763 /* 00764 * Stop 32-bit apps from inadvertantly using hModuleWin as their hInstance 00765 * when they register a window class. FritzS 00766 */ 00767 00768 if (LOWORD(ptiCurrent->dwExpWinVer) >= VER40) { 00769 /* 00770 * This is actually, Win95 behavior -- the USER.EXE hModule gets thunked to NULL on 00771 * the way out of the 16->32 bit thunk. Note -- if we ever need to support 16-bit 00772 * 4.0 apps (shudder), this may need to change. FritzS 00773 */ 00774 if (hModule == hModClient) { 00775 pwc->hInstance = NULL; 00776 } else { 00777 pwc->hInstance = hModule; 00778 } 00779 } else { 00780 /* 00781 * Win NT 3.1/3.51 returned the hInstance from the class. 00782 * Note that this is incompatible with Win 3.1. WoW has hacks for 16-bit apps. 00783 */ 00784 00785 if ((pcls->hModule == hModuleWin) || (pcls->hModule == hModClient)) { 00786 pwc->hInstance = hModClient; 00787 } else { 00788 pwc->hInstance = pcls->hModule; 00789 } 00790 } 00791 00792 pwc->hIcon = PtoH(pcls->spicn); 00793 pwc->hCursor = PtoH(pcls->spcur); 00794 pwc->hbrBackground = pcls->hbrBackground; 00795 00796 /* 00797 * Need to hide the small icon if it's USER created 00798 */ 00799 if (pcls->spicnSm && (pcls->spicnSm->CURSORF_flags & CURSORF_SECRET)) 00800 pwc->hIconSm = NULL; 00801 else 00802 pwc->hIconSm = PtoH(pcls->spicnSm); 00803 00804 /* 00805 * If its a server proc then map it to a client proc. If not we may have 00806 * to create a CPD. 00807 */ 00808 if (pcls->CSF_flags & CSF_SERVERSIDEPROC) { 00809 pwc->lpfnWndProc = 00810 (WNDPROC)MapServerToClientPfn((ULONG_PTR)pcls->lpfnWndProc, bAnsi); 00811 } else { 00812 pwc->lpfnWndProc = (WNDPROC)MapClientNeuterToClientPfn(pcls, 0, bAnsi); 00813 00814 /* 00815 * If the client mapping didn't change the window proc then see if 00816 * we need a callproc handle. 00817 */ 00818 if (pwc->lpfnWndProc == (WNDPROC)pcls->lpfnWndProc) { 00819 /* 00820 * Need to return a CallProc handle if there is an Ansi/Unicode mismatch 00821 */ 00822 if (bAnsi != !!(pcls->CSF_flags & CSF_ANSIPROC)) { 00823 dwCPDType |= bAnsi ? CPD_ANSI_TO_UNICODE : CPD_UNICODE_TO_ANSI; 00824 } 00825 } 00826 } 00827 00828 if (dwCPDType) { 00829 ULONG_PTR dwCPD; 00830 00831 dwCPD = GetCPD(pcls, dwCPDType | CPD_CLASS, (ULONG_PTR)pwc->lpfnWndProc); 00832 00833 if (dwCPD) { 00834 pwc->lpfnWndProc = (WNDPROC)dwCPD; 00835 } else { 00836 RIPMSG0(RIP_WARNING, "GetClassInfo unable to alloc CPD returning handle\n"); 00837 } 00838 } 00839 00840 /* 00841 * Return the stashed pointer to the client-side menu name string. 00842 */ 00843 if (bAnsi) { 00844 *ppszMenuName = (LPWSTR)pcls->lpszClientAnsiMenuName; 00845 } else { 00846 *ppszMenuName = pcls->lpszClientUnicodeMenuName; 00847 } 00848 return pcls->atomClassName; 00849 }

BOOL _GetComboBoxInfo PWND  pwnd,
PCOMBOBOXINFO  ptbi
 

Definition at line 778 of file winable2.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, BOOL, tagCBox::buttonrc, tagCBox::CBoxStyle, DATAALIGN, tagCBox::editrc, FALSE, tagCBox::fButtonPressed, FNID_COMBOBOX, FNID_COMBOLISTBOX, GETFNID, GETPTI, gpsi, HEAD, HW, HWCCX, ICLS_COMBOBOX, ICLS_COMBOLISTBOX, KeAttachProcess(), KeDetachProcess(), NULL, tagLBIV::pcbox, tagWND::pcls, PpiCurrent, ProbeForRead, tagCBox::spwnd, tagCBox::spwndEdit, tagCBox::spwndList, and TRUE.

Referenced by NtUserGetComboBoxInfo().

00779 { 00780 PCLS pcls; 00781 COMBOBOXINFO cbi = { 00782 sizeof cbi, 00783 }; 00784 BOOL fOtherProcess; 00785 BOOL bRetval = FALSE; 00786 WORD wWindowType = 0; 00787 00788 /* 00789 * Make sure it is a combobox or a dropdown 00790 */ 00791 pcls = pwnd->pcls; 00792 00793 00794 if ((GETFNID(pwnd) == FNID_COMBOBOX) || 00795 (pcls->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX])) { 00796 wWindowType = FNID_COMBOBOX; 00797 } else if ((GETFNID(pwnd) == FNID_COMBOLISTBOX) || 00798 (pcls->atomClassName == gpsi->atomSysClass[ICLS_COMBOLISTBOX])) { 00799 wWindowType = FNID_COMBOLISTBOX; 00800 } else { 00801 RIPERR1(ERROR_WINDOW_NOT_COMBOBOX, RIP_WARNING, 00802 "pwnd %#p not a combobox or dropdown", pwnd); 00803 return FALSE; 00804 } 00805 00806 /* 00807 * Validate combo structure 00808 */ 00809 if (pcbi->cbSize != sizeof(COMBOBOXINFO)) { 00810 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "COMBOBOXINFO.cbSize %d is wrong", pcbi->cbSize); 00811 return FALSE; 00812 } 00813 00814 if (fOtherProcess = (GETPTI(pwnd)->ppi != PpiCurrent())) { 00815 KeAttachProcess(&GETPTI(pwnd)->ppi->Process->Pcb); 00816 } 00817 00818 try { 00819 PCBOX ccxPcboxSnap; 00820 PWND ccxPwndSnap; 00821 HWND ccxHwndSnap; 00822 00823 /* 00824 * Snap and probe the CBOX structure, since it is client side. 00825 */ 00826 if (wWindowType == FNID_COMBOBOX) { 00827 ccxPcboxSnap = ((PCOMBOWND)pwnd)->pcbox; 00828 } else { 00829 PLBIV ccxPlbSnap; 00830 /* 00831 * If this is a listbox, we must snap and probe the LBIV structure 00832 * in order to get to the CBOX structure. 00833 */ 00834 ccxPlbSnap = ((PLBWND)pwnd)->pLBIV; 00835 if (!ccxPlbSnap) { 00836 goto errorexit; 00837 } 00838 ProbeForRead(ccxPlbSnap, sizeof(LBIV), DATAALIGN); 00839 ccxPcboxSnap = ccxPlbSnap->pcbox; 00840 } 00841 if (!ccxPcboxSnap) { 00842 goto errorexit; 00843 } 00844 ProbeForRead(ccxPcboxSnap, sizeof(CBOX), DATAALIGN); 00845 00846 /* 00847 * Get the combo information now 00848 */ 00849 00850 /* 00851 * Snap and probe the client side pointer to the Combo window 00852 */ 00853 ccxPwndSnap = ccxPcboxSnap->spwnd; 00854 ProbeForRead(ccxPwndSnap, sizeof(HEAD), DATAALIGN); 00855 cbi.hwndCombo = HWCCX(ccxPwndSnap); 00856 00857 /* 00858 * Snap & probe the client side pointer to the Edit window. 00859 * To compare spwndEdit and pwnd, we should compare handles 00860 * since spwndEdit is a client-side address and pwnd is a 00861 * kernel-mode address, 00862 */ 00863 00864 ccxPwndSnap = ccxPcboxSnap->spwndEdit; 00865 /* 00866 * If combobox is not fully initialized and spwndEdit is NULL, 00867 * we should fail. 00868 */ 00869 ProbeForRead(ccxPwndSnap, sizeof(HEAD), DATAALIGN); 00870 ccxHwndSnap = HWCCX(ccxPwndSnap); 00871 if (ccxHwndSnap == HW(pwnd)) { 00872 /* 00873 * ComboBox doesn't have Edit control. 00874 */ 00875 cbi.hwndItem = NULL; 00876 } else { 00877 cbi.hwndItem = HWCCX(ccxPwndSnap); 00878 } 00879 00880 /* 00881 * Snap and probe the client side pointer to the List window 00882 */ 00883 ccxPwndSnap = ccxPcboxSnap->spwndList; 00884 /* 00885 * If combobox is not fully initialized and spwndList is NULL, 00886 * we should fail. 00887 */ 00888 ProbeForRead(ccxPwndSnap, sizeof(HEAD), DATAALIGN); 00889 cbi.hwndList = HWCCX(ccxPwndSnap); 00890 00891 /* 00892 * Snap the rest of the combo information. 00893 * We don't need to probe any of these, since there are no more indirections. 00894 */ 00895 cbi.rcItem = ccxPcboxSnap->editrc; 00896 cbi.rcButton = ccxPcboxSnap->buttonrc; 00897 00898 /* 00899 * Button state 00900 */ 00901 cbi.stateButton = 0; 00902 if (ccxPcboxSnap->CBoxStyle == CBS_SIMPLE) { 00903 cbi.stateButton |= STATE_SYSTEM_INVISIBLE; 00904 } 00905 if (ccxPcboxSnap->fButtonPressed) { 00906 cbi.stateButton |= STATE_SYSTEM_PRESSED; 00907 } 00908 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00909 goto errorexit; 00910 } 00911 00912 *pcbi = cbi; 00913 bRetval = TRUE; 00914 00915 errorexit: 00916 if (fOtherProcess) { 00917 KeDetachProcess(); 00918 } 00919 return bRetval; 00920 }

PCURSOR _GetCursorFrameInfo PCURSOR  pcur,
int  iFrame,
PJIF  pjifRate,
LPINT  pccur
 

Definition at line 183 of file kernel/acons.c.

References CURSORF_ACON, NULL, and pacon.

Referenced by NtUserGetCursorFrameInfo().

00188 { 00189 /* 00190 * If this is only a single cursor (not an ACON) just return it and 00191 * a frame count of 1. 00192 */ 00193 if (!(pcur->CURSORF_flags & CURSORF_ACON)) { 00194 *pccur = 1; 00195 *pjifRate = 0; 00196 return pcur; 00197 } 00198 00199 /* 00200 * Return the useful cursor information for the specified frame 00201 * of the ACON. 00202 */ 00203 #define pacon ((PACON)pcur) 00204 if (iFrame < 0 || iFrame >= pacon->cicur) 00205 return NULL; 00206 00207 *pccur = pacon->cicur; 00208 *pjifRate = pacon->ajifRate[iFrame]; 00209 00210 return pacon->aspcur[pacon->aicur[iFrame]]; 00211 #undef pacon 00212 }

BOOL _GetCursorPos LPPOINT   ) 
 

HDC _GetDC PWND  pwnd  ) 
 

Definition at line 148 of file dc.c.

References _GetDCEx(), NULL, tagDESKTOP::pDeskInfo, PtiCurrent, and tagDESKTOPINFO::spwnd.

Referenced by NtUserGetDC(), UT_InvertCaret(), xxxDesktopWndProc(), xxxMNInvertItem(), and xxxRealizeDesktop().

00150 { 00151 /* 00152 * Special case for NULL: For backward compatibility we want to return 00153 * a window DC for the desktop that does not exclude its children. 00154 */ 00155 if (pwnd == NULL) { 00156 00157 PDESKTOP pdesk = PtiCurrent()->rpdesk; 00158 00159 if (pdesk) { 00160 return _GetDCEx(pdesk->pDeskInfo->spwnd, 00161 NULL, 00162 DCX_WINDOW | DCX_CACHE); 00163 } 00164 00165 /* 00166 * The thread has no desktop. Fail the call. 00167 */ 00168 return NULL; 00169 } 00170 00171 return _GetDCEx(pwnd, NULL, DCX_USESTYLE); 00172 }

HDC _GetDCEx PWND  pwnd,
HRGN  hrgnClip,
DWORD  flags
 

Definition at line 608 of file dc.c.

References _GetProp(), BOOL, CalcVisRgn(), CFCLASSDC, CFOWNDC, CFPARENTDC, CopyRgn, CreateCacheDC(), CreateEmptyRgn(), CreateEmptyRgnPublic(), tagDCE::DCX_flags, DecrementFreeDCECount(), DelayedDestroyCacheDC(), DeleteHrgnClip(), DWORD, FALSE, GetLayeredWindow(), GETPTI, ghrgnGDC, gpDispInfo, tagDCE::hdc, tagDISPLAYINFO::hDev, HRGN_FULL, HRGN_SPECIAL_LAST, tagDCE::hrgnClip, tagDCE::hrgnClipPublic, IntersectRgn, IsVisible(), NULL, tagWND::pcls, tagCLS::pdce, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDCE::pMonitor, PpiCurrent, PROP_LAYER, PtiCurrent, tagDCE::ptiOwner, tagDCE::pwndClip, tagDCE::pwndOrg, tagWND::rcWindow, ResetOrg(), SetEmptyRgn(), SpbCheckDce(), tagWND::spwndParent, SubtractRgn, TestCF, TestWF, TRUE, UpdateLayeredSprite(), WFCLIPCHILDREN, WFCLIPSIBLINGS, WFMINIMIZED, WFVISIBLE, and WFWIN31COMPAT.

Referenced by _GetDC(), _GetWindowDC(), _UserSoundSentryWorker(), DrawSwitchWndHilite(), GetTooltipDC(), MNDrawArrow(), MNDrawFullNC(), NtUserGetDCEx(), StopFade(), UserGetDesktopDC(), xxxBeginPaint(), xxxDefWindowProc(), xxxDrawAnimatedRects(), xxxDrawDragRect(), xxxDrawMenuBarUnderlines(), xxxDWP_DoNCActivate(), xxxHotTrackMenu(), xxxMenuWindowProc(), xxxMNCompute(), xxxMoveSwitchWndHilite(), xxxPaintIconsInSwitchWindow(), xxxPaintSwitchWindow(), xxxRedrawHungWindow(), xxxRedrawHungWindowFrame(), xxxScrollWindowEx(), xxxSendEraseBkgnd(), and xxxTrackCaptionButton().

00612 { 00613 HRGN hrgn; 00614 HDC hdcMatch; 00615 PWND pwndClip; 00616 PWND pwndOrg; 00617 PDCE pdce; 00618 PDCE *ppdce; 00619 PDCE *ppdceNotInUse; 00620 DWORD DCX_flagsMatch; 00621 BOOL bpwndOrgVisible; 00622 PWND pwndLayer; 00623 HBITMAP hbmLayer; 00624 BOOL fVisRgnError = FALSE; 00625 00626 /* 00627 * Lock the device while we're playing with visrgns. 00628 */ 00629 GreLockDisplay(gpDispInfo->hDev); 00630 00631 if (pwnd == NULL) 00632 pwnd = PtiCurrent()->rpdesk->pDeskInfo->spwnd; 00633 00634 hdcMatch = NULL; 00635 pwndOrg = pwndClip = pwnd; 00636 00637 bpwndOrgVisible = IsVisible(pwndOrg); 00638 00639 if (PpiCurrent()->W32PF_Flags & W32PF_OWNDCCLEANUP) { 00640 DelayedDestroyCacheDC(); 00641 } 00642 00643 /* 00644 * If necessary, compute DCX flags from window style. 00645 */ 00646 if (DCX_flags & DCX_USESTYLE) { 00647 00648 DCX_flags &= ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_PARENTCLIP); 00649 00650 if (!(DCX_flags & DCX_WINDOW)) { 00651 00652 if (TestCF(pwndOrg, CFPARENTDC)) 00653 DCX_flags |= DCX_PARENTCLIP; 00654 00655 /* 00656 * If the DCX_CACHE flag is present, override OWNDC/CLASSDC. 00657 * Otherwise, calculate from appropriate style bits. 00658 */ 00659 if (!(DCX_flags & DCX_CACHE) && !TestCF(pwndOrg, CFOWNDC)) { 00660 if (TestCF(pwndOrg, CFCLASSDC)) { 00661 /* 00662 * Look for a non-cache entry that matches hdc... 00663 */ 00664 if (pwndOrg->pcls->pdce != NULL) { 00665 hdcMatch = pwndOrg->pcls->pdce->hdc; 00666 } 00667 } else { 00668 DCX_flags |= DCX_CACHE; 00669 } 00670 } 00671 00672 if (TestWF(pwndOrg, WFCLIPCHILDREN)) 00673 DCX_flags |= DCX_CLIPCHILDREN; 00674 00675 if (TestWF(pwndOrg, WFCLIPSIBLINGS)) 00676 DCX_flags |= DCX_CLIPSIBLINGS; 00677 00678 /* 00679 * Minimized windows never exclude their children. 00680 */ 00681 if (TestWF(pwndOrg, WFMINIMIZED)) { 00682 DCX_flags &= ~DCX_CLIPCHILDREN; 00683 00684 if (pwndOrg->pcls->spicn) 00685 DCX_flags |= DCX_CACHE; 00686 } 00687 00688 } else { 00689 if (TestWF(pwndClip, WFCLIPSIBLINGS)) 00690 DCX_flags |= DCX_CLIPSIBLINGS; 00691 00692 DCX_flags |= DCX_CACHE; 00693 00694 /* 00695 * Window DCs never exclude children. 00696 */ 00697 } 00698 } 00699 00700 /* 00701 * Deal with all the Win 3.0-compatible clipping rules: 00702 * 00703 * DCX_NOCLIPCHILDREN overrides: 00704 * DCX_PARENTCLIP/CS_OWNDC/CS_CLASSDC 00705 * DCX_PARENTCLIP overrides: 00706 * DCX_CLIPSIBLINGS/DCX_CLIPCHILDREN/CS_OWNDC/CS_CLASSDC 00707 */ 00708 if (DCX_flags & DCX_NOCLIPCHILDREN) { 00709 DCX_flags &= ~(DCX_PARENTCLIP | DCX_CLIPCHILDREN); 00710 DCX_flags |= DCX_CACHE; 00711 } 00712 00713 /* 00714 * Deal with layered windows. 00715 */ 00716 if ((pwndLayer = GetLayeredWindow(pwndOrg)) != NULL && 00717 (hbmLayer = _GetProp(pwndLayer, PROP_LAYER, TRUE)) != NULL) { 00718 00719 /* 00720 * Get a layered redirection DC. 00721 */ 00722 DCX_flags |= DCX_LAYERED; 00723 00724 /* 00725 * When the window we're getting the DC for is the layered and 00726 * redirected window, don't allow to clip to its parent, since 00727 * clipping must not exceed the size of the backing bitmap. 00728 */ 00729 if (pwndOrg == pwndLayer) { 00730 DCX_flags &= ~DCX_PARENTCLIP; 00731 } 00732 00733 /* 00734 * Convert hrgnClip from screen to the redirection DC coordinates. 00735 */ 00736 if (hrgnClip > HRGN_SPECIAL_LAST) { 00737 GreOffsetRgn(hrgnClip, -pwndLayer->rcWindow.left, 00738 -pwndLayer->rcWindow.top); 00739 } 00740 } else { 00741 pwndLayer = NULL; 00742 hbmLayer = NULL; 00743 } 00744 00745 if (DCX_flags & DCX_PARENTCLIP) { 00746 00747 PWND pwndParent; 00748 00749 /* 00750 * If this window has no parent. This can occur if the app is 00751 * calling GetDC in response to a CBT_CREATEWND callback. In this 00752 * case, the parent is not yet setup. 00753 */ 00754 if (pwndOrg->spwndParent == NULL) 00755 pwndParent = PtiCurrent()->rpdesk->pDeskInfo->spwnd; 00756 else 00757 pwndParent = pwndOrg->spwndParent; 00758 00759 /* 00760 * Always get the DC from the cache. 00761 */ 00762 DCX_flags |= DCX_CACHE; 00763 00764 /* 00765 * We can't use a shared DC if the visibility of the 00766 * child does not match the parent's, or if a 00767 * CLIPSIBLINGS or CLIPCHILDREN DC is requested. 00768 * 00769 * In 3.1, we pay attention to the CLIPSIBLINGS and CLIPCHILDREN 00770 * bits of CS_PARENTDC windows, by overriding CS_PARENTDC if 00771 * either of these flags are requested. 00772 * 00773 * BACKWARD COMPATIBILITY HACK 00774 * 00775 * If parent is CLIPCHILDREN, get a cache DC, but don't 00776 * use parent's DC. Windows PowerPoint depends on this 00777 * behavior in order to draw the little gray rect between 00778 * its scroll bars correctly. 00779 */ 00780 if (!(DCX_flags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN)) && 00781 (TestWF(pwndOrg, WFWIN31COMPAT) || !TestWF(pwndParent, WFCLIPCHILDREN)) && 00782 TestWF(pwndParent, WFVISIBLE) == TestWF(pwndOrg, WFVISIBLE)) { 00783 00784 pwndClip = pwndParent; 00785 00786 #if DBG 00787 if (DCX_flags & DCX_CLIPCHILDREN) 00788 RIPMSG0(RIP_WARNING, "WS_CLIPCHILDREN overridden by CS_PARENTDC"); 00789 if (DCX_flags & DCX_CLIPSIBLINGS) 00790 RIPMSG0(RIP_WARNING, "WS_CLIPSIBLINGS overridden by CS_PARENTDC"); 00791 #endif 00792 /* 00793 * Make sure flags reflect hwndClip rather than hwndOrg. 00794 * But, we must never clip the children (since that's who 00795 * wants to do the drawing!) 00796 */ 00797 DCX_flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS); 00798 if (TestWF(pwndClip, WFCLIPSIBLINGS)) 00799 DCX_flags |= DCX_CLIPSIBLINGS; 00800 } 00801 } 00802 00803 /* 00804 * Make sure we don't return an OWNDC if the calling thread didn't 00805 * create this window - need to returned cached always in this case. 00806 * 00807 * Win95 does not contain this code. Why? 00808 */ 00809 if (!(DCX_flags & DCX_CACHE)) { 00810 if (pwndOrg == NULL || GETPTI(pwndOrg) != PtiCurrent()) 00811 DCX_flags |= DCX_CACHE; 00812 } 00813 00814 DCX_flagsMatch = DCX_flags & DCX_MATCHMASK; 00815 00816 if (!(DCX_flags & DCX_CACHE)) { 00817 00818 /* 00819 * Handle CS_OWNDC and CS_CLASSDC cases specially. Based on the 00820 * supplied match information, we need to find the appropriate DCE. 00821 */ 00822 for (ppdce = &gpDispInfo->pdceFirst; (pdce = *ppdce); ppdce = &pdce->pdceNext) { 00823 00824 if (pdce->DCX_flags & DCX_CACHE) 00825 continue; 00826 00827 /* 00828 * Look for the entry that matches hdcMatch or pwndOrg... 00829 */ 00830 if (!(pdce->pwndOrg == pwndOrg || pdce->hdc == hdcMatch)) 00831 continue; 00832 00833 /* 00834 * NOTE: The "Multiple-BeginPaint()-of-OWNDC-Window" Conundrum 00835 * 00836 * There is a situation having to do with OWNDC or CLASSDC window 00837 * DCs that can theoretically arise that is handled specially 00838 * here and in ReleaseCacheDC(). These DCs are identified with 00839 * the DCX_CACHE bit CLEAR. 00840 * 00841 * In the case where BeginPaint() (or a similar operation) is 00842 * called more than once without an intervening EndPaint(), the 00843 * DCX_INTERSECTRGN (or DCX_EXCLUDERGN) bit may already be set 00844 * when we get here. 00845 * 00846 * Theoretically, the correct thing to do is to save the current 00847 * hrgnClip, and set up the new one here. In ReleaseCacheDC, the 00848 * saved hrgnClip is restored and the visrgn recomputed. 00849 * 00850 * All of this is only necessary if BOTH calls involve an 00851 * hrgnClip that causes the visrgn to be changed (i.e., the 00852 * simple hrgnClip test clears the INTERSECTRGN or EXCLUDERGN bit 00853 * fails), which is not at all likely. 00854 * 00855 * When this code encounters this multiple-BeginPaint case it 00856 * punts by honoring the new EXCLUDE/INTERSECTRGN bits, but it 00857 * first restores the DC to a wide-open visrgn before doing so. 00858 * This means that the first EndPaint() will restore the visrgn 00859 * to a wide-open DC, rather than clipped to the first 00860 * BeginPaint()'s update rgn. This is a good punt, because worst 00861 * case an app does a bit more drawing than it should. 00862 */ 00863 if ((pdce->DCX_flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && 00864 (DCX_flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))) { 00865 00866 RIPMSG0(RIP_WARNING, "Nested BeginPaint() calls, please fix Your app!"); 00867 DeleteHrgnClip(pdce); 00868 } 00869 00870 if (pdce->DCX_flags & DCX_LAYERED) { 00871 /* 00872 * We're giving out the same DC again. Since it may not have 00873 * been released, transfer any accumulated bits if needed. 00874 */ 00875 UpdateLayeredSprite(pdce); 00876 00877 /* 00878 * As this point, the DC may get converted back to a screen 00879 * DC, so we must select the screen surface back into the DC. 00880 */ 00881 UserVerify(GreSelectRedirectionBitmap(pdce->hdc, NULL)); 00882 } 00883 00884 /* 00885 * If we matched exactly, no recomputation necessary 00886 * (we found a CS_OWNDC or a CS_CLASSDC that is already set up) 00887 * Otherwise, we have a CS_CLASSDC that needs recomputation. 00888 */ 00889 if ( pdce->pwndOrg == pwndOrg && 00890 bpwndOrgVisible && 00891 (pdce->DCX_flags & DCX_LAYERED) == (DCX_flags & DCX_LAYERED) && 00892 !(pdce->DCX_flags & DCX_PWNDORGINVISIBLE)) { 00893 00894 goto HaveComputedEntry; 00895 } 00896 00897 goto RecomputeEntry; 00898 } 00899 00900 RIPMSG1(RIP_WARNING, "Couldn't find DC for %p - bad code path", pwndOrg); 00901 00902 NullExit: 00903 00904 GreUnlockDisplay(gpDispInfo->hDev); 00905 return NULL; 00906 00907 } else { 00908 00909 /* 00910 * Make a quick pass through the cache, looking for an 00911 * exact match. 00912 */ 00913 SearchAgain: 00914 00915 #if DBG 00916 if (fDisableCache) 00917 goto SearchFailed; 00918 #endif 00919 00920 /* 00921 * CONSIDER (adams): Put this check into the loop above so we don't 00922 * touch all these pages twice? 00923 */ 00924 for (ppdce = &gpDispInfo->pdceFirst; (pdce = *ppdce); ppdce = &pdce->pdceNext) { 00925 00926 /* 00927 * If we find an entry that is not in use and whose clip flags 00928 * and clip window match, we can use it. 00929 * 00930 * NOTE: DCX_INTERSECT/EXCLUDERGN cache entries always have 00931 * DCX_INUSE set, so we'll never erroneously match one here. 00932 */ 00933 UserAssert(!(pdce->DCX_flags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)) || 00934 (pdce->DCX_flags & DCX_INUSE)); 00935 00936 if ((pdce->pwndClip == pwndClip) && 00937 pdce->pMonitor == NULL && 00938 (DCX_flagsMatch == (pdce->DCX_flags & (DCX_MATCHMASK | DCX_INUSE | DCX_INVALID)))) { 00939 00940 /* 00941 * Special case for icon - bug 9103 (win31) 00942 */ 00943 if (TestWF(pwndClip, WFMINIMIZED) && 00944 (pdce->pwndOrg != pdce->pwndClip)) { 00945 continue; 00946 } 00947 00948 /* 00949 * If the pwndOrg of the DC we found is not visible and 00950 * the pwndOrg we're looking for is visble, then 00951 * the visrgn is no good, we can't reuse it so keep 00952 * looking. 00953 */ 00954 if (bpwndOrgVisible && pdce->DCX_flags & DCX_PWNDORGINVISIBLE) { 00955 continue; 00956 } 00957 00958 /* 00959 * Set INUSE before performing any GDI operations, just 00960 * in case DCHook() has a mind to recalculate the visrgn... 00961 */ 00962 pdce->DCX_flags |= DCX_INUSE; 00963 00964 /* 00965 * We found an entry with the proper visrgn. 00966 * If the origin doesn't match, update the CE and reset it. 00967 */ 00968 if (pwndOrg != pdce->pwndOrg) { 00969 /* 00970 * Need to flush any dirty rectangle stuff now. 00971 */ 00972 SpbCheckDce(pdce); 00973 00974 pdce->pwndOrg = pwndOrg; 00975 ResetOrg(NULL, pdce, FALSE); 00976 } 00977 00978 goto HaveComputedEntry; 00979 } 00980 } 00981 00982 #if DBG 00983 SearchFailed: 00984 #endif 00985 00986 /* 00987 * Couldn't find an exact match. Find some invalid or non-inuse 00988 * entry we can reuse. 00989 */ 00990 ppdceNotInUse = NULL; 00991 for (ppdce = &gpDispInfo->pdceFirst; (pdce = *ppdce); ppdce = &pdce->pdceNext) { 00992 00993 /* 00994 * Skip non-cache entries 00995 */ 00996 if (!(pdce->DCX_flags & DCX_CACHE)) 00997 continue; 00998 00999 /* 01000 * Skip monitor-specific entires 01001 */ 01002 if (pdce->pMonitor != NULL) 01003 continue; 01004 01005 if (pdce->DCX_flags & DCX_INVALID) { 01006 break; 01007 } else if (!(pdce->DCX_flags & DCX_INUSE)) { 01008 01009 /* 01010 * Remember the non-inuse one, but keep looking for an invalid. 01011 */ 01012 ppdceNotInUse = ppdce; 01013 } 01014 } 01015 01016 /* 01017 * If we broke out of the loop, we found an invalid entry to reuse. 01018 * Otherwise see if we found a non-inuse entry to reuse. 01019 */ 01020 if (pdce == NULL && ((ppdce = ppdceNotInUse) == NULL)) { 01021 01022 /* 01023 * Create another DCE if we need it. 01024 */ 01025 if (!CreateCacheDC(pwndOrg, 01026 DCX_INVALID | DCX_CACHE | 01027 (DCX_flags & DCX_LAYERED), 01028 NULL)) { 01029 goto NullExit; 01030 } 01031 01032 goto SearchAgain; 01033 } 01034 01035 /* 01036 * We've chosen an entry to reuse: now fill it in and recompute it. 01037 */ 01038 pdce = *ppdce; 01039 01040 RecomputeEntry: 01041 01042 /* 01043 * Any non-invalid entries that we reuse might still have some bounds 01044 * that need to be used to invalidate SPBs. Apply them here. 01045 */ 01046 if (!(pdce->DCX_flags & DCX_INVALID)) 01047 SpbCheckDce(pdce); 01048 01049 /* 01050 * We want to compute only the matchable visrgn at first, 01051 * so we don't set up hrgnClip, or set the EXCLUDERGN or INTERSECTRGN 01052 * bits yet -- we'll deal with those later. 01053 */ 01054 pdce->DCX_flags = DCX_flagsMatch | DCX_INUSE; 01055 01056 #if DBG 01057 /* 01058 * We're about to select the visrgn into the DC, even though it's 01059 * not yet completely setup. Turn off the visrgn validation for now. 01060 * It will be turned on before this function returns. 01061 */ 01062 GreValidateVisrgn(pdce->hdc, FALSE); 01063 #endif 01064 01065 /* 01066 * Now recompute the visrgn (minus any hrgnClip shenanigans) 01067 */ 01068 hrgn = NULL; 01069 if (CalcVisRgn(&hrgn, pwndOrg, pwndClip, DCX_flagsMatch) == FALSE) { 01070 pdce->DCX_flags |= DCX_PWNDORGINVISIBLE; 01071 } 01072 01073 pdce->pwndOrg = pwndOrg; 01074 pdce->pwndClip = pwndClip; 01075 pdce->hrgnClip = NULL; // Just in case... 01076 pdce->hrgnClipPublic = NULL; 01077 01078 ResetOrg(hrgn, pdce, TRUE); 01079 01080 if (hrgn == NULL) { 01081 fVisRgnError = TRUE; 01082 } 01083 01084 /* 01085 * When we arrive here, pdce (and *ppdce) point to 01086 * a cache entry whose visrgn and origin are set up. 01087 * All that remains to be done is to deal with EXCLUDE/INTERSECTRGN 01088 */ 01089 HaveComputedEntry: 01090 01091 /* 01092 * If the window clipping flags have changed in the window 01093 * since the last time this dc was invalidated, then recompute 01094 * this dc entry. 01095 */ 01096 if ((pdce->DCX_flags & DCX_MATCHMASK) != (DCX_flags & DCX_MATCHMASK)) 01097 goto RecomputeEntry; 01098 01099 /* 01100 * Let's check these assertions just in case... 01101 */ 01102 UserAssert(pdce); 01103 UserAssert(*ppdce == pdce); 01104 UserAssert(pdce->DCX_flags & DCX_INUSE); 01105 UserAssert(!(pdce->DCX_flags & DCX_INVALID)); 01106 UserAssert((pdce->DCX_flags & DCX_MATCHMASK) == (DCX_flags & DCX_MATCHMASK)); 01107 01108 /* 01109 * Move the dce to the head of the list so it's easy to find later. 01110 */ 01111 if (pdce != gpDispInfo->pdceFirst) { 01112 *ppdce = pdce->pdceNext; 01113 pdce->pdceNext = gpDispInfo->pdceFirst; 01114 gpDispInfo->pdceFirst = pdce; 01115 } 01116 01117 #if DBG 01118 /* 01119 * We're about to mess with the visrgn in this DC, even though it's 01120 * not yet completely setup. Turn off the visrgn validation for now. 01121 * It will be turned on before this function returns. 01122 */ 01123 GreValidateVisrgn(pdce->hdc, FALSE); 01124 #endif 01125 01126 /* 01127 * Time to deal with DCX_INTERSECTRGN or DCX_EXCLUDERGN. 01128 * 01129 * We handle these two bits specially, because cache entries 01130 * with these bits set cannot be reused with the bits set. This 01131 * is because the area described in hrgnClip would have to be 01132 * compared along with the bit, which is a pain, especially since 01133 * they'd never match very often anyhow. 01134 * 01135 * What we do instead is to save the visrgn of the window before 01136 * applying either of these two flags, which is then restored 01137 * at ReleaseCacheDC() time, along with the clearing of these bits. 01138 * This effectively converts a cache entry with either of these 01139 * bits set into a "normal" cache entry that can be matched. 01140 */ 01141 if (DCX_flags & DCX_INTERSECTRGN) { 01142 01143 if (hrgnClip != HRGN_FULL) { 01144 01145 SetEmptyRgn(ghrgnGDC); 01146 01147 /* 01148 * Save the visrgn for reuse on ReleaseDC(). 01149 * (do this BEFORE we set hrgnClip & pdce->flag bit, 01150 * so that if a DCHook() callback occurs it recalculates 01151 * without hrgnClip) 01152 */ 01153 UserAssertMsg0(!pdce->hrgnSavedVis, 01154 "Nested SaveVisRgn attempt in _GetDCEx"); 01155 01156 /* 01157 * get the current vis region into hrgnSavedVis. Temporarily 01158 * store a dummy one in the DC. 01159 */ 01160 01161 pdce->hrgnSavedVis = CreateEmptyRgn(); 01162 01163 GreSelectVisRgn(pdce->hdc,pdce->hrgnSavedVis, SVR_SWAP); 01164 01165 pdce->hrgnClip = hrgnClip; 01166 01167 if (DCX_flags & DCX_NODELETERGN) 01168 pdce->DCX_flags |= DCX_NODELETERGN; 01169 01170 pdce->DCX_flags |= DCX_INTERSECTRGN; 01171 01172 if (hrgnClip == NULL) { 01173 01174 pdce->hrgnClipPublic = NULL; 01175 01176 } else { 01177 01178 IntersectRgn(ghrgnGDC, pdce->hrgnSavedVis, hrgnClip); 01179 01180 /* 01181 * Make a copy of the hrgnClip and make it public 01182 * so that we can use it in calculations in HungDraw. 01183 */ 01184 pdce->hrgnClipPublic = CreateEmptyRgnPublic(); 01185 CopyRgn(pdce->hrgnClipPublic, hrgnClip); 01186 } 01187 01188 /* 01189 * Clear the SAVEDRGNINVALID bit, since we're just 01190 * about to set it properly now. If the dce later 01191 * gets invalidated, it'll set this bit so we know 01192 * to recompute it when we restore the visrgn. 01193 */ 01194 pdce->DCX_flags &= ~DCX_SAVEDRGNINVALID; 01195 01196 /* 01197 * Select in the new region. we use the SWAP_REGION mode 01198 * so that ghrgnGDC always has a valid rgn 01199 */ 01200 01201 GreSelectVisRgn(pdce->hdc, ghrgnGDC, SVR_SWAP); 01202 } 01203 } else if (DCX_flags & DCX_EXCLUDERGN) { 01204 01205 if (hrgnClip != NULL) { 01206 01207 SetEmptyRgn(ghrgnGDC); 01208 01209 /* 01210 * Save the visrgn for reuse on ReleaseDC(). 01211 * (do this BEFORE we set hrgnClip & pdce->flag bit, 01212 * so that if a DCHook() callback occurs it recalculates 01213 * without hrgnClip) 01214 */ 01215 UserAssertMsg0(!pdce->hrgnSavedVis, 01216 "Nested SaveVisRgn attempt in _GetDCEx"); 01217 01218 /* 01219 * get the current vis region into hrgnSavedVis. Temporarily 01220 * store a dummy one in the DC. 01221 */ 01222 pdce->hrgnSavedVis = CreateEmptyRgn(); 01223 01224 GreSelectVisRgn(pdce->hdc,pdce->hrgnSavedVis, SVR_SWAP); 01225 01226 pdce->hrgnClip = hrgnClip; 01227 01228 if (DCX_flags & DCX_NODELETERGN) 01229 pdce->DCX_flags |= DCX_NODELETERGN; 01230 01231 pdce->DCX_flags |= DCX_EXCLUDERGN; 01232 01233 if (hrgnClip == HRGN_FULL) { 01234 01235 pdce->hrgnClipPublic = HRGN_FULL; 01236 01237 } else { 01238 01239 SubtractRgn(ghrgnGDC, pdce->hrgnSavedVis, hrgnClip); 01240 01241 /* 01242 * Make a copy of the hrgnClip and make it public 01243 * so that we can use it in calculations in HungDraw. 01244 */ 01245 pdce->hrgnClipPublic = CreateEmptyRgnPublic(); 01246 CopyRgn(pdce->hrgnClipPublic, hrgnClip); 01247 } 01248 01249 /* 01250 * Clear the SAVEDRGNINVALID bit, since we're just 01251 * about to set it properly now. If the dce later 01252 * gets invalidated, it'll set this bit so we know 01253 * to recompute it when we restore the visrgn. 01254 */ 01255 pdce->DCX_flags &= ~DCX_SAVEDRGNINVALID; 01256 01257 /* 01258 * Select in the new region. we use the SWAP_REGION mode 01259 * so that ghrgnGDC always has a valid rgn 01260 */ 01261 01262 GreSelectVisRgn(pdce->hdc, ghrgnGDC, SVR_SWAP); 01263 } 01264 } 01265 } 01266 01267 if (pdce->DCX_flags & DCX_LAYERED) { 01268 UserAssert(pwndLayer != NULL); 01269 UserAssert(hbmLayer != NULL); 01270 01271 UserVerify(GreSelectRedirectionBitmap(pdce->hdc, hbmLayer)); 01272 01273 /* 01274 * Enable bounds accumulation, so we know if there was any drawing 01275 * done into that DC and the actual rect we need to update when 01276 * this DC is released. 01277 */ 01278 GreGetBounds(pdce->hdc, NULL, GGB_ENABLE_WINMGR); 01279 01280 /* 01281 * In case the visrgn couldn't be allocated, clear it in the 01282 * dc again, since we just selected a new surface. 01283 */ 01284 if (fVisRgnError) { 01285 GreSelectVisRgn(pdce->hdc, NULL, SVR_DELETEOLD); 01286 } 01287 } 01288 01289 /* 01290 * Whew! Set ownership and return the bloody DC. 01291 * Only set ownership for cache dcs. Own dcs have already been owned. 01292 * The reason why we don't want to set the ownership over again is 01293 * because the console sets its owndcs to PUBLIC so gdisrv can use 01294 * them without asserting. We don't want to set the ownership back 01295 * again. 01296 */ 01297 if (pdce->DCX_flags & DCX_CACHE) { 01298 01299 if (!GreSetDCOwner(pdce->hdc, OBJECT_OWNER_CURRENT)) { 01300 RIPMSG1(RIP_WARNING, "GetDCEx: SetDCOwner Failed %lX", pdce->hdc); 01301 } 01302 01303 /* 01304 * Decrement the Free DCE Count. This should always be >= 0, 01305 * since we'll create a new dce if the cache is all in use. 01306 */ 01307 DecrementFreeDCECount(); 01308 01309 pdce->ptiOwner = PtiCurrent(); 01310 } 01311 01312 #ifdef USE_MIRRORING 01313 if (TestWF(pwnd, WEFLAYOUTRTL) && !(DCX_flags & DCX_NOMIRROR)) { 01314 GreSetLayout(pdce->hdc, -1, LAYOUT_RTL); 01315 } 01316 #endif 01317 01318 #if DBG 01319 GreValidateVisrgn(pdce->hdc, TRUE); 01320 #endif 01321 01322 GreUnlockDisplay(gpDispInfo->hDev); 01323 01324 return pdce->hdc; 01325 }

BOOL _GetGUIThreadInfo PTHREADINFO  pti,
PGUITHREADINFO  pgui
 

Definition at line 36 of file winable2.c.

References tagQ::caret, tagDESKTOP::cciConsole, tagCARET::cx, tagCARET::cy, FALSE, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fIsSysMenu, _MOVESIZEDATA::fTrackCancelled, GETPTI, gpqForeground, HW, HWq, tagCARET::iHideLevel, NULL, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagTHREADINFO::pmsd, tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrentShared, tagTHREADINFO::rpdesk, SetRectEmpty, tagCARET::spwnd, _MOVESIZEDATA::spwnd, tagQ::spwndActive, tagQ::spwndCapture, tagQ::spwndFocus, tagPOPUPMENU::spwndNotify, TRUE, W32PF_CONSOLEHASFOCUS, tagCARET::x, and tagCARET::y.

Referenced by NtUserGetGUIThreadInfo().

00037 { 00038 PQ pq; 00039 00040 /* 00041 * Validate threadinfo structure 00042 */ 00043 if (pgui->cbSize != sizeof(GUITHREADINFO)) { 00044 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "GUITHREADINFO.cbSize %d is wrong", pgui->cbSize); 00045 return FALSE; 00046 } 00047 00048 /* 00049 * Is this a valid initialized GUI thread? 00050 */ 00051 if (pti != NULL) { 00052 if ((pq = pti->pq) == NULL) { 00053 // does this ever happen? 00054 RIPMSG1(RIP_ERROR, "GetGUIThreadInfo: No queue for pti %lx", pti); 00055 return FALSE; 00056 } 00057 } else { 00058 /* 00059 * Use the foreground queue. To get menu state information we must also 00060 * figure out the right pti. This matches _GetForegroundWindow() logic. 00061 */ 00062 if ((pq = gpqForeground) == NULL) { 00063 // this does sometimes happen... 00064 RIPMSG0(RIP_WARNING, "GetGUIThreadInfo: No foreground queue"); 00065 return FALSE; 00066 } 00067 00068 if (pq->spwndActive && (GETPTI(pq->spwndActive)->pq == pq)) { 00069 pti = GETPTI(pq->spwndActive); 00070 if (PtiCurrentShared()->rpdesk != pti->rpdesk) { 00071 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, "Foreground window on different desktop"); 00072 return FALSE; 00073 } 00074 } 00075 } 00076 00077 UserAssert(pq != NULL); 00078 00079 /* 00080 * For C2 security, verify that pq and pti are on the current thread's desktop. 00081 * We can't directly determine which desktop pq belongs to, but we can at 00082 * least ensure that any caret info we return is not from another desktop 00083 */ 00084 if (pq->caret.spwnd && 00085 (GETPTI(pq->caret.spwnd)->rpdesk != PtiCurrentShared()->rpdesk)) { 00086 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, "Foreground caret on different desktop"); 00087 return FALSE; 00088 } 00089 if (pti && (pti->rpdesk != PtiCurrentShared()->rpdesk)) { 00090 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, "Foreground thread on different desktop"); 00091 return FALSE; 00092 } 00093 00094 pgui->flags = 0; 00095 pgui->hwndMoveSize = NULL; 00096 pgui->hwndMenuOwner = NULL; 00097 00098 /* 00099 * Get Menu information from the THREADINFO 00100 */ 00101 if (pti != NULL) { 00102 if (pti->pmsd && !pti->pmsd->fTrackCancelled && pti->pmsd->spwnd) { 00103 pgui->flags |= GUI_INMOVESIZE; 00104 pgui->hwndMoveSize = HWq(pti->pmsd->spwnd); 00105 } 00106 00107 if (pti->pMenuState && pti->pMenuState->pGlobalPopupMenu) { 00108 pgui->flags |= GUI_INMENUMODE; 00109 00110 if (pti->pMenuState->pGlobalPopupMenu->fHasMenuBar) { 00111 if (pti->pMenuState->pGlobalPopupMenu->fIsSysMenu) { 00112 pgui->flags |= GUI_SYSTEMMENUMODE; 00113 } 00114 } else { 00115 pgui->flags |= GUI_POPUPMENUMODE; 00116 } 00117 00118 if (pti->pMenuState->pGlobalPopupMenu->spwndNotify) 00119 pgui->hwndMenuOwner = HWq(pti->pMenuState->pGlobalPopupMenu->spwndNotify); 00120 } 00121 } 00122 00123 /* 00124 * Get the rest of the information from the queue 00125 */ 00126 pgui->hwndActive = HW(pq->spwndActive); 00127 pgui->hwndFocus = HW(pq->spwndFocus); 00128 pgui->hwndCapture = HW(pq->spwndCapture); 00129 00130 pgui->hwndCaret = NULL; 00131 00132 if (pq->caret.spwnd) { 00133 pgui->hwndCaret = HWq(pq->caret.spwnd); 00134 00135 /* 00136 * These coords are always relative to the client of hwndCaret 00137 * of course. 00138 */ 00139 pgui->rcCaret.left = pq->caret.x; 00140 pgui->rcCaret.right = pgui->rcCaret.left + pq->caret.cx; 00141 pgui->rcCaret.top = pq->caret.y; 00142 pgui->rcCaret.bottom = pgui->rcCaret.top + pq->caret.cy; 00143 00144 if (pq->caret.iHideLevel == 0) 00145 pgui->flags |= GUI_CARETBLINKING; 00146 } else if (pti && (pti->ppi->W32PF_Flags & W32PF_CONSOLEHASFOCUS)) { 00147 /* 00148 * The thread is running in the console window with focus. Pull 00149 * out the info from the console pseudo caret. 00150 */ 00151 pgui->hwndCaret = pti->rpdesk->cciConsole.hwnd; 00152 pgui->rcCaret = pti->rpdesk->cciConsole.rc; 00153 } else { 00154 SetRectEmpty(&pgui->rcCaret); 00155 } 00156 00157 return TRUE; 00158 }

BOOL _GetIMEShowStatus VOID   ) 
 

Definition at line 2705 of file ntimm.c.

References BOOL, FALSE, and gfIMEShowStatus.

Referenced by xxxSystemParametersInfo().

02706 { 02707 return gfIMEShowStatus != FALSE; 02708 }

BOOL _GetInputState VOID   ) 
 

Definition at line 4206 of file queue.c.

References _GetQueueStatus(), BOOL, FALSE, QS_TEST, QS_TEST_AND_CLEAR, and TRUE.

Referenced by NtUserGetThreadState().

04207 { 04208 if (LOWORD(_GetQueueStatus(QS_TEST_AND_CLEAR)) & QS_TEST) { 04209 return TRUE; 04210 } else { 04211 return FALSE; 04212 } 04213 }

HKL _GetKeyboardLayout DWORD  idThread  ) 
 

Definition at line 1469 of file kbdlyout.c.

References CheckCritIn, tagKL::hkl, NULL, PtiCurrent, PtiCurrentShared, and tagTHREADINFO::spklActive.

Referenced by GetActiveHKL().

01471 { 01472 PTHREADINFO ptiT; 01473 PLIST_ENTRY pHead, pEntry; 01474 01475 CheckCritIn(); 01476 01477 /* 01478 * If idThread is NULL return hkl of the current thread 01479 */ 01480 if (idThread == 0) { 01481 PKL pklActive = PtiCurrentShared()->spklActive; 01482 01483 if (pklActive == NULL) { 01484 return (HKL)0; 01485 } 01486 return pklActive->hkl; 01487 } 01488 /* 01489 * Look for idThread 01490 */ 01491 pHead = &PtiCurrent()->rpdesk->PtiList; 01492 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 01493 ptiT = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 01494 if (ptiT->pEThread->Cid.UniqueThread == (HANDLE)LongToHandle( idThread )) { 01495 if (ptiT->spklActive == NULL) { 01496 return (HKL)0; 01497 } 01498 return ptiT->spklActive->hkl; 01499 } 01500 } 01501 /* 01502 * idThread doesn't exist 01503 */ 01504 return (HKL)0; 01505 }

UINT _GetKeyboardLayoutList PWINDOWSTATION  pwinsta,
UINT  nItems,
HKL *  lpBuff
 

Definition at line 1507 of file kbdlyout.c.

References EXCEPTION_EXECUTE_HANDLER, tagKL::hkl, KL_UNLOADED, NULL, tagWINDOWSTATION::spklList, and UINT.

Referenced by NtUserGetKeyboardLayoutList().

01511 { 01512 UINT nHKL = 0; 01513 PKL pkl, pklFirst; 01514 01515 if (!pwinsta) { 01516 return 0; 01517 } 01518 01519 pkl = pwinsta->spklList; 01520 01521 /* 01522 * Windowstations that do not take input could have no layouts 01523 */ 01524 if (pkl == NULL) { 01525 // SetLastError() ???? 01526 return 0; 01527 } 01528 01529 /* 01530 * The client/server thunk sets nItems to 0 if ccxlpBuff == NULL 01531 */ 01532 UserAssert(ccxlpBuff || (nItems == 0)); 01533 01534 pklFirst = pkl; 01535 if (nItems) { 01536 try { 01537 do { 01538 if (!(pkl->dwKL_Flags & KL_UNLOADED)) { 01539 if (nItems-- == 0) { 01540 break; 01541 } 01542 nHKL++; 01543 *ccxlpBuff++ = pkl->hkl; 01544 } 01545 pkl = pkl->pklNext; 01546 } while (pkl != pklFirst); 01547 } except (EXCEPTION_EXECUTE_HANDLER) { 01548 RIPERR1(ERROR_INVALID_PARAMETER, RIP_ERROR, 01549 "_GetKeyBoardLayoutList: exception writing ccxlpBuff %lx", ccxlpBuff); 01550 return 0; 01551 } 01552 } else do { 01553 if (!(pkl->dwKL_Flags & KL_UNLOADED)) { 01554 nHKL++; 01555 } 01556 pkl = pkl->pklNext; 01557 } while (pkl != pklFirst); 01558 01559 return nHKL; 01560 }

int _GetKeyboardType int  nTypeFlag  ) 
 

Definition at line 3070 of file ntinput.c.

References gKeyboardInfo, gpKbdNlsTbl, and NULL.

03071 { 03072 03073 switch (nTypeFlag) { 03074 case 0: 03075 return gKeyboardInfo.KeyboardIdentifier.Type; 03076 03077 case 1: 03078 // FE_SB 03079 { 03080 int OEMId = 0; 03081 // 03082 // If this keyboard layout is compatible with 101 or 106 03083 // Japanese keyboard, we just return 101 or 106's keyboard 03084 // id, not this keyboard's one to let application handle 03085 // this keyboard as 101 or 106 Japanese keyboard. 03086 // 03087 if (gpKbdNlsTbl != NULL) { 03088 if (gpKbdNlsTbl->LayoutInformation & NLSKBD_INFO_EMURATE_101_KEYBOARD) { 03089 return (MICROSOFT_KBD_101_TYPE); 03090 } 03091 if (gpKbdNlsTbl->LayoutInformation & NLSKBD_INFO_EMURATE_106_KEYBOARD) { 03092 return (MICROSOFT_KBD_106_TYPE); 03093 } 03094 } 03095 03096 // 03097 // PSS ID Number: Q130054 03098 // Article last modified on 05-16-1995 03099 // 03100 // 3.10 1.20 | 3.50 1.20 03101 // WINDOWS | WINDOWS NT 03102 // 03103 // --------------------------------------------------------------------- 03104 // The information in this article applies to: 03105 // - Microsoft Windows Software Development Kit (SDK) for Windows 03106 // version 3.1 03107 // - Microsoft Win32 Software Development Kit (SDK) version 3.5 03108 // - Microsoft Win32s version 1.2 03109 // --------------------------------------------------------------------- 03110 // SUMMARY 03111 // ======= 03112 // Because of the variety of computer manufacturers (NEC, Fujitsu, IBMJ, and 03113 // so on) in Japan, sometimes Windows-based applications need to know which 03114 // OEM (original equipment manufacturer) manufactured the computer that is 03115 // running the application. This article explains how. 03116 // 03117 // MORE INFORMATION 03118 // ================ 03119 // There is no documented way to detect the manufacturer of the computer that 03120 // is currently running an application. However, a Windows-based application 03121 // can detect the type of OEM Windows by using the return value of the 03122 // GetKeyboardType() function. 03123 // 03124 // If an application uses the GetKeyboardType API, it can get OEM ID by 03125 // specifying "1" (keyboard subtype) as argument of the function. Each OEM ID 03126 // is listed here: 03127 // 03128 // OEM Windows OEM ID 03129 // ------------------------------ 03130 // Microsoft 00H (DOS/V) 03131 // all AX 01H 03132 // EPSON 04H 03133 // Fujitsu 05H 03134 // IBMJ 07H 03135 // Matsushita 0AH 03136 // NEC 0DH 03137 // Toshiba 12H 03138 // 03139 // Application programs can use these OEM IDs to distinguish the type of OEM 03140 // Windows. Note, however, that this method is not documented, so Microsoft 03141 // may not support it in the future version of Windows. 03142 // 03143 // As a rule, application developers should write hardware-independent code, 03144 // especially when making Windows-based applications. If they need to make a 03145 // hardware-dependent application, they must prepare the separated program 03146 // file for each different hardware architecture. 03147 // 03148 // Additional reference words: 3.10 1.20 3.50 1.20 kbinf 03149 // KBCategory: kbhw 03150 // KBSubcategory: wintldev 03151 // ============================================================================= 03152 // Copyright Microsoft Corporation 1995. 03153 03154 if (gpKbdNlsTbl != NULL) { 03155 // 03156 // Get OEM (Windows) ID. 03157 // 03158 OEMId = ((int)gpKbdNlsTbl->OEMIdentifier) << 8; 03159 } 03160 // 03161 // The format of KeyboardIdentifier.Subtype : 03162 // 03163 // 0 - 3 bits = keyboard subtype 03164 // 4 - 7 bits = kernel mode kerboard driver provider id. 03165 // 03166 // Kernel mode keyboard dirver provier | ID 03167 // ------------------------------------+----- 03168 // Microsoft | 00H 03169 // all AX | 01H 03170 // Toshiba | 02H 03171 // EPSON | 04H 03172 // Fujitsu | 05H 03173 // IBMJ | 07H 03174 // Matsushita | 0AH 03175 // NEC | 0DH 03176 // 03177 03178 // 03179 // And here is the format of return value. 03180 // 03181 // 0 - 7 bits = Keyboard Subtype. 03182 // 8 - 15 bits = OEM (Windows) Id. 03183 // 16 - 31 bits = not used. 03184 // 03185 return (int)(OEMId | (gKeyboardInfo.KeyboardIdentifier.Subtype & 0x0F)); 03186 } 03187 03188 case 2: 03189 return gKeyboardInfo.NumberOfFunctionKeys; 03190 } 03191 return 0; 03192 }

int _GetKeyNameText LONG  lParam,
LPWSTR  lpString,
int  nSize
 

Definition at line 408 of file xlate.c.

References APIENTRY, BYTE, InternalMapVirtualKeyEx(), L, LOBYTE, NULL, tagKBDFILE::pKbdTbl, PtiCurrentShared, tagKL::spkf, tagTHREADINFO::spklActive, TRUE, UINT, and wcsncpycch().

Referenced by NtUserGetKeyNameText().

00412 { 00413 BYTE Vsc = LOBYTE(HIWORD(lParam)); 00414 PVSC_LPWSTR pKN; 00415 PTHREADINFO ptiT = PtiCurrentShared(); 00416 PKBDTABLES pKbdTbl; 00417 UINT Vk; 00418 UINT Char; 00419 00420 /* 00421 * NOTE -- lpStr can be a client-side address, so access through it 00422 * must be guarded with try blocks. 00423 */ 00424 00425 if (cchSize < 1) 00426 return 0; 00427 00428 /* 00429 * If bit 25 set (don't care about left vs. right) then: 00430 * 1) convert right-Shift into left-Shift 00431 * 2) clear the extended bit for Ctrl and Alt only (effectively converting 00432 * right-Ctrl & right-Alt into left-Ctrl & right-Alt) 00433 * For Windows '95 compatibility, the DONTCARE_BIT doesn't apply to other 00434 * extended keys (eg: NumPad cursor movement keys, NumPad Enter). Some 00435 * applications (Word '95) depend on this. #37796 00436 */ 00437 if (lParam & DONTCARE_BIT) { 00438 if (Vsc == SCANCODE_RSHIFT) { 00439 Vsc = SCANCODE_LSHIFT; 00440 } 00441 if (lParam & EXTENDED_BIT) { 00442 if ((Vsc == SCANCODE_CTRL) || (Vsc == SCANCODE_ALT)) { 00443 lParam &= ~EXTENDED_BIT; 00444 } 00445 } 00446 lParam &= ~DONTCARE_BIT; 00447 } 00448 00449 if (ptiT->spklActive == (PKL)NULL) { 00450 return 0; 00451 } 00452 pKbdTbl = ptiT->spklActive->spkf->pKbdTbl; 00453 00454 /* 00455 * Scan pKbdTbl->pKeyNames[] or pKeyNamesExt[] for matching Virtual Scan Code 00456 */ 00457 if (lParam & EXTENDED_BIT) { 00458 pKN = pKbdTbl->pKeyNamesExt; 00459 } else { 00460 pKN = pKbdTbl->pKeyNames; 00461 } 00462 00463 if (pKN) { 00464 while (pKN->vsc != 0) { 00465 if (Vsc == pKN->vsc) { 00466 00467 try { 00468 cchSize = wcsncpycch(ccxlpStr, pKN->pwsz, cchSize); 00469 cchSize--; 00470 ccxlpStr[cchSize] = L'\0'; 00471 } except(W32ExceptionHandler(TRUE, RIP_ERROR)) { 00472 return 0; 00473 } 00474 return cchSize; 00475 } 00476 pKN++; 00477 } 00478 } 00479 00480 /* 00481 * The name of the key was not found in the table, so we 00482 * now attempt to construct the key name from the character produced by 00483 * the key. Translate Scancode -> Virtual Key -> character. 00484 */ 00485 00486 /* 00487 * Translate Scancode to Virtual Key (ignoring modifier keys etc.) 00488 */ 00489 Vk = InternalMapVirtualKeyEx((UINT)Vsc, 1, pKbdTbl); 00490 if (Vk == 0) { 00491 return 0; 00492 } 00493 00494 /* 00495 * Now translate Virtual Key to character (ignoring modifier keys etc.) 00496 */ 00497 Char = InternalMapVirtualKeyEx((UINT)Vk, 2, pKbdTbl); 00498 if (Char == 0) { 00499 return 0; 00500 } 00501 00502 if (Char & 0x80000000) { 00503 LPWSTR *ppwsz; 00504 00505 ppwsz = pKbdTbl->pKeyNamesDead; 00506 if (ppwsz) { 00507 while (*ppwsz != NULL) { 00508 if (*ppwsz[0] == (WCHAR)Char) { 00509 try { 00510 cchSize = wcsncpycch(ccxlpStr, (*ppwsz)+1, cchSize); 00511 cchSize--; 00512 ccxlpStr[cchSize] = L'\0'; 00513 } except(W32ExceptionHandler(TRUE, RIP_ERROR)) { 00514 return 0; 00515 } 00516 return cchSize; 00517 } 00518 ppwsz++; 00519 } 00520 } 00521 } 00522 00523 /* 00524 * Construct a single character name (adding null-terminator if possible) 00525 */ 00526 try { 00527 ccxlpStr[0] = (WCHAR)Char; 00528 if (cchSize >= 2) { 00529 ccxlpStr[1] = L'\0'; 00530 } 00531 } except(W32ExceptionHandler(TRUE, RIP_ERROR)) { 00532 return 0; 00533 } 00534 return 1; 00535 }

DWORD _GetListBoxInfo PWND  pwnd  ) 
 

Definition at line 946 of file winable2.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, BOOL, tagLBIV::cMac, DATAALIGN, DWORD, FALSE, tagLBIV::fMultiColumn, FNID_LISTBOX, GETFNID, GETPTI, gpsi, ICLS_LISTBOX, tagLBIV::itemsPerColumn, KeAttachProcess(), KeDetachProcess(), tagWND::pcls, PpiCurrent, and ProbeForRead.

Referenced by NtUserGetListBoxInfo().

00947 { 00948 PCLS pcls; 00949 DWORD dwRet = 0; 00950 BOOL fOtherProcess; 00951 00952 /* 00953 * Make sure it is a combobox or a dropdown 00954 */ 00955 pcls = pwnd->pcls; 00956 if ((pcls->atomClassName != gpsi->atomSysClass[ICLS_LISTBOX]) && 00957 (GETFNID(pwnd) != FNID_LISTBOX)) { 00958 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "pwnd %#p is not a listbox", pwnd); 00959 return 0; 00960 } 00961 00962 if (fOtherProcess = (GETPTI(pwnd)->ppi != PpiCurrent())) { 00963 KeAttachProcess(&GETPTI(pwnd)->ppi->Process->Pcb); 00964 } 00965 00966 try { 00967 PLBIV ccxPlbSnap; 00968 00969 /* 00970 * Snap and probe the pointer to the LBIV, since it is client-side. 00971 */ 00972 ccxPlbSnap = ((PLBWND)pwnd)->pLBIV; 00973 if (!ccxPlbSnap) { 00974 goto errorexit; 00975 } 00976 ProbeForRead(ccxPlbSnap, sizeof(LBIV), DATAALIGN); 00977 00978 if (ccxPlbSnap->fMultiColumn) { 00979 dwRet = ccxPlbSnap->itemsPerColumn; 00980 } else { 00981 dwRet = ccxPlbSnap->cMac; 00982 } 00983 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00984 dwRet = 0; 00985 } 00986 00987 errorexit: 00988 if (fOtherProcess) { 00989 KeDetachProcess(); 00990 } 00991 00992 return dwRet; 00993 }

PMENU _GetMenu PWND  pWnd  ) 
 

WINUSERAPI UINT _GetMenuItemCount PMENU  pMenu  ) 
 

WINUSERAPI UINT _GetMenuItemID PMENU  pMenu,
int  nPos
 

DWORD _GetMessagePos VOID   ) 
 

Definition at line 1205 of file ntuser/kernel/input.c.

References DWORD, PtiCurrent, tagTHREADINFO::ptLast, and SHORT.

Referenced by xxxContScroll(), xxxEndScroll(), xxxMS_TrackMove(), xxxSendHelpMessage(), and xxxSysCommand().

01206 { 01207 PTHREADINFO pti; 01208 01209 pti = PtiCurrent(); 01210 01211 return MAKELONG((SHORT)pti->ptLast.x, (SHORT)pti->ptLast.y); 01212 }

int _GetMouseMovePointsEx CONST MOUSEMOVEPOINT *  ppt,
MOUSEMOVEPOINT *  pptBuf,
UINT  nPoints,
DWORD  resolution
 

Definition at line 3652 of file ntinput.c.

References BOOL, DWORD, FALSE, gaptMouse, gptInd, MAX_MOUSEPOINTS, min, PREVPOINT, SYSMET, TRUE, and UINT.

Referenced by NtUserGetMouseMovePointsEx().

03657 { 03658 UINT uInd, uStart, nPointsRetrieved, i; 03659 BOOL bFound = FALSE; 03660 int x, y; 03661 DWORD resX, resY; 03662 03663 uStart = PREVPOINT(gptInd); 03664 03665 /* 03666 * Search the point in the global buffer and get the first occurance. 03667 */ 03668 uInd = uStart; 03669 03670 do { 03671 /* 03672 * The resolutions can be zero only if the buffer is still not full 03673 */ 03674 if (HIWORD(gaptMouse[uInd].x) == 0 || HIWORD(gaptMouse[uInd].y) == 0) { 03675 break; 03676 } 03677 03678 resX = (DWORD)HIWORD(gaptMouse[uInd].x) + 1; 03679 resY = (DWORD)HIWORD(gaptMouse[uInd].y) + 1; 03680 03681 if ((int)resX != SYSMET(CXVIRTUALSCREEN)) { 03682 UserAssert(resX == 0x10000); 03683 x = (LOWORD(gaptMouse[uInd].x) * SYSMET(CXVIRTUALSCREEN)) / resX; 03684 } else { 03685 x = LOWORD(gaptMouse[uInd].x); 03686 } 03687 03688 if ((int)resY != SYSMET(CYVIRTUALSCREEN)) { 03689 UserAssert(resY == 0x10000); 03690 y = (LOWORD(gaptMouse[uInd].y) * SYSMET(CYVIRTUALSCREEN)) / resY; 03691 } else { 03692 y = LOWORD(gaptMouse[uInd].y); 03693 } 03694 03695 if (x == ppt->x && y == ppt->y) { 03696 03697 /* 03698 * If the timestamp was provided check to see if it's the right 03699 * timestamp. 03700 */ 03701 if (ppt->time != 0 && ppt->time != gaptMouse[uInd].time) { 03702 uInd = PREVPOINT(uInd); 03703 RIPMSG4(RIP_VERBOSE, 03704 "GetMouseMovePointsEx: Found point (%x, %y) but timestamp %x diff from %x", 03705 x, y, ppt->time, gaptMouse[uInd].time); 03706 continue; 03707 } 03708 03709 bFound = TRUE; 03710 break; 03711 } 03712 uInd = PREVPOINT(uInd); 03713 03714 } while (uInd != uStart); 03715 03716 /* 03717 * The point might not be in the buffer anymore. 03718 */ 03719 if (!bFound) { 03720 RIPERR2(ERROR_POINT_NOT_FOUND, RIP_VERBOSE, 03721 "GetMouseMovePointsEx: point not found (%x, %y)", ppt->x, ppt->y); 03722 return -1; 03723 } 03724 03725 /* 03726 * See how many points we can retrieve. 03727 */ 03728 nPointsRetrieved = (uInd <= uStart ? uInd + MAX_MOUSEPOINTS - uStart : uInd - uStart); 03729 03730 nPointsRetrieved = min(nPointsRetrieved, nPoints); 03731 03732 /* 03733 * Copy the points to the app buffer 03734 */ 03735 try { 03736 for (i = 0; i < nPointsRetrieved; i++) { 03737 03738 resX = (DWORD)HIWORD(gaptMouse[uInd].x) + 1; 03739 resY = (DWORD)HIWORD(gaptMouse[uInd].y) + 1; 03740 03741 /* 03742 * If one of the resolution is 0 then we're done 03743 */ 03744 if (HIWORD(gaptMouse[uInd].x) == 0 || HIWORD(gaptMouse[uInd].y) == 0) { 03745 break; 03746 } 03747 03748 /* 03749 * LOWORD(gaptMouse[uInd].x) contains the x point on the 03750 * scale specified by HIWORD(gaptMouse[uInd].x) 03751 */ 03752 if (resolution == GMMP_USE_HIGH_RESOLUTION_POINTS) { 03753 ccxpptBuf[i].x = ((DWORD)LOWORD(gaptMouse[uInd].x) * 0xFFFF) / (resX - 1); 03754 03755 ccxpptBuf[i].y = ((DWORD)LOWORD(gaptMouse[uInd].y) * 0xFFFF) / (resY - 1); 03756 03757 } else { 03758 UserAssert(resolution == GMMP_USE_DISPLAY_POINTS); 03759 03760 ccxpptBuf[i].x = (LOWORD(gaptMouse[uInd].x) * SYSMET(CXVIRTUALSCREEN)) / resX; 03761 03762 ccxpptBuf[i].y = (LOWORD(gaptMouse[uInd].y) * SYSMET(CYVIRTUALSCREEN)) / resY; 03763 } 03764 ccxpptBuf[i].time = gaptMouse[uInd].time; 03765 ccxpptBuf[i].dwExtraInfo = gaptMouse[uInd].dwExtraInfo; 03766 03767 03768 uInd = PREVPOINT(uInd); 03769 } 03770 } except(W32ExceptionHandler(FALSE, RIP_WARNING)) { 03771 } 03772 return i; 03773 }

PWND _GetNextQueueWindow PWND  pwnd,
BOOL  fDir,
BOOL  fAltEsc
 

Definition at line 99 of file tmswitch.c.

References _GetWindow(), BOOL, FALSE, GetLastTopMostWindow(), GetTopLevelWindow(), gptiRit, grpdeskRitInput, gspwndAltTab, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, tagDESKTOPINFO::spwnd, tagWND::spwndChild, tagWND::spwndLastActive, tagWND::spwndOwner, tagWND::spwndParent, TestWF, TRUE, WEFNOACTIVATE, WEFTOOLWINDOW, WEFTOPMOST, WFBOTTOMMOST, WFDISABLED, and WFVISIBLE.

Referenced by InitSwitchWndInfo(), xxxNextWindow(), xxxOldNextWindow(), xxxSwitchToThisWindow(), and zzzReattachThreads().

00103 { 00104 PWND pwndAltTab; 00105 PWND pwndNext; 00106 PWND pwndT; 00107 PWND pwndDesktop; 00108 BOOL bBeenHereAlready = FALSE; 00109 PTHREADINFO ptiAltTab; 00110 00111 /* 00112 * HACK: We have a problem with direct-draw full apps where an alttab 00113 * window is created on a queue owned other than the RIT. This 00114 * shows up by alt-tabbing away from ROIDS.EXE during fullscreen. 00115 * 00116 * What is happening is on a ALT-TAB, from xxxSysCommand(), the 00117 * thread is not a rit. xxxSysCommand() calls xxxOldNextWindow 00118 * which finds that the current-thread doesn't have a switch 00119 * window, and then creates one on the current-thread-queue. 00120 * 00121 * The hack here is to make sure the calling thread is the RIT 00122 * before allowing any cool-switch creation. 00123 * 00124 * 21-Mar-1996 : Chriswil 00125 */ 00126 #if 0 00127 ptiAltTab = PtiCurrent(); 00128 #else 00129 ptiAltTab = gptiRit; 00130 #endif 00131 00132 /* 00133 * If the window we receive is Null then use the last topmost window 00134 */ 00135 if (!pwnd) { 00136 pwnd = GetLastTopMostWindow(); 00137 if (!pwnd) { 00138 return NULL; 00139 } 00140 } 00141 00142 pwndAltTab = gspwndAltTab; 00143 00144 pwnd = pwndNext = GetTopLevelWindow(pwnd); 00145 if (!pwndNext) 00146 return NULL; 00147 00148 /* 00149 * Get the window's desktop 00150 */ 00151 if ((pwndDesktop = pwndNext->spwndParent) == NULL) { 00152 pwndDesktop = grpdeskRitInput->pDeskInfo->spwnd; 00153 pwnd = pwndNext = pwndDesktop->spwndChild; 00154 } 00155 00156 while (TRUE) { 00157 00158 if (pwndNext == NULL) 00159 return NULL; 00160 00161 /* 00162 * Get the next window 00163 */ 00164 pwndNext = _GetWindow(pwndNext, fPrev ? GW_HWNDPREV : GW_HWNDNEXT); 00165 00166 if (!pwndNext) { 00167 00168 pwndNext = fPrev ? _GetWindow(pwndDesktop->spwndChild, GW_HWNDLAST) 00169 : pwndDesktop->spwndChild; 00170 /* 00171 * To avoid searching the child chain forever, bale out if we get 00172 * to the end (beginning) of the chain twice. 00173 * This happens if pwnd is a partially destroyed window that has 00174 * been unlinked from its siblings but not yet unlinked from the 00175 * parent. (Happens while sending WM_NCDESTROY in xxxFreeWindow) 00176 */ 00177 if (bBeenHereAlready) { 00178 RIPMSG1(RIP_WARNING, "pwnd %#p is no longer a sibling", pwnd); 00179 return NULL; 00180 } 00181 00182 bBeenHereAlready = TRUE; 00183 } 00184 00185 /* 00186 * If we have gone all the way around with no success, return NULL. 00187 */ 00188 if (!pwndNext || (pwndNext == pwnd)) 00189 return NULL; 00190 00191 /* 00192 * Ignore the following windows: 00193 * Switch window 00194 * Tool Windows 00195 * NoActivate Windows 00196 * Hidden windows 00197 * Disabled windows 00198 * Topmost windows if via Alt+Esc 00199 * Bottommost windows if via Alt+Esc 00200 * 00201 * If we're doing Alt-Esc processing, we have to skip topmost windows. 00202 * 00203 * Because topmost windows don't really go to the back when we 00204 * send them there, alt-esc would never enumerate non-topmost windows. 00205 * So, although we're allowed to start enumeration at a topmost window, 00206 * we only allow enumeration of non-topmost windows, so the user can 00207 * enumerate his presumably more important applications. 00208 */ 00209 if ((pwndNext != pwndAltTab) && 00210 // BradG - Win95 is missing the check for Tool Windows 00211 (!TestWF(pwndNext, WEFTOOLWINDOW)) && 00212 (!TestWF(pwndNext, WEFNOACTIVATE)) && 00213 (TestWF(pwndNext, WFVISIBLE)) && 00214 ((pwndNext->spwndLastActive == NULL) || (!TestWF(pwndNext->spwndLastActive, WFDISABLED)) && 00215 (!fAltEsc || (!TestWF(pwndNext, WEFTOPMOST) && !TestWF(pwndNext, WFBOTTOMMOST))))) { 00216 /* 00217 * If this window is owned, don't return it unless it is the most 00218 * recently active window in its owner/ownee group. 00219 */ 00220 /* 00221 * Hard loop to find top level owner 00222 */ 00223 for (pwndT = pwndNext; pwndT->spwndOwner; pwndT = pwndT->spwndOwner) 00224 ; 00225 00226 /* 00227 * Don't return it unless it is the most recently active 00228 * window in its owner/ownee group. 00229 */ 00230 if (pwndNext == pwndT->spwndLastActive) 00231 return pwndNext; 00232 } 00233 } 00234 }

int _GetPriorityClipboardFormat UINT *  lpPriorityList,
int  cfmts
 

Referenced by NtUserGetPriorityClipboardFormat().

DWORD _GetQueueStatus UINT   ) 
 

Definition at line 4228 of file queue.c.

References DWORD, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeBits, tagCLIENTTHREADINFO::fsWakeBitsJournal, tagTHREADINFO::pcti, PtiCurrentShared, and UINT.

Referenced by _GetInputState().

04230 { 04231 PTHREADINFO ptiCurrent; 04232 UINT fsChangeBits; 04233 04234 ptiCurrent = PtiCurrentShared(); 04235 04236 flags &= (QS_ALLINPUT | QS_ALLPOSTMESSAGE | QS_TRANSFER); 04237 04238 fsChangeBits = ptiCurrent->pcti->fsChangeBits; 04239 04240 /* 04241 * Clear out the change bits the app is looking at 04242 * so it'll know what changed since it's last call 04243 * to GetQueueStatus(). 04244 */ 04245 ptiCurrent->pcti->fsChangeBits &= ~flags; 04246 04247 /* 04248 * Return the current change/wake-bits. 04249 */ 04250 return MAKELONG(fsChangeBits & flags, 04251 (ptiCurrent->pcti->fsWakeBits | ptiCurrent->pcti->fsWakeBitsJournal) & flags); 04252 }

BOOL _GetScrollBarInfo PWND  pwnd,
LONG  idObject,
PSCROLLBARINFO  ptbi
 

Definition at line 309 of file winable2.c.

References BOOL, CalcSBStuff(), CalcSBStuff2(), FALSE, GetRect(), GetWndSBDisableFlags(), GRECT_CLIENT, GRECT_CLIENTCOORDS, LTUPFLAG, OffsetRect(), PSBWND, tagSBCALC::pxBottom, tagSBCALC::pxDownArrow, tagSBCALC::pxLeft, tagSBCALC::pxRight, tagSBCALC::pxThumbBottom, tagSBCALC::pxThumbTop, tagSBCALC::pxTop, tagSBCALC::pxUpArrow, tagWND::rcClient, tagWND::rcWindow, RTDNFLAG, TestWF, TRUE, UINT, WFHPRESENT, WFHSCROLL, WFLINEDNBUTTONDOWN, WFLINEUPBUTTONDOWN, WFPAGEDNBUTTONDOWN, WFPAGEUPBUTTONDOWN, WFSCROLLBUTTONDOWN, WFVERTSCROLLTRACK, WFVPRESENT, and WFVSCROLL.

Referenced by NtUserGetScrollBarInfo().

00310 { 00311 UINT wDisable; 00312 BOOL fVertical; 00313 SBCALC SBCalc; 00314 00315 /* 00316 * Validate scrollbarinfo structure 00317 */ 00318 if (psbi->cbSize != sizeof(SCROLLBARINFO)) { 00319 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "SCROLLBARINFO.cbSize %d is wrong", psbi->cbSize); 00320 return FALSE; 00321 } 00322 00323 RtlZeroMemory(&psbi->rgstate, sizeof(psbi->rgstate)); 00324 00325 /* 00326 * Calculate where everything is. 00327 */ 00328 if (idObject == OBJID_CLIENT) { 00329 RECT rc; 00330 wDisable = ((PSBWND)pwnd)->wDisableFlags; 00331 fVertical = ((PSBWND)pwnd)->fVert; 00332 GetRect(pwnd, &rc, GRECT_CLIENT | GRECT_CLIENTCOORDS); 00333 CalcSBStuff2(&SBCalc, &rc, (PSBDATA)&((PSBWND)pwnd)->SBCalc, ((PSBWND)pwnd)->fVert); 00334 } else { 00335 /* 00336 * Is this window scrollbar here? 00337 */ 00338 if (idObject == OBJID_VSCROLL) { 00339 fVertical = TRUE; 00340 if (! TestWF(pwnd, WFVSCROLL)) { 00341 // No scrollbar. 00342 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_INVISIBLE; 00343 } else if (! TestWF(pwnd, WFVPRESENT)) { 00344 // Window too short to display it. 00345 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_OFFSCREEN; 00346 } 00347 } else if (idObject == OBJID_HSCROLL) { 00348 fVertical = FALSE; 00349 if (! TestWF(pwnd, WFHSCROLL)) { 00350 // No scrollbar. 00351 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_INVISIBLE; 00352 } else if (! TestWF(pwnd, WFHPRESENT)) { 00353 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_OFFSCREEN; 00354 } 00355 } else { 00356 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "invalid idObject %d", idObject); 00357 return FALSE; 00358 } 00359 00360 if (psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_INVISIBLE) 00361 return TRUE; 00362 00363 wDisable = GetWndSBDisableFlags(pwnd, fVertical); 00364 00365 if (!(psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_OFFSCREEN)) 00366 CalcSBStuff(pwnd, &SBCalc, fVertical); 00367 } 00368 00369 /* 00370 * Setup button states. 00371 */ 00372 if (wDisable & LTUPFLAG) { 00373 psbi->rgstate[INDEX_SCROLLBAR_UP] |= STATE_SYSTEM_UNAVAILABLE; 00374 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_UNAVAILABLE; 00375 } 00376 00377 if (wDisable & RTDNFLAG) { 00378 psbi->rgstate[INDEX_SCROLLBAR_DOWN] |= STATE_SYSTEM_UNAVAILABLE; 00379 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_UNAVAILABLE; 00380 } 00381 00382 if ((wDisable & (LTUPFLAG | RTDNFLAG)) == (LTUPFLAG | RTDNFLAG)) 00383 psbi->rgstate[INDEX_SCROLLBAR_SELF] |= STATE_SYSTEM_UNAVAILABLE; 00384 00385 /* 00386 * Button pressed? 00387 */ 00388 if (TestWF(pwnd, WFSCROLLBUTTONDOWN) && 00389 ((idObject != OBJID_VSCROLL) || TestWF(pwnd, WFVERTSCROLLTRACK))) { 00390 if (TestWF(pwnd, WFLINEUPBUTTONDOWN)) 00391 psbi->rgstate[INDEX_SCROLLBAR_UP] |= STATE_SYSTEM_PRESSED; 00392 00393 if (TestWF(pwnd, WFPAGEUPBUTTONDOWN)) 00394 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_PRESSED; 00395 00396 if (TestWF(pwnd, WFPAGEDNBUTTONDOWN)) 00397 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_PRESSED; 00398 00399 if (TestWF(pwnd, WFLINEDNBUTTONDOWN)) 00400 psbi->rgstate[INDEX_SCROLLBAR_DOWN] |= STATE_SYSTEM_PRESSED; 00401 } 00402 00403 /* 00404 * Fill in area locations. 00405 */ 00406 if (!(psbi->rgstate[INDEX_SCROLLBAR_SELF] & STATE_SYSTEM_OFFSCREEN)) { 00407 if (fVertical) { 00408 psbi->rcScrollBar.left = SBCalc.pxLeft; 00409 psbi->rcScrollBar.top = SBCalc.pxTop; 00410 psbi->rcScrollBar.right = SBCalc.pxRight; 00411 psbi->rcScrollBar.bottom = SBCalc.pxBottom; 00412 } else { 00413 psbi->rcScrollBar.left = SBCalc.pxTop; 00414 psbi->rcScrollBar.top = SBCalc.pxLeft; 00415 psbi->rcScrollBar.right = SBCalc.pxBottom; 00416 psbi->rcScrollBar.bottom = SBCalc.pxRight; 00417 } 00418 00419 if (idObject == OBJID_CLIENT) { 00420 OffsetRect(&psbi->rcScrollBar, pwnd->rcClient.left, pwnd->rcClient.top); 00421 } else { 00422 OffsetRect(&psbi->rcScrollBar, pwnd->rcWindow.left, pwnd->rcWindow.top); 00423 } 00424 00425 psbi->dxyLineButton = (SBCalc.pxUpArrow - SBCalc.pxTop); 00426 psbi->xyThumbTop = (SBCalc.pxThumbTop - SBCalc.pxTop); 00427 psbi->xyThumbBottom = (SBCalc.pxThumbBottom - SBCalc.pxTop); 00428 00429 /* 00430 * Is the thumb all the way to the left/top? If so, page up is 00431 * not visible. 00432 */ 00433 if (SBCalc.pxThumbTop == SBCalc.pxUpArrow) 00434 psbi->rgstate[INDEX_SCROLLBAR_UPPAGE] |= STATE_SYSTEM_INVISIBLE; 00435 00436 /* 00437 * Is the thumb all the way to the right/down? If so, page down 00438 * is not visible. 00439 */ 00440 if (SBCalc.pxThumbBottom == SBCalc.pxDownArrow) 00441 psbi->rgstate[INDEX_SCROLLBAR_DOWNPAGE] |= STATE_SYSTEM_INVISIBLE; 00442 } 00443 00444 return TRUE; 00445 }

BOOL _GetTextMetricsW HDC  hdc,
LPTEXTMETRICW  ptm
 

Definition at line 1187 of file kernel/server.c.

References BOOL, and fret().

Referenced by GetCharDimensions(), xxxDrawCaptionTemp(), and xxxPSMTextOut().

01190 { 01191 TMW_INTERNAL tmi; 01192 BOOL fret; 01193 01194 fret = GreGetTextMetricsW(hdc, &tmi); 01195 01196 *ptm = tmi.tmw; 01197 01198 return fret; 01199 }

BOOL _GetUserObjectInformation HANDLE  h,
int  nIndex,
PVOID  pvInfo,
DWORD  nLength,
LPDWORD  lpnLengthNeeded
 

Definition at line 626 of file w32/ntuser/kernel/security.c.

References BOOL, CheckHandleFlag(), DWORD, ExDesktopObjectType, ExWindowStationObjectType, FALSE, _OBJECT_HANDLE_INFORMATION::HandleAttributes, HF_DESKTOPHOOK, LogDesktop, _OBJECT_TYPE::Name, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, OBJECT_TO_OBJECT_HEADER, ObReferenceObjectByHandle(), PBYTE, POBJECT_NAME, tagWINDOWSTATION::psidUser, PtiCurrentShared, RtlLengthSid(), Status, TRUE, _OBJECT_HEADER::Type, UserMode, and WSF_NOIO.

Referenced by NtUserGetObjectInformation().

00632 { 00633 PUSEROBJECTFLAGS puof; 00634 BOOL fSuccess = TRUE; 00635 PVOID pObject; 00636 POBJECT_HEADER pHead; 00637 DWORD dwLengthNeeded = 0; 00638 OBJECT_HANDLE_INFORMATION ohi; 00639 PUNICODE_STRING pstrInfo; 00640 PWINDOWSTATION pwinsta; 00641 NTSTATUS Status; 00642 00643 /* 00644 * Validate the object 00645 */ 00646 Status = ObReferenceObjectByHandle( 00647 h, 00648 0, 00649 NULL, 00650 UserMode, // this is always called from the client side 00651 &pObject, 00652 &ohi); 00653 if (!NT_SUCCESS(Status)) { 00654 RIPNTERR0(Status, RIP_VERBOSE, "ObReferenceObjectByHandle Failed"); 00655 return FALSE; 00656 } 00657 00658 pHead = OBJECT_TO_OBJECT_HEADER(pObject); 00659 if (pHead->Type != *ExWindowStationObjectType && 00660 pHead->Type != *ExDesktopObjectType) { 00661 RIPERR0(ERROR_INVALID_FUNCTION, RIP_WARNING, "Object is not a USER object"); 00662 ObDereferenceObject(pObject); 00663 return FALSE; 00664 } 00665 00666 #ifdef LOGDESKTOPLOCKS 00667 if (OBJECT_TO_OBJECT_HEADER(pObject)->Type == *ExDesktopObjectType) { 00668 LogDesktop(pObject, LD_REF_FN_GETUSEROBJECTINFORMATION, TRUE, (ULONG_PTR)PtiCurrentShared()); 00669 } 00670 #endif 00671 00672 try { 00673 switch (nIndex) { 00674 case UOI_FLAGS: 00675 dwLengthNeeded = sizeof(USEROBJECTFLAGS); 00676 if (nLength < sizeof(USEROBJECTFLAGS)) { 00677 RIPERR0(ERROR_INSUFFICIENT_BUFFER, RIP_VERBOSE, ""); 00678 fSuccess = FALSE; 00679 break; 00680 } 00681 puof = ccxpvInfo; 00682 puof->fInherit = (ohi.HandleAttributes & OBJ_INHERIT) ? TRUE : FALSE; 00683 puof->fReserved = 0; 00684 puof->dwFlags = 0; 00685 if (pHead->Type == *ExDesktopObjectType) { 00686 if (CheckHandleFlag(h, HF_DESKTOPHOOK)) 00687 puof->dwFlags |= DF_ALLOWOTHERACCOUNTHOOK; 00688 } else { 00689 if (!(((PWINDOWSTATION)pObject)->dwWSF_Flags & WSF_NOIO)) 00690 puof->dwFlags |= WSF_VISIBLE; 00691 } 00692 break; 00693 00694 case UOI_NAME: 00695 pstrInfo = POBJECT_NAME(pObject); 00696 goto docopy; 00697 00698 case UOI_TYPE: 00699 pstrInfo = &pHead->Type->Name; 00700 docopy: 00701 if (pstrInfo) { 00702 dwLengthNeeded = pstrInfo->Length + sizeof(WCHAR); 00703 if (dwLengthNeeded > nLength) { 00704 RIPERR0(ERROR_INSUFFICIENT_BUFFER, RIP_VERBOSE, ""); 00705 fSuccess = FALSE; 00706 break; 00707 } 00708 RtlCopyMemory(ccxpvInfo, pstrInfo->Buffer, pstrInfo->Length); 00709 *(PWCHAR)((PBYTE)ccxpvInfo + pstrInfo->Length) = 0; 00710 } else { 00711 dwLengthNeeded = 0; 00712 } 00713 break; 00714 00715 case UOI_USER_SID: 00716 if (pHead->Type == *ExWindowStationObjectType) 00717 pwinsta = pObject; 00718 else 00719 pwinsta = ((PDESKTOP)pObject)->rpwinstaParent; 00720 if (pwinsta->psidUser == NULL) { 00721 dwLengthNeeded = 0; 00722 } else { 00723 dwLengthNeeded = RtlLengthSid(pwinsta->psidUser); 00724 if (dwLengthNeeded > nLength) { 00725 RIPERR0(ERROR_INSUFFICIENT_BUFFER, RIP_VERBOSE, ""); 00726 fSuccess = FALSE; 00727 break; 00728 } 00729 RtlCopyMemory(ccxpvInfo, pwinsta->psidUser, dwLengthNeeded); 00730 } 00731 break; 00732 00733 default: 00734 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00735 fSuccess = FALSE; 00736 break; 00737 } 00738 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 00739 fSuccess = FALSE; 00740 } 00741 00742 *lpnLengthNeeded = dwLengthNeeded; 00743 00744 #ifdef LOGDESKTOPLOCKS 00745 if (OBJECT_TO_OBJECT_HEADER(pObject)->Type == *ExDesktopObjectType) { 00746 LogDesktop(pObject, LD_DEREF_FN_GETUSEROBJECTINFORMATION, FALSE, (ULONG_PTR)PtiCurrentShared()); 00747 } 00748 #endif 00749 00750 ObDereferenceObject(pObject); 00751 00752 return fSuccess; 00753 }

DWORD _GetWindowContextHelpId PWND  pwnd  ) 
 

Definition at line 15 of file kernel/help.c.

References _GetProp(), tagSERVERINFO::atomContextHelpIdProp, DWORD, gpsi, MAKEINTATOM, and PROPF_INTERNAL.

00016 { 00017 return (DWORD)(ULONG_PTR)_GetProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp), 00018 PROPF_INTERNAL); 00019 }

HDC _GetWindowDC PWND  pwnd  ) 
 

Definition at line 201 of file dc.c.

References _GetDCEx(), NULL, TestWF, WFMINIMIZED, and WFWIN40COMPAT.

Referenced by _UserSoundSentryWorker(), DrawCtlThumb(), InvertScrollHilite(), NtUserGetWindowDC(), xxxDrawThumb(), xxxEnableWndSBArrows(), xxxMNInvertItem(), xxxMoveThumb(), xxxRedrawTitle(), xxxSBWndProc(), xxxSnapWindow(), and zzzDrawInvertScrollArea().

00203 { 00204 00205 #if 0 00206 00207 /* 00208 * For WIN31 and previous apps, we want to actually return back a 00209 * client DC. Before WIN40, the window rect and client rect were the 00210 * same, and there was this terrible hack to grab the window dc when 00211 * painting because window DCs never clip anything. Otherwise the 00212 * children of the minimized window would be clipped out of the fake 00213 * client area. So apps would call GetWindowDC() to redraw their icons, 00214 * since GetDC() would clip empty if the window had a class icon. 00215 */ 00216 if (TestWF(pwnd, WFMINIMIZED) && !TestWF(pwnd, WFWIN40COMPAT)) 00217 return(_GetDCEx(pwnd, hrgnClip, DCX_INTERNAL | DCX_CACHE | DCX_USESTYLE)); 00218 #endif 00219 00220 return _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE); 00221 }

BOOL _GetWindowPlacement PWND  pwnd,
PWINDOWPLACEMENT  pwp
 

Definition at line 679 of file kernel/winmgr.c.

References _MonitorFromRect(), BOOL, CopyRect, FALSE, tagCHECKPOINT::fDragged, tagCHECKPOINT::fMaxInitialized, tagCHECKPOINT::fMinInitialized, tagCHECKPOINT::fWasMaximizedBeforeMinimized, OffsetRect(), tagCHECKPOINT::ptMax, tagCHECKPOINT::ptMin, PWNDDESKTOP, tagMONITOR::rcMonitor, tagCHECKPOINT::rcNormal, tagMONITOR::rcWork, tagWND::spwndParent, TestWF, TestwndChild, TRUE, UpdateCheckpoint(), WEFTOOLWINDOW, WFMAXIMIZED, WFMINIMIZED, and WFREALLYMAXIMIZABLE.

Referenced by NtUserGetInternalWindowPos(), and NtUserGetWindowPlacement().

00682 { 00683 CHECKPOINT * pcp; 00684 00685 /* 00686 * this will set the normal or the minimize point in the checkpoint, 00687 * so that all elements will be up to date. 00688 */ 00689 pcp = UpdateCheckpoint(pwnd); 00690 00691 if (!pcp) 00692 return FALSE; 00693 00694 if (TestWF(pwnd, WFMINIMIZED)) { 00695 pwp->showCmd = SW_SHOWMINIMIZED; 00696 } else if (TestWF(pwnd, WFMAXIMIZED)) { 00697 pwp->showCmd = SW_SHOWMAXIMIZED; 00698 } else { 00699 pwp->showCmd = SW_SHOWNORMAL; 00700 } 00701 00702 CopyRect(&pwp->rcNormalPosition, &pcp->rcNormal); 00703 00704 if (pcp->fMinInitialized) { 00705 pwp->ptMinPosition = pcp->ptMin; 00706 } else { 00707 pwp->ptMinPosition.x = pwp->ptMinPosition.y = -1; 00708 } 00709 00710 /* 00711 * We never ever save the position of "normal" maximized windows. Other 00712 * wise, when the size border changes dimensions, the max pos would be 00713 * invalid, and you would never be able to reset it. 00714 */ 00715 if (pcp->fMaxInitialized && !TestWF(pwnd, WFREALLYMAXIMIZABLE)) { 00716 pwp->ptMaxPosition = pcp->ptMax; 00717 } else { 00718 pwp->ptMaxPosition.x = pwp->ptMaxPosition.y = -1; 00719 } 00720 00721 if ((pwnd->spwndParent == PWNDDESKTOP(pwnd)) && 00722 !TestWF(pwnd, WEFTOOLWINDOW)) { 00723 00724 PMONITOR pMonitor; 00725 00726 pMonitor = _MonitorFromRect(&pwp->rcNormalPosition, MONITOR_DEFAULTTOPRIMARY); 00727 00728 /* 00729 * Convert min, normal positions to be relative to the working area. 00730 * The max pos already is (always is saved that way). 00731 * 00732 * working area, except for maximized position, which is always 00733 * working area relative. 00734 */ 00735 if (pcp->fMinInitialized) { 00736 pwp->ptMinPosition.x -= (pMonitor->rcWork.left - pMonitor->rcMonitor.left); 00737 pwp->ptMinPosition.y -= (pMonitor->rcWork.top - pMonitor->rcMonitor.top); 00738 } 00739 00740 OffsetRect(&pwp->rcNormalPosition, 00741 pMonitor->rcMonitor.left - pMonitor->rcWork.left, 00742 pMonitor->rcMonitor.top - pMonitor->rcWork.top); 00743 } 00744 00745 pwp->flags = 0; 00746 00747 /* 00748 * B#3276 00749 * Don't allow WPF_SETMINPOSITION on top-level windows. 00750 */ 00751 if (TestwndChild(pwnd) && pcp->fDragged) 00752 pwp->flags |= WPF_SETMINPOSITION; 00753 00754 if (pcp->fWasMaximizedBeforeMinimized || TestWF(pwnd, WFMAXIMIZED)) 00755 pwp->flags |= WPF_RESTORETOMAXIMIZED; 00756 00757 pwp->length = sizeof(WINDOWPLACEMENT); 00758 00759 return TRUE; 00760 }

BOOL _GetWinStationInfo WSINFO *  pWsInfo  ) 
 

Definition at line 872 of file w32/ntuser/kernel/misc.c.

References CheckCritIn, DATAALIGN, FALSE, gWinStationInfo, ProbeForWrite(), and TRUE.

00874 { 00875 CheckCritIn(); 00876 00877 try { 00878 00879 ProbeForWrite(pWsInfo, sizeof(gWinStationInfo), DATAALIGN); 00880 RtlCopyMemory(pWsInfo, &gWinStationInfo, sizeof(gWinStationInfo)); 00881 00882 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00883 return FALSE; 00884 } 00885 00886 return TRUE; 00887 }

PCLS _GetWOWClass HANDLE  hModule,
LPCWSTR  lpszClassName
 

Definition at line 616 of file class.c.

References CheckCritInShared, GetClassPtr(), NULL, tagCLS::pclsClone, tagCLS::pclsNext, tagTHREADINFO::ppi, PtiCurrentShared, tagTHREADINFO::rpdesk, tagCLS::rpdeskParent, and UserFindAtom().

Referenced by NtUserGetWOWClass().

00619 { 00620 PCLS pcls; 00621 PPCLS ppcls = NULL; 00622 ATOM atomT; 00623 PTHREADINFO ptiCurrent; 00624 00625 CheckCritInShared(); 00626 00627 ptiCurrent = PtiCurrentShared(); 00628 00629 /* 00630 * Is this class registered as a private class? 00631 */ 00632 atomT = UserFindAtom(ccxlpszClassName); 00633 if (atomT != 0) 00634 ppcls = GetClassPtr(atomT, ptiCurrent->ppi, hModule); 00635 if (ppcls == NULL) { 00636 RIPERR0(ERROR_CLASS_DOES_NOT_EXIST, RIP_VERBOSE, ""); 00637 return NULL; 00638 } 00639 00640 pcls = *ppcls; 00641 00642 if (ptiCurrent->rpdesk != pcls->rpdeskParent) { 00643 pcls = pcls->pclsClone; 00644 while (pcls != NULL) { 00645 if (ptiCurrent->rpdesk == pcls->rpdeskParent) { 00646 goto Done; 00647 } 00648 pcls = pcls->pclsNext; 00649 } 00650 RIPERR0(ERROR_CLASS_DOES_NOT_EXIST, RIP_VERBOSE, ""); 00651 return NULL; 00652 } 00653 Done: 00654 return pcls; 00655 }

BOOL _ImpersonateDdeClientWindow PWND  pwndClient,
PWND  pwndServer
 

Definition at line 2256 of file kernel/ddetrack.c.

References BOOL, tagDDEIMP::ClientContext, FALSE, FindDdeConv(), NT_SUCCESS, NTSTATUS(), NULL, tagDDECONV::pddei, PsGetCurrentThread, SeImpersonateClientEx(), Status, and TRUE.

Referenced by NtUserImpersonateDdeClientWindow().

02259 { 02260 PDDECONV pDdeConv; 02261 NTSTATUS Status; 02262 02263 /* 02264 * Locate token used in the conversation 02265 */ 02266 pDdeConv = FindDdeConv(pwndClient, pwndServer); 02267 if (pDdeConv == NULL || pDdeConv->pddei == NULL) 02268 return(FALSE); 02269 02270 /* 02271 * Stick the token into the dde server thread 02272 */ 02273 Status = SeImpersonateClientEx(&pDdeConv->pddei->ClientContext, 02274 PsGetCurrentThread()); 02275 if (!NT_SUCCESS(Status)) { 02276 RIPNTERR0(Status, RIP_VERBOSE, ""); 02277 return FALSE; 02278 } 02279 return TRUE; 02280 }

PSBINFO _InitPwSB PWND   ) 
 

Definition at line 183 of file miscutil.c.

References DesktopAlloc(), DTAG_SBINFO, tagWND::head, tagSBINFO::Horz, NULL, tagSBDATA::posMax, tagWND::pSBInfo, SBINFO, and tagSBINFO::Vert.

Referenced by CalcSBStuff(), xxxDefWindowProc(), xxxEnableWndSBArrows(), xxxSetScrollBar(), and xxxShowScrollBar().

00185 { 00186 if (pwnd->pSBInfo) { 00187 00188 /* 00189 * If memory is already allocated, don't bother to do it again. 00190 */ 00191 return pwnd->pSBInfo; 00192 } 00193 00194 pwnd->pSBInfo = (PSBINFO)DesktopAlloc(pwnd->head.rpdesk, 00195 sizeof(SBINFO), 00196 DTAG_SBINFO); 00197 00198 if (pwnd->pSBInfo != NULL) { 00199 00200 /* 00201 * rgw[0] = 0; */ /* LPTR zeros all 6 words 00202 */ 00203 00204 /* 00205 * rgw[1] = 0; 00206 */ 00207 00208 /* 00209 * rgw[3] = 0; 00210 */ 00211 00212 /* 00213 * rgw[4] = 0; 00214 */ 00215 pwnd->pSBInfo->Vert.posMax = 100; 00216 pwnd->pSBInfo->Horz.posMax = 100; 00217 } 00218 00219 return pwnd->pSBInfo; 00220 }

PPCLS _InnerGetClassPtr ATOM  atom,
PPCLS  ppclsList,
HANDLE  hModule
 

Definition at line 997 of file class.c.

References CSF_WOWDEFERDESTROY, and NULL.

Referenced by _UnregisterClass(), GetClassPtr(), and InternalRegisterClassEx().

01001 { 01002 if (atom == 0) 01003 return NULL; 01004 01005 while (*ppcls != NULL) { 01006 if ((*ppcls)->atomClassName == atom && 01007 (hModule == NULL || HIWORD((ULONG_PTR)(*ppcls)->hModule) == HIWORD((ULONG_PTR)hModule)) && 01008 !((*ppcls)->CSF_flags & CSF_WOWDEFERDESTROY)) { 01009 return ppcls; 01010 } 01011 01012 ppcls = (PPCLS)*ppcls; 01013 } 01014 01015 return NULL; 01016 }

BOOL _InternalGetIconInfo IN PCURSOR  pcur,
OUT PICONINFO  piconinfo,
OUT OPTIONAL PUNICODE_STRING  pstrModName,
OUT OPTIONAL PUNICODE_STRING  pstrResName,
OUT OPTIONAL LPDWORD  pbpp,
IN BOOL  fInternalCursor
 

Definition at line 395 of file loadbits.c.

References BOOL, CURSORF_ACON, FALSE, ghdcMem, ghdcMem2, HDCBITS, IS_PTR, NULL, PTR_TO_ID, RtlCopyUnicodeString(), TRUE, UserGetAtomName(), and USHORT.

Referenced by GetCursorHeight(), and NtUserGetIconInfo().

00402 { 00403 HBITMAP hbmBitsT; 00404 HBITMAP hbmDstT; 00405 HBITMAP hbmMask; 00406 HBITMAP hbmColor; 00407 00408 /* 00409 * Note -- while the STRING structures are in kernel mode memory, the 00410 * buffers are in user-mode memory. So all use of the buffers should 00411 * be protected bytry blocks. 00412 */ 00413 00414 /* 00415 * If this is an animated cursor, just grab the first frame and return 00416 * the info for it. 00417 */ 00418 if (pcur->CURSORF_flags & CURSORF_ACON) 00419 pcur = ((PACON)pcur)->aspcur[0]; 00420 00421 /* 00422 * Make copies of the bitmaps 00423 * 00424 * If the color bitmap is around, then there is no XOR mask in the 00425 * hbmMask bitmap. 00426 */ 00427 hbmMask = GreCreateBitmap( 00428 pcur->cx, 00429 (pcur->hbmColor && !fInternalCursor) ? pcur->cy / 2 : pcur->cy, 00430 1, 00431 1, 00432 NULL); 00433 00434 if (hbmMask == NULL) 00435 return FALSE; 00436 00437 00438 hbmColor = NULL; 00439 00440 if (pcur->hbmColor != NULL) { 00441 00442 hbmColor = GreCreateCompatibleBitmap(HDCBITS(), 00443 pcur->cx, 00444 pcur->cy / 2); 00445 00446 if (hbmColor == NULL) { 00447 GreDeleteObject(hbmMask); 00448 return FALSE; 00449 } 00450 } 00451 00452 hbmBitsT = GreSelectBitmap(ghdcMem2, pcur->hbmMask); 00453 hbmDstT = GreSelectBitmap(ghdcMem, hbmMask); 00454 00455 GreBitBlt(ghdcMem, 00456 0, 00457 0, 00458 pcur->cx, 00459 (pcur->hbmColor && !fInternalCursor) ? pcur->cy / 2 : pcur->cy, 00460 ghdcMem2, 00461 0, 00462 0, 00463 SRCCOPY, 00464 0x00ffffff); 00465 00466 if (hbmColor != NULL) { 00467 00468 GreSelectBitmap(ghdcMem2, pcur->hbmColor); 00469 GreSelectBitmap(ghdcMem, hbmColor); 00470 00471 GreBitBlt(ghdcMem, 00472 0, 00473 0, 00474 pcur->cx, 00475 pcur->cy / 2, 00476 ghdcMem2, 00477 0, 00478 0, 00479 SRCCOPY, 00480 0); 00481 } 00482 00483 GreSelectBitmap(ghdcMem2, hbmBitsT); 00484 GreSelectBitmap(ghdcMem, hbmDstT); 00485 00486 /* 00487 * Fill in the iconinfo structure. make copies of the bitmaps. 00488 */ 00489 try { 00490 00491 ccxpiconinfo->fIcon = (pcur->rt == PTR_TO_ID(RT_ICON)); 00492 ccxpiconinfo->xHotspot = pcur->xHotspot; 00493 ccxpiconinfo->yHotspot = pcur->yHotspot; 00494 ccxpiconinfo->hbmMask = hbmMask; 00495 ccxpiconinfo->hbmColor = hbmColor; 00496 00497 if (pstrInstanceName != NULL) { 00498 00499 if (pcur->atomModName) { 00500 pstrInstanceName->Length = (USHORT) 00501 UserGetAtomName(pcur->atomModName, 00502 pstrInstanceName->Buffer, 00503 (int) (pstrInstanceName->MaximumLength / sizeof(WCHAR)) 00504 * sizeof(WCHAR)); 00505 } else { 00506 pstrInstanceName->Length = 0; 00507 } 00508 } 00509 00510 if (pstrResName != NULL) { 00511 00512 if (IS_PTR(pcur->strName.Buffer)) { 00513 RtlCopyUnicodeString(pstrResName, &pcur->strName); 00514 } else { 00515 *pstrResName = pcur->strName; 00516 } 00517 } 00518 00519 if (ccxpbpp) 00520 *ccxpbpp = pcur->bpp; 00521 00522 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00523 GreDeleteObject(hbmMask); 00524 GreDeleteObject(hbmColor); 00525 return FALSE; 00526 } 00527 00528 return TRUE; 00529 }

BOOL _IsClipboardFormatAvailable UINT  fmt  ) 
 

NTSTATUS _KeUserModeCallback IN ULONG  ApiNumber,
IN PVOID  InputBuffer,
IN ULONG  InputLength,
OUT PVOID *  OutputBuffer,
OUT PULONG  OutputLength
 

BOOL _KillSystemTimer PWND  pwnd,
UINT_PTR  nIDEvent
 

Definition at line 431 of file timers.c.

References BOOL, KillTimer2(), and TRUE.

Referenced by _SetCaretBlinkTime(), CaretBlinkProc(), DecrementRedirectedCount(), StopFade(), TrackMouseEvent(), xxxCancelMouseMoveTracking(), xxxEndScroll(), xxxFlashWindow(), xxxSystemTimerProc(), zzzInternalDestroyCaret(), and zzzSetCaretPos().

00434 { 00435 return KillTimer2(pwnd, nIDEvent, TRUE); 00436 }

BOOL _KillTimer PWND  pwnd,
UINT_PTR  nIDEvent
 

Definition at line 414 of file timers.c.

References BOOL, FALSE, and KillTimer2().

Referenced by KillTooltipTimer(), MNAnimate(), NtUserKillTimer(), xxxMenuWindowProc(), xxxMNCloseHierarchy(), xxxMNDestroyHandler(), xxxMNDoScroll(), xxxMNOpenHierarchy(), xxxMNSelectItem(), and xxxTrackPopupMenuEx().

00417 { 00418 return KillTimer2(pwnd, nIDEvent, FALSE); 00419 }

VOID _LoadCursorsAndIcons VOID   ) 
 

Definition at line 1568 of file w32/ntuser/kernel/init.c.

References CURSORF_LRSHARED, FALSE, gasyscur, gasysico, gpcurFirst, gpepCSRSS, gpsi, HH_LOADCURSORS, HYDRA_HINT, tagSYSCFGICO::Id, IS_PTR, Lock, NULL, PsGetCurrentProcess, PtoH, PTR_TO_ID, SYSICO, SYSMET, and VOID().

01569 { 01570 PCURSOR pcur; 01571 int i; 01572 01573 pcur = gpcurFirst; 01574 01575 /* 01576 * Only CSR can call this (and only once). 01577 */ 01578 if (PsGetCurrentProcess() != gpepCSRSS) { 01579 return; 01580 } 01581 01582 HYDRA_HINT(HH_LOADCURSORS); 01583 01584 while (pcur) { 01585 01586 UserAssert(!IS_PTR(pcur->strName.Buffer)); 01587 01588 switch (pcur->rt) { 01589 case RT_ICON: 01590 UserAssert((LONG_PTR)pcur->strName.Buffer >= OIC_FIRST_DEFAULT); 01591 01592 UserAssert((LONG_PTR)pcur->strName.Buffer < 01593 OIC_FIRST_DEFAULT + COIC_CONFIGURABLE); 01594 01595 i = PTR_TO_ID(pcur->strName.Buffer) - OIC_FIRST_DEFAULT; 01596 pcur->strName.Buffer = (LPWSTR)gasysico[i].Id; 01597 01598 if (pcur->CURSORF_flags & CURSORF_LRSHARED) { 01599 UserAssert(gasysico[i].spcur == NULL); 01600 Lock(&gasysico[i].spcur, pcur); 01601 } else { 01602 UserAssert(gpsi->hIconSmWindows == NULL); 01603 UserAssert((int)pcur->cx == SYSMET(CXSMICON)); 01604 /* 01605 * The special small winlogo icon is not shared. 01606 */ 01607 gpsi->hIconSmWindows = PtoH(pcur); 01608 } 01609 break; 01610 01611 case RT_CURSOR: 01612 UserAssert((LONG_PTR)pcur->strName.Buffer >= OCR_FIRST_DEFAULT); 01613 01614 UserAssert((LONG_PTR)pcur->strName.Buffer < 01615 OCR_FIRST_DEFAULT + COCR_CONFIGURABLE); 01616 01617 i = PTR_TO_ID(pcur->strName.Buffer) - OCR_FIRST_DEFAULT; 01618 pcur->strName.Buffer = (LPWSTR)gasyscur[i].Id; 01619 Lock(&gasyscur[i].spcur ,pcur); 01620 break; 01621 01622 default: 01623 UserAssert(FALSE); // should be nothing in the cache but these! 01624 } 01625 01626 pcur = pcur->pcurNext; 01627 } 01628 01629 /* 01630 * copy special icon handles to global spots for later use. 01631 */ 01632 gpsi->hIcoWindows = PtoH(SYSICO(WINLOGO)); 01633 }

BOOL _LockSetForegroundWindow UINT  uLockCode  ) 
 

Definition at line 1167 of file focusact.c.

References BOOL, CanForceForeground(), DWORD, FALSE, gppiLockSFW, NULL, PpiCurrent, and TRUE.

01169 { 01170 DWORD dwError; 01171 PPROCESSINFO ppiCurrent = PpiCurrent(); 01172 01173 switch (uLockCode) { 01174 case LSFW_LOCK: 01175 /* 01176 * If the caller cannot lock it or already locked, fail the call 01177 */ 01178 if (CanForceForeground(ppiCurrent) && (gppiLockSFW == NULL)) { 01179 gppiLockSFW = ppiCurrent; 01180 TAGMSG1(DBGTAG_FOREGROUND, "_LockSetForegroundWindow locked by %#p", ppiCurrent); 01181 } else { 01182 dwError = ERROR_ACCESS_DENIED; 01183 goto FailIt; 01184 } 01185 break; 01186 01187 case LSFW_UNLOCK: 01188 /* 01189 * If the caller didn't lock it, fail the call 01190 */ 01191 if (ppiCurrent == gppiLockSFW) { 01192 gppiLockSFW = NULL; 01193 TAGMSG0(DBGTAG_FOREGROUND, "_LockSetForegroundWindow UNLOCKED"); 01194 } else { 01195 dwError = ERROR_ACCESS_DENIED; 01196 goto FailIt; 01197 } 01198 break; 01199 01200 default: 01201 dwError = ERROR_INVALID_PARAMETER; 01202 goto FailIt; 01203 } 01204 01205 return TRUE; 01206 01207 FailIt: 01208 RIPERR0(dwError, RIP_VERBOSE, ""); 01209 return FALSE; 01210 }

UINT _LockWindowStation PWINDOWSTATION  pwinsta  ) 
 

Definition at line 57 of file logon.c.

References BOOL, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetCurrentProcessId, gpidLogon, grpdeskLogon, NULL, OBJECT_TO_OBJECT_HEADER, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, TRUE, UINT, WSF_OPENLOCK, WSF_SHUTDOWN, and WSF_SWITCHLOCK.

Referenced by NtUserLockWindowStation().

00059 { 00060 PDESKTOP pdesk; 00061 BOOL fBusy = FALSE; 00062 00063 /* 00064 * Make sure the caller is the logon process 00065 */ 00066 if (GetCurrentProcessId() != gpidLogon) { 00067 RIPERR0(ERROR_ACCESS_DENIED, 00068 RIP_WARNING, 00069 "Access denied in _LockWindowStation"); 00070 00071 return WSS_ERROR; 00072 } 00073 00074 /* 00075 * Prevent desktop switches 00076 */ 00077 pwinsta->dwWSF_Flags |= WSF_SWITCHLOCK; 00078 00079 /* 00080 * Determine whether the station is busy 00081 */ 00082 pdesk = pwinsta->rpdeskList; 00083 while (pdesk != NULL) { 00084 if (pdesk != grpdeskLogon && 00085 OBJECT_TO_OBJECT_HEADER(pdesk)->HandleCount != 0) { 00086 00087 /* 00088 * This desktop is open, thus the station is busy 00089 */ 00090 fBusy = TRUE; 00091 break; 00092 } 00093 pdesk = pdesk->rpdeskNext; 00094 } 00095 00096 if (pwinsta->dwWSF_Flags & WSF_SHUTDOWN) 00097 pwinsta->dwWSF_Flags |= WSF_OPENLOCK; 00098 00099 /* 00100 * Unlock opens if the station is busy and is not in the middle 00101 * of shutting down. 00102 */ 00103 if (fBusy) 00104 return WSS_BUSY; 00105 else 00106 return WSS_IDLE; 00107 }

BOOL _LockWorkStation VOID   ) 
 

Definition at line 1517 of file winsta.c.

References _PostMessage(), BOOL, gspwndLogonNotify, NULL, and TRUE.

Referenced by NtUserLockWorkStation().

01519 { 01520 UserAssert(gspwndLogonNotify != NULL); 01521 01522 _PostMessage(gspwndLogonNotify, 01523 WM_LOGONNOTIFY, LOGON_LOCKWORKSTATION, 0); 01524 01525 return TRUE; 01526 }

PVOID _MapDesktopObject HANDLE  h  ) 
 

Definition at line 2798 of file desktop.c.

References GetDesktopView(), HMObjectFlags, HMValidateHandle(), NULL, OCF_DESKTOPHEAP, PBYTE, PDESKOBJHEAD, PpiCurrent, TYPE_GENERIC, and tagDESKTOPVIEW::ulClientDelta.

02800 { 02801 PDESKOBJHEAD pobj; 02802 PDESKTOPVIEW pdv; 02803 02804 /* 02805 * Validate the handle 02806 */ 02807 pobj = HMValidateHandle(h, TYPE_GENERIC); 02808 if (pobj == NULL) 02809 return NULL; 02810 02811 UserAssert(HMObjectFlags(pobj) & OCF_DESKTOPHEAP); 02812 02813 /* 02814 * Locate the client's view of the desktop. Realistically, 02815 * this should never fail for valid objects. 02816 */ 02817 pdv = GetDesktopView(PpiCurrent(), pobj->rpdesk); 02818 if (pdv == NULL) { 02819 RIPMSG1(RIP_WARNING, "MapDesktopObject: can not map handle %#p", h); 02820 return NULL; 02821 } 02822 02823 UserAssert(pdv->ulClientDelta != 0); 02824 return (PVOID)((PBYTE)pobj - pdv->ulClientDelta); 02825 }

__inline UINT _MNGetpItemIndex PMENU  pmenu,
PITEM  pitem
 

Definition at line 4894 of file userk.h.

References UINT.

04905 {return (UINT)(((ULONG_PTR)pitem - (ULONG_PTR)pmenu->rgItems) / sizeof(ITEM));}

HWINSTA _OpenWindowStation POBJECT_ATTRIBUTES  ,
DWORD  ,
KPROCESSOR_MODE 
 

Definition at line 1019 of file winsta.c.

References ExWindowStationObjectType, NT_SUCCESS, NTSTATUS(), NULL, ObOpenObjectByName(), and Status.

Referenced by _UserTestForWinStaAccess(), NtUserOpenWindowStation(), xxxResolveDesktop(), and xxxResolveDesktopForWOW().

01023 { 01024 HWINSTA hwinsta; 01025 NTSTATUS Status; 01026 01027 /* 01028 * Obja is client-side. Ob interfaces protect and capture is 01029 * appropriate. 01030 */ 01031 Status = ObOpenObjectByName( 01032 pObjA, 01033 *ExWindowStationObjectType, 01034 AccessMode, 01035 NULL, 01036 dwDesiredAccess, 01037 NULL, 01038 &hwinsta); 01039 if (!NT_SUCCESS(Status)) { 01040 RIPNTERR0(Status, RIP_VERBOSE, ""); 01041 hwinsta = NULL; 01042 } 01043 return hwinsta; 01044 }

BOOL _PostMessage PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 981 of file ntuser/kernel/input.c.

References _PostThreadMessage(), AdjustForCoalescing(), AllocQEntry(), BMSG_POSTMSG, BOOL, DO_POST, DWORD, FALSE, GETPTI, HWq, tagQ::idSysLock, tagTHREADINFO::mlPost, NULL, PostUpdateKeyStateEvent(), tagTHREADINFO::pq, PtiCurrent, tagQ::ptiSysLock, PWND_BROADCAST, SetWakeBit(), StoreQMessage(), TESTSYNCONLYMESSAGE, ThreadLockAlwaysWithPti, ThreadUnlock, TRUE, xxxBroadcastMessage(), and xxxDDETrackPostHook().

Referenced by _LockWorkStation(), AbnormalDDEPost(), DestroyTask(), FreeDdeConv(), HighContrastHotKey(), IdleTimerProc(), NotifyLogon(), NtUserEndMenu(), NtUserPostMessage(), PlayEventSound(), PostAccessNotification(), PostShellHookMessages(), RemoteLogoff(), RemoteNtSecurity(), StartScreenSaver(), TrackMouseEvent(), xxxAccessTimeOutTimer(), xxxButtonEvent(), xxxCancelMouseMoveTracking(), xxxCancelTrackingForThread(), xxxDDETrackSendHook(), xxxDDETrackWindowDying(), xxxDefWindowProc(), xxxDestroyThreadInfo(), xxxDoHotKeyStuff(), xxxDWP_ProcessVirtKey(), xxxFlashWindow(), xxxHandleMenuMessages(), xxxImmProcessKey(), xxxMenuWindowProc(), xxxMessageBeep(), xxxMinMaximize(), xxxMNCancel(), xxxMNLoop(), xxxMNStartMenuState(), xxxNextWindow(), xxxOldNextWindow(), xxxProcessEventMessage(), xxxRemoteDisconnect(), xxxRemoteReconnect(), xxxScanSysQueue(), xxxSendBSMtoDesktop(), xxxSysCommand(), xxxSystemParametersInfo(), xxxSystemTimerProc(), xxxTranslateMessage(), and xxxUserPowerEventCalloutWorker().

00986 { 00987 PQMSG pqmsg; 00988 BOOL fPwndUnlock; 00989 BOOL fRet; 00990 DWORD dwPostCode; 00991 TL tlpwnd; 00992 PTHREADINFO pti; 00993 00994 /* 00995 * First check to see if this message takes DWORDs only. If it does not, 00996 * fail the post. Cannot allow an app to post a message with pointers or 00997 * handles in it - this can cause the server to fault and cause other 00998 * problems - such as causing apps in separate address spaces to fault. 00999 * (or even an app in the same address space to fault!) 01000 */ 01001 if (TESTSYNCONLYMESSAGE(message, wParam)) { 01002 RIPERR1(ERROR_MESSAGE_SYNC_ONLY, 01003 RIP_WARNING, 01004 "Invalid parameter \"message\" (%ld) to _PostMessage", 01005 message); 01006 01007 return FALSE; 01008 } 01009 01010 /* 01011 * Is this a BroadcastMsg()? 01012 */ 01013 if (pwnd == PWND_BROADCAST) { 01014 xxxBroadcastMessage(NULL, message, wParam, lParam, BMSG_POSTMSG, NULL); 01015 return TRUE; 01016 } 01017 01018 pti = PtiCurrent(); 01019 01020 /* 01021 * Is this posting to the current thread info? 01022 */ 01023 if (pwnd == NULL) { 01024 return _PostThreadMessage(pti, message, wParam, lParam); 01025 } 01026 01027 fPwndUnlock = FALSE; 01028 if (message >= WM_DDE_FIRST && message <= WM_DDE_LAST) { 01029 ThreadLockAlwaysWithPti(pti, pwnd, &tlpwnd); 01030 dwPostCode = xxxDDETrackPostHook(&message, pwnd, wParam, &lParam, FALSE); 01031 01032 if (dwPostCode != DO_POST) { 01033 ThreadUnlock(&tlpwnd); 01034 return (BOOL)dwPostCode; 01035 } 01036 01037 fPwndUnlock = TRUE; 01038 } 01039 01040 pti = GETPTI(pwnd); 01041 01042 /* 01043 * Check to see if this message is in the multimedia coalescing range. 01044 * If so, see if it can be coalesced with the previous message. 01045 */ 01046 AdjustForCoalescing(&pti->mlPost, HWq(pwnd), message); 01047 01048 /* 01049 * Allocate a key state update event if needed. 01050 */ 01051 if (message >= WM_KEYFIRST && message <= WM_KEYLAST) { 01052 PostUpdateKeyStateEvent(pti->pq); 01053 } 01054 01055 /* 01056 * Put this message on the 'post' list. 01057 */ 01058 fRet = FALSE; 01059 if ((pqmsg = AllocQEntry(&pti->mlPost)) != NULL) { 01060 /* 01061 * Set the QS_POSTMESSAGE bit so the thread knows it has a message. 01062 */ 01063 StoreQMessage(pqmsg, pwnd, message, wParam, lParam, 0, 0, 0); 01064 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 01065 01066 /* 01067 * If it's a hotkey, set the QS_HOTKEY bit since we have a separate 01068 * bit for those messages. 01069 */ 01070 if (message == WM_HOTKEY) 01071 SetWakeBit(pti, QS_HOTKEY); 01072 01073 fRet = TRUE; 01074 } else { 01075 RIPMSG1(RIP_WARNING, "_PostMessage: Failed to alloc Q entry: target pti=0x%p", 01076 pti); 01077 } 01078 01079 /* 01080 * Are we posting to the thread currently reading from the input queue? 01081 * If so, update idSysLock with this pqmsg so that the input queue will 01082 * not be unlocked until this message is read. 01083 */ 01084 if (pti == pti->pq->ptiSysLock) 01085 pti->pq->idSysLock = (ULONG_PTR)pqmsg; 01086 01087 if (fPwndUnlock) 01088 ThreadUnlock(&tlpwnd); 01089 01090 return fRet; 01091 }

BOOL _PostQuitMessage int  nExitCode  ) 
 

Definition at line 1109 of file ntuser/kernel/input.c.

References BOOL, IPostQuitMessage(), and PtiCurrent.

Referenced by xxxFreeWindow().

01110 { 01111 return IPostQuitMessage(PtiCurrent(), nExitCode); 01112 }

BOOL _PostThreadMessage PTHREADINFO  pti,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1123 of file ntuser/kernel/input.c.

References AdjustForCoalescing(), AllocQEntry(), BOOL, FALSE, tagQ::idSysLock, tagTHREADINFO::mlPost, NULL, tagTHREADINFO::pq, tagQ::ptiSysLock, SetWakeBit(), StoreQMessage(), TESTSYNCONLYMESSAGE, tagTHREADINFO::TIF_flags, TIF_GUITHREADINITIALIZED, TIF_INCLEANUP, and TRUE.

Referenced by _PostMessage(), EndShutdown(), InitiateWin32kCleanup(), NtUserPostThreadMessage(), TerminateConsole(), xxxDoHotKeyStuff(), xxxSysCommand(), and zzzCancelJournalling().

01128 { 01129 PQMSG pqmsg; 01130 01131 if ((pti == NULL) || 01132 !(pti->TIF_flags & TIF_GUITHREADINITIALIZED) || 01133 (pti->TIF_flags & TIF_INCLEANUP)) { 01134 01135 RIPERR0(ERROR_INVALID_THREAD_ID, RIP_VERBOSE, ""); 01136 return FALSE; 01137 } 01138 01139 /* 01140 * First check to see if this message takes DWORDs only. If it does not, 01141 * fail the post. Cannot allow an app to post a message with pointers or 01142 * handles in it - this can cause the server to fault and cause other 01143 * problems - such as causing apps in separate address spaces to fault. 01144 * (or even an app in the same address space to fault!) 01145 */ 01146 if (TESTSYNCONLYMESSAGE(message, wParam)) { 01147 RIPERR1(ERROR_MESSAGE_SYNC_ONLY, 01148 RIP_WARNING, 01149 "Invalid parameter \"message\" (%ld) to _PostThreadMessage", 01150 message); 01151 01152 return FALSE; 01153 } 01154 01155 /* 01156 * Check to see if this message is in the multimedia coalescing range. 01157 * If so, see if it can be coalesced with the previous message. 01158 */ 01159 AdjustForCoalescing(&pti->mlPost, NULL, message); 01160 01161 /* 01162 * Put this message on the 'post' list. 01163 */ 01164 if ((pqmsg = AllocQEntry(&pti->mlPost)) == NULL) { 01165 RIPMSG1(RIP_WARNING, "_PostThreadMessage: Failed to alloc Q entry: Target pti=0x%p", 01166 pti); 01167 return FALSE; 01168 } 01169 01170 /* 01171 * Set the QS_POSTMESSAGE bit so the thread knows it has a message. 01172 */ 01173 StoreQMessage(pqmsg, NULL, message, wParam, lParam, 0, 0, 0); 01174 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 01175 01176 /* 01177 * If it's a hotkey, set the QS_HOTKEY bit since we have a separate 01178 * bit for those messages. 01179 */ 01180 if (message == WM_HOTKEY) 01181 SetWakeBit(pti, QS_HOTKEY); 01182 01183 /* 01184 * Are we posting to the thread currently reading from the input queue? 01185 * If so, update idSysLock with this pqmsg so that the input queue will 01186 * not be unlocked until this message is read. 01187 */ 01188 if (pti == pti->pq->ptiSysLock) 01189 pti->pq->idSysLock = (ULONG_PTR)pqmsg; 01190 01191 return TRUE; 01192 }

VOID _QueryUserHandles IN LPDWORD  lpIn,
IN DWORD  dwInLength,
OUT DWORD  pdwResult[][TYPE_CTYPES]
 

Referenced by NtUserQueryUserCounters().

PWND _RealChildWindowFromPoint PWND  pwndParent,
POINT  pt
 

Definition at line 505 of file winable2.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, BFTYPEMASK, FNID_BUTTON, GETFNID, gpsi, tagWND::hrgnClip, ICLS_BUTTON, LOBYTE, NULL, tagWND::pcls, PtInRect(), PWNDDESKTOP, tagWND::rcClient, tagWND::rcWindow, tagWND::spwndChild, tagWND::spwndNext, TestWF, and WFVISIBLE.

Referenced by NtUserRealChildWindowFromPoint().

00506 { 00507 PWND pwndChild; 00508 PWND pwndSave; 00509 00510 if (pwndParent != PWNDDESKTOP(pwndParent)) { 00511 pt.x += pwndParent->rcClient.left; 00512 pt.y += pwndParent->rcClient.top; 00513 } 00514 00515 /* 00516 * Is this point even in the parent? 00517 */ 00518 if (!PtInRect(&pwndParent->rcClient, pt) || 00519 (pwndParent->hrgnClip && !GrePtInRegion(pwndParent->hrgnClip, pt.x, pt.y))) { 00520 // Nope 00521 return NULL; 00522 } 00523 00524 pwndSave = NULL; 00525 00526 /* 00527 * Loop through the children. 00528 */ 00529 for (pwndChild = pwndParent->spwndChild; pwndChild; pwndChild = pwndChild->spwndNext) { 00530 if (!TestWF(pwndChild, WFVISIBLE)) 00531 continue; 00532 00533 /* 00534 * Is this point in the child's window? 00535 */ 00536 if (!PtInRect(&pwndChild->rcWindow, pt) || 00537 (pwndChild->hrgnClip && !GrePtInRegion(pwndChild->hrgnClip, pt.x, pt.y))) 00538 continue; 00539 00540 /* 00541 * OK, we are in somebody's window. Is this by chance a group box? 00542 */ 00543 if ((pwndChild->pcls->atomClassName == gpsi->atomSysClass[ICLS_BUTTON]) || 00544 (GETFNID(pwndChild) == FNID_BUTTON)) { 00545 if (TestWF(pwndChild, BFTYPEMASK) == LOBYTE(BS_GROUPBOX)) { 00546 pwndSave = pwndChild; 00547 continue; 00548 } 00549 } 00550 00551 return pwndChild; 00552 } 00553 00554 /* 00555 * Did we save a groupbox which turned out to have nothing behind it 00556 * at that point? 00557 */ 00558 if (pwndSave) { 00559 return pwndSave; 00560 } else { 00561 return pwndParent; 00562 } 00563 }

BOOL _RegisterHotKey PWND  pwnd,
int  id,
UINT  fsModifiers,
UINT  vk
 

Definition at line 125 of file hotkeys.c.

References BOOL, CheckWinstaWriteAttributesAccess(), FALSE, FindHotKey(), tagHOTKEY::fsModifiers, GETPTI, gfsSASModifiers, gpepCSRSS, gphkFirst, gpidLogon, grpWinStaList, gvkSAS, HOTKEY, tagHOTKEY::id, Lock, NULL, tagHOTKEY::phkNext, PsGetCurrentProcess, tagHOTKEY::pti, PtiCurrent, PWND_FOCUS, PWND_INPUTOWNER, tagHOTKEY::spwnd, TRUE, tagHOTKEY::vk, and tagHOTKEY::wFlags.

Referenced by NtUserRegisterHotKey(), RawInputThread(), SetDebugHotKeys(), and xxxSetShellWindow().

00130 { 00131 PHOTKEY phk; 00132 BOOL fKeysExist; 00133 PTHREADINFO ptiCurrent; 00134 BOOL bSAS = FALSE; 00135 WORD wFlags; 00136 00137 wFlags = fsModifiers & MOD_SAS; 00138 fsModifiers &= ~MOD_SAS; 00139 00140 ptiCurrent = PtiCurrent(); 00141 00142 /* 00143 * Blow it off if the caller is not the windowstation init thread 00144 * and doesn't have the proper access rights 00145 */ 00146 if (PsGetCurrentProcess() != gpepCSRSS) { 00147 if (grpWinStaList && !CheckWinstaWriteAttributesAccess()) { 00148 return FALSE; 00149 } 00150 } 00151 00152 /* 00153 * If VK_PACKET is specified, just bail out, since VK_PACKET is 00154 * not a real keyboard input. 00155 */ 00156 if (vk == VK_PACKET) { 00157 return FALSE; 00158 } 00159 00160 /* 00161 * If this is the SAS check that winlogon is the one registering it. 00162 */ 00163 if (wFlags & MOD_SAS) { 00164 if (PsGetCurrentProcess()->UniqueProcessId == gpidLogon) { 00165 bSAS = TRUE; 00166 } 00167 } 00168 00169 /* 00170 * Can't register hotkey for a window of another queue. 00171 * Return FALSE in this case. 00172 */ 00173 if ((pwnd != PWND_FOCUS) && (pwnd != PWND_INPUTOWNER)) { 00174 if (GETPTI(pwnd) != ptiCurrent) { 00175 RIPERR0(ERROR_WINDOW_OF_OTHER_THREAD, RIP_VERBOSE, ""); 00176 return FALSE; 00177 } 00178 } 00179 00180 phk = FindHotKey(ptiCurrent, pwnd, id, fsModifiers, vk, FALSE, &fKeysExist); 00181 00182 /* 00183 * If the keys have already been registered, return FALSE. 00184 */ 00185 if (fKeysExist) { 00186 RIPERR0(ERROR_HOTKEY_ALREADY_REGISTERED, RIP_WARNING, "Hotkey already exists"); 00187 return FALSE; 00188 } 00189 00190 if (phk == NULL) { 00191 /* 00192 * This hotkey doesn't exist yet. 00193 */ 00194 phk = (PHOTKEY)UserAllocPool(sizeof(HOTKEY), TAG_HOTKEY); 00195 00196 /* 00197 * If the allocation failed, bail out. 00198 */ 00199 if (phk == NULL) { 00200 return FALSE; 00201 } 00202 00203 phk->pti = ptiCurrent; 00204 00205 if ((pwnd != PWND_FOCUS) && (pwnd != PWND_INPUTOWNER)) { 00206 phk->spwnd = NULL; 00207 Lock(&phk->spwnd, pwnd); 00208 } else { 00209 phk->spwnd = pwnd; 00210 } 00211 phk->fsModifiers = (WORD)fsModifiers; 00212 phk->wFlags = wFlags; 00213 00214 phk->vk = vk; 00215 phk->id = id; 00216 00217 /* 00218 * Link the new hotkey to the front of the list. 00219 */ 00220 phk->phkNext = gphkFirst; 00221 gphkFirst = phk; 00222 00223 } else { 00224 00225 /* 00226 * Hotkey already exists, reset the keys. 00227 */ 00228 phk->fsModifiers = (WORD)fsModifiers; 00229 phk->wFlags = wFlags; 00230 phk->vk = vk; 00231 } 00232 00233 if (bSAS) { 00234 /* 00235 * store the SAS on the terminal. 00236 */ 00237 gvkSAS = vk; 00238 gfsSASModifiers = fsModifiers; 00239 } 00240 00241 return TRUE; 00242 }

BOOL _RegisterLogonProcess DWORD  dwProcessId,
BOOL  fSecure
 

Definition at line 25 of file logon.c.

References BOOL, FALSE, gpidLogon, IsPrivileged(), psTcb, and TRUE.

00028 { 00029 UNREFERENCED_PARAMETER(fSecure); 00030 00031 /* 00032 * Allow only one logon process and then only if it has TCB 00033 * privilege. 00034 */ 00035 if (gpidLogon != 0 || !IsPrivileged(&psTcb)) { 00036 RIPERR0(ERROR_ACCESS_DENIED, 00037 RIP_WARNING, 00038 "Access denied in _RegisterLogonProcess"); 00039 00040 return FALSE; 00041 } 00042 00043 gpidLogon = (HANDLE)LongToHandle( dwProcessId ); 00044 return TRUE; 00045 }

BOOL _RegisterShellHookWindow PWND  pwnd  ) 
 

Definition at line 3628 of file rare.c.

References BOOL, FALSE, tagWND::head, NULL, tagDESKTOPINFO::pvwplShellHook, SetWF, TRUE, VWPLAdd(), and WFSHELLHOOKWND.

03628 { 03629 PDESKTOPINFO pdeskinfo; 03630 03631 if (pwnd->head.rpdesk == NULL) 03632 return FALSE; 03633 03634 pdeskinfo = pwnd->head.rpdesk->pDeskInfo; 03635 03636 /* 03637 * Add pwnd to the desktop's Volatile Window Pointer List (VWPL) of 03638 * ShellHook windows. If this call initializes the VWPL, set the 03639 * (re)allocation threshhold to 2 PWNDs (we know we never have more than 03640 * 2 windows in this list anyway) 03641 */ 03642 if (VWPLAdd(&(pdeskinfo->pvwplShellHook), pwnd, 2)) { 03643 SetWF(pwnd, WFSHELLHOOKWND); 03644 return TRUE; 03645 } 03646 return FALSE; 03647 }

BOOL _RegisterTasklist PWND  pwndTasklist  ) 
 

Definition at line 583 of file syscmd.c.

References BOOL, GETPTI, ghwndSwitch, gptiTasklist, HWq, PsGetCurrentThread, TIF_DONTATTACHQUEUE, and TRUE.

Referenced by NtUserRegisterTasklist().

00585 { 00586 #ifdef LATER 00587 // 00588 // JimA - ??? Why do this? 00589 // 00590 PETHREAD Thread; 00591 00592 Thread = PsGetCurrentThread(); 00593 pRitCSRThread->ThreadHandle = Thread->ThreadHandle; 00594 #endif 00595 00596 gptiTasklist = GETPTI(pwndTasklist); 00597 ghwndSwitch = HWq(pwndTasklist); 00598 00599 /* 00600 * Don't allow an app to call AttachThreadInput() on task man - 00601 * we want taskman to be unsynchronized at all times (so the user 00602 * can bring it up and kill other apps). 00603 */ 00604 GETPTI(pwndTasklist)->TIF_flags |= TIF_DONTATTACHQUEUE; 00605 00606 return TRUE; 00607 }

BOOL _ReleaseDC HDC  hdc  ) 
 

Definition at line 183 of file dc.c.

References BOOL, CheckCritIn, DCE_NORELEASE, FALSE, ReleaseCacheDC(), and TRUE.

Referenced by _UserSoundSentryWorker(), CreateTooltipBitmap(), DrawCtlThumb(), DrawSwitchWndHilite(), InitTooltipAnimation(), InvertScrollHilite(), MNAnimate(), MNDrawArrow(), MNDrawFullNC(), StopFade(), TooltipAnimate(), TooltipGetSize(), UserReleaseDC(), UT_InvertCaret(), xxxDefWindowProc(), xxxDesktopWndProc(), xxxDrawAnimatedRects(), xxxDrawDragRect(), xxxDrawMenuBarUnderlines(), xxxDrawThumb(), xxxDWP_DoNCActivate(), xxxEnableWndSBArrows(), xxxHotTrackMenu(), xxxMenuWindowProc(), xxxMNCompute(), xxxMNInvertItem(), xxxMoveSwitchWndHilite(), xxxMoveThumb(), xxxPaintIconsInSwitchWindow(), xxxPaintSwitchWindow(), xxxRealizeDesktop(), xxxRedrawHungWindow(), xxxRedrawHungWindowFrame(), xxxRedrawTitle(), xxxSBWndProc(), xxxScrollWindowEx(), xxxSnapWindow(), xxxTrackCaptionButton(), and zzzDrawInvertScrollArea().

00185 { 00186 CheckCritIn(); 00187 00188 return (ReleaseCacheDC(hdc, FALSE) == DCE_NORELEASE ? FALSE : TRUE); 00189 }

BOOL _ReplyMessage LRESULT  lRet  ) 
 

Definition at line 198 of file kernel/sendmsg.c.

References BOOL, CheckCritIn, DirectedScheduleTask(), tagINTERSENDMSGEX::dwData, FALSE, tagINTERSENDMSGEX::fuCall, INTRSENDMSGEX, ISM_CALLBACK, ISM_CB_CLIENT, ISM_REPLY, L, tagINTERSENDMSGEX::lpResultCallBack, tagINTERSENDMSGEX::lRet, NULL, PSMS, tagTHREADINFO::psmsCurrent, PtiCurrent, SetWakeBit(), SMF_CB_CLIENT, SMF_CB_REQUEST, SMF_REPLY, SMF_SENDERDIED, ThreadLockWithPti, ThreadUnlock, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, xxxInterSendMsgEx(), and xxxSleepTask().

00200 { 00201 PTHREADINFO ptiCurrent; 00202 PSMS psms; 00203 00204 CheckCritIn(); 00205 00206 ptiCurrent = PtiCurrent(); 00207 00208 /* 00209 * Are we processing a SendMessage? 00210 */ 00211 psms = ptiCurrent->psmsCurrent; 00212 if (psms == NULL) 00213 return FALSE; 00214 00215 /* 00216 * See if the reply has been made already. 00217 */ 00218 if (psms->flags & SMF_REPLY) 00219 return FALSE; 00220 00221 /* 00222 * Blow off the rest of the call if the SMS came 00223 * from xxxSendNotifyMessage(). Obviously there's 00224 * no one around to reply to in the case. 00225 */ 00226 if (psms->ptiSender != NULL) { 00227 00228 /* 00229 * Reply to this message. The sender should not free the SMS 00230 * because the receiver still considers it valid. Thus we 00231 * mark it with a special bit indicating it has been replied 00232 * to. We wait until both the sender and receiver are done 00233 * with the sms before we free it. 00234 */ 00235 psms->lRet = lRet; 00236 psms->flags |= SMF_REPLY; 00237 00238 /* 00239 * Wake up the sender. 00240 * ??? why don't we test that psms == ptiSender->psmsSent? 00241 */ 00242 SetWakeBit(psms->ptiSender, QS_SMSREPLY); 00243 } else if (psms->flags & SMF_CB_REQUEST) { 00244 00245 /* 00246 * From SendMessageCallback REQUEST callback. Send the message 00247 * back with a the REPLY value. 00248 */ 00249 TL tlpwnd; 00250 INTRSENDMSGEX ism; 00251 00252 psms->flags |= SMF_REPLY; 00253 00254 if (!(psms->flags & SMF_SENDERDIED)) { 00255 ism.fuCall = ISM_CALLBACK | ISM_REPLY; 00256 if (psms->flags & SMF_CB_CLIENT) 00257 ism.fuCall |= ISM_CB_CLIENT; 00258 ism.lpResultCallBack = psms->lpResultCallBack; 00259 ism.dwData = psms->dwData; 00260 ism.lRet = lRet; 00261 00262 ThreadLockWithPti(ptiCurrent, psms->spwnd, &tlpwnd); 00263 00264 xxxInterSendMsgEx(psms->spwnd, psms->message, 0L, 0L, 00265 NULL, psms->ptiCallBackSender, &ism ); 00266 00267 ThreadUnlock(&tlpwnd); 00268 } 00269 } 00270 00271 /* 00272 * We have 4 conditions to satisfy: 00273 * 00274 * 16 - 16 : receiver yields if sender is waiting for this reply 00275 * 32 - 16 : receiver yields if sender is waiting for this reply 00276 * 16 - 32 : no yield required 00277 * 32 - 32 : No yielding required. 00278 */ 00279 if (psms->ptiSender && 00280 (psms->ptiSender->TIF_flags & TIF_16BIT || ptiCurrent->TIF_flags & TIF_16BIT)) { 00281 00282 DirectedScheduleTask(ptiCurrent, psms->ptiSender, FALSE, psms); 00283 if (ptiCurrent->TIF_flags & TIF_16BIT && psms->ptiSender->psmsSent == psms) { 00284 xxxSleepTask(TRUE, NULL); 00285 } 00286 } 00287 00288 return TRUE; 00289 }

VOID _ResetDblClk VOID   ) 
 

Definition at line 3768 of file rare.c.

References L, PtiCurrent, and VOID().

03769 { 03770 PtiCurrent()->pq->timeDblClk = 0L; 03771 }

BOOL _ScrollDC HDC  ,
int  ,
int  ,
LPRECT  ,
LPRECT  ,
HRGN  ,
LPRECT 
 

Definition at line 653 of file scrollw.c.

References AnySpbs, BOOL, FastWindowFromDC(), HRGN_FULL, tagWND::hrgnUpdate, InternalScrollDC(), NULL, OffsetRect(), tagWND::rcClient, SpbCheckRect(), TRUE, and UnionRect().

Referenced by NtUserScrollDC(), and xxxPaintIconsInSwitchWindow().

00661 { 00662 RECT rcSrc; 00663 RECT rcSpb; 00664 PWND pwnd; 00665 HRGN hrgnInvalid; 00666 BOOL fRet; 00667 00668 /* 00669 * ScrollDC does not scroll update region. Under WinNT, an app calling 00670 * GetUpdateRgn() then ScrollDC() then InvalidateRgn() will not get 00671 * any new update region that happened between the Get and Scroll. Under 00672 * Win3.1, that was not a problem because no other app ran during this 00673 * time. So pass hrgnInvalid - this will affect the hrgnUpdate and 00674 * prcUpdate values being returned from ScrollDC with the update region. 00675 */ 00676 hrgnInvalid = NULL; 00677 if ((pwnd = FastWindowFromDC(hdc)) != NULL) { 00678 00679 hrgnInvalid = pwnd->hrgnUpdate; 00680 00681 if (hrgnInvalid == HRGN_FULL) { 00682 00683 /* 00684 * This is a fix for winhell, a performance testing app 00685 * written by some guy working for a windows magazine. 00686 * this app scrolls it's window while it is completely 00687 * invalid. We normaly won't scroll invalid bits but 00688 * but we make the exception here 00689 */ 00690 hrgnInvalid = NULL; 00691 } 00692 } 00693 00694 fRet = InternalScrollDC(hdc, 00695 dx, 00696 dy, 00697 prcSrc, 00698 prcClip, 00699 hrgnInvalid, 00700 hrgnUpdate, 00701 prcUpdate, 00702 TRUE) != ERROR; 00703 00704 /* 00705 * InternalScrollDC() only scrolls those areas inside the visible region. 00706 * This means it does no operations on parts of the window if the window 00707 * isn't visible. This means SPBs don't get properly invalidated. This 00708 * could be seen by starting a dir, then moving another window with the 00709 * mouse (and keeping the mouse down until the dir finished). The 00710 * screen is remembered with an SPB, and the dir window doesn't get 00711 * properly invalidated because of this. 00712 */ 00713 if (pwnd != NULL && AnySpbs()) { 00714 00715 if (prcSrc) { 00716 00717 rcSrc = *prcSrc; 00718 OffsetRect(&rcSrc, pwnd->rcClient.left, pwnd->rcClient.top); 00719 00720 rcSpb = rcSrc; 00721 OffsetRect(&rcSpb, dx, dy); 00722 UnionRect(&rcSpb, &rcSpb, &rcSrc); 00723 00724 } else { 00725 rcSpb = pwnd->rcClient; 00726 } 00727 00728 SpbCheckRect(pwnd, &rcSpb, 0); 00729 } 00730 00731 return fRet; 00732 }

HPALETTE _SelectPalette HDC  hdc,
HPALETTE  hpalette,
BOOL  fForceBackground
 

Definition at line 51 of file palette.c.

References _GetDesktopWindow(), _IsChild(), BOOL, FALSE, GETPTI, GetTopLevelWindow(), gpqForeground, tagWND::head, IsTopmostRealApp(), NULL, PUSIF_PALETTEDISPLAY, SetWF, tagQ::spwndActive, TEST_PUSIF, TestWF, TIF_PALETTEAWARE, TRUE, WEFTOOLWINDOW, WFHASPALETTE, and WindowFromCacheDC().

Referenced by BMPtoDIB(), ConvertToDDB(), DIBtoBMP(), NtUserSelectPalette(), xxxDrawWallpaper(), and xxxInternalPaintDesktop().

00055 { 00056 PWND pwndTop; 00057 BOOL fBackgroundPalette = TRUE; 00058 PWND pwnd = NULL; 00059 /* 00060 * If we are not forcing palette into background, find out where it does 00061 * actually belong. Don't ever select the default palette in as a 00062 * foreground palette because this confuses gdi. Many apps do a 00063 * (oldPal = SelectPalette) (myPal); Draw; SelectObject(oldPal). 00064 * and we don't want to allow this to go through. 00065 */ 00066 if (!fForceBackground && 00067 TEST_PUSIF(PUSIF_PALETTEDISPLAY) && 00068 (hpal != GreGetStockObject(DEFAULT_PALETTE))) { 00069 00070 if (pwnd = WindowFromCacheDC(hdc)) { 00071 00072 PWND pwndActive; 00073 00074 /* 00075 * don't "select" palette unless on a palette device 00076 */ 00077 pwndTop = GetTopLevelWindow(pwnd); 00078 00079 if (!TestWF(pwndTop, WFHASPALETTE)) { 00080 00081 if (pwndTop != _GetDesktopWindow()) 00082 GETPTI(pwndTop)->TIF_flags |= TIF_PALETTEAWARE; 00083 00084 SetWF(pwndTop, WFHASPALETTE); 00085 } 00086 00087 /* 00088 * Hack-o-rama: 00089 * Windows get foreground use of the palette if 00090 * * They are the foreground's active window 00091 * * The current process is the shell and they are the 00092 * topmost valid non-toolwindow in the zorder. 00093 * 00094 * This makes our tray friendly on palettized displays. 00095 * Currently, if you run a palette app and click on the tray, 00096 * the palette app goes all weird. Broderbund apps go 00097 * completely black. This is because they get forced to be 00098 * background always, even though the shell isn't really 00099 * palettized. 00100 * 00101 * Note: this palette architecture sucks. Apps get forced to 00102 * be background palette users even if the foreground thread 00103 * couldn't care less about the palette. Should go by zorder 00104 * if so, but in a more clean way than this. 00105 * 00106 * We really only care about the tray && the background. 00107 * Cabinet dudes don't matter so much. 00108 */ 00109 pwndActive = (gpqForeground ? gpqForeground->spwndActive : NULL); 00110 00111 #if 0 00112 if (pwndActive && 00113 (pwndTop != pwnd->head.rpdesk->pDeskInfo->spwndShell) && 00114 ((pwndActive == pwnd) || _IsChild(pwndActive, pwnd) || IsTopmostRealApp(pwnd)) && 00115 !TestWF(pwnd, WEFTOOLWINDOW)) { 00116 00117 fBackgroundPalette = FALSE; 00118 } 00119 #else 00120 if ((pwndTop != pwndTop->head.rpdesk->pDeskInfo->spwnd) && 00121 (pwndTop != pwndTop->head.rpdesk->pDeskInfo->spwndShell) && 00122 (pwndActive != NULL) && 00123 ((pwndActive == pwnd) || 00124 _IsChild(pwndActive, pwnd) || 00125 IsTopmostRealApp(pwnd)) && 00126 !TestWF(pwnd, WEFTOOLWINDOW)) { 00127 00128 fBackgroundPalette = FALSE; 00129 } 00130 #endif 00131 } 00132 } 00133 00134 return GreSelectPalette(hdc, hpal, fBackgroundPalette); 00135 }

BOOL _SetCaretBlinkTime UINT   ) 
 

Definition at line 513 of file caret.c.

References _KillSystemTimer(), _SetSystemTimer(), BOOL, tagQ::caret, CaretBlinkProc(), CheckWinstaWriteAttributesAccess(), FALSE, gpsi, tagCARET::hTimer, IDSYS_CARET, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, and TRUE.

Referenced by xxxUpdatePerUserSystemParameters().

00515 { 00516 PQ pq; 00517 PTHREADINFO ptiCurrent = PtiCurrent(); 00518 00519 /* 00520 * Blow it off if the caller doesn't have the proper access rights 00521 */ 00522 if (!CheckWinstaWriteAttributesAccess()) { 00523 return FALSE; 00524 } 00525 00526 gpsi->dtCaretBlink = cmsBlink; 00527 00528 pq = ptiCurrent->pq; 00529 00530 if (pq->caret.spwnd) { 00531 _KillSystemTimer(pq->caret.spwnd, IDSYS_CARET); 00532 pq->caret.hTimer = _SetSystemTimer(pq->caret.spwnd, IDSYS_CARET, 00533 gpsi->dtCaretBlink, CaretBlinkProc); 00534 } 00535 00536 return TRUE; 00537 }

WORD _SetClassWord PWND  pwnd,
int  index,
WORD  value
 

Definition at line 863 of file class.c.

References BYTE, CheckCritIn, GETPTI, NULL, tagWND::pcls, tagCLS::pclsBase, tagCLS::pclsClone, tagCLS::pclsNext, and PpiCurrent.

Referenced by NtUserSetClassWord().

00867 { 00868 WORD wOld; 00869 WORD UNALIGNED *pw; 00870 PCLS pcls; 00871 00872 CheckCritIn(); 00873 00874 if (GETPTI(pwnd)->ppi != PpiCurrent()) { 00875 RIPERR1(ERROR_ACCESS_DENIED, RIP_WARNING, "SetClassWord: different process: index 0x%lx", index); 00876 return 0; 00877 } 00878 00879 pcls = pwnd->pcls->pclsBase; 00880 if ((index < 0) || (index + (int)sizeof(WORD) > pcls->cbclsExtra)) { 00881 RIPERR0(ERROR_INVALID_INDEX, RIP_WARNING, "SetClassWord: invalid index"); 00882 return 0; 00883 } else { 00884 pw = (WORD UNALIGNED *)((BYTE *)(pcls + 1) + index); 00885 wOld = *pw; 00886 *pw = value; 00887 pcls = pcls->pclsClone; 00888 while (pcls != NULL) { 00889 pw = (WORD UNALIGNED *)((BYTE *)(pcls + 1) + index); 00890 *pw = value; 00891 pcls = pcls->pclsNext; 00892 } 00893 return wOld; 00894 } 00895 }

BOOL _SetClipboardData UINT  fmt,
HANDLE  hData,
BOOL  fGlobalHandle,
BOOL  fIncSerialNumber
 

Definition at line 953 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), DUMMY_MAX_HANDLE, DUMMY_TEXT_HANDLE, FALSE, InternalSetClipboardData(), and NULL.

Referenced by NtUserSetClipboardData(), and xxxSnapWindow().

00958 { 00959 PWINDOWSTATION pwinsta; 00960 BOOL fRet; 00961 00962 if ((pwinsta = CheckClipboardAccess()) == NULL) 00963 return FALSE; 00964 00965 /* 00966 * Check if the Data handle is DUMMY_TEXT_HANDLE; If so, return an 00967 * error. DUMMY_TEXT_HANDLE will be used as a valid clipboard handle 00968 * only by USER. If any app tries to pass it as a handle, it should 00969 * get an error! 00970 */ 00971 if ((hData >= DUMMY_TEXT_HANDLE) && (hData <= DUMMY_MAX_HANDLE)) { 00972 RIPMSG0(RIP_WARNING, "Clipboard: SetClipboardData called with dummy-handle"); 00973 return FALSE; 00974 } 00975 00976 if (fRet = InternalSetClipboardData(pwinsta, fmt, hData, fGlobalHandle, fIncSerialNumber)) { 00977 00978 /* 00979 * The set object must remain PUBLIC, so that other processes 00980 * can view/manipulate the handles when requested. 00981 */ 00982 switch (fmt) { 00983 case CF_BITMAP: 00984 GreSetBitmapOwner(hData, OBJECT_OWNER_PUBLIC); 00985 break; 00986 00987 case CF_PALETTE: 00988 GreSetPaletteOwner(hData, OBJECT_OWNER_PUBLIC); 00989 break; 00990 } 00991 } 00992 00993 return fRet; 00994 }

BOOL _SetCursorContents PCURSOR  pcur,
PCURSOR  pcurNew
 

Definition at line 695 of file loadbits.c.

References _DestroyCursor(), BOOL, CURSOR_THREADCLEANUP, CURSORF_ACON, and TRUE.

Referenced by NtUserSetCursorContents().

00698 { 00699 HBITMAP hbmpT; 00700 00701 if (!(pcur->CURSORF_flags & CURSORF_ACON)) { 00702 00703 /* 00704 * Swap bitmaps. 00705 */ 00706 hbmpT = pcur->hbmMask; 00707 pcur->hbmMask = pcurNew->hbmMask; 00708 pcurNew->hbmMask = hbmpT; 00709 00710 hbmpT = pcur->hbmColor; 00711 pcur->hbmColor = pcurNew->hbmColor; 00712 pcurNew->hbmColor = hbmpT; 00713 00714 /* 00715 * Remember hotspot info and size info 00716 */ 00717 pcur->xHotspot = pcurNew->xHotspot; 00718 pcur->yHotspot = pcurNew->yHotspot; 00719 pcur->cx = pcurNew->cx; 00720 pcur->cy = pcurNew->cy; 00721 } 00722 00723 /* 00724 * Destroy the cursor we copied from. 00725 */ 00726 _DestroyCursor(pcurNew, CURSOR_THREADCLEANUP); 00727 00728 return (BOOL)TRUE; 00729 }

BOOL _SetCursorIconData PCURSOR  pcur,
PUNICODE_STRING  pstrModName,
PUNICODE_STRING  pstrResName,
PCURSORDATA  pData,
DWORD  cbData
 

Definition at line 319 of file kernel/acons.c.

References ACON, tagCURSORDATA::aicur, tagCURSORDATA::ajifRate, AllocateUnicodeString(), tagCURSORDATA::aspcur, BOOL, tagCURSORDATA::cpcur, CURSOR, CURSORF_ACON, tagCURSORDATA::CURSORF_flags, DWORD, FALSE, HMValidateHandle(), LinkCursor(), Lock, NULL, pacon, PBYTE, PCURSORDATA, tagCURSORDATA::rt, TRUE, TYPE_CURSOR, Unlock, and UserAddAtom().

Referenced by CopyIcoCur(), CreateAniIcon(), CreateIcoCur(), CreateIcoCurIndirect(), CreateIconIndirect(), and NtUserSetCursorIconData().

00325 { 00326 #define pacon ((PACON)pcur) 00327 int i; 00328 #if DBG 00329 BOOL fSuccess; 00330 #endif 00331 00332 pcur->CURSORF_flags |= pcurData->CURSORF_flags; 00333 pcur->rt = pcurData->rt; 00334 00335 if (pcurData->CURSORF_flags & CURSORF_ACON) { 00336 UserAssert(pacon->aspcur == NULL); 00337 RtlCopyMemory(&pacon->cpcur, 00338 &pcurData->cpcur, 00339 sizeof(ACON) - FIELD_OFFSET(ACON, cpcur)); 00340 } else { 00341 RtlCopyMemory(&pcur->CI_COPYSTART, 00342 &pcurData->CI_COPYSTART, 00343 sizeof(CURSOR) - FIELD_OFFSET(CURSOR, CI_COPYSTART)); 00344 } 00345 00346 /* 00347 * Save name of the cursor resource 00348 */ 00349 if (cczpstrName->Length != 0){ 00350 /* 00351 * AllocateUnicodeString guards access to src Buffer with 00352 * a try block. 00353 */ 00354 00355 if (!AllocateUnicodeString(&pcur->strName, cczpstrName)) 00356 return FALSE; 00357 } else { 00358 pcur->strName = *cczpstrName; 00359 } 00360 00361 /* 00362 * Save the module name 00363 */ 00364 if (cczpstrModName->Buffer) { 00365 /* 00366 * UserAddAtom guards access to the string with a try block. 00367 */ 00368 pcur->atomModName = UserAddAtom(cczpstrModName->Buffer, FALSE); 00369 if (pcur->atomModName == 0) { 00370 return FALSE; 00371 } 00372 } 00373 00374 if (pcur->CURSORF_flags & CURSORF_ACON) { 00375 00376 /* 00377 * Stash away animated icon info. 00378 */ 00379 pacon = (PACON)pcur; 00380 pacon->aspcur = UserAllocPool(cbData, TAG_CURSOR); 00381 if (pacon->aspcur == NULL) 00382 return FALSE; 00383 00384 /* 00385 * Copy the handle array. Do this in a try/except so the 00386 * buffer will be freed if pcurData goes away. Even though 00387 * cursor destruction would free the array, a fault will 00388 * leave the contents in an undetermined state and cause 00389 * problems during cursor destruction. 00390 */ 00391 try { 00392 RtlCopyMemory(pacon->aspcur, pcurData->aspcur, cbData); 00393 pacon->aicur = (DWORD *)((PBYTE)pacon->aspcur + (ULONG_PTR)pcurData->aicur); 00394 pacon->ajifRate = (PJIF)((PBYTE)pacon->aspcur + (ULONG_PTR)pcurData->ajifRate); 00395 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00396 UserFreePool(pacon->aspcur); 00397 pacon->aspcur = NULL; 00398 return FALSE; 00399 } 00400 00401 /* 00402 * Convert handles into pointers and lock them in. 00403 */ 00404 for (i = 0; i < pacon->cpcur; i++) { 00405 PCURSOR pcurT; 00406 00407 pcurT = (PCURSOR) HMValidateHandle(pacon->aspcur[i], TYPE_CURSOR); 00408 if (pcurT) { 00409 pacon->aspcur[i] = NULL; 00410 Lock(&pacon->aspcur[i], pcurT); 00411 } else { 00412 while (--i >= 0) { 00413 Unlock(&pacon->aspcur[i]); 00414 } 00415 00416 UserFreePool(pacon->aspcur); 00417 pacon->aspcur = NULL; 00418 RIPMSG0(RIP_WARNING, "SetCursorIconData: invalid cursor handle for animated cursor"); 00419 return FALSE; 00420 } 00421 } 00422 } else { 00423 00424 PW32PROCESS W32Process = W32GetCurrentProcess(); 00425 00426 /* 00427 * Make the cursor and its bitmaps public - LAST THING! 00428 */ 00429 UserAssert(pcur->hbmMask); 00430 UserAssert(pcur->cx); 00431 UserAssert(pcur->cy); 00432 00433 /* 00434 * Make the cursor public so that it can be shared across processes. 00435 * Charge the curson to this very process GDI quota even if it's public. 00436 */ 00437 #if DBG 00438 fSuccess = 00439 #endif 00440 GreSetBitmapOwner(pcur->hbmMask, OBJECT_OWNER_PUBLIC); 00441 UserAssert(fSuccess); 00442 GreIncQuotaCount(W32Process); 00443 if (pcur->hbmColor) { 00444 #if DBG 00445 fSuccess = 00446 #endif 00447 GreSetBitmapOwner(pcur->hbmColor, OBJECT_OWNER_PUBLIC); 00448 UserAssert(fSuccess); 00449 GreIncQuotaCount(W32Process); 00450 } 00451 } 00452 00453 LinkCursor(pcur); 00454 00455 return TRUE; 00456 #undef pacon 00457 }

VOID _SetDbgTag int  ,
DWORD 
 

Definition at line 287 of file rare.c.

References COPY_FLAG, and gpsi.

Referenced by NtUserSetDbgTag(), and SetDbgTag().

00288 { 00289 #if DEBUGTAGS 00290 if (gpsi && tag < DBGTAG_Max && !(dwDBGTAGFlags & ~DBGTAG_VALIDUSERFLAGS)) { 00291 COPY_FLAG(gpsi->adwDBGTAGFlags[tag], dwDBGTAGFlags, DBGTAG_VALIDUSERFLAGS); 00292 } 00293 #else 00294 UNREFERENCED_PARAMETER(tag); 00295 UNREFERENCED_PARAMETER(dwDBGTAGFlags); 00296 #endif 00297 }

BOOL _SetDesktopBitmap PDESKTOP  pdesk,
HBITMAP  hbitmap,
DWORD  dwStyle
 

DWORD _SetDesktopConsoleThread PDESKTOP  pdesk,
DWORD  dwThreadId
 

BOOL _SetDoubleClickTime UINT   ) 
 

Definition at line 74 of file sysmet.c.

References APIENTRY, BOOL, CheckWinstaWriteAttributesAccess(), FALSE, gdtDblClk, gpsi, InitTooltipDelay(), NULL, PpiCurrent, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, tagDESKTOP::spwndTooltip, and TRUE.

Referenced by xxxSystemParametersInfo().

00076 { 00077 PWINDOWSTATION pwinsta = PpiCurrent()->rpwinsta; 00078 00079 /* 00080 * Blow it off if the caller doesn't have the proper access rights 00081 */ 00082 if (!CheckWinstaWriteAttributesAccess()) { 00083 return FALSE; 00084 } 00085 00086 if (!dtTime) { 00087 dtTime = 500; 00088 } else if (dtTime > 5000) { 00089 dtTime = 5000; 00090 } 00091 00092 gdtDblClk = dtTime; 00093 gpsi->dtLBSearch = dtTime * 4; // dtLBSearch = 4 * gdtDblClk 00094 gpsi->dtScroll = gpsi->dtLBSearch / 5; // dtScroll = 4/5 * gdtDblClk 00095 /* 00096 * This value should be set through SPI_SETMENUSHOWDELAY 00097 * gdtMNDropDown = gpsi->dtScroll; // gdtMNDropDown = 4/5 * gdtDblClk 00098 */ 00099 00100 /* 00101 * Recalculate delays for tooltip windows on all desktops. 00102 */ 00103 if (pwinsta != NULL) { 00104 PDESKTOP pdesk; 00105 for (pdesk = pwinsta->rpdeskList; pdesk; pdesk = pdesk->rpdeskNext) { 00106 InitTooltipDelay((PTOOLTIPWND)pdesk->spwndTooltip); 00107 } 00108 } 00109 00110 return TRUE; 00111 }

void _SetIMEShowStatus BOOL  fShow  ) 
 

BOOL _SetKeyboardState CONST BYTE pKeyboard  ) 
 

Definition at line 136 of file keyboard.c.

References BOOL, ClearAsyncKeyStateToggle, ClearKeyStateDown, ClearKeyStateToggle, gpsi, tagTHREADINFO::pq, PtiCurrent, SetAsyncKeyStateToggle, SetKeyStateDown, SetKeyStateToggle, TRUE, and UpdateKeyLights().

Referenced by NtUserSetKeyboardState().

00138 { 00139 int i; 00140 PQ pq; 00141 PTHREADINFO ptiCurrent = PtiCurrent(); 00142 00143 pq = ptiCurrent->pq; 00144 00145 /* 00146 * Copy in the new state table. 00147 */ 00148 for (i = 0; i < 256; i++, pb++) { 00149 if (*pb & 0x80) { 00150 SetKeyStateDown(pq, i); 00151 } else { 00152 ClearKeyStateDown(pq, i); 00153 } 00154 00155 if (*pb & 0x01) { 00156 SetKeyStateToggle(pq, i); 00157 } else { 00158 ClearKeyStateToggle(pq, i); 00159 } 00160 } 00161 00162 /* 00163 * Update the key cache index. 00164 */ 00165 gpsi->dwKeyCache++; 00166 00167 #ifdef LATER 00168 // scottlu 6-9-91 00169 // I don't think we ought to do this unless someone really complains. This 00170 // could have bad side affects, especially considering that terminal 00171 // apps will want to do this, and terminal apps could easily not respond 00172 // to input for awhile, causing this state to change unexpectedly while 00173 // a user is using some other application. - scottlu. 00174 00175 /* DavidPe 02/05/92 00176 * How about if we only do it when the calling app is foreground? 00177 */ 00178 00179 /* 00180 * Propagate the toggle bits for the keylight keys to the 00181 * async keystate table and update the keylights. 00182 * 00183 * THIS could be evil in a de-synced environment, but to do this 00184 * in a totally "synchronous" way is hard. 00185 */ 00186 if (pb[VK_CAPITAL] & 0x01) { 00187 SetAsyncKeyStateToggle(VK_CAPITAL); 00188 } else { 00189 ClearAsyncKeyStateToggle(VK_CAPITAL); 00190 } 00191 00192 if (pb[VK_NUMLOCK] & 0x01) { 00193 SetAsyncKeyStateToggle(VK_NUMLOCK); 00194 } else { 00195 ClearAsyncKeyStateToggle(VK_NUMLOCK); 00196 } 00197 00198 if (pb[VK_SCROLL] & 0x01) { 00199 SetAsyncKeyStateToggle(VK_SCROLL); 00200 } else { 00201 ClearAsyncKeyStateToggle(VK_SCROLL); 00202 } 00203 00204 UpdateKeyLights(TRUE); 00205 #endif 00206 00207 return TRUE; 00208 }

BOOL _SetLayeredWindowAttributes PWND  pwnd,
COLORREF  crKey,
BYTE  bAlpha,
DWORD  dwFlags
 

Definition at line 230 of file sprite.c.

References _GetProp(), BOOL, ConvertRedirectionDCs(), CreateRedirectionBitmap(), dwFlags, FALSE, ghdcMem, gpDispInfo, tagDISPLAYINFO::hDev, NULL, PROP_LAYER, PtoHq, tagWND::rcWindow, TestWF, TRUE, and WEFLAYERED.

Referenced by NtUserSetLayeredWindowAttributes().

00232 { 00233 BOOL bRet; 00234 BLENDFUNCTION blend; 00235 HBITMAP hbm; 00236 00237 if (!TestWF(pwnd, WEFLAYERED)) { 00238 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, 00239 "SetLayeredWindowAttributes: not a sprite %X", pwnd); 00240 return FALSE; 00241 } 00242 00243 if ((hbm = _GetProp(pwnd, PROP_LAYER, TRUE)) == NULL) { 00244 HBITMAP hbmNew; 00245 00246 if ((hbmNew = CreateRedirectionBitmap(pwnd)) == NULL) { 00247 return FALSE; 00248 } 00249 00250 ConvertRedirectionDCs(pwnd, hbmNew); 00251 } 00252 00253 blend.BlendOp = AC_SRC_OVER; 00254 blend.BlendFlags = 0; 00255 blend.AlphaFormat = 0; 00256 blend.SourceConstantAlpha = bAlpha; 00257 00258 dwFlags |= ULW_NEW_ATTRIBUTES; // Notify gdi that these are new attributes 00259 00260 if (hbm != NULL) { 00261 HBITMAP hbmOld; 00262 SIZE size; 00263 POINT ptSrc = {0,0}; 00264 00265 hbmOld = GreSelectBitmap(ghdcMem, hbm); 00266 00267 size.cx = pwnd->rcWindow.right - pwnd->rcWindow.left; 00268 size.cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 00269 00270 bRet = GreUpdateSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL, NULL, 00271 NULL, &size, ghdcMem, &ptSrc, crKey, &blend, dwFlags, NULL); 00272 00273 GreSelectBitmap(ghdcMem, hbmOld); 00274 } else { 00275 bRet = GreUpdateSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL, NULL, 00276 NULL, NULL, NULL, NULL, crKey, &blend, dwFlags, NULL); 00277 } 00278 00279 return bRet; 00280 }

BOOL _SetLogonNotifyWindow PWND  pwnd  ) 
 

Definition at line 153 of file logon.c.

References BOOL, FALSE, GetCurrentProcessId, gpidLogon, gspwndLogonNotify, Lock, and TRUE.

Referenced by NtUserSetLogonNotifyWindow().

00155 { 00156 /* 00157 * Make sure the caller is the logon process 00158 */ 00159 if (GetCurrentProcessId() != gpidLogon) { 00160 RIPERR0(ERROR_ACCESS_DENIED, 00161 RIP_WARNING, 00162 "Access denied in _SetLogonNotifyWindow"); 00163 00164 return FALSE; 00165 } 00166 00167 Lock(&gspwndLogonNotify, pwnd); 00168 00169 return TRUE; 00170 }

BOOL _SetMenuContextHelpId PMENU  pMenu,
DWORD  dwContextHelpId
 

Definition at line 999 of file mnchange.c.

References BOOL, tagMENU::dwContextHelpId, and TRUE.

Referenced by NtUserSetMenuContextHelpId().

01000 { 01001 01002 // Set the new context help Id; 01003 pMenu->dwContextHelpId = dwContextHelpId; 01004 01005 return TRUE; 01006 }

BOOL _SetMenuDefaultItem PMENU  pMenu,
UINT  wId,
BOOL  fByPosition
 

Definition at line 567 of file mnsys.c.

References BOOL, tagMENU::cItems, ClearMFS, FALSE, MFMWFP_NOITEM, MNLookUpItem(), NULL, tagMENU::rgItems, SetMFS, TestMFS, TestMFT, TRUE, UINT, tagITEM::ulWidth, tagITEM::ulX, and UNDERLINE_RECALC.

Referenced by _SetCloseDefault(), NtUserSetMenuDefaultItem(), xxxDefWindowProc(), and xxxSetSysMenu().

00568 { 00569 UINT iItem; 00570 UINT cItems; 00571 PITEM pItem; 00572 PITEM pItemFound; 00573 PMENU pMenuFound; 00574 00575 // 00576 // We need to check if wId actually exists on this menu. 0xFFFF means 00577 // clear all default items. 00578 // 00579 00580 if (wID != MFMWFP_NOITEM) 00581 { 00582 pItemFound = MNLookUpItem(pMenu, wID, fByPosition, &pMenuFound); 00583 00584 // item must be on same menu and can't be a separator 00585 if ((pItemFound == NULL) || (pMenuFound != pMenu) || TestMFT(pItemFound, MFT_SEPARATOR)) 00586 return(FALSE); 00587 00588 } 00589 else 00590 pItemFound = NULL; 00591 00592 pItem = pMenu->rgItems; 00593 cItems = pMenu->cItems; 00594 00595 // Walk the menu list, clearing MFS_DEFAULT from all other items, and 00596 // setting MFS_DEFAULT on the requested one. 00597 for (iItem = 0; iItem < cItems; iItem++, pItem++) { 00598 // 00599 // Note we don't change the state of lpItemFound if it exists. This 00600 // is so that below, where we try to set the default, we can tell 00601 // if we need to recalculate the underline. 00602 // 00603 00604 if (TestMFS(pItem, MFS_DEFAULT) && (pItem != pItemFound)) 00605 { 00606 // 00607 // We are changing the default item. As such, it will be drawn 00608 // with a different font than the one used to calculate it, if 00609 // the menu has already been drawn once. We need to ensure 00610 // that the underline gets drawn in the right place the next 00611 // time the menu comes up. Cause it to recalculate. 00612 // 00613 // We do NOT do this if the item 00614 // (a) isn't default--otherwise we'll recalculate the 00615 // underline for every system menu item every time we go into 00616 // menu mode because sysmenu init will call SetMenuDefaultItem. 00617 // (b) isn't the item we're going to set as the default. 00618 // That way we don't recalculate the underline when the item 00619 // isn't changing state. 00620 // 00621 ClearMFS(pItem, MFS_DEFAULT); 00622 pItem->ulX = UNDERLINE_RECALC; 00623 pItem->ulWidth = 0; 00624 } 00625 } 00626 00627 if (wID != MFMWFP_NOITEM) 00628 { 00629 if (!TestMFS(pItemFound, MFS_DEFAULT)) 00630 { 00631 // 00632 // We are changing from non-default to default. Clear out 00633 // the underline info. If the menu has never painted, this 00634 // won't do anything. But it matters a lot if it has. 00635 // 00636 SetMFS(pItemFound, MFS_DEFAULT); 00637 pItemFound->ulX = UNDERLINE_RECALC; 00638 pItemFound->ulWidth = 0; 00639 } 00640 } 00641 00642 return(TRUE); 00643 }

BOOL _SetMenuFlagRtoL PMENU  pMenu  ) 
 

Definition at line 1008 of file mnchange.c.

References BOOL, MFRTL, SetMF, and TRUE.

Referenced by NtUserSetMenuFlagRtoL().

01009 { 01010 01011 // This is a right-to-left menu being created; 01012 SetMF(pMenu, MFRTL); 01013 01014 return TRUE; 01015 }

LONG_PTR _SetMessageExtraInfo LONG_PTR   ) 
 

Definition at line 6485 of file ntuser/kernel/input.c.

References tagQ::ExtraInfo, tagTHREADINFO::pq, and PtiCurrent.

06486 { 06487 LONG_PTR lRet; 06488 PTHREADINFO pti = PtiCurrent(); 06489 06490 lRet = pti->pq->ExtraInfo; 06491 pti->pq->ExtraInfo = lData; 06492 return lRet; 06493 }

BOOL _SetProgmanWindow PWND  pwnd  ) 
 

Definition at line 48 of file miscutil.c.

References BOOL, FALSE, GETDESKINFO, Lock, NULL, PtiCurrent, tagDESKTOPINFO::spwndProgman, and TRUE.

00048 { 00049 00050 PDESKTOPINFO pdeskinfo = GETDESKINFO(PtiCurrent()); 00051 00052 if (pwnd != NULL) { 00053 // Fail the call if another shell window exists 00054 if (pdeskinfo->spwndProgman != NULL) 00055 return(FALSE); 00056 } 00057 00058 Lock(&pdeskinfo->spwndProgman, pwnd); 00059 00060 return(TRUE); 00061 }

VOID _SetRipFlags DWORD  ,
DWORD 
 

Definition at line 264 of file rare.c.

References DWORD, gpsi, RIPF_VALIDUSERFLAGS, VOID(), tagSERVERINFO::wRIPFlags, and tagSERVERINFO::wRIPPID.

Referenced by NtUserSetRipFlags(), and SetRipFlags().

00266 { 00267 if (gpsi) { 00268 if ((dwRipFlags != (DWORD)-1) && !(dwRipFlags & ~RIPF_VALIDUSERFLAGS)) { 00269 gpsi->wRIPFlags = (WORD)((gpsi->wRIPFlags & ~RIPF_VALIDUSERFLAGS) | dwRipFlags); 00270 } 00271 if (dwPID != (DWORD)-1) { 00272 gpsi->wRIPPID = (WORD)dwPID; 00273 } 00274 } 00275 }

BOOL _SetSystemMenu PWND  pwnd,
PMENU  pMenu
 

UINT_PTR _SetSystemTimer PWND  pwnd,
UINT_PTR  nIDEvent,
DWORD  dwElapse,
TIMERPROC_PWND  pTimerFunc
 

Definition at line 78 of file timers.c.

References GETPTI, InternalSetTimer(), and PpiCurrent.

Referenced by _SetCaretBlinkTime(), NtUserSetSystemTimer(), xxxContScroll(), xxxCreateCaret(), xxxTrackBox(), and zzzSetCaretPos().

00083 { 00084 /* 00085 * Prevent apps from setting a Timer with a window proc to another app 00086 */ 00087 if (pwnd && PpiCurrent() != GETPTI(pwnd)->ppi) { 00088 00089 RIPERR1(ERROR_ACCESS_DENIED, 00090 RIP_WARNING, 00091 "Calling SetSystemTimer with window of another process %lX", 00092 pwnd); 00093 00094 return 0; 00095 } 00096 00097 return InternalSetTimer(pwnd, nIDEvent, dwElapse, pTimerFunc, TMRF_SYSTEM); 00098 }

BOOL _SetTaskmanWindow PWND  pwnd  ) 
 

Definition at line 63 of file miscutil.c.

References BOOL, FALSE, GETDESKINFO, Lock, NULL, PtiCurrent, tagDESKTOPINFO::spwndTaskman, and TRUE.

00063 { 00064 00065 PDESKTOPINFO pdeskinfo = GETDESKINFO(PtiCurrent()); 00066 00067 if (pwnd != NULL) { 00068 // Fail the call if another shell window exists 00069 if (pdeskinfo->spwndTaskman != NULL) 00070 return(FALSE); 00071 } 00072 00073 Lock(&pdeskinfo->spwndTaskman, pwnd); 00074 00075 return(TRUE); 00076 }

UINT_PTR _SetTimer PWND  pwnd,
UINT_PTR  nIDEvent,
UINT  dwElapse,
TIMERPROC_PWND  pTimerFunc
 

Definition at line 45 of file timers.c.

References GETPTI, InternalSetTimer(), and PpiCurrent.

Referenced by MNSetTimerToAutoDismiss(), MNSetTimerToCloseHierarchy(), MNSetTimerToOpenHierarchy(), NtUserSetTimer(), xxxMenuWindowProc(), and xxxMNDoScroll().

00050 { 00051 /* 00052 * Prevent apps from setting a Timer with a window proc to another app 00053 */ 00054 if (pwnd && (PpiCurrent() != GETPTI(pwnd)->ppi)) { 00055 00056 RIPERR1(ERROR_ACCESS_DENIED, 00057 RIP_WARNING, 00058 "Calling SetTimer with window of another process %lX", 00059 pwnd); 00060 00061 return 0; 00062 } 00063 00064 return InternalSetTimer(pwnd, nIDEvent, dwElapse, pTimerFunc, 0); 00065 }

BOOL _SetUserObjectInformation HANDLE  h,
int  nIndex,
PVOID  pvInfo,
DWORD  nLength
 

Definition at line 764 of file w32/ntuser/kernel/security.c.

References BOOL, DWORD, ExDesktopObjectType, ExWindowStationObjectType, FALSE, HF_DESKTOPHOOK, LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, OBJECT_TO_OBJECT_HEADER, ObReferenceObjectByHandle(), PtiCurrent, SetHandleFlag(), Status, TRUE, _OBJECT_HEADER::Type, and UserMode.

Referenced by NtUserSetObjectInformation().

00769 { 00770 PUSEROBJECTFLAGS puof; 00771 BOOL fSuccess = TRUE; 00772 PVOID pObject; 00773 POBJECT_HEADER pHead; 00774 DWORD dwLengthNeeded = 0; 00775 OBJECT_HANDLE_INFORMATION ohi; 00776 OBJECT_HANDLE_FLAG_INFORMATION ofi; 00777 NTSTATUS Status; 00778 00779 /* 00780 * Validate the object 00781 */ 00782 Status = ObReferenceObjectByHandle( 00783 h, 00784 0, 00785 NULL, 00786 UserMode, // this is always called from the client side 00787 &pObject, 00788 &ohi); 00789 if (!NT_SUCCESS(Status)) { 00790 RIPNTERR0(Status, RIP_VERBOSE, "ObReferenceObjectByHandle Failed"); 00791 return FALSE; 00792 } 00793 00794 pHead = OBJECT_TO_OBJECT_HEADER(pObject); 00795 if (pHead->Type != *ExWindowStationObjectType && 00796 pHead->Type != *ExDesktopObjectType) { 00797 RIPERR0(ERROR_INVALID_FUNCTION, RIP_WARNING, "Object is not a USER object"); 00798 ObDereferenceObject(pObject); 00799 return FALSE; 00800 } 00801 00802 #ifdef LOGDESKTOPLOCKS 00803 if (OBJECT_TO_OBJECT_HEADER(pObject)->Type == *ExDesktopObjectType) { 00804 LogDesktop(pObject, LD_REF_FN_SETUSEROBJECTINFORMATION, TRUE, (ULONG_PTR)PtiCurrent()); 00805 } 00806 #endif 00807 00808 try { 00809 switch (nIndex) { 00810 case UOI_FLAGS: 00811 if (nLength < sizeof(USEROBJECTFLAGS)) { 00812 RIPERR0(ERROR_INVALID_DATA, RIP_VERBOSE, ""); 00813 fSuccess = FALSE; 00814 break; 00815 } 00816 puof = ccxpvInfo; 00817 ZwQueryObject(h, ObjectHandleFlagInformation, 00818 &ofi, sizeof(ofi), NULL); 00819 ofi.Inherit = (puof->fInherit != FALSE); 00820 ZwSetInformationObject(h, ObjectHandleFlagInformation, 00821 &ofi, sizeof(ofi)); 00822 if (pHead->Type == *ExDesktopObjectType) { 00823 SetHandleFlag(h, HF_DESKTOPHOOK, 00824 puof->dwFlags & DF_ALLOWOTHERACCOUNTHOOK); 00825 } 00826 break; 00827 default: 00828 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00829 fSuccess = FALSE; 00830 break; 00831 } 00832 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 00833 fSuccess = FALSE; 00834 } 00835 00836 #ifdef LOGDESKTOPLOCKS 00837 if (OBJECT_TO_OBJECT_HEADER(pObject)->Type == *ExDesktopObjectType) { 00838 LogDesktop(pObject, LD_DEREF_FN_SETUSEROBJECTINFORMATION, FALSE, (ULONG_PTR)PtiCurrent()); 00839 } 00840 #endif 00841 00842 ObDereferenceObject(pObject); 00843 00844 return fSuccess; 00845 }

BOOL _SetWindowContextHelpId PWND  pwnd,
DWORD  dwContextId
 

Definition at line 22 of file kernel/help.c.

References tagSERVERINFO::atomContextHelpIdProp, BOOL, gpsi, InternalRemoveProp(), InternalSetProp(), MAKEINTATOM, PROPF_INTERNAL, PROPF_NOPOOL, and TRUE.

00023 { 00024 //If dwContextId is NULL, then this implies that the caller wants to 00025 // remove the dwContextId associated with this Window. 00026 if(dwContextId == 0) { 00027 InternalRemoveProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp), 00028 PROPF_INTERNAL); 00029 return(TRUE); 00030 } 00031 00032 return (InternalSetProp(pWnd, MAKEINTATOM(gpsi->atomContextHelpIdProp), 00033 (HANDLE)LongToHandle( dwContextId ), PROPF_INTERNAL | PROPF_NOPOOL)); 00034 }

UINT _SetWindowStationUser PWINDOWSTATION  pwinsta,
PLUID  pluidUser,
PSID  psidUser,
DWORD  cbsidUser
 

Definition at line 1459 of file winsta.c.

References FALSE, GetCurrentProcessId, gpidLogon, tagWINDOWSTATION::luidUser, NULL, tagWINDOWSTATION::psidUser, TRUE, and UINT.

Referenced by NtUserSetWindowStationUser().

01464 { 01465 01466 /* 01467 * Make sure the caller is the logon process 01468 */ 01469 if (GetCurrentProcessId() != gpidLogon) { 01470 RIPERR0(ERROR_ACCESS_DENIED, 01471 RIP_WARNING, 01472 "Access denied in _SetWindowStationUser: caller must be in the logon process"); 01473 01474 return FALSE; 01475 } 01476 01477 if (pwinsta->psidUser != NULL) 01478 UserFreePool(pwinsta->psidUser); 01479 01480 if (ccxpsidUser != NULL) { 01481 pwinsta->psidUser = UserAllocPoolWithQuota(cbsidUser, TAG_SECURITY); 01482 if (pwinsta->psidUser == NULL) { 01483 RIPERR0(ERROR_OUTOFMEMORY, 01484 RIP_WARNING, 01485 "Memory allocation failed in _SetWindowStationUser"); 01486 01487 return FALSE; 01488 } 01489 try { 01490 RtlCopyMemory(pwinsta->psidUser, ccxpsidUser, cbsidUser); 01491 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 01492 01493 UserFreePool(pwinsta->psidUser); 01494 pwinsta->psidUser = NULL; 01495 return FALSE; 01496 } 01497 } else { 01498 pwinsta->psidUser = NULL; 01499 } 01500 01501 pwinsta->luidUser = *pluidUser; 01502 01503 return TRUE; 01504 }

WORD _SetWindowWord PWND  pwnd,
int  index,
WORD  value
 

Definition at line 133 of file ntuser/kernel/getset.c.

References tagBUTN::buttonState, BYTE, CBFNID, tagWND::cbwndExtra, DWORD, tagWND::dwUserData, FALSE, FCallerOk(), FNID_BUTTON, FNID_DIALOG, FNID_MDICLIENT, GETFNID, ProbeAndReadUlong, TestWF, UINT, and WFDIALOGWINDOW.

Referenced by NtUserSetWindowWord().

00137 { 00138 WORD wOld; 00139 00140 /* 00141 * Don't allow setting of words belonging to a system thread if the caller 00142 * is not a system thread. Same goes for winlogon. 00143 */ 00144 if (!FCallerOk(pwnd)) { 00145 RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); 00146 return 0; 00147 } 00148 00149 /* 00150 * Applications can not set a WORD into a dialog Proc or any of the 00151 * non-public reserved bytes in DLGWINDOWEXTRA (usersrv stores pointers 00152 * theres) 00153 */ 00154 if (TestWF(pwnd, WFDIALOGWINDOW)) { 00155 if (((index >= DWLP_DLGPROC) && (index < DWLP_MSGRESULT)) || 00156 ((index > DWLP_USER+sizeof(LONG_PTR)-sizeof(WORD)) && (index < DLGWINDOWEXTRA))) { 00157 RIPERR3(ERROR_INVALID_INDEX, RIP_WARNING, 00158 "SetWindowWord: Trying to set WORD of a windowproc pwnd=(%#p) index=(%ld) fnid (%lX)", 00159 pwnd, index, (DWORD)pwnd->fnid); 00160 return 0; 00161 } else { 00162 00163 /* 00164 * If this is really a dialog and not some other server class 00165 * where usersrv has stored some data (Windows Compuserve - 00166 * wincim - does this) then store the data now that we have 00167 * verified the index limits. 00168 */ 00169 if (GETFNID(pwnd) == FNID_DIALOG) 00170 goto DoSetWord; 00171 } 00172 } 00173 00174 if (index == GWLP_USERDATA) { 00175 wOld = (WORD)pwnd->dwUserData; 00176 pwnd->dwUserData = MAKELONG(value, HIWORD(pwnd->dwUserData)); 00177 return wOld; 00178 } 00179 00180 // fix for RedShift, they call SetWindowWord 00181 // tn play with the low word of the style dword 00182 if (index == GWL_STYLE) { 00183 wOld = (WORD)pwnd->style; 00184 pwnd->style = MAKELONG(value, HIWORD(pwnd->style)); 00185 return wOld; 00186 } 00187 00188 if (GETFNID(pwnd) != 0) { 00189 if (index >= 0 && 00190 (index < (int)(CBFNID(pwnd->fnid)-sizeof(WND)))) { 00191 switch (GETFNID(pwnd)) { 00192 case FNID_MDICLIENT: 00193 if (index == 0) 00194 break; 00195 goto DoDefault; 00196 00197 case FNID_BUTTON: 00198 /* 00199 * CorelDraw, Direct Access 1.0 and WordPerfect 6.0 do a 00200 * get/set on the first button window word. Allow this 00201 * for compatibility. 00202 */ 00203 if (index == 0) { 00204 /* 00205 * Since we now use a lookaside buffer for the control's 00206 * private data, we need to indirect into this structure. 00207 */ 00208 PBUTN pbutn = ((PBUTNWND)pwnd)->pbutn; 00209 if (!pbutn || (LONG_PTR)pbutn == (LONG_PTR)-1) { 00210 return 0; 00211 } else { 00212 try { 00213 wOld = (WORD)ProbeAndReadUlong(&pbutn->buttonState); 00214 pbutn->buttonState = value; 00215 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00216 wOld = 0; 00217 } 00218 return wOld; 00219 } 00220 } 00221 goto DoDefault; 00222 00223 default: 00224 DoDefault: 00225 RIPERR3(ERROR_INVALID_INDEX, 00226 RIP_WARNING, 00227 "SetWindowWord: Trying to set private server data pwnd=(%#p) index=(%ld) fnid (%lX)", 00228 pwnd, index, (DWORD)pwnd->fnid); 00229 return 0; 00230 break; 00231 } 00232 } 00233 } 00234 00235 DoSetWord: 00236 if ((index < 0) || ((UINT)index + sizeof(WORD) > (UINT)pwnd->cbwndExtra)) { 00237 RIPERR0(ERROR_INVALID_INDEX, RIP_WARNING,"SetWindowWord Fails because of invalid index"); 00238 return 0; 00239 } else { 00240 WORD UNALIGNED *pw; 00241 00242 pw = (WORD UNALIGNED *)((BYTE *)(pwnd + 1) + index); 00243 wOld = *pw; 00244 *pw = value; 00245 return (WORD)wOld; 00246 } 00247 }

PEVENTHOOK _SetWinEventHook DWORD  eventMin,
DWORD  eventMax,
HMODULE  hmodWinEventProc,
PUNICODE_STRING  pstrLib,
WINEVENTPROC  pfnWinEventProc,
HANDLE  hEventProcess,
DWORD  idEventThread,
DWORD  dwFlags
 

Definition at line 674 of file kernel/winable.c.

References AddHmodDependency(), dwFlags, tagEVENTHOOK::eventMax, tagEVENTHOOK::eventMin, FALSE, tagEVENTHOOK::fDestroyed, tagEVENTHOOK::fIgnoreOwnProcess, tagEVENTHOOK::fIgnoreOwnThread, tagEVENTHOOK::fSync, GetHmodTableIndex(), gpWinEventHooks, tagEVENTHOOK::hEventProcess, HMAllocObject(), tagEVENTHOOK::idEventThread, tagEVENTHOOK::ihmod, NULL, tagEVENTHOOK::offPfn, tagEVENTHOOK::pehNext, PtiCurrent, PtiFromThreadId(), SET_SRVIF, SRVIF_WINEVENTHOOKS, tagTHREADINFO::TIF_flags, TIF_GUITHREADINITIALIZED, TIF_INCLEANUP, TYPE_WINEVENTHOOK, and UINT.

Referenced by NtUserSetWinEventHook().

00683 { 00684 PEVENTHOOK pEventNew; 00685 PTHREADINFO ptiCurrent; 00686 00687 int ihmod; 00688 00689 ptiCurrent = PtiCurrent(); 00690 00691 // 00692 // If exiting, fail the call. 00693 // 00694 if (ptiCurrent->TIF_flags & TIF_INCLEANUP) { 00695 RIPMSG1(RIP_ERROR, "SetWinEventHook: Fail call - thread %#p in cleanup", ptiCurrent); 00696 return NULL; 00697 } 00698 00699 /* 00700 * Check to see if filter proc is valid. 00701 */ 00702 if (pfnWinEventProc == NULL) { 00703 RIPERR0(ERROR_INVALID_FILTER_PROC, RIP_VERBOSE, "pfnWinEventProc == NULL"); 00704 return NULL; 00705 } 00706 00707 if (eventMin > eventMax) { 00708 RIPERR0(ERROR_INVALID_HOOK_FILTER, RIP_VERBOSE, "eventMin > eventMax"); 00709 return NULL; 00710 } 00711 00712 if (dwFlags & WINEVENT_INCONTEXT) { 00713 /* 00714 * WinEventProc to be called in context of hooked thread, so needs a DLL 00715 */ 00716 if (hmodWinEventProc == NULL) { 00717 RIPERR0(ERROR_HOOK_NEEDS_HMOD, RIP_VERBOSE, ""); 00718 return NULL; 00719 } else if (pstrLib == NULL) { 00720 /* 00721 * If we got an hmod, we should get a DLL name too! 00722 */ 00723 RIPERR1(ERROR_DLL_NOT_FOUND, RIP_ERROR, 00724 "hmod %#p, but no lib name", hmodWinEventProc); 00725 return NULL; 00726 } 00727 ihmod = GetHmodTableIndex(pstrLib); 00728 if (ihmod == -1) { 00729 RIPERR0(ERROR_MOD_NOT_FOUND, RIP_VERBOSE, ""); 00730 return NULL; 00731 } 00732 } else { 00733 ihmod = -1; // means no DLL is required 00734 hmodWinEventProc = 0; 00735 } 00736 00737 /* 00738 * Check the thread id, check it is a GUI thread. 00739 */ 00740 if (idEventThread != 0) { 00741 PTHREADINFO ptiT; 00742 00743 ptiT = PtiFromThreadId(idEventThread); 00744 if ((ptiT == NULL) || 00745 !(ptiT->TIF_flags & TIF_GUITHREADINITIALIZED)) { 00746 RIPERR1(ERROR_INVALID_THREAD_ID, RIP_VERBOSE, "pti %#p", ptiT); 00747 return NULL; 00748 } 00749 } 00750 00751 // 00752 // Create the window for async events first. Creating it might yield, 00753 // so we want to do this before we've touched our event array. 00754 // 00755 // NOTE that USER itself will not pass on window creation/destruction 00756 // notifications for 00757 // * IME windows 00758 // * OLE windows 00759 // * RPC windows 00760 // * Event windows 00761 // 00762 00763 // 00764 // Get a new event. 00765 // 00766 pEventNew = (PEVENTHOOK)HMAllocObject(ptiCurrent, NULL, 00767 TYPE_WINEVENTHOOK, sizeof(EVENTHOOK)); 00768 if (!pEventNew) 00769 return NULL; 00770 00771 // 00772 // Fill in the new event. 00773 // 00774 pEventNew->eventMin = (UINT)eventMin; 00775 pEventNew->eventMax = (UINT)eventMax; 00776 00777 // pEventNew->f32Bit = ((dwFlags & WINEVENT_32BITCALLER) != 0); 00778 pEventNew->fIgnoreOwnThread = ((dwFlags & WINEVENT_SKIPOWNTHREAD) != 0); 00779 pEventNew->fIgnoreOwnProcess = ((dwFlags & WINEVENT_SKIPOWNPROCESS) != 0); 00780 pEventNew->fDestroyed = FALSE; 00781 pEventNew->fSync = ((dwFlags & WINEVENT_INCONTEXT) != 0); 00782 00783 pEventNew->hEventProcess = hEventProcess; 00784 pEventNew->idEventThread = idEventThread; 00785 // pEventNew->cInUse = 0; 00786 00787 pEventNew->ihmod = ihmod; 00788 00789 /* 00790 * Add a dependency on this module - meaning, increment a count 00791 * that simply counts the number of hooks set into this module. 00792 */ 00793 if (pEventNew->ihmod >= 0) { 00794 AddHmodDependency(pEventNew->ihmod); 00795 } 00796 00797 /* 00798 * If pfnWinEventProc is in caller's process and no DLL is involved, 00799 * then pEventNew->offPfn is the actual address. 00800 */ 00801 pEventNew->offPfn = ((ULONG_PTR)pfnWinEventProc) - ((ULONG_PTR)hmodWinEventProc); 00802 00803 // 00804 // 00805 // Link our event into the master list. 00806 // 00807 // Note that we count on USER to not generate any events when installing 00808 // our hook. The caller can't handle it yet since he hasn't got back 00809 // his event handle from this call. 00810 // 00811 pEventNew->pehNext = gpWinEventHooks; 00812 gpWinEventHooks = pEventNew; 00813 SET_SRVIF(SRVIF_WINEVENTHOOKS); 00814 00815 return pEventNew; 00816 }

BOOL _ShowWindowAsync PWND  pwnd,
int  cmdShow,
UINT  uWPFlags
 

Definition at line 25 of file showwin.c.

References BOOL, GETPTI, HWq, NULL, PostEventMessage(), PUDF_ANIMATE, QEVENT_SHOWWINDOW, and TEST_PUDF.

Referenced by NtUserShowWindowAsync(), and xxxSetWindowPlacement().

00026 { 00027 00028 return PostEventMessage( 00029 GETPTI(pwnd), 00030 GETPTI(pwnd)->pq, 00031 QEVENT_SHOWWINDOW, 00032 NULL, 00033 uWPFlags, 00034 (WPARAM)HWq(pwnd), 00035 cmdShow | TEST_PUDF(PUDF_ANIMATE)); 00036 }

BOOL APIENTRY _SwapMouseButton BOOL  fSwapButtons  ) 
 

Definition at line 25 of file sysmet.c.

References tagPROCESSINFO::amwinsta, APIENTRY, BOOL, FALSE, gbMouseButtonsRecentlySwapped, PpiCurrent, RETURN_IF_ACCESS_DENIED, and SYSMET.

Referenced by xxxSystemParametersInfo().

00027 { 00028 BOOL fSwapOld; 00029 PPROCESSINFO ppiCurrent = PpiCurrent(); 00030 00031 /* 00032 * Blow it off if the caller doesn't have the proper access rights 00033 */ 00034 RETURN_IF_ACCESS_DENIED(ppiCurrent->amwinsta, 00035 WINSTA_READATTRIBUTES | WINSTA_WRITEATTRIBUTES, 00036 FALSE); 00037 00038 if (!(ppiCurrent->W32PF_Flags & W32PF_IOWINSTA)) { 00039 RIPERR0(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION, 00040 RIP_WARNING, 00041 "SwapMouseButton invalid on a non-interactive WindowStation."); 00042 00043 return FALSE; 00044 } 00045 00046 fSwapOld = SYSMET(SWAPBUTTON); 00047 SYSMET(SWAPBUTTON) = fSwapButtons; 00048 00049 /* 00050 * Give xxxButtonEvent a hint that a mouse button event may have to be 00051 * left/right swapped to correspond with our current async key state. 00052 * Toggle the global since an even number of SwapMouseButtons has no effect. 00053 */ 00054 if (fSwapButtons != fSwapOld) { 00055 gbMouseButtonsRecentlySwapped = !gbMouseButtonsRecentlySwapped; 00056 } 00057 00058 /* 00059 * Return previous state 00060 */ 00061 return fSwapOld; 00062 }

BOOL _UnhookWinEvent PEVENTHOOK  peh  ) 
 

Definition at line 827 of file kernel/winable.c.

References DBGVERIFYEVENTHOOK, DestroyEventHook(), FALSE, GETPTI, HMIsMarkDestroy, PtiCurrent, and TRUE.

Referenced by NtUserUnhookWinEvent().

00828 { 00829 DBGVERIFYEVENTHOOK(pEventUnhook); 00830 00831 if (HMIsMarkDestroy(pEventUnhook) || (GETPTI(pEventUnhook) != PtiCurrent())) { 00832 // 00833 // We do this to avoid someone calling UnhookWinEvent() the first 00834 // time, then somehow getting control again and calling it a second 00835 // time before we've managed to free up the event since someone was 00836 // in the middle of using it at the first UWE call. 00837 // 00838 00839 RIPERR0(ERROR_INVALID_HANDLE, RIP_WARNING, "_UnhookWinEvent: Invalid event hook"); 00840 return FALSE; 00841 } 00842 00843 // 00844 // Purge this baby if all notifications are done. 00845 // * if there are SYNC ones pending, the caller will clean this up 00846 // upon the return from calling the event 00847 // * if there are ASYNC ones pending, the receiver will not call 00848 // the event and clean it up when he gets it. 00849 // 00850 00851 // 00852 // NOTE that DestroyEventHook() does not yield! 00853 // 00854 DestroyEventHook(pEventUnhook); 00855 00856 return TRUE; 00857 }

BOOL _UnlockWindowStation PWINDOWSTATION  pwinsta  ) 
 

Definition at line 119 of file logon.c.

References BOOL, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetCurrentProcessId, gpidLogon, TRUE, WSF_OPENLOCK, WSF_SHUTDOWN, and WSF_SWITCHLOCK.

Referenced by NtUserUnlockWindowStation().

00121 { 00122 00123 /* 00124 * Make sure the caller is the logon process 00125 */ 00126 if (GetCurrentProcessId() != gpidLogon) { 00127 RIPERR0(ERROR_ACCESS_DENIED, 00128 RIP_WARNING, 00129 "Access denied in _UnlockWindowStation"); 00130 00131 return FALSE; 00132 } 00133 00134 /* 00135 * If shutdown is occuring, only remove the switch lock. 00136 */ 00137 if (pwinsta->dwWSF_Flags & WSF_SHUTDOWN) 00138 pwinsta->dwWSF_Flags &= ~WSF_SWITCHLOCK; 00139 else 00140 pwinsta->dwWSF_Flags &= ~(WSF_OPENLOCK | WSF_SWITCHLOCK); 00141 return TRUE; 00142 }

BOOL _UnregisterClass LPCWSTR  lpszClassName,
HANDLE  hModule,
PCLSMENUNAME  pcmn
 

Definition at line 555 of file class.c.

References _InnerGetClassPtr(), BOOL, CheckCritIn, DestroyClass(), DWORD, FALSE, FindClassAtom, NULL, tagPROCESSINFO::pclsPrivateList, tagPROCESSINFO::pclsPublicList, tagTHREADINFO::ppi, tagCLSMENUNAME::pszClientAnsiMenuName, PtiCurrent, tagCLSMENUNAME::pusMenuName, tagCLSMENUNAME::pwszClientUnicodeMenuName, and TRUE.

Referenced by NtUserUnregisterClass().

00559 { 00560 ATOM atomT; 00561 PPCLS ppcls; 00562 PTHREADINFO ptiCurrent; 00563 00564 CheckCritIn(); 00565 00566 ptiCurrent = PtiCurrent(); 00567 00568 /* 00569 * Check whether the given ClassName is already registered by the 00570 * Application with the given handle. 00571 * Return error, if either the Class does not exist or it does not 00572 * belong to the calling process. 00573 */ 00574 00575 /* 00576 * bradg (3/9/95) - Must first check to see if an ATOM has been passed 00577 */ 00578 atomT = FindClassAtom(ccxlpszClassName); 00579 00580 ppcls = _InnerGetClassPtr(atomT, &ptiCurrent->ppi->pclsPrivateList, hModule); 00581 if (ppcls == NULL) { 00582 /* 00583 * Maybe this is a public class. 00584 */ 00585 ppcls = _InnerGetClassPtr(atomT, &ptiCurrent->ppi->pclsPublicList, NULL); 00586 if (ppcls == NULL) { 00587 RIPERR1(ERROR_CLASS_DOES_NOT_EXIST, RIP_WARNING, "UnregisterClass: Class does not exist; atom=%lX", (DWORD)atomT); 00588 return FALSE; 00589 } 00590 } 00591 00592 /* 00593 * If any windows created with this class still exist return an error. 00594 */ 00595 if ((*ppcls)->cWndReferenceCount != 0) { 00596 RIPERR0(ERROR_CLASS_HAS_WINDOWS, RIP_WARNING, "UnregisterClass: Class still has window"); 00597 return FALSE; 00598 } 00599 00600 /* 00601 * Return client side pointers for cleanup 00602 */ 00603 pcmn->pszClientAnsiMenuName = (*ppcls)->lpszClientAnsiMenuName; 00604 pcmn->pwszClientUnicodeMenuName = (*ppcls)->lpszClientUnicodeMenuName; 00605 pcmn->pusMenuName = NULL; 00606 00607 /* 00608 * Release the Window class and related information. 00609 */ 00610 DestroyClass(ppcls); 00611 00612 return TRUE; 00613 }

BOOL _UnregisterHotKey PWND  pwnd,
int  id
 

Definition at line 255 of file hotkeys.c.

References BOOL, FALSE, FindHotKey(), NULL, PtiCurrent, and TRUE.

Referenced by NtUserUnregisterHotKey(), and SetDebugHotKeys().

00258 { 00259 PHOTKEY phk; 00260 BOOL fKeysExist; 00261 PTHREADINFO ptiCurrent = PtiCurrent(); 00262 phk = FindHotKey(ptiCurrent, pwnd, id, 0, 0, TRUE, &fKeysExist); 00263 00264 /* 00265 * No hotkey to unregister, return FALSE. 00266 */ 00267 if (phk == NULL) { 00268 RIPERR0(ERROR_HOTKEY_NOT_REGISTERED, RIP_VERBOSE, ""); 00269 return FALSE; 00270 } 00271 00272 return TRUE; 00273 }

BOOL _UpdateLayeredWindow PWND  pwnd,
HDC  hdcDst,
POINT *  pptDst,
SIZE *  psize,
HDC  hdcSrc,
POINT *  pptSrc,
COLORREF  crKey,
BLENDFUNCTION *  pblend,
DWORD  dwFlags
 

Definition at line 625 of file sprite.c.

References _GetProp(), BOOL, dwFlags, FALSE, gpDispInfo, tagDISPLAYINFO::hDev, NULL, PROP_LAYER, PtoHq, tagWND::rcClient, tagWND::rcWindow, SetRectRelative(), TestWF, TRUE, and WEFLAYERED.

Referenced by NtUserUpdateLayeredWindow(), UpdateFade(), and xxxSetLayeredWindow().

00635 { 00636 int dx, dy, dcx, dcy; 00637 BOOL fMove = FALSE, fSize = FALSE; 00638 00639 /* 00640 * Verify that we're called with a real layered window. 00641 */ 00642 if (!TestWF(pwnd, WEFLAYERED) || 00643 _GetProp(pwnd, PROP_LAYER, TRUE) != NULL) { 00644 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, 00645 "_UpdateLayeredWindow: can't call on window %X", pwnd); 00646 return FALSE; 00647 } 00648 00649 if (!GreUpdateSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL, hdcDst, pptDst, 00650 psize, hdcSrc, pptSrc, crKey, pblend, dwFlags, NULL)) { 00651 RIPMSG1(RIP_WARNING, "_UpdateLayeredWindow: !UpdateSprite %X", pwnd); 00652 return FALSE; 00653 } 00654 00655 /* 00656 * Figure out relative adjustments in position and size. 00657 */ 00658 if (pptDst != NULL) { 00659 dx = pptDst->x - pwnd->rcWindow.left; 00660 dy = pptDst->y - pwnd->rcWindow.top; 00661 if (dx != 0 || dy != 0) { 00662 fMove = TRUE; 00663 } 00664 } else { 00665 dx = 0; 00666 dy = 0; 00667 } 00668 if (psize != NULL) { 00669 dcx = psize->cx - (pwnd->rcWindow.right - pwnd->rcWindow.left); 00670 dcy = psize->cy - (pwnd->rcWindow.bottom - pwnd->rcWindow.top); 00671 if (dcx != 0 || dcy != 0) { 00672 fSize = TRUE; 00673 } 00674 } else { 00675 dcx = 0; 00676 dcy = 0; 00677 } 00678 00679 if (fMove || fSize) { 00680 /* 00681 * Adjust the client rect position and size relative to 00682 * the window rect. 00683 */ 00684 SetRectRelative(&pwnd->rcWindow, dx, dy, dcx, dcy); 00685 SetRectRelative(&pwnd->rcClient, dx, dy, dcx, dcy); 00686 00687 /* 00688 * Since the client rect could be smaller than the window 00689 * rect make sure the client rect doesn't underflow! 00690 */ 00691 if ((dcx < 0) && (pwnd->rcClient.left < pwnd->rcWindow.left)) { 00692 pwnd->rcClient.left = pwnd->rcWindow.left; 00693 pwnd->rcClient.right = pwnd->rcWindow.left; 00694 } 00695 if ((dcy < 0) && (pwnd->rcClient.top < pwnd->rcWindow.top)) { 00696 pwnd->rcClient.top = pwnd->rcWindow.top; 00697 pwnd->rcClient.bottom = pwnd->rcWindow.top; 00698 } 00699 /* 00700 * BUGBUG: should jiggle the mouse, do this when SetFMouseMoved 00701 * doesn't leave crit. 00702 * 00703 * SetFMouseMoved(); 00704 */ 00705 } 00706 00707 return TRUE; 00708 }

NTSTATUS _UserTestForWinStaAccess PUNICODE_STRING  pstrWinSta,
BOOL  fInherit
 

Definition at line 295 of file w32/ntuser/kernel/security.c.

References _OpenWindowStation(), AccessCheckObject(), CheckCritIn, DEFAULT_WINSTA, FALSE, gbSecureDesktop, grpWinStaList, KernelMode, KPROCESSOR_MODE, luidSystem, tagWINDOWSTATION::luidUser, NT_SUCCESS, NTSTATUS(), NULL, OpenEffectiveToken(), PBYTE, RtlEqualLuid(), RtlEqualUnicodeString(), RtlInitUnicodeString(), Status, TRUE, UserMode, and WinStaMapping.

Referenced by xxxResolveDesktop().

00299 { 00300 PTOKEN_STATISTICS pStats; 00301 ULONG BytesRequired; 00302 PWINDOWSTATION pwinsta; 00303 HWINSTA hwsta = NULL; 00304 OBJECT_ATTRIBUTES ObjAttr; 00305 POBJECT_ATTRIBUTES pObjAttr = NULL; 00306 PUNICODE_STRING pstrStatic; 00307 NTSTATUS Status = STATUS_SUCCESS; 00308 SIZE_T cbObjA; 00309 UNICODE_STRING strDefWinSta; 00310 HANDLE htoken; 00311 00312 CheckCritIn(); 00313 00314 UserAssert(NtCurrentTeb()); 00315 UserAssert(pstrWinSta->Buffer == NtCurrentTeb()->StaticUnicodeBuffer); 00316 00317 /* 00318 * If we are testing against Default WindowStation (WinSta0) retreive 00319 * pwinsta from the top of the grpwinstaList instead of doing an 00320 * OpenWindowStation() 00321 * 00322 * !!! 00323 * 00324 * This relies on the fact that there is only ONE interactive 00325 * windowstation and that it is the first one in the list. 00326 * If multiple windowstations are ever supported 00327 * a lookup will have to be done instead. 00328 */ 00329 RtlInitUnicodeString(&strDefWinSta, DEFAULT_WINSTA); 00330 if (RtlEqualUnicodeString(pstrWinSta, &strDefWinSta, TRUE)) { 00331 00332 00333 if (!NT_SUCCESS(Status = OpenEffectiveToken(&htoken))) { 00334 return Status; 00335 } 00336 00337 Status = ZwQueryInformationToken( 00338 htoken, // Handle 00339 TokenStatistics, // TokenInformationClass 00340 NULL, // TokenInformation 00341 0, // TokenInformationLength 00342 &BytesRequired // ReturnLength 00343 ); 00344 00345 if (Status != STATUS_BUFFER_TOO_SMALL) { 00346 ZwClose(htoken); 00347 return Status; 00348 } 00349 00350 // 00351 // Allocate space for the user info 00352 // 00353 00354 pStats = (PTOKEN_STATISTICS)UserAllocPoolWithQuota(BytesRequired, TAG_SECURITY); 00355 if (pStats == NULL) { 00356 Status = STATUS_NO_MEMORY; 00357 ZwClose(htoken); 00358 return Status; 00359 } 00360 00361 // 00362 // Read in the user info 00363 // 00364 00365 if (!NT_SUCCESS(Status = ZwQueryInformationToken( 00366 htoken, // Handle 00367 TokenStatistics, // TokenInformationClass 00368 pStats, // TokenInformation 00369 BytesRequired, // TokenInformationLength 00370 &BytesRequired // ReturnLength 00371 ))) { 00372 ZwClose(htoken); 00373 UserFreePool(pStats); 00374 return Status; 00375 } 00376 00377 /* 00378 * Make sure that current process has access to this window station 00379 */ 00380 Status = STATUS_ACCESS_DENIED; 00381 00382 if (grpWinStaList != NULL) { 00383 00384 /* 00385 * !!! 00386 * 00387 * This relies on the fact that there is only ONE interactive 00388 * windowstation and that it is the first one in the list. 00389 * If multiple windowstations are ever supported 00390 * a lookup will have to be done here. 00391 */ 00392 pwinsta = grpWinStaList; 00393 00394 /* 00395 * For now we will just do the user luid test till we figure out 00396 * what fInherit means for a Multi-User system 00397 */ 00398 if (fInherit) { 00399 if ( (RtlEqualLuid(&pStats->AuthenticationId, &pwinsta->luidUser)) || 00400 (RtlEqualLuid(&pStats->AuthenticationId, &luidSystem)) || 00401 (AccessCheckObject(pwinsta, GENERIC_EXECUTE, (KPROCESSOR_MODE)(gbSecureDesktop ? UserMode : KernelMode), &WinStaMapping)) ) { 00402 Status = STATUS_SUCCESS; 00403 } 00404 } else { 00405 /* Bug 42905. Service Controller clears the flag 00406 * ScStartupInfo.dwFlags &= (~STARTF_DESKTOPINHERIT) to make services 00407 * running under the context of system non-interactive. Hence if fInherit 00408 * is false don't do the SystemLuid and AccessCheckObject tests. 00409 */ 00410 00411 if (RtlEqualLuid(&pStats->AuthenticationId, &pwinsta->luidUser)) { 00412 Status = STATUS_SUCCESS; 00413 } 00414 } 00415 } 00416 00417 ZwClose(htoken); 00418 UserFreePool(pStats); 00419 return Status; 00420 } 00421 00422 if (gbSecureDesktop) { 00423 /* 00424 * Since we don't have a pointer to the WindowStation Object we will do 00425 * a OpenWindowStation() to make sure we have the desired access. 00426 */ 00427 cbObjA = sizeof(*pObjAttr) + sizeof(*pstrStatic); 00428 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), 00429 &pObjAttr, 0, &cbObjA, MEM_COMMIT, PAGE_READWRITE); 00430 pstrStatic = (PUNICODE_STRING)((PBYTE)pObjAttr + sizeof(*pObjAttr)); 00431 00432 if (NT_SUCCESS(Status)) { 00433 00434 /* 00435 * Note -- the string must be in client-space or the 00436 * address validation in OpenWindowStation will fail. 00437 * 00438 * This code is called from xxxResolveDesktop and the buffer of the passed-in string 00439 * is in the teb already. 00440 */ 00441 try { 00442 *pstrStatic = *pstrWinSta; 00443 InitializeObjectAttributes( pObjAttr, 00444 pstrStatic, 00445 OBJ_CASE_INSENSITIVE, 00446 NULL, 00447 NULL 00448 ); 00449 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00450 Status = GetExceptionCode(); 00451 } 00452 00453 if (NT_SUCCESS(Status)) { 00454 hwsta = _OpenWindowStation(pObjAttr, GENERIC_EXECUTE, UserMode); 00455 } 00456 } else { 00457 return Status; 00458 } 00459 00460 if (pObjAttr != NULL) { 00461 ZwFreeVirtualMemory(NtCurrentProcess(), &pObjAttr, &cbObjA, 00462 MEM_RELEASE); 00463 } 00464 } else { 00465 InitializeObjectAttributes( &ObjAttr, 00466 pstrWinSta, 00467 OBJ_CASE_INSENSITIVE, 00468 NULL, 00469 NULL 00470 ); 00471 hwsta = _OpenWindowStation(&ObjAttr, GENERIC_EXECUTE, KernelMode); 00472 } 00473 00474 if (!hwsta) { 00475 return STATUS_ACCESS_DENIED; 00476 } 00477 00478 Status = ZwClose(hwsta); 00479 00480 UserAssert(NT_SUCCESS(Status)); 00481 return Status; 00482 }

PWND _WindowFromDC HDC  hdc  ) 
 

Definition at line 1995 of file dc.c.

References tagDCE::DCX_flags, gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, and tagDCE::pwndOrg.

Referenced by xxxAnimateCaption().

01997 { 01998 PDCE pdce; 01999 02000 for (pdce = gpDispInfo->pdceFirst; pdce; pdce = pdce->pdceNext) { 02001 02002 if (!(pdce->DCX_flags & DCX_INUSE) || (pdce->DCX_flags & DCX_CREATEDC)) 02003 continue; 02004 02005 if (pdce->hdc == hdc) 02006 return pdce->pwndOrg; 02007 } 02008 02009 return NULL; 02010 }

VOID _WOWCleanup HANDLE  hInstance,
DWORD  hTaskWow
 

Definition at line 218 of file w32/ntuser/kernel/cleanup.c.

References tagSHAREDINFO::aheList, tagSERVERINFO::apfnClientA, _HANDLEENTRY::bFlags, tagHANDLETYPEINFO::bObjectCreateFlags, _HANDLEENTRY::bType, CSF_WOWDEFERDESTROY, DestroyClass(), DWORD, gahti, giheLast, gpsi, gSharedInfo, HANDLEF_DESTROY, HMDestroyUnlockedObject(), tagTDB::hTaskWow, tagWND::lpfnWndProc, NULL, OCF_PROCESSOWNED, tagPROCESSINFO::pclsPrivateList, tagPROCESSINFO::pclsPublicList, _PFNCLIENT::pfnDefWindowProc, _HANDLEENTRY::phead, _HANDLEENTRY::pOwner, tagTHREADINFO::ppi, PpiCurrent, PPROCOBJHEAD, tagTHREADINFO::ptdb, TestWF, TIF_16BIT, tagTHREADINFO::TIF_flags, TYPE_CALLPROC, TYPE_FREE, TYPE_WINDOW, VOID(), WFSERVERSIDEPROC, and WNDPROC_PWND.

Referenced by xxxDestroyThreadInfo().

00221 { 00222 PPROCESSINFO ppi = PpiCurrent(); 00223 PPCLS ppcls; 00224 PHE pheT, pheMax; 00225 int i; 00226 00227 if (hInstance != NULL) { 00228 00229 /* 00230 * Task cleanup 00231 */ 00232 00233 PWND pwnd; 00234 hTaskWow = (DWORD) LOWORD(hTaskWow); 00235 /* 00236 * Task exit called by wow. This loop will Pseudo-Destroy windows 00237 * created by this task. 00238 */ 00239 pheMax = &gSharedInfo.aheList[giheLast]; 00240 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 00241 PTHREADINFO ptiTest = (PTHREADINFO)pheT->pOwner; 00242 if ((pheT->bType == TYPE_WINDOW) && 00243 (ptiTest->TIF_flags & TIF_16BIT) && 00244 (ptiTest->ptdb) && 00245 (ptiTest->ptdb->hTaskWow == hTaskWow) && 00246 (ptiTest->ppi == ppi)) { 00247 00248 pwnd = (PWND) pheT->phead; 00249 if (!TestWF(pwnd, WFSERVERSIDEPROC)) { 00250 pwnd->lpfnWndProc = (WNDPROC_PWND)gpsi->apfnClientA.pfnDefWindowProc; 00251 } 00252 } 00253 } 00254 return; 00255 } 00256 00257 /* 00258 * If we get here, we are in thread cleanup and all of the thread's windows 00259 * have been destroyed or disassociated with any classes. If a class 00260 * marked for destruction at this point still has windows, they must 00261 * belong to a dll. 00262 */ 00263 00264 /* 00265 * Destroy private classes marked for destruction 00266 */ 00267 ppcls = &(ppi->pclsPrivateList); 00268 for (i = 0; i < 2; ++i) { 00269 while (*ppcls != NULL) { 00270 if ((*ppcls)->hTaskWow == hTaskWow && 00271 ((*ppcls)->CSF_flags & CSF_WOWDEFERDESTROY)) { 00272 if ((*ppcls)->cWndReferenceCount == 0) { 00273 DestroyClass(ppcls); 00274 } else { 00275 RIPMSG0(RIP_ERROR, "Windows remain for a WOW class marked for destruction"); 00276 ppcls = &((*ppcls)->pclsNext); 00277 } 00278 } else 00279 ppcls = &((*ppcls)->pclsNext); 00280 } 00281 00282 /* 00283 * Destroy public classes marked for destruction 00284 */ 00285 ppcls = &(ppi->pclsPublicList); 00286 } 00287 00288 /* 00289 * Destroy menus, cursors, icons and accel tables identified by hTaskWow 00290 */ 00291 pheMax = &gSharedInfo.aheList[giheLast]; 00292 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 00293 00294 /* 00295 * Check against free before we look at ppi... because pq is stored 00296 * in the object itself, which won't be there if TYPE_FREE. 00297 */ 00298 if (pheT->bType == TYPE_FREE) 00299 continue; 00300 00301 /* 00302 * Destroy those objects created by this task. 00303 */ 00304 if ( !(gahti[pheT->bType].bObjectCreateFlags & OCF_PROCESSOWNED) || 00305 (PPROCESSINFO)pheT->pOwner != ppi || 00306 (((PPROCOBJHEAD)pheT->phead)->hTaskWow != hTaskWow) || 00307 (pheT->bType == TYPE_CALLPROC) /* Do not destroy CALLPROCDATA objects. 00308 * These should only get nuked when the 00309 * process goes away or when the class 00310 * is nuked. 00311 */ 00312 ) { 00313 00314 continue; 00315 } 00316 00317 /* 00318 * Make sure this object isn't already marked to be destroyed - we'll 00319 * do no good if we try to destroy it now since it is locked. 00320 */ 00321 if (pheT->bFlags & HANDLEF_DESTROY) { 00322 continue; 00323 } 00324 00325 /* 00326 * Destroy this object. 00327 */ 00328 HMDestroyUnlockedObject(pheT); 00329 } 00330 }

VOID _WOWModuleUnload HANDLE  hModule  ) 
 

Definition at line 99 of file w32/ntuser/kernel/cleanup.c.

References tagSHAREDINFO::aheList, tagSERVERINFO::apfnClientA, tagSERVERINFO::apfnClientW, tagCLS::atomClassName, tagSERVERINFO::atomSysClass, _HANDLEENTRY::bType, tagCLS::CSF_flags, CSF_WOWCLASS, CSF_WOWDEFERDESTROY, DestroyClass(), giheLast, gpfnwp, gpsi, gSharedInfo, ICLS_BUTTON, ICLS_MAX, tagWND::lpfnWndProc, NULL, tagPROCESSINFO::pclsPrivateList, tagPROCESSINFO::pclsPublicList, _PFNCLIENT::pfnDefWindowProc, _HANDLEENTRY::phead, _HANDLEENTRY::pOwner, tagTHREADINFO::ppi, PpiCurrent, PseudoDestroyClassWindows(), PtiCurrent, PWCFromPCLS, TestWF, TIF_16BIT, tagTHREADINFO::TIF_flags, TYPE_WINDOW, VOID(), WFSERVERSIDEPROC, and WNDPROC_PWND.

00099 { 00100 PPROCESSINFO ppi = PpiCurrent(); 00101 PHE pheT, pheMax; 00102 PPCLS ppcls; 00103 int i; 00104 00105 UserAssert(gpfnwp[0]); 00106 00107 /* 00108 * PseudoDestroy windows with wndprocs from this hModule 00109 * If its a wow16 wndproc, check if the hMod16 is this module 00110 * and Nuke matches. 00111 */ 00112 pheMax = &gSharedInfo.aheList[giheLast]; 00113 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 00114 PTHREADINFO ptiTest = (PTHREADINFO)pheT->pOwner; 00115 PWND pwnd; 00116 if ((pheT->bType == TYPE_WINDOW) && 00117 (ptiTest->TIF_flags & TIF_16BIT) && 00118 (ptiTest->ppi == ppi)) { 00119 00120 pwnd = (PWND) pheT->phead; 00121 if (!TestWF(pwnd, WFSERVERSIDEPROC) && 00122 IsWOWProc(pwnd->lpfnWndProc) && 00123 (pwnd->hMod16 == (WORD)(ULONG_PTR)hModule)) { 00124 pwnd->lpfnWndProc = (WNDPROC_PWND)gpsi->apfnClientA.pfnDefWindowProc; 00125 } 00126 } 00127 } 00128 00129 /* 00130 * Destroy private classes identified by hInstance that are not 00131 * referenced by any windows. Mark in-use classes for later 00132 * destruction. 00133 */ 00134 ppcls = &(ppi->pclsPrivateList); 00135 00136 for (i = 0; i < 2; ++i) { 00137 while (*ppcls != NULL) { 00138 00139 PWC pwc; 00140 PCLS pcls; 00141 00142 if (HIWORD((ULONG_PTR)(*ppcls)->hModule) == (WORD)(ULONG_PTR)hModule) { 00143 if ((*ppcls)->cWndReferenceCount == 0) { 00144 DestroyClass(ppcls); 00145 /* 00146 * DestroyClass does *ppcls = pcls->pclsNext; 00147 * so we just want continue here 00148 */ 00149 } else { 00150 00151 /* 00152 * Zap all the windows around that belong to this class. 00153 */ 00154 PseudoDestroyClassWindows(PtiCurrent()->rpdesk->pDeskInfo->spwnd, *ppcls); 00155 00156 /* 00157 * Win 3.1 does not distinguish between Dll's and Exe's 00158 */ 00159 (*ppcls)->CSF_flags |= CSF_WOWDEFERDESTROY; 00160 ppcls = &((*ppcls)->pclsNext); 00161 } 00162 continue; 00163 } 00164 00165 pcls = *ppcls; 00166 00167 if ((pcls->CSF_flags & CSF_WOWCLASS) && ((WORD)(ULONG_PTR)hModule == (pwc = PWCFromPCLS(pcls))->hMod16)) { 00168 00169 ATOM atom; 00170 int iSel; 00171 00172 /* 00173 * See if the window's class atom matches any of 00174 * the system ones. If so, jam in the original window proc. 00175 * Otherwise, use DefWindowProc 00176 */ 00177 atom = (*ppcls)->atomClassName; 00178 for (iSel = ICLS_BUTTON; iSel < ICLS_MAX; iSel++) { 00179 if ((gpfnwp[iSel]) && (atom == gpsi->atomSysClass[iSel])) { 00180 (*ppcls)->lpfnWndProc = (WNDPROC_PWND)gpfnwp[iSel]; 00181 break; 00182 } 00183 } 00184 if (iSel == ICLS_MAX) 00185 (*ppcls)->lpfnWndProc = (WNDPROC_PWND)gpsi->apfnClientW.pfnDefWindowProc; 00186 } 00187 00188 ppcls = &((*ppcls)->pclsNext); 00189 } 00190 00191 /* 00192 * Destroy public classes identified by hInstance that are not 00193 * referenced by any windows. Mark in-use classes for later 00194 * destruction. 00195 */ 00196 ppcls = &(ppi->pclsPublicList); 00197 } 00198 return; 00199 00200 }

BOOL AccessCheckObject PVOID  ,
ACCESS_MASK  ,
KPROCESSOR_MODE  ,
CONST GENERIC_MAPPING * 
 

Definition at line 555 of file w32/ntuser/kernel/security.c.

References BOOL, KeyMapping, NTSTATUS(), ObCheckObjectAccess(), SeCreateAccessState(), SeDeleteAccessState(), Status, and TRUE.

Referenced by _BuildNameList(), _UserTestForWinStaAccess(), OpenCacheKeyEx(), ReferenceWindowStation(), and xxxMouseEventDirect().

00560 { 00561 NTSTATUS Status; 00562 ACCESS_STATE AccessState; 00563 BOOLEAN fAccessGranted; 00564 AUX_ACCESS_DATA AuxData; 00565 BOOLEAN bMutexLocked = (pGenericMapping == (&KeyMapping)); 00566 /* 00567 * Due to a resource problem in the object manager, we must pass in a TRUE 00568 * when checking access for registry keys, even if we do not explicitly have 00569 * the object type mutex. If we do not, we can get into a deadlock situation with this mutex 00570 * and the CmpRegistry lock. 00571 */ 00572 00573 SeCreateAccessState(&AccessState, &AuxData, amRequest, (PGENERIC_MAPPING)pGenericMapping); 00574 fAccessGranted = ObCheckObjectAccess( 00575 pobj, 00576 &AccessState, 00577 bMutexLocked, 00578 AccessMode, 00579 &Status); 00580 SeDeleteAccessState(&AccessState); 00581 return (BOOL)(fAccessGranted == TRUE); 00582 }

VOID AddHmodDependency int  iatom  ) 
 

Definition at line 136 of file libmgmt.c.

References acatomSysDepends, catomSysTableEntries, and VOID().

Referenced by _SetWinEventHook(), and zzzSetWindowsHookEx().

00138 { 00139 UserAssert(iatom >= 0); 00140 if (iatom < catomSysTableEntries) { 00141 acatomSysDepends[iatom]++; 00142 } 00143 }

PACCESS_ALLOWED_ACE AllocAce PACCESS_ALLOWED_ACE  pace,
BYTE  bType,
BYTE  bFlags,
ACCESS_MASK  am,
PSID  psid,
LPDWORD  lpdwLength
 

Definition at line 37 of file w32/ntuser/kernel/security.c.

References DWORD, NULL, PBYTE, RtlCopySid(), RtlLengthSid(), and USHORT.

Referenced by InitSecurity(), and xxxConnectService().

00044 { 00045 PACCESS_ALLOWED_ACE paceNew; 00046 DWORD iEnd; 00047 DWORD dwLength, dwLengthSid; 00048 00049 /* 00050 * Allocate space for the ACE. 00051 */ 00052 dwLengthSid = RtlLengthSid(psid); 00053 dwLength = dwLengthSid + sizeof(ACE_HEADER) + sizeof(ACCESS_MASK); 00054 if (pace == NULL) { 00055 iEnd = 0; 00056 pace = UserAllocPoolWithQuota(dwLength, TAG_SECURITY); 00057 if (pace == NULL) 00058 return NULL; 00059 } else { 00060 iEnd = *lpdwLength; 00061 paceNew = UserAllocPoolWithQuota(iEnd + dwLength, TAG_SECURITY); 00062 if (paceNew == NULL) 00063 return NULL; 00064 RtlCopyMemory(paceNew, pace, iEnd); 00065 UserFreePool(pace); 00066 pace = paceNew; 00067 } 00068 *lpdwLength = dwLength + iEnd; 00069 00070 /* 00071 * Insert the new ACE. 00072 */ 00073 paceNew = (PACCESS_ALLOWED_ACE)((PBYTE)pace + iEnd); 00074 paceNew->Header.AceType = bType; 00075 paceNew->Header.AceSize = (USHORT)dwLength; 00076 paceNew->Header.AceFlags = bFlags; 00077 paceNew->Mask = am; 00078 RtlCopySid(dwLengthSid, &paceNew->SidStart, psid); 00079 return pace; 00080 }

BOOL AllocateCvr PSMWP  psmwp,
int  cwndHint
 

Definition at line 203 of file swp.c.

References tagSMWP::acvr, BOOL, tagSMWP::ccvr, tagSMWP::ccvrAlloc, FALSE, NULL, and TRUE.

Referenced by _BeginDeferWindowPos(), InternalBeginDeferWindowPos(), and Win32UserInitialize().

00204 { 00205 PCVR acvr; 00206 00207 UserAssert(cwndHint != 0); 00208 acvr = (PCVR)UserAllocPoolWithQuota(sizeof(CVR) * cwndHint, TAG_SWP); 00209 00210 if (acvr == NULL) { 00211 return FALSE; 00212 } 00213 00214 /* 00215 * Initialize psmwp related fields. 00216 * CVR array is initialized by _DeferWindowPos 00217 */ 00218 00219 psmwp->acvr = acvr; 00220 psmwp->ccvrAlloc = cwndHint; 00221 psmwp->ccvr = 0; 00222 return TRUE; 00223 }

BOOL AllocateUnicodeString PUNICODE_STRING  pstrDst,
PUNICODE_STRING  pstrSrc
 

Definition at line 155 of file w32/ntuser/kernel/random.c.

References FALSE, NULL, RtlInitUnicodeString(), and TRUE.

Referenced by _SetCursorIconData(), InternalRegisterClassEx(), and xxxSetClassData().

00158 { 00159 if (cczpstrSrc == NULL) { 00160 RtlInitUnicodeString(pstrDst, NULL); 00161 return TRUE; 00162 } 00163 00164 pstrDst->Buffer = UserAllocPoolWithQuota(cczpstrSrc->Length+sizeof(UNICODE_NULL), TAG_TEXT); 00165 if (pstrDst->Buffer == NULL) { 00166 return FALSE; 00167 } 00168 00169 try { 00170 RtlCopyMemory(pstrDst->Buffer, cczpstrSrc->Buffer, cczpstrSrc->Length); 00171 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00172 UserFreePool(pstrDst->Buffer); 00173 pstrDst->Buffer = NULL; 00174 return FALSE; 00175 } 00176 pstrDst->MaximumLength = cczpstrSrc->Length+sizeof(UNICODE_NULL); 00177 pstrDst->Length = cczpstrSrc->Length; 00178 pstrDst->Buffer[pstrDst->Length / sizeof(WCHAR)] = 0; 00179 00180 return TRUE; 00181 }

PQMSG AllocQEntry PMLIST  pml  ) 
 

Definition at line 3208 of file queue.c.

References tagMLIST::cMsgs, DebugValidateMLIST, DebugValidateMLISTandQMSG, ExAllocateFromPagedLookasideList(), gUserPostMessageLimit, NULL, tagQMSG::pqmsgNext, tagQMSG::pqmsgPrev, tagMLIST::pqmsgRead, tagMLIST::pqmsgWriteLast, and QEntryLookaside.

Referenced by _PostMessage(), _PostThreadMessage(), DestroyProcessInfo(), DoTimer(), PostEventMessage(), PostInputMessage(), and xxxSetForegroundWindow2().

03210 { 03211 PQMSG pqmsg; 03212 03213 DebugValidateMLIST(pml); 03214 03215 if (pml->cMsgs >= gUserPostMessageLimit) { 03216 RIPMSG3(RIP_WARNING, "AllocQEntry: # of post messages exceeds the limit(%d) in pti=0x%p, pml=0x%p", 03217 gUserPostMessageLimit, W32GetCurrentThread(), pml); 03218 return NULL; 03219 } 03220 03221 /* 03222 * Allocate a Q message structure. 03223 */ 03224 if ((pqmsg = ExAllocateFromPagedLookasideList(QEntryLookaside)) == NULL) { 03225 return NULL; 03226 } 03227 03228 RtlZeroMemory(pqmsg, sizeof(*pqmsg)); 03229 03230 if (pml->pqmsgWriteLast != NULL) { 03231 pml->pqmsgWriteLast->pqmsgNext = pqmsg; 03232 pqmsg->pqmsgPrev = pml->pqmsgWriteLast; 03233 pml->pqmsgWriteLast = pqmsg; 03234 } else { 03235 pml->pqmsgWriteLast = pml->pqmsgRead = pqmsg; 03236 } 03237 03238 pml->cMsgs++; 03239 03240 DebugValidateMLISTandQMSG(pml, pqmsg); 03241 03242 return pqmsg; 03243 }

PQ AllocQueue PTHREADINFO  ,
PQ 
 

Definition at line 2102 of file queue.c.

References tagQ::afKeyState, CBKEYSTATE, tagQ::cLockCount, DebugValidateMLIST, ExAllocateFromPagedLookasideList(), gafAsyncKeyState, GTERMF_MOUSE, tagQ::iCursorLevel, LockQCursor, tagQ::mlInput, NULL, tagTHREADINFO::pq, QLookaside, SYSCUR, TEST_GTERMF, and USHORT.

Referenced by xxxCreateThreadInfo(), xxxHardErrorControl(), xxxSetThreadDesktop(), xxxSwitchDesktop(), zzzJournalAttach(), and zzzRecalcThreadAttachment().

02106 { 02107 USHORT cLockCount; 02108 02109 if (pq == NULL) { 02110 pq = ExAllocateFromPagedLookasideList(QLookaside); 02111 if (pq == NULL) { 02112 return NULL; 02113 } 02114 cLockCount = 0; 02115 } else { 02116 DebugValidateMLIST(&pq->mlInput); 02117 /* 02118 * Preserve lock count. 02119 */ 02120 cLockCount = pq->cLockCount; 02121 } 02122 RtlZeroMemory(pq, sizeof(Q)); 02123 pq->cLockCount = cLockCount; 02124 02125 /* 02126 * This is a new queue; we need to update its key state table before 02127 * the first input event is put in the queue. 02128 * We do this by copying the current keystate table and NULLing the recent 02129 * down state table. If a key is really down it will be updated when 02130 * we get it repeats. 02131 * 02132 * He is the old way that did not work because if the first key was say an 02133 * alt key the Async table would be updated, then the UpdateKeyState 02134 * message and it would look like the alt key was PREVIOUSLY down. 02135 * 02136 * The queue will get updated when it first reads input: to allow the 02137 * app to query the key state before it calls GetMessage, set its initial 02138 * key state to the asynchronous key state. 02139 */ 02140 if (ptiKeyState) { 02141 RtlCopyMemory(pq->afKeyState, ptiKeyState->pq->afKeyState, CBKEYSTATE); 02142 } else { 02143 RtlCopyMemory(pq->afKeyState, gafAsyncKeyState, CBKEYSTATE); 02144 } 02145 02146 /* 02147 * If there isn't a mouse set iCursorLevel to -1 so the 02148 * mouse cursor won't be visible on the screen. 02149 */ 02150 if ( 02151 !TEST_GTERMF(GTERMF_MOUSE)) { 02152 pq->iCursorLevel--; 02153 } 02154 /* 02155 * While the thread is starting up... it has the wait cursor. 02156 */ 02157 LockQCursor(pq, SYSCUR(WAIT)); 02158 02159 DebugValidateMLIST(&pq->mlInput); 02160 return pq; 02161 }

void AnimateFade void   ) 
 

Definition at line 984 of file sprite.c.

References BOOL, BYTE, tagFADE::dwFlags, DWORD, tagFADE::dwStart, tagFADE::dwTime, FADE_COMPLETED, FADE_SHOW, gfade, tagFADE::hbm, tagFADE::hdc, NtGetTickCount(), NULL, StopFade(), and UpdateFade().

Referenced by xxxSystemTimerProc().

00985 { 00986 DWORD dwTimeElapsed; 00987 BLENDFUNCTION blend; 00988 BYTE bAlpha; 00989 BOOL fShow; 00990 00991 UserAssert(gfade.hdc != NULL); 00992 UserAssert(gfade.hbm != NULL); 00993 00994 dwTimeElapsed = NtGetTickCount() - gfade.dwStart; 00995 00996 /* 00997 * If exceeding the allowed time, stop the animation now. 00998 */ 00999 if (dwTimeElapsed > gfade.dwTime) { 01000 StopFade(); 01001 return; 01002 } 01003 01004 fShow = (gfade.dwFlags & FADE_SHOW); 01005 01006 /* 01007 * Calculate new alpha value based on time elapsed. 01008 */ 01009 if (fShow) { 01010 bAlpha = (BYTE)((255 * dwTimeElapsed) / gfade.dwTime); 01011 } else { 01012 bAlpha = (BYTE)(255 * (gfade.dwTime - dwTimeElapsed) / gfade.dwTime); 01013 } 01014 01015 blend.BlendOp = AC_SRC_OVER; 01016 blend.BlendFlags = 0; 01017 blend.AlphaFormat = 0; 01018 blend.SourceConstantAlpha = bAlpha; 01019 UpdateFade(NULL, NULL, NULL, NULL, &blend); 01020 01021 /* 01022 * Check if finished animating the fade. 01023 */ 01024 if ((fShow && bAlpha == 255) || (!fShow && bAlpha == 0)) { 01025 gfade.dwFlags |= FADE_COMPLETED; 01026 StopFade(); 01027 } 01028 }

HIMC AssociateInputContext IN PWND  pWnd,
IN PIMC  pImc
 

Definition at line 289 of file ntimm.c.

References PtoH.

Referenced by AssociateInputContextEx(), and DestroyInputContext().

00292 { 00293 HIMC hImcRet = pWnd->hImc; 00294 pWnd->hImc = (HIMC)PtoH(pImc); 00295 00296 return hImcRet; 00297 }

AIC_STATUS AssociateInputContextEx IN PWND  pWnd,
IN PIMC  pImc,
IN DWORD  dwFlag
 

Definition at line 299 of file ntimm.c.

References AIC_ERROR, AIC_FOCUSCONTEXTCHANGED, AIC_STATUS, AIC_SUCCESS, AssociateInputContext(), BOOL, BuildHwndList(), BWL_ENUMCHILDREN, BWL_ENUMLIST, FreeHwndList(), GETPTI, tagWND::hImc, NULL, NULL_HIMC, tagTHREADINFO::pq, PtiCurrent, PtoH, RevalidateHwnd, tagBWL::rghwnd, tagTHREADINFO::spDefaultImc, tagQ::spwndFocus, and Status.

Referenced by NtUserAssociateInputContext().

00303 { 00304 PTHREADINFO ptiWnd = GETPTI(pWnd); 00305 PWND pWndFocus = ptiWnd->pq->spwndFocus; 00306 HIMC hImcFocus = pWndFocus->hImc; 00307 BOOL fIgnoreNoContext = (dwFlag & IACE_IGNORENOCONTEXT) == IACE_IGNORENOCONTEXT; 00308 AIC_STATUS Status = AIC_SUCCESS; 00309 00310 if (dwFlag & IACE_DEFAULT) { 00311 /* 00312 * use default input context. 00313 */ 00314 pImc = ptiWnd->spDefaultImc; 00315 00316 } else if (pImc != NULL && GETPTI(pImc) != ptiWnd) { 00317 /* 00318 * Cannot associate input context to window created 00319 * by other thread. 00320 */ 00321 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, 00322 "AssociateInputContextEx: pwnd not of Imc pti"); 00323 return AIC_ERROR; 00324 } 00325 00326 /* 00327 * Cannot do association under different process context. 00328 */ 00329 if (GETPTI(pWnd)->ppi != PtiCurrent()->ppi) { 00330 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, 00331 "AssociateInputContextEx: pwnd not of current ppi"); 00332 return AIC_ERROR; 00333 } 00334 00335 /* 00336 * Finally, make sure they are on the same desktop. 00337 */ 00338 if (pImc != NULL && pImc->head.rpdesk != pWnd->head.rpdesk) { 00339 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, 00340 "AssociateInputContextEx: no desktop access"); 00341 return AIC_ERROR; 00342 } 00343 00344 /* 00345 * If IACE_CHILDREN is specified, associate the input context 00346 * to the child windows of pWnd as well. 00347 */ 00348 if ((dwFlag & IACE_CHILDREN) && pWnd->spwndChild != NULL) { 00349 PBWL pbwl; 00350 PWND pwndT; 00351 HWND *phwndT; 00352 00353 pbwl = BuildHwndList(pWnd->spwndChild, 00354 BWL_ENUMLIST|BWL_ENUMCHILDREN, ptiWnd); 00355 00356 if (pbwl != NULL) { 00357 00358 for (phwndT = pbwl->rghwnd; *phwndT != (HWND)1; phwndT++) { 00359 /* 00360 * Make sure this hwnd is still around. 00361 */ 00362 if ((pwndT = RevalidateHwnd(*phwndT)) == NULL) 00363 continue; 00364 00365 if (pwndT->hImc == (HIMC)PtoH(pImc)) 00366 continue; 00367 00368 if (pwndT->hImc == NULL_HIMC && fIgnoreNoContext) 00369 continue; 00370 00371 AssociateInputContext(pwndT, pImc); 00372 00373 if (pwndT == pWndFocus) 00374 Status = AIC_FOCUSCONTEXTCHANGED; 00375 } 00376 00377 FreeHwndList(pbwl); 00378 } 00379 } 00380 00381 /* 00382 * Associate the input context to pWnd. 00383 */ 00384 if (pWnd->hImc != NULL_HIMC || !fIgnoreNoContext) { 00385 if (pWnd->hImc != (HIMC)PtoH(pImc)) { 00386 AssociateInputContext(pWnd, pImc); 00387 if (pWnd == pWndFocus) 00388 Status = AIC_FOCUSCONTEXTCHANGED; 00389 } 00390 } 00391 00392 return Status; 00393 }

BOOL FAR BitBltSysBmp HDC  hdc,
int  x,
int  y,
UINT  i
 

Definition at line 29 of file mngrayc.c.

References BOOL, tagOEMBITMAPINFO::cx, tagOEMBITMAPINFO::cy, FAR, gpsi, HDCBITS, HEBREW_UI_LANGID, NtUserBitBltSysBmp(), OBI_HELP, OBI_HELP_D, OBI_HELP_H, SYSMET, tagOEMBITMAPINFO::x, and tagOEMBITMAPINFO::y.

Referenced by DrawCaptionButtons(), DrawSize(), DrawStateW(), LoadBmp(), MNDrawArrow(), xxxDrawCaptionBar(), xxxDrawSB2(), xxxRealDrawMenuItem(), xxxTrackCaptionButton(), and zzzDrawInvertScrollArea().

00030 { 00031 POEMBITMAPINFO pOem = gpsi->oembmi + i; 00032 00033 return(NtUserBitBltSysBmp(hdc, x, y, pOem->cx, pOem->cy, pOem->x, pOem->y, SRCCOPY)); 00034 }

VOID BltColor HDC  ,
HBRUSH  ,
HDC  ,
int  ,
int  ,
int  ,
int  ,
int  ,
int  ,
UINT 
 

Definition at line 448 of file mngray.c.

References BC_INVERT, BC_NOMIRROR, cy, DWORD, gpDispInfo, tagDISPLAYINFO::hdcGray, L, NULL, and VOID().

Referenced by DrawMenuItemCheckMark(), DrawStateW(), xxxDrawMenuItem(), xxxDrawState(), and xxxRealDrawMenuItem().

00459 { 00460 HBRUSH hbrSave; 00461 DWORD textColorSave; 00462 DWORD bkColorSave; 00463 DWORD ROP; 00464 00465 /* 00466 * Set the Text and Background colors so that bltColor handles the 00467 * background of buttons (and other bitmaps) properly. 00468 * Save the HDC's old Text and Background colors. This causes problems 00469 * with Omega (and probably other apps) when calling GrayString which 00470 * uses this routine... 00471 */ 00472 textColorSave = GreSetTextColor(hdc, 0x00000000L); 00473 bkColorSave = GreSetBkColor(hdc, 0x00FFFFFFL); 00474 00475 if (hbr != NULL) 00476 hbrSave = GreSelectBrush(hdc, hbr); 00477 if (uBltFlags & BC_INVERT) 00478 ROP = 0xB8074AL; 00479 else 00480 ROP = 0xE20746L; 00481 00482 if (uBltFlags & BC_NOMIRROR) 00483 ROP |= NOMIRRORBITMAP; 00484 00485 GreBitBlt(hdc, 00486 xO, 00487 yO, 00488 cx, 00489 cy, 00490 hdcSrce ? hdcSrce : gpDispInfo->hdcGray, 00491 xO1, 00492 yO1, 00493 ROP, 00494 0x00FFFFFF); 00495 00496 if (hbr != NULL) 00497 GreSelectBrush(hdc, hbrSave); 00498 00499 /* 00500 * Restore saved colors 00501 */ 00502 GreSetTextColor(hdc, textColorSave); 00503 GreSetBkColor(hdc, bkColorSave); 00504 }

BOOL BltIcon HDC  hdc,
int  x,
int  y,
int  cx,
int  cy,
HDC  hdcSrc,
PCURSOR  pcursor,
BOOL  fMask,
LONG  rop
 

Definition at line 32 of file wmicon.c.

References BOOL, cy, FALSE, SetBestStretchMode, and TRUE.

Referenced by _DrawIconEx(), and BltMe4Times().

00042 { 00043 HBITMAP hbmpSave; 00044 HBITMAP hbmpUse; 00045 LONG rgbText; 00046 LONG rgbBk; 00047 int nMode; 00048 00049 /* 00050 * Setup the DC for drawing 00051 */ 00052 hbmpUse = (fMask || !pcur->hbmColor ? pcur->hbmMask : pcur->hbmColor); 00053 00054 rgbBk = GreSetBkColor(hdc, 0x00FFFFFFL); 00055 rgbText = GreSetTextColor(hdc, 0x00000000L); 00056 nMode = SetBestStretchMode(hdc, pcur->bpp, FALSE); 00057 00058 hbmpSave = GreSelectBitmap(hdcSrc, hbmpUse); 00059 00060 /* 00061 * Do the output to the surface. By passing in (-1) as the background 00062 * color, we are telling GDI to use the background-color already set 00063 * in the DC. 00064 */ 00065 GreStretchBlt(hdc, 00066 x, 00067 y, 00068 cx, 00069 cy, 00070 hdcSrc, 00071 0, 00072 (fMask || pcur->hbmColor ? 0 : pcur->cy / 2), 00073 pcur->cx, 00074 pcur->cy / 2, 00075 rop, 00076 (COLORREF)-1); 00077 00078 GreSetStretchBltMode(hdc, nMode); 00079 GreSetTextColor(hdc, rgbText); 00080 GreSetBkColor(hdc, rgbBk); 00081 00082 GreSelectBitmap(hdcSrc, hbmpSave); 00083 00084 return TRUE; 00085 }

VOID BoundCursor LPPOINT  lppt  ) 
 

Definition at line 299 of file ntuser/kernel/cursor.c.

References ClipPointToDesktop(), tagDISPLAYINFO::fDesktopIsRect, gpDispInfo, grcCursorClip, grcVDMCursorBounds, gspwndFullScreen, NULL, PUDF_VDMBOUNDSACTIVE, TEST_PUDF, and VOID().

Referenced by xxxMoveEventAbsolute(), zzzActiveCursorTracking(), and zzzInternalSetCursorPos().

00301 { 00302 if (TEST_PUDF(PUDF_VDMBOUNDSACTIVE) && gspwndFullScreen != NULL) { 00303 00304 if (lppt->x < grcVDMCursorBounds.left) { 00305 lppt->x = grcVDMCursorBounds.left; 00306 } else if (lppt->x >= grcVDMCursorBounds.right) { 00307 lppt->x = grcVDMCursorBounds.right - 1; 00308 } 00309 00310 if (lppt->y < grcVDMCursorBounds.top) { 00311 lppt->y = grcVDMCursorBounds.top; 00312 } else if (lppt->y >= grcVDMCursorBounds.bottom) { 00313 lppt->y = grcVDMCursorBounds.bottom - 1; 00314 } 00315 00316 } else { 00317 00318 if (lppt->x < grcCursorClip.left) { 00319 lppt->x = grcCursorClip.left; 00320 } else if (lppt->x >= grcCursorClip.right) { 00321 lppt->x = grcCursorClip.right - 1; 00322 } 00323 00324 if (lppt->y < grcCursorClip.top) { 00325 lppt->y = grcCursorClip.top; 00326 } else if (lppt->y >= grcCursorClip.bottom) { 00327 lppt->y = grcCursorClip.bottom - 1; 00328 } 00329 } 00330 00331 /* 00332 * If we have more than one monitor, then we need to clip the 00333 * cursor to a point on the desktop. 00334 */ 00335 if (!gpDispInfo->fDesktopIsRect) { 00336 ClipPointToDesktop(lppt); 00337 } 00338 }

UINT BuildHimcList PTHREADINFO  pti,
UINT  cHimcMax,
HIMC *  phimcFirst
 

Definition at line 475 of file ntimm.c.

References FALSE, NULL, tagIMC::pImcNext, PtiCurrent, tagTHREADINFO::ptiSibling, PtoH, tagTHREADINFO::spDefaultImc, and UINT.

Referenced by ImmEnumInputContext(), and NtUserBuildHimcList().

00479 { 00480 PIMC pImcT; 00481 UINT i = 0; 00482 00483 if (pti == NULL) { 00484 /* 00485 * Build the list which contains all IMCs created by calling process. 00486 */ 00487 for (pti = PtiCurrent()->ppi->ptiList; pti != NULL; pti = pti->ptiSibling) { 00488 pImcT = pti->spDefaultImc; 00489 while (pImcT != NULL) { 00490 if (i < cHimcMax) { 00491 try { 00492 ccxphimcFirst[i] = (HIMC)PtoH(pImcT); 00493 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00494 } 00495 } 00496 i++; 00497 pImcT = pImcT->pImcNext; 00498 } 00499 } 00500 } 00501 else { 00502 /* 00503 * Build the list which contains all IMCs created by specified thread. 00504 */ 00505 pImcT = pti->spDefaultImc; 00506 while (pImcT != NULL) { 00507 if (i < cHimcMax) { 00508 try { 00509 ccxphimcFirst[i] = (HIMC)PtoH(pImcT); 00510 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00511 } 00512 } 00513 i++; 00514 pImcT = pImcT->pImcNext; 00515 } 00516 } 00517 00518 return i; 00519 }

PBWL BuildHwndList PWND  pwnd,
UINT  flags,
PTHREADINFO  ptiOwner
 

Definition at line 91 of file enumwin.c.

References BWL, BWL_ENUMIMELAST, BWL_ENUMOWNERLIST, BWL_REMOVEIMECHILD, CheckCritIn, CHWND_BWLCREATE, gpbwlList, InternalBuildHwndList(), InternalBuildHwndOwnerList(), IS_IME_ENABLED, NULL, pbwlCache, tagBWL::pbwlNext, tagBWL::phwndMax, tagBWL::phwndNext, PtiCurrent, tagBWL::ptiOwner, and tagBWL::rghwnd.

Referenced by _FindWindowEx(), ArrangeWindows(), AssociateInputContextEx(), CascadeWindowsEnum(), DestroyInputContext(), InitSwitchWndInfo(), InternalEnumWindows(), NtUserBuildHwndList(), StartTaskModalDialog(), UnmaximizeChildWindows(), xxxArrangeIconicWindows(), xxxCheckImeShowStatus(), xxxClientShutdown(), xxxDefWindowProc(), xxxDesktopRecalc(), xxxDWPPrint(), xxxInternalDoSyncPaint(), xxxInternalEnumWindow(), xxxMetricsRecalc(), xxxSendBSMtoDesktop(), and xxxShowOwnedWindows().

00095 { 00096 PBWL pbwl; 00097 00098 CheckCritIn(); 00099 00100 if ((pbwl = pbwlCache) != NULL) { 00101 00102 /* 00103 * We're using the cache now; zero it out. 00104 */ 00105 #if DBG 00106 pbwlCachePrev = pbwlCache; 00107 #endif 00108 pbwlCache = NULL; 00109 00110 #if DBG 00111 { 00112 PBWL pbwlT; 00113 /* 00114 * pbwlCache shouldn't be in the global linked list. 00115 */ 00116 for (pbwlT = gpbwlList; pbwlT != NULL; pbwlT = pbwlT->pbwlNext) { 00117 UserAssert(pbwlT != pbwl); 00118 } 00119 } 00120 #endif 00121 } else { 00122 00123 /* 00124 * sizeof(BWL) includes the first element of array. 00125 */ 00126 pbwl = (PBWL)UserAllocPool(sizeof(BWL) + sizeof(PWND) * CHWND_BWLCREATE, 00127 TAG_WINDOWLIST); 00128 if (pbwl == NULL) 00129 return NULL; 00130 00131 pbwl->phwndMax = &pbwl->rghwnd[CHWND_BWLCREATE - 1]; 00132 } 00133 pbwl->phwndNext = pbwl->rghwnd; 00134 00135 /* 00136 * We'll use ptiOwner as temporary storage for the thread we're 00137 * scanning for. It will get reset to the proper thing at the bottom 00138 * of this routine. 00139 */ 00140 pbwl->ptiOwner = pti; 00141 00142 #ifdef OWNERLIST 00143 if (flags & BWL_ENUMOWNERLIST) { 00144 pbwl = InternalBuildHwndOwnerList(pbwl, pwnd, NULL); 00145 } else { 00146 pbwl = InternalBuildHwndList(pbwl, pwnd, flags); 00147 } 00148 #else 00149 pbwl = InternalBuildHwndList(pbwl, pwnd, flags); 00150 #endif 00151 00152 /* 00153 * If phwndNext == phwndMax, it indicates that the pbwl has failed to expand. 00154 * The list is no longer valid, so we should just bail. 00155 */ 00156 if (pbwl->phwndNext >= pbwl->phwndMax) { 00157 UserAssert(pbwl->phwndNext == pbwl->phwndMax); 00158 /* 00159 * Even if we had picked pbwl from the global single cache (pbwlCache), 00160 * it should have already been unlinked from the global link list when it was put in the cache. 00161 * So we should just free it without manupilating the link pointers. 00162 * If we have allocated the pwbl for ourselves, we can simply free it. 00163 * In both cases, we should just call UserFreePool(). 00164 * As the side effect, it may make some room by providing a free pool block. 00165 */ 00166 UserFreePool(pbwl); 00167 return NULL; 00168 } 00169 00170 /* 00171 * Stick in the terminator. 00172 */ 00173 *pbwl->phwndNext = (HWND)1; 00174 00175 #ifdef FE_IME 00176 if (flags & BWL_ENUMIMELAST) { 00177 UserAssert(IS_IME_ENABLED()); 00178 /* 00179 * For IME windows. 00180 * Rebuild window list for EnumWindows API. Because ACCESS 2.0 assumes 00181 * the first window that is called CallBack Functions in the task is 00182 * Q-Card Wnd. We should change the order of IME windows 00183 */ 00184 pbwl = InternalRebuildHwndListForIMEClass(pbwl, 00185 (flags & BWL_REMOVEIMECHILD) == BWL_REMOVEIMECHILD); 00186 } 00187 #endif 00188 00189 /* 00190 * Finally link this guy into the list. 00191 */ 00192 pbwl->ptiOwner = PtiCurrent(); 00193 pbwl->pbwlNext = gpbwlList; 00194 gpbwlList = pbwl; 00195 00196 00197 /* 00198 * We should have given out the cache if it was available 00199 */ 00200 UserAssert(pbwlCache == NULL); 00201 00202 return pbwl; 00203 }

PWND CalcForegroundInsertAfter PWND  pwnd  ) 
 

Definition at line 3620 of file swp.c.

References FALSE, GetLastNonBottomMostWindow(), GetLastTopMostWindow(), GETPTI, gpqForeground, IS_IME_ENABLED, NULL, tagQ::spwndActive, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndOwner, tagWND::spwndParent, TestWF, TestwndChild, TIF_ALLOWFOREGROUNDACTIVATE, TRUE, WEFTOPMOST, WFBOTTOMMOST, and WFVISIBLE.

Referenced by CheckOnTop(), CheckTopmost(), TrackBackground(), xxxCreateWindowEx(), and xxxSetParent().

03622 { 03623 PWND pwndInsertAfter, pwndInsertAfterSave; 03624 PWND pwndT; 03625 PTHREADINFO ptiTop; 03626 #ifdef LATER // see #88810 03627 BOOLEAN fImeOwnerIsBottom = FALSE; 03628 #endif 03629 03630 /* 03631 * If we're allowing this application to make this top 03632 * level window foreground active, then this app may 03633 * not be foreground yet, but we want any windows it 03634 * zorders to appear on top because it is probably about 03635 * to activate them (this is a guess!) If this is the case, 03636 * let it do what it wants. A good example of this is an 03637 * application like toolbook that creates a window without a 03638 * caption, doesn't activate it, and wants that to appear on top. 03639 */ 03640 03641 if (TestWF(pwnd, WFBOTTOMMOST)) { 03642 pwndInsertAfter = GetLastNonBottomMostWindow(pwnd, TRUE); 03643 } else { 03644 pwndInsertAfter = GetLastTopMostWindow(); 03645 #ifdef LATER // see #88810 03646 if (IS_IME_ENABLED()) { 03647 fImeOwnerIsBottom = IsBottomIMEWindow(pwnd); 03648 if (fImeOwnerIsBottom) { 03649 for (pwndT = pwndInsertAfter; pwndT; pwndT = pwndT->spwndNext) { 03650 if (ImeCheckBottomIMEWindow(pwndT)) { 03651 /* 03652 * toplevel owner of pwndT->spwndNext is BOTTOMMOST 03653 */ 03654 break; 03655 } 03656 pwndInsertAfter = pwndT; 03657 } 03658 } 03659 } 03660 #endif // LATER 03661 } 03662 03663 03664 if (!TestwndChild(pwnd)) { 03665 // if (hwnd->hwndParent == hwndDesktop) -- Chicago conditional FritzS 03666 03667 if ((GETPTI(pwnd)->TIF_flags & TIF_ALLOWFOREGROUNDACTIVATE) || 03668 (GETPTI(pwnd)->ppi->W32PF_Flags & W32PF_ALLOWFOREGROUNDACTIVATE)) { 03669 03670 return pwndInsertAfter; 03671 } 03672 } 03673 03674 /* 03675 * If there is no foreground thread or this pwnd is of the foreground 03676 * thread, then let it come to the top. 03677 */ 03678 if (gpqForeground == NULL) 03679 return pwndInsertAfter; 03680 03681 if (GETPTI(pwnd)->pq == gpqForeground) 03682 return pwndInsertAfter; 03683 03684 /* 03685 * This thread is not of the foreground queue, so search for a window 03686 * of this thread to zorder above. 03687 */ 03688 pwndT = ((pwndInsertAfter == NULL) ? 03689 pwnd->spwndParent->spwndChild : 03690 pwndInsertAfter); 03691 03692 /* 03693 * Remember the top insert after in case this first loop 03694 * fails to find a window 03695 */ 03696 pwndInsertAfterSave = pwndInsertAfter; 03697 03698 for (; pwndT != NULL; pwndT = pwndT->spwndNext) { 03699 03700 /* 03701 * This window wants to come to the top if possible. 03702 * If we're passing our own window, get out of this loop: 03703 * by now we already have pwndInsertAfter set up to the 03704 * last available window to insert after. 03705 */ 03706 if ((pwndT == pwnd) || TestWF(pwndT, WFBOTTOMMOST)) 03707 break; 03708 03709 /* 03710 * If this window isn't owned by this thread, continue. 03711 */ 03712 if (GETPTI(pwndT) != GETPTI(pwnd)) { 03713 pwndInsertAfter = pwndT; 03714 continue; 03715 } 03716 03717 /* 03718 * Don't want a window zordering below one of its top most windows 03719 * if it isn't foreground. 03720 */ 03721 if (TestWF(pwndT, WEFTOPMOST)) { 03722 pwndInsertAfter = pwndT; 03723 continue; 03724 } 03725 03726 #ifdef LATER // see #88810 03727 // FE_IME 03728 if (fImeOwnerIsBottom && ImeCheckBottomIMEWindow(pwndT)) { 03729 /* 03730 * owner of pwndT->spwndNext is BOTTOMMOST 03731 * so pwndT is the last one whose owner is not bottommost. 03732 */ 03733 pwndInsertAfter = pwndT; 03734 continue; 03735 } 03736 // end FE_IME 03737 #endif 03738 03739 /* 03740 * Ok to change zorder of top level windows because of 03741 * invisible windows laying around, but not children: 03742 * applications would go nuts if we did this. 03743 */ 03744 if (!TestwndChild(pwndT)) { 03745 if (!TestWF(pwndT, WFVISIBLE)) { 03746 pwndInsertAfter = pwndT; 03747 continue; 03748 } 03749 } 03750 03751 break; 03752 } 03753 03754 /* 03755 * If we didn't find a window in the previous loop, 03756 * it means that the thread has no 03757 * other sibling windows, so we need to put it after the 03758 * foreground window (foreground thread). Search for the 03759 * first unowned window of the foreground app to zorder 03760 * after. 03761 */ 03762 if ((pwndT == NULL) || TestWF(pwndT, WFBOTTOMMOST)) { 03763 /* 03764 * This is our first guess in case nothing works out. 03765 */ 03766 pwndInsertAfter = pwndInsertAfterSave; 03767 03768 /* 03769 * Start below the last topmost or from the top if no 03770 * topmost windows. 03771 */ 03772 if ((pwndT = pwndInsertAfter) == NULL) 03773 pwndT = pwnd->spwndParent->spwndChild; 03774 03775 /* 03776 * ptiTop is the pti of the active window in the foreground queue! 03777 */ 03778 ptiTop = NULL; 03779 if (gpqForeground->spwndActive != NULL) 03780 ptiTop = GETPTI(gpqForeground->spwndActive); 03781 03782 for (; pwndT != NULL; pwndT = pwndT->spwndNext) { 03783 03784 if (TestWF(pwndT, WFBOTTOMMOST)) 03785 break; 03786 03787 /* 03788 * If not the top most thread, continue. 03789 */ 03790 if (GETPTI(pwndT) != ptiTop) 03791 continue; 03792 03793 /* 03794 * Found one of the foreground thread. Remember this 03795 * as the next best guess. Try to find an unowned 03796 * visible window, which would indicate the main 03797 * window of the foreground thread. If owned, 03798 * continue. 03799 */ 03800 if (pwndT->spwndOwner != NULL) { 03801 pwndInsertAfter = pwndT; 03802 continue; 03803 } 03804 03805 /* 03806 * Unowned and of the foreground thread. Is it visible? 03807 * If not, get out of here. 03808 */ 03809 if (!TestWF(pwndT, WFVISIBLE)) 03810 continue; 03811 #ifdef LATER // see #88810 03812 // FE_IME 03813 if (fImeOwnerIsBottom && ImeCheckBottomIMEWindow(pwndT)) { 03814 continue; 03815 } 03816 // end FE_IME 03817 #endif 03818 03819 /* 03820 * Best possible match so far: unowned visible window 03821 * of the foreground thread. 03822 */ 03823 pwndInsertAfter = pwndT; 03824 } 03825 } 03826 03827 UserAssert(pwnd != pwndInsertAfter); 03828 03829 return pwndInsertAfter; 03830 }

void CalcSBStuff PWND  pwnd,
PSBCALC  pSBCalc,
BOOL  fVert
 

Referenced by _GetScrollBarInfo(), HitTestScrollBar(), RecalcTrackRect(), xxxDoScrollMenu(), xxxDrawScrollBar(), xxxDrawThumb(), and xxxSBTrackInit().

void CalcSBStuff2 PSBCALC  pSBCalc,
LPRECT  lprc,
CONST PSBDATA  pw,
BOOL  fVert
 

Definition at line 925 of file sbctl.c.

References tagSBCALC::cpx, tagSBCALC::cpxThumb, DWORD, max, min, tagSBCALC::pxBottom, tagSBCALC::pxDownArrow, tagSBCALC::pxLeft, tagSBCALC::pxMin, tagSBCALC::pxRight, tagSBCALC::pxThumbBottom, tagSBCALC::pxThumbTop, tagSBCALC::pxTop, tagSBCALC::pxUpArrow, and SYSMET.

Referenced by _GetScrollBarInfo(), CalcSBStuff(), and SBCtlSetup().

00930 { 00931 int cpx; 00932 DWORD dwRange; 00933 int denom; 00934 00935 if (fVert) { 00936 pSBCalc->pxTop = lprc->top; 00937 pSBCalc->pxBottom = lprc->bottom; 00938 pSBCalc->pxLeft = lprc->left; 00939 pSBCalc->pxRight = lprc->right; 00940 pSBCalc->cpxThumb = SYSMET(CYVSCROLL); 00941 } else { 00942 00943 /* 00944 * For horiz scroll bars, "left" & "right" are "top" and "bottom", 00945 * and vice versa. 00946 */ 00947 pSBCalc->pxTop = lprc->left; 00948 pSBCalc->pxBottom = lprc->right; 00949 pSBCalc->pxLeft = lprc->top; 00950 pSBCalc->pxRight = lprc->bottom; 00951 pSBCalc->cpxThumb = SYSMET(CXHSCROLL); 00952 } 00953 00954 pSBCalc->pos = pw->pos; 00955 pSBCalc->page = pw->page; 00956 pSBCalc->posMin = pw->posMin; 00957 pSBCalc->posMax = pw->posMax; 00958 00959 dwRange = ((DWORD)(pSBCalc->posMax - pSBCalc->posMin)) + 1; 00960 00961 // 00962 // For the case of short scroll bars that don't have enough 00963 // room to fit the full-sized up and down arrows, shorten 00964 // their sizes to make 'em fit 00965 // 00966 cpx = min((pSBCalc->pxBottom - pSBCalc->pxTop) / 2, pSBCalc->cpxThumb); 00967 00968 pSBCalc->pxUpArrow = pSBCalc->pxTop + cpx; 00969 pSBCalc->pxDownArrow = pSBCalc->pxBottom - cpx; 00970 00971 if ((pw->page != 0) && (dwRange != 0)) { 00972 // JEFFBOG -- This is the one and only place where we should 00973 // see 'range'. Elsewhere it should be 'range - page'. 00974 00975 /* 00976 * The minimun thumb size used to depend on the frame/edge metrics. 00977 * People that increase the scrollbar width/height expect the minimun 00978 * to grow with proportianally. So NT5 bases the minimun on 00979 * CXH/YVSCROLL, which is set by default in cpxThumb. 00980 */ 00981 /* 00982 * i is used to keep the macro "max" from executing EngMulDiv twice. 00983 */ 00984 int i = EngMulDiv(pSBCalc->pxDownArrow - pSBCalc->pxUpArrow, 00985 pw->page, dwRange); 00986 pSBCalc->cpxThumb = max(pSBCalc->cpxThumb / 2, i); 00987 } 00988 00989 pSBCalc->pxMin = pSBCalc->pxTop + cpx; 00990 pSBCalc->cpx = pSBCalc->pxBottom - cpx - pSBCalc->cpxThumb - pSBCalc->pxMin; 00991 00992 denom = dwRange - (pw->page ? pw->page : 1); 00993 if (denom) 00994 pSBCalc->pxThumbTop = EngMulDiv(pw->pos - pw->posMin, 00995 pSBCalc->cpx, denom) + 00996 pSBCalc->pxMin; 00997 else 00998 pSBCalc->pxThumbTop = pSBCalc->pxMin - 1; 00999 01000 pSBCalc->pxThumbBottom = pSBCalc->pxThumbTop + pSBCalc->cpxThumb; 01001 01002 }

LONG CalculateMouseSensitivity LONG  lSens  ) 
 

Definition at line 1247 of file rare.c.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

01274 : Sensitivities are constrained to be between 1 and 20. 01275 */ 01276 { 01277 LONG lSenFactor ; 01278 01279 if(lSens <= 2) 01280 lSenFactor=lSens*256/32 ; 01281 else if(lSens >= 3 && lSens <= 10 ) 01282 lSenFactor=(lSens-2)*256/8 ; 01283 else 01284 lSenFactor=(lSens-6)*256/4 ; 01285 01286 return lSenFactor ; 01287 }

BOOL CalcVisRgn HRGN *  hrgn,
PWND  pwndOrg,
PWND  pwndClip,
DWORD  flags
 

Definition at line 523 of file visrgn.c.

References _IsDescendant(), BOOL, CalcWindowVisRgn(), FALSE, grpdeskRitInput, gspwndLockUpdate, tagWND::head, IsVisible(), NULL, PZERO, tagDESKTOP::rpwinstaParent, and SetOrCreateRectRgnIndirectPublic().

Referenced by _GetDCEx(), InvalidateGDIWindows(), ResetSharedDesktops(), SwpCalcVisRgn(), UserGetClientRgn(), UserSetDCVisRgn(), and UserVisrgnFromHwnd().

00528 { 00529 PDESKTOP pdesk; 00530 00531 UserAssert(pwndOrg != NULL); 00532 00533 /* 00534 * If the window's not visible or is not an active desktop, 00535 * or if the clip window is in the process of being destroyed, 00536 * the visrgn is empty. 00537 */ 00538 pdesk = pwndOrg->head.rpdesk; 00539 00540 UserAssert(pdesk); 00541 00542 /* 00543 * Make sure this happens in the IO windowstation 00544 */ 00545 #if DBG 00546 if (grpdeskRitInput != NULL) { 00547 UserAssert(pdesk->rpwinstaParent == grpdeskRitInput->rpwinstaParent || 00548 !IsVisible(pwndOrg)); 00549 } 00550 #endif // DBG 00551 00552 if (!IsVisible(pwndOrg) || pdesk != grpdeskRitInput) { 00553 goto EmptyRgn; 00554 } 00555 00556 /* 00557 * If LockWindowUpdate() has been called, and this window is a child 00558 * of the lock window, always return an empty visrgn. 00559 */ 00560 if ((gspwndLockUpdate != NULL) && 00561 !(flags & DCX_LOCKWINDOWUPDATE) && 00562 _IsDescendant(gspwndLockUpdate, pwndOrg)) { 00563 00564 goto EmptyRgn; 00565 } 00566 00567 /* 00568 * Now go compute the visrgn for pwndClip. 00569 */ 00570 return CalcWindowVisRgn(pwndClip, phrgn, flags); 00571 00572 EmptyRgn: 00573 SetOrCreateRectRgnIndirectPublic(phrgn, PZERO(RECT)); 00574 return FALSE; 00575 }

int CalcWindowRgn PWND  pwnd,
HRGN  hrgn,
BOOL  fClient
 

Definition at line 585 of file visrgn.c.

References tagWND::hrgnClip, IntersectRgn, NULL, tagWND::rcClient, tagWND::rcWindow, and SetRectRgnIndirect().

Referenced by GetNCUpdateRgn(), InternalInvalidate3(), and xxxInternalInvalidate().

00589 { 00590 SetRectRgnIndirect(hrgn, (fClient) ? &pwnd->rcClient : &pwnd->rcWindow); 00591 00592 /* 00593 * If the window has a region, then intersect the rectangle region with 00594 * that. If this is low on memory, it'll propagate ERROR back. 00595 */ 00596 if (pwnd->hrgnClip != NULL) { 00597 return IntersectRgn(hrgn, hrgn, pwnd->hrgnClip); 00598 } 00599 00600 return SIMPLEREGION; 00601 }

void CancelForegroundActivate  ) 
 

Definition at line 1515 of file ntuser/kernel/input.c.

References CLEAR_PUDF, gppiStarting, NULL, tagPROCESSINFO::ppiNext, PUDF_ALLOWFOREGROUNDACTIVATE, and TEST_PUDF.

Referenced by WakeSomeone().

01516 { 01517 PPROCESSINFO ppiT; 01518 01519 if (TEST_PUDF(PUDF_ALLOWFOREGROUNDACTIVATE)) { 01520 01521 for (ppiT = gppiStarting; ppiT != NULL; ppiT = ppiT->ppiNext) { 01522 /* 01523 * Don't cancel activation if the app is being debugged - if 01524 * the debugger stops the application before it has created and 01525 * activated its first window, the app will come up behind all 01526 * others - not what you want when being debugged. 01527 */ 01528 if (!ppiT->Process->DebugPort) { 01529 ppiT->W32PF_Flags &= ~W32PF_ALLOWFOREGROUNDACTIVATE; 01530 TAGMSG1(DBGTAG_FOREGROUND, "CancelForegroundActivate clear W32PF %#p", ppiT); 01531 } 01532 } 01533 01534 CLEAR_PUDF(PUDF_ALLOWFOREGROUNDACTIVATE); 01535 TAGMSG0(DBGTAG_FOREGROUND, "CancelForegroundActivate clear PUDF"); 01536 } 01537 }

void CancelMouseHover PQ  pq  ) 
 

BOOL CanForceForeground PPROCESSINFO  ppi  ) 
 

Definition at line 1056 of file focusact.c.

References BOOL, FALSE, glinp, gppiInputProvider, gpqForeground, gptiForeground, IsTimeFromLastRITEvent(), NULL, tagTHREADINFO::ppi, tagLASTINPUT::ptiLastWoken, TRUE, UP, and W32PF_ALLOWSETFOREGROUND.

Referenced by _LockSetForegroundWindow(), CheckAllowForeground(), NtUserSystemParametersInfo(), xxxAllowSetForegroundWindow(), xxxHardErrorControl(), xxxSendBSMtoDesktop(), and xxxSetForegroundWindow().

01057 { 01058 01059 if ((glinp.ptiLastWoken != NULL) 01060 && (glinp.ptiLastWoken->ppi != ppi) 01061 && (gptiForeground != NULL) 01062 && (gptiForeground->ppi != ppi) 01063 && !(ppi->W32PF_Flags & (W32PF_ALLOWFOREGROUNDACTIVATE | W32PF_ALLOWSETFOREGROUND)) 01064 && (ppi != gppiInputProvider) 01065 && (gpqForeground != NULL) 01066 && 01067 #if DBG 01068 /* 01069 * When attaching the debugger to the foreground app, this function always 01070 * returns TRUE. In order to be able to debug anything related to this 01071 * function in such case, set this global to TRUE. 01072 */ 01073 (gfDebugForegroundIgnoreDebugPort 01074 || ( 01075 #endif 01076 (glinp.ptiLastWoken->ppi->Process->DebugPort == NULL) 01077 && (gptiForeground->ppi->Process->DebugPort == NULL) 01078 #if DBG 01079 )) 01080 #endif 01081 && !IsTimeFromLastRITEvent(UP(FOREGROUNDLOCKTIMEOUT))) { 01082 01083 return FALSE; 01084 } else { 01085 return TRUE; 01086 } 01087 01088 }

VOID CaretBlinkProc PWND  pwnd,
UINT  message,
UINT_PTR  id,
LPARAM  lParam
 

Definition at line 454 of file caret.c.

References _KillSystemTimer(), tagQ::caret, tagCARET::fOn, tagCARET::fVisible, gbRemoteSession, gpsi, IDSYS_CARET, tagCARET::iHideLevel, PtiCurrent, tagCARET::spwnd, UT_InvertCaret(), and VOID().

Referenced by _SetCaretBlinkTime(), xxxCreateCaret(), and zzzSetCaretPos().

00459 { 00460 PQ pq; 00461 00462 /* 00463 * If this window doesn't even have a timer, just return. TRUE is 00464 * returned, which gets returned from DispatchMessage(). Why? Because 00465 * it is compatible with Win3. 00466 */ 00467 pq = PtiCurrent()->pq; 00468 if (pwnd != pq->caret.spwnd) 00469 return; 00470 00471 /* 00472 * leave caret on, don't blink it off for remote sessions 00473 */ 00474 00475 if (gbRemoteSession && (gpsi->dtCaretBlink >= 1200) && pq->caret.fOn && pq->caret.fVisible) { 00476 00477 /* 00478 * Kill the timer for performance 00479 */ 00480 _KillSystemTimer(pq->caret.spwnd, IDSYS_CARET); 00481 return; 00482 } 00483 00484 /* 00485 * Flip the logical cursor state. If the hide level permits it, flip 00486 * the physical state and draw the caret. 00487 */ 00488 pq->caret.fOn ^= 1; 00489 if (pq->caret.iHideLevel == 0) { 00490 pq->caret.fVisible ^= 1; 00491 UT_InvertCaret(); 00492 } 00493 00494 return; 00495 00496 DBG_UNREFERENCED_PARAMETER(message); 00497 DBG_UNREFERENCED_PARAMETER(id); 00498 DBG_UNREFERENCED_PARAMETER(lParam); 00499 }

VOID ChangeAcquireResourceType VOID   ) 
 

Definition at line 887 of file validate.c.

References CheckDevLockOut, ExAcquireResourceExclusiveLite(), ExReleaseResource, gpresUser, gptiCurrent, ISATOMICCHECK, TRUE, and VOID().

Referenced by NtUserGetKeyState().

00889 { 00890 #if DBG 00891 FlushCallStack(); 00892 CheckDevLockOut(); 00893 UserAssert(!ISATOMICCHECK()); 00894 #endif // DBG 00895 ExReleaseResource(gpresUser); 00896 ExAcquireResourceExclusiveLite(gpresUser, TRUE); 00897 gptiCurrent = ((PTHREADINFO)(W32GetCurrentThread())); 00898 #if DBG 00899 GetCallStack(); 00900 #endif // DBG 00901 }

VOID ChangeForegroundKeyboardTable PKL  pklOld,
PKL  pklNew
 

Definition at line 982 of file kbdlyout.c.

References CheckCritIn, ClearAsyncKeyStateToggle, ClearKeyStateToggle, ClearRawKeyToggle, gfKanaToggle, ghKbdTblBase, gpKbdNlsTbl, gpKbdTbl, gptiForeground, guKbdTblSize, tagKBDFILE::hBase, tagKL::hkl, ISTS, NULL, tagKBDFILE::pKbdNlsTbl, tagKBDFILE::pKbdTbl, tagTHREADINFO::pq, SetAsyncKeyStateToggle, SetKeyStateToggle, SetRawKeyToggle, tagKBDFILE::Size, tagKL::spkf, TestAsyncKeyStateToggle, TRUE, UpdateKeyLights(), and VOID().

Referenced by SetForegroundThread(), xxxInternalActivateKeyboardLayout(), and xxxSetPKLinThreads().

00983 { 00984 CheckCritIn(); 00985 UserAssert(pklNew != NULL); 00986 00987 if (pklOld == pklNew || (pklOld != NULL && pklOld->spkf == pklNew->spkf)) { 00988 return; 00989 } 00990 00991 // Manage the VK_KANA toggle key for Japanese KL. 00992 // Since VK_HANGUL and VK_KANA share the same VK value and 00993 // VK_KANA is a toggle key, when keyboard layouts are switched, 00994 // VK_KANA toggle status should be restored. 00995 00996 // 00997 // If: 00998 // 1) Old and New keyboard layouts are both Japanese, do nothing. 00999 // 2) Old and New keyboard layouts are not Japanese, do nothing. 01000 // 3) Old keyboard is Japanese and new one is not, clear the KANA toggle. 01001 // 4) New keyboard is Japanese and old one is not, restore the KANA toggle. 01002 // 01003 01004 if (pklOld && JAPANESE_KBD_LAYOUT(pklOld->hkl)) { 01005 if (!JAPANESE_KBD_LAYOUT(pklNew->hkl)) { 01006 // Old keyboard layout is Japanese and the new one is not Japanese, 01007 // so we save the current KANA toggle status and clear it. 01008 gfKanaToggle = (TestAsyncKeyStateToggle(VK_KANA) != 0); 01009 RIPMSG0(RIP_VERBOSE, "Old kbd is JPN. VK_KANA toggle is being cleared.\n"); 01010 ClearAsyncKeyStateToggle(VK_KANA); 01011 ClearRawKeyToggle(VK_KANA); 01012 UpdateKeyLights(TRUE); 01013 } 01014 } else if (JAPANESE_KBD_LAYOUT(pklNew->hkl)) { 01015 // Previous keyboard layout does not exist or is not Japanese, 01016 // and the new one is Japanese. 01017 // Have to restore the KANA toggle status. 01018 RIPMSG0(RIP_VERBOSE, "New kbd is JPN. "); 01019 if (gfKanaToggle) { 01020 RIPMSG0(RIP_VERBOSE, "VK_KANA is being set.\n"); 01021 SetAsyncKeyStateToggle(VK_KANA); 01022 SetRawKeyToggle(VK_KANA); 01023 if (gptiForeground && gptiForeground->pq) { 01024 SetKeyStateToggle(gptiForeground->pq, VK_KANA); 01025 } 01026 } else { 01027 RIPMSG0(RIP_VERBOSE, "VK_KANA is beging cleared.\n"); 01028 ClearAsyncKeyStateToggle(VK_KANA); 01029 ClearRawKeyToggle(VK_KANA); 01030 if (gptiForeground && gptiForeground->pq) { 01031 ClearKeyStateToggle(gptiForeground->pq, VK_KANA); 01032 } 01033 } 01034 UpdateKeyLights(TRUE); 01035 } 01036 01037 /* 01038 * Set gpKbdTbl so foreground thread processes AltGr appropriately 01039 */ 01040 gpKbdTbl = pklNew->spkf->pKbdTbl; 01041 if (ISTS()) { 01042 ghKbdTblBase = pklNew->spkf->hBase; 01043 guKbdTblSize = pklNew->spkf->Size; 01044 } 01045 01046 UserAssert(pklNew); 01047 TAGMSG2(DBGTAG_IMM, "ChangeForegroundKeyboardTable:Changing KL NLS Table: prev HKL=%x to new HKL=%x\n", pklOld ? pklOld->hkl : 0, pklNew->hkl); 01048 TAGMSG1(DBGTAG_IMM, "ChangeForegroundKeyboardTable: new gpKbdNlsTbl=%x\n", pklNew->spkf->pKbdNlsTbl); 01049 gpKbdNlsTbl = pklNew->spkf->pKbdNlsTbl; 01050 }

VOID ChangeMenuOwner PMENU  pMenu,
PPROCESSINFO  ppi
 

PWINDOWSTATION CheckClipboardAccess void   ) 
 

Definition at line 49 of file ntuser/kernel/clipbrd.c.

References BOOL, FALSE, NT_SUCCESS, NTSTATUS(), NULL, PsGetCurrentThread, PtiCurrentShared, ReferenceWindowStation(), Status, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, and TRUE.

Referenced by _EnumClipboardFormats(), _GetPriorityClipboardFormat(), _SetClipboardData(), DisownClipboard(), NtUserCountClipboardFormats(), NtUserGetClipboardData(), NtUserGetClipboardOwner(), NtUserGetClipboardSequenceNumber(), NtUserGetClipboardViewer(), NtUserGetOpenClipboardWindow(), NtUserIsClipboardFormatAvailable(), xxxChangeClipboardChain(), xxxCloseClipboard(), xxxEmptyClipboard(), xxxOpenClipboard(), and xxxSetClipboardViewer().

00050 { 00051 NTSTATUS Status; 00052 PWINDOWSTATION pwinsta; 00053 BOOL fUseDesktop; 00054 PTHREADINFO pti; 00055 00056 pti = PtiCurrentShared(); 00057 00058 /* 00059 * CSR process use to have NULL pwinsta. Now that it's assigned to 00060 * the services windowstation we have to explicitly use the desktop 00061 * for checking the access. 00062 */ 00063 fUseDesktop = (pti->TIF_flags & TIF_CSRSSTHREAD) ? TRUE : FALSE; 00064 00065 Status = ReferenceWindowStation(PsGetCurrentThread(), 00066 NULL, 00067 WINSTA_ACCESSCLIPBOARD, 00068 &pwinsta, 00069 fUseDesktop); 00070 if (!NT_SUCCESS(Status)) { 00071 RIPNTERR0(Status, RIP_WARNING,"Access to clipboard denied."); 00072 return NULL; 00073 } 00074 00075 return pwinsta; 00076 }

BOOL CheckDesktopPolicy PUNICODE_STRING pProfileUserName  OPTIONAL,
PCWSTR  lpKeyName
 

Definition at line 426 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, DWORD, FALSE, gdwPolicyFlags, GetCurrentProcessId, gpidLogon, hModuleWin, IS_PTR, NT_ERROR, NTSTATUS(), NULL, OpenCacheKeyEx(), PMAP_DESKTOP, POLICY_MACHINE, POLICY_USER, PTR_TO_ID, RtlInitUnicodeString(), ServerLoadString, Status, and TRUE.

Referenced by xxxSystemParametersInfo().

00430 { 00431 WCHAR szKey[80]; 00432 HANDLE hKey; 00433 DWORD cbSize; 00434 NTSTATUS Status; 00435 UNICODE_STRING UnicodeString; 00436 KEY_VALUE_BASIC_INFORMATION KeyInfo; 00437 DWORD dwPolicyFlags = gdwPolicyFlags & (POLICY_MACHINE | POLICY_USER); 00438 00439 /* 00440 * If there is no policy or the caller is winlogon, let it go. 00441 */ 00442 if (!dwPolicyFlags || GetCurrentProcessId() == gpidLogon) { 00443 return FALSE; 00444 } 00445 00446 /* 00447 * Convert the ID to a string if we need to. 00448 */ 00449 if (!IS_PTR(lpKeyName)) { 00450 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 00451 lpKeyName = szKey; 00452 } 00453 00454 TryAgain: 00455 00456 /* 00457 * Try to open a key. 00458 */ 00459 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00460 PMAP_DESKTOP, 00461 KEY_READ, 00462 &dwPolicyFlags)) == NULL) { 00463 return FALSE; 00464 } 00465 00466 /* 00467 * See if the value exists. 00468 */ 00469 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00470 Status = ZwQueryValueKey(hKey, 00471 &UnicodeString, 00472 KeyValueBasicInformation, 00473 &KeyInfo, 00474 sizeof(KeyInfo), 00475 &cbSize); 00476 00477 ZwClose(hKey); 00478 00479 if (!NT_ERROR(Status)) { 00480 return TRUE; 00481 } else if (dwPolicyFlags) { 00482 goto TryAgain; 00483 } else { 00484 return FALSE; 00485 } 00486 }

BOOL CheckDesktopPolicyChange PUNICODE_STRING pProfileUserName  OPTIONAL  ) 
 

Definition at line 499 of file w32/ntuser/kernel/profile.c.

References BOOL, DWORD, FALSE, gdwPolicyFlags, OpenCacheKeyEx(), PMAP_DESKTOP, POLICY_MACHINE, POLICY_USER, and TRUE.

Referenced by xxxUpdatePerUserSystemParameters().

00502 { 00503 static LARGE_INTEGER LastMachineWriteTime; 00504 static LARGE_INTEGER LastUserWriteTime; 00505 KEY_BASIC_INFORMATION KeyInfo; 00506 BOOL bPolicyChanged = FALSE; 00507 HANDLE hKey; 00508 DWORD cbSize; 00509 DWORD dwPolicyFlags; 00510 00511 /* 00512 * Check if machine policy has changed since last time we checked. 00513 */ 00514 dwPolicyFlags = POLICY_MACHINE; 00515 KeyInfo.LastWriteTime.QuadPart = 0; 00516 hKey = OpenCacheKeyEx(pProfileUserName, 00517 PMAP_DESKTOP, 00518 KEY_READ, 00519 &dwPolicyFlags); 00520 if (hKey) { 00521 ZwQueryKey(hKey, 00522 KeyValueBasicInformation, 00523 &KeyInfo, 00524 sizeof(KeyInfo), 00525 &cbSize); 00526 ZwClose(hKey); 00527 gdwPolicyFlags |= POLICY_MACHINE; 00528 } else { 00529 gdwPolicyFlags &= ~POLICY_MACHINE; 00530 } 00531 if (LastMachineWriteTime.QuadPart != KeyInfo.LastWriteTime.QuadPart) { 00532 LastMachineWriteTime.QuadPart = KeyInfo.LastWriteTime.QuadPart; 00533 bPolicyChanged = TRUE; 00534 } 00535 00536 /* 00537 * Check if user policy has changed since last time we checked. 00538 */ 00539 dwPolicyFlags = POLICY_USER; 00540 KeyInfo.LastWriteTime.QuadPart = 0; 00541 hKey = OpenCacheKeyEx(pProfileUserName, 00542 PMAP_DESKTOP, 00543 KEY_READ, 00544 &dwPolicyFlags); 00545 if (hKey) { 00546 ZwQueryKey(hKey, 00547 KeyValueBasicInformation, 00548 &KeyInfo, 00549 sizeof(KeyInfo), 00550 &cbSize); 00551 ZwClose(hKey); 00552 gdwPolicyFlags |= POLICY_USER; 00553 } else { 00554 gdwPolicyFlags &= ~POLICY_USER; 00555 } 00556 if (LastUserWriteTime.QuadPart != KeyInfo.LastWriteTime.QuadPart) { 00557 LastUserWriteTime.QuadPart = KeyInfo.LastWriteTime.QuadPart; 00558 bPolicyChanged = TRUE; 00559 } 00560 00561 return bPolicyChanged; 00562 }

BOOL CheckGrantedAccess ACCESS_MASK  ,
ACCESS_MASK 
 

Definition at line 492 of file w32/ntuser/kernel/security.c.

References BOOL, FALSE, RtlAreAllAccessesGranted(), and TRUE.

Referenced by NtUserGetCaretBlinkTime(), NtUserGetDoubleClickTime(), and xxxMouseEventDirect().

00495 { 00496 00497 /* 00498 * Check the granted access. 00499 */ 00500 if (!RtlAreAllAccessesGranted(amGranted, amRequest)) { 00501 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, ""); 00502 return FALSE; 00503 } 00504 return TRUE; 00505 }

BOOL CheckHandleFlag HANDLE  ,
DWORD 
 

Definition at line 4464 of file desktop.c.

References tagPROCESSINFO::bmHandleFlags, BOOL, EnterHandleFlagsCrit(), FALSE, HF_LIMIT, Index, LeaveHandleFlagsCrit(), NULL, PEXHANDLE, and PpiCurrent.

Referenced by _GetUserObjectInformation(), OkayToCloseDesktop(), OkayToCloseWindowStation(), and zzzSetDesktop().

04467 { 04468 PPROCESSINFO ppi; 04469 ULONG Index = ((PEXHANDLE)&hObject)->Index * HF_LIMIT + dwFlag; 04470 BOOL fRet = FALSE; 04471 04472 EnterHandleFlagsCrit(); 04473 04474 if ((ppi = PpiCurrent()) != NULL) { 04475 fRet = (Index < ppi->bmHandleFlags.SizeOfBitMap && 04476 RtlCheckBit(&ppi->bmHandleFlags, Index)); 04477 } 04478 04479 LeaveHandleFlagsCrit(); 04480 04481 return fRet; 04482 }

BOOL CheckHandleInUse HANDLE   ) 
 

Definition at line 4557 of file desktop.c.

References BOOL, EnterHandleFlagsCrit(), gHandleInUse, gProcessInUse, LeaveHandleFlagsCrit(), and PsGetCurrentProcess.

Referenced by OkayToCloseDesktop(), and OkayToCloseWindowStation().

04559 { 04560 BOOL fRet; 04561 04562 EnterHandleFlagsCrit(); 04563 fRet = ((gProcessInUse == PsGetCurrentProcess()) && 04564 (gHandleInUse == hObject)); 04565 LeaveHandleFlagsCrit(); 04566 04567 return fRet; 04568 }

PIMEHOTKEYOBJ CheckImeHotKey PQ  pq,
UINT  uVKey,
LPARAM  lParam
 

Definition at line 461 of file imehotky.c.

References BOOL, FALSE, FindImeHotKeyByKey(), gpImeHotKeyListHeader, _tagIMEHOTKEYOBJ::hk, MOD_BOTH_SIDES, MOD_MODIFY_KEYS, NULL, TestKeyStateDown, TRUE, UINT, and _tagIMEHOTKEY::uModifiers.

Referenced by NtUserCheckImeHotKey(), and xxxImmProcessKey().

00466 { 00467 static UINT uVKeySaved = 0; 00468 PIMEHOTKEYOBJ ph; 00469 UINT uModifiers = 0; 00470 BOOL fKeyUp; 00471 00472 // 00473 // early return for key up message 00474 // 00475 fKeyUp = ( lParam & 0x80000000 ) ? TRUE : FALSE; 00476 if ( fKeyUp ) { 00477 // 00478 // if the uVKey is not same as the vkey 00479 // we previously saved, there is no chance 00480 // that this is a hotkey. 00481 // 00482 if ( uVKeySaved != uVKey ) { 00483 uVKeySaved = 0; 00484 return NULL; 00485 } 00486 uVKeySaved = 0; 00487 // 00488 // If it's same, we still need to check 00489 // the hotkey list because there is a 00490 // chance that the hotkey list is modified 00491 // between the key make and break. 00492 // 00493 } 00494 00495 // 00496 // Current specification doesn't allow us to use a complex 00497 // hotkey such as LSHIFT+RMENU+SPACE 00498 // 00499 00500 // 00501 // Setup the shift, control, alt key states 00502 // 00503 uModifiers |= TestKeyStateDown(pq, VK_LSHIFT) ? (MOD_SHIFT | MOD_LEFT) : 0; 00504 uModifiers |= TestKeyStateDown(pq, VK_RSHIFT) ? (MOD_SHIFT | MOD_RIGHT) : 0; 00505 00506 uModifiers |= TestKeyStateDown(pq, VK_LCONTROL) ? (MOD_CONTROL | MOD_LEFT) : 0; 00507 uModifiers |= TestKeyStateDown(pq, VK_RCONTROL) ? (MOD_CONTROL | MOD_RIGHT) : 0; 00508 00509 uModifiers |= TestKeyStateDown(pq, VK_LMENU) ? (MOD_ALT | MOD_LEFT) : 0; 00510 uModifiers |= TestKeyStateDown(pq, VK_RMENU) ? (MOD_ALT | MOD_RIGHT) : 0; 00511 00512 ph = FindImeHotKeyByKey( gpImeHotKeyListHeader, 00513 uModifiers & MOD_MODIFY_KEYS, 00514 uModifiers & MOD_BOTH_SIDES, 00515 uVKey ); 00516 00517 if ( ph != NULL ) { 00518 if ( fKeyUp ) { 00519 if ( ph->hk.uModifiers & MOD_ON_KEYUP ) { 00520 return ph; 00521 } 00522 } else { 00523 if ( ph->hk.uModifiers & MOD_ON_KEYUP ) { 00524 // 00525 // save vkey for next keyup message time 00526 // 00527 // when ALT+Z is a hotkey, we don't want 00528 // to handle #2 as the hotkey sequence. 00529 // 1) ALT make -> 'Z' make -> 'Z' break 00530 // 2) 'Z' make -> ALT make -> 'Z' break 00531 // 00532 uVKeySaved = uVKey; 00533 } else { 00534 return ph; 00535 } 00536 } 00537 } 00538 00539 return NULL; 00540 }

BOOL CheckPwndFilter PWND  pwnd,
PWND  pwndFilter
 

Definition at line 131 of file w32/ntuser/kernel/random.c.

References _IsChild(), BOOL, NULL, and TRUE.

Referenced by DoPaint(), DoTimer(), FindQMsg(), xxxScanSysQueue(), and xxxWindowHitTest2().

00134 { 00135 if ((pwndFilter == NULL) || (pwndFilter == pwnd) || 00136 ((pwndFilter == (PWND)1) && (pwnd == NULL))) { 00137 return TRUE; 00138 } 00139 00140 return _IsChild(pwndFilter, pwnd); 00141 }

BOOL CheckWinstaWriteAttributesAccess void   ) 
 

Definition at line 518 of file w32/ntuser/kernel/security.c.

References tagPROCESSINFO::amwinsta, BOOL, FALSE, gpidLogon, PpiCurrent, PsGetCurrentProcess, RtlAreAllAccessesGranted(), and TRUE.

Referenced by _RegisterHotKey(), _SetCaretBlinkTime(), _SetDoubleClickTime(), xxxSetSysColors(), xxxSystemParametersInfo(), zzzClipCursor(), zzzSetCursorPos(), and zzzSetSystemCursor().

00519 { 00520 PPROCESSINFO ppiCurrent = PpiCurrent(); 00521 00522 /* 00523 * winlogon has rights to all windowstations. 00524 */ 00525 if (PsGetCurrentProcess()->UniqueProcessId == gpidLogon) 00526 return TRUE; 00527 00528 if (!(ppiCurrent->W32PF_Flags & W32PF_IOWINSTA)) { 00529 RIPERR0(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION, 00530 RIP_WARNING, 00531 "Operation invalid on a non-interactive WindowStation."); 00532 00533 return FALSE; 00534 } 00535 00536 if (!RtlAreAllAccessesGranted(ppiCurrent->amwinsta, WINSTA_WRITEATTRIBUTES)) { 00537 RIPERR0(ERROR_ACCESS_DENIED, 00538 RIP_WARNING, 00539 "WINSTA_WRITEATTRIBUTES access to WindowStation denied."); 00540 00541 return FALSE; 00542 } 00543 return TRUE; 00544 }

CHECKPOINT* CkptRestore PWND  pwnd,
LPCRECT  lprcWindow
 

Definition at line 335 of file movesize.c.

References _GetProp(), _MonitorFromRect(), CopyRect, FALSE, tagCHECKPOINT::fMaxInitialized, tagCHECKPOINT::fMinInitialized, GetMonitorMaxArea(), HMIsMarkDestroy, InternalSetProp(), NULL, PROP_CHECKPOINT, PROPF_INTERNAL, tagCHECKPOINT::ptMax, tagCHECKPOINT::ptMin, PWNDDESKTOP, tagCHECKPOINT::rcNormal, tagWND::spwndParent, TestWF, TRUE, WFMAXIMIZED, WFMINIMIZED, and WFREALLYMAXIMIZABLE.

Referenced by UpdateCheckpoint(), xxxMinMaximize(), and xxxMS_TrackMove().

00338 { 00339 PCHECKPOINT pcp; 00340 00341 /* 00342 * Don't return or create a checkpoint if the window is dying. 00343 */ 00344 if (HMIsMarkDestroy(pwnd)) 00345 return NULL; 00346 00347 /* 00348 * If it doesn't exist, create it. 00349 */ 00350 if ((pcp = (PCHECKPOINT)_GetProp(pwnd, 00351 PROP_CHECKPOINT, 00352 PROPF_INTERNAL)) == NULL) { 00353 00354 if ((pcp = (PCHECKPOINT)UserAllocPoolWithQuota(sizeof(CHECKPOINT), 00355 TAG_CHECKPT)) == NULL) { 00356 return NULL; 00357 } 00358 00359 if (!InternalSetProp(pwnd, 00360 PROP_CHECKPOINT, 00361 (HANDLE)pcp, 00362 PROPF_INTERNAL)) { 00363 00364 UserFreePool(pcp); 00365 return NULL; 00366 } 00367 00368 /* 00369 * Initialize it to -1 so first minimize will park the icon. 00370 */ 00371 pcp->ptMin.x = -1; 00372 pcp->ptMin.y = -1; 00373 pcp->ptMax.x = -1; 00374 pcp->ptMax.y = -1; 00375 00376 /* 00377 * Initialize pwndTitle to NULL so we create a title window on the 00378 * first minimize of the window 00379 */ 00380 pcp->fDragged = FALSE; 00381 pcp->fWasMaximizedBeforeMinimized = FALSE; 00382 pcp->fWasMinimizedBeforeMaximized = FALSE; 00383 pcp->fMinInitialized = FALSE; 00384 pcp->fMaxInitialized = FALSE; 00385 00386 /* 00387 * BOGUS! We're going to copy this twice if the window isn't 00388 * minimized or maximized. But if it isn't, we're going to get 00389 * a weird size in rcNormal... 00390 */ 00391 CopyRect(&pcp->rcNormal, lprcWindow); 00392 } 00393 00394 /* 00395 * If the window is minimized/maximized, then set the min/max 00396 * point. Otherwise use checkpoint the window-size. 00397 */ 00398 if (TestWF(pwnd, WFMINIMIZED)) { 00399 pcp->fMinInitialized = TRUE; 00400 pcp->ptMin.x = lprcWindow->left; 00401 pcp->ptMin.y = lprcWindow->top; 00402 } else if (TestWF(pwnd, WFMAXIMIZED)) { 00403 pcp->fMaxInitialized = TRUE; 00404 00405 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00406 if (TestWF(pwnd, WFREALLYMAXIMIZABLE)) { 00407 pcp->fMaxInitialized = FALSE; 00408 pcp->ptMax.x = -1; 00409 pcp->ptMax.y = -1; 00410 } else { 00411 PMONITOR pMonitor; 00412 LPRECT lprc; 00413 00414 pMonitor = _MonitorFromRect(lprcWindow, MONITOR_DEFAULTTOPRIMARY); 00415 GetMonitorMaxArea(pwnd, pMonitor, &lprc); 00416 pcp->ptMax.x = lprcWindow->left - lprc->left; 00417 pcp->ptMax.y = lprcWindow->top - lprc->top; 00418 } 00419 } else { 00420 pcp->ptMax.x = lprcWindow->left; 00421 pcp->ptMax.y = lprcWindow->top; 00422 } 00423 } else { 00424 CopyRect(&pcp->rcNormal, lprcWindow); 00425 } 00426 00427 return pcp; 00428 }

PCURSOR ClassSetSmallIcon PCLS  pcls,
PCURSOR  pcursor,
BOOL  fServerCreated
 

void CleanupDecSFWLockCount PVOID  pIgnore  ) 
 

Definition at line 1218 of file focusact.c.

References DecSFWLockCount().

01219 { 01220 DecSFWLockCount(); 01221 UNREFERENCED_PARAMETER(pIgnore); 01222 }

VOID CleanupGDI VOID   ) 
 

Definition at line 565 of file w32/ntuser/kernel/init.c.

References DelayedDestroyCacheDC(), DestroyBitmap(), DestroyBrush(), DestroyCacheDCEntries(), DestroyDC(), DestroyFont(), DestroyMonitor(), DestroyRegion(), gfade, ghbmBits, ghbmCaption, ghbmWallpaper, ghbrBlack, ghbrHungApp, ghbrWhite, ghdcMem, ghdcMem2, ghFontSys, ghIconFont, ghMenuFont, ghMenuFontDef, ghpalWallpaper, ghrgnGDC, ghrgnInv0, ghrgnInv1, ghrgnInv2, ghrgnInvalid, ghrgnInvalidSum, ghrgnSCR, ghrgnScrl1, ghrgnScrl2, ghrgnScrlDst, ghrgnScrlSrc, ghrgnScrlValid, ghrgnScrlVis, ghrgnSPB1, ghrgnSPB2, ghrgnSW, ghrgnSWP1, ghrgnValid, ghrgnValidSum, ghrgnVisNew, ghSmCaptionFont, ghStatusFont, gpDispInfo, gpMonitorCached, gpsi, tagDISPLAYINFO::hbmGray, tagFADE::hdc, tagDISPLAYINFO::hdcBits, tagDISPLAYINFO::hdcGray, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, tagDISPLAYINFO::hrgnScreen, NULL, tagDISPLAYINFO::pdceFirst, tagDISPLAYINFO::pmdev, tagDISPLAYINFO::pMonitorFirst, tagMONITOR::pMonitorNext, PtiCurrent, SYSHBRUSH, and VOID().

Referenced by CleanupResources().

00567 { 00568 int i; 00569 00570 /* 00571 * Free gpDispInfo stuff 00572 */ 00573 DestroyDC(&gpDispInfo->hdcScreen); 00574 DestroyDC(&gpDispInfo->hdcBits); 00575 DestroyDC(&gpDispInfo->hdcGray); 00576 DestroyDC(&ghdcMem); 00577 DestroyDC(&ghdcMem2); 00578 DestroyDC(&gfade.hdc); 00579 00580 /* 00581 * Free the cache DC stuff before the GRE cleanup. 00582 * Also notice that we call DelayedDestroyCacheDC which 00583 * we usualy call from DestroyProcessInfo. We do it 00584 * here because this is the last WIN32 thread. 00585 */ 00586 DestroyCacheDCEntries(PtiCurrent()); 00587 DestroyCacheDCEntries(NULL); 00588 DelayedDestroyCacheDC(); 00589 00590 UserAssert(gpDispInfo->pdceFirst == NULL); 00591 00592 /* 00593 * Free bitmaps 00594 */ 00595 DestroyBitmap(&gpDispInfo->hbmGray); 00596 DestroyBitmap(&ghbmBits); 00597 DestroyBitmap(&ghbmCaption); 00598 00599 /* 00600 * Cleanup brushes 00601 */ 00602 DestroyBrush(&ghbrHungApp); 00603 DestroyBrush(&gpsi->hbrGray); 00604 DestroyBrush(&ghbrWhite); 00605 DestroyBrush(&ghbrBlack); 00606 00607 for (i = 0; i < COLOR_MAX; i++) { 00608 DestroyBrush(&(SYSHBRUSH(i))); 00609 } 00610 00611 /* 00612 * Cleanup regions 00613 */ 00614 DestroyRegion(&gpDispInfo->hrgnScreen); 00615 DestroyRegion(&ghrgnInvalidSum); 00616 DestroyRegion(&ghrgnVisNew); 00617 DestroyRegion(&ghrgnSWP1); 00618 DestroyRegion(&ghrgnValid); 00619 DestroyRegion(&ghrgnValidSum); 00620 DestroyRegion(&ghrgnInvalid); 00621 DestroyRegion(&ghrgnInv0); 00622 DestroyRegion(&ghrgnInv1); 00623 DestroyRegion(&ghrgnInv2); 00624 DestroyRegion(&ghrgnGDC); 00625 DestroyRegion(&ghrgnSCR); 00626 DestroyRegion(&ghrgnSPB1); 00627 DestroyRegion(&ghrgnSPB2); 00628 DestroyRegion(&ghrgnSW); 00629 DestroyRegion(&ghrgnScrl1); 00630 DestroyRegion(&ghrgnScrl2); 00631 DestroyRegion(&ghrgnScrlVis); 00632 DestroyRegion(&ghrgnScrlSrc); 00633 DestroyRegion(&ghrgnScrlDst); 00634 DestroyRegion(&ghrgnScrlValid); 00635 00636 /* 00637 * Cleanup fonts 00638 */ 00639 DestroyFont(&ghSmCaptionFont); 00640 DestroyFont(&ghMenuFont); 00641 DestroyFont(&ghMenuFontDef); 00642 DestroyFont(&ghStatusFont); 00643 DestroyFont(&ghIconFont); 00644 DestroyFont(&ghFontSys); 00645 00646 /* 00647 * wallpaper stuff. 00648 */ 00649 if (ghpalWallpaper != NULL) { 00650 GreSetPaletteOwner(ghpalWallpaper, OBJECT_OWNER_CURRENT); 00651 GreDeleteObject(ghpalWallpaper); 00652 ghpalWallpaper = NULL; 00653 } 00654 DestroyBitmap(&ghbmWallpaper); 00655 00656 /* 00657 * Unload the video driver 00658 */ 00659 if (gpDispInfo->pmdev) { 00660 DrvDestroyMDEV(gpDispInfo->pmdev); 00661 GreFreePool(gpDispInfo->pmdev); 00662 gpDispInfo->pmdev = NULL; 00663 gpDispInfo->hDev = NULL; 00664 } 00665 00666 /* 00667 * Free the monitor stuff 00668 */ 00669 { 00670 PMONITOR pMonitor; 00671 PMONITOR pMonitorNext; 00672 00673 pMonitor = gpDispInfo->pMonitorFirst; 00674 00675 while (pMonitor != NULL) { 00676 pMonitorNext = pMonitor->pMonitorNext; 00677 DestroyMonitor(pMonitor); 00678 pMonitor = pMonitorNext; 00679 } 00680 00681 UserAssert(gpDispInfo->pMonitorFirst == NULL); 00682 00683 if (gpMonitorCached != NULL) { 00684 DestroyMonitor(gpMonitorCached); 00685 } 00686 } 00687 }

VOID CleanupPowerRequestList VOID   ) 
 

Definition at line 216 of file power.c.

References CancelPowerRequest(), gbNoMorePowerCallouts, gpPowerRequestMutex, NULL, PPOWERREQUEST, TRUE, and UnqueuePowerRequest().

Referenced by CleanupResources(), and InitiateWin32kCleanup().

00217 { 00218 PPOWERREQUEST pPowerRequest; 00219 00220 /* 00221 * Make sure no new power requests come in. 00222 */ 00223 gbNoMorePowerCallouts = TRUE; 00224 00225 /* 00226 * If we never allocated anything, there's nothing to clean up. 00227 */ 00228 if (gpPowerRequestMutex == NULL) { 00229 return; 00230 } 00231 00232 /* 00233 * Mark any pending power requests as cacelled. 00234 */ 00235 while ((pPowerRequest = UnqueuePowerRequest()) != NULL) { 00236 CancelPowerRequest(pPowerRequest); 00237 } 00238 }

VOID CleanupResources VOID   ) 
 

Definition at line 2087 of file ntinput.c.

References CleanupGDI(), CleanupPowerRequestList(), DestroyClass(), gbCleanedUpResources, gpclsList, HH_CLEANUPRESOURCES, HYDRA_HINT, LockQCursor, NULL, PpiCurrent, tagTHREADINFO::pq, tagTHREADINFO::ptiSibling, TRUE, UnloadCursorsAndIcons(), and VOID().

Referenced by xxxDestroyThreadInfo().

02089 { 02090 PPCLS ppcls; 02091 PTHREADINFO pti; 02092 02093 UserAssert(!gbCleanedUpResources); 02094 02095 gbCleanedUpResources = TRUE; 02096 02097 HYDRA_HINT(HH_CLEANUPRESOURCES); 02098 02099 /* 02100 * Prevent power callouts. 02101 */ 02102 CleanupPowerRequestList(); 02103 02104 /* 02105 * Destroy the system classes also 02106 */ 02107 ppcls = &gpclsList; 02108 while (*ppcls != NULL) { 02109 DestroyClass(ppcls); 02110 } 02111 02112 /* 02113 * Unlock the cursor from all the CSRSS's threads. 02114 * We do this here because RIT might not be the only 02115 * CSRSS process running at this time and we want 02116 * to prevent the change of thread ownership 02117 * after RIT is gone. 02118 */ 02119 pti = PpiCurrent()->ptiList; 02120 02121 while (pti != NULL) { 02122 02123 if (pti->pq != NULL) { 02124 LockQCursor(pti->pq, NULL); 02125 } 02126 pti = pti->ptiSibling; 02127 } 02128 02129 UnloadCursorsAndIcons(); 02130 02131 /* 02132 * Cleanup the GDI globals in USERK 02133 */ 02134 CleanupGDI(); 02135 }

void ClearAppStarting PPROCESSINFO  ppi  ) 
 

Definition at line 1131 of file queue.c.

References gppiStarting, PROCESSINFO, and REMOVE_FROM_LIST.

Referenced by DestroyProcessInfo(), FRemoveForegroundActivate(), and InitSystemThread().

01132 { 01133 REMOVE_FROM_LIST(PROCESSINFO, gppiStarting, ppi, ppiNext); 01134 ppi->W32PF_Flags &= ~W32PF_APPSTARTING; 01135 }

VOID ClearHungFlag PWND  pwnd,
WORD  wFlag
 

Definition at line 57 of file hungapp.c.

References BOOL, ClrWF, gpvwplHungRedraw, TestWF, VOID(), VWPLRemove(), and WFANYHUNGREDRAW.

Referenced by InternalInvalidate3(), xxxBeginPaint(), xxxDrawCaptionBar(), xxxFreeWindow(), xxxHungAppDemon(), xxxRedrawHungWindow(), and xxxSimpleDoSyncPaint().

00060 { 00061 BOOL fInRedrawList = TestWF(pwnd, WFANYHUNGREDRAW); 00062 00063 ClrWF(pwnd, wFlag); 00064 if (!TestWF(pwnd, WFANYHUNGREDRAW) && fInRedrawList) { 00065 /* 00066 * Remove the window from the redraw list and possibly compact it. 00067 */ 00068 VWPLRemove(&gpvwplHungRedraw, pwnd); 00069 } 00070 }

VOID ClearSendMessages PWND  pwnd  ) 
 

Definition at line 2400 of file kernel/sendmsg.c.

Referenced by xxxFreeWindow().

02409 : 02410 * 01-13-91 DavidPe Ported. 02411 \***********************************************************************/ 02412 02413 VOID ClearSendMessages( 02414 PWND pwnd) 02415 { 02416 PSMS psms, psmsNext; 02417 PSMS *ppsms; 02418 02419 CheckCritIn(); 02420 02421 psms = gpsmsList; 02422 while (psms != NULL) { 02423 /* 02424 * Grab the next one beforehand in case we free the current one. 02425 */ 02426 psmsNext = psms->psmsNext; 02427 02428 if (psms->spwnd == pwnd) { 02429 02430 /* 02431 * If the sender has died, then mark this receiver free so the 02432 * receiver will destroy it in its processing. 02433 */ 02434 if (psms->flags & SMF_SENDERDIED) { 02435 psms->flags |= SMF_REPLY | SMF_RECEIVERFREE; 02436 } else { 02437 /* 02438 * The sender is alive. If the receiver hasn't replied to 02439 * this yet, make a reply so the sender gets it. Make sure 02440 * the receiver is the one free it so we don't have a race 02441 * condition. 02442 */ 02443 if (!(psms->flags & SMF_REPLY)) { 02444 02445 /* 02446 * The sms is either still on the receive list 02447 * or is currently being received. Since the sender 02448 * is alive, we want the sender to get the reply 02449 * to this SMS. If it hasn't been received, take 02450 * it off the receive list and reply to it. If it 02451 * has been received, then just leave it alone: 02452 * it'll get replied to normally. 02453 */ 02454 if (psms->flags & SMF_CB_REQUEST) { 02455 /* 02456 * From SendMessageCallback REQUEST callback. Send the 02457 * message back with a the REPLY value. 02458 */ 02459 TL tlpwnd; 02460 INTRSENDMSGEX ism; 02461 02462 psms->flags |= SMF_REPLY; 02463 02464 ism.fuCall = ISM_CALLBACK | ISM_REPLY; 02465 if (psms->flags & SMF_CB_CLIENT) 02466 ism.fuCall |= ISM_CB_CLIENT; 02467 ism.lpResultCallBack = psms->lpResultCallBack; 02468 ism.dwData = psms->dwData; 02469 ism.lRet = 0L; /* null return */ 02470 02471 ThreadLock(psms->spwnd, &tlpwnd); 02472 02473 xxxInterSendMsgEx(psms->spwnd, psms->message, 0L, 0L, 02474 NULL, psms->ptiCallBackSender, &ism ); 02475 02476 ThreadUnlock(&tlpwnd); 02477 } else if (!(psms->flags & SMF_RECEIVERBUSY)) { 02478 /* 02479 * If there is no sender, this is a notification 02480 * message (nobody to reply to). In this case, 02481 * just set the SMF_REPLY bit (SMF_RECEIVERFREE 02482 * is already set) and this'll cause ReceiveMessage 02483 * to just free this SMS and return. 02484 */ 02485 if (psms->ptiSender == NULL) { 02486 psms->flags |= SMF_REPLY; 02487 } else { 02488 /* 02489 * There is a sender, and it wants a reply: take 02490 * this SMS off the receive list, and reply 02491 * to the sender. 02492 */ 02493 for (ppsms = &(psms->ptiReceiver->psmsReceiveList); 02494 *ppsms != NULL; 02495 ppsms = &((*ppsms)->psmsReceiveNext)) { 02496 02497 if (*ppsms == psms) { 02498 *ppsms = psms->psmsReceiveNext; 02499 break; 02500 } 02501 } 02502 02503 02504 /* 02505 * Reply to this message so the sender 02506 * wakes up. 02507 */ 02508 psms->flags |= SMF_REPLY; 02509 psms->lRet = 0; 02510 psms->psmsReceiveNext = NULL; 02511 SetWakeBit(psms->ptiSender, QS_SMSREPLY); 02512 02513 /* 02514 * 16 bit senders need to be notifed that sends completed 02515 * otherwise it may wait for a very long time for the reply. 02516 */ 02517 if (psms->ptiSender->TIF_flags & TIF_16BIT) { 02518 DirectedScheduleTask(psms->ptiReceiver, psms->ptiSender, FALSE, psms); 02519 } 02520 } }

VOID ClearWakeBit PTHREADINFO  pti,
UINT  wWakeBit,
BOOL  fSysCheck
 

Definition at line 4700 of file queue.c.

References tagMLIST::cMsgs, FJOURNALPLAYBACK, tagCLIENTTHREADINFO::fsWakeBits, tagQ::mlInput, tagTHREADINFO::pcti, tagTHREADINFO::pq, tagQ::QF_flags, QF_MOUSEMOVED, and VOID().

Referenced by xxxDesktopThread(), and xxxScanSysQueue().

04704 { 04705 04706 /* 04707 * If fSysCheck is TRUE, clear bits only if we are not doing journal 04708 * playback and there are no more messages in the queue. fSysCheck 04709 * is TRUE if clearing because of no more input. FALSE if just 04710 * transfering input ownership from one thread to another. 04711 */ 04712 if (fSysCheck) { 04713 if (pti->pq->mlInput.cMsgs != 0 || FJOURNALPLAYBACK()) 04714 return; 04715 if (pti->pq->QF_flags & QF_MOUSEMOVED) 04716 wWakeBit &= ~QS_MOUSEMOVE; 04717 } 04718 04719 /* 04720 * Only clear the wake bits, not the change bits as well! 04721 */ 04722 pti->pcti->fsWakeBits &= ~wWakeBit; 04723 }

VOID ClearWakeMask VOID   ) 
 

Definition at line 5223 of file queue.c.

References PtiCurrent, and VOID().

05224 { 05225 PtiCurrent()->pcti->fsWakeMask = 0; 05226 }

VOID ClearWindowState PWND  pwnd,
DWORD  flags
 

Definition at line 102 of file w32/ntuser/kernel/random.c.

References ClrWF, dwFlags, GETPTI, PtiCurrent, and ValidateState().

Referenced by AnimateWindow(), ButtonWndProcWorker(), CalcClientScrolling(), CBNcCreateHandler(), DefDlgProcWorker(), DefFrameProcWorker(), ECNcCreate(), ECSetPasswordChar(), EditWndProc(), MDIAddSysMenu(), MDIClientWndProcWorker(), and MLCreate().

00105 { 00106 /* 00107 * Don't let anyone mess with someone else's window 00108 */ 00109 if (GETPTI(pwnd)->ppi == PtiCurrent()->ppi) { 00110 if (ValidateState(dwFlags)) { 00111 ClrWF(pwnd, dwFlags); 00112 } else { 00113 RIPMSG1(RIP_ERROR, "SetWindowState: invalid flag %x", dwFlags); 00114 } 00115 } else { 00116 RIPMSG1(RIP_WARNING, "ClearWindowState: current ppi doesn't own pwnd %#p", pwnd); 00117 } 00118 00119 }

VOID ClientDeliverUserApc VOID   ) 
 

Referenced by xxxPollAndWaitForSingleObject(), xxxSleepTask(), and xxxSleepThread().

void ClientDied void   ) 
 

BOOL ClientExitProcess PFNW32ET  pfn,
DWORD  dwExitCode
 

VOID ClientFontSweep VOID   ) 
 

Referenced by CreateTerminalInput().

BOOL ClientFreeLibrary HANDLE  hmod  ) 
 

Referenced by xxxDoSysExpunge(), and xxxLoadHmodIndex().

DWORD ClientGetListboxString PWND  hwnd,
UINT  msg,
WPARAM  wParam,
PVOID  lParam,
ULONG_PTR  xParam,
PROC  xpfn,
DWORD  dwSCMSFlags,
BOOL  bNotString,
PSMS  psms
 

Referenced by SfnOUTCBOXSTRING(), and SfnOUTLBOXSTRING().

BOOL ClientGrayString GRAYSTRINGPROC  pfnOutProc,
HDC  hdc,
DWORD  lpData,
int  nCount
 

BOOL ClientImmLoadLayout HKL  ,
PIMEINFOEX 
 

Referenced by xxxImmLoadLayout().

DWORD ClientImmProcessKey HWND  ,
HKL  ,
UINT  ,
LPARAM  ,
DWORD 
 

Referenced by xxxImmProcessKey().

HANDLE ClientLoadLibrary PUNICODE_STRING  pstrLib,
BOOL  bWx86KnownDll
 

Referenced by xxxLoadHmodIndex().

VOID ClientLoadLocalT1Fonts  ) 
 

Referenced by xxxLW_LoadFonts().

VOID ClientLoadRemoteT1Fonts  ) 
 

Referenced by xxxLW_LoadFonts().

VOID ClientNoMemoryPopup VOID   ) 
 

Referenced by xxxSnapWindow().

NTSTATUS ClientThreadSetup VOID   ) 
 

Definition at line 1219 of file clinit.c.

References BOOL, ButtonWndProcA(), ButtonWndProcW(), ButtonWndProcWorker(), CheckBadApp(), _CLIENTINFO::CI_flags, CI_INITIALIZED, CI_REGISTERCLASSES, ComboBoxWndProcA(), ComboBoxWndProcW(), ComboBoxWndProcWorker(), ComboListBoxWndProcA(), ComboListBoxWndProcW(), DefDlgProcA(), DefDlgProcW(), DefDlgProcWorker(), DESKTOPINFO, DesktopWndProcA(), DesktopWndProcW(), DispatchClientMessage(), DispatchHookA(), DispatchHookW(), _USERCONNECT::dwDispatchCount, DWORD, EditWndProcA(), EditWndProcW(), EditWndProcWorker(), FALSE, fnHkINLPCWPRETSTRUCTA(), fnHkINLPCWPRETSTRUCTW(), fnHkINLPCWPSTRUCTA(), fnHkINLPCWPSTRUCTW(), gcsAccelCache, GdiProcessSetup(), gDispatchTableValues, gdwLpkEntryPoints, GetClientInfo, gfFirstThread, gfServerProcess, gfSystemInitialized, ghbrBlack, ghbrWhite, ghdcBits2, gpsi, gSharedInfo, hmodUser, tagMSG_TABLE_ENTRY::iFunction, ImeWndProcA(), ImeWndProcW(), ImeWndProcWorker(), InitClientDrawing(), InitOemXlateTables(), INT, ListBoxWndProcA(), ListBoxWndProcW(), ListBoxWndProcWorker(), LoadAppDlls(), LoadCursorsAndIcons(), MB_DlgProcA(), MB_DlgProcW(), MDIActivateDlgProcA(), MDIActivateDlgProcW(), MDIClientWndProcA(), MDIClientWndProcW(), MDIClientWndProcWorker(), MenuWndProcA(), MenuWndProcW(), MessageTable, NT_SUCCESS, NTSTATUS(), NtUserCallNoParam(), NtUserCallOneParam(), NtUserGetThreadDesktop(), NtUserInitializeClientPfnArrays(), NtUserProcessConnect(), NULL, pdiLocal, _PFNCLIENTWORKER::pfnButtonWndProc, _PFNCLIENT::pfnButtonWndProc, pfnClientA, pfnClientW, pfnClientWorker, _PFNCLIENTWORKER::pfnComboBoxWndProc, _PFNCLIENT::pfnComboBoxWndProc, _PFNCLIENTWORKER::pfnComboListBoxProc, _PFNCLIENT::pfnComboListBoxProc, _PFNCLIENT::pfnDefWindowProc, _PFNCLIENT::pfnDesktopWndProc, _PFNCLIENTWORKER::pfnDialogWndProc, _PFNCLIENT::pfnDialogWndProc, _PFNCLIENT::pfnDispatchHook, _PFNCLIENT::pfnDispatchMessage, _PFNCLIENTWORKER::pfnEditWndProc, _PFNCLIENT::pfnEditWndProc, _PFNCLIENT::pfnHkINLPCWPRETSTRUCT, _PFNCLIENT::pfnHkINLPCWPSTRUCT, _PFNCLIENTWORKER::pfnImeWndProc, _PFNCLIENT::pfnImeWndProc, _PFNCLIENTWORKER::pfnListBoxWndProc, _PFNCLIENT::pfnListBoxWndProc, _PFNCLIENT::pfnMB_DlgProc, _PFNCLIENT::pfnMDIActivateDlgProc, _PFNCLIENTWORKER::pfnMDIClientWndProc, _PFNCLIENT::pfnMDIClientWndProc, _PFNCLIENT::pfnMenuWndProc, _PFNCLIENT::pfnScrollBarWndProc, _PFNCLIENTWORKER::pfnStaticWndProc, _PFNCLIENT::pfnStaticWndProc, _PFNCLIENT::pfnTitleWndProc, tagSHAREDINFO::psi, RW_RegisterControls(), RW_RegisterDDEML(), ScrollBarWndProcA(), ScrollBarWndProcW(), _USERCONNECT::siClient, StaticWndProcA(), StaticWndProcW(), StaticWndProcWorker(), Status, TRUE, _USERCONNECT::ulVersion, and USERCURRENTVERSION.

Referenced by xxxCreateThreadInfo().

01220 { 01221 PCLIENTINFO pci; 01222 BOOL fFirstThread; 01223 DWORD ConnectState; 01224 01225 #ifdef TRACE_THREAD_INIT 01226 KdPrint(("USER32: ClientThreadSetup (pteb: %#p)\n", NtCurrentTeb())); 01227 #endif 01228 01229 /* 01230 * BUG 268642: Only the first thread calls GdiProcessSetup but all the other 01231 * threads must wait until the setup for GDI is finished. 01232 * 01233 * We can safely use gcsAccelCache critical section to protect this (even 01234 * though the name is not intuitive at all) 01235 */ 01236 01237 RtlEnterCriticalSection(&gcsAccelCache); 01238 01239 fFirstThread = gfFirstThread; 01240 01241 /* 01242 * setup GDI before continuing 01243 */ 01244 if (fFirstThread) { 01245 gfFirstThread = FALSE; 01246 GdiProcessSetup(); 01247 } 01248 01249 RtlLeaveCriticalSection(&gcsAccelCache); 01250 01251 /* 01252 * We've already checked to see if we need to connect 01253 * (i.e. NtCurrentTeb()->Win32ThreadInfo == NULL) This routine 01254 * just does the connecting. If we've already been through here 01255 * once, don't do it again. 01256 */ 01257 pci = GetClientInfo(); 01258 if (pci->CI_flags & CI_INITIALIZED) { 01259 RIPMSG0(RIP_ERROR, "Already initialized!"); 01260 return FALSE; 01261 } 01262 01263 /* 01264 * Create the queue info and thread info. Only once for this process do 01265 * we pass client side addresses to the server (for server callbacks). 01266 */ 01267 if (gfServerProcess && fFirstThread) { 01268 01269 USERCONNECT userconnect; 01270 NTSTATUS Status; 01271 01272 /* 01273 * We know that the shared info is now available in 01274 * the kernel. Map it into the server process. 01275 */ 01276 userconnect.ulVersion = USERCURRENTVERSION; 01277 userconnect.dwDispatchCount = gDispatchTableValues; 01278 Status = NtUserProcessConnect(NtCurrentProcess(), 01279 &userconnect, 01280 sizeof(USERCONNECT)); 01281 if (!NT_SUCCESS(Status)) 01282 return FALSE; 01283 01284 gSharedInfo = userconnect.siClient; 01285 gpsi = gSharedInfo.psi; 01286 UserAssert(gpsi); 01287 01288 UserAssert(pfnClientA.pfnScrollBarWndProc == (KPROC)ScrollBarWndProcA); 01289 UserAssert(pfnClientA.pfnTitleWndProc == (KPROC)DefWindowProcA); 01290 UserAssert(pfnClientA.pfnMenuWndProc == (KPROC)MenuWndProcA); 01291 UserAssert(pfnClientA.pfnDesktopWndProc == (KPROC)DesktopWndProcA); 01292 UserAssert(pfnClientA.pfnDefWindowProc == (KPROC)DefWindowProcA); 01293 UserAssert(pfnClientA.pfnHkINLPCWPSTRUCT == (KPROC)fnHkINLPCWPSTRUCTA); 01294 UserAssert(pfnClientA.pfnHkINLPCWPRETSTRUCT == (KPROC)fnHkINLPCWPRETSTRUCTA); 01295 UserAssert(pfnClientA.pfnButtonWndProc == (KPROC)ButtonWndProcA); 01296 UserAssert(pfnClientA.pfnComboBoxWndProc == (KPROC)ComboBoxWndProcA); 01297 UserAssert(pfnClientA.pfnComboListBoxProc == (KPROC)ComboListBoxWndProcA); 01298 UserAssert(pfnClientA.pfnDialogWndProc == (KPROC)DefDlgProcA); 01299 UserAssert(pfnClientA.pfnEditWndProc == (KPROC)EditWndProcA); 01300 UserAssert(pfnClientA.pfnListBoxWndProc == (KPROC)ListBoxWndProcA); 01301 UserAssert(pfnClientA.pfnMB_DlgProc == (KPROC)MB_DlgProcA); 01302 UserAssert(pfnClientA.pfnMDIActivateDlgProc == (KPROC)MDIActivateDlgProcA); 01303 UserAssert(pfnClientA.pfnMDIClientWndProc == (KPROC)MDIClientWndProcA); 01304 UserAssert(pfnClientA.pfnStaticWndProc == (KPROC)StaticWndProcA); 01305 UserAssert(pfnClientA.pfnDispatchHook == (KPROC)DispatchHookA); 01306 UserAssert(pfnClientA.pfnDispatchMessage == (KPROC)DispatchClientMessage); 01307 UserAssert(pfnClientA.pfnImeWndProc == (KPROC)ImeWndProcA); 01308 01309 UserAssert(pfnClientW.pfnScrollBarWndProc == (KPROC)ScrollBarWndProcW); 01310 UserAssert(pfnClientW.pfnTitleWndProc == (KPROC)DefWindowProcW); 01311 UserAssert(pfnClientW.pfnMenuWndProc == (KPROC)MenuWndProcW); 01312 UserAssert(pfnClientW.pfnDesktopWndProc == (KPROC)DesktopWndProcW); 01313 UserAssert(pfnClientW.pfnDefWindowProc == (KPROC)DefWindowProcW); 01314 UserAssert(pfnClientW.pfnHkINLPCWPSTRUCT == (KPROC)fnHkINLPCWPSTRUCTW); 01315 UserAssert(pfnClientW.pfnHkINLPCWPRETSTRUCT == (KPROC)fnHkINLPCWPRETSTRUCTW); 01316 UserAssert(pfnClientW.pfnButtonWndProc == (KPROC)ButtonWndProcW); 01317 UserAssert(pfnClientW.pfnComboBoxWndProc == (KPROC)ComboBoxWndProcW); 01318 UserAssert(pfnClientW.pfnComboListBoxProc == (KPROC)ComboListBoxWndProcW); 01319 UserAssert(pfnClientW.pfnDialogWndProc == (KPROC)DefDlgProcW); 01320 UserAssert(pfnClientW.pfnEditWndProc == (KPROC)EditWndProcW); 01321 UserAssert(pfnClientW.pfnListBoxWndProc == (KPROC)ListBoxWndProcW); 01322 UserAssert(pfnClientW.pfnMB_DlgProc == (KPROC)MB_DlgProcW); 01323 UserAssert(pfnClientW.pfnMDIActivateDlgProc == (KPROC)MDIActivateDlgProcW); 01324 UserAssert(pfnClientW.pfnMDIClientWndProc == (KPROC)MDIClientWndProcW); 01325 UserAssert(pfnClientW.pfnStaticWndProc == (KPROC)StaticWndProcW); 01326 UserAssert(pfnClientW.pfnDispatchHook == (KPROC)DispatchHookW); 01327 UserAssert(pfnClientW.pfnDispatchMessage == (KPROC)DispatchClientMessage); 01328 UserAssert(pfnClientW.pfnImeWndProc == (KPROC)ImeWndProcW); 01329 01330 UserAssert(pfnClientWorker.pfnButtonWndProc == (KPROC)ButtonWndProcWorker); 01331 UserAssert(pfnClientWorker.pfnComboBoxWndProc == (KPROC)ComboBoxWndProcWorker); 01332 UserAssert(pfnClientWorker.pfnComboListBoxProc == (KPROC)ListBoxWndProcWorker); 01333 UserAssert(pfnClientWorker.pfnDialogWndProc == (KPROC)DefDlgProcWorker); 01334 UserAssert(pfnClientWorker.pfnEditWndProc == (KPROC)EditWndProcWorker); 01335 UserAssert(pfnClientWorker.pfnListBoxWndProc == (KPROC)ListBoxWndProcWorker); 01336 UserAssert(pfnClientWorker.pfnMDIClientWndProc == (KPROC)MDIClientWndProcWorker); 01337 UserAssert(pfnClientWorker.pfnStaticWndProc == (KPROC)StaticWndProcWorker); 01338 UserAssert(pfnClientWorker.pfnImeWndProc == (KPROC)ImeWndProcWorker); 01339 01340 #if DBG 01341 { 01342 PULONG_PTR pdw; 01343 01344 /* 01345 * Make sure that everyone got initialized 01346 */ 01347 for (pdw = (PULONG_PTR)&pfnClientA; 01348 (ULONG_PTR)pdw<(ULONG_PTR)(&pfnClientA) + sizeof(pfnClientA); 01349 pdw++) { 01350 UserAssert(*pdw); 01351 } 01352 01353 for (pdw = (PULONG_PTR)&pfnClientW; 01354 (ULONG_PTR)pdw<(ULONG_PTR)(&pfnClientW) + sizeof(pfnClientW); 01355 pdw++) { 01356 UserAssert(*pdw); 01357 } 01358 } 01359 #endif 01360 01361 #if DBG 01362 { 01363 extern CONST INT gcapfnScSendMessage; 01364 BOOLEAN apfnCheckMessage[64]; 01365 int i; 01366 01367 /* 01368 * Do some verification of the message table. Since we only have 01369 * 6 bits to store the function index, the function table can have 01370 * at most 64 entries. Also verify that none of the indexes point 01371 * past the end of the table and that all the function entries 01372 * are used. 01373 */ 01374 UserAssert(gcapfnScSendMessage <= 64); 01375 RtlZeroMemory(apfnCheckMessage, sizeof(apfnCheckMessage)); 01376 for (i = 0; i < WM_USER; i++) { 01377 UserAssert(MessageTable[i].iFunction < gcapfnScSendMessage); 01378 apfnCheckMessage[MessageTable[i].iFunction] = TRUE; 01379 } 01380 01381 for (i = 0; i < gcapfnScSendMessage; i++) { 01382 UserAssert(apfnCheckMessage[i]); 01383 } 01384 } 01385 #endif 01386 01387 } 01388 01389 /* 01390 * Pass the function pointer arrays to the kernel. This also establishes 01391 * the kernel state for the thread. If ClientThreadSetup is called from 01392 * CsrConnectToUser this call will raise an exception if the thread 01393 * cannot be converted to a gui thread. The exception is handled in 01394 * CsrConnectToUser. 01395 */ 01396 #if DBG && !defined(BUILD_WOW6432) 01397 /* 01398 * On debug systems, go to the kernel for all processes to verify we're 01399 * loading user32.dll at the right address. 01400 */ 01401 if (fFirstThread) { 01402 #elif defined(BUILD_WOW6432) 01403 /* 01404 * On WOW64 allways register the client fns 01405 */ 01406 { 01407 #else 01408 if (gfServerProcess && fFirstThread) { 01409 #endif 01410 if (!NT_SUCCESS(NtUserInitializeClientPfnArrays(&pfnClientA, &pfnClientW, &pfnClientWorker, hmodUser))) { 01411 01412 RIPERR0(ERROR_OUTOFMEMORY, 01413 RIP_WARNING, 01414 "NtUserInitializeClientPfnArrays failed"); 01415 01416 return FALSE; 01417 } 01418 } 01419 01420 /* 01421 * Mark this thread as being initialized. If the connection to 01422 * the server fails, NtCurrentTeb()->Win32ThreadInfo will remain 01423 * NULL. 01424 */ 01425 pci->CI_flags |= CI_INITIALIZED; 01426 01427 /* 01428 * Some initialization only has to occur once per process 01429 */ 01430 if (fFirstThread) { 01431 01432 ConnectState = (DWORD)NtUserCallNoParam(SFI_REMOTECONNECTSTATE); 01433 01434 /* 01435 * Winstation Winlogon and CSR must do graphics initialization 01436 * after the connect. 01437 */ 01438 01439 if (ConnectState != CTX_W32_CONNECT_STATE_IDLE) { 01440 01441 if ((ghdcBits2 = CreateCompatibleDC(NULL)) == NULL) { 01442 RIPERR0(ERROR_OUTOFMEMORY, RIP_WARNING, "ghdcBits2 creation failed"); 01443 return FALSE; 01444 } 01445 01446 /* 01447 * Get things we need from Gdi. 01448 */ 01449 if (ghbrWhite == NULL) 01450 ghbrWhite = GetStockObject(WHITE_BRUSH); 01451 01452 if (ghbrBlack == NULL) 01453 ghbrBlack = GetStockObject(BLACK_BRUSH); 01454 01455 InitClientDrawing(); 01456 } 01457 01458 gfSystemInitialized = NtUserGetThreadDesktop(GetCurrentThreadId(), 01459 NULL) != NULL; 01460 01461 /* 01462 * If an lpk is loaded for this process notify the kernel 01463 */ 01464 if (gdwLpkEntryPoints) { 01465 NtUserCallOneParam(gdwLpkEntryPoints, SFI_REGISTERLPK); 01466 } 01467 01468 if (gfServerProcess || (GetClientInfo()->pDeskInfo == NULL)) { 01469 01470 /* 01471 * Perform any server initialization. 01472 */ 01473 UserAssert(gpsi); 01474 01475 if (pdiLocal = LocalAlloc(LPTR, sizeof(DESKTOPINFO))) { 01476 01477 GetClientInfo()->pDeskInfo = pdiLocal; 01478 01479 } else { 01480 01481 RIPERR0(ERROR_OUTOFMEMORY, RIP_WARNING, "pdiLocal creation failed"); 01482 01483 return FALSE; 01484 } 01485 } 01486 01487 if (gfServerProcess) { 01488 /* 01489 * Winstation Winlogon and CSR must do graphics initialization 01490 * after the connect. 01491 */ 01492 if (ConnectState != CTX_W32_CONNECT_STATE_IDLE) { 01493 if (!LoadCursorsAndIcons()) { 01494 RIPERR0(ERROR_OUTOFMEMORY, RIP_WARNING, "LoadCursorsAndIcons failed"); 01495 return FALSE; 01496 } 01497 } 01498 01499 InitOemXlateTables(); 01500 } 01501 01502 if ( ! CheckBadApp() ) { 01503 RIPERR0(ERROR_OUTOFMEMORY, RIP_WARNING, "Don't start app for server appliance"); 01504 return FALSE; 01505 } 01506 01507 LoadAppDlls(); 01508 } else if (gfServerProcess) { 01509 GetClientInfo()->pDeskInfo = pdiLocal; 01510 } 01511 01512 /* 01513 * Kernel sets CI_REGISTERCLASSES when appropriate (i.e. always 01514 * for the first thread and for other threads if the last GUI 01515 * thread for a process has exited) except for the CSR proces. 01516 * For the CSR process, you must register the classes on the 01517 * first thread anyways. 01518 */ 01519 01520 if (fFirstThread || (pci->CI_flags & CI_REGISTERCLASSES)) { 01521 01522 /* 01523 * If it's the first thread we already made it to the kernel 01524 * to get the ConnectState... 01525 */ 01526 if (!fFirstThread) { 01527 ConnectState = (DWORD)NtUserCallNoParam(SFI_REMOTECONNECTSTATE); 01528 } 01529 01530 if (ConnectState != CTX_W32_CONNECT_STATE_IDLE) { 01531 01532 /* 01533 * Register the control classes. 01534 */ 01535 RW_RegisterControls(); 01536 RW_RegisterDDEML(); 01537 } 01538 } 01539 01540 return TRUE; 01541 }

void ClipPointToDesktop LPPOINT  lppt  ) 
 

Definition at line 33 of file multimon.c.

References _MonitorFromPoint(), tagDISPLAYINFO::fDesktopIsRect, gpDispInfo, gpMonitorMouse, NULL, PtInRect(), and tagMONITOR::rcMonitor.

Referenced by BoundCursor().

00034 { 00035 PMONITOR pMonitor; 00036 00037 UserAssert(!gpDispInfo->fDesktopIsRect && 00038 "You shouldn't call this function if the desktop is a rectangle.\n" 00039 "Just clip to gpsi->rcScreen instead."); 00040 00041 /* 00042 * Optimization: The cursor is likely to be on the monitor it was last on, 00043 * so check for that case. 00044 */ 00045 if (gpMonitorMouse != NULL && PtInRect(&gpMonitorMouse->rcMonitor, *lppt)) { 00046 return; 00047 } 00048 00049 pMonitor = _MonitorFromPoint(*lppt, MONITOR_DEFAULTTONEAREST); 00050 00051 /* 00052 * Remember the monitor the cursor is on. 00053 */ 00054 gpMonitorMouse = pMonitor; 00055 00056 if (lppt->x < pMonitor->rcMonitor.left) { 00057 lppt->x = pMonitor->rcMonitor.left; 00058 } else if (lppt->x >= pMonitor->rcMonitor.right) { 00059 lppt->x = pMonitor->rcMonitor.right-1; 00060 } 00061 if (lppt->y < pMonitor->rcMonitor.top) { 00062 lppt->y = pMonitor->rcMonitor.top; 00063 } else if (lppt->y >= pMonitor->rcMonitor.bottom) { 00064 lppt->y = pMonitor->rcMonitor.bottom-1; 00065 } 00066 }

__inline NTSTATUS CloseProtectedHandle HANDLE  handle  ) 
 

Definition at line 7298 of file userk.h.

References BOOL, and VOID().

Referenced by DestroyProcessInfo(), InitiateWin32kCleanup(), NtUserOpenInputDesktop(), xxxCloseDesktop(), xxxCreateDesktop(), xxxCreateDisconnectDesktop(), xxxOpenDesktop(), xxxResolveDesktop(), xxxResolveDesktopForWOW(), xxxRestoreCsrssThreadDesktop(), and xxxSetCsrssThreadDesktop().

07309 {

VOID ClrFTrueVis PWND  pwnd  ) 
 

Definition at line 5495 of file swp.c.

References ClrWF, DecPaintCount(), DeleteMaybeSpecialRgn(), tagWND::hrgnUpdate, NEEDSPAINT, NULL, tagWND::spwndChild, tagWND::spwndNext, TestWF, VOID(), WFINTERNALPAINT, and WFVISIBLE.

Referenced by SetVisible(), and xxxMinMaximize().

05497 { 05498 /* 05499 * Destroy pwnd and its children's update regions. 05500 * We do this here to guarantee that a hidden window 05501 * and its children don't have update regions. 05502 * 05503 * This fixes bugs when destroying windows that have 05504 * update regions (SendDestroyMessages) among others 05505 * and allows us to simplify SetParent(). This was 05506 * deemed better than hacking DoPaint() and/or 05507 * DestroyWindow(). 05508 * 05509 * We can stop recursing when we find a window that doesn't 05510 * have the visible bit set, because by definition it won't 05511 * have any update regions below it (this routine will have been called) 05512 */ 05513 if (NEEDSPAINT(pwnd)) { 05514 05515 DeleteMaybeSpecialRgn(pwnd->hrgnUpdate); 05516 05517 ClrWF(pwnd, WFINTERNALPAINT); 05518 05519 pwnd->hrgnUpdate = NULL; 05520 DecPaintCount(pwnd); 05521 } 05522 05523 for (pwnd = pwnd->spwndChild; pwnd != NULL; pwnd = pwnd->spwndNext) { 05524 05525 /* 05526 * pwnd->fs &= ~WF_TRUEVIS; 05527 */ 05528 if (TestWF(pwnd, WFVISIBLE)) 05529 ClrFTrueVis(pwnd); 05530 } 05531 }

NTSTATUS CommitReadOnlyMemory HANDLE  hSection,
PSIZE_T  pulCommit,
DWORD  dwCommitOffset,
int *  pdCommit
 

Definition at line 278 of file ex.c.

References MmMapViewOfSection(), MmUnmapViewOfSection(), NT_SUCCESS, NTSTATUS(), NULL, PAGE_SIZE, PBYTE, PsGetCurrentProcess, and Status.

Referenced by HMGrowHandleTable(), HMInitHandleTable(), UserCommitDesktopMemory(), and UserCommitSharedMemory().

00283 { 00284 SIZE_T ulViewSize; 00285 LARGE_INTEGER liOffset; 00286 PEPROCESS Process; 00287 PVOID pUserBase, pvt; 00288 NTSTATUS Status; 00289 00290 ulViewSize = 0; 00291 pUserBase = NULL; 00292 liOffset.QuadPart = 0; 00293 Process = PsGetCurrentProcess(); 00294 00295 Status = MmMapViewOfSection( 00296 hSection, 00297 Process, 00298 &pUserBase, 00299 0, 00300 PAGE_SIZE, 00301 &liOffset, 00302 &ulViewSize, 00303 ViewUnmap, 00304 SEC_NO_CHANGE, 00305 PAGE_EXECUTE_READ); 00306 00307 if (NT_SUCCESS(Status)) { 00308 00309 /* 00310 * Commit the memory 00311 */ 00312 pUserBase = pvt = (PVOID)((PBYTE)pUserBase + dwCommitOffset); 00313 00314 Status = ZwAllocateVirtualMemory( 00315 NtCurrentProcess(), 00316 &pUserBase, 00317 0, 00318 pCommitSize, 00319 MEM_COMMIT, 00320 PAGE_EXECUTE_READ); 00321 00322 if (pdCommit) { 00323 *pdCommit = (int)((PBYTE)pUserBase - (PBYTE)pvt); 00324 } 00325 #if DBG 00326 else { 00327 UserAssert(pvt == pUserBase); 00328 } 00329 #endif 00330 00331 MmUnmapViewOfSection(Process, pUserBase); 00332 } 00333 return Status; 00334 }

__inline int ComputePastTickDelta IN DWORD  dwCurTick,
IN DWORD  dwLastTick
 

Definition at line 6972 of file userk.h.

Referenced by TimersProc(), and xxxPollAndWaitForSingleObject().

06976 { 06977 return (int) dwCurTick - dwLastTick; 06978 } 06979

__inline int ComputeTickDelta IN DWORD  dwCurTick,
IN DWORD  dwLastTick
 

Definition at line 6963 of file userk.h.

Referenced by zzzCalcStartCursorHide().

06976 {

BOOL CopyFromClient LPBYTE  lpByte,
LPBYTE  lpByteClient,
DWORD  cch,
BOOL  fString,
BOOL  fAnsi
 

BOOL CopyToClient LPBYTE  lpByte,
LPBYTE  lpByteClient,
DWORD  cchMax,
BOOL  fAnsi
 

BOOL CreateBitmapStrip VOID   ) 
 

Definition at line 494 of file inctlpan.c.

References BOOL, CCACHEDCAPTIONS, CreateCaptionStrip(), tagOEMBITMAPINFO::cx, tagOEMBITMAPINFO::cy, cy, DrawCaptionButtons(), DrawFrameControl(), FALSE, FillRect(), gcachedCaptions, GetFrameControlMetrics(), ghbmBits, ghbmCaption, gpDispInfo, gpsi, HDCBITS, tagDISPLAYINFO::hdcScreen, min, NULL, OBI_COUNT, OBI_MENUCHECK, PackFrameControls(), tagCAPTIONCACHE::pOem, tagCAPTIONCACHE::spcursor, sysBmpStyles, SYSHBR, SYSMET, szOneChar, TestALPHA, TRUE, UINT, Unlock, tagOEMBITMAPINFO::x, and tagOEMBITMAPINFO::y.

Referenced by xxxResetDisplayDevice(), xxxSetWindowNCMetrics(), and xxxSystemParametersInfo().

00495 { 00496 int cxBmp = 0; 00497 int cyBmp = 0; 00498 int iCache = 0; 00499 HBITMAP hOldBitmap; 00500 HBITMAP hNewBmp; 00501 UINT iType; 00502 RECT rc; 00503 UINT wBmpType; 00504 UINT wBmpStyle; 00505 POEMBITMAPINFO pOem; 00506 00507 /* 00508 * Each OBI_ must have an entry in sysBmpStyles 00509 */ 00510 UserAssert(OBI_COUNT == sizeof(sysBmpStyles) / sizeof(*sysBmpStyles)); 00511 UserAssert(OBI_COUNT == sizeof(gpsi->oembmi) / sizeof(*(gpsi->oembmi))); 00512 00513 /* 00514 * load all the bitmap dimensions into the OEMBITMAPINFO array oemInfo.bm 00515 */ 00516 for (iType = 0; iType < OBI_COUNT; iType++) 00517 cxBmp = GetFrameControlMetrics(iType, cxBmp); 00518 00519 for (iType = 0; iType < 5; iType++) 00520 cy[iType] = PackFrameControls(cxBmp * (iType + 1), FALSE) * (iType + 1); 00521 00522 cyBmp = min(cy[0], min(cy[1], min(cy[2], min(cy[3], cy[4])))); 00523 for (iType = 0; cyBmp != cy[iType]; iType++); 00524 00525 cxBmp *= iType + 1; 00526 cyBmp = PackFrameControls(cxBmp, TRUE); 00527 00528 hNewBmp = GreCreateCompatibleBitmap(gpDispInfo->hdcScreen, cxBmp, cyBmp); 00529 00530 if (hNewBmp == NULL) { 00531 RIPMSG0(RIP_WARNING, "CreateBitmapStrip: failed to create bitmap"); 00532 return FALSE; 00533 } 00534 00535 GreSetBitmapOwner(hNewBmp, OBJECT_OWNER_PUBLIC); 00536 00537 /* 00538 * Select in Bitmap Strip -- then delete old one if it exists 00539 * Yanked for Chicago since these can now be paged 00540 * GDIMoveBitmap(hNewBmp); 00541 */ 00542 hOldBitmap = GreSelectBitmap(HDCBITS(), hNewBmp); 00543 00544 if (ghbmBits) { 00545 #if DBG 00546 /* 00547 * Don't assert if we're out of memory 00548 */ 00549 if (hOldBitmap != NULL) { 00550 UserAssert(ghbmBits == hOldBitmap); 00551 } 00552 #endif 00553 GreDeleteObject(ghbmCaption); 00554 GreDeleteObject(hOldBitmap); 00555 } else { 00556 /* 00557 * hack to clear out display driver's font cache 00558 */ 00559 GreExtTextOutW(HDCBITS(), 0, 0, 0, NULL, (PWSTR)szOneChar, 1, NULL); 00560 } 00561 00562 ghbmBits = hNewBmp; 00563 00564 ghbmCaption = CreateCaptionStrip(); 00565 00566 if (ghbmCaption == NULL) { 00567 RIPMSG0(RIP_WARNING, "CreateBitmapStrip: failed to create bitmap for caption"); 00568 return FALSE; 00569 } 00570 00571 /* 00572 * draw individual bitmaps into the strip bitmap and record the offsets 00573 */ 00574 for (pOem = gpsi->oembmi, iType = 0; iType < OBI_COUNT; iType++, pOem++) { 00575 if (!pOem->cx) { 00576 *pOem = gpsi->oembmi[pOem->cy]; 00577 } else { 00578 rc.left = pOem->x; 00579 rc.top = pOem->y; 00580 rc.right = rc.left + pOem->cx; 00581 rc.bottom = rc.top + pOem->cy; 00582 00583 wBmpType = sysBmpStyles[iType][0]; 00584 wBmpStyle = sysBmpStyles[iType][1]; 00585 00586 if (wBmpType == DFC_CACHE) { 00587 if (wBmpStyle & DFCS_CACHEBUTTONS) { 00588 HBRUSH hbr; 00589 if (TestALPHA(GRADIENTCAPTIONS)) { 00590 hbr = (wBmpStyle & DFCS_INACTIVE) ? SYSHBR(GRADIENTINACTIVECAPTION) : SYSHBR(GRADIENTACTIVECAPTION); 00591 } else { 00592 hbr = (wBmpStyle & DFCS_INACTIVE) ? SYSHBR(INACTIVECAPTION) : SYSHBR(ACTIVECAPTION); 00593 } 00594 FillRect(HDCBITS(), &rc, hbr); 00595 DrawCaptionButtons(rc.left, rc.top); 00596 } else if (!(wBmpStyle & DFCS_INACTIVE)) { 00597 /* 00598 * Setup Caption Cache Entry 00599 */ 00600 UserAssert(iCache < CCACHEDCAPTIONS); 00601 if (gcachedCaptions[iCache].spcursor) { 00602 Unlock(&(gcachedCaptions[iCache].spcursor)); 00603 } 00604 gcachedCaptions[iCache++].pOem = pOem; 00605 } 00606 } else { 00607 DrawFrameControl(HDCBITS(), &rc, wBmpType, wBmpStyle); 00608 } 00609 } 00610 } 00611 00612 /* 00613 * Setup other frame metric dependent values. 00614 */ 00615 SYSMET(CXMENUCHECK) = gpsi->oembmi[OBI_MENUCHECK].cx; 00616 SYSMET(CYMENUCHECK) = gpsi->oembmi[OBI_MENUCHECK].cy; 00617 00618 return TRUE; 00619 }

HDC CreateCacheDC PWND  ,
DWORD  ,
PMONITOR 
 

Definition at line 1463 of file dc.c.

References AnySpbs, CFCLASSDC, DCE, tagDCE::DCX_flags, FALSE, gpDispInfo, tagDCE::hdc, tagMONITOR::hDev, tagDISPLAYINFO::hDev, tagDCE::hrgnClip, tagDCE::hrgnClipPublic, tagDCE::hrgnSavedVis, IncrementFreeDCECount(), InvalidateDce(), NULL, tagWND::pcls, tagCLS::pdce, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDCE::pMonitor, PtiCurrent, tagDCE::ptiOwner, tagDCE::pwndClip, tagDCE::pwndOrg, and TestCF.

Referenced by _GetDCEx(), GetMonitorDC(), InitUserScreen(), and xxxCreateWindowEx().

01468 { 01469 PDCE pdce; 01470 HDC hdc; 01471 HANDLE hDev; 01472 01473 if ((pdce = (PDCE)UserAllocPool(sizeof(DCE), TAG_DCE)) == NULL) 01474 return NULL; 01475 01476 if (pMonitor == NULL) { 01477 hDev = gpDispInfo->hDev; 01478 } else { 01479 hDev = pMonitor->hDev; 01480 } 01481 01482 if ((hdc = GreCreateDisplayDC(hDev, DCTYPE_DIRECT, FALSE)) == NULL) { 01483 UserFreePool(pdce); 01484 return NULL; 01485 } 01486 01487 /* 01488 * Link this entry into the cache entry list. 01489 */ 01490 pdce->pdceNext = gpDispInfo->pdceFirst; 01491 gpDispInfo->pdceFirst = pdce; 01492 01493 pdce->hdc = hdc; 01494 pdce->DCX_flags = DCX_flags; 01495 pdce->pwndOrg = pwndOrg; 01496 pdce->pwndClip = pwndOrg; 01497 pdce->hrgnClip = NULL; 01498 pdce->hrgnClipPublic = NULL; 01499 pdce->hrgnSavedVis = NULL; 01500 pdce->pMonitor = pMonitor; 01501 01502 /* 01503 * Mark it as undeleteable so no application can delete it out of our 01504 * cache! 01505 */ 01506 GreMarkUndeletableDC(hdc); 01507 01508 if (DCX_flags & DCX_OWNDC) { 01509 01510 /* 01511 * Set the ownership of owndcs immediately: that way console can set 01512 * the owernship to PUBLIC when it calls GetDC so that both the input 01513 * thread and the service threads can use the same owndc. 01514 */ 01515 GreSetDCOwner(hdc, OBJECT_OWNER_CURRENT); 01516 pdce->ptiOwner = PtiCurrent(); 01517 01518 } else { 01519 01520 /* 01521 * Otherwise it is a cache dc... set its owner to none - nothing 01522 * is using it - equivalent of "being in the cache" but unaccessible 01523 * to other processes. 01524 */ 01525 GreSetDCOwner(hdc, OBJECT_OWNER_NONE); 01526 pdce->ptiOwner = NULL; 01527 01528 /* 01529 * Increment the available-cacheDC count. Once this hits our 01530 * threshold, then we can free-up some of the entries. 01531 */ 01532 IncrementFreeDCECount(); 01533 } 01534 01535 /* 01536 * If we're creating a permanent DC, then compute it now. 01537 */ 01538 if (!(DCX_flags & DCX_CACHE)) { 01539 01540 /* 01541 * Set up the class DC now... 01542 */ 01543 if (TestCF(pwndOrg, CFCLASSDC)) 01544 pwndOrg->pcls->pdce = pdce; 01545 01546 /* 01547 * Finish setting up DCE and force eventual visrgn calculation. 01548 */ 01549 UserAssert(!(DCX_flags & DCX_WINDOW)); 01550 01551 pdce->DCX_flags |= DCX_INUSE; 01552 01553 InvalidateDce(pdce); 01554 } 01555 01556 /* 01557 * If there are any spb's around then enable bounds accumulation. 01558 */ 01559 if (AnySpbs()) 01560 GreGetBounds(pdce->hdc, NULL, DCB_ENABLE | DCB_SET | DCB_WINDOWMGR); 01561 01562 return pdce->hdc; 01563 }

HBITMAP CreateCaptionStrip  ) 
 

Referenced by CreateBitmapStrip(), xxxAnimateCaption(), and xxxResetDisplayDevice().

HDC CreateCompatiblePublicDC HDC  hdc,
HBITMAP *  pbmDCGray
 

Definition at line 40 of file mngray.c.

References tagDISPLAYINFO::cxGray, cy, ghbmBits, ghFontSys, gpDispInfo, GreGetTextAlign(), GreSetTextAlign(), HDCBITS, tagDISPLAYINFO::hdcGray, and NULL.

00043 { 00044 HDC hdcCompatible = 0; 00045 HBITMAP hbmCompatible; 00046 HFONT hFont; 00047 int cx,cy; 00048 00049 if ((hdcPublic != gpDispInfo->hdcGray) && (hdcPublic != HDCBITS())) { 00050 return hdcPublic; 00051 } 00052 00053 if ((hdcCompatible = GreCreateCompatibleDC(hdcPublic)) == NULL) { 00054 RIPMSG1(RIP_WARNING, "CreateCompatiblePublicDC: GreCreateCompatibleDC Failed %lX", hdcPublic); 00055 return (HDC)NULL; 00056 } 00057 if (!GreSetDCOwner(hdcCompatible, OBJECT_OWNER_CURRENT)) { 00058 RIPMSG1(RIP_WARNING, "CreateCompatiblePublicDC: SetDCOwner Failed %lX", hdcCompatible); 00059 GreDeleteDC(hdcCompatible); 00060 return (HDC)NULL; 00061 } 00062 00063 if (hdcPublic == gpDispInfo->hdcGray) { 00064 cx = gpDispInfo->cxGray; 00065 cy = gpDispInfo->cxGray; 00066 } else { 00067 if (hdcPublic == HDCBITS()) { 00068 BITMAP bmBits; 00069 00070 GreExtGetObjectW(ghbmBits, sizeof(BITMAP), &bmBits); 00071 cx = bmBits.bmWidth; 00072 cy = bmBits.bmHeight; 00073 } else { 00074 00075 // 00076 // We should not reach here. 00077 // 00078 RIPMSG1(RIP_ERROR, "CreateCompatiblePublicDC: GreCreateCompatibleDC Failed %lX", hdcPublic); 00079 } 00080 00081 } 00082 00083 hbmCompatible = GreCreateCompatibleBitmap(hdcPublic, 00084 cx, 00085 cy); 00086 00087 // 00088 // Check whether bitmap couldn't be created or can't 00089 // be set to OBJECT_OWNER_CURRENT, then fail and 00090 // do necessary cleanup now! 00091 // 00092 00093 if( (hbmCompatible == NULL) || 00094 (!GreSetBitmapOwner(hbmCompatible, OBJECT_OWNER_CURRENT)) ) { 00095 00096 RIPMSG1(RIP_WARNING, "CreateCompatiblePublicDC: GreCreateCompatibleBitmap Failed %lX", hbmCompatible); 00097 GreDeleteDC( hdcCompatible ); 00098 00099 if( hbmCompatible ) { 00100 GreDeleteObject( hbmCompatible ); 00101 } 00102 00103 return (HDC)NULL; 00104 } 00105 00106 GreSelectBitmap(hdcCompatible, hbmCompatible); 00107 /* 00108 * Make sure we use the same font and text alignment. 00109 */ 00110 hFont = GreSelectFont(hdcPublic, ghFontSys); 00111 GreSelectFont(hdcPublic, hFont); 00112 GreSelectFont(hdcCompatible, hFont); 00113 GreSetTextAlign(hdcCompatible, GreGetTextAlign(hdcPublic)); 00114 /* 00115 * Copy any information already written into G_TERM(pDispInfo)->hdcGray. 00116 */ 00117 00118 #ifdef USE_MIRRORING 00119 // 00120 // Mirror the created DC if the hdcGray is currently mirrored, 00121 // so that TextOut won't get mirrored on User Client DCs 00122 // 00123 if (GreGetLayout(hdcPublic) & LAYOUT_RTL) 00124 GreSetLayout(hdcCompatible, cx - 1, LAYOUT_RTL); 00125 #endif 00126 GreBitBlt(hdcCompatible, 0, 0, cx, cy, hdcPublic, 0, 0, SRCCOPY, 0); 00127 00128 *pbmPublicDC = hbmCompatible ; // for later deletion, by the server side 00129 00130 return hdcCompatible; 00131 }

HANDLE CreateDesktopHeap PWIN32HEAP *  ppheapRet,
ULONG  ulHeapSize
 

Definition at line 2696 of file desktop.c.

References Error, NT_SUCCESS, NTSTATUS(), NULL, Status, UserCommitDesktopMemory(), and UserCreateHeap().

Referenced by xxxCreateDesktop2().

02699 { 02700 HANDLE hsection; 02701 LARGE_INTEGER SectionSize; 02702 SIZE_T ulViewSize; 02703 NTSTATUS Status; 02704 PWIN32HEAP pheap; 02705 PVOID pHeapBase; 02706 02707 /* 02708 * Create desktop heap section and map it into the kernel 02709 */ 02710 SectionSize.QuadPart = ulHeapSize; 02711 02712 Status = Win32CreateSection(&hsection, 02713 SECTION_ALL_ACCESS, 02714 (POBJECT_ATTRIBUTES)NULL, 02715 &SectionSize, 02716 PAGE_EXECUTE_READWRITE, 02717 SEC_RESERVE, 02718 (HANDLE)NULL, 02719 NULL, 02720 TAG_SECTION_DESKTOP); 02721 02722 if (!NT_SUCCESS( Status )) { 02723 RIPNTERR0(Status, RIP_WARNING, "Can't create section for desktop heap."); 02724 return NULL; 02725 } 02726 02727 ulViewSize = ulHeapSize; 02728 pHeapBase = NULL; 02729 02730 Status = Win32MapViewInSessionSpace(hsection, &pHeapBase, &ulViewSize); 02731 02732 if (!NT_SUCCESS(Status)) { 02733 RIPNTERR0(Status, 02734 RIP_WARNING, 02735 "Can't map section for desktop heap into system space."); 02736 goto Error; 02737 } 02738 02739 /* 02740 * Create desktop heap. 02741 */ 02742 if ((pheap = UserCreateHeap( 02743 hsection, 02744 0, 02745 pHeapBase, 02746 ulHeapSize, 02747 UserCommitDesktopMemory)) == NULL) { 02748 02749 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, RIP_WARNING, "Can't create Desktop heap."); 02750 02751 Win32UnmapViewInSessionSpace(pHeapBase); 02752 Error: 02753 Win32DestroySection(hsection); 02754 *ppheapRet = NULL; 02755 return NULL; 02756 } 02757 02758 UserAssert(Win32HeapGetHandle(pheap) == pHeapBase); 02759 *ppheapRet = pheap; 02760 02761 return hsection; 02762 }

PDEVICEINFO CreateDeviceInfo DWORD  DeviceType,
PUNICODE_STRING  SymbolicLinkName,
BYTE  bFlags
 

Definition at line 406 of file w32/ntuser/kernel/pnp.c.

References aDeviceTemplate, BEGINATOMICCHECK, BYTE, CheckCritIn, CreateKernelEvent(), DEVICE_TYPE_MAX, ENDATOMICCHECK, EnterDeviceInfoListCrit(), EXITATOMICCHECK, FALSE, GDIAF_ARRIVED, gpDeviceInfoList, LeaveDeviceInfoListCrit(), NULL, RequestDeviceChange(), RtlCopyUnicodeString(), and TRUE.

Referenced by DeviceClassNotify(), OpenMultiplePortDevice(), and RawInputThread().

00407 { 00408 PDEVICEINFO pDeviceInfo = NULL; 00409 00410 CheckCritIn(); 00411 BEGINATOMICCHECK(); 00412 00413 UserAssert(pustrName != NULL); 00414 00415 TAGMSG3(DBGTAG_PNP, "CreateDeviceInfo(%d, %S, %x)", DeviceType, pustrName->Buffer, bFlags); 00416 00417 if (DeviceType > DEVICE_TYPE_MAX) { 00418 RIPMSG1(RIP_ERROR, "Unknown DeviceType %lx", DeviceType); 00419 } 00420 00421 pDeviceInfo = UserAllocPoolZInit(aDeviceTemplate[DeviceType].cbDeviceInfo, TAG_PNP); 00422 if (pDeviceInfo == NULL) { 00423 RIPMSG0(RIP_WARNING, "CreateDeviceInfo() out of memory allocating DEVICEINFO"); 00424 EXITATOMICCHECK(); 00425 return NULL; 00426 } 00427 00428 if (pustrName->Buffer != NULL) { 00429 pDeviceInfo->ustrName.Buffer = UserAllocPool(pustrName->Length, TAG_PNP); 00430 00431 if (pDeviceInfo->ustrName.Buffer == NULL) { 00432 RIPMSG1(RIP_WARNING, "CreateDeviceInfo: Can't duplicate string %ws", 00433 pustrName->Buffer); 00434 goto CreateFailed; 00435 } 00436 00437 pDeviceInfo->ustrName.MaximumLength = pustrName->Length; 00438 RtlCopyUnicodeString(&pDeviceInfo->ustrName, pustrName); 00439 } 00440 00441 pDeviceInfo->type = (BYTE)DeviceType; 00442 00443 /* 00444 * Create this device's HidChangeCompletion event. When the RIT completes 00445 * a synchronous ProcessDeviceChanges() it signals the HidChangeCompletion 00446 * event to wake the requesting RequestDeviceChange() which is blocking on 00447 * the event. 00448 * Each device has it's own HidChangeCompletion event, 00449 * since multiple PnP notification may arrive for several different 00450 * devices simultaneously. (see #331320 IanJa) 00451 */ 00452 pDeviceInfo->pkeHidChangeCompleted = CreateKernelEvent(SynchronizationEvent, FALSE); 00453 if (pDeviceInfo->pkeHidChangeCompleted == NULL) { 00454 RIPMSG0(RIP_WARNING, 00455 "CreateDeviceInfo: failed to create pkeHidChangeCompleted"); 00456 goto CreateFailed; 00457 } 00458 00459 /* 00460 * Link it in 00461 */ 00462 EnterDeviceInfoListCrit(); 00463 pDeviceInfo->pNext = gpDeviceInfoList; 00464 gpDeviceInfoList = pDeviceInfo; 00465 pDeviceInfo->bFlags |= bFlags; 00466 00467 /* 00468 * Tell the RIT there is a new device so that it can open it and start 00469 * reading from it. This is non-blocking (no GDIAF_PNPWAITING bit set) 00470 */ 00471 RequestDeviceChange(pDeviceInfo, GDIAF_ARRIVED, TRUE); 00472 LeaveDeviceInfoListCrit(); 00473 00474 EXITATOMICCHECK(); 00475 return pDeviceInfo; 00476 00477 CreateFailed: 00478 00479 if (pDeviceInfo) { 00480 if (pDeviceInfo->ustrName.Buffer) { 00481 UserFreePool(pDeviceInfo->ustrName.Buffer); 00482 } 00483 UserFreePool(pDeviceInfo); 00484 } 00485 00486 ENDATOMICCHECK(); 00487 return NULL; 00488 }

HPALETTE CreateDIBPalette LPBITMAPINFOHEADER  pbmih,
UINT  colors
 

Definition at line 2041 of file ntuser/kernel/clipbrd.c.

References BOOL, BYTE, HDCBITS, and NULL.

Referenced by xxxGetDummyPalette().

02044 { 02045 HPALETTE hpal; 02046 02047 if (colors != 0) { 02048 02049 int i; 02050 BOOL fOldDIB = (pbmih->biSize == sizeof(BITMAPCOREHEADER)); 02051 RGBTRIPLE *pColorTable; 02052 PLOGPALETTE plp; 02053 02054 /* 02055 * Allocate memory for palette creation. 02056 */ 02057 plp = (PLOGPALETTE)UserAllocPoolWithQuota(sizeof(LOGPALETTE) + 02058 (sizeof(PALETTEENTRY) * 256), 02059 TAG_CLIPBOARDPALETTE); 02060 02061 if (plp == NULL) { 02062 return NULL; 02063 } 02064 02065 pColorTable = (RGBTRIPLE *)((LPSTR)pbmih + (WORD)pbmih->biSize); 02066 plp->palVersion = 0x300; 02067 02068 if (fOldDIB || (pbmih->biClrUsed == 0)) { 02069 UserAssert(colors <= 0xFFFF); 02070 plp->palNumEntries = (WORD)colors; 02071 } else { 02072 UserAssert(pbmih->biClrUsed <= 0xFFFF); 02073 plp->palNumEntries = (WORD)pbmih->biClrUsed; 02074 } 02075 02076 for (i = 0; i < (int)(plp->palNumEntries); i++) { 02077 02078 plp->palPalEntry[i].peRed = pColorTable->rgbtRed; 02079 plp->palPalEntry[i].peGreen = pColorTable->rgbtGreen; 02080 plp->palPalEntry[i].peBlue = pColorTable->rgbtBlue; 02081 plp->palPalEntry[i].peFlags = (BYTE)PC_NOCOLLAPSE; 02082 02083 if (fOldDIB) { 02084 pColorTable++; 02085 } else { 02086 pColorTable = (RGBTRIPLE *)((LPSTR)pColorTable+sizeof(RGBQUAD)); 02087 } 02088 } 02089 02090 hpal = GreCreatePalette((LPLOGPALETTE)plp); 02091 UserFreePool(plp); 02092 02093 } else { 02094 hpal = GreCreateHalftonePalette(HDCBITS()); 02095 } 02096 02097 GreSetPaletteOwner(hpal, OBJECT_OWNER_PUBLIC); 02098 02099 return hpal; 02100 }

HRGN CreateEmptyRgn void   ) 
 

Definition at line 57 of file visrgn.c.

References PZERO.

Referenced by _GetDCEx(), BltValidInit(), CalcWindowVisRgn(), CenterWallpaper(), CreateEmptyRgnPublic(), GetMonitorDC(), InternalScrollDC(), NtUserGetDC(), PreventInterMonitorBlts(), ResetSharedDesktops(), UserValidateCopyRgn(), xxxBeginPaint(), xxxCreateDisconnectDesktop(), xxxMenuBarDraw(), xxxMNInvertItem(), and xxxRedrawHungWindow().

00058 { 00059 return GreCreateRectRgnIndirect(PZERO(RECT)); 00060 }

HRGN CreateEmptyRgnPublic void   ) 
 

Definition at line 74 of file visrgn.c.

References CreateEmptyRgn().

Referenced by _GetDCEx(), GetNCUpdateRgn(), InitUserScreen(), and InternalInvalidate3().

00075 { 00076 HRGN hrgn; 00077 00078 if (hrgn = CreateEmptyRgn()) { 00079 UserVerify(GreSetRegionOwner(hrgn, OBJECT_OWNER_PUBLIC)); 00080 } 00081 00082 return hrgn; 00083 }

HDC CreateFade PWND  pwnd,
RECT *  prc,
DWORD  dwTime,
DWORD  dwFlags
 

Definition at line 761 of file sprite.c.

References BEGINATOMICCHECK, DeleteFadeSprite(), dwFlags, tagFADE::dwFlags, tagFADE::dwTime, ENDATOMICCHECK, FADE_WINDOW, FALSE, gfade, gpDispInfo, tagFADE::hbm, tagFADE::hdc, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, tagFADE::hsprite, HWq, NULL, tagFADE::ptDst, tagWND::rcWindow, tagFADE::size, and xxxSetLayeredWindow().

Referenced by MNFadeSelection(), xxxMenuWindowProc(), and xxxTooltipWndProc().

00762 { 00763 SIZE size; 00764 00765 /* 00766 * Bail if there is a fade animation going on already. 00767 */ 00768 if (gfade.hbm != NULL) { 00769 RIPMSG0(RIP_WARNING, "CreateFade: failed, fade not available"); 00770 return NULL; 00771 } 00772 00773 /* 00774 * Create a cached compatible DC. 00775 */ 00776 if (gfade.hdc == NULL) { 00777 gfade.hdc = GreCreateCompatibleDC(gpDispInfo->hdcScreen); 00778 if (gfade.hdc == NULL) { 00779 return NULL; 00780 } 00781 } 00782 00783 /* 00784 * A windowed fade must have window position and size, so 00785 * prc passed in is disregarded. 00786 */ 00787 UserAssert((pwnd == NULL) || (prc == NULL)); 00788 00789 if (pwnd != NULL) { 00790 prc = &pwnd->rcWindow; 00791 } 00792 00793 size.cx = prc->right - prc->left; 00794 size.cy = prc->bottom - prc->top; 00795 00796 if (pwnd == NULL) { 00797 gfade.hsprite = GreCreateSprite(gpDispInfo->hDev, NULL, prc); 00798 } else { 00799 gfade.dwFlags |= FADE_WINDOW; 00800 gfade.hsprite = HWq(pwnd); 00801 00802 BEGINATOMICCHECK(); 00803 xxxSetLayeredWindow(pwnd, FALSE); 00804 ENDATOMICCHECK(); 00805 } 00806 00807 if (gfade.hsprite == NULL) 00808 return FALSE; 00809 00810 /* 00811 * Create a compatible bitmap for this size animation. 00812 */ 00813 gfade.hbm = GreCreateCompatibleBitmap(gpDispInfo->hdcScreen, size.cx, size.cy); 00814 if (gfade.hbm == NULL) { 00815 DeleteFadeSprite(); 00816 return NULL; 00817 } 00818 00819 GreSelectBitmap(gfade.hdc, gfade.hbm); 00820 00821 /* 00822 * Since this isn't necessarily the first animation and the hdc could 00823 * be set to public, make sure the owner is the current process. This 00824 * way this process will be able to draw into it. 00825 */ 00826 GreSetDCOwner(gfade.hdc, OBJECT_OWNER_CURRENT); 00827 00828 /* 00829 * Initialize all other fade animation data. 00830 */ 00831 gfade.ptDst.x = prc->left; 00832 gfade.ptDst.y = prc->top; 00833 gfade.size.cx = size.cx; 00834 gfade.size.cy = size.cy; 00835 gfade.dwTime = dwTime; 00836 gfade.dwFlags |= dwFlags; 00837 00838 return gfade.hdc; 00839 }

HFONT FAR PASCAL CreateFontFromWinIni PUNICODE_STRING  pProfileUserName,
LPLOGFONT  lplf,
UINT  idFont
 

Referenced by SPISetIconTitleFont(), and UserSetFont().

NTSTATUS CreateGlobalAtomTable PVOID *  ppAtomTable  ) 
 

Definition at line 212 of file winsta.c.

References ARRAY_SIZE, lpszStdFormats, NT_SUCCESS, NTSTATUS(), RtlAddAtomToAtomTable(), RtlCreateAtomTable(), RtlDestroyAtomTable(), RtlPinAtomInAtomTable(), and Status.

Referenced by CreateW32Job(), and xxxCreateWindowStation().

00214 { 00215 NTSTATUS Status; 00216 RTL_ATOM Atom; 00217 ULONG i; 00218 00219 Status = RtlCreateAtomTable(0, ppAtomTable); 00220 00221 if (!NT_SUCCESS(Status)) { 00222 RIPMSG0(RIP_WARNING, "Global atom table not created"); 00223 return Status; 00224 } 00225 00226 for (i = 0; i < ARRAY_SIZE(lpszStdFormats); i++) { 00227 Status = RtlAddAtomToAtomTable(*ppAtomTable, 00228 (PWSTR)lpszStdFormats[i], 00229 &Atom); 00230 if (!NT_SUCCESS(Status)) { 00231 RIPMSG1(RIP_WARNING, "RtlAddAtomToAtomTable failed to add atom %ws", 00232 lpszStdFormats[i]); 00233 00234 RtlDestroyAtomTable(*ppAtomTable); 00235 return Status; 00236 } 00237 00238 RtlPinAtomInAtomTable(*ppAtomTable, Atom); 00239 } 00240 return Status; 00241 }

PIMC CreateInputContext IN ULONG_PTR  dwClientImcData  ) 
 

Referenced by InternalImmLockIMC(), NtUserCreateInputContext(), xxxCreateDefaultImeWindow(), and xxxCreateThreadInfo().

PKEVENT CreateKernelEvent IN EVENT_TYPE  Type,
IN BOOLEAN  State
 

Definition at line 346 of file ex.c.

References KeInitializeEvent, and NULL.

Referenced by CreateDeviceInfo(), RawInputThread(), RemoteConnect(), UserInitialize(), xxxDesktopThread(), and xxxInitInput().

00349 { 00350 PKEVENT pEvent; 00351 00352 pEvent = UserAllocPoolNonPaged(sizeof(KEVENT), TAG_SYSTEM); 00353 if (pEvent != NULL) { 00354 KeInitializeEvent(pEvent, Type, State); 00355 } 00356 return pEvent; 00357 }

PUNICODE_STRING CreateProfileUserName TL ptl  ) 
 

Definition at line 151 of file w32/ntuser/kernel/profile.c.

References tagPROFILEUSERNAME::awcName, CheckCritIn, InitPreviousUserString(), tagPROFILEUSERNAME::NameString, NULL, PPROFILEUSERNAME, PreviousUserString, PtiCurrent, RtlCopyUnicodeString(), and ThreadLockPool.

Referenced by InitUserScreen(), NtUserSetSysColors(), PrepareForLogoff(), xxxDesktopWndProc(), xxxInitWindowStation(), xxxResetDisplayDevice(), xxxSetIMEShowStatus(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00152 { 00153 PPROFILEUSERNAME pMapName; 00154 00155 CheckCritIn(); 00156 00157 pMapName = UserAllocPoolWithQuota(sizeof (PROFILEUSERNAME), TAG_PROFILEUSERNAME); 00158 if (!pMapName) { 00159 RIPMSG0(RIP_WARNING, "CreateProfileUserName: Allocation failed"); 00160 return NULL; 00161 } 00162 00163 ThreadLockPool(PtiCurrent(), pMapName, ptl); 00164 pMapName->NameString.Length = 0; 00165 pMapName->NameString.MaximumLength = sizeof (pMapName->awcName); 00166 pMapName->NameString.Buffer = pMapName->awcName; 00167 00168 InitPreviousUserString(); 00169 00170 RtlCopyUnicodeString(&pMapName->NameString, &PreviousUserString); 00171 return &(pMapName->NameString); 00172 }

PPROP CreateProp PWND  pwnd  ) 
 

Definition at line 217 of file kernel/winprop.c.

References tagPROPLIST::aprop, tagPROPLIST::cEntries, DesktopAlloc(), DesktopFree, DTAG_PROPLIST, tagWND::head, tagPROPLIST::iFirstFree, NULL, tagWND::ppropList, PROP, and PROPLIST.

Referenced by InternalSetProp().

00219 { 00220 PPROPLIST ppropList; 00221 PPROP pprop; 00222 00223 if (pwnd->ppropList == NULL) { 00224 pwnd->ppropList = (PPROPLIST)DesktopAlloc(pwnd->head.rpdesk, 00225 sizeof(PROPLIST), 00226 DTAG_PROPLIST); 00227 if (pwnd->ppropList == NULL) { 00228 return NULL; 00229 } 00230 pwnd->ppropList->cEntries = 1; 00231 } else if (pwnd->ppropList->iFirstFree == pwnd->ppropList->cEntries) { 00232 ppropList = (PPROPLIST)DesktopAlloc(pwnd->head.rpdesk, 00233 sizeof(PROPLIST) + pwnd->ppropList->cEntries * sizeof(PROP), 00234 DTAG_PROPLIST); 00235 if (ppropList == NULL) { 00236 return NULL; 00237 } 00238 RtlCopyMemory(ppropList, pwnd->ppropList, sizeof(PROPLIST) + (pwnd->ppropList->cEntries - 1) * sizeof(PROP)); 00239 DesktopFree(pwnd->head.rpdesk, pwnd->ppropList); 00240 pwnd->ppropList = ppropList; 00241 pwnd->ppropList->cEntries++; 00242 } 00243 pprop = &pwnd->ppropList->aprop[pwnd->ppropList->iFirstFree]; 00244 pwnd->ppropList->iFirstFree++; 00245 00246 return pprop; 00247 }

PSECURITY_DESCRIPTOR CreateSecurityDescriptor PACCESS_ALLOWED_ACE  paceList,
DWORD  cbAce,
BOOLEAN  fDaclDefaulted
 

Definition at line 91 of file w32/ntuser/kernel/security.c.

References FALSE, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, RtlAddAce(), RtlCreateAcl(), RtlCreateSecurityDescriptor(), RtlSetDaclSecurityDescriptor(), RtlSetGroupSecurityDescriptor(), RtlSetOwnerSecurityDescriptor(), RtlSetSaclSecurityDescriptor(), Status, and TRUE.

Referenced by InitSecurity(), xxxConnectService(), and xxxCreateWindowStation().

00095 { 00096 PSECURITY_DESCRIPTOR psd; 00097 PACL pacl; 00098 NTSTATUS Status; 00099 00100 /* 00101 * Allocate the security descriptor 00102 */ 00103 psd = (PSECURITY_DESCRIPTOR)UserAllocPoolWithQuota( 00104 cbAce + sizeof(ACL) + SECURITY_DESCRIPTOR_MIN_LENGTH, 00105 TAG_SECURITY); 00106 if (psd == NULL) 00107 return NULL; 00108 RtlCreateSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION); 00109 00110 /* 00111 * Initialize the ACL 00112 */ 00113 pacl = (PACL)((PBYTE)psd + SECURITY_DESCRIPTOR_MIN_LENGTH); 00114 Status = RtlCreateAcl(pacl, sizeof(ACL) + cbAce, ACL_REVISION); 00115 if (NT_SUCCESS(Status)) { 00116 00117 /* 00118 * Add the ACEs to the ACL. 00119 */ 00120 Status = RtlAddAce(pacl, ACL_REVISION, MAXULONG, paceList, cbAce); 00121 if (NT_SUCCESS(Status)) { 00122 00123 /* 00124 * Initialize the SD 00125 */ 00126 Status = RtlSetDaclSecurityDescriptor(psd, (BOOLEAN)TRUE, 00127 pacl, fDaclDefaulted); 00128 RtlSetSaclSecurityDescriptor(psd, (BOOLEAN)FALSE, NULL, 00129 (BOOLEAN)FALSE); 00130 RtlSetOwnerSecurityDescriptor(psd, NULL, (BOOLEAN)FALSE); 00131 RtlSetGroupSecurityDescriptor(psd, NULL, (BOOLEAN)FALSE); 00132 } 00133 } 00134 00135 if (!NT_SUCCESS(Status)) { 00136 UserFreePool(psd); 00137 return NULL; 00138 } 00139 00140 return psd; 00141 }

VOID CreateSpb PWND  pwnd,
UINT  flags,
HDC  hdcScreen
 

Definition at line 341 of file spb.c.

References _MonitorFromRect(), AnySpbs, BOOL, cy, tagDCE::DCX_flags, FALSE, tagSPB::flags, ghdcMem, ghrgnSPB2, gpDispInfo, tagSPB::hbm, tagDCE::hdc, tagDISPLAYINFO::hDev, tagSPB::hrgn, tagWND::hrgnClip, tagDISPLAYINFO::hrgnScreen, IntersectRect(), IntersectRgn, Lock, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDISPLAYINFO::pMonitorPrimary, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, PWNDDESKTOP, tagSPB::rc, tagMONITOR::rcMonitor, tagDISPLAYINFO::rcScreen, tagWND::rcWindow, SetRectRgnIndirect(), SetWF, SPB, SPB_LOCKUPDATE, SPB_SAVESCREENBITS, SpbCheck(), SpbTransfer(), tagSPB::spwnd, tagWND::spwndNext, tagWND::spwndParent, SubtractRect(), SYSMET, TRUE, tagSPB::ulSaveId, Unlock, VOID(), and WFHASSPB.

Referenced by LockWindowUpdate2(), and zzzChangeStates().

00345 { 00346 PSPB pspb; 00347 int fSpbLockUpdate; 00348 00349 /* 00350 * Non-LOCKWINDOWUPDATE SPBs can only be created for top-level windows. 00351 * 00352 * This is because of the way that the display driver RestoreBits function 00353 * works. It can put bits down in places that aren't even part of the 00354 * window's visrgn, and these bits need to be invalidated. The 00355 * SetWindowPos() code to handle this case only knows how to invalidate 00356 * one of windows (i.e., the window's immediate parent), but all levels 00357 * need to get invalidated. See also the comments in wmswp.c, near the 00358 * call to RestoreSpb(). 00359 * 00360 * For example: the Q&E app brings up a copyright dialog that is a child 00361 * of its main window. While this is up, the user alt-f alt-l to execute 00362 * the file login command, which brings up another dialog that is a child 00363 * of the desktop. When the copyright dialog goes away, the display driver 00364 * restores bits on top of the second dialog. The SWP code knows to 00365 * invalidate the bogus stuff in the main window, but not in the desktop. 00366 * 00367 * LOCKUPDATE SPBs are fine, because they don't call RestoreBits. 00368 */ 00369 fSpbLockUpdate = flags & SPB_LOCKUPDATE; 00370 if ( !fSpbLockUpdate && 00371 pwnd->spwndParent != NULL && 00372 pwnd->spwndParent != PWNDDESKTOP(pwnd)) { 00373 00374 return; 00375 } 00376 00377 /* 00378 * We go and check all the existing DCs at this point, to handle the 00379 * case where we're saving an image of a window that has a "dirty" 00380 * DC, which would eventually invalidate our saved image (but which 00381 * is really okay). 00382 */ 00383 if (AnySpbs()) { 00384 00385 SpbCheck(); 00386 00387 } else { 00388 00389 PDCE pdce; 00390 00391 /* 00392 * Reset the dirty areas of all of the DC's and enable 00393 * bounds accumulation. We're creating a SPB now. This 00394 * is only done if there are no other SPB's in the list. 00395 */ 00396 GreLockDisplay(gpDispInfo->hDev); 00397 00398 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 00399 00400 if (pdce->DCX_flags & DCX_LAYERED) 00401 continue; 00402 00403 GreGetBounds(pdce->hdc, NULL, GGB_ENABLE_WINMGR); 00404 } 00405 00406 GreUnlockDisplay(gpDispInfo->hDev); 00407 } 00408 00409 /* 00410 * Create the save popup bits structure 00411 */ 00412 pspb = (PSPB)UserAllocPoolWithQuota(sizeof(SPB), TAG_SPB); 00413 if (!pspb) 00414 return; 00415 00416 pspb->spwnd = NULL; 00417 pspb->rc = pwnd->rcWindow; 00418 00419 /* 00420 * Clip to the screen 00421 */ 00422 if (!IntersectRect(&pspb->rc, &pspb->rc, &gpDispInfo->rcScreen)) 00423 goto BMError; 00424 00425 pspb->hrgn = NULL; 00426 pspb->hbm = NULL; 00427 pspb->flags = flags; 00428 Lock(&(pspb->spwnd), pwnd); 00429 00430 if (!fSpbLockUpdate) { 00431 00432 RECT rc = pspb->rc; 00433 00434 if (!SYSMET(SAMEDISPLAYFORMAT)) { 00435 PMONITOR pMonitor = _MonitorFromRect(&pspb->rc, MONITOR_DEFAULTTOPRIMARY); 00436 RECT rcT; 00437 00438 /* 00439 * If the intersection with the monitor isn't the entire visible 00440 * window rectangle, then bail! We don't save SPBs for windows 00441 * that span multiple monitors. Since we do a lot of work to 00442 * pin dialogs and menus, there won't be too many of these 00443 * babies. 00444 */ 00445 if (SubtractRect(&rcT, &pspb->rc, &pMonitor->rcMonitor) && 00446 GreRectInRegion(gpDispInfo->hrgnScreen, &rcT)) 00447 goto BMError2; 00448 00449 /* 00450 * Clip to the window's monitor 00451 */ 00452 if (!IntersectRect(&pspb->rc, &pspb->rc, &pMonitor->rcMonitor)) 00453 goto BMError2; 00454 00455 /* 00456 * dont save bits in a mixed bitdepth situtation 00457 * we cant create the exactly correct format bitmap 00458 * in all cases (555/565, and Paletized) so as 00459 * a cop-out dont save bitmaps at all (on secondaries) 00460 * in mixed bit-depth. 00461 * 00462 * the correct fix is to create a compatible 00463 * bitmap for the monitor device and directly 00464 * BitBlt() from/to the device (pMonitor->hdcMonitor) 00465 * but this involves too much code at this time. 00466 */ 00467 if (pMonitor != gpDispInfo->pMonitorPrimary) 00468 goto BMError2; 00469 } 00470 00471 /* 00472 * If this window is a regional window, don't use driver save 00473 * bits. Because it can only restore an entire rectangle, 00474 * invalid region is calculated assuming the old vis rgn was 00475 * rectangular. For regional windows, this would end up always 00476 * invalidating the area of (rcWindow - hrgnWindow) every 00477 * time an spb would be used. On the other hand, the invalid 00478 * area calculated when not using driver save bits is perfect, 00479 * because the restore blt can be correctly clipped to begin with. 00480 */ 00481 if ((pwnd->hrgnClip == NULL) && 00482 (pspb->ulSaveId = GreSaveScreenBits(gpDispInfo->hDev, 00483 SS_SAVE, 00484 0, 00485 (RECTL *)&rc))) { 00486 00487 /* 00488 * Remember that we copied this bitmap into on board memory. 00489 */ 00490 pspb->flags |= SPB_SAVESCREENBITS; 00491 00492 } else { 00493 HBITMAP hbmSave; 00494 BOOL bRet; 00495 00496 /* 00497 * The following delta byte-aligns the screen bitmap 00498 */ 00499 int dx = pspb->rc.left & 0x0007; 00500 int cx = pspb->rc.right - pspb->rc.left; 00501 int cy = pspb->rc.bottom - pspb->rc.top; 00502 00503 /* 00504 * NOTE: we don't care about setting up a visrgn in 00505 * hdcScreen, because BitBlt ignores it on reads. 00506 */ 00507 pspb->hbm = GreCreateCompatibleBitmap(hdcScreen, cx + dx, cy); 00508 if (!pspb->hbm) 00509 goto BMError2; 00510 00511 hbmSave = (HBITMAP)GreSelectBitmap(ghdcMem, pspb->hbm); 00512 if (!hbmSave) 00513 goto BMError2; 00514 00515 /* 00516 * Copy the contents of the screen to the bitmap in the 00517 * save popup bits structure. If we ever find we run 00518 * into problems with the screen access check we can 00519 * do a bLockDisplay, give this process permission, do 00520 * the BitBlt and then take away permission. GDI 00521 * accesses the screen and that bit only under the 00522 * display semaphore so it is safe. Alternatively 00523 * if it is too hard to change this processes permission 00524 * here we could do it in GDI by marking the psoSrc 00525 * readable temporarily while completing the operation 00526 * and then setting it back to unreadable when done. 00527 * Or we could just fail it like the CreateCompatibleDC 00528 * failed and force a redraw. Basically we can't add 00529 * 3K of code in GDI to do a BitBlt that just does 1 00530 * test differently for this 1 place in User. 00531 * 00532 */ 00533 bRet = GreBitBlt(ghdcMem, 00534 dx, 00535 0, 00536 cx, 00537 cy, 00538 hdcScreen, 00539 pspb->rc.left, 00540 pspb->rc.top, 00541 0x00CC0000, 00542 0); 00543 00544 GreSelectBitmap(ghdcMem, hbmSave); 00545 00546 if (!bRet) 00547 goto BMError2; 00548 00549 GreSetBitmapOwner(pspb->hbm, OBJECT_OWNER_PUBLIC); 00550 } 00551 00552 /* 00553 * Mark that the window has an SPB. 00554 */ 00555 SetWF(pwnd, WFHASSPB); 00556 00557 /* 00558 * non-LOCKUPDATE SPBs are not invalidated by 00559 * drawing in pspb->spwnd, so start the SPB validation 00560 * loop below at the sibling immediately below us. 00561 */ 00562 pwnd = pwnd->spwndNext; 00563 } 00564 00565 /* 00566 * Link the new save popup bits structure into the list. 00567 */ 00568 pspb->pspbNext = gpDispInfo->pspbFirst; 00569 gpDispInfo->pspbFirst = pspb; 00570 00571 /* 00572 * Here we deal with any update regions that may be 00573 * pending in windows underneath the SPB. 00574 * 00575 * For all windows that might affect this SPB: 00576 * - Subtract the SPB rect from the update region 00577 * - Subtract the window from the SPB 00578 * 00579 * Note that we use pspb->spwnd here, in case it has 00580 * no siblings. 00581 * 00582 * ghrgnSPB2 is the region that is used inside of SpbTransfer to 00583 * validate window update regions. Intersect with the window clipping 00584 * region, if it exists. Don't want to intersect with the spb rect if 00585 * a clipping region exists because we'll end up validating more than 00586 * we want to validate. 00587 */ 00588 SetRectRgnIndirect(ghrgnSPB2, &pspb->rc); 00589 if (pspb->spwnd->hrgnClip != NULL) { 00590 00591 /* 00592 * If we get an error bail since an error might result in more 00593 * being validated than we want. Since the below code is only an 00594 * optimizer, this is ok: the window will remain invalid and will 00595 * draw, thereby invalidating the SPB like usual. 00596 */ 00597 if (IntersectRgn(ghrgnSPB2, 00598 ghrgnSPB2, 00599 pspb->spwnd->hrgnClip) == ERROR) { 00600 return; 00601 } 00602 } 00603 00604 if (pspb->spwnd->spwndParent == NULL || 00605 SpbTransfer(pspb, pspb->spwnd->spwndParent, FALSE)) { 00606 00607 /* 00608 * Do the same for the siblings underneath us... 00609 */ 00610 for ( ; pwnd != NULL; pwnd = pwnd->spwndNext) { 00611 if (!SpbTransfer(pspb, pwnd, TRUE)) 00612 break; 00613 } 00614 } 00615 00616 return; 00617 00618 BMError2: 00619 /* 00620 * Error creating the bitmap: clean up and return. 00621 */ 00622 if (pspb->hbm) 00623 GreDeleteObject(pspb->hbm); 00624 00625 Unlock(&pspb->spwnd); 00626 // fall-through 00627 00628 BMError: 00629 UserFreePool(pspb); 00630 }

NTSTATUS CreateSystemThread PKSTART_ROUTINE  lpThreadAddress,
PVOID  pvContext,
PHANDLE  phThread
 

Definition at line 131 of file ex.c.

References CheckCritOut, gpepCSRSS, KernelMode, NT_SUCCESS, NTSTATUS(), NULL, ObOpenObjectByPointer(), PsCreateSystemThread(), and Status.

Referenced by VideoPortCallout(), xxxInitInput(), and xxxInitTerminal().

00135 { 00136 NTSTATUS Status; 00137 OBJECT_ATTRIBUTES Obja; 00138 HANDLE hProcess; 00139 00140 CheckCritOut(); 00141 00142 InitializeObjectAttributes(&Obja, 00143 NULL, 00144 0, 00145 NULL, 00146 NULL); 00147 00148 /* 00149 * On WinFrame WIN32K.SYS is in WINSTATION SPACE. We can not 00150 * allow any system threads to access WIN32K.SYS since 00151 * this space is not mapped into the system process. 00152 * 00153 * We need to access the CSRSS 00154 * process regardless of who our caller is. IE: We could be called from 00155 * a CSRSS client who does not have a handle to the CSRSS process in 00156 * its handle table. 00157 */ 00158 UserAssert(gpepCSRSS != NULL); 00159 00160 Status = ObOpenObjectByPointer( 00161 gpepCSRSS, 00162 0, 00163 NULL, 00164 PROCESS_CREATE_THREAD, 00165 NULL, 00166 KernelMode, 00167 &hProcess); 00168 00169 if (!NT_SUCCESS(Status)) { 00170 return Status; 00171 } 00172 00173 UserAssert(hProcess != NULL); 00174 00175 Status = PsCreateSystemThread( 00176 phThread, 00177 THREAD_ALL_ACCESS, 00178 &Obja, 00179 hProcess, 00180 NULL, 00181 lpThreadAddress, 00182 pvContext); 00183 00184 ZwClose(hProcess); 00185 00186 return Status; 00187 }

BOOL CreateTerminalInput PTERMINAL   ) 
 

Definition at line 1376 of file w32/ntuser/kernel/init.c.

References BOOL, ClientFontSweep(), FALSE, NULL, TRUE, xxxInitInput(), and xxxLW_LoadFonts().

Referenced by xxxInitTerminal().

01378 { 01379 UserAssert(pTerm != NULL); 01380 01381 /* 01382 * call to the client side to clean up the [Fonts] section 01383 * of the registry. This will only take significant chunk of time 01384 * if the [Fonts] key changed during since the last boot and if 01385 * there are lots of fonts loaded 01386 */ 01387 ClientFontSweep(); 01388 01389 /* 01390 * Load the standard fonts before we create any DCs. 01391 * At this time we can only add the fonts that do not 01392 * reside on the net. They may be needed by winlogon. 01393 * Our winlogon needs only ms sans serif, but private 01394 * winlogon's may need some other fonts as well. 01395 * The fonts on the net will be added later, right 01396 * after all the net connections have been restored. 01397 */ 01398 /* 01399 * This call should be made in UserInitialize. 01400 */ 01401 xxxLW_LoadFonts(FALSE); 01402 01403 /* 01404 * Initialize the input system. 01405 */ 01406 if (!xxxInitInput(pTerm)) 01407 return FALSE; 01408 01409 return TRUE; 01410 }

NTSTATUS CtxDisplayIOCtl ULONG  DisplayIOCtlFlags,
PUCHAR  pDisplayIOCtlData,
ULONG  cbDisplayIOCtlData
 

Definition at line 814 of file w32/ntuser/kernel/misc.c.

References BOOL, gpDispInfo, tagDISPLAYINFO::hDev, RemoteRedrawRectangle(), and TRACE_HYDAPI.

Referenced by NtUserCtxDisplayIOCtl().

00818 { 00819 BOOL fResult; 00820 00821 TRACE_HYDAPI(("CtxDisplayIOCtl\n")); 00822 00823 fResult = bDrvDisplayIOCtl(gpDispInfo->hDev, pDisplayIOCtlData, cbDisplayIOCtlData); 00824 00825 if (!fResult) { 00826 return STATUS_CTX_BAD_VIDEO_MODE; 00827 } 00828 00829 if ((DisplayIOCtlFlags & DISPLAY_IOCTL_FLAG_REDRAW)) { 00830 RemoteRedrawRectangle(0,0,0xffff,0xffff); 00831 } 00832 00833 return STATUS_SUCCESS; 00834 }

void DBGValidateQueueStates PDESKTOP  pdesk  ) 
 

Referenced by zzzReattachThreads().

VOID DecPaintCount PWND  pwnd  ) 
 

Definition at line 1272 of file paint.c.

References tagTHREADINFO::cPaintsReady, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeBits, GETPTI, tagTHREADINFO::pcti, and VOID().

Referenced by ClrFTrueVis(), DoPaint(), GetNCUpdateRgn(), InternalInvalidate3(), xxxBeginPaint(), xxxFreeWindow(), and xxxUpdateWindow2().

01274 { 01275 PTHREADINFO pti = GETPTI(pwnd); 01276 01277 if (--pti->cPaintsReady == 0) { 01278 pti->pcti->fsWakeBits &= ~QS_PAINT; 01279 pti->pcti->fsChangeBits &= ~QS_PAINT; 01280 } 01281 }

void DecrMBox void   ) 
 

__inline void DecSFWLockCount  ) 
 

Definition at line 7053 of file userk.h.

Referenced by CleanupDecSFWLockCount(), xxxMNEndMenuState(), and xxxMNLoop().

07059 {

VOID DecTimerCount PTHREADINFO  pti  ) 
 

Definition at line 644 of file timers.c.

References CheckCritIn, tagTHREADINFO::cTimersReady, tagCLIENTTHREADINFO::fsWakeBits, tagTHREADINFO::pcti, and VOID().

Referenced by DoTimer(), FreeTimer(), and InternalSetTimer().

00646 { 00647 CheckCritIn(); 00648 00649 if (--pti->cTimersReady == 0) 00650 pti->pcti->fsWakeBits &= ~QS_TIMER; 00651 }

VOID DecVisWindows PWND  pwnd  ) 
 

Definition at line 5156 of file swp.c.

References cDecVis(), ISTS, and VOID().

Referenced by SetMinimize(), SetVisible(), and xxxSetWindowStyle().

05158 { 05159 cDecVis(pwnd); 05160 05161 #if DBG 05162 if (!ISTS()) 05163 VerifycVisWindows(pwnd); 05164 #endif 05165 }

BOOL DefSetText PWND  pwnd,
PLARGE_STRING  pstrText
 

Definition at line 28 of file ntuser/kernel/getset.c.

References _LARGE_STRING::bAnsi, BOOL, _LARGE_UNICODE_STRING::Buffer, _LARGE_STRING::Buffer, DesktopAlloc(), DesktopFree, DTAG_TEXT, DWORD, FALSE, tagWND::head, _LARGE_STRING::Length, _LARGE_UNICODE_STRING::Length, _LARGE_UNICODE_STRING::MaximumLength, NT_SUCCESS, NULL, RtlMultiByteToUnicodeN(), tagWND::strName, and TRUE.

Referenced by NtUserDefSetText(), and xxxDefWindowProc().

00031 { 00032 /* 00033 * Note -- string buffer may be on client side. 00034 */ 00035 PDESKTOP pdesk; 00036 DWORD cbString; 00037 BOOL fTranslateOk; 00038 00039 if (pwnd->head.rpdesk == NULL || cczpstr == NULL || cczpstr->Buffer == NULL) { 00040 pwnd->strName.Length = 0; 00041 return TRUE; 00042 } 00043 00044 /* 00045 * Capture the new window name 00046 */ 00047 if (cczpstr->bAnsi) 00048 cbString = (cczpstr->Length + 1) * sizeof(WCHAR); 00049 else 00050 cbString = cczpstr->Length + sizeof(WCHAR); 00051 00052 /* 00053 * If the current buffer is not large enough, 00054 * reallocate it. 00055 */ 00056 pdesk = pwnd->head.rpdesk; 00057 if (pwnd->strName.MaximumLength < cbString) { 00058 if (pwnd->strName.Buffer != NULL) 00059 DesktopFree(pdesk, pwnd->strName.Buffer); 00060 pwnd->strName.Buffer = (LPWSTR)DesktopAlloc(pdesk, cbString, DTAG_TEXT); 00061 pwnd->strName.Length = 0; 00062 if (pwnd->strName.Buffer == NULL) { 00063 pwnd->strName.MaximumLength = 0; 00064 return FALSE; 00065 } 00066 pwnd->strName.MaximumLength = cbString; 00067 } 00068 00069 fTranslateOk = TRUE; 00070 if (cczpstr->Length != 0) { 00071 try { 00072 if (!cczpstr->bAnsi) { 00073 RtlCopyMemory(pwnd->strName.Buffer, cczpstr->Buffer, cbString); 00074 } else { 00075 LPCSTR ccxpszAnsi = (LPCSTR)cczpstr->Buffer; 00076 00077 fTranslateOk = NT_SUCCESS(RtlMultiByteToUnicodeN(pwnd->strName.Buffer, 00078 cbString, &cbString, 00079 (LPSTR)ccxpszAnsi, cbString / sizeof(WCHAR))); 00080 } 00081 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00082 pwnd->strName.Length = 0; 00083 return FALSE; 00084 } 00085 } 00086 00087 if (fTranslateOk) { 00088 pwnd->strName.Length = cbString - sizeof(WCHAR); 00089 return TRUE; 00090 } else { 00091 pwnd->strName.Length = 0; 00092 return FALSE; 00093 } 00094 }

VOID DelayedDestroyCacheDC VOID   ) 
 

Definition at line 1596 of file dc.c.

References tagDCE::DCX_flags, DestroyCacheDC(), gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PpiCurrent, and VOID().

Referenced by _GetDCEx(), CleanupGDI(), and DestroyProcessInfo().

01597 { 01598 PDCE *ppdce; 01599 PDCE pdce; 01600 01601 01602 /* 01603 * Zip through the cache looking for a DCX_DESTROYTHIS hdc. 01604 */ 01605 for (ppdce = &gpDispInfo->pdceFirst; *ppdce != NULL; ) { 01606 01607 /* 01608 * If we found a DCE on this thread that we tried to destroy 01609 * earlier, try and destroy it again. 01610 */ 01611 pdce = *ppdce; 01612 01613 if (pdce->DCX_flags & DCX_DESTROYTHIS) 01614 DestroyCacheDC(ppdce, pdce->hdc); 01615 01616 /* 01617 * Step to the next DC. If the DC was deleted, there 01618 * is no need to calculate address of the next entry. 01619 */ 01620 if (pdce == *ppdce) 01621 ppdce = &pdce->pdceNext; 01622 } 01623 01624 PpiCurrent()->W32PF_Flags &= ~W32PF_OWNDCCLEANUP; 01625 }

void DeleteHrgnClip PDCE  pdce  ) 
 

Definition at line 549 of file dc.c.

References tagDCE::DCX_flags, DeleteMaybeSpecialRgn(), tagDCE::hdc, tagDCE::hrgnClip, tagDCE::hrgnClipPublic, tagDCE::hrgnSavedVis, InvalidateDce(), NULL, and VOID().

Referenced by _GetDCEx(), ReleaseCacheDC(), and xxxFreeWindow().

00551 { 00552 /* 00553 * Clear these flags first in case we get a DCHook() callback... 00554 */ 00555 pdce->DCX_flags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN); 00556 00557 /* 00558 * Blow away pdce->hrgnClip and clear the associated flags. 00559 * Do not delete hrgnClip if DCX_NODELETERGN is set! 00560 */ 00561 if (!(pdce->DCX_flags & DCX_NODELETERGN)) { 00562 DeleteMaybeSpecialRgn(pdce->hrgnClip); 00563 } else { 00564 pdce->DCX_flags &= ~DCX_NODELETERGN; 00565 } 00566 00567 DeleteMaybeSpecialRgn(pdce->hrgnClipPublic); 00568 00569 pdce->hrgnClip = NULL; 00570 pdce->hrgnClipPublic = NULL; 00571 00572 /* 00573 * If the saved visrgn was invalidated by an InvalidateDce() 00574 * while we had it checked out, then invalidate the entry now. 00575 */ 00576 if (pdce->DCX_flags & DCX_SAVEDRGNINVALID) { 00577 InvalidateDce(pdce); 00578 00579 /* 00580 * We've just gone through InvalidateDce, so the visrgn in the 00581 * DC has been properly reset. Simply nuke the old saved visrgn. 00582 */ 00583 if (pdce->hrgnSavedVis != NULL) { 00584 GreDeleteObject(pdce->hrgnSavedVis); 00585 pdce->hrgnSavedVis = NULL; 00586 } 00587 } else { 00588 /* 00589 * The saved visrgn is still valid, select it back into the 00590 * DC so the entry may be re-used without recomputing. 00591 */ 00592 if (pdce->hrgnSavedVis != NULL) { 00593 GreSelectVisRgn(pdce->hdc, pdce->hrgnSavedVis, SVR_DELETEOLD); 00594 pdce->hrgnSavedVis = NULL; 00595 } 00596 } 00597 }

void DeleteMaybeSpecialRgn HRGN  hrgn  ) 
 

Definition at line 132 of file paint.c.

References HRGN_SPECIAL_LAST, and VOID().

Referenced by ClrFTrueVis(), DeleteHrgnClip(), DestroyCacheDC(), InternalInvalidate3(), xxxBeginPaint(), xxxFreeWindow(), and xxxSimpleDoSyncPaint().

00134 { 00135 if (hrgn > HRGN_SPECIAL_LAST) { 00136 GreDeleteObject(hrgn); 00137 } 00138 }

VOID DeletePowerRequestList VOID   ) 
 

Definition at line 250 of file power.c.

References gPowerRequestList, gpPowerRequestMutex, and NULL.

Referenced by Win32kNtUserCleanup().

00251 { 00252 if (gpPowerRequestMutex) { 00253 00254 /* 00255 * Make sure there are no pending power requests. 00256 */ 00257 UserAssert(IsListEmpty(&gPowerRequestList)); 00258 00259 /* 00260 * Free the power request structures. 00261 */ 00262 UserFreePool(gpPowerRequestMutex); 00263 gpPowerRequestMutex = NULL; 00264 } 00265 }

VOID DeleteProperties PWND  pwnd  ) 
 

Definition at line 265 of file kernel/winprop.c.

References tagPROPLIST::aprop, DesktopFree, tagPROP::fs, tagPROP::hData, tagWND::head, tagPROPLIST::iFirstFree, NULL, tagWND::ppropList, PROPF_INTERNAL, PROPF_NOPOOL, and UINT.

Referenced by xxxFreeWindow().

00267 { 00268 PPROP pprop; 00269 UINT i; 00270 00271 UserAssert(pwnd->ppropList); 00272 00273 /* 00274 * Loop through the whole list of properties on this window. 00275 */ 00276 pprop = pwnd->ppropList->aprop; 00277 for (i = pwnd->ppropList->iFirstFree; i > 0; i--) { 00278 00279 /* 00280 * Is this an internal property? If so, free any data we allocated 00281 * for it. 00282 */ 00283 if ((pprop->fs & PROPF_INTERNAL) && !(pprop->fs & PROPF_NOPOOL)) { 00284 UserFreePool(pprop->hData); 00285 } 00286 00287 /* 00288 * Advance to the next property in the list. 00289 */ 00290 pprop++; 00291 } 00292 00293 /* 00294 * All properties gone, free the property list and clear out the 00295 * window's property list pointer. 00296 */ 00297 DesktopFree(pwnd->head.rpdesk, pwnd->ppropList); 00298 pwnd->ppropList = NULL; 00299 }

VOID DeleteUpdateRgn PWND  pwnd  ) 
 

void DelQEntry PMLIST  pml,
PQMSG  pqmsg
 

Definition at line 3253 of file queue.c.

References tagMLIST::cMsgs, DebugValidateMLIST, DebugValidateMLISTandQMSG, ExFreeToPagedLookasideList(), NULL, tagQMSG::pqmsgNext, tagQMSG::pqmsgPrev, tagMLIST::pqmsgRead, tagMLIST::pqmsgWriteLast, and QEntryLookaside.

Referenced by AdjustForCoalescing(), DestroyThreadsMessages(), FindQMsg(), FreeMessageList(), PostInputMessage(), RemoveEventMessage(), xxxReadPostMessage(), xxxScanSysQueue(), and xxxSkipSysMsg().

03256 { 03257 DebugValidateMLISTandQMSG(pml, pqmsg); 03258 UserAssert((int)pml->cMsgs > 0); 03259 UserAssert(pml->pqmsgRead); 03260 UserAssert(pml->pqmsgWriteLast); 03261 03262 /* 03263 * Unlink this pqmsg from the message list. 03264 */ 03265 if (pqmsg->pqmsgPrev != NULL) 03266 pqmsg->pqmsgPrev->pqmsgNext = pqmsg->pqmsgNext; 03267 03268 if (pqmsg->pqmsgNext != NULL) 03269 pqmsg->pqmsgNext->pqmsgPrev = pqmsg->pqmsgPrev; 03270 03271 /* 03272 * Update the read/write pointers if necessary. 03273 */ 03274 if (pml->pqmsgRead == pqmsg) 03275 pml->pqmsgRead = pqmsg->pqmsgNext; 03276 03277 if (pml->pqmsgWriteLast == pqmsg) 03278 pml->pqmsgWriteLast = pqmsg->pqmsgPrev; 03279 03280 /* 03281 * Adjust the message count and free the message structure. 03282 */ 03283 pml->cMsgs--; 03284 03285 ExFreeToPagedLookasideList(QEntryLookaside, pqmsg); 03286 03287 DebugValidateMLIST(pml); 03288 }

VOID DereferenceClass PWND  pwnd  ) 
 

Definition at line 1735 of file class.c.

References tagCLS::cWndReferenceCount, DestroyClass(), tagWND::pcls, tagCLS::pclsBase, tagCLS::pclsClone, tagCLS::pclsNext, and VOID().

Referenced by HMChangeOwnerThread(), and xxxFreeWindow().

01737 { 01738 PCLS pcls = pwnd->pcls; 01739 PPCLS ppcls; 01740 01741 UserAssert(pcls->cWndReferenceCount >= 1); 01742 01743 pcls->cWndReferenceCount--; 01744 if (pcls != pcls->pclsBase) { 01745 01746 UserAssert(pcls->pclsBase->cWndReferenceCount >= 1); 01747 01748 pcls->pclsBase->cWndReferenceCount--; 01749 01750 if (pcls->cWndReferenceCount == 0) { 01751 ppcls = &pcls->pclsBase->pclsClone; 01752 while ((*ppcls) != pcls) 01753 ppcls = &(*ppcls)->pclsNext; 01754 UserAssert(ppcls); 01755 DestroyClass(ppcls); 01756 } 01757 } 01758 }

PVOID DesktopAlloc PDESKTOP  pdesk,
UINT  uSize,
DWORD  tag
 

Definition at line 47 of file desktop.c.

References DF_DESTROYED, tagDESKTOP::dwDTFlags, NULL, and tagDESKTOP::pheapDesktop.

Referenced by _InitPwSB(), CreateProp(), DefSetText(), HMAllocObject(), xxxCreateDefaultImeWindow(), xxxCreateDesktop2(), xxxInsertMenuItem(), xxxRemoveDeleteMenuHelper(), and xxxSetLPITEMInfo().

00051 { 00052 if (pdesk->dwDTFlags & DF_DESTROYED) { 00053 RIPMSG2(RIP_ERROR, 00054 "DesktopAlloc: tag %d pdesk %#p is destroyed", 00055 tag, 00056 pdesk); 00057 return NULL; 00058 } 00059 00060 return Win32HeapAlloc(pdesk->pheapDesktop, uSize, tag, 0); 00061 }

__inline PVOID DesktopRebaseToClient PTHREADINFO  pti,
PVOID  p
 

Definition at line 6718 of file userk.h.

06729 {

BOOL DestroyCacheDC PDCE ,
HDC 
 

Definition at line 1638 of file dc.c.

References BOOL, tagDCE::DCX_flags, DecrementFreeDCECount(), DeleteMaybeSpecialRgn(), FALSE, gpDispInfo, tagDCE::hdc, tagDCE::hrgnClip, tagDCE::hrgnClipPublic, tagDCE::hrgnSavedVis, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PpiCurrent, tagDCE::pwndClip, tagDCE::pwndOrg, and TRUE.

Referenced by DelayedDestroyCacheDC(), DestroyCacheDCEntries(), DestroyClass(), DestroyMonitorDCs(), ReleaseCacheDC(), xxxFreeWindow(), and xxxUserProcessCallout().

01641 { 01642 PDCE pdce; 01643 01644 /* 01645 * Zip through the cache looking for hdc. 01646 */ 01647 if (ppdce == NULL) { 01648 for (ppdce = &gpDispInfo->pdceFirst; (pdce = *ppdce); ppdce = &pdce->pdceNext) { 01649 if (pdce->hdc == hdc) 01650 break; 01651 } 01652 } 01653 01654 if (ppdce == NULL) 01655 return FALSE; 01656 01657 /* 01658 * Set this here so we know this DCE is supposed to be deleted. 01659 */ 01660 pdce = *ppdce; 01661 pdce->DCX_flags |= DCX_DESTROYTHIS; 01662 01663 /* 01664 * Free up the dce object and contents. 01665 */ 01666 01667 if (!(pdce->DCX_flags & DCX_NODELETERGN)) { 01668 DeleteMaybeSpecialRgn(pdce->hrgnClip); 01669 pdce->hrgnClip = NULL; 01670 } 01671 01672 if (pdce->hrgnClipPublic != NULL) { 01673 GreDeleteObject(pdce->hrgnClipPublic); 01674 pdce->hrgnClipPublic = NULL; 01675 } 01676 01677 if (pdce->hrgnSavedVis != NULL) { 01678 GreDeleteObject(pdce->hrgnSavedVis); 01679 pdce->hrgnSavedVis = NULL; 01680 } 01681 01682 /* 01683 * If GreSetDCOwner() or GreDeleteDC() fail, the 01684 * DC is in-use by another thread. Set 01685 * W32PF_OWNDCCLEANUP so we know to scan for and 01686 * delete this DCE later. 01687 */ 01688 if (!GreSetDCOwner(hdc, OBJECT_OWNER_PUBLIC)) { 01689 PpiCurrent()->W32PF_Flags |= W32PF_OWNDCCLEANUP; 01690 return FALSE; 01691 } 01692 01693 /* 01694 * Set the don't rip flag so our routine RipIfCacheDC() doesn't 01695 * rip (called back from gdi). 01696 */ 01697 #if DBG 01698 pdce->DCX_flags |= DCX_DONTRIPONDESTROY; 01699 GreMarkDeletableDC(hdc); // So GRE doesn't RIP. 01700 #endif 01701 01702 if (!GreDeleteDC(hdc)) { 01703 01704 #if DBG 01705 GreMarkUndeletableDC(hdc); 01706 pdce->DCX_flags &= ~DCX_DONTRIPONDESTROY; 01707 #endif 01708 PpiCurrent()->W32PF_Flags |= W32PF_OWNDCCLEANUP; 01709 return FALSE; 01710 } 01711 01712 /* 01713 * Decrement this dc-entry from the free-list count. 01714 */ 01715 if (pdce->DCX_flags & DCX_CACHE) { 01716 01717 if (!(pdce->DCX_flags & DCX_INUSE)) { 01718 DecrementFreeDCECount(); 01719 } 01720 } 01721 01722 #if DBG 01723 pdce->pwndOrg = NULL; 01724 pdce->pwndClip = NULL; 01725 #endif 01726 01727 /* 01728 * Unlink the DCE from the list. 01729 */ 01730 *ppdce = pdce->pdceNext; 01731 01732 UserFreePool(pdce); 01733 01734 return TRUE; 01735 }

VOID DestroyCacheDCEntries PTHREADINFO   ) 
 

Definition at line 2923 of file createw.c.

References tagDCE::DCX_flags, DestroyCacheDC(), gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDCE::ptiOwner, and VOID().

Referenced by CleanupGDI(), and DestroyThreadsObjects().

02925 { 02926 PDCE *ppdce; 02927 PDCE pdce; 02928 /* 02929 * Before any window destruction occurs, we need to destroy any dcs 02930 * in use in the dc cache. When a dc is checked out, it is marked owned, 02931 * which makes gdi's process cleanup code delete it when a process 02932 * goes away. We need to similarly destroy the cache entry of any dcs 02933 * in use by the exiting process. 02934 */ 02935 for (ppdce = &gpDispInfo->pdceFirst; *ppdce != NULL; ) { 02936 02937 /* 02938 * If the dc owned by this thread, remove it from the cache. Because 02939 * DestroyCacheEntry destroys gdi objects, it is important that 02940 * USER be called first in process destruction ordering. 02941 * 02942 * Only destroy this dc if it is a cache dc, because if it is either 02943 * an owndc or a classdc, it will be destroyed for us when we destroy 02944 * the window (for owndcs) or destroy the class (for classdcs). 02945 */ 02946 pdce = *ppdce; 02947 if (pti == pdce->ptiOwner) { 02948 02949 if (pdce->DCX_flags & DCX_CACHE) 02950 DestroyCacheDC(ppdce, pdce->hdc); 02951 } 02952 02953 /* 02954 * Step to the next DC. If the DC was deleted, there 02955 * is no need to calculate address of the next entry. 02956 */ 02957 if (pdce == *ppdce) 02958 ppdce = &pdce->pdceNext; 02959 } 02960 }

VOID DestroyClass PPCLS  ppcls  ) 
 

Definition at line 1207 of file class.c.

References tagCLS::atomClassName, ClassFree(), tagCLS::cWndReferenceCount, DestroyCacheDC(), DestroyClassBrush(), DestroyClassSmIcon(), tagDCE::hdc, IS_PTR, LockDesktop, NULL, tagCLS::pclsBase, tagCLS::pclsClone, tagCLS::pclsNext, tagCLS::pdce, PtiCurrent, tagCLS::rpdeskParent, tagCLS::spcpdFirst, Unlock, UnlockAndFreeCPDs(), UnlockDesktop, and UserDeleteAtom().

Referenced by _UnregisterClass(), _WOWCleanup(), _WOWModuleUnload(), CleanupResources(), DereferenceClass(), DestroyProcessesClasses(), and FinalUserInit().

01209 { 01210 PPCLS ppclsClone; 01211 PCLS pcls; 01212 PDESKTOP rpdesk; 01213 01214 pcls = *ppcls; 01215 01216 UserAssert(pcls->cWndReferenceCount == 0); 01217 01218 /* 01219 * If this is a base class, destroy all clones before deleting 01220 * stuff. 01221 */ 01222 if (pcls == pcls->pclsBase) { 01223 ppclsClone = &pcls->pclsClone; 01224 while (*ppclsClone != NULL) { 01225 DestroyClass(ppclsClone); 01226 } 01227 01228 UserDeleteAtom(pcls->atomClassName); 01229 01230 /* 01231 * No freeing if it's an integer resource. 01232 */ 01233 if (IS_PTR(pcls->lpszMenuName)) { 01234 UserFreePool(pcls->lpszMenuName); 01235 } 01236 01237 /* 01238 * Free up the class dc if there is one. 01239 */ 01240 if (pcls->pdce != NULL) 01241 DestroyCacheDC(NULL, pcls->pdce->hdc); 01242 01243 /* 01244 * Delete the hBrBackground brush if nobody else is 01245 * using it. 01246 */ 01247 DestroyClassBrush(pcls); 01248 } 01249 01250 /* 01251 * If we created the small icon delete it 01252 */ 01253 DestroyClassSmIcon(pcls); 01254 01255 /* 01256 * Unlock cursor and icon 01257 */ 01258 Unlock(&pcls->spicn); 01259 Unlock(&pcls->spicnSm); 01260 Unlock(&pcls->spcur); 01261 01262 /* 01263 * Free any CallProcData objects associated with this class 01264 */ 01265 if (pcls->spcpdFirst) { 01266 UnlockAndFreeCPDs(&pcls->spcpdFirst); 01267 } 01268 01269 /* 01270 * Point the previous guy at the guy we currently point to. 01271 */ 01272 *ppcls = pcls->pclsNext; 01273 01274 /* 01275 * Lock the desktop. Do not use a thread lock because 01276 * this may be called during process cleanup when thread 01277 * locks are no longer usable. 01278 */ 01279 rpdesk = NULL; 01280 LockDesktop(&rpdesk, pcls->rpdeskParent, LDL_FN_DESTROYCLASS, (ULONG_PTR)PtiCurrent()); 01281 UnlockDesktop(&pcls->rpdeskParent, LDU_CLS_DESKPARENT2, (ULONG_PTR)pcls); 01282 ClassFree(rpdesk, pcls->lpszAnsiClassName); 01283 ClassFree(rpdesk, pcls); 01284 UnlockDesktop(&rpdesk, LDU_FN_DESTROYCLASS, (ULONG_PTR)PtiCurrent()); 01285 }

BOOL DestroyClassSmIcon PCLS  pcls  ) 
 

Definition at line 146 of file classchg.c.

References _DestroyCursor(), BOOL, CSF_CACHEDSMICON, tagCLS::CSF_flags, CURSOR_ALWAYSDESTROY, FALSE, TRUE, and Unlock.

Referenced by DestroyClass(), xxxRecreateSmallIcons(), and xxxSetClassIcon().

00148 { 00149 00150 /* 00151 * If we don't have a cached icon, then no work. 00152 */ 00153 if (pcls->CSF_flags & CSF_CACHEDSMICON) { 00154 if (pcls->spicnSm) { 00155 _DestroyCursor(pcls->spicnSm, CURSOR_ALWAYSDESTROY); 00156 Unlock(&pcls->spicnSm); 00157 } 00158 pcls->CSF_flags &= ~CSF_CACHEDSMICON; 00159 return TRUE; 00160 } 00161 00162 return FALSE; 00163 }

void DestroyEventHook PEVENTHOOK   ) 
 

Definition at line 879 of file kernel/winable.c.

References DBGVERIFYEVENTHOOK, tagEVENTHOOK::fDestroyed, gpWinEventHooks, HMFreeObject(), HMMarkObjectDestroy(), tagEVENTHOOK::ihmod, tagEVENTHOOK::pehNext, RemoveHmodDependency(), SET_OR_CLEAR_SRVIF, SRVIF_WINEVENTHOOKS, and TRUE.

Referenced by _UnhookWinEvent(), and FreeThreadsWinEvents().

00880 { 00881 PEVENTHOOK *ppEvent; 00882 PEVENTHOOK pEventT; 00883 00884 DBGVERIFYEVENTHOOK(pEventDestroy); 00885 UserAssert(gpWinEventHooks); 00886 00887 /* 00888 * Mark this event as destroyed, but don't remove it from the event list 00889 * until its lock count goes to 0 - we may be traversing the list 00890 * within xxxWindowEvent, so we mustn't break the link to the next hook. 00891 */ 00892 pEventDestroy->fDestroyed = TRUE; 00893 00894 /* 00895 * If the object is locked, mark it for destroy but don't free it yet. 00896 */ 00897 if (!HMMarkObjectDestroy(pEventDestroy)) 00898 return; 00899 00900 /* 00901 * Remove this from our event list. 00902 */ 00903 for (ppEvent = &gpWinEventHooks; pEventT = *ppEvent; ppEvent = &pEventT->pehNext) { 00904 if (pEventT == pEventDestroy) { 00905 *ppEvent = pEventDestroy->pehNext; 00906 break; 00907 } 00908 } 00909 UserAssert(pEventT); 00910 SET_OR_CLEAR_SRVIF(SRVIF_WINEVENTHOOKS, gpWinEventHooks); 00911 00912 /* 00913 * Make sure each hooked thread will unload the hook proc DLL 00914 */ 00915 if (pEventDestroy->ihmod >= 0) { 00916 RemoveHmodDependency(pEventDestroy->ihmod); 00917 } 00918 00919 /* 00920 * Free this pointer. 00921 */ 00922 HMFreeObject(pEventDestroy); 00923 00924 return; 00925 }

BOOL DestroyInputContext IN PIMC  pImc  ) 
 

Definition at line 122 of file ntimm.c.

References AssociateInputContext(), _HANDLEENTRY::bFlags, BOOL, BuildHwndList(), BWL_ENUMCHILDREN, BWL_ENUMLIST, FALSE, FreeHwndList(), GETPTI, HANDLEF_DESTROY, tagWND::hImc, HMDestroyUnlockedObject(), HMPheFromObject, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, PtoH, RevalidateHwnd, tagBWL::rghwnd, tagTHREADINFO::rpdesk, tagTHREADINFO::spDefaultImc, tagDESKTOPINFO::spwnd, tagWND::spwndChild, and TRUE.

Referenced by ImmDestroyContext(), ImmDllInitialize(), and NtUserDestroyInputContext().

00124 { 00125 PTHREADINFO ptiImcOwner; 00126 PBWL pbwl; 00127 PWND pwnd; 00128 HWND *phwnd; 00129 PHE phe; 00130 00131 ptiImcOwner = GETPTI(pImc); 00132 00133 /* 00134 * Cannot destroy input context from other thread. 00135 */ 00136 if (ptiImcOwner != PtiCurrent()) { 00137 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, 00138 "DestroyInputContext: pImc not of current pti"); 00139 return FALSE; 00140 } 00141 00142 /* 00143 * Cannot destroy default input context. 00144 */ 00145 if (pImc == ptiImcOwner->spDefaultImc) { 00146 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, 00147 "DestroyInputContext: can't destroy default Imc"); 00148 return FALSE; 00149 } 00150 00151 /* 00152 * Cleanup destroyed input context from each associated window. 00153 */ 00154 pbwl = BuildHwndList(ptiImcOwner->rpdesk->pDeskInfo->spwnd->spwndChild, 00155 BWL_ENUMLIST|BWL_ENUMCHILDREN, ptiImcOwner); 00156 00157 if (pbwl != NULL) { 00158 00159 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00160 /* 00161 * Make sure this hwnd is still around. 00162 */ 00163 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 00164 continue; 00165 00166 /* 00167 * Cleanup by associating the default input context. 00168 */ 00169 if (pwnd->hImc == (HIMC)PtoH(pImc)) 00170 AssociateInputContext(pwnd, ptiImcOwner->spDefaultImc); 00171 } 00172 00173 FreeHwndList(pbwl); 00174 } 00175 00176 phe = HMPheFromObject(pImc); 00177 00178 /* 00179 * Make sure this object isn't already marked to be destroyed - we'll 00180 * do no good if we try to destroy it now since it is locked. 00181 */ 00182 if (!(phe->bFlags & HANDLEF_DESTROY)) 00183 HMDestroyUnlockedObject(phe); 00184 00185 return TRUE; 00186 }

void DestroyKF PKBDFILE  pkf  ) 
 

Definition at line 435 of file kbdlyout.c.

References tagKBDFILE::hBase, HMFreeObject(), HMMarkObjectDestroy(), and RemoveKeyboardLayoutFile().

Referenced by DestroyKL().

00436 { 00437 if (!HMMarkObjectDestroy(pkf)) 00438 return; 00439 00440 RemoveKeyboardLayoutFile(pkf); 00441 UserFreePool(pkf->hBase); 00442 HMFreeObject(pkf); 00443 }

VOID DestroyKL PKL  pkl  ) 
 

Definition at line 1688 of file kbdlyout.c.

References DestroyKF(), HMFreeObject(), NULL, tagKL::piiex, tagKL::pklNext, tagKL::pklPrev, tagKL::spkf, Unlock, and VOID().

Referenced by Win32kNtUserCleanup().

01690 { 01691 PKBDFILE pkf; 01692 01693 /* 01694 * Cut it out of the pwinsta->spklList circular bidirectional list. 01695 * We know pwinsta->spklList != pkl, since pkl is unlocked. 01696 */ 01697 pkl->pklPrev->pklNext = pkl->pklNext; 01698 pkl->pklNext->pklPrev = pkl->pklPrev; 01699 01700 /* 01701 * Unlock its pkf 01702 */ 01703 pkf = Unlock(&pkl->spkf); 01704 if (pkf) { 01705 DestroyKF(pkf); 01706 } 01707 01708 if (pkl->piiex != NULL) { 01709 UserFreePool(pkl->piiex); 01710 } 01711 01712 /* 01713 * Free the pkl itself. 01714 */ 01715 HMFreeObject(pkl); 01716 }

void DestroyMonitor PMONITOR  pMonitor  ) 
 

Definition at line 249 of file multimon.c.

References gpDispInfo, gpMonitorMouse, HMFreeObject(), HMMarkObjectDestroy(), tagMONITOR::hrgnMonitor, NULL, tagDISPLAYINFO::pMonitorFirst, tagDISPLAYINFO::pMonitorPrimary, and REMOVE_FROM_LIST.

Referenced by CleanupGDI(), and UpdateUserScreen().

00250 { 00251 UserAssert(pMonitor); 00252 00253 /* 00254 * Remove references to this monitor from the global data. 00255 */ 00256 if (pMonitor == gpMonitorMouse) { 00257 gpMonitorMouse = NULL; 00258 } 00259 00260 /* 00261 * Remove from the monitor list. 00262 */ 00263 REMOVE_FROM_LIST(MONITOR, gpDispInfo->pMonitorFirst, pMonitor, pMonitorNext); 00264 00265 /* 00266 * Make sure the primary monitor points to a valid monitor. During the 00267 * mode changes the primary monitor will be recalculated as appropriate. 00268 */ 00269 if (pMonitor == gpDispInfo->pMonitorPrimary) { 00270 gpDispInfo->pMonitorPrimary = gpDispInfo->pMonitorFirst; 00271 } 00272 00273 if (HMMarkObjectDestroy(pMonitor)) { 00274 00275 if (pMonitor->hrgnMonitor) { 00276 GreDeleteObject(pMonitor->hrgnMonitor); 00277 } 00278 00279 HMFreeObject(pMonitor); 00280 } 00281 }

VOID DestroyNotify PNOTIFY  pNotify  ) 
 

Definition at line 566 of file kernel/winable.c.

References DBGVERIFYNOTIFY, gpPendingNotifies, NULL, tagNOTIFY::pNotifyNext, PtiCurrent, tagNOTIFY::ptiReceiver, and RemoveNotify().

Referenced by CleanEventMessage(), FreeThreadsWinEvents(), and xxxProcessNotifyWinEvent().

00567 { 00568 PNOTIFY *ppNotify; 00569 PNOTIFY pNotifyT; 00570 00571 DBGVERIFYNOTIFY(pNotifyDestroy); 00572 00573 /* 00574 * Either this notify isn't currently in the process of calling back 00575 * (which means ptiReceiver is NULL) or the thread destroying it 00576 * must be the one that was calling back (which means this thread 00577 * was destroyed during the callback and is cleaning up). 00578 */ 00579 UserAssert((pNotifyDestroy->ptiReceiver == NULL) || 00580 (pNotifyDestroy->ptiReceiver == PtiCurrent())); 00581 00582 ppNotify = &gpPendingNotifies; 00583 while (pNotifyT = *ppNotify) { 00584 if (pNotifyT == pNotifyDestroy) { 00585 RemoveNotify(ppNotify); 00586 return; 00587 } else { 00588 ppNotify = &pNotifyT->pNotifyNext; 00589 } 00590 } 00591 RIPMSG1(RIP_ERROR, "DestroyNotify %#p - not found", pNotifyDestroy); 00592 }

VOID DestroyProcessesClasses PPROCESSINFO   ) 
 

Definition at line 1768 of file class.c.

References DestroyClass(), NULL, tagPROCESSINFO::pclsPrivateList, tagPROCESSINFO::pclsPublicList, and VOID().

Referenced by xxxDestroyThreadInfo().

01770 { 01771 PPCLS ppcls; 01772 01773 /* 01774 * Destroy the private classes first 01775 */ 01776 ppcls = &(ppi->pclsPrivateList); 01777 while (*ppcls != NULL) { 01778 DestroyClass(ppcls); 01779 } 01780 01781 /* 01782 * Then the cloned public classes 01783 */ 01784 ppcls = &(ppi->pclsPublicList); 01785 while (*ppcls != NULL) { 01786 DestroyClass(ppcls); 01787 } 01788 }

BOOL DestroyProcessInfo PW32PROCESS   ) 
 

Definition at line 4976 of file queue.c.

References tagSHAREDINFO::aheList, AllocQEntry(), BEGINATOMICCHECK, _HANDLEENTRY::bFlags, BOOL, _HANDLEENTRY::bType, CheckCritIn, ClearAppStarting(), CLOSE_PSEUDO_EVENT, CloseProtectedHandle(), tagPROCESSINFO::cThreads, DeferWinEventNotify, DelayedDestroyCacheDC(), tagWINDOWSTATION::dwWSF_Flags, ENDATOMICCHECK, EndDeferWinEventNotifyWithoutProcessing, FALSE, gahti, GETPTI, giheLast, GiveForegroundActivateRight(), gppiForegroundOld, gppiInputProvider, gppiList, gppiLockSFW, gppiScreenSaver, gpPublicObjectList, gpwpiFirstWow, gSharedInfo, gspwndLogonNotify, HANDLEF_DESTROY, IsShellProcess(), tagTHREADINFO::mlPost, tagPUBOBJ::next, NT_SUCCESS, NULL, ObDereferenceObject, OCF_PROCESSOWNED, tagDESKTOP::pDeskInfo, tagDESKTOPVIEW::pdvNext, tagWOWPROCESSINFO::pEventWowExec, tagPUBOBJ::pid, _HANDLEENTRY::pOwner, tagDESKTOPINFO::ppiShellProcess, PPUBOBJ, REMOVE_FROM_LIST, tagPROCESSINFO::rpdeskStartup, tagPROCESSINFO::rpwinsta, SetWakeBit(), StoreQMessage(), UnlockDesktop, UnlockWinSta, USER_SOUND_CLOSE, WOWPROCESSINFO, WSF_OPENLOCK, and zzzCalcStartCursorHide().

Referenced by xxxUserProcessCallout().

04978 { 04979 PPROCESSINFO ppi = (PPROCESSINFO)pwp; 04980 PDESKTOPVIEW pdv, pdvNext; 04981 BOOL fHadThreads; 04982 PPUBOBJ ppo; 04983 04984 CheckCritIn(); 04985 04986 /* 04987 * Free up input idle event if it exists - wake everyone waiting on it 04988 * first. This object will get created sometimes even for non-windows 04989 * processes (usually for WinExec(), which calls WaitForInputIdle()). 04990 */ 04991 CLOSE_PSEUDO_EVENT(&pwp->InputIdleEvent); 04992 04993 /* 04994 * Check to see if the startglass is on, and if so turn it off and update. 04995 * DeferWinEventNotify to because we cannot process notifications for this 04996 * thread now (we may have no PtiCurrent, see comment above) 04997 */ 04998 BEGINATOMICCHECK(); 04999 DeferWinEventNotify(); 05000 if (pwp->W32PF_Flags & W32PF_STARTGLASS) { 05001 pwp->W32PF_Flags &= ~W32PF_STARTGLASS; 05002 zzzCalcStartCursorHide(NULL, 0); 05003 } 05004 /* 05005 * This is bookkeeping - restore original notification deferral but without 05006 * attempting to process any deferred notifications because we have no pti. 05007 */ 05008 EndDeferWinEventNotifyWithoutProcessing(); 05009 ENDATOMICCHECK(); 05010 05011 /* 05012 * If the process never called Win32k, we're done. 05013 */ 05014 if (!(pwp->W32PF_Flags & W32PF_PROCESSCONNECTED)) { 05015 return FALSE; 05016 } 05017 05018 /* 05019 * Play the Process Close sound for non-console processes 05020 * running on the I/O windowstation. 05021 */ 05022 05023 if ((ppi->W32PF_Flags & W32PF_IOWINSTA) && 05024 !(ppi->W32PF_Flags & W32PF_CONSOLEAPPLICATION) && 05025 (gspwndLogonNotify != NULL) && 05026 !(ppi->rpwinsta->dwWSF_Flags & WSF_OPENLOCK)) { 05027 05028 PTHREADINFO pti = GETPTI(gspwndLogonNotify); 05029 PQMSG pqmsg; 05030 05031 if ((pqmsg = AllocQEntry(&pti->mlPost)) != NULL) { 05032 StoreQMessage(pqmsg, gspwndLogonNotify, WM_LOGONNOTIFY, 05033 LOGON_PLAYEVENTSOUND, USER_SOUND_CLOSE, 0, 0, 0); 05034 05035 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 05036 } 05037 05038 } 05039 05040 /* 05041 * Be like WIN95. 05042 * If this is the shell process, then send a LOGON_RESTARTSHELL 05043 * notification to the winlogon process (only if not logging off) 05044 */ 05045 if (IsShellProcess(ppi)) { 05046 05047 /* 05048 * The shell process will get killed and it's better to set this 05049 * in the desktop info. 05050 */ 05051 ppi->rpdeskStartup->pDeskInfo->ppiShellProcess = NULL; 05052 05053 /* 05054 * If we're not logging off, notify winlogon 05055 */ 05056 if ((gspwndLogonNotify != NULL) && 05057 !(ppi->rpwinsta->dwWSF_Flags & WSF_OPENLOCK)) { 05058 05059 PTHREADINFO pti = GETPTI(gspwndLogonNotify); 05060 PQMSG pqmsg; 05061 05062 if ((pqmsg = AllocQEntry(&pti->mlPost)) != NULL) { 05063 StoreQMessage(pqmsg, gspwndLogonNotify, WM_LOGONNOTIFY, 05064 LOGON_RESTARTSHELL, ppi->Process->ExitStatus, 0, 0, 0); 05065 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 05066 } 05067 } 05068 } 05069 05070 if (ppi->cThreads) 05071 RIPMSG1(RIP_ERROR, "Disconnect with %d threads remaining\n", ppi->cThreads); 05072 05073 /* 05074 * If the app is still starting, remove it from the startup list 05075 */ 05076 if (ppi->W32PF_Flags & W32PF_APPSTARTING) { 05077 /* 05078 * Bug 294193 - joejo 05079 * 05080 * Handle case when creator process exits before the child 05081 * process makes it to CheckAllowForeground code. This is typical with 05082 * stub EXEs that do nothing but create other processes. 05083 */ 05084 GiveForegroundActivateRight(ppi->Process->UniqueProcessId); 05085 ClearAppStarting(ppi); 05086 } 05087 05088 /* 05089 * remove it from the global list 05090 */ 05091 REMOVE_FROM_LIST(PROCESSINFO, gppiList, ppi, ppiNextRunning); 05092 05093 /* 05094 * If any threads ever connected, there may be DCs, classes, 05095 * cursors, etc. still lying around. If no threads connected 05096 * (which is the case for console apps), skip all of this cleanup. 05097 */ 05098 fHadThreads = ppi->W32PF_Flags & W32PF_THREADCONNECTED; 05099 if (fHadThreads) { 05100 05101 /* 05102 * When a process dies we need to make sure any DCE's it owns 05103 * and have not been deleted are cleanup up. The clean up 05104 * earlier may have failed if the DC was busy in GDI. 05105 */ 05106 if (ppi->W32PF_Flags & W32PF_OWNDCCLEANUP) { 05107 DelayedDestroyCacheDC(); 05108 } 05109 05110 #if DBG 05111 { 05112 PHE pheT, pheMax; 05113 05114 /* 05115 * Loop through the table destroying all objects created by the current 05116 * process. All objects will get destroyed in their proper order simply 05117 * because of the object locking. 05118 */ 05119 pheMax = &gSharedInfo.aheList[giheLast]; 05120 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 05121 05122 /* 05123 * We should have no process objects left for this process. 05124 */ 05125 UserAssertMsg0( 05126 pheT->bFlags & HANDLEF_DESTROY || 05127 !(gahti[pheT->bType].bObjectCreateFlags & OCF_PROCESSOWNED) || 05128 (PPROCESSINFO)pheT->pOwner != ppi, 05129 "We should have no process objects left for this process!"); 05130 } 05131 } 05132 #endif 05133 } 05134 05135 if (pwp->UserHandleCount) 05136 RIPMSG1(RIP_ERROR, "Disconnect with %d User handle objects remaining\n", pwp->UserHandleCount); 05137 05138 /* 05139 * check if we need to zap PID's for DDE objects 05140 */ 05141 for (ppo = gpPublicObjectList; 05142 ppo != NULL; 05143 ppo = ppo->next) { 05144 if (ppo->pid == pwp->W32Pid) { 05145 ppo->pid = OBJECT_OWNER_PUBLIC; 05146 } 05147 } 05148 05149 05150 if (gppiScreenSaver == ppi) { 05151 UserAssert(ppi->W32PF_Flags & W32PF_SCREENSAVER); 05152 05153 gppiScreenSaver = NULL; 05154 } 05155 05156 if (gppiForegroundOld == ppi) { 05157 gppiForegroundOld = NULL; 05158 } 05159 05160 UnlockWinSta(&ppi->rpwinsta); 05161 UnlockDesktop(&ppi->rpdeskStartup, LDU_PPI_DESKSTARTUP3, (ULONG_PTR)ppi); 05162 05163 /* 05164 * Close the startup desktop handle now if it's still around. If we wait 05165 * until handle table cleanup time we could potentially deadlock. 05166 */ 05167 if (ppi->hdeskStartup) { 05168 UserVerify(NT_SUCCESS(CloseProtectedHandle(ppi->hdeskStartup))); 05169 ppi->hdeskStartup = NULL; 05170 } 05171 05172 /* 05173 * Mark the process as terminated so access checks will work. 05174 */ 05175 ppi->W32PF_Flags |= W32PF_TERMINATED; 05176 05177 /* 05178 * Cleanup wow process info struct, if any 05179 */ 05180 if (ppi->pwpi) { 05181 PWOWPROCESSINFO pwpi = ppi->pwpi; 05182 05183 ObDereferenceObject(pwpi->pEventWowExec); 05184 05185 REMOVE_FROM_LIST(WOWPROCESSINFO, gpwpiFirstWow, pwpi, pwpiNext); 05186 05187 UserFreePool(pwpi); 05188 ppi->pwpi = NULL; 05189 } 05190 05191 /* 05192 * Delete desktop views. System will do unmapping. 05193 */ 05194 pdv = ppi->pdvList; 05195 while (pdv) { 05196 pdvNext = pdv->pdvNext; 05197 UserFreePool(pdv); 05198 pdv = pdvNext; 05199 } 05200 ppi->pdvList = NULL; 05201 05202 /* 05203 * Clear the SendInput/Journalling hook caller ppi 05204 */ 05205 if (ppi == gppiInputProvider) { 05206 gppiInputProvider = NULL; 05207 } 05208 /* 05209 * If this ppi locked SetForegroundWindow, clean up 05210 */ 05211 if (ppi == gppiLockSFW) { 05212 gppiLockSFW = NULL; 05213 } 05214 05215 return fHadThreads; 05216 }

void DestroySMWP PSMWP  psmwp  ) 
 

Definition at line 64 of file swp.c.

References tagSMWP::acvr, tagSMWP::bHandle, BOOL, tagSMWP::ccvr, tagSMWP::ccvrAlloc, CheckCritIn, CLEAR_PUDF, CVR, DBGCheskSMWP, gSMWP, HMFreeObject(), HMMarkObjectDestroy(), tagCVR::hrgnInterMonitor, NULL, PUDF_GSMWPINUSE, TEST_PUDF, and TRUE.

Referenced by _DeferWindowPos(), and xxxEndDeferWindowPosEx().

00065 { 00066 BOOL fFree; 00067 00068 CheckCritIn(); 00069 00070 DBGCheskSMWP(psmwp); 00071 /* 00072 * First mark the object for destruction. This tells the locking code 00073 * that we want to destroy this object when the lock count goes to 0. 00074 * If this returns FALSE, we can't destroy the object yet. 00075 */ 00076 if (psmwp->bHandle) { 00077 if (!HMMarkObjectDestroy(psmwp)) { 00078 return; 00079 } 00080 fFree = TRUE; 00081 } else { 00082 /* 00083 * Is this the global cached structure? 00084 */ 00085 fFree = (psmwp != &gSMWP); 00086 } 00087 00088 if (psmwp->acvr) { 00089 00090 /* 00091 * Free any hrgnInterMonitor stuff we accumulated. 00092 */ 00093 PCVR pcvr; 00094 int ccvr; 00095 00096 for (pcvr = psmwp->acvr, ccvr = psmwp->ccvr; --ccvr >= 0; pcvr++) { 00097 if (pcvr->hrgnInterMonitor != NULL) { 00098 GreDeleteObject(pcvr->hrgnInterMonitor); 00099 } 00100 } 00101 00102 if (fFree) { 00103 UserFreePool(psmwp->acvr); 00104 } 00105 } 00106 00107 /* 00108 * Ok to destroy... Free the handle (which will free the object 00109 * and the handle). 00110 */ 00111 if (psmwp->bHandle) { 00112 HMFreeObject(psmwp); 00113 } else if (fFree) { 00114 UserFreePool(psmwp); 00115 } else { 00116 UserAssert(TEST_PUDF(PUDF_GSMWPINUSE)); 00117 CLEAR_PUDF(PUDF_GSMWPINUSE); 00118 /* 00119 * If acvr grew too much, shrink it. 00120 * Don't use realloc since we don't care about the left over data 00121 */ 00122 if (psmwp->ccvrAlloc > 8) { 00123 PCVR pcvr = UserAllocPool(4 * sizeof(CVR), TAG_SWP); 00124 if (pcvr != NULL) { 00125 UserFreePool(psmwp->acvr); 00126 psmwp->acvr = pcvr; 00127 psmwp->ccvrAlloc = 4; 00128 } 00129 } 00130 } 00131 }

VOID DestroyTask PPROCESSINFO  ppi,
PTHREADINFO  ptiToRemove
 

Definition at line 129 of file taskman.c.

References _PostMessage(), BEGINATOMICCHECK, CheckCritIn, CLOSE_PSEUDO_EVENT, tagWOWPROCESSINFO::CSOwningThread, DTM_SETUPAPPRAN, ENDATOMICCHECK, EVENT_INCREMENT, ExitWowCritSect(), FALSE, GETDESKINFO, gpsi, gpwtiFirst, KeSetEvent(), tagTDB::nEvents, tagWOWPROCESSINFO::nTaskLock, NULL, tagTHREADINFO::pEventQueueServer, tagWOWPROCESSINFO::pEventWowExec, tagWOWTHREADINFO::pIdleEvent, tagTHREADINFO::ptdb, tagWOWPROCESSINFO::ptdbHead, tagTDB::ptdbNext, tagTDB::pti, tagWOWPROCESSINFO::ptiScheduled, tagPROCESSINFO::pwpi, tagTDB::pwti, tagWOWTHREADINFO::pwtiNext, tagDESKTOPINFO::spwndShell, tagTDB::TDB_Flags, and TDBF_SETUP.

Referenced by xxxDestroyThreadInfo().

00132 { 00133 PTDB ptdbToRemove = ptiToRemove->ptdb; 00134 PTDB ptdb; 00135 PTDB* pptdb; 00136 PWOWPROCESSINFO pwpi = ppi->pwpi; 00137 00138 // try to catch #150446 00139 CheckCritIn(); 00140 BEGINATOMICCHECK(); 00141 00142 UserAssert(pwpi != NULL); 00143 00144 if (ptdbToRemove != NULL) { 00145 00146 if (ptdbToRemove->TDB_Flags & TDBF_SETUP) { 00147 /* 00148 * This means that the WoW app was a setup app (checked in SetAppCompatFlags). 00149 * If so, the shell needs to be notified so it can clean up potential problems 00150 * caused by bad calls to DDE, etc. FritzS 00151 */ 00152 PDESKTOPINFO pdeskinfo = GETDESKINFO(ptiToRemove); 00153 if (pdeskinfo->spwndShell) { 00154 _PostMessage(pdeskinfo->spwndShell, DTM_SETUPAPPRAN, 0, 0); 00155 } 00156 } 00157 /* 00158 * Remove the WOW per thread info 00159 */ 00160 if (ptdbToRemove->pwti) { 00161 PWOWTHREADINFO *ppwti = &gpwtiFirst; 00162 while (*ppwti != ptdbToRemove->pwti && (*ppwti)->pwtiNext != NULL) { 00163 ppwti = &((*ppwti)->pwtiNext); 00164 } 00165 if (*ppwti == ptdbToRemove->pwti) { 00166 *ppwti = ptdbToRemove->pwti->pwtiNext; 00167 } 00168 CLOSE_PSEUDO_EVENT(&ptdbToRemove->pwti->pIdleEvent); 00169 UserFreePool(ptdbToRemove->pwti); 00170 } 00171 00172 gpsi->nEvents -= ptdbToRemove->nEvents; 00173 00174 /* 00175 * remove it from any lists 00176 */ 00177 pptdb = &pwpi->ptdbHead; 00178 while ((ptdb = *pptdb) != NULL) { 00179 /* 00180 * Remove it from it's old location 00181 */ 00182 if (ptdb == ptdbToRemove) { 00183 *pptdb = ptdb->ptdbNext; 00184 UserFreePool(ptdbToRemove); 00185 UserAssert(ptiToRemove->ptdb == ptdbToRemove); 00186 ptiToRemove->ptdb = NULL; 00187 break; 00188 } 00189 pptdb = &(ptdb->ptdbNext); 00190 } 00191 UserAssert(ptdb == ptdbToRemove); // #150446 check that we actually found it 00192 } 00193 ENDATOMICCHECK(); // #150446 00194 00195 /* 00196 * If the task being destroyed is the active task, make nobody active. 00197 * We will go through this code path for 32-bit threads that die while 00198 * Win16 threads are waiting for a SendMessage reply from them. 00199 */ 00200 if (pwpi->ptiScheduled == ptiToRemove) { 00201 pwpi->ptiScheduled = NULL; 00202 ExitWowCritSect(ptiToRemove, pwpi); 00203 00204 /* 00205 * If this active task was locked, remove lock so next guy can 00206 * run. 00207 */ 00208 pwpi->nTaskLock = 0; 00209 00210 00211 /* 00212 * Wake next task with events, or wowexec to run the scheduler 00213 */ 00214 if (pwpi->ptdbHead != NULL) { 00215 PTDB ptdb; 00216 00217 for (ptdb = pwpi->ptdbHead; ptdb; ptdb = ptdb->ptdbNext) { 00218 if (ptdb->nEvents > 0) { 00219 KeSetEvent(ptdb->pti->pEventQueueServer, 00220 EVENT_INCREMENT, FALSE); 00221 break; 00222 } 00223 } 00224 00225 if (!ptdb) { 00226 KeSetEvent(pwpi->pEventWowExec, EVENT_INCREMENT, FALSE); 00227 } 00228 } 00229 } 00230 UserAssert(ptiToRemove != pwpi->CSOwningThread); 00231 00232 }

VOID DestroyThreadsHotKeys VOID   ) 
 

VOID DestroyThreadsObjects VOID   ) 
 

VOID DestroyThreadsTimers PTHREADINFO  pti  ) 
 

Definition at line 472 of file timers.c.

References FreeTimer(), gptmrFirst, NULL, tagTIMER::pti, tagTIMER::ptiOptCreator, tagTIMER::ptmrNext, and VOID().

Referenced by xxxDestroyThreadInfo().

00474 { 00475 PTIMER ptmr; 00476 00477 ptmr = gptmrFirst; 00478 00479 while (ptmr != NULL) { 00480 00481 /* 00482 * Is this one of the timers we're looking for? If so, destroy it. 00483 */ 00484 if (ptmr->pti == pti || ptmr->ptiOptCreator == pti) { 00485 PTIMER ptmrNext = ptmr->ptmrNext; 00486 FreeTimer(ptmr); 00487 ptmr = ptmrNext; 00488 } else { 00489 ptmr = ptmr->ptmrNext; 00490 } 00491 } 00492 }

void DestroyUnlockedCursor void *   ) 
 

Definition at line 680 of file loadbits.c.

References _DestroyCursor(), and CURSOR_THREADCLEANUP.

00681 { 00682 _DestroyCursor((PCURSOR)pv, CURSOR_THREADCLEANUP); 00683 }

VOID DestroyWindowsHotKeys PWND  pwnd  ) 
 

Definition at line 93 of file hotkeys.c.

References gphkFirst, tagHOTKEY::phkNext, tagHOTKEY::spwnd, Unlock, and VOID().

Referenced by xxxFreeWindow().

00095 { 00096 PHOTKEY *pphk; 00097 PHOTKEY phk; 00098 pphk = &gphkFirst; 00099 while (*pphk) { 00100 if ((*pphk)->spwnd == pwnd) { 00101 phk = *pphk; 00102 *pphk = (*pphk)->phkNext; 00103 00104 Unlock(&phk->spwnd); 00105 UserFreePool(phk); 00106 } else { 00107 pphk = &((*pphk)->phkNext); 00108 } 00109 } 00110 }

BOOL DestroyWindowSmIcon PWND  pwnd  ) 
 

Definition at line 1067 of file dwp.c.

References _DestroyCursor(), _GetProp(), tagSERVERINFO::atomIconSmProp, BOOL, ClrWF, CURSOR_ALWAYSDESTROY, CURSORF_SECRET, FALSE, gpsi, HMValidateHandleNoRip(), InternalRemoveProp(), MAKEINTATOM, NULL, PROPF_INTERNAL, TRUE, TYPE_CURSOR, and WFSMQUERYDRAGICON.

Referenced by xxxFreeWindow(), xxxRecreateSmallIcons(), and xxxSetClassIconEnum().

01069 { 01070 HCURSOR hcursor; 01071 PCURSOR pcursor; 01072 01073 // 01074 // Get the small icon property first... 01075 // 01076 hcursor = (HCURSOR)_GetProp(pwnd, MAKEINTATOM(gpsi->atomIconSmProp), PROPF_INTERNAL); 01077 if (hcursor == NULL) 01078 return FALSE; 01079 01080 pcursor = (PCURSOR)HMValidateHandleNoRip(hcursor, TYPE_CURSOR); 01081 if (pcursor == NULL) 01082 return FALSE; 01083 01084 // 01085 // Remove it if it's a secretly created one 01086 // 01087 01088 if (pcursor->CURSORF_flags & CURSORF_SECRET) 01089 { 01090 ClrWF(pwnd, WFSMQUERYDRAGICON); 01091 InternalRemoveProp(pwnd, MAKEINTATOM(gpsi->atomIconSmProp), PROPF_INTERNAL); 01092 _DestroyCursor(pcursor, CURSOR_ALWAYSDESTROY); 01093 return(TRUE); 01094 } 01095 else 01096 return(FALSE); 01097 }

VOID DestroyWindowStation IN PEPROCESS Process  OPTIONAL,
IN PVOID  Object,
IN ACCESS_MASK  GrantedAccess,
IN ULONG  ProcessHandleCount,
IN ULONG  SystemHandleCount
 

Referenced by Win32UserInitialize().

VOID DestroyWindowsTimers PWND  pwnd  ) 
 

Definition at line 504 of file timers.c.

References FreeTimer(), gptmrFirst, NULL, tagTIMER::ptmrNext, tagTIMER::spwnd, and VOID().

Referenced by xxxClientShutdown2(), and xxxFreeWindow().

00506 { 00507 PTIMER ptmr; 00508 00509 ptmr = gptmrFirst; 00510 00511 while (ptmr != NULL) { 00512 00513 /* 00514 * Is this one of the timers we're looking for? If so, destroy it. 00515 */ 00516 if (ptmr->spwnd == pwnd) { 00517 PTIMER ptmrNext = ptmr->ptmrNext; 00518 FreeTimer(ptmr); 00519 ptmr = ptmrNext; 00520 } else { 00521 ptmr = ptmr->ptmrNext; 00522 } 00523 } 00524 }

NTSTATUS DeviceNotify IN PPLUGPLAY_NOTIFY_HDR  pNotification,
IN PDEVICEINFO  pDeviceInfo
 

Definition at line 1025 of file w32/ntuser/kernel/pnp.c.

References CheckCritOut, CheckDeviceInfoListCritOut, FALSE, gbRemoteSession, GDIAF_DEPARTED, GDIAF_PNPWAITING, GDIAF_QUERYREMOVE, GDIAF_REMOVECANCELLED, gpDeviceInfoList, NTSTATUS(), NULL, PsGetCurrentThread, RequestDeviceChange(), and USHORT.

01028 { 01029 USHORT usAction; 01030 01031 #if DBG 01032 { 01033 PDEVICEINFO pDeviceInfoDbg; 01034 for (pDeviceInfoDbg = gpDeviceInfoList; pDeviceInfoDbg; pDeviceInfoDbg = pDeviceInfoDbg->pNext) { 01035 if (pDeviceInfoDbg == pDeviceInfo) { 01036 break; 01037 } 01038 } 01039 UserAssertMsg1(pDeviceInfoDbg != NULL, "Notification for unlisted DEVICEINFO %lx", pDeviceInfo); 01040 } 01041 #endif 01042 01043 CheckCritOut(); 01044 01045 UserAssert(!gbRemoteSession); 01046 01047 TAGMSG1(DBGTAG_PNP | RIP_THERESMORE, "DeviceNotify >>> %lx", pDeviceInfo); 01048 01049 UserAssert(pDeviceInfo->OpenerProcess != PsGetCurrentThread()->Cid.UniqueProcess); 01050 UserAssert(pDeviceInfo->usActions == 0); 01051 01052 if (IsEqualGUID(&pNotification->Event, &GUID_TARGET_DEVICE_QUERY_REMOVE)) { 01053 TAGMSG0(DBGTAG_PNP | RIP_NONAME, "QueryRemove"); 01054 usAction = GDIAF_QUERYREMOVE; 01055 01056 } else if (IsEqualGUID(&pNotification->Event, &GUID_TARGET_DEVICE_REMOVE_CANCELLED)) { 01057 TAGMSG0(DBGTAG_PNP | RIP_NONAME, "RemoveCancelled"); 01058 usAction = GDIAF_REMOVECANCELLED; 01059 01060 } else if (IsEqualGUID(&pNotification->Event, &GUID_TARGET_DEVICE_REMOVE_COMPLETE)) { 01061 TAGMSG1(DBGTAG_PNP | RIP_NONAME, "RemoveComplete (process %#x)", PsGetCurrentThread()->Cid.UniqueProcess); 01062 usAction = GDIAF_DEPARTED; 01063 01064 } else { 01065 TAGMSG4(DBGTAG_PNP | RIP_NONAME, "GUID Unknown: %lx:%lx:%lx:%x...", 01066 pNotification->Event.Data1, pNotification->Event.Data2, 01067 pNotification->Event.Data3, pNotification->Event.Data4[0]); 01068 return STATUS_UNSUCCESSFUL; 01069 } 01070 01071 /* 01072 * Signal the RIT to ProcessDeviceChanges() 01073 * Wait for completion according to the GDIAF_PNPWAITING bit 01074 */ 01075 CheckCritOut(); 01076 CheckDeviceInfoListCritOut(); 01077 RequestDeviceChange(pDeviceInfo, (USHORT)(usAction | GDIAF_PNPWAITING), FALSE); 01078 01079 return STATUS_SUCCESS; 01080 }

VOID DirectedScheduleTask PTHREADINFO  ptiOld,
PTHREADINFO  ptiNew,
BOOL  bSendMsg,
PSMS  psms
 

Definition at line 594 of file taskman.c.

References BOOL, CheckCritIn, gpsi, InsertTask(), tagTDB::nEvents, tagTDB::nPriority, tagWOWPROCESSINFO::nRecvLock, tagWOWPROCESSINFO::nSendLock, tagTHREADINFO::ppi, tagTHREADINFO::psmsSent, tagTHREADINFO::ptdb, tagWOWPROCESSINFO::ptiScheduled, tagPROCESSINFO::pwpi, SMF_WOWRECEIVE, SMF_WOWSEND, TIF_16BIT, tagTHREADINFO::TIF_flags, VOID(), and WakeWowTask().

Referenced by _ReplyMessage(), ReceiverDied(), xxxInterSendMsgEx(), xxxReceiveMessage(), and xxxSleepTask().

00600 { 00601 PWOWPROCESSINFO pwpiOld; 00602 PWOWPROCESSINFO pwpiNew; 00603 00604 CheckCritIn(); 00605 00606 pwpiOld = ptiOld->ppi->pwpi; 00607 pwpiNew = ptiNew->ppi->pwpi; 00608 00609 00610 /* 00611 * If old task is 16 bit, reinsert the task in its wow scheduler list 00612 * so that it is lowest in priority. Note that ptiOld is always the 00613 * same as pwpiOld->ptiScheduled except when called from ReceiverDied. 00614 */ 00615 if (ptiOld->TIF_flags & TIF_16BIT) { 00616 00617 if (pwpiOld->ptiScheduled == ptiOld) { 00618 ptiOld->ptdb->nEvents++; 00619 gpsi->nEvents++; 00620 InsertTask(ptiOld->ppi, ptiOld->ptdb); 00621 } 00622 00623 00624 // Update the Send\Recv counts for interprocess scheduling in SleepTask 00625 00626 if (pwpiOld != pwpiNew || !(ptiNew->TIF_flags & TIF_16BIT)) { 00627 if (bSendMsg) { 00628 pwpiOld->nSendLock++; 00629 psms->flags |= SMF_WOWSEND; 00630 } 00631 else if (pwpiOld->nRecvLock && psms->flags & SMF_WOWRECEIVE) { 00632 pwpiOld->nRecvLock--; 00633 psms->flags &= ~SMF_WOWRECEIVE; 00634 } 00635 } 00636 00637 } 00638 00639 00640 /* 00641 * If the new task is 16 bit, reinsert into the wow scheduler list 00642 * so that it will run, if its a sendmsg raise priority of the receiver. 00643 * If its a reply and the sender is waiting for this psms or the sender 00644 * has a message to reply to raise priority of the sender. 00645 */ 00646 if (ptiNew->TIF_flags & TIF_16BIT) { 00647 BOOL bRaisePriority; 00648 00649 ptiNew->ptdb->nEvents++; 00650 gpsi->nEvents++; 00651 bRaisePriority = bSendMsg || psms == ptiNew->psmsSent; 00652 00653 if (bRaisePriority) { 00654 ptiNew->ptdb->nPriority--; 00655 } 00656 00657 InsertTask(ptiNew->ppi, ptiNew->ptdb); 00658 00659 if (bRaisePriority) { 00660 ptiNew->ptdb->nPriority++; 00661 WakeWowTask(ptiNew); 00662 } 00663 00664 00665 // Update the Send\Recv counts for interprocess scheduling in SleepTask 00666 00667 if (pwpiOld != pwpiNew || !(ptiOld->TIF_flags & TIF_16BIT)) { 00668 if (bSendMsg) { 00669 pwpiNew->nRecvLock++; 00670 psms->flags |= SMF_WOWRECEIVE; 00671 } 00672 else if (pwpiNew->nSendLock && psms->flags & SMF_WOWSEND) { 00673 pwpiNew->nSendLock--; 00674 psms->flags &= ~SMF_WOWSEND; 00675 } 00676 } 00677 00678 } 00679 }

VOID DisownClipboard PWND  pwndClipOwner  ) 
 

Definition at line 2687 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), tagWINDOWSTATION::cNumClipFormats, DUMMY_TEXT_HANDLE, FALSE, tagWINDOWSTATION::fClipboardChanged, tagWINDOWSTATION::iClipSequenceNumber, IsTextHandle, MungeClipData(), NULL, tagWINDOWSTATION::pClipBase, PtiCurrent, tagWINDOWSTATION::spwndClipOwner, ThreadLockWinSta, ThreadUnlockWinSta, TRUE, Unlock, VOID(), xxxDrawClipboard(), and xxxSendClipboardMessage().

Referenced by xxxDW_SendDestroyMessages().

02688 { 02689 TL tlpwinsta; 02690 PWINDOWSTATION pwinsta; 02691 int iFmt; 02692 int cFmts; 02693 PCLIP pClip; 02694 PCLIP pClipOut; 02695 BOOL fKeepDummyHandle; 02696 PTHREADINFO ptiCurrent; 02697 02698 if ((pwinsta = CheckClipboardAccess()) == NULL) 02699 return; 02700 02701 ptiCurrent = PtiCurrent(); 02702 02703 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 02704 02705 xxxSendClipboardMessage(pwinsta, WM_RENDERALLFORMATS); 02706 02707 pClipOut = pClip = pwinsta->pClipBase; 02708 fKeepDummyHandle = FALSE; 02709 02710 for (cFmts = 0, iFmt = pwinsta->cNumClipFormats; iFmt-- != 0;) { 02711 02712 /* 02713 * We have to remove the Dummy handles also if the corresponding 02714 * valid handles are NULL; We should not remove the dummy handles if 02715 * the corresponding valid handles are not NULL; 02716 * The following code assumes that only one dummy handle is possible 02717 * and that can appear only after the corresponding valid handle in 02718 * the pClip linked list; 02719 * Fix for Bug #???? --SANKAR-- 10-19-89 --OPUS BUG #3252-- 02720 */ 02721 if (pClip->hData != NULL) { 02722 02723 if ((pClip->hData != DUMMY_TEXT_HANDLE) || 02724 ((pClip->hData == DUMMY_TEXT_HANDLE) && fKeepDummyHandle)) { 02725 02726 cFmts++; 02727 *pClipOut++ = *pClip; 02728 02729 if (IsTextHandle(pClip->fmt, pClip->hData)) { 02730 fKeepDummyHandle = TRUE; 02731 } 02732 } 02733 } 02734 02735 pClip++; 02736 } 02737 02738 /* 02739 * Unlock the clipboard owner if the owner is still the window we were cleaning 02740 * up for. 02741 */ 02742 if (pwndClipOwner == pwinsta->spwndClipOwner) { 02743 Unlock(&pwinsta->spwndClipOwner); 02744 } else { 02745 RIPMSG2(RIP_WARNING, "DisownClipboard: pwndClipOwner changed from %#p to %#p", 02746 pwndClipOwner, pwinsta->spwndClipOwner); 02747 } 02748 02749 /* 02750 * If number of formats changed, redraw. 02751 */ 02752 if (cFmts != pwinsta->cNumClipFormats) { 02753 pwinsta->fClipboardChanged = TRUE; 02754 pwinsta->iClipSequenceNumber++; 02755 } 02756 02757 pwinsta->cNumClipFormats = cFmts; 02758 02759 /* 02760 * If anything changed, redraw. And make sure the data type munging is done. Or else we will lose 02761 * them when xxxDrawClipboard clears the fClipboardChanged flag 02762 */ 02763 if (pwinsta->fClipboardChanged) { 02764 xxxDrawClipboard(pwinsta); 02765 MungeClipData(pwinsta); 02766 } 02767 02768 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 02769 }

BOOL DoPaint PWND  pwndFilter,
LPMSG  lpMsg
 

Definition at line 574 of file paint.c.

References BOOL, CheckPwndFilter(), ClrWF, DecPaintCount(), DWORD, FALSE, FNID_DESKTOP, GETFNID, tagWND::hrgnUpdate, InternalDoPaint(), L, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, tagTHREADINFO::pwinsta, tagTHREADINFO::rpdesk, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, SetWF, tagDESKTOPINFO::spwnd, tagWND::spwndParent, StoreMessage(), TestWF, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, TRUE, WFCLIPCHILDREN, WFINTERNALPAINT, WFMINIMIZED, WFSTARTPAINT, WFUPDATEDIRTY, WFWIN40COMPAT, and WFWMPAINTSENT.

Referenced by xxxInternalGetMessage().

00577 { 00578 PWND pwnd; 00579 PWND pwndT; 00580 PTHREADINFO ptiCurrent = PtiCurrent(); 00581 00582 00583 #if 0 // CHRISWIL: WIN95 SPECIFIC 00584 00585 /* 00586 * If there is a system modal up and it is attached to another task, 00587 * DON'T do paints. We don't want to return a message for a window in 00588 * another task! 00589 */ 00590 if (hwndSysModal && (hwndSysModal->hq != hqCurrent)) { 00591 00592 /* 00593 * Poke this guy so he wakes up at some point in the future, 00594 * otherwise he may never wake up to realize he should paint. 00595 * Causes hangs - e.g. Photoshop installation program 00596 * PostThreadMessage32(Lpq(hqCurrent)->idThread, WM_NULL, 0, 0, 0); 00597 */ 00598 return FALSE; 00599 } 00600 00601 #endif 00602 00603 /* 00604 * If this is a system thread, then walk the windowstation desktop-list 00605 * to find the window which needs painting. For other threads, we 00606 * reference off the thread-desktop. 00607 */ 00608 if (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD) { 00609 00610 PWINDOWSTATION pwinsta; 00611 PDESKTOP pdesk; 00612 00613 if ((pwinsta = ptiCurrent->pwinsta) == NULL) { 00614 RIPMSG0(RIP_ERROR, "DoPaint: SYSTEMTHREAD does not have (pwinsta)"); 00615 return FALSE; 00616 } 00617 00618 pwnd = NULL; 00619 for(pdesk = pwinsta->rpdeskList; pdesk; pdesk = pdesk->rpdeskNext) { 00620 00621 if (pwnd = InternalDoPaint(pdesk->pDeskInfo->spwnd, ptiCurrent)) 00622 break; 00623 } 00624 00625 } else { 00626 pwnd = InternalDoPaint(ptiCurrent->rpdesk->pDeskInfo->spwnd, 00627 ptiCurrent); 00628 } 00629 00630 if (pwnd != NULL) { 00631 00632 if (!CheckPwndFilter(pwnd, pwndFilter)) 00633 return FALSE; 00634 00635 /* 00636 * We're returning a WM_PAINT message, so clear WFINTERNALPAINT so 00637 * it won't get sent again later. 00638 */ 00639 if (TestWF(pwnd, WFINTERNALPAINT)) { 00640 00641 ClrWF(pwnd, WFINTERNALPAINT); 00642 00643 /* 00644 * If there is no update region, then no more paint for this 00645 * window. 00646 */ 00647 if (pwnd->hrgnUpdate == NULL) 00648 DecPaintCount(pwnd); 00649 } 00650 00651 /* 00652 * Set the STARTPAINT so that any other calls to BeginPaint while 00653 * painting is begin performed, will prevent painting on those 00654 * windows. 00655 * 00656 * Clear the UPDATEDIRTY since some apps (DBFast) don't call 00657 * GetUpdateRect, BeginPaint/EndPaint. 00658 */ 00659 ClrWF(pwnd, WFSTARTPAINT); 00660 ClrWF(pwnd, WFUPDATEDIRTY); 00661 00662 /* 00663 * If we get an invalidate between now and the time the app calls 00664 * BeginPaint() and the windows parent is not CLIPCHILDREN, then 00665 * the parent will paint in the wrong order. So we are going to 00666 * cause the child to paint again. Look in beginpaint and internal 00667 * invalidate for other parts of this fix. 00668 * 00669 * Set a flag to signify that we are in the bad zone. 00670 * 00671 * Must go up the parent links to make sure all parents have 00672 * WFCLIPCHILDREN set otherwise set the WFWMPAINTSENT flag. 00673 * This is to fix Excel spreadsheet and fulldrag. The speadsheet 00674 * parent window (class XLDESK) has WFCLIPCHILDREN set but it's 00675 * parent (class XLMAIN) doesn't. So the main window erases the 00676 * background after the child window paints. 00677 * 00678 * JOHANNEC : 27-Jul-1994 00679 */ 00680 00681 /* 00682 * NT Bug 400167: As we walk up the tree, we need to stop short of 00683 * desktop windows and mother desktop windows. We can't do a test 00684 * for WFCLIPCHILDREN on the mother desktop window's parent because 00685 * it doesn't exist. This means that no desktop window will get 00686 * WFWMPAINTSENT set, but the message window will be able to get 00687 * WFWMPAINTSENT set. 00688 */ 00689 00690 pwndT = pwnd; 00691 while (pwndT && (GETFNID(pwndT) != FNID_DESKTOP)) { 00692 00693 if (!TestWF(pwndT->spwndParent, WFCLIPCHILDREN)) { 00694 SetWF(pwnd, WFWMPAINTSENT); 00695 break; 00696 } 00697 00698 pwndT = pwndT->spwndParent; 00699 } 00700 00701 /* 00702 * If the top level "tiled" owner/parent of this window is iconed, 00703 * send a WM_PAINTICON rather than a WM_PAINT. The wParam 00704 * is TRUE if this is the tiled window and FALSE if it is a 00705 * child/owned popup of the minimized window. 00706 * 00707 * BACKWARD COMPATIBILITY HACK 00708 * 00709 * 3.0 sent WM_PAINTICON with wParam == TRUE for no apparent 00710 * reason. Lotus Notes 2.1 depends on this for some reason 00711 * to properly change its icon when new mail arrives. 00712 */ 00713 if (!TestWF(pwnd, WFWIN40COMPAT) && 00714 TestWF(pwnd, WFMINIMIZED) && 00715 (pwnd->pcls->spicn != NULL)) { 00716 00717 StoreMessage(lpMsg, pwnd, WM_PAINTICON, (DWORD)TRUE, 0L, 0L); 00718 00719 } else { 00720 00721 StoreMessage(lpMsg, pwnd, WM_PAINT, 0, 0L, 0L); 00722 } 00723 00724 return TRUE; 00725 } 00726 00727 return FALSE; 00728 }

BOOL DoTimer PWND  pwndFilter  ) 
 

Definition at line 538 of file timers.c.

References AllocQEntry(), BOOL, CheckCritIn, CheckPwndFilter(), DecTimerCount(), FALSE, tagTIMER::flags, gptmrFirst, tagTHREADINFO::mlPost, tagTIMER::nID, NULL, tagTIMER::pfn, tagTIMER::pti, PtiCurrent, tagTIMER::ptmrNext, tagTIMER::ptmrPrev, SetWakeBit(), tagTIMER::spwnd, StoreQMessage(), StoreQMessagePti(), TRUE, UINT, and WM_SYSTIMER.

Referenced by xxxInternalGetMessage().

00540 { 00541 PTHREADINFO pti; 00542 PTIMER ptmr; 00543 PTIMER ptmrNext; 00544 PQMSG pqmsg; 00545 00546 CheckCritIn(); 00547 00548 pti = PtiCurrent(); 00549 00550 /* 00551 * Search for a timer that belongs to this queue. 00552 */ 00553 ptmr = gptmrFirst; 00554 00555 while (ptmr != NULL) { 00556 00557 /* 00558 * Has this timer gone off and is it one we're looking for? 00559 */ 00560 if ((ptmr->flags & TMRF_READY) && 00561 (ptmr->pti == pti) && 00562 CheckPwndFilter(ptmr->spwnd, pwndFilter)) { 00563 00564 /* 00565 * We found an appropriate timer. Put it in the app's queue and 00566 * return success. 00567 */ 00568 if ((pqmsg = AllocQEntry(&pti->mlPost)) != NULL) { 00569 00570 /* 00571 * Store the message and set the QS_POSTMESSAGE bit so the 00572 * thread knows it has a message. 00573 */ 00574 StoreQMessage(pqmsg, 00575 ptmr->spwnd, 00576 (UINT)((ptmr->flags & TMRF_SYSTEM) ? 00577 WM_SYSTIMER : WM_TIMER), 00578 (WPARAM)ptmr->nID, 00579 (LPARAM)ptmr->pfn, 00580 0, 0, 0); 00581 #ifdef REDIRECTION 00582 StoreQMessagePti(pqmsg, pti); 00583 #endif // REDIRECTION 00584 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 00585 } 00586 00587 /* 00588 * Reset this timer. 00589 */ 00590 ptmr->flags &= ~TMRF_READY; 00591 DecTimerCount(ptmr->pti); 00592 00593 /* 00594 * If there are other timers in the system move this timer 00595 * to the end of the list so other timers in for this queue 00596 * get a chance to go off. 00597 */ 00598 ptmrNext = ptmr->ptmrNext; 00599 if (ptmrNext != NULL) { 00600 00601 /* 00602 * Remove ptmr from its place in the list. 00603 */ 00604 if (ptmr->ptmrPrev) { 00605 ptmr->ptmrPrev->ptmrNext = ptmr->ptmrNext; 00606 } else 00607 gptmrFirst = ptmr->ptmrNext; 00608 00609 ptmrNext->ptmrPrev = ptmr->ptmrPrev; 00610 00611 /* 00612 * Move to the last TIMER of the list. 00613 */ 00614 while (ptmrNext->ptmrNext != NULL) 00615 ptmrNext = ptmrNext->ptmrNext; 00616 00617 /* 00618 * Insert this timer at the end. 00619 */ 00620 ptmrNext->ptmrNext = ptmr; 00621 ptmr->ptmrPrev = ptmrNext; 00622 ptmr->ptmrNext = NULL; 00623 } 00624 00625 return TRUE; 00626 } 00627 00628 ptmr = ptmr->ptmrNext; 00629 } 00630 00631 return FALSE; 00632 }

void DrawSize PWND  pwnd,
HDC  hdc,
int  cxFrame,
int  cyFrame
 

Definition at line 481 of file sbctl.c.

References BitBltSysBmp(), DrawBox(), FAR, IsScrollBarControl, OBI_NCGRIP, OBI_NCGRIP_L, tagWND::rcWindow, SBFSIZEGRIP, SizeBoxHwnd(), SYSHBR, SYSMET, TestWF, and WEFLEFTSCROLL.

Referenced by xxxDrawWindowFrame(), and xxxSBWndProc().

00482 { 00483 int x, y; 00484 //HBRUSH hbrSave; 00485 00486 if (TestWF(pwnd, WEFLEFTSCROLL)) { 00487 x = cxFrame; 00488 } else { 00489 x = pwnd->rcWindow.right - pwnd->rcWindow.left - cxFrame - SYSMET(CXVSCROLL); 00490 } 00491 y = pwnd->rcWindow.bottom - pwnd->rcWindow.top - cyFrame - SYSMET(CYHSCROLL); 00492 00493 // If we have a scrollbar control, or the sizebox is not associated with 00494 // a sizeable window, draw the flat gray sizebox. Otherwise, use the 00495 // sizing grip. 00496 if (IsScrollBarControl(pwnd)) 00497 { 00498 if (TestWF(pwnd, SBFSIZEGRIP)) 00499 goto DrawSizeGrip; 00500 else 00501 goto DrawBox; 00502 00503 } 00504 else if (!SizeBoxHwnd(pwnd)) 00505 { 00506 DrawBox: 00507 { 00508 //hbrSave = GreSelectBrush(hdc, SYSHBR(3DFACE)); 00509 //GrePatBlt(hdc, x, y, SYSMET(CXVSCROLL), SYSMET(CYHSCROLL), PATCOPY); 00510 //GreSelectBrush(hdc, hbrSave); 00511 00512 POLYPATBLT PolyData; 00513 00514 PolyData.x = x; 00515 PolyData.y = y; 00516 PolyData.cx = SYSMET(CXVSCROLL); 00517 PolyData.cy = SYSMET(CYHSCROLL); 00518 PolyData.BrClr.hbr = SYSHBR(3DFACE); 00519 00520 GrePolyPatBlt(hdc,PATCOPY,&PolyData,1,PPB_BRUSH); 00521 00522 } 00523 } 00524 else 00525 { 00526 DrawSizeGrip: 00527 // Blt out the grip bitmap. 00528 BitBltSysBmp(hdc, x, y, TestWF(pwnd, WEFLEFTSCROLL) ? OBI_NCGRIP_L : OBI_NCGRIP); 00529 } 00530 }

VOID DrawThumb2 PWND  ,
PSBCALC  ,
HDC  ,
HBRUSH  ,
BOOL  ,
UINT 
 

Definition at line 697 of file sbctl.c.

References BOOL, tagSBTRACK::cmdSB, tagSBCALC::cpxThumb, DrawGroove(), DrawPushButton(), FALSE, tagSBTRACK::fTrackRecalc, tagSBTRACK::fTrackVert, InvertRect(), LTUPFLAG, PWNDTOPSBTRACK, tagSBCALC::pxBottom, tagSBCALC::pxDownArrow, tagSBCALC::pxLeft, tagSBCALC::pxRight, tagSBCALC::pxThumbBottom, tagSBCALC::pxThumbTop, tagSBCALC::pxTop, tagSBCALC::pxUpArrow, tagSBTRACK::rcTrack, RecalcTrackRect(), RTDNFLAG, and tagSBTRACK::spwndTrack.

Referenced by DrawCtlThumb(), xxxDrawSB2(), xxxDrawThumb(), xxxMoveThumb(), and xxxSBWndProc().

00704 { 00705 int *pLength; 00706 int *pWidth; 00707 RECT rcSB; 00708 PSBTRACK pSBTrack; 00709 00710 // 00711 // Bail out if the scrollbar has an empty rect 00712 // 00713 if ((pSBCalc->pxTop >= pSBCalc->pxBottom) || (pSBCalc->pxLeft >= pSBCalc->pxRight)) 00714 return; 00715 pLength = (LPINT)&rcSB; 00716 if (fVert) 00717 pWidth = pLength++; 00718 else 00719 pWidth = pLength + 1; 00720 00721 pWidth[0] = pSBCalc->pxLeft; 00722 pWidth[2] = pSBCalc->pxRight; 00723 00724 /* 00725 * If both scroll bar arrows are disabled, then we should not draw 00726 * the thumb. So, quit now! 00727 */ 00728 if (((wDisable & LTUPFLAG) && (wDisable & RTDNFLAG)) || 00729 ((pSBCalc->pxDownArrow - pSBCalc->pxUpArrow) < pSBCalc->cpxThumb)) { 00730 pLength[0] = pSBCalc->pxUpArrow; 00731 pLength[2] = pSBCalc->pxDownArrow; 00732 00733 DrawGroove(hdc, hbr, &rcSB, fVert); 00734 return; 00735 } 00736 00737 if (pSBCalc->pxUpArrow < pSBCalc->pxThumbTop) { 00738 // Fill in space above Thumb 00739 pLength[0] = pSBCalc->pxUpArrow; 00740 pLength[2] = pSBCalc->pxThumbTop; 00741 00742 DrawGroove(hdc, hbr, &rcSB, fVert); 00743 } 00744 00745 if (pSBCalc->pxThumbBottom < pSBCalc->pxDownArrow) { 00746 // Fill in space below Thumb 00747 pLength[0] = pSBCalc->pxThumbBottom; 00748 pLength[2] = pSBCalc->pxDownArrow; 00749 00750 DrawGroove(hdc, hbr, &rcSB, fVert); 00751 } 00752 00753 // 00754 // Draw elevator 00755 // 00756 pLength[0] = pSBCalc->pxThumbTop; 00757 pLength[2] = pSBCalc->pxThumbBottom; 00758 00759 // Not soft! 00760 DrawPushButton(hdc, &rcSB, 0, 0); 00761 00762 /* 00763 * If we're tracking a page scroll, then we've obliterated the hilite. 00764 * We need to correct the hiliting rectangle, and rehilite it. 00765 */ 00766 pSBTrack = PWNDTOPSBTRACK(pwnd); 00767 00768 if (pSBTrack && (pSBTrack->cmdSB == SB_PAGEUP || pSBTrack->cmdSB == SB_PAGEDOWN) && 00769 (pwnd == pSBTrack->spwndTrack) && 00770 (BOOL)pSBTrack->fTrackVert == fVert) { 00771 00772 if (pSBTrack->fTrackRecalc) { 00773 RecalcTrackRect(pSBTrack); 00774 pSBTrack->fTrackRecalc = FALSE; 00775 } 00776 00777 pLength = (int *)&pSBTrack->rcTrack; 00778 00779 if (fVert) 00780 pLength++; 00781 00782 if (pSBTrack->cmdSB == SB_PAGEUP) 00783 pLength[2] = pSBCalc->pxThumbTop; 00784 else 00785 pLength[0] = pSBCalc->pxThumbBottom; 00786 00787 if (pLength[0] < pLength[2]) 00788 InvertRect(hdc, &pSBTrack->rcTrack); 00789 } 00790 }

PWND DSW_GetTopLevelCreatorWindow PWND  pwnd  ) 
 

Definition at line 69 of file tmswitch.c.

References NULL, and tagWND::spwndOwner.

Referenced by xxxPaintIconsInSwitchWindow(), and xxxSetForegroundWindow().

00071 { 00072 UserAssert(pwnd != NULL); 00073 00074 if (pwnd != NULL) { 00075 while (pwnd->spwndOwner) 00076 pwnd = pwnd->spwndOwner; 00077 } 00078 00079 return pwnd; 00080 }

PWND DWP_GetEnabledPopup PWND  pwndStart  ) 
 

Definition at line 125 of file dwp.c.

References GETPTI, NULL, tagTHREADINFO::pq, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndOwner, tagWND::spwndParent, TestWF, TIF_16BIT, tagTHREADINFO::TIF_flags, WFDISABLED, and WFVISIBLE.

Referenced by GetActiveTrackPwnd(), and xxxDWP_SetCursor().

00127 { 00128 PWND pwndT, pwnd; 00129 PTHREADINFO ptiStart; 00130 00131 ptiStart = GETPTI(pwndStart); 00132 pwnd = pwndStart->spwndNext; 00133 00134 #ifdef SYSMODALWINDOWS 00135 if (gspwndSysModal) 00136 return NULL; 00137 #endif 00138 00139 /* 00140 * The user clicked on a window that is disabled. That window is pwndStart. 00141 * This loop is designed to evaluate what application this window is 00142 * associated with, and activate that "application", by finding what window 00143 * associated with that application can be activated. This is done by 00144 * enumerating top level windows, searching for a top level enabled 00145 * and visible ownee associated with this application. 00146 */ 00147 while (pwnd != pwndStart) { 00148 if (pwnd == NULL) { 00149 00150 /* 00151 * Warning! Win 3.1 had PWNDDESKTOP(pwndStart)->spwndChild 00152 * which could loop forever if pwndStart was a child window 00153 */ 00154 pwnd = pwndStart->spwndParent->spwndChild; 00155 continue; 00156 } 00157 00158 /* 00159 * We have two cases we need to watch out for here. The first is when 00160 * applications call AssociateThreadInput() to tie two threads 00161 * together to share input state. If the threads own the same queue, 00162 * then associate them together: this way, when two threads call 00163 * AttachThreadInput(), one created the main window, one created the 00164 * dialog window, when you click on the main window, they'll both 00165 * come to the top (rather than beeping). In this case we want to 00166 * compare queues. When Control Panel starts Setup in the Network 00167 * applet is one type of example of attached input. 00168 * 00169 * The second case is WOW apps. All wow apps have the same queue 00170 * so to retain Win 3.1 compatibility, we want to treat each app 00171 * as an individual task (Win 3.1 tests hqs), so we will compare 00172 * PTI's for WOW apps. 00173 * 00174 * To see this case start 16 bit notepad and 16 bit write. Do file 00175 * open on write and then give notepad the focus now click on write's 00176 * main window and the write file open dialog should activate. 00177 * 00178 * Another related case is powerpnt. This case is interesting because 00179 * it tests that we do not find another window to activate when nested 00180 * windows are up and you click on a owner's owner. Run Powerpnt, do 00181 * Edit-Insert-Picture and Object-Recolor Picture will bring up a 00182 * dialog with combos, drop down one of the color combo and then click 00183 * on powerpnt's main window - focus should stay with the dialogs 00184 * combo and it should stay dropped down. 00185 */ 00186 if (((ptiStart->TIF_flags & TIF_16BIT) && (GETPTI(pwnd) == ptiStart)) || 00187 (!(ptiStart->TIF_flags & TIF_16BIT) && (GETPTI(pwnd)->pq == ptiStart->pq))) { 00188 00189 if (!TestWF(pwnd, WFDISABLED) && TestWF(pwnd, WFVISIBLE)) { 00190 pwndT = pwnd->spwndOwner; 00191 00192 /* 00193 * If this window is the parent of a popup window, 00194 * bring up only one. 00195 */ 00196 while (pwndT) { 00197 if (pwndT == pwndStart) 00198 return pwnd; 00199 00200 pwndT = pwndT->spwndOwner; 00201 } 00202 00203 /* 00204 * Win9x continues looping only if pwnd is WEFTOPMOST. NT4 just returns, like Win3.1 00205 * As soon as we find a window on the queue, we stop. So if the queue owns 00206 * multiple top level unowned windows, then this code will probably not find 00207 * the enabled popup. Note that owned windows are supposed to be on top of the 00208 * owner, usally right on top of it (ie, pwnd->spwndNext == pwnd->spwndOwner) 00209 * so this code used to find any other top level unowned windows before the enabled 00210 * popup and bail. Odd. 00211 * So let's continue looping. Hopefully this won't cause any compatibility problems 00212 */ 00213 // return NULL; 00214 } 00215 } 00216 pwnd = pwnd->spwndNext; 00217 } 00218 00219 return NULL; 00220 }

UINT DWP_GetHotKey PWND   ) 
 

Definition at line 242 of file winhtky.c.

References HotKeyHelper(), tagHOTKEYSTRUCT::key, NULL, and UINT.

Referenced by xxxDefWindowProc().

00244 { 00245 PHOTKEYSTRUCT phk; 00246 00247 if ((phk = HotKeyHelper(pwnd)) == NULL) 00248 return 0; 00249 00250 return phk->key; 00251 }

HICON DWP_GetIcon PWND  pwnd,
UINT  uType
 

Definition at line 1022 of file dwp.c.

References _GetProp(), tagSERVERINFO::atomIconProp, tagSERVERINFO::atomIconSmProp, CURSORF_SECRET, gpsi, HMValidateHandleNoRip(), MAKEINTATOM, NULL, PROPF_INTERNAL, and TYPE_CURSOR.

Referenced by xxxDefWindowProc().

01025 { 01026 HICON hicoTemp; 01027 01028 if (uType < ICON_SMALL || uType > ICON_BIG) 01029 { 01030 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "WM_GETICON: Invalid wParam value (0x%X)", uType); 01031 return (HICON)NULL; 01032 } 01033 01034 /* 01035 * Get the icon from the window 01036 */ 01037 hicoTemp = (HICON)_GetProp(pwnd, 01038 MAKEINTATOM(uType == ICON_SMALL ? gpsi->atomIconSmProp : gpsi->atomIconProp), 01039 PROPF_INTERNAL); 01040 01041 /* 01042 * If it's a USER created small icon don't return it. 01043 */ 01044 if (uType == ICON_SMALL && hicoTemp) { 01045 PCURSOR pcurTemp; 01046 01047 pcurTemp = (PCURSOR)HMValidateHandleNoRip((HCURSOR)hicoTemp, TYPE_CURSOR); 01048 if (pcurTemp != NULL && (pcurTemp->CURSORF_flags & CURSORF_SECRET)) { 01049 hicoTemp = (HICON)NULL; 01050 } 01051 } 01052 01053 return hicoTemp; 01054 }

UINT DWP_SetHotKey PWND  ,
DWORD 
 

Definition at line 96 of file winhtky.c.

References BOOL, FALSE, gcHotKey, gcHotKeyAlloc, gpHotKeyList, HotKeyHelper(), HOTKEYSTRUCT, HotKeyToWindow(), tagHOTKEYSTRUCT::key, LOBYTE, Lock, NULL, tagHOTKEYSTRUCT::spwnd, TestWF, TRUE, UINT, Unlock, and WFCHILD.

Referenced by xxxCreateWindowEx(), xxxDefWindowProc(), and xxxDestroyWindow().

00099 { 00100 PHOTKEYSTRUCT phk; 00101 BOOL fKeyExists = FALSE; 00102 PWND pwndTemp; 00103 00104 /* 00105 * Filter out invalid hotkeys 00106 */ 00107 if (LOBYTE(dwKey) == VK_ESCAPE || 00108 LOBYTE(dwKey) == VK_SPACE || 00109 LOBYTE(dwKey) == VK_TAB || 00110 LOBYTE(dwKey) == VK_PACKET) { 00111 00112 return (UINT)-1; 00113 } 00114 00115 /* 00116 * Don't allow hotkeys for children 00117 */ 00118 if (TestWF(pwnd, WFCHILD)) 00119 return 0; 00120 00121 /* 00122 * Check if the hot key exists and is assigned to a different pwnd 00123 */ 00124 if (dwKey != 0) { 00125 00126 pwndTemp = HotKeyToWindow(dwKey); 00127 00128 if ((pwndTemp != NULL) && (pwndTemp != pwnd)) 00129 fKeyExists = TRUE; 00130 } 00131 00132 /* 00133 * Get the hotkey assigned to the window, if any 00134 */ 00135 if ((phk = HotKeyHelper(pwnd)) == NULL) { 00136 00137 /* 00138 * Window doesn't exist in the hotkey list and key is being set 00139 * to zero, so just return. 00140 */ 00141 if (dwKey == 0) 00142 return 1; 00143 00144 /* 00145 * Allocate and point to a spot for the new hotkey 00146 */ 00147 if (gcHotKey >= gcHotKeyAlloc) { 00148 00149 if (gcHotKeyAlloc) { 00150 00151 phk = (PHOTKEYSTRUCT)UserReAllocPool( 00152 (HANDLE)gpHotKeyList, 00153 gcHotKeyAlloc * sizeof(HOTKEYSTRUCT), 00154 (gcHotKey + 1) * sizeof(HOTKEYSTRUCT), TAG_HOTKEY); 00155 00156 if (phk != NULL) { 00157 00158 gpHotKeyList = phk; 00159 phk = &gpHotKeyList[gcHotKey++]; 00160 gcHotKeyAlloc = gcHotKey; 00161 00162 } else { 00163 00164 return 0; 00165 } 00166 00167 } else { 00168 00169 UserAssert(gpHotKeyList == NULL); 00170 UserAssert(gcHotKey == 0); 00171 00172 phk = (PHOTKEYSTRUCT)UserAllocPool(sizeof(HOTKEYSTRUCT), 00173 TAG_HOTKEY); 00174 00175 if (phk != NULL) { 00176 00177 gpHotKeyList = phk; 00178 gcHotKey = 1; 00179 gcHotKeyAlloc = 1; 00180 00181 } else { 00182 00183 return 0; 00184 } 00185 } 00186 00187 } else { 00188 phk = &gpHotKeyList[gcHotKey++]; 00189 } 00190 } 00191 00192 if (dwKey == 0) { 00193 00194 /* 00195 * The hotkey for this window is being deleted. Copy the last item 00196 * on the list on top of the one being deleted. 00197 */ 00198 if (--gcHotKey) { 00199 00200 Lock(&phk->spwnd, gpHotKeyList[gcHotKey].spwnd); 00201 Unlock(&gpHotKeyList[gcHotKey].spwnd); 00202 00203 phk->key = gpHotKeyList[gcHotKey].key; 00204 phk = (PHOTKEYSTRUCT)UserReAllocPool((HANDLE)gpHotKeyList, 00205 gcHotKeyAlloc * sizeof(HOTKEYSTRUCT), 00206 gcHotKey * sizeof(HOTKEYSTRUCT), TAG_HOTKEY); 00207 00208 if (phk != NULL) { 00209 gpHotKeyList = phk; 00210 gcHotKeyAlloc = gcHotKey; 00211 } 00212 00213 } else { 00214 00215 Unlock(&gpHotKeyList[gcHotKey].spwnd); 00216 UserFreePool((HANDLE)gpHotKeyList); 00217 gpHotKeyList = NULL; 00218 gcHotKeyAlloc = 0; 00219 } 00220 00221 } else { 00222 00223 /* 00224 * Add the window and key to the list 00225 */ 00226 phk->spwnd = NULL; 00227 Lock(&phk->spwnd, pwnd); 00228 phk->key = dwKey; 00229 } 00230 00231 return fKeyExists ? 2 : 1; 00232 }

void EnforceColorDependentSettings void   ) 
 

Definition at line 2782 of file w32/ntuser/kernel/init.c.

References FALSE, tagDISPLAYINFO::fAnyPalette, gbDisableAlpha, gpDispInfo, tagDISPLAYINFO::hdcScreen, and TRUE.

Referenced by LoadCPUserPreferences(), and UpdateUserScreen().

02783 { 02784 if (gpDispInfo->fAnyPalette) { 02785 gbDisableAlpha = TRUE; 02786 } else if (GreGetDeviceCaps(gpDispInfo->hdcScreen, NUMCOLORS) == -1) { 02787 gbDisableAlpha = FALSE; 02788 } else { 02789 gbDisableAlpha = TRUE; 02790 } 02791 }

VOID EnterCrit VOID   ) 
 

__inline VOID EnterDeviceInfoListCrit  ) 
 

Definition at line 7254 of file userk.h.

Referenced by CreateDeviceInfo(), InputApc(), NlsKbdSendIMENotification(), ProcessDeviceChanges(), RawInputThread(), RequestDeviceChange(), StartDeviceRead(), UpdateKeyLights(), UpdateMouseInfo(), and Win32kNtUserCleanup().

07264 {

__inline VOID EnterHandleFlagsCrit  ) 
 

Definition at line 7307 of file userk.h.

References FALSE, HF_PROTECTED, NTSTATUS(), NULL, and SetHandleFlag().

Referenced by CheckHandleFlag(), CheckHandleInUse(), SetHandleFlag(), SetHandleInUse(), and UserDeleteW32Process().

07309 { 07310 if (handle != NULL) {

__inline VOID EnterMouseCrit  ) 
 

Definition at line 7233 of file userk.h.

Referenced by QueueMouseEvent(), and UnqueueMouseEvent().

07243 {

VOID EnterSharedCrit VOID   ) 
 

_inline VOID EnterWowCritSect PTHREADINFO  pti,
PWOWPROCESSINFO  pwpi
 

Definition at line 5343 of file userk.h.

References VOID().

Referenced by xxxSleepTask(), and zzzInitTask().

05357 { 05358 if (!++pwpi->CSLockCount) { 05359 pwpi->CSOwningThread = pti; 05360 return;

__inline BOOL ExitMenuLoop PMENUSTATE  pMenuState,
PPOPUPMENU  ppopupmenu
 

Definition at line 4723 of file userk.h.

Referenced by xxxCallHandleMenuMessages(), xxxHandleMenuMessages(), xxxMNLoop(), xxxTrackPopupMenuEx(), xxxUnlockMenuState(), and zzzAttachToQueue().

04730 {

_inline VOID ExitWowCritSect PTHREADINFO  pti,
PWOWPROCESSINFO  pwpi
 

Definition at line 5364 of file userk.h.

Referenced by DestroyTask(), and xxxSleepTask().

05378 {

DWORD FastGetProfileDwordW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
DWORD  dwDefault
 

Definition at line 575 of file w32/ntuser/kernel/profile.c.

References BYTE, DWORD, gbRemoteSession, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), and Status.

Referenced by IsIMMEnabledSystem(), OpenMultiplePortDevice(), SetDebugHotKeys(), Win32UserInitialize(), and xxxUpdatePerUserSystemParameters().

00580 { 00581 HANDLE hKey; 00582 DWORD cbSize; 00583 DWORD dwRet; 00584 LONG Status; 00585 UNICODE_STRING UnicodeString; 00586 BYTE Buf[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD)]; 00587 00588 UserAssert(idSection <= PMAP_LAST); 00589 00590 if (gbRemoteSession) { 00591 00592 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 00593 if (hKey != NULL) { 00594 goto Override; 00595 } 00596 } 00597 00598 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00599 idSection, 00600 KEY_READ, 00601 NULL)) == NULL) { 00602 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 00603 return dwDefault; 00604 } 00605 00606 Override: 00607 00608 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00609 Status = ZwQueryValueKey(hKey, 00610 &UnicodeString, 00611 KeyValuePartialInformation, 00612 (PKEY_VALUE_PARTIAL_INFORMATION)Buf, 00613 sizeof(Buf), 00614 &cbSize); 00615 00616 dwRet = dwDefault; 00617 00618 if (NT_SUCCESS(Status)) { 00619 00620 dwRet = *((PDWORD)((PKEY_VALUE_PARTIAL_INFORMATION)Buf)->Data); 00621 00622 } else if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { 00623 00624 RIPMSG1(RIP_WARNING, 00625 "FastGetProfileDwordW: ObjectName not found: %ws", 00626 lpKeyName); 00627 } 00628 00629 ZwClose(hKey); 00630 00631 return dwRet; 00632 }

int FastGetProfileIntFromID PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  idKey,
int  def
 

Definition at line 1031 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, FastGetProfileIntW(), gpsi, hModuleWin, MultDiv, PMAP_LAST, and ServerLoadString.

Referenced by LW_LoadProfileInitData(), MetricGetID(), and xxxUpdatePerUserSystemParameters().

01036 { 01037 int result; 01038 WCHAR szKey[80]; 01039 01040 01041 UserAssert(idSection <= PMAP_LAST); 01042 01043 ServerLoadString(hModuleWin, idKey, szKey, ARRAY_SIZE(szKey)); 01044 01045 result = FastGetProfileIntW(pProfileUserName,idSection, szKey, def); 01046 01047 /* 01048 * If you change the below list of STR_* make sure you make a 01049 * corresponding change in SetWindowMetricInt (rare.c) 01050 */ 01051 switch (idKey) { 01052 case STR_BORDERWIDTH: 01053 case STR_SCROLLWIDTH: 01054 case STR_SCROLLHEIGHT: 01055 case STR_CAPTIONWIDTH: 01056 case STR_CAPTIONHEIGHT: 01057 case STR_SMCAPTIONWIDTH: 01058 case STR_SMCAPTIONHEIGHT: 01059 case STR_MENUWIDTH: 01060 case STR_MENUHEIGHT: 01061 case STR_ICONHORZSPACING: 01062 case STR_ICONVERTSPACING: 01063 case STR_MINWIDTH: 01064 case STR_MINHORZGAP: 01065 case STR_MINVERTGAP: 01066 /* 01067 * Convert any registry values stored in TWIPS back to pixels 01068 */ 01069 if (result < 0) 01070 result = MultDiv(-result, gpsi->dmLogPixels, 72 * 20); 01071 break; 01072 } 01073 01074 return result; 01075 }

BOOL FastGetProfileIntsW PUNICODE_STRING pProfileUserName  OPTIONAL,
PPROFINTINFO  ppii
 

Definition at line 1290 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FastGetProfileIntW(), hModuleWin, tagPROFINTINFO::idSection, tagPROFINTINFO::lpKeyName, tagPROFINTINFO::nDefault, PPROFINTINFO, PTR_TO_ID, tagPROFINTINFO::puResult, ServerLoadString, and TRUE.

Referenced by xxxSetDeskWallpaper(), and xxxUpdatePerUserSystemParameters().

01293 { 01294 WCHAR szKey[40]; 01295 01296 while (ppii->idSection != 0) { 01297 01298 ServerLoadString(hModuleWin, 01299 PTR_TO_ID(ppii->lpKeyName), 01300 szKey, 01301 ARRAY_SIZE(szKey)); 01302 01303 *ppii->puResult = FastGetProfileIntW(pProfileUserName, 01304 ppii->idSection, 01305 szKey, 01306 ppii->nDefault 01307 ); 01308 ppii++; 01309 } 01310 01311 return TRUE; 01312 }

UINT FastGetProfileIntW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
UINT  nDefault
 

Definition at line 945 of file w32/ntuser/kernel/profile.c.

References FastGetProfileStringW(), NULL, PMAP_LAST, RtlInitUnicodeString(), RtlUnicodeStringToInteger(), and UINT.

Referenced by FastGetProfileIntFromID(), FastGetProfileIntsW(), GetKbdLangSwitch(), UpdatePerUserKeyboardIndicators(), xxxUpdatePerUserAccessPackSettings(), and xxxUpdatePerUserSystemParameters().

00950 { 00951 WCHAR ValueBuf[40]; 00952 UNICODE_STRING Value; 00953 UINT ReturnValue; 00954 00955 UserAssert(idSection <= PMAP_LAST); 00956 00957 if (!FastGetProfileStringW(pProfileUserName, 00958 idSection, 00959 lpKeyName, 00960 NULL, 00961 ValueBuf, 00962 sizeof(ValueBuf) / sizeof(WCHAR) 00963 )) { 00964 00965 return nDefault; 00966 } 00967 00968 /* 00969 * Convert string to int. 00970 */ 00971 RtlInitUnicodeString(&Value, ValueBuf); 00972 RtlUnicodeStringToInteger(&Value, 10, &ReturnValue); 00973 00974 return ReturnValue; 00975 }

DWORD FastGetProfileKeysW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  pszDefault,
LPWSTR *  ppszKeys
 

Definition at line 642 of file w32/ntuser/kernel/profile.c.

References Buffer, DWORD, L, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, Status, and TRUE.

Referenced by bEnumerateRegistryFonts().

00647 { 00648 HANDLE hKey; 00649 DWORD cchSize; 00650 DWORD cchKey; 00651 LONG Status; 00652 WCHAR Buffer[256 + 6]; 00653 PKEY_VALUE_BASIC_INFORMATION pKeyInfo; 00654 ULONG iValue; 00655 LPWSTR lpTmp; 00656 LPWSTR lpKeys = NULL; 00657 DWORD dwPoolSize; 00658 00659 UserAssert(idSection <= PMAP_LAST); 00660 00661 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00662 idSection, 00663 KEY_READ, 00664 NULL)) == NULL) { 00665 RIPMSG0(RIP_WARNING | RIP_NONAME, ""); 00666 goto DefExit; 00667 } 00668 00669 pKeyInfo = (PKEY_VALUE_BASIC_INFORMATION)Buffer; 00670 cchSize = 0; 00671 *lpReturnedString = NULL; 00672 iValue = 0; 00673 00674 while (TRUE) { 00675 00676 #if DBG 00677 wcscpy(Buffer + 256, L"DON'T"); 00678 #endif 00679 Status = ZwEnumerateValueKey(hKey, 00680 iValue, 00681 KeyValueBasicInformation, 00682 pKeyInfo, 00683 sizeof(Buffer), 00684 &cchKey); 00685 00686 UserAssert(_wcsicmp(Buffer + 256, L"DON'T") == 0); 00687 00688 if (Status == STATUS_NO_MORE_ENTRIES) { 00689 00690 break; 00691 00692 } else if (!NT_SUCCESS(Status)) { 00693 00694 if (lpKeys) { 00695 UserFreePool(lpKeys); 00696 lpKeys = NULL; 00697 } 00698 goto DefExit; 00699 } 00700 00701 UserAssert(pKeyInfo->NameLength * sizeof(WCHAR) <= 00702 sizeof(Buffer) - sizeof(KEY_VALUE_BASIC_INFORMATION)); 00703 00704 UserAssert(cchKey <= sizeof(Buffer)); 00705 00706 /* 00707 * A key was found. Allocate space for it. Note that 00708 * NameLength is in bytes. 00709 */ 00710 cchKey = cchSize; 00711 cchSize += pKeyInfo->NameLength + sizeof(WCHAR); 00712 00713 if (lpKeys == NULL) { 00714 00715 dwPoolSize = cchSize + sizeof(WCHAR); 00716 lpKeys = UserAllocPoolWithQuota(dwPoolSize, TAG_PROFILE); 00717 00718 } else { 00719 00720 lpTmp = lpKeys; 00721 lpKeys = UserReAllocPoolWithQuota(lpTmp, 00722 dwPoolSize, 00723 cchSize + sizeof(WCHAR), 00724 TAG_PROFILE); 00725 00726 /* 00727 * Free the original buffer if the allocation fails 00728 */ 00729 if (lpKeys == NULL) { 00730 UserFreePool(lpTmp); 00731 } 00732 dwPoolSize = cchSize + sizeof(WCHAR); 00733 } 00734 00735 /* 00736 * Check for out of memory. 00737 */ 00738 if (lpKeys == NULL) 00739 goto DefExit; 00740 00741 /* 00742 * NULL terminate the string and append it to 00743 * the key list. 00744 */ 00745 UserAssert(pKeyInfo->NameLength < sizeof(Buffer) - sizeof(KEY_VALUE_BASIC_INFORMATION)); 00746 00747 RtlCopyMemory(&lpKeys[cchKey / sizeof(WCHAR)], pKeyInfo->Name, pKeyInfo->NameLength); 00748 lpKeys[(cchKey + pKeyInfo->NameLength) / sizeof(WCHAR)] = 0; 00749 00750 iValue++; 00751 } 00752 00753 /* 00754 * If no keys were found, return the default. 00755 */ 00756 if (iValue == 0) { 00757 00758 DefExit: 00759 00760 cchSize = wcslen(lpDefault)+1; 00761 lpKeys = UserAllocPoolWithQuota((cchSize+1) * sizeof(WCHAR), TAG_PROFILE); 00762 00763 if (lpKeys) 00764 wcscpy(lpKeys, lpDefault); 00765 else 00766 cchSize = 0; 00767 00768 } else { 00769 00770 /* 00771 * Turn the byte count into a char count. 00772 */ 00773 cchSize /= sizeof(WCHAR); 00774 } 00775 00776 /* 00777 * Make sure hKey is closed. 00778 */ 00779 if (hKey) 00780 ZwClose(hKey); 00781 00782 /* 00783 * Append the ending NULL. 00784 */ 00785 if (lpKeys) 00786 lpKeys[cchSize] = 0; 00787 00788 *lpReturnedString = lpKeys; 00789 00790 return cchSize; 00791 }

DWORD FastGetProfileStringFromIDW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  idKey,
LPCWSTR  lpDefault,
LPWSTR  lpReturnedString,
DWORD  cch
 

Definition at line 1086 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, DWORD, FastGetProfileStringW(), hModuleWin, PMAP_LAST, and ServerLoadString.

Referenced by GetDeskWallpaperName(), LW_LoadResources(), xxxODI_ColorInit(), xxxSetDeskPattern(), xxxSystemParametersInfo(), xxxUpdateSystemCursorsFromRegistry(), and xxxUpdateSystemIconsFromRegistry().

01093 { 01094 WCHAR szKey[80]; 01095 01096 UserAssert(idSection <= PMAP_LAST); 01097 01098 ServerLoadString(hModuleWin, idKey, szKey, ARRAY_SIZE(szKey)); 01099 01100 return FastGetProfileStringW(pProfileUserName, 01101 idSection, 01102 szKey, 01103 lpDefault, 01104 lpReturnedString, 01105 cch 01106 ); 01107 }

DWORD FastGetProfileStringW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPCWSTR  lpDefault,
LPWSTR  lpReturnedString,
DWORD  nSize
 

Definition at line 806 of file w32/ntuser/kernel/profile.c.

References BOOL, DWORD, FALSE, gbRemoteSession, gdwPolicyFlags, gpidLogon, L, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PsGetCurrentProcess, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), Status, and TRUE.

Referenced by bEnumerateRegistryFonts(), FastGetProfileIntW(), FastGetProfileStringFromIDW(), InitCreateUserSubsystem(), OpenMultiplePortDevice(), SetAppCompatFlags(), SetAppImeCompatFlags(), and xxxUpdatePerUserAccessPackSettings().

00813 { 00814 HANDLE hKey = NULL; 00815 DWORD cbSize; 00816 LONG Status; 00817 UNICODE_STRING UnicodeString; 00818 PKEY_VALUE_PARTIAL_INFORMATION pKeyInfo; 00819 BOOL bRemoteOverride = FALSE; 00820 DWORD dwPolicyFlags = gdwPolicyFlags; 00821 00822 00823 UserAssert(idSection <= PMAP_LAST); 00824 UserAssert(lpKeyName != NULL); 00825 00826 if (gbRemoteSession) { 00827 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 00828 if (hKey != NULL) { 00829 bRemoteOverride = TRUE; 00830 goto Override; 00831 } 00832 } 00833 00834 TryAgain: 00835 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00836 idSection, 00837 KEY_READ, 00838 &dwPolicyFlags)) == NULL) { 00839 00840 #if DBG 00841 if (PsGetCurrentProcess()->UniqueProcessId != gpidLogon) { 00842 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 00843 } 00844 #endif 00845 goto DefExit; 00846 } 00847 00848 Override: 00849 00850 cbSize = (cchBuf * sizeof(WCHAR)) + 00851 FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); 00852 00853 if ((pKeyInfo = UserAllocPoolWithQuota(cbSize, TAG_PROFILE)) == NULL) 00854 goto DefExit; 00855 00856 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00857 Status = ZwQueryValueKey(hKey, 00858 &UnicodeString, 00859 KeyValuePartialInformation, 00860 pKeyInfo, 00861 cbSize, 00862 &cbSize); 00863 00864 if (Status == STATUS_BUFFER_OVERFLOW) { 00865 RIPMSG0(RIP_WARNING, "FastGetProfileStringW: Buffer overflow"); 00866 Status = STATUS_SUCCESS; 00867 } 00868 00869 UserAssert(NT_SUCCESS(Status) || (Status == STATUS_OBJECT_NAME_NOT_FOUND)); 00870 00871 if (NT_SUCCESS(Status)) { 00872 00873 if (pKeyInfo->DataLength >= sizeof(WCHAR)) { 00874 00875 ((LPWSTR)(pKeyInfo->Data))[cchBuf - 1] = L'\0'; 00876 wcscpy(lpReturnedString, (LPWSTR)pKeyInfo->Data); 00877 00878 } else { 00879 /* 00880 * Appears to be a bug with empty strings - only first 00881 * byte is set to NULL. (SAS) 00882 */ 00883 lpReturnedString[0] = TEXT('\0'); 00884 } 00885 00886 cchBuf = pKeyInfo->DataLength; 00887 00888 UserFreePool(pKeyInfo); 00889 00890 ZwClose(hKey); 00891 00892 /* 00893 * data length includes terminating zero [bodind] 00894 */ 00895 return (cchBuf / sizeof(WCHAR)); 00896 00897 } else if (bRemoteOverride) { 00898 bRemoteOverride = FALSE; 00899 UserFreePool(pKeyInfo); 00900 ZwClose(hKey); 00901 hKey = NULL; 00902 goto TryAgain; 00903 00904 } else if (dwPolicyFlags) { 00905 UserFreePool(pKeyInfo); 00906 ZwClose(hKey); 00907 goto TryAgain; 00908 } 00909 00910 UserFreePool(pKeyInfo); 00911 00912 DefExit: 00913 00914 /* 00915 * Make sure the key is closed. 00916 */ 00917 if (hKey) 00918 ZwClose(hKey); 00919 00920 /* 00921 * wcscopy copies terminating zero, but the length returned by 00922 * wcslen does not, so add 1 to be consistent with success 00923 * return [bodind] 00924 */ 00925 if (lpDefault != NULL) { 00926 cchBuf = wcslen(lpDefault) + 1; 00927 RtlCopyMemory(lpReturnedString, lpDefault, cchBuf * sizeof(WCHAR)); 00928 return cchBuf; 00929 } 00930 00931 return 0; 00932 }

DWORD FastGetProfileValue PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPBYTE  lpDefault,
LPBYTE  lpReturn,
UINT  cbSizeReturn
 

Definition at line 1173 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, DWORD, gbRemoteSession, hModuleWin, IS_PTR, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PTR_TO_ID, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), ServerLoadString, SERVERSTRINGMAXSIZE, Status, and UINT.

Referenced by CreateFontFromWinIni(), CreateSetupNameArray(), InitScancodeMap(), LoadCPUserPreferences(), SetAppCompatFlags(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

01180 { 01181 HANDLE hKey; 01182 UINT cbSize; 01183 LONG Status; 01184 UNICODE_STRING UnicodeString; 01185 PKEY_VALUE_PARTIAL_INFORMATION pKeyInfo; 01186 WCHAR szKey[SERVERSTRINGMAXSIZE]; 01187 KEY_VALUE_PARTIAL_INFORMATION KeyInfo; 01188 01189 UserAssert(idSection <= PMAP_LAST); 01190 01191 if (!IS_PTR(lpKeyName)) { 01192 *szKey = (WCHAR)0; 01193 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 01194 UserAssert(*szKey != (WCHAR)0); 01195 lpKeyName = szKey; 01196 } 01197 01198 if (gbRemoteSession) { 01199 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 01200 if (hKey != NULL) { 01201 goto Override; 01202 } 01203 } 01204 01205 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01206 idSection, 01207 KEY_READ, 01208 NULL)) == NULL) { 01209 // if hi-word of lpKeName is 0, it is a resource number not a string 01210 01211 if (!IS_PTR(lpKeyName)) 01212 RIPMSG1(RIP_WARNING, "FastGetProfileValue: Failed to open cache-key (%08x)", lpKeyName); 01213 else 01214 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 01215 01216 goto DefExit; 01217 } 01218 01219 Override: 01220 01221 if (cbSizeReturn == 0) { 01222 cbSize = sizeof(KeyInfo); 01223 pKeyInfo = &KeyInfo; 01224 } else { 01225 cbSize = cbSizeReturn + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); 01226 if ((pKeyInfo = UserAllocPoolWithQuota(cbSize, TAG_PROFILE)) == NULL) { 01227 goto DefExit; 01228 } 01229 } 01230 01231 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01232 01233 Status = ZwQueryValueKey(hKey, 01234 &UnicodeString, 01235 KeyValuePartialInformation, 01236 pKeyInfo, 01237 cbSize, 01238 &cbSize); 01239 01240 if (NT_SUCCESS(Status)) { 01241 01242 UserAssert(cbSizeReturn >= pKeyInfo->DataLength); 01243 01244 cbSize = pKeyInfo->DataLength; 01245 RtlCopyMemory(lpReturn, pKeyInfo->Data, cbSize); 01246 01247 if (cbSizeReturn != 0) { 01248 UserFreePool(pKeyInfo); 01249 } 01250 ZwClose(hKey); 01251 01252 return cbSize; 01253 } else if ((Status == STATUS_BUFFER_OVERFLOW) && (cbSizeReturn == 0)) { 01254 ZwClose(hKey); 01255 return pKeyInfo->DataLength; 01256 } 01257 01258 #if DBG 01259 if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { 01260 RIPMSG3 (RIP_WARNING, "FastGetProfileValue: ZwQueryValueKey Failed. Status:%#lx idSection:%#lx KeyName:%s", 01261 Status, idSection, UnicodeString.Buffer); 01262 } 01263 #endif 01264 01265 if (cbSizeReturn != 0) { 01266 UserFreePool(pKeyInfo); 01267 } 01268 01269 DefExit: 01270 01271 if (hKey) 01272 ZwClose(hKey); 01273 01274 if (lpDefault) { 01275 RtlMoveMemory(lpReturn, lpDefault, cbSizeReturn); 01276 return cbSizeReturn; 01277 } 01278 01279 return 0; 01280 }

BOOL FastUpdateWinIni PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  wKeyNameId,
LPWSTR  lpszValue
 

Definition at line 1323 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FALSE, FastWriteProfileStringW(), hModuleWin, PMAP_LAST, and ServerLoadString.

Referenced by xxxSystemParametersInfo().

01328 { 01329 WCHAR szKeyName[40]; 01330 BOOL bResult = FALSE; 01331 01332 UserAssert(idSection <= PMAP_LAST); 01333 01334 ServerLoadString(hModuleWin, 01335 wKeyNameId, 01336 szKeyName, 01337 ARRAY_SIZE(szKeyName)); 01338 01339 bResult = FastWriteProfileStringW(pProfileUserName, 01340 idSection, szKeyName, lpszValue); 01341 01342 return bResult; 01343 }

PWND FastWindowFromDC HDC  hdc  ) 
 

Definition at line 2022 of file dc.c.

References tagDCE::DCX_flags, gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, and tagDCE::pwndOrg.

Referenced by _ScrollDC().

02024 { 02025 PDCE *ppdce; 02026 PDCE pdceT; 02027 02028 if ((gpDispInfo->pdceFirst->hdc == hdc) && 02029 (gpDispInfo->pdceFirst->DCX_flags & DCX_INUSE)) { 02030 02031 return gpDispInfo->pdceFirst->pwndOrg; 02032 } 02033 02034 for (ppdce = &gpDispInfo->pdceFirst; *ppdce; ppdce = &(*ppdce)->pdceNext) { 02035 02036 if (((*ppdce)->hdc == hdc) && ((*ppdce)->DCX_flags & DCX_INUSE)) { 02037 02038 /* 02039 * Unlink/link to make it first. 02040 */ 02041 pdceT = *ppdce; 02042 *ppdce = pdceT->pdceNext; 02043 pdceT->pdceNext = gpDispInfo->pdceFirst; 02044 gpDispInfo->pdceFirst = pdceT; 02045 02046 return pdceT->pwndOrg; 02047 } 02048 } 02049 02050 return NULL; 02051 }

BOOL FastWriteProfileStringW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPCWSTR  lpString
 

Definition at line 988 of file w32/ntuser/kernel/profile.c.

References BOOL, FALSE, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, RtlInitUnicodeString(), and Status.

Referenced by FastUpdateWinIni(), RegisterPerUserKeyboardIndicators(), SetFilterKeys(), SetMouseKeys(), SetSoundSentry(), UpdateWinIniInt(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00993 { 00994 HANDLE hKey; 00995 LONG Status; 00996 UNICODE_STRING UnicodeString; 00997 00998 UserAssert(idSection <= PMAP_LAST); 00999 01000 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01001 idSection, 01002 KEY_WRITE, 01003 NULL)) == NULL) { 01004 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 01005 return FALSE; 01006 } 01007 01008 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01009 Status = ZwSetValueKey(hKey, 01010 &UnicodeString, 01011 0, 01012 REG_SZ, 01013 (PVOID)lpString, 01014 (wcslen(lpString) + 1) * sizeof(WCHAR)); 01015 01016 ZwClose(hKey); 01017 01018 return (NT_SUCCESS(Status)); 01019 }

BOOL FastWriteProfileValue PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
UINT  uType,
LPBYTE  lpStruct,
UINT  cbSizeStruct
 

Definition at line 1115 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FALSE, hModuleWin, IS_PTR, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PTR_TO_ID, RtlInitUnicodeString(), ServerLoadString, SERVERSTRINGMAXSIZE, and Status.

Referenced by SetWindowMetricFont(), and xxxSystemParametersInfo().

01122 { 01123 HANDLE hKey; 01124 LONG Status; 01125 UNICODE_STRING UnicodeString; 01126 WCHAR szKey[SERVERSTRINGMAXSIZE]; 01127 01128 UserAssert(idSection <= PMAP_LAST); 01129 01130 if (!IS_PTR(lpKeyName)) { 01131 *szKey = (WCHAR)0; 01132 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 01133 UserAssert(*szKey != (WCHAR)0); 01134 lpKeyName = szKey; 01135 } 01136 01137 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01138 idSection, 01139 KEY_WRITE, 01140 NULL)) == NULL) { 01141 RIPMSG1(RIP_WARNING, "FastWriteProfileValue: Failed to open cache-key (%ws)", lpKeyName); 01142 return FALSE; 01143 } 01144 01145 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01146 01147 Status = ZwSetValueKey(hKey, 01148 &UnicodeString, 01149 0, 01150 uType, 01151 lpStruct, 01152 cbSizeStruct); 01153 ZwClose(hKey); 01154 01155 #if DBG 01156 if (!NT_SUCCESS(Status)) { 01157 RIPMSG3 (RIP_WARNING, "FastWriteProfileValue: ZwSetValueKey Failed. Status:%#lx idSection:%#lx KeyName:%s", 01158 Status, idSection, UnicodeString.Buffer); 01159 } 01160 #endif 01161 01162 return (NT_SUCCESS(Status)); 01163 }

BOOL FBadWindow PWND  pwnd  ) 
 

Definition at line 365 of file focusact.c.

References BOOL, NULL, TestWF, WFDISABLED, and WFVISIBLE.

Referenced by xxxActivateWindow(), and xxxMenuWindowProc().

00367 { 00368 return (pwnd == NULL 00369 || !TestWF(pwnd, WFVISIBLE) 00370 || TestWF(pwnd, WFDISABLED)); 00371 }

BOOL FCallerOk PWND  pwnd  ) 
 

Definition at line 104 of file ntuser/kernel/getset.c.

References BOOL, FALSE, GETPTI, gpidLogon, PtiCurrent, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, and TRUE.

Referenced by _SetWindowWord(), and xxxSetWindowLongPtr().

00106 { 00107 PTHREADINFO pti = PtiCurrent(); 00108 00109 if ((GETPTI(pwnd)->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) && 00110 !(pti->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD))) { 00111 return FALSE; 00112 } 00113 00114 if (GETPTI(pwnd)->pEThread->Cid.UniqueProcess == gpidLogon && 00115 pti->pEThread->Cid.UniqueProcess != gpidLogon) { 00116 return FALSE; 00117 } 00118 00119 return TRUE; 00120 }

BOOL FHungApp PTHREADINFO  pti,
DWORD  dwTimeFromLastRead
 

Definition at line 80 of file hungapp.c.

References BOOL, FALSE, tagCLIENTTHREADINFO::fsWakeMask, GET_TIME_LAST_READ, NtGetTickCount(), tagTHREADINFO::pcti, tagTHREADINFO::ppi, and TRUE.

Referenced by IdleTimerProc(), InterQueueMsgCleanup(), NtUserQueryWindow(), xxxButtonEvent(), xxxCallHook2(), xxxDesktopThread(), xxxDesktopWndProc(), xxxHungAppDemon(), xxxInterSendMsgEx(), xxxQueryInformationThread(), xxxRedrawHungWindow(), xxxSendMessageTimeout(), xxxSetForegroundWindow2(), and xxxSimpleDoSyncPaint().

00083 { 00084 00085 /* 00086 * An app is considered hung if it isn't waiting for input, isn't in 00087 * startup processing, and hasn't called PeekMessage() within the 00088 * specified timeout. 00089 */ 00090 if (((NtGetTickCount() - GET_TIME_LAST_READ(pti)) > dwTimeFromLastRead) && 00091 !((pti->pcti->fsWakeMask & QS_INPUT) && (pti->pEThread->Tcb.FreezeCount == 0)) && 00092 !(pti->ppi->W32PF_Flags & W32PF_APPSTARTING)) { 00093 return TRUE; 00094 } 00095 00096 return FALSE; 00097 }

BOOL FinalUserInit  ) 
 

Referenced by xxxInitWindowStation().

LONG FindBestPos int  x,
int  y,
int  cx,
int  cy,
LPRECT  prcExclude,
UINT  wFlags,
PPOPUPMENU  ppopupmenu,
PMONITOR  pMonitor
 

Definition at line 496 of file mnpopup.c.

References COPY_FLAG, CopyRect, cy, tagPOPUPMENU::iDropDir, IntersectRect(), NULL, PAS_DOWN, PAS_HORZ, PAS_LEFT, PAS_RIGHT, PAS_UP, PAS_VERT, tagMONITOR::rcMonitor, RECT_ONBOTTOM, RECT_ONLEFT, RECT_ONRIGHT, RECT_ONTOP, RECT_ORG, SetRect(), TryRect(), and UINT.

Referenced by xxxMenuWindowProc(), and xxxTrackPopupMenuEx().

00505 { 00506 int iRect; 00507 int iT; 00508 UINT awRect[4]; 00509 POINT ptT; 00510 RECT rcExclude; 00511 // 00512 // Clip our coords on screen first. We use the same algorithm to clip 00513 // as in Win3.1 for dudes with no exclude rect. 00514 // 00515 00516 if (prcExclude!=NULL) { 00517 // Clip exclude rect to monitor! 00518 CopyRect(&rcExclude, prcExclude); 00519 IntersectRect(&rcExclude, &rcExclude, &pMonitor->rcMonitor); 00520 } else { 00521 SetRect(&rcExclude, x, y, x, y); 00522 } 00523 00524 00525 /* 00526 * Make sure popup fits completely on the screen 00527 * At least the x,y point will be on the screen. 00528 */ 00529 if (x + cx > pMonitor->rcMonitor.right) { 00530 if ((wFlags & TPM_CENTERALIGN) 00531 || (x - cx < pMonitor->rcMonitor.left) 00532 || (x >= pMonitor->rcMonitor.right)) { 00533 x = pMonitor->rcMonitor.right - cx; 00534 } else { 00535 x -= cx; 00536 } 00537 if (ppopupmenu->iDropDir & PAS_HORZ) { 00538 COPY_FLAG(ppopupmenu->iDropDir, PAS_LEFT, PAS_HORZ); 00539 } 00540 } 00541 00542 if (x < pMonitor->rcMonitor.left) { 00543 x += cx; 00544 if ((wFlags & TPM_CENTERALIGN) 00545 || (x >= pMonitor->rcMonitor.right) 00546 || (x < pMonitor->rcMonitor.left)) { 00547 x = pMonitor->rcMonitor.left; 00548 } 00549 if (ppopupmenu->iDropDir & PAS_HORZ) { 00550 COPY_FLAG(ppopupmenu->iDropDir, PAS_RIGHT, PAS_HORZ); 00551 } 00552 } 00553 00554 00555 if (y + cy > pMonitor->rcMonitor.bottom) { 00556 if ((wFlags & TPM_VCENTERALIGN) 00557 || (y - cy < pMonitor->rcMonitor.top) 00558 || (y >= pMonitor->rcMonitor.bottom)) { 00559 y = pMonitor->rcMonitor.bottom - cy; 00560 } else { 00561 y -= cy; 00562 } 00563 if (ppopupmenu->iDropDir & PAS_VERT) { 00564 COPY_FLAG(ppopupmenu->iDropDir, PAS_UP, PAS_VERT); 00565 } 00566 } 00567 00568 if (y < pMonitor->rcMonitor.top) { 00569 y += cy; 00570 if ((wFlags & TPM_VCENTERALIGN) 00571 || (y >= pMonitor->rcMonitor.bottom) 00572 || (y < pMonitor->rcMonitor.top)) { 00573 y = pMonitor->rcMonitor.top; 00574 } 00575 if (ppopupmenu->iDropDir & PAS_VERT) { 00576 COPY_FLAG(ppopupmenu->iDropDir, PAS_DOWN, PAS_VERT); 00577 } 00578 } 00579 00580 // 00581 // Try first point 00582 // 00583 if (TryRect(RECT_ORG, x, y, cx, cy, &rcExclude, &ptT, pMonitor)) 00584 goto FOUND; 00585 00586 // 00587 // Sort possibilities. Get offset of horizontal rects. 00588 // 00589 iRect = (wFlags & TPM_VERTICAL) ? 2 : 0; 00590 00591 // 00592 // Sort horizontally. Note that we treat TPM_CENTERALIGN like 00593 // TPM_LEFTALIGN. 00594 // 00595 // 00596 // If we're right-aligned, try to right-align on left side first. 00597 // Otherwise, try to left-align on right side first. 00598 // 00599 iT = (wFlags & TPM_RIGHTALIGN) ? 0 : 2; 00600 00601 awRect[0 + iRect] = RECT_ONLEFT + iT; 00602 awRect[1 + iRect] = RECT_ONRIGHT - iT; 00603 00604 // 00605 // Sort vertically. Note that we treat TPM_VCENTERALIGN like 00606 // TPM_TOPALIGN. 00607 // 00608 // If we're bottom-aligned, try to bottom-align with top of rect 00609 // first. Otherwise, try to top-align with bottom of exclusion first. 00610 // 00611 iT = (wFlags & TPM_BOTTOMALIGN) ? 0 : 2; 00612 00613 awRect[2 - iRect] = RECT_ONTOP + iT; 00614 awRect[3 - iRect] = RECT_ONBOTTOM - iT; 00615 00616 // 00617 // Loop through sorted alternatives. Note that TryRect fails immediately 00618 // if an exclusion coordinate is too close to screen edge. 00619 // 00620 00621 for (iRect = 0; iRect < 4; iRect++) { 00622 if (TryRect(awRect[iRect], x, y, cx, cy, &rcExclude, &ptT, pMonitor)) { 00623 switch (awRect[iRect]) 00624 { 00625 case RECT_ONTOP: 00626 ppopupmenu->iDropDir = PAS_UP; 00627 break; 00628 case RECT_ONLEFT: 00629 ppopupmenu->iDropDir = PAS_LEFT; 00630 break; 00631 case RECT_ONBOTTOM: 00632 ppopupmenu->iDropDir = PAS_DOWN; 00633 break; 00634 case RECT_ONRIGHT: 00635 ppopupmenu->iDropDir = PAS_RIGHT; 00636 break; 00637 } 00638 00639 x = ptT.x; 00640 y = ptT.y; 00641 break; 00642 } 00643 } 00644 00645 FOUND: 00646 return MAKELONG(x, y); 00647 }

PCLIP FindClipFormat PWINDOWSTATION  pwinsta,
UINT  format
 

Definition at line 2482 of file ntuser/kernel/clipbrd.c.

References tagWINDOWSTATION::cNumClipFormats, tagCLIP::fmt, format, NULL, and tagWINDOWSTATION::pClipBase.

Referenced by _EnumClipboardFormats(), InternalSetClipboardData(), MungeClipData(), NtUserIsClipboardFormatAvailable(), xxxGetClipboardData(), xxxGetDummyBitmap(), xxxGetDummyDib(), xxxGetDummyDibV5(), xxxGetDummyPalette(), xxxGetDummyText(), and xxxGetRenderData().

02485 { 02486 PCLIP pClip; 02487 int iFmt; 02488 02489 if ((format != 0) && ((pClip = pwinsta->pClipBase) != NULL)) { 02490 02491 for (iFmt = pwinsta->cNumClipFormats; iFmt-- != 0;) { 02492 02493 if (pClip->fmt == format) 02494 return pClip; 02495 02496 pClip++; 02497 } 02498 } 02499 02500 return NULL; 02501 }

PHOTKEY FindHotKey PTHREADINFO  pti,
PWND  pwnd,
int  id,
UINT  fsModifiers,
UINT  vk,
BOOL  fUnregister,
PBOOL  pfKeysExist
 

Definition at line 290 of file hotkeys.c.

References FALSE, tagHOTKEY::fsModifiers, gphkFirst, tagHOTKEY::id, NULL, tagHOTKEY::phkNext, tagHOTKEY::pti, PWND_FOCUS, PWND_INPUTOWNER, tagHOTKEY::spwnd, TRUE, Unlock, and tagHOTKEY::vk.

Referenced by _RegisterHotKey(), and _UnregisterHotKey().

00298 { 00299 PHOTKEY phk, phkRet, phkPrev; 00300 00301 /* 00302 * Initialize out 'return' values. 00303 */ 00304 *pfKeysExist = FALSE; 00305 phkRet = NULL; 00306 00307 phk = gphkFirst; 00308 00309 while (phk) { 00310 00311 /* 00312 * If all this matches up then we've found it. 00313 */ 00314 if ((phk->pti == ptiCurrent) && (phk->spwnd == pwnd) && (phk->id == id)) { 00315 if (fUnregister) { 00316 00317 /* 00318 * Unlink the HOTKEY from the list. 00319 */ 00320 if (phk == gphkFirst) { 00321 gphkFirst = phk->phkNext; 00322 } else { 00323 phkPrev->phkNext = phk->phkNext; 00324 } 00325 00326 if ((pwnd != PWND_FOCUS) && (pwnd != PWND_INPUTOWNER)) { 00327 Unlock(&phk->spwnd); 00328 } 00329 UserFreePool((PVOID)phk); 00330 00331 return((PHOTKEY)1); 00332 } 00333 phkRet = phk; 00334 } 00335 00336 /* 00337 * If the key is already registered, set the exists flag so 00338 * the app knows it can't use this hotkey sequence. 00339 */ 00340 if ((phk->fsModifiers == (WORD)fsModifiers) && (phk->vk == vk)) { 00341 00342 /* 00343 * In the case of PWND_FOCUS, we need to check that the queues 00344 * are the same since PWND_FOCUS is local to the queue it was 00345 * registered under. 00346 */ 00347 if (phk->spwnd == PWND_FOCUS) { 00348 if (phk->pti == ptiCurrent) { 00349 *pfKeysExist = TRUE; 00350 } 00351 } else { 00352 *pfKeysExist = TRUE; 00353 } 00354 } 00355 00356 phkPrev = phk; 00357 phk = phk->phkNext; 00358 } 00359 00360 return phkRet; 00361 }

int FindNCHitEx PWND  pwnd,
int  ht,
POINT  pt
 

Definition at line 375 of file tooltips.c.

References FALSE, tagITEM::hbmp, HitTestScrollBar(), HTMDICLOSE, HTMDIMAXBUTTON, HTMDIMINBUTTON, HTMDISYSMENU, HTMENUITEM, MNItemHitTest(), tagMENU::rgItems, tagWND::spmenu, TestWF, TRUE, WFHPRESENT, WFMPRESENT, and WFVPRESENT.

Referenced by xxxScanSysQueue().

00376 { 00377 /* 00378 * Bug 263057 joejo 00379 * It seems that pwnd->spmenu can be released and set to null, 00380 * without the WFMPRESENT flag being cleared. Make sure that 00381 * we have a good pwnd->spmenu before continuing. 00382 */ 00383 if (ht == HTMENU && pwnd->spmenu && TestWF(pwnd, WFMPRESENT)) { 00384 PMENU spmenu = pwnd->spmenu; 00385 PITEM pitem; 00386 int nItem; 00387 00388 nItem = MNItemHitTest(spmenu, pwnd, pt); 00389 if (nItem >= 0) { 00390 pitem = (PITEM)&spmenu->rgItems[nItem]; 00391 switch ((ULONG_PTR)pitem->hbmp) { 00392 case (ULONG_PTR)HBMMENU_SYSTEM: 00393 ht = HTMDISYSMENU; 00394 break; 00395 case (ULONG_PTR)HBMMENU_MBAR_RESTORE: 00396 ht = HTMDIMAXBUTTON; 00397 break; 00398 case (ULONG_PTR)HBMMENU_MBAR_MINIMIZE: 00399 case (ULONG_PTR)HBMMENU_MBAR_MINIMIZE_D: 00400 ht = HTMDIMINBUTTON; 00401 break; 00402 case (ULONG_PTR)HBMMENU_MBAR_CLOSE: 00403 case (ULONG_PTR)HBMMENU_MBAR_CLOSE_D: 00404 ht = HTMDICLOSE; 00405 break; 00406 case (ULONG_PTR)HBMMENU_CALLBACK: 00407 ht = HTERROR; 00408 break; 00409 default: 00410 ht = HTMENUITEM; 00411 break; 00412 } 00413 } 00414 return MAKELONG(ht, nItem); 00415 } else if (ht == HTVSCROLL && TestWF(pwnd, WFVPRESENT)) { 00416 return MAKELONG(HitTestScrollBar(pwnd, TRUE, pt), 1); 00417 } else if (ht == HTHSCROLL && TestWF(pwnd, WFHPRESENT)) { 00418 return MAKELONG(HitTestScrollBar(pwnd, FALSE, pt), 0); 00419 } 00420 00421 return ht; 00422 }

PQMSG FindQMsg PTHREADINFO  ,
PMLIST  ,
PWND  ,
UINT  ,
UINT  ,
BOOL 
 

Definition at line 3336 of file queue.c.

References CheckMsgFilter, CheckPwndFilter(), CheckRemoveHotkeyBit(), DebugValidateMLIST, DelQEntry(), tagXSTATE::flags, FreeDdeXact(), HMValidateHandleNoRip(), tagQ::idSysLock, tagQMSG::msg, MSGFLAG_DDE_MID_THUNK, NULL, tagTHREADINFO::pq, tagQMSG::pqmsgNext, tagMLIST::pqmsgRead, tagQ::ptiSysLock, PtoH, PXSTATE, RevalidateHwnd, TYPE_DDEXACT, UINT, and XS_FREEPXS.

Referenced by xxxFreeWindow(), and xxxReadPostMessage().

03343 { 03344 PWND pwnd; 03345 PQMSG pqmsgRead; 03346 PQMSG pqmsgRet = NULL; 03347 UINT message; 03348 03349 DebugValidateMLIST(pml); 03350 03351 pqmsgRead = pml->pqmsgRead; 03352 03353 while (pqmsgRead != NULL) { 03354 03355 /* 03356 * Make sure this window is valid and doesn't have the destroy 03357 * bit set (don't want to send it to any client side window procs 03358 * if destroy window has been called on it). 03359 */ 03360 pwnd = RevalidateHwnd(pqmsgRead->msg.hwnd); 03361 03362 if (pwnd == NULL && pqmsgRead->msg.hwnd != NULL) { 03363 /* 03364 * If we're removing a WM_HOTKEY message, we may need to 03365 * clear the QS_HOTKEY bit, since we have a special bit 03366 * for that message. 03367 */ 03368 if (pqmsgRead->msg.message == WM_HOTKEY) { 03369 CheckRemoveHotkeyBit(pti, pml); 03370 } 03371 /* 03372 * If the current thread's queue is locked waiting for this message, 03373 * we have to unlock it because we're eating the message. If there's 03374 * no more input/messages for this thread, the thread is going to 03375 * sleep; hence there might not be a next Get/PeekMessage call to 03376 * unlock the queue (ie, updating pti->idLast is not enough); 03377 * so we must unlock it now. 03378 * Win95 doesn't have this problem because their FindQMsg doesn't 03379 * eat messages; they call ReadPostMessage from FreeWindow 03380 * to take care of this scenario (== message for a destroyed window). 03381 * We could also do this if we have some problems with this fix. 03382 */ 03383 if ((pti->pq->idSysLock == (ULONG_PTR)pqmsgRead) 03384 && (pti->pq->ptiSysLock == pti)) { 03385 /* CheckSysLock(What number?, pti->pq, NULL); */ 03386 RIPMSG2(RIP_VERBOSE, "FindQMsg: Unlocking queue:%#p. Msg:%#lx", 03387 pti->pq, pqmsgRead->msg.message); 03388 pti->pq->ptiSysLock = NULL; 03389 } 03390 03391 DelQEntry(pml, pqmsgRead); 03392 goto nextMsgFromPml; 03393 } 03394 03395 /* 03396 * Process the WM_DDE_ACK messages if bProcessAck is set. 03397 */ 03398 if (bProcessAck && (PtoH(pwndFilter) == pqmsgRead->msg.hwnd) && 03399 (pqmsgRead->msg.message == (WM_DDE_ACK | MSGFLAG_DDE_MID_THUNK))) { 03400 03401 PXSTATE pxs; 03402 03403 pxs = (PXSTATE)HMValidateHandleNoRip((HANDLE)pqmsgRead->msg.lParam, TYPE_DDEXACT); 03404 03405 if (pxs != NULL && (pxs->flags & XS_FREEPXS)) { 03406 FreeDdeXact(pxs); 03407 DelQEntry(pml, pqmsgRead); 03408 goto nextMsgFromPml; 03409 } 03410 } 03411 03412 /* 03413 * Make sure this message fits both window handle and message 03414 * filters. 03415 */ 03416 if (!CheckPwndFilter(pwnd, pwndFilter)) 03417 goto nextMsg; 03418 03419 /* 03420 * If this is a fixed up dde message, then turn it into a normal 03421 * dde message for the sake of message filtering. 03422 */ 03423 message = pqmsgRead->msg.message; 03424 if (CheckMsgFilter(message, 03425 (WM_DDE_FIRST + 1) | MSGFLAG_DDE_MID_THUNK, 03426 WM_DDE_LAST | MSGFLAG_DDE_MID_THUNK)) { 03427 message = message & ~MSGFLAG_DDE_MID_THUNK; 03428 } 03429 03430 if (!CheckMsgFilter(message, msgMin, msgMax)) 03431 goto nextMsg; 03432 03433 /* 03434 * Found it. If bProcessAck is set, remember this pointer and go on 03435 * till we finish walking the list to process all WM_DDE_ACK messages. 03436 */ 03437 if (!bProcessAck) { 03438 DebugValidateMLIST(pml); 03439 return pqmsgRead; 03440 } 03441 03442 if (pqmsgRet == NULL) { 03443 pqmsgRet = pqmsgRead; 03444 } 03445 nextMsg: 03446 pqmsgRead = pqmsgRead->pqmsgNext; 03447 continue; 03448 03449 nextMsgFromPml: 03450 pqmsgRead = pml->pqmsgRead; 03451 continue; 03452 } 03453 03454 DebugValidateMLIST(pml); 03455 return pqmsgRet; 03456 }

PSPB FindSpb PWND  pwnd  ) 
 

Definition at line 965 of file spb.c.

References tagSPB::flags, gpDispInfo, NULL, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, SPB_LOCKUPDATE, and tagSPB::spwnd.

Referenced by OffsetChildren(), RestoreSpb(), xxxDrawDragRect(), xxxFreeWindow(), and zzzBltValidBits().

00967 { 00968 PSPB pspb; 00969 00970 /* 00971 * Walk through the list of save popup bits looking for a match on 00972 * window handle. 00973 */ 00974 for (pspb = gpDispInfo->pspbFirst; pspb != NULL; pspb = pspb->pspbNext) { 00975 00976 if (pspb->spwnd == pwnd && !(pspb->flags & SPB_LOCKUPDATE)) 00977 break; 00978 } 00979 00980 return pspb; 00981 }

PTIMER FindTimer PWND  pwnd,
UINT_PTR  nID,
UINT  flags,
BOOL  fKill
 

Definition at line 167 of file timers.c.

References tagTIMER::flags, FreeTimer(), gptmrFirst, tagTIMER::nID, NULL, tagTIMER::ptmrNext, tagTIMER::spwnd, SYSRIT_TIMER, and TRUE.

Referenced by InternalSetTimer(), KillTimer2(), and UserSetTimer().

00172 { 00173 PTIMER ptmr; 00174 00175 ptmr = gptmrFirst; 00176 00177 while (ptmr != NULL) { 00178 00179 /* 00180 * Is this the timer we're looking for? 00181 */ 00182 if ((ptmr->spwnd == pwnd) && 00183 (ptmr->nID == nID) && 00184 (ptmr->flags & SYSRIT_TIMER) == (flags & SYSRIT_TIMER)) { 00185 00186 /* 00187 * Are we being called from KillTimer()? If so, destroy the 00188 * timer. return != 0 because *pptmr is gone. 00189 */ 00190 if (fKill) { 00191 FreeTimer(ptmr); 00192 return (PTIMER)TRUE; 00193 } 00194 00195 /* 00196 * Found the timer, break out of the loop. 00197 */ 00198 break; 00199 } 00200 00201 /* 00202 * No, try the next one. 00203 */ 00204 ptmr = ptmr->ptmrNext; 00205 } 00206 00207 return ptmr; 00208 }

__inline BOOL FLayeredOrRedirected PWND  pwnd  ) 
 

Definition at line 6776 of file userk.h.

References BOOL.

Referenced by CalcWindowVisRgn(), ExcludeWindowRects(), InternalInvalidate2(), IntersectWithParents(), RecreateRedirectionBitmap(), RemoveRedirectionBitmap(), UpdateLayeredSprite(), xxxInternalInvalidate(), zzzBltValidBits(), and zzzChangeStates().

06782 {

LRESULT fnHkINLPCWPEXSTRUCT PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 490 of file srvhook.c.

References _CLIENTINFO::CI_flags, CI_INTERTHREAD_HOOK, GetClientInfo, HW, NULL, _CWPSTRUCTEX::psmsSender, and xxxCallNextHookEx().

Referenced by InitFunctionTables().

00496 { 00497 CWPSTRUCTEX cwp; 00498 PCLIENTINFO pci = GetClientInfo(); 00499 00500 UNREFERENCED_PARAMETER(xParam); 00501 00502 cwp.hwnd = HW(pwnd); 00503 cwp.message = message; 00504 cwp.wParam = wParam; 00505 cwp.lParam = lParam; 00506 cwp.psmsSender = NULL; 00507 00508 return xxxCallNextHookEx(HC_ACTION, (pci->CI_flags & CI_INTERTHREAD_HOOK) != 0, 00509 (LPARAM)&cwp); 00510 }

LRESULT fnHkINLPCWPRETEXSTRUCT PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 512 of file srvhook.c.

References _CLIENTINFO::CI_flags, CI_INTERTHREAD_HOOK, _CLIENTINFO::dwHookData, GetClientInfo, HW, _CWPRETSTRUCTEX::lResult, NULL, _CWPRETSTRUCTEX::psmsSender, and xxxCallNextHookEx().

Referenced by InitFunctionTables().

00518 { 00519 CWPRETSTRUCTEX cwp; 00520 PCLIENTINFO pci = GetClientInfo(); 00521 00522 UNREFERENCED_PARAMETER(xParam); 00523 00524 cwp.hwnd = HW(pwnd); 00525 cwp.message = message; 00526 cwp.wParam = wParam; 00527 cwp.lParam = lParam; 00528 cwp.lResult = pci->dwHookData; 00529 cwp.psmsSender = NULL; 00530 00531 return xxxCallNextHookEx(HC_ACTION, (pci->CI_flags & CI_INTERTHREAD_HOOK) != 0, 00532 (LPARAM)&cwp); 00533 }

VOID ForceEmptyClipboard PWINDOWSTATION   ) 
 

Definition at line 2779 of file ntuser/kernel/clipbrd.c.

References tagWINDOWSTATION::dwWSF_Flags, tagWINDOWSTATION::ptiClipLock, tagWINDOWSTATION::spwndClipOpen, tagWINDOWSTATION::spwndClipOwner, tagWINDOWSTATION::spwndClipViewer, Unlock, VOID(), WSF_DYING, xxxCloseClipboard(), and xxxEmptyClipboard().

Referenced by EndShutdown(), and FreeWindowStation().

02781 { 02782 02783 pwinsta->ptiClipLock = ((PTHREADINFO)(W32GetCurrentThread())); /* 02784 * This will be NULL 02785 * for a non-GUI thread. 02786 */ 02787 Unlock(&pwinsta->spwndClipOwner); 02788 Unlock(&pwinsta->spwndClipViewer); 02789 Unlock(&pwinsta->spwndClipOpen); 02790 02791 xxxEmptyClipboard(pwinsta); 02792 02793 /* 02794 * If the windowstation is dying, don't bother closing 02795 * the clipboard. 02796 */ 02797 if (!(pwinsta->dwWSF_Flags & WSF_DYING)) 02798 xxxCloseClipboard(pwinsta); 02799 }

VOID FreeAllSpbs void   ) 
 

Definition at line 1252 of file spb.c.

References AnySpbs, FreeSpb(), gpDispInfo, NULL, tagDISPLAYINFO::pspbFirst, and VOID().

Referenced by InitiateWin32kCleanup(), xxxRealizePalette(), xxxSetDeskWallpaper(), xxxSwitchDesktop(), and xxxUserChangeDisplaySettings().

01253 { 01254 01255 while(AnySpbs()) { 01256 FreeSpb(gpDispInfo->pspbFirst); 01257 } 01258 01259 gpDispInfo->pspbFirst = NULL; 01260 }

VOID FreeCachedQueues VOID   ) 
 

Definition at line 2193 of file queue.c.

References ExDeletePagedLookasideList(), NULL, QLookaside, and VOID().

Referenced by Win32kNtUserCleanup().

02195 { 02196 if (QLookaside != NULL) { 02197 ExDeletePagedLookasideList(QLookaside); 02198 UserFreePool(QLookaside); 02199 QLookaside = NULL; 02200 } 02201 }

VOID FreeDdeConv PDDECONV  pDdeConv  ) 
 

Definition at line 2042 of file kernel/ddetrack.c.

References _PostMessage(), tagDDEIMP::ClientContext, tagDDEIMP::cRefConv, tagDDEIMP::cRefInit, CXF_TERMINATE_POSTED, tagDDECONV::flags, GETPTI, HMFreeObject(), HMIsMarkDestroy, HMMarkObjectDestroy(), NULL, tagDDECONV::pddei, PopState(), PtoH, SeDeleteClientSecurity, tagDDECONV::spartnerConv, tagDDECONV::spwnd, tagDDECONV::spwndPartner, TIF_INCLEANUP, TRACE_DDE1, UnlinkConv(), Unlock, and VOID().

Referenced by xxxCleanupDdeConv(), xxxDDETrackGetMessageHook(), and xxxDDETrackWindowDying().

02044 { 02045 02046 TRACE_DDE1("FreeDdeConv(%#p)", pDdeConv); 02047 02048 if (!(pDdeConv->flags & CXF_TERMINATE_POSTED) && 02049 !HMIsMarkDestroy(pDdeConv->spwndPartner)) { 02050 _PostMessage(pDdeConv->spwndPartner, WM_DDE_TERMINATE, 02051 (WPARAM)PtoH(pDdeConv->spwnd), 0); 02052 // pDdeConv->flags |= CXF_TERMINATE_POSTED; set by PostHookProc 02053 } 02054 02055 if (pDdeConv->spartnerConv != NULL && 02056 GETPTI(pDdeConv)->TIF_flags & TIF_INCLEANUP) { 02057 /* 02058 * Fake that the other side already posted a terminate. 02059 * This prevents vestigal dde structures from hanging 02060 * around after thread cleanup if the conversation structure 02061 * is destroyed before the associated window. 02062 */ 02063 pDdeConv->spartnerConv->flags |= CXF_TERMINATE_POSTED; 02064 } 02065 02066 UnlinkConv(pDdeConv); 02067 02068 if (pDdeConv->pddei != NULL) { 02069 pDdeConv->pddei->cRefConv--; 02070 if (pDdeConv->pddei->cRefConv == 0 && pDdeConv->pddei->cRefInit == 0) { 02071 SeDeleteClientSecurity(&pDdeConv->pddei->ClientContext); 02072 UserFreePool(pDdeConv->pddei); 02073 } 02074 pDdeConv->pddei = NULL; 02075 } 02076 02077 Unlock(&(pDdeConv->spartnerConv)); 02078 Unlock(&(pDdeConv->spwndPartner)); 02079 Unlock(&(pDdeConv->spwnd)); 02080 02081 if (!HMMarkObjectDestroy((PHEAD)pDdeConv)) 02082 return; 02083 02084 while (pDdeConv->spxsOut) { 02085 PopState(pDdeConv); 02086 } 02087 02088 HMFreeObject(pDdeConv); 02089 }

VOID FreeDdeXact PXSTATE  pxs  ) 
 

Definition at line 2285 of file kernel/ddetrack.c.

References tagSHAREDINFO::aheList, tagXSTATE::flags, tagINTDDEINFO::flags, giheLast, gSharedInfo, tagXSTATE::head, tagINTDDEINFO::hIndirect, HMFreeObject(), HMMarkObjectDestroy(), NULL, tagXSTATE::pIntDdeInfo, RemovePublicObject(), tagXSTATE::snext, TYPE_DDECONV, TYPE_DDEXACT, ValidatePublicObjectList, VOID(), XS_ENHMETAFILE, XS_METAFILEPICT, and XS_PUBLICOBJ.

Referenced by FindQMsg(), PopState(), and xxxDDETrackGetMessageHook().

02287 { 02288 if (!HMMarkObjectDestroy(pxs)) 02289 return; 02290 02291 #if 0 02292 { 02293 int i; 02294 HANDLEENTRY *phe; 02295 02296 for (i = 0, phe = gSharedInfo.aheList; 02297 i <= giheLast; 02298 i++) { 02299 if (phe[i].bType == TYPE_DDEXACT) { 02300 UserAssert(((PXSTATE)(phe[i].phead))->snext != pxs); 02301 } 02302 if (phe[i].bType == TYPE_DDECONV) { 02303 UserAssert(((PDDECONV)(phe[i].phead))->spxsOut != pxs); 02304 UserAssert(((PDDECONV)(phe[i].phead))->spxsIn != pxs); 02305 } 02306 } 02307 } 02308 UserAssert(pxs->head.cLockObj == 0); 02309 UserAssert(pxs->snext == NULL); 02310 #endif 02311 02312 if (pxs->pIntDdeInfo != NULL) { 02313 /* 02314 * free any server-side GDI objects 02315 */ 02316 if (pxs->pIntDdeInfo->flags & (XS_METAFILEPICT | XS_ENHMETAFILE)) { 02317 GreDeleteServerMetaFile(pxs->pIntDdeInfo->hIndirect); 02318 } 02319 if (pxs->flags & XS_PUBLICOBJ) { 02320 RemovePublicObject(((PDDE_DATA)(pxs->pIntDdeInfo + 1))->wFmt, 02321 pxs->pIntDdeInfo->hIndirect); 02322 pxs->flags &= ~XS_PUBLICOBJ; 02323 } 02324 UserFreePool(pxs->pIntDdeInfo); 02325 } 02326 02327 HMFreeObject(pxs); 02328 ValidatePublicObjectList(); 02329 }

VOID FreeDesktop IN PVOID  Desktop  ) 
 

PDEVICEINFO FreeDeviceInfo PDEVICEINFO  pMouseInfo  ) 
 

Definition at line 313 of file ntinput.c.

References CheckDeviceInfoListCritIn, EVENT_INCREMENT, FALSE, FreeKernelEvent(), GDIAF_FREEME, GDIAF_PNPWAITING, GDIF_PNPMUSTFREE, GDIF_READERMUSTFREE, GDIF_READING, gpDeviceInfoList, KeSetEvent(), and NULL.

Referenced by InputApc(), ProcessDeviceChanges(), RequestDeviceChange(), StartDeviceRead(), and Win32kNtUserCleanup().

00314 { 00315 PDEVICEINFO *ppDeviceInfo; 00316 00317 CheckDeviceInfoListCritIn(); 00318 00319 TAGMSG1(DBGTAG_PNP, "FreeDeviceInfo(%#p)", pDeviceInfo); 00320 00321 /* 00322 * We cannot free the device since we still have a read pending. 00323 * Mark it GDIAF_FREEME so that it will be freed when the APC is made 00324 * (see InputApc), or when the next read request is about to be issued 00325 * (see StartDeviceRead). 00326 */ 00327 if (pDeviceInfo->bFlags & GDIF_READING) { 00328 #if DIAGNOSE_IO 00329 pDeviceInfo->bFlags |= GDIF_READERMUSTFREE; 00330 #endif 00331 TAGMSG1(DBGTAG_PNP, "** FreeDeviceInfo(%#p) DEFERRED : reader must free", pDeviceInfo); 00332 pDeviceInfo->usActions |= GDIAF_FREEME; 00333 return pDeviceInfo->pNext; 00334 } 00335 00336 /* 00337 * If a PnP thread is waiting in RequestDeviceChange for some action to be 00338 * performed on this device, just mark it for freeing and signal that PnP 00339 * thread with the pkeHidChangeCompleted so that it will free it 00340 */ 00341 if (pDeviceInfo->usActions & GDIAF_PNPWAITING) { 00342 #if DIAGNOSE_IO 00343 pDeviceInfo->bFlags |= GDIF_PNPMUSTFREE; 00344 #endif 00345 TAGMSG1(DBGTAG_PNP, "** FreeDeviceInfo(%#p) DEFERRED : PnP must free", pDeviceInfo); 00346 pDeviceInfo->usActions |= GDIAF_FREEME; 00347 KeSetEvent(pDeviceInfo->pkeHidChangeCompleted, EVENT_INCREMENT, FALSE); 00348 return pDeviceInfo->pNext; 00349 } 00350 00351 ppDeviceInfo = &gpDeviceInfoList; 00352 00353 while (*ppDeviceInfo) { 00354 if (*ppDeviceInfo == pDeviceInfo) { 00355 /* 00356 * Found the DEVICEINFO struct, so free it and its members. 00357 */ 00358 if (pDeviceInfo->pkeHidChangeCompleted != NULL) { 00359 FreeKernelEvent(&pDeviceInfo->pkeHidChangeCompleted); // BUG BUG 00360 } 00361 if (pDeviceInfo->ustrName.Buffer != NULL) { 00362 UserFreePool(pDeviceInfo->ustrName.Buffer); 00363 } 00364 *ppDeviceInfo = pDeviceInfo->pNext; 00365 UserFreePool(pDeviceInfo); 00366 00367 return *ppDeviceInfo; 00368 } 00369 ppDeviceInfo = &(*ppDeviceInfo)->pNext; 00370 } 00371 RIPMSG1(RIP_ERROR, "pDeviceInfo %#p not found in gpDeviceInfoList", pDeviceInfo); 00372 00373 return NULL; 00374 }

VOID FreeHook PHOOK  phk  ) 
 

Definition at line 1976 of file hooks.c.

References CheckWHFBits(), DbgValidateHooks, tagHOOK::flags, GETPTI, HF_DESTROYED, HF_GLOBAL, HMFreeObject(), HMMarkObjectDestroy(), tagHOOK::iHook, NULL, tagHOOK::ptiHooked, RemoveHmodDependency(), UnlinkHook(), and VOID().

Referenced by FreeThreadsWindowHooks(), xxxCallHook2(), and zzzUnhookWindowsHookEx().

01978 { 01979 /* 01980 * Paranoia... 01981 */ 01982 UserAssert(!(phkFree->flags & HF_FREED)); 01983 /* 01984 * BUGBUG 01985 * Unless we come from zzzUnhookWindowsHook, if this was a journaling hook 01986 * we don't unattach the threads. We should reconsider this one day. 01987 * MCostea Jan 21, 99 01988 */ 01989 01990 /* 01991 * Clear fsHooks bits the first time around (and mark it as destroyed). 01992 */ 01993 if (!(phkFree->flags & HF_DESTROYED)) { 01994 DbgValidateHooks (phkFree, phkFree->iHook); 01995 phkFree->flags |= HF_DESTROYED; 01996 /* 01997 * This hook has been marked as destroyed so CheckWHSBits 01998 * won't take it into account when updating the fsHooks bits. 01999 * However, this means that right at this moment fsHooks is 02000 * out of sync. So we need a flag to make the assertion freaks 02001 * (i.e., me) happy. 02002 */ 02003 #if DBG 02004 phkFree->flags |= HF_INCHECKWHF; 02005 #endif 02006 UserAssert((phkFree->ptiHooked != NULL) || (phkFree->flags & HF_GLOBAL)); 02007 CheckWHFBits(phkFree->ptiHooked != NULL 02008 ? phkFree->ptiHooked 02009 : GETPTI(phkFree), 02010 phkFree->iHook); 02011 #if DBG 02012 phkFree->flags &= ~HF_INCHECKWHF; 02013 #endif 02014 } 02015 /* 02016 * Mark it for destruction. If it the object is locked it can't 02017 * be freed right now. 02018 */ 02019 if (!HMMarkObjectDestroy((PVOID)phkFree)) { 02020 return; 02021 } 02022 /* 02023 * We're going to free this hook so get it off the list. 02024 */ 02025 UnlinkHook(phkFree); 02026 /* 02027 * Now remove the hmod dependency and free the 02028 * HOOK structure. 02029 */ 02030 if (phkFree->ihmod >= 0) { 02031 RemoveHmodDependency(phkFree->ihmod); 02032 } 02033 02034 #ifdef HOOKBATCH 02035 /* 02036 * Free the cached Events 02037 */ 02038 if (phkFree->aEventCache) { 02039 UserFreePool(phkFree->aEventCache); 02040 phkFree->aEventCache = NULL; 02041 } 02042 #endif //HOOKBATCH 02043 02044 #if DBG 02045 phkFree->flags |= HF_FREED; 02046 #endif 02047 02048 HMFreeObject((PVOID)phkFree); 02049 return; 02050 }

VOID FreeHwndList PBWL  pbwl  ) 
 

Definition at line 417 of file enumwin.c.

References CheckCritIn, FALSE, gpbwlList, NULL, pbwlCache, tagBWL::pbwlNext, tagBWL::phwndMax, and tagBWL::rghwnd.

Referenced by _FindWindowEx(), AssociateInputContextEx(), DestroyInputContext(), InitSwitchWndInfo(), NtUserBuildHwndList(), SwitchWndCleanup(), xxxArrangeIconicWindows(), xxxCheckImeShowStatus(), xxxClientShutdown(), xxxDefWindowProc(), xxxDesktopRecalc(), xxxDestroyThreadInfo(), xxxDWPPrint(), xxxInternalDoSyncPaint(), xxxInternalEnumWindow(), xxxMetricsRecalc(), xxxSendBSMtoDesktop(), and xxxShowOwnedWindows().

00419 { 00420 PBWL *ppbwl; 00421 PBWL pbwlT; 00422 00423 CheckCritIn(); 00424 00425 /* 00426 * We should never have an active bwl that is the free cached bwl 00427 */ 00428 UserAssert(pbwl != pbwlCache); 00429 00430 /* 00431 * Unlink this bwl from the list. 00432 */ 00433 for (ppbwl = &gpbwlList; *ppbwl != NULL; ppbwl = &(*ppbwl)->pbwlNext) { 00434 if (*ppbwl == pbwl) { 00435 *ppbwl = pbwl->pbwlNext; 00436 00437 /* 00438 * If the cache is empty or this pbwl is larger than the 00439 * cached one, save the pbwl there. 00440 */ 00441 if (pbwlCache == NULL) { 00442 pbwlCache = pbwl; 00443 } else if ((pbwl->phwndMax - pbwl->rghwnd) > 00444 (pbwlCache->phwndMax - pbwlCache->rghwnd)) { 00445 pbwlT = pbwlCache; 00446 pbwlCache = pbwl; 00447 UserFreePool((HANDLE)pbwlT); 00448 } else { 00449 UserFreePool((HANDLE)pbwl); 00450 } 00451 return; 00452 } 00453 } 00454 00455 /* 00456 * Assert if we couldn't find the pbwl in the list... 00457 */ 00458 UserAssert(FALSE); 00459 }

VOID FreeInputContext IN PIMC  pImc  ) 
 

Definition at line 198 of file ntimm.c.

References GETPTI, HMFreeObject(), HMMarkObjectDestroy(), NULL, tagIMC::pImcNext, and VOID().

00200 { 00201 PIMC pImcT; 00202 00203 /* 00204 * Mark it for destruction. If it the object is locked it can't 00205 * be freed right now. 00206 */ 00207 if (!HMMarkObjectDestroy((PVOID)pImc)) 00208 return; 00209 00210 /* 00211 * Unlink it. 00212 */ 00213 pImcT = GETPTI(pImc)->spDefaultImc; 00214 00215 while (pImcT != NULL && pImcT->pImcNext != pImc) 00216 pImcT = pImcT->pImcNext; 00217 00218 if (pImcT != NULL) 00219 pImcT->pImcNext = pImc->pImcNext; 00220 00221 /* 00222 * We're really going to free the input context. 00223 */ 00224 HMFreeObject((PVOID)pImc); 00225 00226 return; 00227 }

VOID __inline FreeKernelEvent PVOID *  pp  ) 
 

Definition at line 126 of file userk.h.

References NULL, and VOID().

Referenced by FreeDeviceInfo(), Win32kNtUserCleanup(), xxxDesktopThread(), and xxxInitInput().

00127 { 00128 UserFreePool(*pp); 00129 *pp = NULL; 00130 }

VOID FreeMessageList PMLIST  pml  ) 
 

Definition at line 3106 of file queue.c.

References CleanEventMessage(), DebugValidateMLIST, DelQEntry(), NULL, tagMLIST::pqmsgRead, and VOID().

Referenced by xxxDestroyThreadInfo(), and zzzDestroyQueue().

03108 { 03109 PQMSG pqmsg; 03110 03111 DebugValidateMLIST(pml); 03112 03113 while ((pqmsg = pml->pqmsgRead) != NULL) { 03114 CleanEventMessage(pqmsg); 03115 DelQEntry(pml, pqmsg); 03116 } 03117 03118 DebugValidateMLIST(pml); 03119 }

void FreeProfileUserName PUNICODE_STRING  pProfileUserName,
TL ptl
 

Definition at line 174 of file w32/ntuser/kernel/profile.c.

References CheckCritIn, PtiCurrent, and ThreadUnlockAndFreePool.

Referenced by InitUserScreen(), NtUserSetSysColors(), PrepareForLogoff(), xxxDesktopWndProc(), xxxInitWindowStation(), xxxResetDisplayDevice(), xxxSetIMEShowStatus(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00174 { 00175 UNREFERENCED_PARAMETER(ptl); 00176 CheckCritIn(); 00177 if (pProfileUserName) { 00178 ThreadUnlockAndFreePool(PtiCurrent(), ptl); 00179 } 00180 }

__inline void FreeQEntry PQMSG  pqmsg  ) 
 

Definition at line 4397 of file userk.h.

References QEntryLookaside, and VOID().

Referenced by RedistributeInput().

04408 {

VOID FreeQueue PQ  pq  ) 
 

Definition at line 2168 of file queue.c.

References ExFreeToPagedLookasideList(), gpqCursor, gpqForeground, gpqForegroundPrev, tagQ::QF_flags, QF_INDESTROY, QLookaside, and VOID().

Referenced by RtlpDphFreeDelayedBlocksFromHeap(), RtlpDphTrimDelayedFreeQueue(), UserDeleteW32Thread(), Win32kNtUserCleanup(), and zzzDestroyQueue().

02170 { 02171 #if DBG 02172 /* 02173 * Turn off the flag indicating that this queue is in destruction. 02174 * We do this in either case that we are putting this into the free 02175 * list, or truly destroying the handle. We use this to try and 02176 * track cases where someone tries to lock elements into the queue 02177 * structure while it's going through destuction. 02178 */ 02179 pq->QF_flags &= ~QF_INDESTROY; 02180 #endif 02181 02182 UserAssertMsg0(pq != gpqForeground, "FreeQueue(gpqForeground) !"); 02183 UserAssertMsg0(pq != gpqForegroundPrev, "FreeQueue(gpqForegroundPrev) !"); 02184 UserAssertMsg0(pq != gpqCursor, "FreeQueue(gpqCursor) !"); 02185 ExFreeToPagedLookasideList(QLookaside, pq); 02186 }

VOID FreeSpb PSPB  pspb  ) 
 

Definition at line 1171 of file spb.c.

References AnySpbs, ClrWF, tagDCE::DCX_flags, tagSPB::flags, gpDispInfo, tagSPB::hbm, tagDCE::hdc, tagDISPLAYINFO::hDev, tagSPB::hrgn, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, SPB_SAVESCREENBITS, tagSPB::spwnd, tagSPB::ulSaveId, Unlock, VOID(), and WFHASSPB.

Referenced by FreeAllSpbs(), LockWindowUpdate2(), RestoreSpb(), SpbCheckPwnd(), SpbCheckRect2(), xxxDrawDragRect(), xxxFreeWindow(), and zzzBltValidBits().

01173 { 01174 PSPB *ppspb; 01175 PDCE pdce; 01176 01177 if (pspb == NULL) 01178 return; 01179 01180 /* 01181 * Delete the bitmap. If saved in screen memory, make special call. 01182 */ 01183 if (pspb->flags & SPB_SAVESCREENBITS) { 01184 GreSaveScreenBits(gpDispInfo->hDev, SS_FREE, pspb->ulSaveId, NULL); 01185 } else if (pspb->hbm != NULL) { 01186 GreDeleteObject(pspb->hbm); 01187 } 01188 01189 /* 01190 * Destroy the region. 01191 */ 01192 if (pspb->hrgn != NULL){ 01193 GreDeleteObject(pspb->hrgn); 01194 } 01195 01196 /* 01197 * Forget that there is an attached SPB. 01198 */ 01199 if (pspb->spwnd != NULL) { 01200 ClrWF(pspb->spwnd, WFHASSPB); 01201 Unlock(&pspb->spwnd); 01202 } 01203 01204 /* 01205 * Unlink the spb. 01206 */ 01207 ppspb = &gpDispInfo->pspbFirst; 01208 while (*ppspb != pspb) { 01209 ppspb = &(*ppspb)->pspbNext; 01210 } 01211 01212 *ppspb = pspb->pspbNext; 01213 01214 /* 01215 * Free the save popup bits structure. 01216 */ 01217 UserFreePool(pspb); 01218 01219 /* 01220 * If we no longer have any SPBs then turn off window MGR 01221 * bounds collection. 01222 */ 01223 if (!AnySpbs()) { 01224 01225 GreLockDisplay(gpDispInfo->hDev); 01226 01227 /* 01228 * Reset the dirty areas of all of the DC's. NULL means reset. 01229 */ 01230 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 01231 01232 if (pdce->DCX_flags & DCX_LAYERED) 01233 continue; 01234 01235 GreGetBounds(pdce->hdc, NULL, GGB_DISABLE_WINMGR); 01236 } 01237 01238 GreUnlockDisplay(gpDispInfo->hDev); 01239 } 01240 01241 }

VOID FreeThreadsWindowHooks VOID   ) 
 

Definition at line 2227 of file hooks.c.

References tagDESKTOPINFO::aphkStart, tagTHREADINFO::aphkStart, tagHOOK::flags, FreeHook(), tagTHREADINFO::fsHooks, GETPTI, HF_DESTROYED, HF_GLOBAL, NULL, tagTHREADINFO::pDeskInfo, tagHOOK::phkNext, PtiCurrent, tagHOOK::ptiHooked, tagTHREADINFO::rpdesk, tagTHREADINFO::sphkCurrent, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, UnlinkHook(), Unlock, and VOID().

Referenced by xxxDestroyThreadInfo().

02228 { 02229 int iHook; 02230 PHOOK phk, phkNext; 02231 PTHREADINFO ptiCurrent = PtiCurrent(); 02232 02233 /* 02234 * If there is not thread info, there are not hooks to worry about 02235 */ 02236 if (ptiCurrent == NULL || ptiCurrent->rpdesk == NULL) { 02237 return; 02238 } 02239 /* 02240 * In case we have a hook locked in as the current hook unlock it 02241 * so it can be freed 02242 */ 02243 Unlock(&ptiCurrent->sphkCurrent); 02244 02245 UserAssert(ptiCurrent->TIF_flags & TIF_INCLEANUP); 02246 // Why bother doing this? We won't be calling back to user mode again! 02247 // if (ptiCurrent->pClientInfo) { 02248 // ptiCurrent->pClientInfo->phkCurrent = NULL; 02249 // } 02250 02251 /* 02252 * Loop through all the hook types. 02253 */ 02254 for (iHook = WH_MIN ; iHook <= WH_MAX ; ++iHook) { 02255 /* 02256 * Loop through all the hooks of this type, including the 02257 * ones already marked as destroyed (so don't call 02258 * PhkFirstValid and PhkNextValid). 02259 */ 02260 phk = ptiCurrent->aphkStart[iHook + 1]; 02261 if (phk == NULL) { 02262 phk = ptiCurrent->pDeskInfo->aphkStart[iHook + 1]; 02263 UserAssert((phk == NULL) || (phk->flags & HF_GLOBAL)); 02264 } 02265 02266 while (phk != NULL) { 02267 /* 02268 * We might free phk below, so grab the next now 02269 * If at end of local chain, jump to the global chain 02270 */ 02271 phkNext = phk->phkNext; 02272 if ((phkNext == NULL) && !(phk->flags & HF_GLOBAL)) { 02273 phkNext = ptiCurrent->pDeskInfo->aphkStart[iHook + 1]; 02274 UserAssert((phkNext == NULL) || (phkNext->flags & HF_GLOBAL)); 02275 } 02276 /* 02277 * If this is a local(thread) hook, unlink it and mark it as 02278 * destroyed so we won't call it anymore. We want to do 02279 * this even if not calling FreeHook; also note that 02280 * FreeHook won't unlink it if locked so we do it here anyway. 02281 */ 02282 if (!(phk->flags & HF_GLOBAL)) { 02283 UserAssert(ptiCurrent == phk->ptiHooked); 02284 UnlinkHook(phk); 02285 phk->flags |= HF_DESTROYED; 02286 phk->phkNext = NULL; 02287 } 02288 /* 02289 * If this hook was created by this thread, free it 02290 */ 02291 if (GETPTI(phk) == ptiCurrent) { 02292 FreeHook(phk); 02293 } 02294 02295 phk = phkNext; 02296 } 02297 /* 02298 * All local hooks should be unlinked 02299 */ 02300 UserAssert(ptiCurrent->aphkStart[iHook + 1] == NULL); 02301 } /* for (iHook = WH_MIN....*/ 02302 02303 /* 02304 * Keep fsHooks in sync. 02305 */ 02306 ptiCurrent->fsHooks = 0; 02307 }

VOID FreeThreadsWinEvents PTHREADINFO  pti  ) 
 

Definition at line 615 of file kernel/winable.c.

References DestroyEventHook(), DestroyNotify(), DWORD, tagNOTIFY::dwWEFlags, GETPTI, gpPendingNotifies, gpWinEventHooks, tagNOTIFY::idSenderThread, NULL, tagEVENTHOOK::pehNext, tagNOTIFY::pNotifyNext, tagNOTIFY::ptiReceiver, WEF_ASYNC, and WEF_POSTED.

Referenced by xxxDestroyThreadInfo().

00616 { 00617 PEVENTHOOK peh, pehNext; 00618 PNOTIFY pn, pnNext; 00619 DWORD idCurrentThread = W32GetCurrentTID(); 00620 00621 /* 00622 * Loop through all the notifications 00623 */ 00624 for (pn = gpPendingNotifies; pn; pn = pnNext) { 00625 pnNext = pn->pNotifyNext; 00626 00627 /* 00628 * Only destroy sync notifications that belong to this thread 00629 * and are not currently calling back i.e. ptiReceiver must be NULL. 00630 * Otherwise, when we come back from the callback in 00631 * xxxProcessNotifyWinEvent we will operate on a freed notify. 00632 * Also destroy the notification if the receiver is going away 00633 * or else it gets leaked as long as the sender is alive. 00634 */ 00635 if ((pn->idSenderThread == idCurrentThread && 00636 pn->ptiReceiver == NULL) || (pn->ptiReceiver == pti)) { 00637 if ((pn->dwWEFlags & WEF_ASYNC) == 0) { 00638 UserAssert((pn->dwWEFlags & WEF_POSTED) == 0); 00639 DestroyNotify(pn); 00640 } 00641 } 00642 } 00643 00644 peh = gpWinEventHooks; 00645 while (peh) { 00646 pehNext = peh->pehNext; 00647 if (GETPTI(peh) == pti) { 00648 DestroyEventHook(peh); 00649 } 00650 peh = pehNext; 00651 } 00652 // Async notification not yet processed may still be posted in a queue, 00653 // pending being read and processed (gnNotifies > 0), although the 00654 // originating hook has now been unhooked (maybe gpWinEventHooks == NULL) 00655 // so the following assert is no good: 00656 // UserAssert(gpWinEventHooks || (!gpWinEventHooks && !gnNotifies)); 00657 }

VOID FreeTimer PTIMER  ptmr  ) 
 

Definition at line 112 of file timers.c.

References CheckCritIn, DecTimerCount(), gptmrFirst, HMFreeObject(), HMMarkObjectDestroy(), tagTIMER::ptmrNext, tagTIMER::ptmrPrev, Unlock, and VOID().

Referenced by DestroyThreadsTimers(), DestroyWindowsTimers(), FindTimer(), InitiateWin32kCleanup(), and Win32kNtUserCleanup().

00113 { 00114 00115 CheckCritIn(); 00116 00117 /* 00118 * Mark it for destruction. If it the object is locked it can't 00119 * be freed right now. 00120 */ 00121 if (!HMMarkObjectDestroy((PVOID)ptmr)) 00122 return; 00123 00124 /* 00125 * If this timer was just about to be processed, decrement 00126 * the ready-count since we're blowing it off. 00127 */ 00128 if (ptmr->flags & TMRF_READY) 00129 DecTimerCount(ptmr->pti); 00130 00131 /* 00132 * Unlock the window 00133 */ 00134 Unlock(&ptmr->spwnd); 00135 00136 /* 00137 * Unlink this timer 00138 */ 00139 if (ptmr->ptmrPrev) { 00140 ptmr->ptmrPrev->ptmrNext = ptmr->ptmrNext; 00141 } else { 00142 gptmrFirst = ptmr->ptmrNext; 00143 } 00144 00145 if (ptmr->ptmrNext) { 00146 ptmr->ptmrNext->ptmrPrev = ptmr->ptmrPrev; 00147 } 00148 00149 /* 00150 * Free up the TIMER structure. 00151 */ 00152 HMFreeObject((PVOID)ptmr); 00153 }

VOID FreeWindowStation IN PWINDOWSTATION  WindowStation  ) 
 

Referenced by Win32UserInitialize().

BOOL FRemoveForegroundActivate PTHREADINFO  pti  ) 
 

Definition at line 1717 of file focusact.c.

References BOOL, ClearAppStarting(), tagTHREADINFO::ppi, TIF_ALLOWFOREGROUNDACTIVATE, and tagTHREADINFO::TIF_flags.

Referenced by FAllowForegroundActivate(), and xxxSetForegroundWindow().

01718 { 01719 BOOL fRemoved; 01720 PPROCESSINFO ppi; 01721 /* 01722 * W32PF_APPSTARTING gets turned off the first activate this process does. 01723 * We assume it's ready now for action. 01724 */ 01725 ppi = pti->ppi; 01726 if (ppi->W32PF_Flags & W32PF_APPSTARTING) { 01727 ClearAppStarting(ppi); 01728 } 01729 01730 /* 01731 * Remove the right if present. 01732 */ 01733 fRemoved = (pti->TIF_flags & TIF_ALLOWFOREGROUNDACTIVATE); 01734 if (fRemoved) { 01735 pti->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE ; 01736 TAGMSG1(DBGTAG_FOREGROUND, "FRemoveForegroundActivate clear TIF %#p", pti); 01737 } else { 01738 fRemoved = (ppi->W32PF_Flags & W32PF_ALLOWFOREGROUNDACTIVATE); 01739 } 01740 if (fRemoved) { 01741 ppi->W32PF_Flags &= ~W32PF_ALLOWFOREGROUNDACTIVATE; 01742 TAGMSG1(DBGTAG_FOREGROUND, "FRemoveForegroundActivate clear W32PF %#p", ppi); 01743 } 01744 01745 return fRemoved; 01746 01747 }

__inline BOOL FSwpTopmost PWND  pwnd  ) 
 

Definition at line 5504 of file userk.h.

References BOOL.

Referenced by LinkWindow(), TrackBackground(), TrackZorder(), and ValidateWindowPos().

05512 : GetTopMostInsertAfter(pwnd))

void FullScreenCleanup  ) 
 

Definition at line 101 of file fullscr.c.

References CLEAR_PUDF, FALSE, fGdiEnabled, fRedoFullScreenSwitch, gbFullScreen, grpdeskRitInput, gspwndFullScreen, HW, idSwitcher, LockWindowUpdate2(), NOSWITCHER, NULL, tagDESKTOP::pDeskInfo, PsGetCurrentThread, PUDF_LOCKFULLSCREEN, tagDESKTOPINFO::spwnd, ThreadLock, ThreadUnlock, TRACE_SWITCH, TRUE, Unlock, and xxxSendNotifyMessage().

Referenced by UserThreadCallout().

00102 { 00103 if (PsGetCurrentThread()->Cid.UniqueThread == idSwitcher) { 00104 00105 /* 00106 * correct the full screen state 00107 */ 00108 00109 if (fGdiEnabled) { 00110 00111 TRACE_SWITCH(("Switching: FullScreenCleanup: Gdi Enabled\n")); 00112 00113 /* 00114 * gdi is enabled, we are switching away from gdi the only thing we 00115 * could have done so far is locking the screen so unlock it. 00116 */ 00117 CLEAR_PUDF(PUDF_LOCKFULLSCREEN); 00118 LockWindowUpdate2(NULL, TRUE); 00119 00120 } else { 00121 00122 /* 00123 * GDI is not enabled . This means we were switching from a full 00124 * screen to another fullscreen or back to GDI. Or we could have 00125 * disabled gdi and sent a message to the new full screen which 00126 * never got completed. 00127 * 00128 * In any case this probably means the fullscreen guy is gone so 00129 * we will switch back to gdi. 00130 * 00131 * delete any left over saved screen state stuff 00132 * set the fullscreen to nothing and then send a message that will 00133 * cause us to switch back to the gdi desktop 00134 */ 00135 TL tlpwndT; 00136 00137 TRACE_SWITCH(("Switching: FullScreenCleanup: Gdi Disabled\n")); 00138 00139 Unlock(&gspwndFullScreen); 00140 gbFullScreen = FULLSCREEN; 00141 00142 ThreadLock(grpdeskRitInput->pDeskInfo->spwnd, &tlpwndT); 00143 xxxSendNotifyMessage( 00144 grpdeskRitInput->pDeskInfo->spwnd, WM_FULLSCREEN, 00145 GDIFULLSCREEN, (LPARAM)HW(grpdeskRitInput->pDeskInfo->spwnd)); 00146 ThreadUnlock(&tlpwndT); 00147 } 00148 00149 idSwitcher = NOSWITCHER; 00150 fRedoFullScreenSwitch = FALSE; 00151 } 00152 }

BOOL FVisCountable PWND  pwnd  ) 
 

Definition at line 5107 of file swp.c.

References BOOL, FALSE, FNID_DESKTOP, FTopLevel, GETFNID, TestWF, TRUE, WFDESTROYED, and WFMINIMIZED.

Referenced by cDecVis(), HMChangeOwnerThread(), and IncVisWindows().

05108 { 05109 if (!TestWF(pwnd, WFDESTROYED)) { 05110 if ((GETFNID(pwnd) == FNID_DESKTOP) || 05111 (FTopLevel(pwnd) && !TestWF(pwnd, WFMINIMIZED))) { 05112 return TRUE; 05113 } 05114 } 05115 return FALSE; 05116 }

HKL GetActiveHKL  ) 
 

Definition at line 439 of file ntinput.c.

References _GetKeyboardLayout(), CheckCritIn, GETPTI, gpqForeground, tagKL::hkl, L, tagTHREADINFO::spklActive, and tagQ::spwndActive.

Referenced by FindImeHotKeyByKey(), RemoteSyncToggleKeys(), VKFromVSC(), xxxButtonEvent(), xxxKeyEvent(), and xxxProcessKeyEvent().

00440 { 00441 CheckCritIn(); 00442 if (gpqForeground && gpqForeground->spwndActive) { 00443 PTHREADINFO ptiForeground = GETPTI(gpqForeground->spwndActive); 00444 if (ptiForeground && ptiForeground->spklActive) { 00445 return ptiForeground->spklActive->hkl; 00446 } 00447 } 00448 return _GetKeyboardLayout(0L); 00449 }

PWND GetActiveTrackPwnd PWND  pwnd,
Q **  ppq
 

Definition at line 2251 of file ntuser/kernel/input.c.

References CheckCritIn, DWP_GetEnabledPopup(), GETPTI, gpqForeground, tagWND::head, IsModelessMenuNotificationWindow(), NULL, tagQ::spwndActive, tagWND::spwndParent, TestWF, TestwndChild, WFDISABLED, and WFVISIBLE.

Referenced by xxxActiveWindowTracking(), xxxSystemTimerProc(), xxxTrackMouseMove(), and zzzActiveCursorTracking().

02252 { 02253 PWND pwndActivate; 02254 Q *pq; 02255 02256 CheckCritIn(); 02257 pwndActivate = pwnd; 02258 02259 /* 02260 * Find the top parent 02261 */ 02262 while (TestwndChild(pwndActivate)) { 02263 pwndActivate = pwndActivate->spwndParent; 02264 } 02265 02266 /* 02267 * If disabled, get a enabled popup owned by it. 02268 */ 02269 if (TestWF(pwndActivate, WFDISABLED)) { 02270 /* 02271 * This is what we do elsewhere when someone clicks on a 02272 * disabled non-active window. It might be cheaper to check 02273 * pwnd->spwndLastActive first (we might need to walk up 02274 * the owner chain though, as this is where we set spwndLastAcitve 02275 * when activating a new window. see xxxActivateThisWindow). 02276 * But let's do the same here; this should be fixed/improved 02277 * in DWP_GetEnabledPopup anyway. There might be a reason 02278 * why we don't grab spwndLastActive if OK.... perhaps it has 02279 * something to do with nested owner windows 02280 */ 02281 pwndActivate = DWP_GetEnabledPopup(pwndActivate); 02282 } 02283 02284 /* 02285 * Bail if we didn't find a visible window 02286 */ 02287 if ((pwndActivate == NULL) || !TestWF(pwndActivate, WFVISIBLE)) { 02288 return NULL; 02289 } 02290 02291 /* 02292 * If already active in the foreground queue, nothing to do 02293 * Don't activate the modeless menu notification window (it would 02294 * dismiss the menu) 02295 */ 02296 pq = GETPTI(pwndActivate)->pq; 02297 if ((pq == gpqForeground) 02298 && ((pwndActivate == pq->spwndActive) 02299 || IsModelessMenuNotificationWindow(pwndActivate))) { 02300 02301 return NULL; 02302 } 02303 02304 /* 02305 * Don't activate the shell window. 02306 */ 02307 if (pwndActivate == pwndActivate->head.rpdesk->pDeskInfo->spwndShell) { 02308 return NULL; 02309 } 02310 02311 /* 02312 * Return the queue if requested 02313 */ 02314 if (ppq != NULL) { 02315 *ppq = pq; 02316 } 02317 02318 return pwndActivate; 02319 }

__inline DWORD GetAppCompatFlags2ForPti PTHREADINFO  pti,
WORD  wVer
 

Definition at line 6044 of file userk.h.

References BOOL, and NULL.

Referenced by GetAppCompatFlags2(), and xxxDDETrackWindowDying().

06050 {

__inline int GetCaptionHeight PWND  pwnd  ) 
 

Definition at line 6919 of file userk.h.

Referenced by xxxCalcClientRect(), xxxDrawWindowFrame(), xxxMenuBarDraw(), xxxMNRecomputeBarIfNeeded(), and xxxMoveSize().

06930 {

PCURSOR GetClassIcoCur PWND  pwnd,
int  index
 

Definition at line 1297 of file class.c.

References NULL, and tagWND::pcls.

01298 { 01299 PCLS pcls = pwnd->pcls; 01300 PCURSOR pcur; 01301 01302 switch (index) { 01303 case GCLP_HICON: 01304 pcur = pcls->spicn; 01305 break; 01306 01307 case GCLP_HCURSOR: 01308 pcur = pcls->spcur; 01309 break; 01310 01311 case GCLP_HICONSM: 01312 pcur = pcls->spicnSm; 01313 break; 01314 01315 default: 01316 RIPMSG2(RIP_WARNING, "GetWndIcoCur: Invalid index:%#lx. pwnd:%#p", 01317 index, pwnd); 01318 pcur = NULL; 01319 } 01320 01321 return pcur; 01322 }

PPCLS GetClassPtr ATOM  atom,
PPROCESSINFO  ppi,
HANDLE  hModule
 

Definition at line 1036 of file class.c.

References _InnerGetClassPtr(), gpclsList, hModClient, NULL, tagPROCESSINFO::pclsPrivateList, and tagPROCESSINFO::pclsPublicList.

Referenced by _GetClassInfoEx(), _GetWOWClass(), HMChangeOwnerThread(), xxxCreateWindowEx(), and xxxFreeWindow().

01040 { 01041 PPCLS ppcls; 01042 01043 /* 01044 * First search public then private then usersrv registered classes 01045 */ 01046 ppcls = _InnerGetClassPtr(atom, &ppi->pclsPrivateList, hModule); 01047 if (ppcls) 01048 return ppcls; 01049 01050 ppcls = _InnerGetClassPtr(atom, &ppi->pclsPublicList, NULL); 01051 if (ppcls) 01052 return ppcls; 01053 01054 /* 01055 * Next seach public and private classes and override hmodule; 01056 * some apps (bunny) do a GetClassInfo(dialog) and RegisterClass 01057 * and only change the wndproc which set the hmodule to be just 01058 * like usersrv created it even though it is in the app's public 01059 * or private class list 01060 */ 01061 01062 /* 01063 * Later -- since we are no longer returning hModuleWin to any app, 01064 * we may only need to check for hModClient. Check this out. 01065 * FritzS 01066 */ 01067 01068 ppcls = _InnerGetClassPtr(atom, &ppi->pclsPrivateList, hModClient); 01069 if (ppcls) 01070 return ppcls; 01071 01072 ppcls = _InnerGetClassPtr(atom, &ppi->pclsPublicList, hModClient); 01073 if (ppcls) 01074 return ppcls; 01075 01076 /* 01077 * Search the system class list 01078 */ 01079 ppcls = _InnerGetClassPtr(atom, &gpclsList, NULL); 01080 return ppcls; 01081 }

DWORD GetContextHelpId PWND  pwnd  ) 
 

Definition at line 28 of file rtl/help.c.

References _GetProp(), tagSERVERINFO::atomContextHelpIdProp, DWORD, FNID_DESKTOP, GETFNID, gpsi, MAKEINTATOM, PROPF_INTERNAL, REBASEPWND, and TestwndChild.

Referenced by ComboBoxWndProcWorker(), xxxDefWindowProc(), and xxxHelpLoop().

00030 { 00031 DWORD dwContextId; 00032 00033 while (!(dwContextId = (DWORD)(ULONG_PTR)_GetProp(pwnd, 00034 MAKEINTATOM(gpsi->atomContextHelpIdProp), PROPF_INTERNAL))) { 00035 pwnd = (TestwndChild(pwnd) ? 00036 REBASEPWND(pwnd, spwndParent) : 00037 REBASEPWND(pwnd, spwndOwner)); 00038 if (!pwnd || (GETFNID(pwnd) == FNID_DESKTOP)) 00039 break; 00040 } 00041 00042 return dwContextId; 00043 }

BOOL GetDCOrgOnScreen HDC  hdc,
LPPOINT  ppt
 

Definition at line 2066 of file dc.c.

References BOOL, FALSE, TRUE, and UserGetRedirectedWindowOrigin().

Referenced by InternalScrollDC(), and xxxScrollWindowEx().

02067 { 02068 if (GreGetDCOrg(hdc, ppt)) { 02069 POINT ptScreen; 02070 02071 /* 02072 * Get the origin of the redirected window in screen coordinates. 02073 */ 02074 if (UserGetRedirectedWindowOrigin(hdc, &ptScreen)) { 02075 ppt->x += ptScreen.x; 02076 ppt->y += ptScreen.y; 02077 return TRUE; 02078 } 02079 } 02080 return FALSE; 02081 }

DWORD GetDebugHookLParamSize WPARAM  wParam,
PDEBUGHOOKINFO  pdebughookstruct
 

Referenced by NtUserfnHkINLPDEBUGHOOKSTRUCT().

PDESKTOPVIEW GetDesktopView PPROCESSINFO  ppi,
PDESKTOP  pdesk
 

Definition at line 2773 of file desktop.c.

References gpepCSRSS, NULL, tagDESKTOPVIEW::pdesk, tagPROCESSINFO::pdvList, and tagDESKTOPVIEW::pdvNext.

Referenced by _MapDesktopObject(), FreeView(), MapDesktop(), NtUserPostThreadMessage(), OpenDesktopCompletion(), UserCommitDesktopMemory(), ValidateHwnd(), xxxCreateDesktop(), xxxResolveDesktop(), xxxSetThreadDesktop(), and zzzSetDesktop().

02776 { 02777 PDESKTOPVIEW pdv; 02778 02779 if(ppi->Process != gpepCSRSS && pdesk == NULL) { 02780 RIPMSG1(RIP_WARNING, "Process %#p isn't CSRSS but pdesk is NULL in GetDesktopView", ppi); 02781 } 02782 02783 for (pdv = ppi->pdvList; pdv != NULL; pdv = pdv->pdvNext) 02784 if (pdv->pdesk == pdesk) 02785 break; 02786 return pdv; 02787 }

ULONG GetDeviceChangeInfo VOID   ) 
 

__inline PDISPLAYINFO GetDispInfo void   ) 
 

Definition at line 7351 of file userk.h.

07362 {

__inline DWORD GetFlashWindowState PWND  pwnd  ) 
 

Definition at line 5658 of file userk.h.

References VOID().

Referenced by xxxFlashWindow().

05669 {

BOOL GetHDevName HMONITOR  hMon,
PWCHAR  pName
 

Definition at line 13465 of file kernel/ntstubs.c.

References BOOL, CheckCritIn, DWORD, FALSE, tagMONITOR::hDev, ProbeForWrite(), StubExceptionHandler, TRUE, and ValidateHmonitor().

13466 { 13467 PMONITOR pMonitor; 13468 13469 CheckCritIn(); 13470 13471 pMonitor = ValidateHmonitor(hMon); 13472 if (!pMonitor) { 13473 return FALSE; 13474 } 13475 13476 try { 13477 ProbeForWrite(pName, CCHDEVICENAME*sizeof(WCHAR), sizeof(DWORD)); 13478 } except (StubExceptionHandler(TRUE)) { 13479 return FALSE; 13480 } 13481 return DrvGetHdevName(pMonitor->hDev, pName); 13482 }

int GetHmodTableIndex PUNICODE_STRING  pstrName  ) 
 

Definition at line 53 of file libmgmt.c.

References aatomSysLoaded, acatomSysDepends, acatomSysUse, catomSysTableEntries, CLIBS, FALSE, ProbeAndReadUnicodeString, ProbeForReadUnicodeStringBuffer, UserAddAtom(), and UserDeleteAtom().

Referenced by _SetWinEventHook(), and zzzSetWindowsHookEx().

00055 { 00056 int i; 00057 ATOM atom; 00058 UNICODE_STRING strLibName; 00059 00060 /* 00061 * Probe string 00062 */ 00063 try { 00064 strLibName = ProbeAndReadUnicodeString(pstrLibName); 00065 ProbeForReadUnicodeStringBuffer(strLibName); 00066 atom = UserAddAtom(strLibName.Buffer, FALSE); 00067 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00068 return -1; 00069 } 00070 00071 /* 00072 * If we can't add the atom we're hosed 00073 * so return an error. 00074 */ 00075 if (atom == 0) { 00076 return -1; 00077 } 00078 00079 /* 00080 * Search for atom index 00081 */ 00082 for (i = 0; i < catomSysTableEntries && aatomSysLoaded[i] != atom; i++) 00083 ; 00084 00085 if (i == catomSysTableEntries) { 00086 00087 /* 00088 * Find empty entry for atom 00089 */ 00090 for (i = 0; i < catomSysTableEntries && aatomSysLoaded[i]; i++) 00091 ; 00092 00093 /* 00094 * Check if no empty entry found 00095 */ 00096 if (i == catomSysTableEntries) { 00097 if (i == CLIBS) { 00098 UserDeleteAtom(atom); 00099 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, 00100 RIP_WARNING, 00101 "Memory allocation failed in GetHmodTableIndex"); 00102 00103 return -1; 00104 } 00105 00106 /* 00107 * Increase table size 00108 */ 00109 catomSysTableEntries++; 00110 } 00111 00112 /* 00113 * Set entry 00114 */ 00115 aatomSysLoaded[i] = atom; 00116 acatomSysUse[i] = 0; 00117 acatomSysDepends[i] = 0; 00118 } else { 00119 UserDeleteAtom(atom); 00120 } 00121 00122 return i; 00123 }

BOOL GetImeHotKey DWORD  dwHotKeyID,
PUINT  puModifiers,
PUINT  puVKey,
HKL *  phKL
 

Definition at line 71 of file imehotky.c.

References FALSE, FindImeHotKeyByID(), gpImeHotKeyListHeader, _tagIMEHOTKEYOBJ::hk, _tagIMEHOTKEY::hKL, NULL, TRUE, _tagIMEHOTKEY::uModifiers, and _tagIMEHOTKEY::uVKey.

Referenced by NtUserGetImeHotKey().

00076 { 00077 PIMEHOTKEYOBJ ph; 00078 00079 ph = FindImeHotKeyByID( gpImeHotKeyListHeader, dwHotKeyID ); 00080 if ( ph == NULL ) { 00081 RIPERR0(ERROR_HOTKEY_NOT_REGISTERED, RIP_VERBOSE, "No such IME hotkey"); 00082 return (FALSE); 00083 } 00084 00085 // 00086 // it is OK for NULL phKL, if the target hKL is NULL 00087 // 00088 if ( phKL ) { 00089 *phKL = ph->hk.hKL; 00090 } else if ( ph->hk.hKL != NULL ) { 00091 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "phKL is null"); 00092 return (FALSE); 00093 } 00094 00095 *puModifiers = ph->hk.uModifiers; 00096 *puVKey = ph->hk.uVKey; 00097 00098 return (TRUE); 00099 }

BOOL GetImeInfoEx IN PWINDOWSTATION  pwinsta,
IN PIMEINFOEX  piiex,
IN IMEINFOEXCLASS  SearchType
 

Referenced by NtUserGetImeInfoEx().

PQ GetJournallingQueue PTHREADINFO  pti  ) 
 

Definition at line 1416 of file queue.c.

References GETPTI, IsHooked, NULL, PhkFirstGlobalValid(), tagTHREADINFO::rpdesk, TIF_DONTJOURNALATTACH, tagTHREADINFO::TIF_flags, and WHF_FROM_WH.

Referenced by xxxCreateThreadInfo(), and zzzSetDesktop().

01417 { 01418 PHOOK phook; 01419 /* 01420 * fail if we cannot journal this thread 01421 */ 01422 if ((pti->TIF_flags & TIF_DONTJOURNALATTACH) 01423 || (pti->rpdesk == NULL)) { 01424 01425 return NULL; 01426 } 01427 /* 01428 * Get the journalling hook if any. 01429 */ 01430 phook = PhkFirstGlobalValid(pti, WH_JOURNALPLAYBACK); 01431 if (phook == NULL) { 01432 phook = PhkFirstGlobalValid(pti, WH_JOURNALRECORD); 01433 } 01434 /* 01435 * Validate fsHooks bits. 01436 */ 01437 UserAssert((phook == NULL) 01438 ^ IsHooked(pti, (WHF_FROM_WH(WH_JOURNALPLAYBACK) | WHF_FROM_WH(WH_JOURNALRECORD)))); 01439 01440 /* 01441 * return the queue if we found a journalling hook 01442 */ 01443 return ((phook == NULL) ? NULL : GETPTI(phook)->pq); 01444 }

BOOL GetKbdLangSwitch PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 2393 of file w32/ntuser/kernel/init.c.

References BOOL, tagKBDLANGTOGGLE::bScan, tagKBDLANGTOGGLE::bVkey, DWORD, FALSE, FastGetProfileIntW(), gbGraveKeyToggle, gLangToggle, PMAP_UKBDLAYOUTTOGGLE, and TRUE.

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

02394 { 02395 DWORD dwToggle; 02396 BOOL bStatus = TRUE; 02397 LCID lcid; 02398 02399 dwToggle = FastGetProfileIntW(pProfileUserName, 02400 PMAP_UKBDLAYOUTTOGGLE, 02401 TEXT("Hotkey"), 02402 1); 02403 02404 gbGraveKeyToggle = FALSE; 02405 02406 switch (dwToggle) { 02407 case 4: 02408 /* 02409 * Grave accent keyboard switch for thai locales 02410 */ 02411 ZwQueryDefaultLocale(FALSE, &lcid); 02412 gbGraveKeyToggle = (PRIMARYLANGID(lcid) == LANG_THAI) ? TRUE : FALSE; 02413 /* 02414 * fall through (intentional) and disable the ctrl/alt toggle mechanism 02415 */ 02416 case 3: 02417 gLangToggle[0].bVkey = 0; 02418 gLangToggle[0].bScan = 0; 02419 break; 02420 02421 case 2: 02422 gLangToggle[0].bVkey = VK_CONTROL; 02423 break; 02424 02425 default: 02426 gLangToggle[0].bVkey = VK_MENU; 02427 break; 02428 } 02429 02430 return bStatus; 02431 }

PWND GetLayeredWindow PWND  pwnd  ) 
 

Definition at line 1166 of file sprite.c.

References GetTopLevelWindow(), NULL, TestWF, and WEFLAYERED.

Referenced by _GetDCEx(), ResetOrg(), UpdateLayeredSprite(), UserGetRedirectedWindowOrigin(), and xxxCalcValidRects().

01167 { 01168 pwnd = GetTopLevelWindow(pwnd); 01169 01170 if (TestWF(pwnd, WEFLAYERED)) 01171 return pwnd; 01172 01173 return NULL; 01174 }

PWND GetMenuStateWindow PMENUSTATE  pMenuState  ) 
 

Definition at line 232 of file ntuser/kernel/menu.c.

References tagPOPUPMENU::fIsTrackPopup, NULL, tagMENUSTATE::pGlobalPopupMenu, tagPOPUPMENU::spwndActivePopup, tagPOPUPMENU::spwndNextPopup, and tagPOPUPMENU::spwndPopupMenu.

Referenced by NtUserEndMenu(), xxxHandleMenuMessages(), and xxxMNDragOver().

00233 { 00234 if (pMenuState == NULL) { 00235 return NULL; 00236 } else if (pMenuState->pGlobalPopupMenu->fIsTrackPopup) { 00237 return pMenuState->pGlobalPopupMenu->spwndPopupMenu; 00238 } else if (pMenuState->pGlobalPopupMenu->spwndNextPopup != NULL) { 00239 return pMenuState->pGlobalPopupMenu->spwndNextPopup; 00240 } else { 00241 return pMenuState->pGlobalPopupMenu->spwndActivePopup; 00242 } 00243 }

HDC GetMonitorDC PDCE  pdceOrig,
PMONITOR  pMonitor
 

Definition at line 2151 of file dc.c.

References CreateCacheDC(), CreateEmptyRgn(), tagDCE::DCX_flags, DCX_LEAVEBITS, DecrementFreeDCECount(), ghrgnGDC, gpDispInfo, tagDCE::hdc, HRGN_FULL, tagDCE::hrgnClip, NULL, OffsetRect(), tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDCE::pMonitor, tagDCE::ptiOwner, tagDCE::pwndClip, tagDCE::pwndOrg, tagMONITOR::rcMonitor, SetMonitorRegion(), and SpbCheckDce().

Referenced by xxxEnumDisplayMonitors().

02152 { 02153 PDCE pdce; 02154 POINT pt; 02155 RECT rc; 02156 02157 TryAgain: 02158 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 02159 /* 02160 * Find an available DC for this monitor. 02161 */ 02162 if (pdce->DCX_flags & (DCX_INUSE | DCX_DESTROYTHIS)) 02163 continue; 02164 02165 if (pdce->pMonitor != pMonitor) 02166 continue; 02167 02168 if (!(pdce->DCX_flags & DCX_INVALID)) 02169 SpbCheckDce(pdce); 02170 02171 /* 02172 * Copy DC properties and style bits. 02173 */ 02174 GreSetDCOwner(pdce->hdc, OBJECT_OWNER_CURRENT); 02175 pdce->pwndOrg = pdceOrig->pwndOrg; 02176 pdce->pwndClip = pdceOrig->pwndClip; 02177 pdce->ptiOwner = pdceOrig->ptiOwner; 02178 pdce->DCX_flags = (DCX_INUSE | DCX_CACHE) | 02179 (pdceOrig->DCX_flags & DCX_LEAVEBITS); 02180 02181 if (pdceOrig->hrgnClip > HRGN_FULL) { 02182 UserAssert(pdce->hrgnClip == NULL); 02183 UserAssert(pdceOrig->DCX_flags & (DCX_INTERSECTRGN | DCX_EXCLUDERGN)); 02184 02185 pdce->hrgnClip = CreateEmptyRgn(); 02186 SetMonitorRegion(pMonitor, pdce->hrgnClip, pdceOrig->hrgnClip); 02187 } else { 02188 pdce->hrgnClip = pdceOrig->hrgnClip; 02189 } 02190 02191 /* 02192 * Setup the visrgn clipped to this monitor. 02193 */ 02194 GreCopyVisRgn(pdceOrig->hdc, ghrgnGDC); 02195 SetMonitorRegion(pMonitor, ghrgnGDC, ghrgnGDC); 02196 GreSelectVisRgn(pdce->hdc, ghrgnGDC, SVR_COPYNEW); 02197 02198 GreGetDCOrgEx(pdceOrig->hdc, &pt, &rc); 02199 OffsetRect(&rc, -pMonitor->rcMonitor.left, -pMonitor->rcMonitor.top); 02200 GreSetDCOrg(pdce->hdc, rc.left, rc.top, (PRECTL)&rc); 02201 02202 /* 02203 * Decrement the Free DCE Count. This should always be >= 0, 02204 * since we'll create a new dce if the cache is all in use. 02205 */ 02206 DecrementFreeDCECount(); 02207 02208 return pdce->hdc; 02209 } 02210 02211 /* 02212 * If this call succeeds a new DC will be available in the cache, 02213 * so the loop will find it and properly set it up. 02214 */ 02215 if (CreateCacheDC(NULL, DCX_INVALID | DCX_CACHE, pMonitor) == NULL) 02216 return NULL; 02217 02218 goto TryAgain; 02219 }

void GetMonitorMaxArea PWND  pwnd,
PMONITOR  pMonitor,
LPRECT *  pprc
 

Definition at line 62 of file movesize.c.

References tagMONITOR::cFullScreen, tagMONITOR::rcMonitor, tagMONITOR::rcWork, TestWF, WFCPRESENT, and WFMAXBOX.

Referenced by CkptRestore(), and xxxInitSendValidateMinMaxInfo().

00063 { 00064 if ( !TestWF(pwnd, WFMAXBOX) || 00065 !TestWF(pwnd, WFCPRESENT) || 00066 pMonitor->cFullScreen) { 00067 00068 *pprc = &pMonitor->rcMonitor; 00069 } else { 00070 *pprc = &pMonitor->rcWork; 00071 } 00072 }

UINT GetMouseKeyFlags PQ  pq  ) 
 

Definition at line 3267 of file ntuser/kernel/input.c.

References TestKeyStateDown, and UINT.

Referenced by xxxDefWindowProc(), xxxProcessEventMessage(), xxxScanSysQueue(), and xxxSystemTimerProc().

03269 { 03270 UINT wParam = 0; 03271 03272 if (TestKeyStateDown(pq, VK_LBUTTON)) 03273 wParam |= MK_LBUTTON; 03274 if (TestKeyStateDown(pq, VK_RBUTTON)) 03275 wParam |= MK_RBUTTON; 03276 if (TestKeyStateDown(pq, VK_MBUTTON)) 03277 wParam |= MK_MBUTTON; 03278 if (TestKeyStateDown(pq, VK_XBUTTON1)) 03279 wParam |= MK_XBUTTON1; 03280 if (TestKeyStateDown(pq, VK_XBUTTON2)) 03281 wParam |= MK_XBUTTON2; 03282 if (TestKeyStateDown(pq, VK_SHIFT)) 03283 wParam |= MK_SHIFT; 03284 if (TestKeyStateDown(pq, VK_CONTROL)) 03285 wParam |= MK_CONTROL; 03286 03287 return wParam; 03288 }

__inline PPOPUPMENU GetpGlobalPopupMenu PWND  pwnd  ) 
 

Definition at line 4731 of file userk.h.

Referenced by xxxGetMenuBarInfo(), and xxxGetSystemMenu().

04734 {

__inline PMENUSTATE GetpMenuState PWND  pwnd  ) 
 

Definition at line 4727 of file userk.h.

References BOOL.

Referenced by MNGetPopupFromMenu(), xxxDestroyWindow(), xxxDWP_DoCancelMode(), xxxMenuWindowProc(), xxxMNEndMenuState(), xxxMNStartMenu(), xxxMNSwitchToAlternateMenu(), and xxxSendMenuSelect().

04730 {

__inline PMONITOR GetPrimaryMonitor void   ) 
 

Definition at line 7358 of file userk.h.

References gpDispInfo.

07362 {

NTSTATUS GetProcessLuid PETHREAD Thread  OPTIONAL,
PLUID  LuidProcess
 

Definition at line 50 of file ex.c.

References NTSTATUS(), NULL, ObDereferenceObject, PsGetCurrentThread, PsReferenceImpersonationToken(), PsReferencePrimaryToken(), SeQueryAuthenticationIdToken(), Status, and _ETHREAD::ThreadsProcess.

Referenced by EndShutdown(), InitiateShutdown(), InitPreviousUserString(), NtUserCreateWindowStation(), NtUserOpenWindowStation(), NtUserPostThreadMessage(), OpenDesktopCompletion(), xxxCreateDesktop2(), xxxInitProcessInfo(), xxxResolveDesktop(), and xxxUpdatePerUserAccessPackSettings().

00054 { 00055 PACCESS_TOKEN UserToken = NULL; 00056 BOOLEAN fCopyOnOpen; 00057 BOOLEAN fEffectiveOnly; 00058 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 00059 NTSTATUS Status; 00060 00061 if (Thread == NULL) 00062 Thread = PsGetCurrentThread(); 00063 00064 // 00065 // Check for a thread token first 00066 // 00067 00068 UserToken = PsReferenceImpersonationToken(Thread, 00069 &fCopyOnOpen, &fEffectiveOnly, &ImpersonationLevel); 00070 00071 if (UserToken == NULL) { 00072 00073 // 00074 // No thread token, go to the process 00075 // 00076 00077 UserToken = PsReferencePrimaryToken(Thread->ThreadsProcess); 00078 if (UserToken == NULL) 00079 return STATUS_NO_TOKEN; 00080 } 00081 00082 Status = SeQueryAuthenticationIdToken(UserToken, LuidProcess); 00083 00084 // 00085 // We're finished with the token 00086 // 00087 00088 ObDereferenceObject(UserToken); 00089 00090 return Status; 00091 }

ULONG GetTaskName PTHREADINFO  pti,
PWSTR  Buffer,
ULONG  BufferLength
 

Definition at line 5857 of file queue.c.

References Buffer, FALSE, min, NT_SUCCESS, NTSTATUS(), NULL, tagTHREADINFO::pstrAppName, RtlAnsiStringToUnicodeString(), RtlInitAnsiString(), SHORT, and Status.

Referenced by xxxQueryInformationThread(), and xxxSendBSMtoDesktop().

05861 { 05862 ANSI_STRING strAppName; 05863 UNICODE_STRING strAppNameU; 05864 NTSTATUS Status; 05865 ULONG NameLength = 0; 05866 05867 if (pti == NULL) { 05868 *Buffer = 0; 05869 return 0; 05870 } 05871 if (pti->pstrAppName != NULL) { 05872 NameLength = min(pti->pstrAppName->Length + sizeof(WCHAR), BufferLength); 05873 RtlCopyMemory(Buffer, pti->pstrAppName->Buffer, NameLength); 05874 } else { 05875 RtlInitAnsiString(&strAppName, pti->pEThread->ThreadsProcess->ImageFileName); 05876 if (BufferLength < sizeof(WCHAR)) 05877 NameLength = (strAppName.Length + 1) * sizeof(WCHAR); 05878 else { 05879 strAppNameU.Buffer = Buffer; 05880 strAppNameU.MaximumLength = (SHORT)BufferLength - sizeof(WCHAR); 05881 Status = RtlAnsiStringToUnicodeString(&strAppNameU, &strAppName, 05882 FALSE); 05883 if (NT_SUCCESS(Status)) 05884 NameLength = strAppNameU.Length + sizeof(WCHAR); 05885 } 05886 } 05887 Buffer[(NameLength / sizeof(WCHAR)) - 1] = 0; 05888 05889 return NameLength; 05890 }

PWND GetTopMostInsertAfter PWND  pwnd  ) 
 

Definition at line 3843 of file swp.c.

References FNID_MENU, FNID_SWITCH, GETFNID, GETPTI, gHardErrorHandler, grpdeskLogon, NULL, tagDESKTOP::pDeskInfo, tagTHREADINFO::ppi, tagWINDOWSTATION::pTerm, tagHARDERRORHANDLER::pti, PtiCurrent, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, tagDESKTOPINFO::spwnd, tagWND::spwndChild, tagWND::spwndNext, TestWF, and WEFTOPMOST.

03844 { 03845 PWND pwndT; 03846 PTHREADINFO ptiCurrent; 03847 PDESKTOP pdesk; 03848 WORD wfnid; 03849 03850 /* 03851 * If you hit this assertion, you're probably not using the 03852 * GETTOPMOSTINSERTAFTER macro to make this call. 03853 */ 03854 UserAssert(gHardErrorHandler.pti != NULL); 03855 /* 03856 * pwnd: Menu and switch (ALT-TAB) windows can go on top. 03857 */ 03858 wfnid = GETFNID(pwnd); 03859 if ((wfnid == FNID_MENU) || (wfnid == FNID_SWITCH)) { 03860 return NULL; 03861 } 03862 03863 /* 03864 * pti: If this is the error handler thread, don't bother any longer. 03865 * Screen saver can go on top too. 03866 */ 03867 ptiCurrent = PtiCurrent(); 03868 UserAssert(ptiCurrent != NULL); 03869 03870 if (ptiCurrent == gHardErrorHandler.pti || (ptiCurrent->ppi->W32PF_Flags & W32PF_SCREENSAVER)) { 03871 return NULL; 03872 } 03873 03874 /* 03875 * pdesk: Leave the logon desktop alone. 03876 * Make sure the hard error box is on this desktop 03877 */ 03878 pdesk = ptiCurrent->rpdesk; 03879 UserAssert(pdesk != NULL); 03880 UserAssert(pdesk->rpwinstaParent); 03881 UserAssert(pdesk->rpwinstaParent->pTerm); 03882 03883 if ((pdesk == grpdeskLogon) 03884 || (pdesk != gHardErrorHandler.pti->rpdesk)) { 03885 return NULL; 03886 } 03887 03888 /* 03889 * Walk the window list looking for the hard error box. 03890 * Start searching from the current desktop's first child. 03891 * Note that the harderror box migth not be created yet. 03892 */ 03893 UserAssert(pdesk->pDeskInfo); 03894 UserAssert(pdesk->pDeskInfo->spwnd); 03895 03896 for (pwndT = pdesk->pDeskInfo->spwnd->spwndChild; 03897 pwndT != NULL; pwndT = pwndT->spwndNext) { 03898 03899 /* 03900 * Hard error boxes are always top most. 03901 */ 03902 if (!TestWF(pwndT, WEFTOPMOST)) { 03903 break; 03904 } 03905 03906 /* 03907 * If this window was created by the hard error handler thread, 03908 * then this is it 03909 */ 03910 if (gHardErrorHandler.pti == GETPTI(pwndT)) { 03911 return pwndT; 03912 } 03913 } 03914 03915 return NULL; 03916 }

VOID GetWindowNCMetrics LPNONCLIENTMETRICS  lpnc  ) 
 

Definition at line 1030 of file inctlpan.c.

References ghMenuFont, ghSmCaptionFont, ghStatusFont, gpsi, SYSMET, and VOID().

Referenced by xxxSystemParametersInfo().

01032 { 01033 lpnc->cbSize = sizeof(NONCLIENTMETRICS); 01034 lpnc->iBorderWidth = gpsi->gclBorder; 01035 lpnc->iScrollWidth = SYSMET(CXVSCROLL); 01036 lpnc->iScrollHeight = SYSMET(CYVSCROLL); 01037 lpnc->iCaptionWidth = SYSMET(CXSIZE); 01038 lpnc->iCaptionHeight = SYSMET(CYSIZE); 01039 lpnc->iSmCaptionWidth = SYSMET(CXSMSIZE); 01040 lpnc->iSmCaptionHeight = SYSMET(CYSMSIZE); 01041 lpnc->iMenuWidth = SYSMET(CXMENUSIZE); 01042 lpnc->iMenuHeight = SYSMET(CYMENUSIZE); 01043 01044 /* 01045 * Get the font info. 01046 */ 01047 GreExtGetObjectW(gpsi->hCaptionFont, 01048 sizeof(LOGFONTW), 01049 &(lpnc->lfCaptionFont)); 01050 01051 GreExtGetObjectW(ghSmCaptionFont, 01052 sizeof(LOGFONTW), 01053 &(lpnc->lfSmCaptionFont)); 01054 01055 GreExtGetObjectW(ghMenuFont, 01056 sizeof(LOGFONTW), 01057 &(lpnc->lfMenuFont)); 01058 01059 GreExtGetObjectW(ghStatusFont, 01060 sizeof(LOGFONTW), 01061 &(lpnc->lfStatusFont)); 01062 01063 GreExtGetObjectW(gpsi->hMsgFont, 01064 sizeof(LOGFONTW), 01065 &(lpnc->lfMessageFont)); 01066 }

UINT GetWndSBDisableFlags PWND  ,
BOOL 
 

Definition at line 186 of file sbctl.c.

References NULL, tagWND::pSBInfo, UINT, WSB_HORZ, WSB_VERT, and tagSBINFO::WSBflags.

Referenced by _GetScrollBarInfo(), HitTestScrollBar(), xxxDoScrollMenu(), xxxDrawScrollBar(), xxxDrawThumb(), and xxxSBTrackInit().

00189 { 00190 PSBINFO pw; 00191 00192 if ((pw = pwnd->pSBInfo) == NULL) { 00193 RIPERR0(ERROR_NO_SCROLLBARS, RIP_VERBOSE, ""); 00194 return 0; 00195 } 00196 00197 return (fVert ? (pw->WSBflags & WSB_VERT) >> 2 : pw->WSBflags & WSB_HORZ); 00198 }

__inline void GiveForegroundActivateRight HANDLE  hPid  ) 
 

Definition at line 6338 of file userk.h.

References ACTIVATE_ARRAY_SIZE, BOOL, and ghCanActivateForegroundPIDs.

Referenced by DestroyProcessInfo(), and xxxUserNotifyProcessCreate().

06349 {

__inline BOOL GiveUpForeground  ) 
 

Definition at line 7033 of file userk.h.

References gppiLockSFW, guSFWLockCount, and NULL.

Referenced by CheckAllowForeground(), and xxxSetForegroundWindow().

07033 { 07034 return ((guSFWLockCount != 0) || (gppiLockSFW != NULL)); 07035 } 07036 07037 07038 /* Bug 247768 - joejo 07039 * Add compatibility hack for foreground activation problems. 07040 * 07041 */ 07042 __inline 07043 BOOL GiveUpForeground() 07044 { 07045 07046 if (gptiForeground == NULL) {

UINT APIENTRY GreGetTextAlign HDC   ) 
 

Referenced by CreateCompatiblePublicDC(), xxxDrawCaptionTemp(), xxxDrawState(), xxxHotTrackMenu(), xxxMenuDraw(), and xxxMNInvertItem().

UINT APIENTRY GreSetTextAlign HDC  ,
UINT 
 

Referenced by CreateCompatiblePublicDC(), DesktopBuildPaint(), xxxDrawCaptionTemp(), xxxDrawState(), xxxHotTrackMenu(), xxxMenuDraw(), and xxxMNInvertItem().

__inline BOOL HasForegroundActivateRight HANDLE  hPid  ) 
 

Definition at line 6349 of file userk.h.

References ACTIVATE_ARRAY_SIZE, and ghCanActivateForegroundPIDs.

Referenced by CheckAllowForeground().

06349 { 06350 static int index = 0; 06351 06352 TAGMSG1(DBGTAG_FOREGROUND, "Giving %x foreground activate right", hPid); 06353 ghCanActivateForegroundPIDs[index++] = hPid; 06354 if(index == ACTIVATE_ARRAY_SIZE) { 06355 index = 0; 06356 } 06357 } 06358 06359 __inline BOOL HasForegroundActivateRight(HANDLE hPid) 06360 { 06361 int i = 0; 06362

ULONG HdevFromMonitor PMONITOR  pMonitor  ) 
 

Definition at line 432 of file fullscr.c.

References gpDispInfo, tagMONITOR::hDev, and tagDISPLAYINFO::pmdev.

Referenced by SnapshotMonitorRects(), and UpdateUserScreen().

00433 { 00434 PMDEV pmdev = gpDispInfo->pmdev; 00435 ULONG i; 00436 00437 for (i = 0; i < pmdev->chdev; i++) { 00438 if (pmdev->Dev[i].hdev == pMonitor->hDev) { 00439 return i; 00440 } 00441 } 00442 return -1; 00443 }

PKL HKLtoPKL PTHREADINFO  pti,
HKL  hkl
 

Definition at line 40 of file kbdlyout.c.

References tagKL::dwKL_Flags, tagKL::hkl, KL_UNLOADED, NULL, tagKL::pklNext, tagKL::pklPrev, and tagTHREADINFO::spklActive.

Referenced by NtUserMapVirtualKeyEx(), NtUserSetThreadLayoutHandles(), NtUserVkKeyScanEx(), xxxActivateKeyboardLayout(), xxxFreeKeyboardLayouts(), xxxInternalToUnicode(), xxxInternalUnloadKeyboardLayout(), xxxLoadKeyboardLayoutEx(), xxxScanSysQueue(), xxxSystemParametersInfo(), and xxxUnloadKeyboardLayout().

00043 { 00044 PKL pklActive; 00045 PKL pkl; 00046 00047 UserAssert(pti != NULL); 00048 if ((pklActive = pti->spklActive) == NULL) { 00049 return NULL; 00050 } 00051 00052 pkl = pklActive; 00053 00054 if (hkl == (HKL)HKL_PREV) { 00055 do { 00056 pkl = pkl->pklPrev; 00057 if (!(pkl->dwKL_Flags & KL_UNLOADED)) { 00058 return pkl; 00059 } 00060 } while (pkl != pklActive); 00061 return NULL; 00062 } else if (hkl == (HKL)HKL_NEXT) { 00063 do { 00064 pkl = pkl->pklNext; 00065 if (!(pkl->dwKL_Flags & KL_UNLOADED)) { 00066 return pkl; 00067 } 00068 } while (pkl != pklActive); 00069 return NULL; 00070 } 00071 00072 /* 00073 * Find the pkl for this hkl. 00074 * If the kbd layout isn't specified (in the HIWORD), ignore it and look 00075 * for a Locale match only. (Mohamed Hamid's fix for Word bug) 00076 */ 00077 if (HandleToUlong(hkl) & 0xffff0000) { 00078 do { 00079 if (pkl->hkl == hkl) { 00080 return pkl; 00081 } 00082 pkl = pkl->pklNext; 00083 } while (pkl != pklActive); 00084 } else { 00085 do { 00086 if (LOWORD(HandleToUlong(pkl->hkl)) == LOWORD(HandleToUlong(hkl))) { 00087 return pkl; 00088 } 00089 pkl = pkl->pklNext; 00090 } while (pkl != pklActive); 00091 } 00092 00093 return NULL; 00094 }

PVOID HMAllocObject PTHREADINFO  pti,
PDESKTOP  pdesk,
BYTE  btype,
DWORD  size
 

Definition at line 828 of file handtabl.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bFlags, tagHANDLETYPEINFO::bObjectCreateFlags, BOOL, _HANDLEENTRY::bType, BYTE, tagSERVERINFO::cHandleEntries, CheckCritIn, DBGHMValidateFreeLists, DBGValidateHandleQuota, DesktopAlloc(), DTAG_HANDTABL, DWORD, ExQueryPoolBlockSize(), gahti, gcHandlePages, giheLast, gpHandlePages, gpsi, gpvSharedAlloc, gSharedInfo, gUserProcessHandleQuota, _HEAD::h, HMGrowHandleTable(), HMHandleFromIndex, HMINDEXBITS, HMIndexFromHandle, tagTDB::hTaskWow, _HANDLEPAGE::iheFreeEven, _HANDLEPAGE::iheFreeOdd, tagPERFINFO::lCount, tagPERFINFO::lMaxCount, LockDesktop, tagPERFINFO::lSize, tagPERFINFO::lTotalCount, NULL, OCF_DESKTOPHEAP, OCF_MARKPROCESS, OCF_PROCESSOWNED, OCF_SHAREDHEAP, OCF_THREADOWNED, OCF_USEPOOLIFNODESKTOP, OCF_USEPOOLQUOTA, OCF_VARIABLESIZE, PBYTE, _HANDLEENTRY::phead, tagDESKTOP::pheapDesktop, _HANDLEENTRY::pOwner, tagTHREADINFO::ppi, PPROCMARKHEAD, tagTHREADINFO::ptdb, RtlSizeHeap(), SharedAlloc(), TIF_16BIT, tagTHREADINFO::TIF_flags, and TYPE_WINDOW.

Referenced by _BeginDeferWindowPos(), _ConvertMemHandle(), _CreateAcceleratorTable(), _CreateEmptyCursorObject(), _SetWinEventHook(), CreateInputContext(), CreateMonitor(), Createpxs(), GetCPD(), InternalCreateMenu(), InternalSetTimer(), LoadKeyboardLayoutFile(), NewConversation(), xxxCreateWindowEx(), xxxCsDdeInitialize(), xxxLoadKeyboardLayoutEx(), and zzzSetWindowsHookEx().

00833 { 00834 DWORD i; 00835 PHEAD phead; 00836 PHE pheT; 00837 ULONG_PTR iheFree, *piheFreeHead; 00838 PHANDLEPAGE php; 00839 BYTE bCreateFlags; 00840 PPROCESSINFO ppiQuotaCharge = NULL; 00841 BOOL fUsePoolIfNoDesktop; 00842 BOOL fEven; 00843 00844 CheckCritIn(); 00845 bCreateFlags = gahti[bType].bObjectCreateFlags; 00846 00847 #if DBG 00848 /* 00849 * Validate size 00850 */ 00851 if (bCreateFlags & OCF_VARIABLESIZE) { 00852 UserAssert(gahti[bType].uSize <= size); 00853 } else { 00854 UserAssert(gahti[bType].uSize == size); 00855 } 00856 #endif 00857 00858 /* 00859 * Check for process handle quota 00860 */ 00861 if (bCreateFlags & (OCF_PROCESSOWNED | OCF_THREADOWNED)) { 00862 UserAssert(ptiOwner != NULL); 00863 ppiQuotaCharge = ptiOwner->ppi; 00864 if (ppiQuotaCharge->UserHandleCount >= gUserProcessHandleQuota) { 00865 RIPERR0(ERROR_NO_MORE_USER_HANDLES, 00866 RIP_WARNING, 00867 "USER: HMAllocObject: out of handle quota\n"); 00868 return NULL; 00869 } 00870 } 00871 00872 /* 00873 * Find the next free handle 00874 * Window handles must be even; hence we try first to use odd handles 00875 * for all other objects. 00876 * Old comment: 00877 * Some wow apps, like WinProj, require even Window handles so we'll 00878 * accomodate them; build a list of the odd handles so they won't get lost 00879 * 10/13/97: WinProj never fixed this; even the 32 bit version has the problem. 00880 */ 00881 fEven = (bType == TYPE_WINDOW); 00882 piheFreeHead = NULL; 00883 do { 00884 php = gpHandlePages; 00885 for (i = 0; i < gcHandlePages; ++i, ++php) { 00886 if (fEven) { 00887 if (php->iheFreeEven != 0) { 00888 piheFreeHead = &php->iheFreeEven; 00889 break; 00890 } 00891 } else { 00892 if (php->iheFreeOdd != 0) { 00893 piheFreeHead = &php->iheFreeOdd; 00894 break; 00895 } 00896 } 00897 } /* for */ 00898 /* 00899 * If we couldn't find an odd handle, then search for an even one 00900 */ 00901 fEven = ((piheFreeHead == NULL) && !fEven); 00902 } while (fEven); 00903 /* 00904 * If there are no free handles we can use, grow the table 00905 */ 00906 if (piheFreeHead == NULL) { 00907 HMGrowHandleTable(); 00908 /* 00909 * If the table didn't grow, get out. 00910 */ 00911 if (i == gcHandlePages) { 00912 RIPMSG0(RIP_WARNING, "HMAllocObject: could not grow handle space"); 00913 return NULL; 00914 } 00915 /* 00916 * Because the handle page table may have moved, 00917 * recalc the page entry pointer. 00918 */ 00919 php = &gpHandlePages[i]; 00920 piheFreeHead = (bType == TYPE_WINDOW ? &php->iheFreeEven : &php->iheFreeOdd); 00921 if (*piheFreeHead == 0) { 00922 UserAssert(gpsi->cHandleEntries == (HMINDEXBITS + 1)); 00923 RIPMSG0(RIP_WARNING, "HMAllocObject: handle table is full"); 00924 return NULL; 00925 } 00926 } 00927 /* 00928 * HMINDEXBITS is a reserved value that should never be in the free lists 00929 * (see HMGrowHandleTable()); 00930 */ 00931 UserAssert(HMIndexFromHandle(*piheFreeHead) != HMINDEXBITS); 00932 /* 00933 * Try to allocate the object. If this fails, bail out. 00934 */ 00935 if ((bCreateFlags & OCF_DESKTOPHEAP) && pdeskSrc) { 00936 phead = (PHEAD)DesktopAlloc(pdeskSrc, size, DTAG_HANDTABL); 00937 if (phead) { 00938 LockDesktop(&((PDESKOBJHEAD)phead)->rpdesk, pdeskSrc, LDL_OBJ_DESK, (ULONG_PTR)phead); 00939 ((PDESKOBJHEAD)phead)->pSelf = (PBYTE)phead; 00940 } 00941 } else if (bCreateFlags & OCF_SHAREDHEAP) { 00942 UserAssert(!pdeskSrc); 00943 phead = (PHEAD)SharedAlloc(size); 00944 } else { 00945 fUsePoolIfNoDesktop = !pdeskSrc && (bCreateFlags & OCF_USEPOOLIFNODESKTOP); 00946 UserAssert(!(bCreateFlags & OCF_DESKTOPHEAP) || fUsePoolIfNoDesktop); 00947 00948 if ((bCreateFlags & OCF_USEPOOLQUOTA) && !fUsePoolIfNoDesktop) { 00949 phead = (PHEAD)UserAllocPoolWithQuotaZInit(size, gahti[bType].dwAllocTag); 00950 } else { 00951 phead = (PHEAD)UserAllocPoolZInit(size, gahti[bType].dwAllocTag); 00952 } 00953 } 00954 00955 if (phead == NULL) { 00956 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, 00957 RIP_WARNING, 00958 "USER: HMAllocObject: out of memory"); 00959 return NULL; 00960 } 00961 /* 00962 * We're going to use this handle so get it off its free list. 00963 * The free handle phead points to the next free handle. 00964 */ 00965 iheFree = *piheFreeHead; 00966 pheT = &gSharedInfo.aheList[iheFree]; 00967 *piheFreeHead = (ULONG_PTR)pheT->phead; 00968 DBGHMValidateFreeLists(); 00969 /* 00970 * Track high water mark for handle allocation. 00971 */ 00972 if ((DWORD)iheFree > giheLast) { 00973 giheLast = (DWORD)iheFree; 00974 } 00975 /* 00976 * Setup the handle contents, plus initialize the object header. 00977 */ 00978 pheT->bType = bType; 00979 pheT->phead = phead; 00980 UserAssert(pheT->bFlags == 0); 00981 if (bCreateFlags & OCF_PROCESSOWNED) { 00982 if ((ptiOwner->TIF_flags & TIF_16BIT) && (ptiOwner->ptdb)) { 00983 ((PPROCOBJHEAD)phead)->hTaskWow = ptiOwner->ptdb->hTaskWow; 00984 } else { 00985 ((PPROCOBJHEAD)phead)->hTaskWow = 0; 00986 } 00987 pheT->pOwner = ptiOwner->ppi; 00988 if (bCreateFlags & OCF_MARKPROCESS) { 00989 ((PPROCMARKHEAD)phead)->ppi = ptiOwner->ppi; 00990 } 00991 } else if (bCreateFlags & OCF_THREADOWNED) { 00992 ((PTHROBJHEAD)phead)->pti = pheT->pOwner = ptiOwner; 00993 } else { 00994 /* 00995 * The caller is wasting time if ptiOwner != NULL 00996 * The handle entry must already have pOwner == NULL. 00997 */ 00998 UserAssert(ptiOwner == NULL); 00999 UserAssert(pheT->pOwner == NULL); 01000 } 01001 01002 phead->h = HMHandleFromIndex(iheFree); 01003 01004 if (ppiQuotaCharge) { 01005 ppiQuotaCharge->UserHandleCount++; 01006 DBGValidateHandleQuota(); 01007 } 01008 01009 #if DBG 01010 /* 01011 * performance counter dumphmgr 01012 * dwPrevCount is used for the snapshot option 01013 */ 01014 01015 gaPerfhti[bType].lTotalCount++; 01016 gaPerfhti[bType].lCount++; 01017 if (gaPerfhti[bType].lCount > gaPerfhti[bType].lMaxCount) { 01018 gaPerfhti[bType].lMaxCount = gaPerfhti[bType].lCount; 01019 } 01020 if ((bCreateFlags & OCF_DESKTOPHEAP) && (pdeskSrc != NULL)) { 01021 gaPerfhti[bType].lSize += RtlSizeHeap(Win32HeapGetHandle(pdeskSrc->pheapDesktop), 0, phead); 01022 } else if (bCreateFlags & OCF_SHAREDHEAP) { 01023 gaPerfhti[bType].lSize += RtlSizeHeap(Win32HeapGetHandle(gpvSharedAlloc), 0, phead); 01024 } else { 01025 unsigned char notUsed; 01026 gaPerfhti[bType].lSize += ExQueryPoolBlockSize(phead, &notUsed); 01027 } 01028 01029 #endif // DBG 01030 01031 /* 01032 * Return a handle entry pointer. 01033 */ 01034 return pheT->phead; 01035 }

PVOID FASTCALL HMAssignmentLock PVOID *  ppobj,
PVOID  pobj
 

Definition at line 1509 of file handtabl.c.

References FASTCALL, HMIsMarkDestroy, HMLockObject, HMRecordLock(), HMUnlockObject, HMUnrecordLock(), HMValidateCatHandleNoSecure(), NULL, PHEAD, and TYPE_GENERIC.

01512 { 01513 PVOID pobjOld; 01514 01515 pobjOld = *ppobj; 01516 *ppobj = pobj; 01517 01518 /* 01519 * Unlocks the old, locks the new. 01520 */ 01521 if (pobjOld != NULL) { 01522 01523 /* 01524 * if we are locking in the same object that is there then 01525 * it is a no-op but we don't want to do the Unlock and the Lock 01526 * because the unlock could free object and the lock would lock 01527 * in a freed pointer; 6410. 01528 */ 01529 if (pobjOld == pobj) { 01530 return pobjOld; 01531 } 01532 01533 #if DEBUGTAGS 01534 01535 /* 01536 * Track assignment locks. 01537 */ 01538 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 01539 if (!HMUnrecordLock(ppobj, pobjOld)) { 01540 HMRecordLock(ppobj, pobjOld, ((PHEAD)pobjOld)->cLockObj - 1); 01541 } 01542 } 01543 #endif 01544 01545 } 01546 01547 01548 if (pobj != NULL) { 01549 UserAssert(pobj == HMValidateCatHandleNoSecure(((PHEAD)pobj)->h, TYPE_GENERIC)); 01550 if (HMIsMarkDestroy(pobj)) { 01551 RIPERR2(ERROR_INVALID_PARAMETER, 01552 RIP_WARNING, 01553 "HMAssignmentLock, locking object %#p marked for destruction at %#p\n", 01554 pobj, ppobj); 01555 } 01556 #if DEBUGTAGS 01557 01558 /* 01559 * Track assignment locks. 01560 */ 01561 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 01562 HMRecordLock(ppobj, pobj, ((PHEAD)pobj)->cLockObj + 1); 01563 if (HMIsMarkDestroy(pobj)) { 01564 01565 RIPMSG2(RIP_WARNING, 01566 "Locking object %#p marked for destruction at %#p", 01567 pobj, ppobj); 01568 } 01569 } 01570 #endif 01571 HMLockObject(pobj); 01572 } 01573 01574 /* 01575 * This unlock has been moved from up above, so that we implement a 01576 * "lock before unlock" strategy. Just in case pobjOld was the 01577 * only object referencing pobj, pobj won't go away when we unlock 01578 * pobjNew -- it will have been locked above. 01579 */ 01580 01581 if (pobjOld) { 01582 pobjOld = HMUnlockObject(pobjOld); 01583 } 01584 01585 return pobjOld; 01586 }

PVOID FASTCALL HMAssignmentUnlock PVOID *  ppobj  ) 
 

Definition at line 1599 of file handtabl.c.

References FASTCALL, HMRecordLock(), HMUnlockObject, HMUnrecordLock(), and NULL.

01601 { 01602 PVOID pobjOld; 01603 01604 pobjOld = *ppobj; 01605 *ppobj = NULL; 01606 01607 /* 01608 * Unlocks the old, locks the new. 01609 */ 01610 if (pobjOld != NULL) { 01611 01612 #if DEBUGTAGS 01613 01614 /* 01615 * Track assignment locks. 01616 */ 01617 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 01618 if (!HMUnrecordLock(ppobj, pobjOld)) { 01619 HMRecordLock(ppobj, pobjOld, ((PHEAD)pobjOld)->cLockObj - 1); 01620 } 01621 } 01622 #endif 01623 pobjOld = HMUnlockObject(pobjOld); 01624 } 01625 01626 return pobjOld; 01627 }

VOID HMChangeOwnerPheProcess PHE  phe,
PTHREADINFO  pti
 

Definition at line 2220 of file handtabl.c.

References tagHANDLETYPEINFO::bObjectCreateFlags, _HANDLEENTRY::bType, DBGValidateHandleQuota, gahti, HMObjectFlags, tagTDB::hTaskWow, NULL, OCF_MARKPROCESS, OCF_PROCESSOWNED, _HANDLEENTRY::phead, _HANDLEENTRY::pOwner, tagTHREADINFO::ppi, tagTHREADINFO::ptdb, TIF_16BIT, tagTHREADINFO::TIF_flags, TYPE_CURSOR, and VOID().

Referenced by DestroyProcessesObjects().

02223 { 02224 PPROCESSINFO ppiOwner = (PPROCESSINFO)(phe->pOwner); 02225 PVOID pobj = phe->phead; 02226 02227 UserAssert(HMObjectFlags(pobj) & OCF_PROCESSOWNED); 02228 UserAssert(pti != NULL); 02229 /* 02230 * Dec current owner handle count 02231 */ 02232 ppiOwner->UserHandleCount--; 02233 /* 02234 * hTaskWow 02235 */ 02236 if ((pti->TIF_flags & TIF_16BIT) && (pti->ptdb)) { 02237 ((PPROCOBJHEAD)pobj)->hTaskWow = pti->ptdb->hTaskWow; 02238 } else { 02239 ((PPROCOBJHEAD)pobj)->hTaskWow = 0; 02240 } 02241 /* 02242 * ppi 02243 */ 02244 if (gahti[phe->bType].bObjectCreateFlags & OCF_MARKPROCESS) { 02245 ((PPROCMARKHEAD)pobj)->ppi = pti->ppi; 02246 } 02247 /* 02248 * Set new owner in handle entry 02249 */ 02250 phe->pOwner = pti->ppi; 02251 /* 02252 * Inc new owner handle count 02253 */ 02254 ((PPROCESSINFO)(phe->pOwner))->UserHandleCount++; 02255 /* 02256 * If the handle is a cursor, adjust GDI cursor handle count 02257 */ 02258 if (phe->bType == TYPE_CURSOR) { 02259 GreDecQuotaCount((PW32PROCESS)ppiOwner); 02260 GreIncQuotaCount((PW32PROCESS)phe->pOwner); 02261 02262 if (((PCURSOR)pobj)->hbmColor) { 02263 GreDecQuotaCount((PW32PROCESS)ppiOwner); 02264 GreIncQuotaCount((PW32PROCESS)phe->pOwner); 02265 } 02266 } 02267 02268 DBGValidateHandleQuota(); 02269 }

VOID HMChangeOwnerThread PVOID  pobj,
PTHREADINFO  pti
 

Definition at line 2112 of file handtabl.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, _HANDLEENTRY::bType, tagTHREADINFO::cVisWindows, tagTHREADINFO::cWindows, tagCLS::cWndReferenceCount, DBGValidateHandleQuota, DereferenceClass(), FVisCountable(), GetClassPtr(), gpsi, gptiRit, tagWND::head, HF_GLOBAL, HMObjectFlags, hModuleWin, HMPheFromObject, ICLS_ICONTITLE, LockDesktop, NULL, OCF_THREADOWNED, tagWND::pcls, PHOOK, _HANDLEENTRY::pOwner, tagTHREADINFO::ppi, PpiCurrent, tagTHREADINFO::rpdesk, TestWF, TYPE_HOOK, TYPE_WINDOW, VOID(), WFDESTROYED, and WFVISIBLE.

Referenced by MarkThreadsObjects(), xxxCreateDesktop(), xxxCreateWindowStation(), xxxDestroyWindow(), xxxFreeWindow(), and xxxMNOpenHierarchy().

02115 { 02116 PHE phe = HMPheFromObject(pobj); 02117 PTHREADINFO ptiOld = ((PTHROBJHEAD)(pobj))->pti; 02118 PWND pwnd; 02119 PPCLS ppcls; 02120 PPROCESSINFO ppi; 02121 02122 UserAssert(HMObjectFlags(pobj) & OCF_THREADOWNED); 02123 UserAssert(pti != NULL); 02124 02125 ((PTHREADINFO)phe->pOwner)->ppi->UserHandleCount--; 02126 02127 ((PTHROBJHEAD)pobj)->pti = phe->pOwner = pti; 02128 02129 ((PTHREADINFO)phe->pOwner)->ppi->UserHandleCount++; 02130 02131 DBGValidateHandleQuota(); 02132 02133 /* 02134 * If this is a window, update the window counts. 02135 */ 02136 switch (phe->bType) { 02137 case TYPE_WINDOW: 02138 /* 02139 * Desktop thread used to hit this assert in HYDRA 02140 * because pti == ptiOld 02141 */ 02142 UserAssert(ptiOld->cWindows > 0 || ptiOld == pti); 02143 pti->cWindows++; 02144 ptiOld->cWindows--; 02145 02146 pwnd = (PWND)pobj; 02147 02148 /* 02149 * Make sure thread visible window count is properly updated. 02150 */ 02151 if (TestWF(pwnd, WFVISIBLE) && FVisCountable(pwnd)) { 02152 pti->cVisWindows++; 02153 ptiOld->cVisWindows--; 02154 } 02155 02156 /* 02157 * If the owning process is changing, fix up 02158 * the window class. 02159 */ 02160 if (pti->ppi != ptiOld->ppi) { 02161 02162 ppcls = GetClassPtr(pwnd->pcls->atomClassName, pti->ppi, hModuleWin); 02163 02164 if (ppcls == NULL) { 02165 if (pwnd->head.rpdesk) 02166 ppi = pwnd->head.rpdesk->rpwinstaParent->pTerm->ptiDesktop->ppi; 02167 else 02168 ppi = PpiCurrent(); 02169 ppcls = GetClassPtr(gpsi->atomSysClass[ICLS_ICONTITLE], ppi, hModuleWin); 02170 } 02171 UserAssert(ppcls); 02172 02173 /* 02174 * The window is either destroyed or the desktop of the class is 02175 * the same as the window's desktop 02176 */ 02177 UserAssert((*ppcls)->rpdeskParent == pwnd->head.rpdesk || 02178 TestWF(pwnd, WFDESTROYED)); 02179 02180 DereferenceClass(pwnd); 02181 pwnd->pcls = *ppcls; 02182 pwnd->pcls->cWndReferenceCount++; 02183 } 02184 break; 02185 02186 case TYPE_HOOK: 02187 /* 02188 * If this is a global hook, remember this hook's desktop so we'll be 02189 * able to unlink it later (gptiRit might switch to a different desktop 02190 * at any time). 02191 */ 02192 UserAssert(!!(((PHOOK)pobj)->flags & HF_GLOBAL) ^ (((PHOOK)pobj)->ptiHooked != NULL)); 02193 if (((PHOOK)pobj)->flags & HF_GLOBAL) { 02194 UserAssert(pti == gptiRit); 02195 LockDesktop(&((PHOOK)pobj)->rpdesk, ptiOld->rpdesk, LDL_HOOK_DESK, 0); 02196 } else { 02197 /* 02198 * This must be a hook on another thread or it was supposed to be 02199 * gone by now. 02200 */ 02201 UserAssert(((PHOOK)pobj)->ptiHooked != ptiOld); 02202 } 02203 break; 02204 02205 default: 02206 break; 02207 } 02208 }

void HMCleanupGrantedHandle HANDLE  h  ) 
 

Definition at line 2853 of file handtabl.c.

References DWORD, gpJobsList, NULL, tagW32JOB::pgh, tagW32JOB::pNext, and tagW32JOB::ughCrt.

Referenced by HMFreeObject().

02855 { 02856 PW32JOB pW32Job; 02857 02858 pW32Job = gpJobsList; 02859 02860 while (pW32Job != NULL) { 02861 PULONG_PTR pgh; 02862 DWORD dw; 02863 02864 pgh = pW32Job->pgh; 02865 02866 /* 02867 * search for the handle in the array. 02868 */ 02869 for (dw = 0; dw < pW32Job->ughCrt; dw++) { 02870 if (*(pgh + dw) == (ULONG_PTR)h) { 02871 02872 /* 02873 * found the handle granted to this process 02874 */ 02875 RtlMoveMemory(pgh + dw, 02876 pgh + dw + 1, 02877 (pW32Job->ughCrt - dw - 1) * sizeof(*pgh)); 02878 02879 (pW32Job->ughCrt)--; 02880 02881 /* 02882 * we should shrink the array also 02883 */ 02884 02885 break; 02886 } 02887 } 02888 02889 pW32Job = pW32Job->pNext; 02890 } 02891 }

BOOL HMDestroyObject PVOID  pobj  ) 
 

Definition at line 1299 of file handtabl.c.

References BOOL, FALSE, HMFreeObject(), HMMarkObjectDestroy(), and TRUE.

Referenced by HMNullFnDestroy().

01301 { 01302 /* 01303 * First mark the object for destruction. This tells the locking code 01304 * that we want to destroy this object when the lock count goes to 0. 01305 * If this returns FALSE, we can't destroy the object yet (and can't get 01306 * rid of security yet either.) 01307 */ 01308 01309 if (!HMMarkObjectDestroy(pobj)) 01310 return FALSE; 01311 01312 /* 01313 * Ok to destroy... Free the handle (which will free the object 01314 * and the handle). 01315 */ 01316 HMFreeObject(pobj); 01317 return TRUE; 01318 }

void HMDestroyUnlockedObject PHE  phe  ) 
 

Referenced by _WOWCleanup(), DestroyHandleTableObjects(), DestroyInputContext(), DestroyProcessesObjects(), DestroyThreadsObjects(), and HMUnlockObjectInternal().

BOOL HMFreeObject PVOID  pobj  ) 
 

Definition at line 1069 of file handtabl.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bFlags, tagHANDLETYPEINFO::bObjectCreateFlags, BOOL, _HANDLEENTRY::bType, BYTE, DBGHMValidateFreeLists, DBGValidateHandleQuota, DesktopFree, DWORD, ExQueryPoolBlockSize(), gahti, gcHandlePages, gpHandlePages, gpvSharedAlloc, gSharedInfo, _HEAD::h, HANDLEF_GRANTED, HANDLEF_POOL, HMCleanupGrantedHandle(), HMPheFromObject, HMUNIQBITS, HtoPqCat, _HANDLEPAGE::iheFreeEven, _HANDLEPAGE::iheFreeOdd, _HANDLEPAGE::iheLimit, tagPERFINFO::lCount, tagPERFINFO::lSize, NULL, OCF_DESKTOPHEAP, OCF_PROCESSOWNED, OCF_SHAREDHEAP, OCF_THREADOWNED, _HANDLEENTRY::phead, tagDESKTOP::pheapDesktop, _LOCKRECORD::plrNext, _HANDLEENTRY::pOwner, PtoHq, RtlSizeHeap(), SharedFree(), TRUE, TYPE_FREE, UnlockDesktop, and _HANDLEENTRY::wUniq.

Referenced by _BeginDeferWindowPos(), _ConvertMemHandle(), _CreateAcceleratorTable(), _DestroyMenu(), DestroyEmptyCursorObject(), DestroyEventHook(), DestroyKF(), DestroyKL(), DestroyMonitor(), DestroySMWP(), FreeDdeConv(), FreeDdeXact(), FreeHook(), FreeInputContext(), FreeTimer(), HMDestroyObject(), InternalSetTimer(), LoadKeyboardLayoutFile(), MungeClipData(), NewConversation(), NtUserDestroyAcceleratorTable(), UT_FreeCBFormat(), xxxCreateWindowEx(), xxxCsDdeInitialize(), xxxDestroyThreadDDEObject(), xxxFreeWindow(), xxxGetDummyDib(), xxxGetDummyDibV5(), and zzzSetWindowsHookEx().

01071 { 01072 PHE pheT; 01073 WORD wUniqT; 01074 PHANDLEPAGE php; 01075 DWORD i; 01076 ULONG_PTR iheCurrent, *piheCurrentHead; 01077 BYTE bCreateFlags; 01078 PDESKTOP pdesk; 01079 PPROCESSINFO ppiQuotaCharge = NULL; 01080 #if DBG 01081 PLR plrT, plrNextT; 01082 unsigned char notUsed; 01083 #endif 01084 01085 UserAssert(((PHEAD)pobj)->cLockObj == 0); 01086 UserAssert(pobj == HtoPqCat(PtoHq(pobj))); 01087 /* 01088 * Free the object first. 01089 */ 01090 pheT = HMPheFromObject(pobj); 01091 bCreateFlags = gahti[pheT->bType].bObjectCreateFlags; 01092 01093 UserAssertMsg1(pheT->bType != TYPE_FREE, 01094 "Object already marked as freed!!! %#p", pobj); 01095 01096 /* 01097 * decr process handle use 01098 */ 01099 if (bCreateFlags & OCF_PROCESSOWNED) { 01100 ppiQuotaCharge = (PPROCESSINFO)pheT->pOwner; 01101 UserAssert(ppiQuotaCharge != NULL); 01102 } else if (bCreateFlags & OCF_THREADOWNED) { 01103 ppiQuotaCharge = (PPROCESSINFO)(((PTHREADINFO)(pheT->pOwner))->ppi); 01104 UserAssert(ppiQuotaCharge != NULL); 01105 } else { 01106 ppiQuotaCharge = NULL; 01107 } 01108 01109 if (ppiQuotaCharge != NULL) { 01110 ppiQuotaCharge->UserHandleCount--; 01111 } 01112 01113 if (pheT->bFlags & HANDLEF_GRANTED) { 01114 HMCleanupGrantedHandle(pheT->phead->h); 01115 pheT->bFlags &= ~HANDLEF_GRANTED; 01116 } 01117 01118 #if DBG 01119 /* 01120 * performance counters 01121 */ 01122 gaPerfhti[pheT->bType].lCount--; 01123 01124 if ((bCreateFlags & OCF_DESKTOPHEAP) && ((PDESKOBJHEAD)pobj)->rpdesk) { 01125 pdesk = ((PDESKOBJHEAD)pobj)->rpdesk; 01126 gaPerfhti[pheT->bType].lSize -= RtlSizeHeap(Win32HeapGetHandle(pdesk->pheapDesktop), 0, pobj); 01127 } else if (bCreateFlags & OCF_SHAREDHEAP) { 01128 gaPerfhti[pheT->bType].lSize -= RtlSizeHeap(Win32HeapGetHandle(gpvSharedAlloc), 0, pobj); 01129 } else { 01130 gaPerfhti[pheT->bType].lSize -= ExQueryPoolBlockSize(pobj, &notUsed); 01131 } 01132 01133 #endif // DBG 01134 01135 if ((bCreateFlags & OCF_DESKTOPHEAP)) { 01136 #if DBG 01137 BOOL bSuccess; 01138 #endif 01139 UserAssert(((PDESKOBJHEAD)pobj)->rpdesk != NULL); 01140 01141 pdesk = ((PDESKOBJHEAD)pobj)->rpdesk; 01142 UnlockDesktop(&((PDESKOBJHEAD)pobj)->rpdesk, LDU_OBJ_DESK, (ULONG_PTR)pobj); 01143 01144 if (pheT->bFlags & HANDLEF_POOL) { 01145 UserFreePool(pobj); 01146 } else { 01147 01148 #if DBG 01149 bSuccess = 01150 #endif 01151 DesktopFree(pdesk, pobj); 01152 #if DBG 01153 if (!bSuccess) { 01154 /* 01155 * We would hit this assert in HYDRA trying to free the 01156 * mother desktop window which was allocated out of pool 01157 */ 01158 RIPMSG1(RIP_ERROR, "Object already freed from desktop heap! %#p", pobj); 01159 } 01160 #endif 01161 } 01162 01163 } else if (bCreateFlags & OCF_SHAREDHEAP) { 01164 SharedFree(pobj); 01165 } else { 01166 UserFreePool(pobj); 01167 } 01168 01169 #if DBG 01170 /* 01171 * Go through and delete the lock records, if they exist. 01172 */ 01173 for (plrT = pheT->plr; plrT != NULL; plrT = plrNextT) { 01174 01175 /* 01176 * Remember the next one before freeing this one. 01177 */ 01178 plrNextT = plrT->plrNext; 01179 FreeLockRecord((HANDLE)plrT); 01180 } 01181 #endif 01182 01183 /* 01184 * Clear the handle contents. Need to remember the uniqueness across 01185 * the clear. Also, advance uniqueness on free so that uniqueness checking 01186 * against old handles also fails. 01187 */ 01188 wUniqT = (WORD)((pheT->wUniq + 1) & HMUNIQBITS); 01189 RtlZeroMemory(pheT, sizeof(HANDLEENTRY)); 01190 pheT->wUniq = wUniqT; 01191 01192 /* 01193 * Change the handle type to TYPE_FREE so we know what type this handle 01194 * is. (TYPE_FREE is defined as zero) 01195 */ 01196 /* pheT->bType = TYPE_FREE; */ 01197 UserAssert(pheT->bType == TYPE_FREE); 01198 01199 /* 01200 * Put the handle on the free list of the appropriate page. 01201 */ 01202 php = gpHandlePages; 01203 iheCurrent = pheT - gSharedInfo.aheList; 01204 for (i = 0; i < gcHandlePages; ++i, ++php) { 01205 if (iheCurrent < php->iheLimit) { 01206 piheCurrentHead = (iheCurrent & 0x1 ? &php->iheFreeOdd : &php->iheFreeEven); 01207 pheT->phead = (PHEAD)*piheCurrentHead; 01208 *piheCurrentHead = iheCurrent; 01209 DBGHMValidateFreeLists(); 01210 break; 01211 } 01212 } 01213 /* 01214 * We must have found it. 01215 */ 01216 UserAssert(i < gcHandlePages); 01217 01218 UserAssert(pheT->pOwner == NULL); 01219 01220 DBGValidateHandleQuota(); 01221 01222 return TRUE; 01223 }

NTSTATUS HMGetStats HANDLE  hProcess,
int  iPidType,
PVOID  pResults,
UINT  cjResultSize
 

BOOL HMInitHandleTable PVOID  pBase  ) 
 

Definition at line 575 of file handtabl.c.

References tagSHAREDINFO::aheList, tagHANDLETYPEINFO::bObjectCreateFlags, BOOL, _HANDLEENTRY::bType, BYTE, tagSERVERINFO::cbHandleTable, tagSERVERINFO::cHandleEntries, CommitReadOnlyMemory(), CPAGEENTRIESINIT, DESKOBJHEAD, FALSE, gahti, gcHandlePages, ghSectionShared, gpHandlePages, gpsi, gSharedInfo, HANDLEPAGE, HMINDEXBITS, HMInitHandleEntries(), _HANDLEPAGE::iheFreeEven, _HANDLEPAGE::iheFreeOdd, _HANDLEPAGE::iheLimit, NT_SUCCESS, NTSTATUS(), NULL, OCF_DESKTOPHEAP, OCF_MARKPROCESS, OCF_PROCESSOWNED, OCF_SHAREDHEAP, OCF_THREADOWNED, OCF_USEPOOLIFNODESKTOP, OCF_USEPOOLQUOTA, PAGE_SIZE, _HANDLEENTRY::phead, PROCDESKHEAD, PROCOBJHEAD, Status, THRDESKHEAD, TRUE, TYPE_CTYPES, TYPE_FREE, UINT, and _HANDLEENTRY::wUniq.

Referenced by Win32UserInitialize().

00577 { 00578 NTSTATUS Status; 00579 SIZE_T ulCommit; 00580 00581 /* 00582 * Allocate the handle page array. Make it big enough 00583 * for 4 pages, which should be sufficient for nearly 00584 * all instances. 00585 */ 00586 gpHandlePages = UserAllocPool( 00587 CPAGEENTRIESINIT * sizeof(HANDLEPAGE), TAG_SYSTEM); 00588 00589 if (gpHandlePages == NULL) 00590 return FALSE; 00591 00592 #if DBG 00593 if (!NT_SUCCESS(InitLockRecordLookaside())) 00594 return FALSE; 00595 #endif 00596 00597 /* 00598 * Allocate the array. We have the space from 00599 * NtCurrentPeb()->ReadOnlySharedMemoryBase to 00600 * NtCurrentPeb()->ReadOnlySharedMemoryHeap reserved for 00601 * the handle table. All we need to do is commit the pages. 00602 * 00603 * Compute the minimum size of the table. The allocation will 00604 * round this up to the next page size. 00605 */ 00606 ulCommit = gpsi->cbHandleTable = PAGE_SIZE; 00607 Status = CommitReadOnlyMemory(ghSectionShared, &ulCommit, 0, NULL); 00608 00609 if (!NT_SUCCESS(Status)) 00610 return FALSE; 00611 00612 gSharedInfo.aheList = pReadOnlySharedSectionBase; 00613 gpsi->cHandleEntries = gpsi->cbHandleTable / sizeof(HANDLEENTRY); 00614 gcHandlePages = 1; 00615 00616 /* 00617 * Initialize the handlepage info. Handle 0 is reserved so even free list 00618 * starts at 2. 00619 */ 00620 gpHandlePages[0].iheFreeOdd = 1; 00621 gpHandlePages[0].iheFreeEven = 2; 00622 gpHandlePages[0].iheLimit = gpsi->cHandleEntries; 00623 /* 00624 * Initialize the handle entries. 00625 */ 00626 HMInitHandleEntries(0); 00627 /* 00628 * PW(NULL) (ie, handle 0) must map to a NULL pointer. 00629 * Old comment: 00630 * Reserve the first handle table entry so that PW(NULL) maps to a 00631 * NULL pointer. Set it to TYPE_FREE so the cleanup code doesn't think 00632 * it is allocated. Set wUniq to 1 so that RevalidateHandles on NULL 00633 * will fail. 00634 */ 00635 gSharedInfo.aheList[0].phead = NULL; 00636 UserAssert(gSharedInfo.aheList[0].bType == TYPE_FREE); 00637 UserAssert(gSharedInfo.aheList[0].wUniq == 1); 00638 00639 #if DBG 00640 /* 00641 * Make sure we don't need to add the special case to handle HMINDEXBITS in this function. 00642 */ 00643 UserAssert(gpsi->cHandleEntries <= HMINDEXBITS); 00644 /* 00645 * PDESKOBJHEAD won't do the right casting unless these structs have 00646 * the same size. 00647 */ 00648 UserAssert(sizeof(THROBJHEAD) == sizeof(PROCOBJHEAD)); 00649 UserAssert(sizeof(THRDESKHEAD) == sizeof(PROCDESKHEAD)); 00650 UserAssert(sizeof(THRDESKHEAD) == sizeof(DESKOBJHEAD)); 00651 /* 00652 * Validate type flags to make sure that assumptions made 00653 * throughout HM code are OK. 00654 */ 00655 { 00656 HANDLETYPEINFO * pahti = (HANDLETYPEINFO *) gahti; 00657 UINT uTypes = TYPE_CTYPES; 00658 BYTE bObjectCreateFlags; 00659 while (uTypes-- != 0) { 00660 bObjectCreateFlags = pahti->bObjectCreateFlags; 00661 /* 00662 * Illegal flag combinations 00663 */ 00664 UserAssert(!((bObjectCreateFlags & OCF_DESKTOPHEAP) && (bObjectCreateFlags & OCF_MARKPROCESS))); 00665 /* 00666 * Pointless (and probably illegal) flag combinations 00667 */ 00668 UserAssert(!((bObjectCreateFlags & OCF_DESKTOPHEAP) && (bObjectCreateFlags & OCF_SHAREDHEAP))); 00669 UserAssert(!((bObjectCreateFlags & OCF_USEPOOLQUOTA) && (bObjectCreateFlags & OCF_SHAREDHEAP))); 00670 UserAssert(!((bObjectCreateFlags & OCF_THREADOWNED) && (bObjectCreateFlags & OCF_PROCESSOWNED))); 00671 UserAssert(!(bObjectCreateFlags & OCF_USEPOOLQUOTA) 00672 || !(bObjectCreateFlags & OCF_DESKTOPHEAP) 00673 || (bObjectCreateFlags & OCF_USEPOOLIFNODESKTOP)); 00674 00675 /* 00676 * Required flag combinations 00677 */ 00678 UserAssert(!(bObjectCreateFlags & OCF_DESKTOPHEAP) 00679 || (bObjectCreateFlags & (OCF_PROCESSOWNED | OCF_THREADOWNED))); 00680 00681 UserAssert(!(bObjectCreateFlags & OCF_MARKPROCESS) 00682 || (bObjectCreateFlags & OCF_PROCESSOWNED)); 00683 00684 UserAssert(!(bObjectCreateFlags & OCF_USEPOOLIFNODESKTOP) 00685 || (bObjectCreateFlags & OCF_DESKTOPHEAP)); 00686 00687 00688 pahti++; 00689 } /* while (uTypes-- != 0) */ 00690 } 00691 #endif 00692 00693 return TRUE; 00694 }

BOOL HMMarkObjectDestroy PVOID  pobj  ) 
 

Definition at line 1237 of file handtabl.c.

References _HANDLEENTRY::bFlags, BOOL, FALSE, HANDLEF_DESTROY, HANDLEF_INDESTROY, HANDLEF_MARKED_OK, HMPheFromObject, HMRecordLock(), LOCKRECORD_MARKDESTROY, and TRUE.

Referenced by _DestroyCursor(), _DestroyMenu(), DestroyEventHook(), DestroyKF(), DestroyMonitor(), DestroySMWP(), FreeDdeConv(), FreeDdeXact(), FreeHook(), FreeInputContext(), FreeTimer(), FreeWindowStation(), HMDestroyObject(), NtUserDestroyAcceleratorTable(), UnlockAndFreeCPDs(), Win32kNtUserCleanup(), xxxDestroyThreadDDEObject(), xxxFreeWindow(), xxxInternalUnloadKeyboardLayout(), and xxxLoadKeyboardLayoutEx().

01239 { 01240 PHE phe; 01241 01242 phe = HMPheFromObject(pobj); 01243 01244 #if DEBUGTAGS 01245 /* 01246 * Record where the object was marked for destruction. 01247 */ 01248 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 01249 if (!(phe->bFlags & HANDLEF_DESTROY)) { 01250 HMRecordLock(LOCKRECORD_MARKDESTROY, pobj, ((PHEAD)pobj)->cLockObj); 01251 } 01252 } 01253 #endif 01254 01255 /* 01256 * Set the destroy flag so our unlock code will know we're trying to 01257 * destroy this object. 01258 */ 01259 phe->bFlags |= HANDLEF_DESTROY; 01260 01261 /* 01262 * If this object can't be destroyed, then CLEAR the HANDLEF_INDESTROY 01263 * flag - because this object won't be currently "in destruction"! 01264 * (if we didn't clear it, when it was unlocked it wouldn't get destroyed). 01265 */ 01266 if (((PHEAD)pobj)->cLockObj != 0) { 01267 phe->bFlags &= ~HANDLEF_INDESTROY; 01268 01269 /* 01270 * Return FALSE because we can't destroy this object. 01271 */ 01272 return FALSE; 01273 } 01274 01275 #if DBG 01276 /* 01277 * Ensure that this function only returns TRUE once. 01278 */ 01279 UserAssert(!(phe->bFlags & HANDLEF_MARKED_OK)); 01280 phe->bFlags |= HANDLEF_MARKED_OK; 01281 #endif 01282 01283 /* 01284 * Return TRUE because Lock count is zero - ok to destroy this object. 01285 */ 01286 return TRUE; 01287 }

PVOID HMUnlockObjectInternal PVOID  pobj  ) 
 

Definition at line 1472 of file handtabl.c.

References _HANDLEENTRY::bFlags, HANDLEF_DESTROY, HANDLEF_INDESTROY, HMDestroyUnlockedObject(), HMPheFromObject, and NULL.

01474 { 01475 PHE phe; 01476 01477 /* 01478 * The object is not reference counted. If the object is not a zombie, 01479 * return success because the object is still around. 01480 */ 01481 phe = HMPheFromObject(pobj); 01482 if (!(phe->bFlags & HANDLEF_DESTROY)) 01483 return pobj; 01484 01485 /* 01486 * We're destroying the object based on an unlock... Make sure it isn't 01487 * currently being destroyed! (It is valid to have lock counts go from 01488 * 0 to != 0 to 0 during destruction... don't want recursion into 01489 * the destroy routine. 01490 */ 01491 if (phe->bFlags & HANDLEF_INDESTROY) 01492 return pobj; 01493 01494 HMDestroyUnlockedObject(phe); 01495 return NULL; 01496 }

VOID IdleTimerProc VOID   ) 
 

Definition at line 5120 of file ntuser/kernel/input.c.

References _PostMessage(), CheckCritIn, CMSHUNGAPPTIMEOUT, tagLASTINPUT::dwFlags, DWORD, FALSE, FHungApp(), GETPTI, giLowPowerTimeOutMs, giPowerOffTimeOutMs, giScreenSaveTimeOutMs, glinp, gppiScreenSaver, gpqForeground, IsTimeFromLastInput(), L, LINP_LOWPOWER, LINP_POWEROFF, LOWPOWER_PHASE, NULL, POWEROFF_PHASE, tagPROCESSINFO::ptiMainThread, SetForegroundPriorityProcess(), tagQ::spwndActive, StartScreenSaver(), TestAsyncKeyStateDown, TRUE, and VOID().

Referenced by xxxHungAppDemon().

05121 { 05122 05123 CheckCritIn(); 05124 05125 if ( (TestAsyncKeyStateDown(VK_LBUTTON)) || 05126 (TestAsyncKeyStateDown(VK_RBUTTON)) || 05127 (TestAsyncKeyStateDown(VK_MBUTTON)) || 05128 (TestAsyncKeyStateDown(VK_XBUTTON1)) || 05129 (TestAsyncKeyStateDown(VK_XBUTTON2))) { 05130 05131 return; 05132 } 05133 05134 05135 if (giScreenSaveTimeOutMs > 0) { 05136 05137 if (IsTimeFromLastInput((DWORD)(giScreenSaveTimeOutMs))) { 05138 05139 if (gppiScreenSaver != NULL) { 05140 05141 if (!(gppiScreenSaver->W32PF_Flags & W32PF_IDLESCREENSAVER)) { 05142 /* 05143 * Bump the priority of the screen saver down to idle. 05144 */ 05145 gppiScreenSaver->W32PF_Flags |= W32PF_IDLESCREENSAVER; 05146 SetForegroundPriorityProcess(gppiScreenSaver, gppiScreenSaver->ptiMainThread, TRUE); 05147 } 05148 } else { 05149 /* 05150 * Tell the system that it needs to bring up a screen saver. 05151 * 05152 * Carefull with the case when the active window is hung. If this 05153 * is the case the screen saver won't be started by winlogon because 05154 * DefWindowProc won't call StartScreenSaver(FALSE). 05155 */ 05156 if ((gpqForeground != NULL) && 05157 (gpqForeground->spwndActive != NULL) && 05158 !FHungApp(GETPTI(gpqForeground->spwndActive), CMSHUNGAPPTIMEOUT)) { 05159 05160 /* 05161 * Tell winlogon to start the screen saver if we have a secure 05162 * screen saver. In case we do have a secure one, the next PostMessage 05163 * will be ignored in winlogon. 05164 */ 05165 StartScreenSaver(TRUE); 05166 _PostMessage(gpqForeground->spwndActive, WM_SYSCOMMAND, SC_SCREENSAVE, 0L); 05167 } else { 05168 StartScreenSaver(FALSE); 05169 } 05170 } 05171 } 05172 } 05173 05174 if ((giLowPowerTimeOutMs > 0) && ((glinp.dwFlags & LINP_LOWPOWER) == 0)) { 05175 if (IsTimeFromLastInput((DWORD)(giLowPowerTimeOutMs))) { 05176 if ((gpqForeground != NULL) && (gpqForeground->spwndActive != NULL)) { 05177 _PostMessage(gpqForeground->spwndActive, WM_SYSCOMMAND, SC_MONITORPOWER, LOWPOWER_PHASE); 05178 } 05179 } 05180 } 05181 05182 if ((giPowerOffTimeOutMs > 0) && ((glinp.dwFlags & LINP_POWEROFF) == 0)) { 05183 if (IsTimeFromLastInput((DWORD)(giPowerOffTimeOutMs))) { 05184 if ((gpqForeground != NULL) && (gpqForeground->spwndActive != NULL)) { 05185 _PostMessage(gpqForeground->spwndActive, WM_SYSCOMMAND, SC_MONITORPOWER, POWEROFF_PHASE); 05186 } 05187 } 05188 } 05189 05190 }

BOOL ImeCanDestroyDefIME IN PWND  pwndDefaultIme,
IN PWND  pwndDestroy
 

Referenced by xxxDestroyWindow().

BOOL ImeCanDestroyDefIMEforChild IN PWND  pwndDefaultIme,
IN PWND  pwndDestroy
 

Referenced by xxxDestroyWindow().

VOID ImeCheckTopmost IN PWND  pwnd  ) 
 

Referenced by ImeCanDestroyDefIME(), and NtUserSetImeOwnerWindow().

VOID ImeSetFutureOwner IN PWND  pwndDefaultIme,
IN PWND  pwndOrgOwner
 

Referenced by ImeCanDestroyDefIME(), and NtUserSetImeOwnerWindow().

VOID ImeSetTopmost IN PWND  pwndRoot,
IN BOOL  fFlag,
IN PWND  pwndInsertBefore
 

Referenced by ImeCheckTopmost().

VOID ImeSetTopmostChild IN PWND  pwndRoot,
IN BOOL  fFlag
 

Referenced by ImeSetTopmost(), and ImeSetTopmostChild().

VOID IncPaintCount PWND  pwnd  ) 
 

Definition at line 1248 of file paint.c.

References tagTHREADINFO::cPaintsReady, GETPTI, SetWakeBit(), and VOID().

Referenced by InternalInvalidate3().

01250 { 01251 PTHREADINFO pti = GETPTI(pwnd); 01252 01253 if (pti->cPaintsReady++ == 0) 01254 SetWakeBit(pti, QS_PAINT); 01255 }

void IncrMBox void   ) 
 

__inline void IncSFWLockCount  ) 
 

Definition at line 7048 of file userk.h.

Referenced by xxxMNAllocMenuState().

07050 { 07051 TAGMSG0(DBGTAG_FOREGROUND, "GiveUpForeground Hack Succeeded!");

VOID IncVisWindows PWND  pwnd  ) 
 

Definition at line 5123 of file swp.c.

References FVisCountable(), GETPTI, ISTS, and VOID().

Referenced by SetMinimize(), SetVisible(), and xxxSetWindowStyle().

05125 { 05126 if (FVisCountable(pwnd)) 05127 GETPTI(pwnd)->cVisWindows++; 05128 05129 #if DBG 05130 if (!ISTS()) 05131 VerifycVisWindows(pwnd); 05132 #endif 05133 }

void InitAnsiOem PCHAR  pOemToAnsi,
PCHAR  pAnsiToOem
 

Definition at line 2743 of file w32/ntuser/kernel/init.c.

References tagSERVERINFO::acAnsiToOem, tagSERVERINFO::acOemToAnsi, BYTE, FALSE, gpsi, NCHARS, and ProbeForRead.

02743 { 02744 02745 UserAssert(gpsi); 02746 UserAssert(pOemToAnsi); 02747 UserAssert(pAnsiToOem); 02748 02749 try { 02750 ProbeForRead(pOemToAnsi, NCHARS, sizeof(BYTE)); 02751 ProbeForRead(pAnsiToOem, NCHARS, sizeof(BYTE)); 02752 02753 RtlCopyMemory(gpsi->acOemToAnsi, pOemToAnsi, NCHARS); 02754 RtlCopyMemory(gpsi->acAnsiToOem, pAnsiToOem, NCHARS); 02755 02756 02757 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 02758 } 02759 }

HRGN InitCreateRgn VOID   ) 
 

BOOL InitCreateUserCrit VOID   ) 
 

Definition at line 1322 of file kernel/server.c.

References BOOL, ERESOURCE, ExAllocatePoolWithTag, ExFreePool(), ExInitializeFastMutex, ExInitializeResourceLite(), FALSE, gpHandleFlagsMutex, gpresDeviceInfoList, gpresMouseEventQueue, gpresUser, NonPagedPoolMustSucceed, NT_SUCCESS, NULL, TRACE_INIT, and TRUE.

01323 { 01324 TRACE_INIT(("Win32UserInit: InitCreateUserCrit()\n")); 01325 01326 /* 01327 * Initialize a critical section structure that will be used to protect 01328 * all of the User Server's critical sections (except a few special 01329 * cases like the RIT -- see below). 01330 */ 01331 gpresUser = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01332 sizeof(ERESOURCE), 01333 TAG_ERESOURCE); 01334 if (!gpresUser) { 01335 goto InitCreateUserCritExit; 01336 } 01337 if (!NT_SUCCESS(ExInitializeResourceLite(gpresUser))) { 01338 goto InitCreateUserCritExit; 01339 } 01340 01341 /* 01342 * Initialize a critical section to be used in [Un]QueueMouseEvent 01343 * to protect the queue of mouse input events that the desktop thread 01344 * uses to pass input on to the RIT, after having moved the cursor 01345 * without obtaining gpresUser itself. 01346 */ 01347 gpresMouseEventQueue = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01348 sizeof(ERESOURCE), 01349 TAG_ERESOURCE); 01350 if (!gpresMouseEventQueue) { 01351 goto InitCreateUserCritExit; 01352 } 01353 if (!NT_SUCCESS(ExInitializeResourceLite(gpresMouseEventQueue))) { 01354 goto InitCreateUserCritExit; 01355 } 01356 01357 /* 01358 * Initialize a critical section to protect the list of DEVICEINFO structs 01359 * kept under gpDeviceInfoList. This is used by the RIT when reading kbd 01360 * input, the desktop thread when reading mouse input, and the PnP callback 01361 * routines DeviceClassNotify() and DeviceNotify() when devices come and go. 01362 */ 01363 gpresDeviceInfoList = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01364 sizeof(ERESOURCE), 01365 TAG_ERESOURCE); 01366 if (!gpresDeviceInfoList) { 01367 goto InitCreateUserCritExit; 01368 } 01369 if (!NT_SUCCESS(ExInitializeResourceLite(gpresDeviceInfoList))) { 01370 goto InitCreateUserCritExit; 01371 } 01372 01373 /* 01374 * Create the handle flag mutex. We'll need this once we start creating 01375 * windowstations and desktops. 01376 */ 01377 gpHandleFlagsMutex = ExAllocatePoolWithTag(NonPagedPoolMustSucceed, 01378 sizeof(FAST_MUTEX), 01379 TAG_SYSTEM); 01380 if (gpHandleFlagsMutex == NULL) { 01381 goto InitCreateUserCritExit; 01382 } 01383 ExInitializeFastMutex(gpHandleFlagsMutex); 01384 01385 TRACE_INIT(("Win32UserInit: gpHandleFlagsMutex = 0x%p\n", gpHandleFlagsMutex)); 01386 TRACE_INIT(("Win32UserInit: gpresDeviceInfoList = 0x%X\n", gpresDeviceInfoList)); 01387 TRACE_INIT(("Win32UserInit: gpresMouseEventQueue = 0x%X\n", gpresMouseEventQueue)); 01388 TRACE_INIT(("Win32UserInit: gpresUser = 0x%X\n", gpresUser)); 01389 01390 TRACE_INIT(("Win32UserInit: exit InitCreateUserCrit()\n")); 01391 return TRUE; 01392 01393 InitCreateUserCritExit: 01394 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, RIP_ERROR, 01395 "Win32UserInit: InitCreateUserCrit failed"); 01396 01397 if (gpresUser) { 01398 ExFreePool(gpresUser); 01399 } 01400 if (gpresMouseEventQueue) { 01401 ExFreePool(gpresMouseEventQueue); 01402 } 01403 if (gpresDeviceInfoList) { 01404 ExFreePool(gpresDeviceInfoList); 01405 } 01406 return FALSE; 01407 }

NTSTATUS InitializeClientPfnArrays CONST PFNCLIENT ppfnClientA,
CONST PFNCLIENT ppfnClientW,
CONST PFNCLIENTWORKER ppfnClientWorker,
HANDLE  hModUser
 

Definition at line 2313 of file w32/ntuser/kernel/init.c.

References tagSERVERINFO::apfnClientA, tagSERVERINFO::apfnClientW, tagSERVERINFO::apfnClientWorker, BOOL, FALSE, gpfnwp, gpsi, hModClient, ICLS_BUTTON, ICLS_COMBOBOX, ICLS_COMBOLISTBOX, ICLS_DDEML16BIT, ICLS_DDEMLCLIENTA, ICLS_DDEMLCLIENTW, ICLS_DDEMLEVENT, ICLS_DDEMLMOTHER, ICLS_DDEMLSERVERA, ICLS_DDEMLSERVERW, ICLS_DESKTOP, ICLS_DIALOG, ICLS_EDIT, ICLS_ICONTITLE, ICLS_IME, ICLS_LISTBOX, ICLS_MAX, ICLS_MDICLIENT, ICLS_MENU, ICLS_SCROLLBAR, ICLS_STATIC, ICLS_SWITCH, ICLS_TOOLTIP, ISCSRSS, NTSTATUS(), NULL, _PFNCLIENT::pfnButtonWndProc, _PFNCLIENT::pfnComboBoxWndProc, _PFNCLIENT::pfnComboListBoxProc, _PFNCLIENT::pfnDefWindowProc, _PFNCLIENT::pfnDialogWndProc, _PFNCLIENT::pfnListBoxWndProc, _PFNCLIENT::pfnMDIClientWndProc, _PFNCLIENT::pfnStaticWndProc, _PFNCLIENT::pfnTitleWndProc, TRUE, xxxDesktopWndProc(), xxxMenuWindowProc(), xxxSBWndProc(), xxxSwitchWndProc(), and xxxTooltipWndProc().

Referenced by NtUserInitializeClientPfnArrays().

02318 { 02319 static BOOL fHaveClientPfns = FALSE; 02320 /* 02321 * Remember client side addresses in this global structure. These are 02322 * always constant, so this is ok. Note that if either of the 02323 * pointers are invalid, the exception will be handled in 02324 * the thunk and fHaveClientPfns will not be set. 02325 */ 02326 if (!fHaveClientPfns && ppfnClientA != NULL) { 02327 if (!ISCSRSS()) { 02328 RIPMSG0(RIP_WARNING, "InitializeClientPfnArrays failed !csrss"); 02329 return STATUS_UNSUCCESSFUL; 02330 } 02331 gpsi->apfnClientA = *ppfnClientA; 02332 gpsi->apfnClientW = *ppfnClientW; 02333 gpsi->apfnClientWorker = *ppfnClientWorker; 02334 02335 gpfnwp[ICLS_BUTTON] = gpsi->apfnClientW.pfnButtonWndProc; 02336 gpfnwp[ICLS_EDIT] = gpsi->apfnClientW.pfnDefWindowProc; 02337 gpfnwp[ICLS_STATIC] = gpsi->apfnClientW.pfnStaticWndProc; 02338 gpfnwp[ICLS_LISTBOX] = gpsi->apfnClientW.pfnListBoxWndProc; 02339 gpfnwp[ICLS_SCROLLBAR] = (PROC)xxxSBWndProc; 02340 gpfnwp[ICLS_COMBOBOX] = gpsi->apfnClientW.pfnComboBoxWndProc; 02341 gpfnwp[ICLS_DESKTOP] = (PROC)xxxDesktopWndProc; 02342 gpfnwp[ICLS_DIALOG] = gpsi->apfnClientW.pfnDialogWndProc; 02343 gpfnwp[ICLS_MENU] = (PROC)xxxMenuWindowProc; 02344 gpfnwp[ICLS_SWITCH] = (PROC)xxxSwitchWndProc; 02345 gpfnwp[ICLS_ICONTITLE] = gpsi->apfnClientW.pfnTitleWndProc; 02346 gpfnwp[ICLS_MDICLIENT] = gpsi->apfnClientW.pfnMDIClientWndProc; 02347 gpfnwp[ICLS_COMBOLISTBOX] = gpsi->apfnClientW.pfnComboListBoxProc; 02348 gpfnwp[ICLS_DDEMLEVENT] = NULL; 02349 gpfnwp[ICLS_DDEMLMOTHER] = NULL; 02350 gpfnwp[ICLS_DDEML16BIT] = NULL; 02351 gpfnwp[ICLS_DDEMLCLIENTA] = NULL; 02352 gpfnwp[ICLS_DDEMLCLIENTW] = NULL; 02353 gpfnwp[ICLS_DDEMLSERVERA] = NULL; 02354 gpfnwp[ICLS_DDEMLSERVERW] = NULL; 02355 gpfnwp[ICLS_IME] = NULL; 02356 gpfnwp[ICLS_TOOLTIP] = (PROC)xxxTooltipWndProc; 02357 02358 /* 02359 * Change this assert when new classes are added. 02360 */ 02361 UserAssert(ICLS_MAX == ICLS_TOOLTIP+1); 02362 02363 hModClient = hModUser; 02364 fHaveClientPfns = TRUE; 02365 } 02366 #if DBG 02367 /* 02368 * BradG - Verify that user32.dll on the client side has loaded 02369 * at the correct address. If not, do an RIPMSG. 02370 */ 02371 02372 if((ppfnClientA != NULL) && 02373 (gpsi->apfnClientA.pfnButtonWndProc != ppfnClientA->pfnButtonWndProc)) 02374 RIPMSG0(RIP_ERROR, "Client side user32.dll not loaded at same address."); 02375 #endif 02376 02377 return STATUS_SUCCESS; 02378 }

VOID InitializeMediaChange HANDLE   ) 
 

Definition at line 119 of file w32/ntuser/kernel/pnp.c.

References ExEventObjectType, ExInitializeFastMutex, gbRemoteSession, gMediaChangeList, gMediaChangeMutex, gpEventMediaChange, KernelMode, NULL, and ObReferenceObjectByHandle().

Referenced by NtUserInitialize().

00120 { 00121 if (!gbRemoteSession) { 00122 00123 InitializeListHead(&gMediaChangeList); 00124 00125 ObReferenceObjectByHandle(hMediaRequestEvent, 00126 EVENT_ALL_ACCESS, 00127 *ExEventObjectType, 00128 KernelMode, 00129 &gpEventMediaChange, 00130 NULL); 00131 00132 gMediaChangeMutex = UserAllocPoolNonPaged(sizeof(FAST_MUTEX), TAG_PNP); 00133 00134 if (gMediaChangeMutex) { 00135 ExInitializeFastMutex(gMediaChangeMutex); 00136 } 00137 } 00138 00139 return; 00140 }

NTSTATUS InitializePowerRequestList HANDLE  hPowerRequestEvent  ) 
 

Definition at line 180 of file power.c.

References ExEventObjectType, ExInitializeFastMutex, gpEventPowerRequest, gPowerRequestList, gpPowerRequestMutex, KernelMode, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), and Status.

Referenced by NtUserInitialize().

00182 { 00183 NTSTATUS Status; 00184 00185 InitializeListHead(&gPowerRequestList); 00186 00187 Status = ObReferenceObjectByHandle(hPowerRequestEvent, 00188 EVENT_ALL_ACCESS, 00189 *ExEventObjectType, 00190 KernelMode, 00191 &gpEventPowerRequest, 00192 NULL); 00193 if (!NT_SUCCESS(Status)) { 00194 return Status; 00195 } 00196 00197 gpPowerRequestMutex = UserAllocPoolNonPaged(sizeof(FAST_MUTEX), TAG_POWER); 00198 if (gpPowerRequestMutex == NULL) { 00199 return STATUS_NO_MEMORY; 00200 } 00201 ExInitializeFastMutex(gpPowerRequestMutex); 00202 00203 return STATUS_SUCCESS; 00204 }

void InitKeyboard void   ) 
 

Referenced by RawInputThread(), and xxxRemoteReconnect().

VOID InitLoadResources  ) 
 

Definition at line 1738 of file kernel/server.c.

References tagDISPLAYRESOURCE::cxBorder, tagDISPLAYRESOURCE::cyBorder, DISPLAYRESOURCE, gbRemoteSession, GetPrimaryMonitor(), gpsi, tagMONITOR::rcMonitor, SYSMET, TRACE_INIT, VOID(), tagDISPLAYRESOURCE::xCompressCursor, tagDISPLAYRESOURCE::xCompressIcon, tagDISPLAYRESOURCE::yCompressCursor, tagDISPLAYRESOURCE::yCompressIcon, and tagDISPLAYRESOURCE::yKanji.

Referenced by RemoteConnect(), and UserInitialize().

01739 { 01740 PRECT prc; 01741 01742 DISPLAYRESOURCE dr = { 01743 17, // Height of vertical thumb 01744 17, // Width of horizontal thumb 01745 2, // Icon horiz compression factor 01746 2, // Icon vert compression factor 01747 1, // Cursor horz compression factor 01748 1, // Cursor vert compression factor 01749 0, // Kanji window height 01750 1, // cxBorder (thickness of vertical lines) 01751 1 // cyBorder (thickness of horizontal lines) 01752 }; 01753 01754 01755 TRACE_INIT(("UserInit: Load Display Resources\n")); 01756 01757 if (dr.xCompressIcon > 10) { 01758 01759 /* 01760 * If so, the actual dimensions of icons and cursors are 01761 * kept in OEMBIN. 01762 */ 01763 SYSMET(CXICON) = dr.xCompressIcon; 01764 SYSMET(CYICON) = dr.yCompressIcon; 01765 SYSMET(CXCURSOR) = dr.xCompressCursor; 01766 SYSMET(CYCURSOR) = dr.yCompressCursor; 01767 01768 } else { 01769 01770 /* 01771 * Else, only the ratio of (64/icon dimensions) is kept there. 01772 */ 01773 SYSMET(CXICON) = (64 / dr.xCompressIcon); 01774 SYSMET(CYICON) = (64 / dr.yCompressIcon); 01775 SYSMET(CXCURSOR) = (32 / dr.xCompressCursor); 01776 SYSMET(CYCURSOR) = (32 / dr.yCompressCursor); 01777 } 01778 01779 SYSMET(CXSMICON) = SYSMET(CXICON) / 2; 01780 SYSMET(CYSMICON) = SYSMET(CYICON) / 2; 01781 01782 SYSMET(CYKANJIWINDOW) = dr.yKanji; 01783 01784 /* 01785 * Get border thicknesses. 01786 */ 01787 SYSMET(CXBORDER) = dr.cxBorder; 01788 SYSMET(CYBORDER) = dr.cyBorder; 01789 01790 /* 01791 * Edge is two borders. 01792 */ 01793 SYSMET(CXEDGE) = 2 * SYSMET(CXBORDER); 01794 SYSMET(CYEDGE) = 2 * SYSMET(CYBORDER); 01795 01796 /* 01797 * Fixed frame is outer edge + border. 01798 */ 01799 SYSMET(CXDLGFRAME) = SYSMET(CXEDGE) + SYSMET(CXBORDER); 01800 SYSMET(CYDLGFRAME) = SYSMET(CYEDGE) + SYSMET(CYBORDER); 01801 01802 if (gbRemoteSession) { 01803 return; 01804 } 01805 01806 prc = &GetPrimaryMonitor()->rcMonitor; 01807 SYSMET(CXFULLSCREEN) = prc->right; 01808 SYSMET(CYFULLSCREEN) = prc->bottom - SYSMET(CYCAPTION); 01809 01810 /* 01811 * Set the initial cursor position to the center of the primary screen. 01812 */ 01813 gpsi->ptCursor.x = prc->right / 2; 01814 gpsi->ptCursor.y = prc->bottom / 2; 01815 }

VOID InitMice  ) 
 

Definition at line 289 of file ntinput.c.

References ACCF_MKVIRTUALMOUSE, CLEAR_ACCF, CLEAR_GTERMF, FALSE, GTERMF_MOUSE, SYSMET, and VOID().

Referenced by RawInputThread().

00290 { 00291 CLEAR_ACCF(ACCF_MKVIRTUALMOUSE); 00292 CLEAR_GTERMF(GTERMF_MOUSE); 00293 SYSMET(MOUSEPRESENT) = FALSE; 00294 SYSMET(CMOUSEBUTTONS) = 0; 00295 SYSMET(MOUSEWHEELPRESENT) = FALSE; 00296 }

BOOL InitSecurity VOID   ) 
 

Definition at line 152 of file w32/ntuser/kernel/security.c.

References AllocAce(), BOOL, CreateSecurityDescriptor(), DWORD, FALSE, gpsdInitWinSta, NULL, _SE_EXPORTS::SeAliasAdminsSid, SeEnableAccessToExports, SeExports, _SE_EXPORTS::SeRestrictedSid, _SE_EXPORTS::SeWorldSid, and WinStaMapping.

Referenced by Win32UserInitialize().

00154 { 00155 PACCESS_ALLOWED_ACE paceList = NULL, pace; 00156 DWORD dwLength; 00157 00158 /* 00159 * Get access to exported constants 00160 */ 00161 SeEnableAccessToExports(); 00162 00163 /* 00164 * Create ACE list. 00165 */ 00166 paceList = AllocAce(NULL, 00167 ACCESS_ALLOWED_ACE_TYPE, 00168 CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE | NO_PROPAGATE_INHERIT_ACE, 00169 WinStaMapping.GenericAll, 00170 SeExports->SeWorldSid, 00171 &dwLength); 00172 if (paceList == NULL) 00173 return FALSE; 00174 00175 pace = AllocAce(paceList, 00176 ACCESS_ALLOWED_ACE_TYPE, 00177 CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE | NO_PROPAGATE_INHERIT_ACE, 00178 WinStaMapping.GenericAll, 00179 SeExports->SeRestrictedSid, 00180 &dwLength); 00181 if (pace == NULL) { 00182 UserFreePool(paceList); 00183 return FALSE; 00184 } 00185 paceList = pace; 00186 00187 pace = AllocAce(paceList, ACCESS_ALLOWED_ACE_TYPE, 00188 OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE, 00189 GENERIC_ALL, SeExports->SeWorldSid, &dwLength); 00190 if (pace == NULL) { 00191 UserFreePool(paceList); 00192 return FALSE; 00193 } 00194 paceList = pace; 00195 00196 pace = AllocAce(paceList, ACCESS_ALLOWED_ACE_TYPE, 00197 OBJECT_INHERIT_ACE | INHERIT_ONLY_ACE, 00198 GENERIC_ALL, SeExports->SeRestrictedSid, &dwLength); 00199 if (pace == NULL) { 00200 UserFreePool(paceList); 00201 return FALSE; 00202 } 00203 paceList = pace; 00204 00205 pace = AllocAce(paceList, ACCESS_ALLOWED_ACE_TYPE, 00206 0, DIRECTORY_QUERY | DIRECTORY_CREATE_OBJECT, 00207 SeExports->SeAliasAdminsSid, &dwLength); 00208 if (pace == NULL) { 00209 UserFreePool(paceList); 00210 return FALSE; 00211 } 00212 paceList = pace; 00213 00214 pace = AllocAce(paceList, ACCESS_ALLOWED_ACE_TYPE, 00215 0, DIRECTORY_TRAVERSE, SeExports->SeWorldSid, &dwLength); 00216 if (pace == NULL) { 00217 UserFreePool(paceList); 00218 return FALSE; 00219 } 00220 paceList = pace; 00221 00222 pace = AllocAce(paceList, ACCESS_ALLOWED_ACE_TYPE, 00223 0, DIRECTORY_TRAVERSE, SeExports->SeRestrictedSid, &dwLength); 00224 if (pace == NULL) { 00225 UserFreePool(paceList); 00226 return FALSE; 00227 } 00228 paceList = pace; 00229 00230 /* 00231 * Create the SD 00232 */ 00233 gpsdInitWinSta = CreateSecurityDescriptor(paceList, dwLength, FALSE); 00234 UserFreePool(paceList); 00235 00236 if (gpsdInitWinSta == NULL) { 00237 RIPMSG0(RIP_WARNING, "Initial windowstation security was not created!"); 00238 } 00239 00240 return (BOOL)(gpsdInitWinSta != NULL); 00241 }

NTSTATUS InitSystemThread PUNICODE_STRING  pstrThreadName  ) 
 

Definition at line 191 of file ex.c.

References CheckCritOut, ClearAppStarting(), EnterCrit, LeaveCrit, NT_SUCCESS, NTSTATUS(), NULL, tagTHREADINFO::ppi, PsGetCurrentThread, tagTHREADINFO::pstrAppName, PtiCurrentShared, Status, _ETHREAD::ThreadsProcess, TRUE, ValidateThreadSessionId, _EPROCESS::Win32Process, and xxxCreateThreadInfo().

Referenced by RawInputThread(), VideoPortCalloutThread(), and xxxDesktopThread().

00193 { 00194 PETHREAD pEThread; 00195 PEPROCESS Process; 00196 PTHREADINFO pti; 00197 NTSTATUS Status; 00198 00199 CheckCritOut(); 00200 00201 pEThread = PsGetCurrentThread(); 00202 Process = pEThread->ThreadsProcess; 00203 00204 ValidateThreadSessionId(pEThread); 00205 00206 /* 00207 * check to see if process is already set, if not, we 00208 * need to set it up as well 00209 */ 00210 if (Process->Win32Process == NULL) { 00211 Status = W32pProcessCallout(Process, TRUE); 00212 if (!NT_SUCCESS(Status)) { 00213 return Status; 00214 } 00215 } 00216 00217 /* 00218 * We have the W32 process (or don't need one). Now get the thread data 00219 * and the kernel stack 00220 */ 00221 Status = AllocateW32Thread(pEThread); 00222 if (!NT_SUCCESS(Status)) { 00223 return Status; 00224 } 00225 00226 EnterCrit(); 00227 00228 /* 00229 * Allocate a pti for this thread 00230 * 00231 * Flag this as a system thread 00232 */ 00233 Status = xxxCreateThreadInfo(pEThread, TRUE); 00234 if (!NT_SUCCESS(Status)) { 00235 FreeW32Thread(pEThread); 00236 LeaveCrit(); 00237 return Status; 00238 } 00239 00240 pti = PtiCurrentShared(); 00241 if (pstrThreadName) { 00242 if (pti->pstrAppName != NULL) 00243 UserFreePool(pti->pstrAppName); 00244 pti->pstrAppName = UserAllocPoolWithQuota(sizeof(UNICODE_STRING) + 00245 pstrThreadName->Length + sizeof(WCHAR), TAG_TEXT); 00246 if (pti->pstrAppName != NULL) { 00247 pti->pstrAppName->Buffer = (PWCHAR)(pti->pstrAppName + 1); 00248 RtlCopyMemory(pti->pstrAppName->Buffer, pstrThreadName->Buffer, 00249 pstrThreadName->Length); 00250 pti->pstrAppName->Buffer[pstrThreadName->Length / sizeof(WCHAR)] = 0; 00251 pti->pstrAppName->MaximumLength = pstrThreadName->Length + sizeof(WCHAR); 00252 pti->pstrAppName->Length = pstrThreadName->Length; 00253 } 00254 } 00255 00256 /* 00257 * Need to clear the W32PF_APPSTARTING bit so that windows created by 00258 * the RIT don't cause the cursor to change to the app starting 00259 * cursor. 00260 */ 00261 if ((pti->ppi != NULL) && (pti->ppi->W32PF_Flags & W32PF_APPSTARTING)) { 00262 ClearAppStarting(pti->ppi); 00263 } 00264 00265 LeaveCrit(); 00266 00267 return STATUS_SUCCESS; 00268 }

__inline void InitTooltipDelay PTOOLTIPWND  pttwnd  ) 
 

Definition at line 6932 of file userk.h.

References SYSMET.

Referenced by _SetDoubleClickTime(), and xxxTooltipWndProc().

06937 : SYSMET(CYCAPTION); 06938

BOOL InitUserScreen  ) 
 

Definition at line 775 of file fullscr.c.

References BOOL, CreateCacheDC(), CreateCachedMonitor(), CreateEmptyRgnPublic(), CreateProfileUserName(), DCE_SIZE_CACHEINIT, FALSE, FillRect(), FreeProfileUserName(), ghdcMem, ghdcMem2, ghFontSys, ghrgnGDC, ghrgnInv0, ghrgnInv1, ghrgnInv2, ghrgnInvalid, ghrgnInvalidSum, ghrgnSCR, ghrgnScrl1, ghrgnScrl2, ghrgnScrlDst, ghrgnScrlSrc, ghrgnScrlValid, ghrgnScrlVis, ghrgnSPB1, ghrgnSPB2, ghrgnSW, ghrgnSWP1, ghrgnValid, ghrgnValidSum, ghrgnVisNew, gpDispInfo, gpsi, HDCBITS, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, InitSafeBootMode, NULL, tagDISPLAYINFO::rcScreen, SYSHBR, SYSMET, TRACE_INIT, TRUE, UpdateUserScreen(), and xxxODI_ColorInit().

Referenced by InitVideo().

00776 { 00777 int i; 00778 TL tlName; 00779 PUNICODE_STRING pProfileUserName = CreateProfileUserName(&tlName); 00780 BOOL fSuccess = TRUE; 00781 00782 TRACE_INIT(("UserInit: Initialize Screen\n")); 00783 00784 /* 00785 * Create screen and memory dcs. 00786 */ 00787 gpDispInfo->hdcScreen = GreCreateDisplayDC(gpDispInfo->hDev, DCTYPE_DIRECT, FALSE); 00788 00789 if (gpDispInfo->hdcScreen == NULL) { 00790 RIPMSG0(RIP_WARNING, "Fail to create gpDispInfo->hdcScreen"); 00791 fSuccess = FALSE; 00792 goto Exit; 00793 } 00794 00795 GreSelectFont(gpDispInfo->hdcScreen, GreGetStockObject(SYSTEM_FONT)); 00796 GreSetDCOwner(gpDispInfo->hdcScreen, OBJECT_OWNER_PUBLIC); 00797 00798 HDCBITS() = GreCreateCompatibleDC(gpDispInfo->hdcScreen); 00799 00800 if (HDCBITS() == NULL) { 00801 RIPMSG0(RIP_WARNING, "Fail to create HDCBITS()"); 00802 fSuccess = FALSE; 00803 goto Exit; 00804 } 00805 00806 GreSelectFont(HDCBITS(), GreGetStockObject(SYSTEM_FONT)); 00807 GreSetDCOwner(HDCBITS(), OBJECT_OWNER_PUBLIC); 00808 00809 ghdcMem = GreCreateCompatibleDC(gpDispInfo->hdcScreen); 00810 fSuccess &= !!ghdcMem; 00811 00812 ghdcMem2 = GreCreateCompatibleDC(gpDispInfo->hdcScreen); 00813 fSuccess &= !!ghdcMem2; 00814 00815 if (!fSuccess) { 00816 RIPMSG0(RIP_WARNING, "Fail to create ghdcMem or ghdcMem2"); 00817 goto Exit; 00818 } 00819 00820 GreSetDCOwner(ghdcMem, OBJECT_OWNER_PUBLIC); 00821 GreSetDCOwner(ghdcMem2, OBJECT_OWNER_PUBLIC); 00822 00823 if (CreateCachedMonitor() == NULL) { 00824 fSuccess = FALSE; 00825 goto Exit; 00826 } 00827 00828 if (!UpdateUserScreen()) { 00829 RIPMSG0(RIP_WARNING, "UpdateUserScreen failed"); 00830 fSuccess = FALSE; 00831 goto Exit; 00832 } 00833 00834 /* 00835 * Do some initialization so we create the system colors. 00836 */ 00837 00838 /* 00839 * Set the window sizing border width to something reasonable. 00840 */ 00841 gpsi->gclBorder = 1; 00842 00843 /* 00844 * Init InternalInvalidate globals 00845 */ 00846 ghrgnInv0 = CreateEmptyRgnPublic(); // For InternalInvalidate() 00847 fSuccess &= !!ghrgnInv0; 00848 00849 ghrgnInv1 = CreateEmptyRgnPublic(); // For InternalInvalidate() 00850 fSuccess &= !!ghrgnInv1; 00851 00852 ghrgnInv2 = CreateEmptyRgnPublic(); // For InternalInvalidate() 00853 fSuccess &= !!ghrgnInv2; 00854 00855 /* 00856 * Initialize SPB globals 00857 */ 00858 ghrgnSPB1 = CreateEmptyRgnPublic(); 00859 fSuccess &= !!ghrgnSPB1; 00860 00861 ghrgnSPB2 = CreateEmptyRgnPublic(); 00862 fSuccess &= !!ghrgnSPB2; 00863 00864 ghrgnSCR = CreateEmptyRgnPublic(); 00865 fSuccess &= !!ghrgnSCR; 00866 00867 /* 00868 * Initialize ScrollWindow/ScrollDC globals 00869 */ 00870 ghrgnSW = CreateEmptyRgnPublic(); 00871 fSuccess &= !!ghrgnSW; 00872 00873 ghrgnScrl1 = CreateEmptyRgnPublic(); 00874 fSuccess &= !!ghrgnScrl1; 00875 00876 ghrgnScrl2 = CreateEmptyRgnPublic(); 00877 fSuccess &= !!ghrgnScrl2; 00878 00879 ghrgnScrlVis = CreateEmptyRgnPublic(); 00880 fSuccess &= !!ghrgnScrlVis; 00881 00882 ghrgnScrlSrc = CreateEmptyRgnPublic(); 00883 fSuccess &= !!ghrgnScrlSrc; 00884 00885 ghrgnScrlDst = CreateEmptyRgnPublic(); 00886 fSuccess &= !!ghrgnScrlDst; 00887 00888 ghrgnScrlValid = CreateEmptyRgnPublic(); 00889 fSuccess &= !!ghrgnScrlValid; 00890 00891 /* 00892 * Initialize SetWindowPos() 00893 */ 00894 ghrgnInvalidSum = CreateEmptyRgnPublic(); 00895 fSuccess &= !!ghrgnInvalidSum; 00896 00897 ghrgnVisNew = CreateEmptyRgnPublic(); 00898 fSuccess &= !!ghrgnVisNew; 00899 00900 ghrgnSWP1 = CreateEmptyRgnPublic(); 00901 fSuccess &= !!ghrgnSWP1; 00902 00903 ghrgnValid = CreateEmptyRgnPublic(); 00904 fSuccess &= !!ghrgnValid; 00905 00906 ghrgnValidSum = CreateEmptyRgnPublic(); 00907 fSuccess &= !!ghrgnValidSum; 00908 00909 ghrgnInvalid = CreateEmptyRgnPublic(); 00910 fSuccess &= !!ghrgnInvalid; 00911 00912 /* 00913 * Initialize DC cache 00914 */ 00915 ghrgnGDC = CreateEmptyRgnPublic(); 00916 fSuccess &= !!ghrgnGDC; 00917 00918 for (i = 0; i < DCE_SIZE_CACHEINIT; i++) { 00919 fSuccess &= !!CreateCacheDC(NULL, DCX_INVALID | DCX_CACHE, NULL); 00920 } 00921 00922 if (!fSuccess) { 00923 RIPMSG0(RIP_WARNING, "CreateCacheDC failed"); 00924 goto Exit; 00925 } 00926 00927 /* 00928 * Let engine know that the display must be secure. 00929 */ 00930 00931 GreMarkDCUnreadable(gpDispInfo->hdcScreen); 00932 00933 /* 00934 * LATER mikeke - if ghfontsys is changed anywhere but here 00935 * we need to fix SetNCFont() 00936 */ 00937 ghFontSys = (HFONT)GreGetStockObject(SYSTEM_FONT); 00938 00939 #if DBG 00940 SYSMET(DEBUG) = TRUE; 00941 #else 00942 SYSMET(DEBUG) = FALSE; 00943 #endif 00944 00945 SYSMET(CLEANBOOT) = **((PULONG *)&InitSafeBootMode); 00946 00947 SYSMET(SLOWMACHINE) = 0; 00948 00949 /* 00950 * Initialize system colors from registry. 00951 */ 00952 xxxODI_ColorInit(pProfileUserName); 00953 00954 /* 00955 * Paint the screen background. 00956 */ 00957 FillRect(gpDispInfo->hdcScreen, &gpDispInfo->rcScreen, SYSHBR(DESKTOP)); 00958 00959 UserAssert(fSuccess); 00960 00961 Exit: 00962 FreeProfileUserName(pProfileUserName, &tlName); 00963 00964 return fSuccess; 00965 }

PMDEV InitVideo BOOL  bReenumerationNeeded  ) 
 

Definition at line 1893 of file kernel/server.c.

References FALSE, gpDispInfo, GW_DESKTOP_ID, tagDISPLAYINFO::hDev, HH_INITVIDEO, HYDRA_HINT, InitUserScreen(), KernelMode, NULL, tagDISPLAYINFO::pmdev, and TRUE.

Referenced by RemoteConnect(), and UserInitialize().

01895 { 01896 PMDEV pmdev; 01897 LONG ChangeStatus; 01898 01899 /* 01900 * BUGBUG !!! Need to get a status return from this call. 01901 */ 01902 DrvInitConsole(bReenumerationNeeded); 01903 01904 /* 01905 * BASEVIDEO may be on or off, whether we are in setup or not. 01906 */ 01907 01908 ChangeStatus = DrvChangeDisplaySettings(NULL, 01909 NULL, 01910 NULL, 01911 (PVOID) (GW_DESKTOP_ID), 01912 KernelMode, 01913 FALSE, 01914 TRUE, 01915 NULL, 01916 &pmdev, 01917 GRE_DEFAULT, 01918 TRUE); 01919 01920 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01921 01922 /* 01923 * If we fail, try BASEVIDEO temporarily 01924 */ 01925 01926 DrvSetBaseVideo(TRUE); 01927 01928 ChangeStatus = DrvChangeDisplaySettings(NULL, 01929 NULL, 01930 NULL, 01931 (PVOID) (GW_DESKTOP_ID), 01932 KernelMode, 01933 FALSE, 01934 TRUE, 01935 NULL, 01936 &pmdev, 01937 GRE_DEFAULT, 01938 TRUE); 01939 01940 DrvSetBaseVideo(FALSE); 01941 01942 /* 01943 * Give it one last try, not in basevideo, to handle TGA 01944 * (non-vgacompatible) during GUI-mode setup (BASEVIDEO is on by 01945 * default) 01946 */ 01947 01948 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01949 01950 ChangeStatus = DrvChangeDisplaySettings(NULL, 01951 NULL, 01952 NULL, 01953 (PVOID) (GW_DESKTOP_ID), 01954 KernelMode, 01955 FALSE, 01956 TRUE, 01957 NULL, 01958 &pmdev, 01959 GRE_DEFAULT, 01960 TRUE); 01961 01962 } 01963 } 01964 01965 if (ChangeStatus != GRE_DISP_CHANGE_SUCCESSFUL) { 01966 RIPMSG0(RIP_WARNING, "InitVideo: No working display driver found"); 01967 return NULL; 01968 } 01969 01970 gpDispInfo->hDev = pmdev->hdevParent; 01971 gpDispInfo->pmdev = pmdev; 01972 01973 GreUpdateSharedDevCaps(gpDispInfo->hDev); 01974 01975 if (!InitUserScreen()) { 01976 RIPMSG0(RIP_WARNING, "InitUserScreen failed"); 01977 return NULL; 01978 } 01979 01980 HYDRA_HINT(HH_INITVIDEO); 01981 01982 return pmdev; 01983 }

VOID NTAPI InputApc IN PVOID  ApcContext,
IN PIO_STATUS_BLOCK  IoStatusBlock,
IN ULONG  Reserved
 

Definition at line 1090 of file ntinput.c.

References aDeviceTemplate, tagDEVICE_TEMPLATE::DeviceRead, EnterDeviceInfoListCrit(), FreeDeviceInfo(), GDIAF_FREEME, GDIF_READING, LeaveDeviceInfoListCrit(), NT_SUCCESS, PDEVICE_TEMPLATE, StartDeviceRead(), and VOID().

Referenced by StartDeviceRead().

01095 { 01096 PDEVICEINFO pDeviceInfo = (PDEVICEINFO)ApcContext; 01097 UNREFERENCED_PARAMETER(Reserved); 01098 01099 #ifdef DIAGNOSE_IO 01100 pDeviceInfo->nReadsOutstanding--; 01101 #endif 01102 01103 /* 01104 * If this device needs freeing, abandon reading now and request the free. 01105 * (Don't even process the input that we received in this APC) 01106 */ 01107 if (pDeviceInfo->usActions & GDIAF_FREEME) { 01108 EnterDeviceInfoListCrit(); 01109 pDeviceInfo->bFlags &= ~GDIF_READING; 01110 FreeDeviceInfo(pDeviceInfo); 01111 LeaveDeviceInfoListCrit(); 01112 return; 01113 } 01114 01115 if (NT_SUCCESS(IoStatusBlock->Status)) { 01116 PDEVICE_TEMPLATE pDevTpl = &aDeviceTemplate[pDeviceInfo->type]; 01117 pDevTpl->DeviceRead(pDeviceInfo); 01118 } 01119 StartDeviceRead(pDeviceInfo); 01120 }

VOID InsertTask PPROCESSINFO  ppi,
PTDB  ptdbNew
 

Definition at line 60 of file taskman.c.

References CheckCritIn, tagTDB::nPriority, NULL, tagWOWPROCESSINFO::ptdbHead, tagTDB::ptdbNext, and tagPROCESSINFO::pwpi.

Referenced by DirectedScheduleTask(), xxxDirectedYield(), xxxSleepTask(), xxxUserYield(), and zzzInitTask().

00063 { 00064 PTDB *pptdb; 00065 PTDB ptdb; 00066 int nPriority; 00067 PWOWPROCESSINFO pwpi = ppi->pwpi; 00068 00069 CheckCritIn(); 00070 00071 UserAssert(pwpi != NULL); 00072 00073 pptdb = &pwpi->ptdbHead; 00074 nPriority = ptdbNew->nPriority; 00075 00076 while ((ptdb = *pptdb) != NULL) { 00077 /* 00078 * Remove it from it's old location 00079 */ 00080 if (ptdb == ptdbNew) { 00081 *pptdb = ptdbNew->ptdbNext; 00082 00083 /* 00084 * continue to search for the place to insert it 00085 */ 00086 while ((ptdb = *pptdb) != NULL) { 00087 if (nPriority < ptdb->nPriority) { 00088 break; 00089 } 00090 00091 pptdb = &(ptdb->ptdbNext); 00092 } 00093 break; 00094 } 00095 00096 /* 00097 * if this is the place to insert continue to search for the 00098 * place to delete it from 00099 */ 00100 if (nPriority < ptdb->nPriority) { 00101 do { 00102 if (ptdb->ptdbNext == ptdbNew) { 00103 ptdb->ptdbNext = ptdbNew->ptdbNext; 00104 break; 00105 } 00106 ptdb = ptdb->ptdbNext; 00107 } while (ptdb != NULL); 00108 break; 00109 } 00110 00111 pptdb = &(ptdb->ptdbNext); 00112 } 00113 00114 /* 00115 * insert the new task 00116 */ 00117 ptdbNew->ptdbNext = *pptdb; 00118 *pptdb = ptdbNew; 00119 }

PSMWP InternalBeginDeferWindowPos int  cwndGuess  ) 
 

Definition at line 231 of file swp.c.

References tagSMWP::acvr, AllocateCvr(), tagSMWP::ccvr, tagSMWP::ccvrAlloc, CheckCritIn, DBGCheskSMWP, gSMWP, NULL, PUDF_GSMWPINUSE, SET_PUDF, and TEST_PUDF.

Referenced by xxxArrangeIconicWindows(), xxxDesktopRecalc(), xxxMinMaximize(), xxxProcessSetWindowPosEvent(), xxxSetWindowPos(), and xxxSetWindowRgn().

00232 { 00233 PSMWP psmwp; 00234 00235 CheckCritIn(); 00236 00237 /* 00238 * If gSMWP in being used, allocate one. 00239 * Note that SMWP is zero init but CVR is not; _DeferWindowPos initializes it 00240 */ 00241 if (TEST_PUDF(PUDF_GSMWPINUSE) || (cwndHint > gSMWP.ccvrAlloc)) { 00242 psmwp = (PSMWP)UserAllocPoolWithQuotaZInit(sizeof(SMWP), TAG_SWP); 00243 if (psmwp == NULL) { 00244 return NULL; 00245 } 00246 if (!AllocateCvr(psmwp, cwndHint)) { 00247 UserFreePool(psmwp); 00248 return NULL; 00249 } 00250 } else { 00251 SET_PUDF(PUDF_GSMWPINUSE); 00252 psmwp = &gSMWP; 00253 RtlZeroMemory(&gSMWP, FIELD_OFFSET(SMWP, ccvrAlloc)); 00254 UserAssert(gSMWP.ccvr == 0); 00255 UserAssert(gSMWP.acvr != NULL); 00256 } 00257 00258 DBGCheskSMWP(psmwp); 00259 return psmwp; 00260 }

void InternalInvalidate3 PWND  pwnd,
HRGN  hrgn,
DWORD  flags
 

Definition at line 784 of file update.c.

References BOOL, CalcWindowRgn(), ClearHungFlag(), ClrWF, CopyRgn, CreateEmptyRgnPublic(), DecPaintCount(), DeleteMaybeSpecialRgn(), GETPTI, ghrgnInv2, HRGN_FULL, tagWND::hrgnUpdate, IncPaintCount(), NEEDSPAINT, NULL, PtiCurrent, RDW_IGNOREUPDATEDIRTY, SetHungFlag(), SetWF, SubtractRgn, TestWF, TRUE, UnionRgn, VOID(), WEFTRANSPARENT, WFDONTVALIDATE, WFINTERNALPAINT, WFNONCPAINT, WFPIXIEHACK, WFREDRAWIFHUNG, WFSENDERASEBKGND, WFSENDNCPAINT, WFUPDATEDIRTY, WFWIN31COMPAT, and WFWMPAINTSENT.

Referenced by InternalInvalidate2(), and xxxEndPaint().

00788 { 00789 BOOL fNeededPaint; 00790 00791 fNeededPaint = NEEDSPAINT(pwnd); 00792 00793 if (flags & (RDW_INVALIDATE | RDW_INTERNALPAINT | RDW_ERASE | RDW_FRAME)) { 00794 00795 if (flags & RDW_INTERNALPAINT) 00796 SetWF(pwnd, WFINTERNALPAINT); 00797 00798 if (flags & RDW_INVALIDATE) { 00799 00800 /* 00801 * Make sure that the NONCPAINT bit is cleared 00802 * to ensure that the caption will redraw when we update. 00803 */ 00804 ClrWF(pwnd, WFNONCPAINT); 00805 00806 /* 00807 * If another app is invalidating this window, then set the 00808 * UPDATEDIRTY flag. 00809 * 00810 * Solves critical section where thread A draws, then validates, 00811 * but thread B goes and invalidates before A validates. 00812 * See comments later in RDW_VALIDATE code. 00813 */ 00814 if (GETPTI(pwnd) != PtiCurrent()) { 00815 00816 SetWF(pwnd, WFUPDATEDIRTY); 00817 00818 /* 00819 * Paint order problem, see paint.c 00820 */ 00821 if (TestWF(pwnd, WFWMPAINTSENT)) { 00822 SetWF(pwnd, WFDONTVALIDATE); 00823 } 00824 } 00825 00826 /* 00827 * BACKWARD COMPATIBILITY HACK 00828 * 00829 * In 3.0, InvalidateRect(pwnd, NULL, FALSE) would always 00830 * clear the WFSENDERASEBKGND flag, even if it was previously 00831 * set from an InvalidateRect(pwnd, NULL, TRUE). This is bogus, 00832 * because it can cause you to "lose" WM_ERASEBKGND messages, but 00833 * AttachMate Extra (and maybe other apps) depend on this behavior. 00834 */ 00835 if ((hrgn == HRGN_FULL) && !TestWF(pwnd, WFWIN31COMPAT)) 00836 ClrWF(pwnd, WFSENDERASEBKGND); 00837 00838 if (flags & RDW_ERASE) 00839 SetWF(pwnd, WFSENDERASEBKGND); 00840 00841 if ((flags & (RDW_FRAME | RDW_ERASE)) && !TestWF(pwnd, WEFTRANSPARENT)) 00842 SetHungFlag(pwnd, WFREDRAWIFHUNG); 00843 00844 if (flags & RDW_FRAME) 00845 SetWF(pwnd, WFSENDNCPAINT); 00846 00847 /* 00848 * If window is already completely invalidated, 00849 * no need to do any further invalidation. 00850 */ 00851 if (pwnd->hrgnUpdate != HRGN_FULL) { 00852 00853 if (hrgn == HRGN_FULL) { 00854 InvalidateAll: 00855 DeleteMaybeSpecialRgn(pwnd->hrgnUpdate); 00856 pwnd->hrgnUpdate = HRGN_FULL; 00857 00858 } else { 00859 if (pwnd->hrgnUpdate == NULL) { 00860 00861 if (!(pwnd->hrgnUpdate = CreateEmptyRgnPublic())) 00862 goto InvalidateAll; 00863 00864 if (CopyRgn(pwnd->hrgnUpdate, hrgn) == ERROR) 00865 goto InvalidateAll; 00866 00867 } else { // pwnd->hrgnUpdate is a region 00868 00869 if (UnionRgn(pwnd->hrgnUpdate, 00870 pwnd->hrgnUpdate, 00871 hrgn) == ERROR) { 00872 00873 goto InvalidateAll; 00874 } 00875 } 00876 } 00877 } 00878 } 00879 00880 if (!fNeededPaint && NEEDSPAINT(pwnd)) 00881 IncPaintCount(pwnd); 00882 00883 } else if (flags & (RDW_VALIDATE | RDW_NOINTERNALPAINT | RDW_NOERASE | RDW_NOFRAME)) { 00884 00885 /* 00886 * Validation: 00887 * 00888 * Do not allow validation if this window has been invalidated from 00889 * another process - because this window may be validating just 00890 * after another process invalidated, thereby validating invalid 00891 * bits. 00892 * 00893 * Sometimes applications draw stuff, then validate what they drew. 00894 * If another app invalidated some area during the drawing operation, 00895 * then it will need another paint message. 00896 * 00897 * This wouldn't be necessary if people validated BEFORE they drew. 00898 */ 00899 if (TestWF(pwnd, WFUPDATEDIRTY) && !(flags & RDW_IGNOREUPDATEDIRTY)) 00900 return; 00901 00902 if (flags & RDW_NOINTERNALPAINT) 00903 ClrWF(pwnd, WFINTERNALPAINT); 00904 00905 if (flags & RDW_VALIDATE) { 00906 00907 if (flags & RDW_NOERASE) 00908 ClrWF(pwnd, WFSENDERASEBKGND); 00909 00910 if (flags & RDW_NOFRAME) { 00911 ClrWF(pwnd, WFSENDNCPAINT); 00912 ClrWF(pwnd, WFPIXIEHACK); 00913 } 00914 00915 if (flags & (RDW_NOERASE | RDW_NOFRAME)) 00916 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 00917 00918 if (pwnd->hrgnUpdate != NULL) { 00919 00920 /* 00921 * If WFSENDNCPAINT is set, then all or part of the 00922 * window border still needs to be drawn. This means 00923 * that we must subtract off the client rectangle only. 00924 * Convert HRGN_FULL to the client region. 00925 */ 00926 if (TestWF(pwnd, WFSENDNCPAINT) && (hrgn == HRGN_FULL)) { 00927 hrgn = ghrgnInv2; 00928 CalcWindowRgn(pwnd, hrgn, TRUE); 00929 } 00930 00931 if (hrgn == HRGN_FULL) { 00932 ValidateAll: 00933 00934 /* 00935 * We're validating the entire window. Just 00936 * blow away the update region. 00937 */ 00938 DeleteMaybeSpecialRgn(pwnd->hrgnUpdate); 00939 pwnd->hrgnUpdate = (HRGN)NULL; 00940 00941 /* 00942 * No need to erase the background... 00943 */ 00944 ClrWF(pwnd, WFSENDERASEBKGND); 00945 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 00946 00947 } else { 00948 00949 /* 00950 * Subtracting some region from pwnd->hrgnUpdate. 00951 * Be sure pwnd->hrgnUpdate is a real region. 00952 */ 00953 if (pwnd->hrgnUpdate == HRGN_FULL) { 00954 00955 /* 00956 * If the WFSENDNCPAINT bit is set, 00957 * the update region must include the entire window 00958 * area. Otherwise it includes only the client. 00959 */ 00960 pwnd->hrgnUpdate = CreateEmptyRgnPublic(); 00961 00962 /* 00963 * If the creation failed, punt by 00964 * invalidating the entire window. 00965 */ 00966 if (pwnd->hrgnUpdate == NULL) 00967 goto InvalidateAll; 00968 00969 if (CalcWindowRgn(pwnd, 00970 pwnd->hrgnUpdate, 00971 !(TestWF(pwnd, WFSENDNCPAINT))) == ERROR) { 00972 00973 goto InvalidateAll; 00974 } 00975 } 00976 00977 /* 00978 * Subtract off the region. If we get an error, 00979 * punt by invalidating everything. If the 00980 * region becomes empty, then validate everything. 00981 */ 00982 switch (SubtractRgn(pwnd->hrgnUpdate, 00983 pwnd->hrgnUpdate, 00984 hrgn)) { 00985 case ERROR: 00986 goto InvalidateAll; 00987 00988 case NULLREGION: 00989 goto ValidateAll; 00990 } 00991 } 00992 } 00993 } 00994 00995 if (fNeededPaint && !NEEDSPAINT(pwnd)) 00996 DecPaintCount(pwnd); 00997 } 00998 }

UINT InternalMapVirtualKeyEx UINT  wCode,
UINT  wType,
PKBDTABLES  pKbdTbl
 

Definition at line 231 of file xlate.c.

References aVkNumpad, LOBYTE, NULL, PBYTE, UINT, and USHORT.

Referenced by _GetKeyNameText(), AdjustPushState(), and NtUserMapVirtualKeyEx().

00235 { 00236 PVK_TO_WCHARS1 pVK; 00237 PVK_TO_WCHAR_TABLE pVKT; 00238 UINT VkRet = 0; 00239 USHORT usScanCode; 00240 PVSC_VK pVscVk; 00241 PBYTE pVkNumpad; 00242 00243 switch (wType) { 00244 case 0: 00245 00246 /* 00247 * Convert Virtual Key (wCode) to Scan Code 00248 */ 00249 if ((wCode >= VK_SHIFT) && (wCode <= VK_MENU)) { 00250 00251 /* 00252 * Convert ambiguous Shift/Control/Alt keys to left-hand keys 00253 */ 00254 wCode = (UINT)((wCode - VK_SHIFT) * 2 + VK_LSHIFT); 00255 } 00256 00257 /* 00258 * Scan through the table that maps Virtual Scancodes to Virtual Keys 00259 * for non-extended keys. 00260 */ 00261 for (usScanCode = 0; usScanCode < pKbdTbl->bMaxVSCtoVK; usScanCode++) { 00262 if ((UINT)LOBYTE(pKbdTbl->pusVSCtoVK[usScanCode]) == wCode) { 00263 return usScanCode & 0xFF; 00264 } 00265 } 00266 00267 /* 00268 * Scan through the table that maps Virtual Scancodes to Virtual Keys 00269 * for extended keys. 00270 */ 00271 for (pVscVk = pKbdTbl->pVSCtoVK_E0; pVscVk->Vk; pVscVk++) { 00272 if ((UINT)LOBYTE(pVscVk->Vk) == wCode) { 00273 return (UINT)pVscVk->Vsc; 00274 } 00275 } 00276 00277 /* 00278 * There was no match: maybe the Virtual Key can only be generated 00279 * with Numlock on. Scan through aVkNumpad[] to determine scancode. 00280 */ 00281 for (pVkNumpad = aVkNumpad; *pVkNumpad != 0; pVkNumpad++) { 00282 if ((UINT)(*pVkNumpad) == wCode) { 00283 return (UINT)(pVkNumpad - aVkNumpad) + SCANCODE_NUMPAD_FIRST; 00284 } 00285 } 00286 00287 return 0; // No match found! 00288 00289 case 1: 00290 case 3: 00291 00292 /* 00293 * Convert Scan Code (wCode) to Virtual Key, disregarding modifier keys 00294 * and NumLock key etc. Returns 0 for no corresponding Virtual Key 00295 */ 00296 if (wCode < (UINT)(pKbdTbl->bMaxVSCtoVK)) { 00297 VkRet = (UINT)LOBYTE(pKbdTbl->pusVSCtoVK[wCode]); 00298 } else { 00299 /* 00300 * Scan the E0 prefix table for a match 00301 */ 00302 for (pVscVk = pKbdTbl->pVSCtoVK_E0; pVscVk->Vk; pVscVk++) { 00303 if ((UINT)pVscVk->Vsc == wCode) { 00304 VkRet = (UINT)LOBYTE(pVscVk->Vk); 00305 break; 00306 } 00307 } 00308 } 00309 00310 if ((wType == 1) && (VkRet >= VK_LSHIFT) && (VkRet <= VK_RMENU)) { 00311 00312 /* 00313 * Convert left/right Shift/Control/Alt keys to ambiguous keys 00314 * (neither left nor right) 00315 */ 00316 VkRet = (UINT)((VkRet - VK_LSHIFT) / 2 + VK_SHIFT); 00317 } 00318 00319 if (VkRet == 0xFF) { 00320 VkRet = 0; 00321 } 00322 return VkRet; 00323 00324 case 2: 00325 00326 /* 00327 * Bogus Win3.1 functionality: despite SDK documenation, return uppercase for 00328 * VK_A through VK_Z 00329 */ 00330 if ((wCode >= (WORD)'A') && (wCode <= (WORD)'Z')) { 00331 return wCode; 00332 } 00333 00334 // HIWORD is no loner the wchar, due to app compat problems #287134 00335 // We should not return the wchar from pti->wchInjected that cached 00336 // at GetMessage time. 00337 // (delete this commented-out section by end of March 1999 - IanJa) 00338 // 00339 // if (LOWORD(wCode) == VK_PACKET) { 00340 // return HIWORD(wCode); 00341 // } 00342 00343 /* 00344 * Convert Virtual Key (wCode) to ANSI. 00345 * Search each Shift-state table in turn, looking for the Virtual Key. 00346 */ 00347 for (pVKT = pKbdTbl->pVkToWcharTable; pVKT->pVkToWchars != NULL; pVKT++) { 00348 pVK = pVKT->pVkToWchars; 00349 while (pVK->VirtualKey != 0) { 00350 if ((UINT)pVK->VirtualKey == wCode) { 00351 00352 /* 00353 * Match found: return the unshifted character 00354 */ 00355 if (pVK->wch[0] == WCH_DEAD) { 00356 00357 /* 00358 * It is a dead character: the next entry contains its 00359 * value. Set the high bit to indicate dead key 00360 * (undocumented behaviour) 00361 */ 00362 pVK = (PVK_TO_WCHARS1)((PBYTE)pVK + pVKT->cbSize); 00363 return pVK->wch[0] | (UINT)0x80000000; 00364 } else if (pVK->wch[0] == WCH_NONE) { 00365 return 0; // 9013 00366 } 00367 if (pVK->wch[0] == WCH_NONE) { 00368 return 0; 00369 } 00370 return pVK->wch[0]; 00371 } 00372 pVK = (PVK_TO_WCHARS1)((PBYTE)pVK + pVKT->cbSize); 00373 } 00374 } 00375 } 00376 00377 /* 00378 * Can't find translation, or wType was invalid 00379 */ 00380 return 0; 00381 }

PCLS InternalRegisterClassEx LPWNDCLASSEX  lpwndcls,
WORD  fnid,
DWORD  flags
 

Definition at line 244 of file class.c.

References _InnerGetClassPtr(), AllocateUnicodeString(), BOOL, CBFNID, CheckCritIn, _CLIENTINFO::CI_flags, CI_REGISTERCLASSES, ClassAlloc(), ClassFree(), COMMON_WNDCLASS, CSF_ANSIPROC, CSF_SERVERSIDEPROC, CSF_SYSTEMCLASS, CSF_WIN40COMPAT, CSF_WOWCLASS, tagTHREADINFO::dwExpWinVer, DWORD, FALSE, FindClassAtom, gpclsList, hModuleWin, IS_PTR, L, LockDesktop, MapClientToServerPfn(), NULL, tagTHREADINFO::pClientInfo, tagCLS::pclsNext, tagPROCESSINFO::pclsPrivateList, tagPROCESSINFO::pclsPublicList, tagTHREADINFO::ppi, PtiCurrent, PTR_TO_ID, tagTHREADINFO::rpdesk, tagCLS::rpdeskParent, RtlInitUnicodeString(), RtlIntegerToChar(), RtlUnicodeStringToAnsiString(), tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, Unlock, UnlockDesktop, UserAddAtom(), UserDeleteAtom(), USHORT, ValidateAndLockCursor(), VER40, WND, and WNDPROC_PWND.

Referenced by LW_RegisterWindows(), and xxxRegisterClassEx().

00249 { 00250 BOOL fIs40Compat; 00251 ULONG_PTR dwT; 00252 PCLS pcls; 00253 LPWSTR pszT1; 00254 ATOM atomT; 00255 PTHREADINFO ptiCurrent; 00256 HANDLE hModule; 00257 PDESKTOP pdesk; 00258 ULONG cch; 00259 UNICODE_STRING UString; 00260 ANSI_STRING AString; 00261 00262 /* 00263 * NOTE -- lpszClassName and lpszMenuName in the wndclass may be client-side 00264 * pointers. Use of those fields must be protected in try blocks. 00265 */ 00266 CheckCritIn(); 00267 00268 ptiCurrent = PtiCurrent(); 00269 00270 /* 00271 * Don't allow 4.0 apps to register a class using hModuleWin 00272 * LATER GerardoB: Our client side classes use hmodUser (USER32) while 00273 * our server side classes use hWinInstance (WIN32K). We should change 00274 * CreateThreadInfo and LW_RegisterWindows so all classes use hModUser. 00275 */ 00276 hModule = cczlpwndcls->hInstance; 00277 if (!(CSF_flags & (CSF_SYSTEMCLASS | CSF_SERVERSIDEPROC)) 00278 && (hModule == hModuleWin) 00279 && (LOWORD(ptiCurrent->dwExpWinVer) >= VER40)) { 00280 00281 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "InternalRegisterClassEx: Invalid hInstance (Cannot use system's hInstance)"); 00282 return NULL; 00283 } 00284 00285 00286 /* 00287 * As of NT 4.0 we no longer honor CS_BYTEALIGNCLIENT or CS_BYTEALIGNWINDOW 00288 */ 00289 if (cczlpwndcls->style & (CS_BYTEALIGNCLIENT | CS_BYTEALIGNWINDOW)) { 00290 RIPMSG0(RIP_VERBOSE, "CS_BYTEALIGNCLIENT and CS_BYTEALIGNWINDOW styles no longer honored."); 00291 } 00292 00293 /* 00294 * Does this class exist as a private class? If so, fail. 00295 */ 00296 atomT = FindClassAtom(cczlpwndcls->lpszClassName); 00297 00298 if (atomT != 0 && !(CSF_flags & CSF_SERVERSIDEPROC)) { 00299 /* 00300 * First check private classes. If already exists, return error. 00301 */ 00302 if (_InnerGetClassPtr(atomT, &ptiCurrent->ppi->pclsPrivateList, 00303 hModule) != NULL) { 00304 RIPERR1(ERROR_CLASS_ALREADY_EXISTS, RIP_VERBOSE, "RegisterClass: Class already exists %lx", (DWORD)atomT); 00305 return NULL; 00306 } 00307 00308 /* 00309 * Now only check public classes if CS_GLOBALCLASS is set. If it 00310 * isn't set, then this will allow an application to re-register 00311 * a private class to take precedence over a public class. 00312 */ 00313 if (cczlpwndcls->style & CS_GLOBALCLASS) { 00314 if (_InnerGetClassPtr(atomT, &ptiCurrent->ppi->pclsPublicList, NULL) != NULL) { 00315 RIPERR0(ERROR_CLASS_ALREADY_EXISTS, RIP_VERBOSE, "RegisterClass: Global Class already exists"); 00316 return NULL; 00317 } 00318 } 00319 } 00320 00321 /* 00322 * Alloc space for the class. 00323 */ 00324 if (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD) { 00325 pdesk = NULL; 00326 } else { 00327 pdesk = ptiCurrent->rpdesk; 00328 } 00329 pcls = (PCLS)ClassAlloc(pdesk, sizeof(CLS) + cczlpwndcls->cbClsExtra + (CSF_flags & CSF_WOWCLASS ? sizeof(WC):0)); 00330 if (pcls == NULL) { 00331 return NULL; 00332 } 00333 00334 LockDesktop(&pcls->rpdeskParent, pdesk, LDL_CLS_DESKPARENT1, (ULONG_PTR)pcls); 00335 pcls->pclsBase = pcls; 00336 00337 /* 00338 * Copy over the shared part of the class structure. 00339 */ 00340 UserAssert(FIELD_OFFSET(WNDCLASSEX, style) == FIELD_OFFSET(COMMON_WNDCLASS, style)); 00341 RtlCopyMemory(&pcls->style, &(cczlpwndcls->style), 00342 sizeof(COMMON_WNDCLASS) - FIELD_OFFSET(COMMON_WNDCLASS, style)); 00343 00344 /* 00345 * Copy CSF_SERVERSIDEPROC, CSF_ANSIPROC (etc.) flags 00346 */ 00347 pcls->CSF_flags = LOWORD(CSF_flags); 00348 pcls->fnid = fnid; 00349 if (fnid) { 00350 CBFNID(fnid) = (WORD)(pcls->cbwndExtra + sizeof(WND)); 00351 00352 if (!(pcls->CSF_flags & CSF_SERVERSIDEPROC) && ptiCurrent->pClientInfo != NULL) { 00353 /* 00354 * Clear the bit so new threads in this process 00355 * won't bother to reregister the client-side USER classes. 00356 */ 00357 ptiCurrent->pClientInfo->CI_flags &= ~CI_REGISTERCLASSES; 00358 } 00359 } 00360 00361 /* 00362 * If this wndproc happens to be a client wndproc stub for a server 00363 * wndproc, then remember the server wndproc! This should be rare: why 00364 * would an application re-register a class that isn't "subclassed"? 00365 */ 00366 if (!(pcls->CSF_flags & CSF_SERVERSIDEPROC)) { 00367 dwT = MapClientToServerPfn((ULONG_PTR)pcls->lpfnWndProc); 00368 if (dwT != 0) { 00369 pcls->CSF_flags |= CSF_SERVERSIDEPROC; 00370 pcls->CSF_flags &= ~CSF_ANSIPROC; 00371 pcls->lpfnWndProc = (WNDPROC_PWND)dwT; 00372 } 00373 } 00374 00375 /* 00376 * Win95 compatible validation. 00377 * 00378 * hbrBackground was validated by GDI in the client side 00379 * NULL hInstances are mapped to GetModuleHandle(NULL) in the client 00380 * side 00381 */ 00382 00383 fIs40Compat = (CSF_flags & CSF_WIN40COMPAT) != 0; 00384 00385 if (!ValidateAndLockCursor(&pcls->spcur, fIs40Compat)) { 00386 goto ValidateError1; 00387 } 00388 00389 if (!ValidateAndLockCursor(&pcls->spicn, fIs40Compat)) { 00390 goto ValidateError2; 00391 } 00392 00393 if (!ValidateAndLockCursor(&pcls->spicnSm, fIs40Compat)) { 00394 goto ValidateError3; 00395 } 00396 00397 /* 00398 * Add the class name to the atom table. 00399 */ 00400 00401 if (IS_PTR(cczlpwndcls->lpszClassName)) 00402 atomT = UserAddAtom(cczlpwndcls->lpszClassName, FALSE); 00403 else 00404 atomT = PTR_TO_ID(cczlpwndcls->lpszClassName); 00405 00406 if (atomT == 0) { 00407 goto AtomError; 00408 } 00409 pcls->atomClassName = atomT; 00410 00411 /* 00412 * Make an ANSI version of the class name to optimize 00413 * GetClassNameA for WOW. 00414 */ 00415 if (IS_PTR(cczlpwndcls->lpszClassName)) { 00416 try { 00417 RtlInitUnicodeString(&UString, cczlpwndcls->lpszClassName); 00418 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00419 goto MemError2; 00420 } 00421 #ifdef FE_SB // InternalRegisterClassEx() 00422 cch = UString.Length + 1; 00423 #else 00424 cch = UString.Length / sizeof(WCHAR) + 1; 00425 #endif // FE_SB 00426 } else { 00427 cch = 7; // 1 char for '#', 5 for '65536'. 00428 } 00429 00430 /* 00431 * Allocate the ANSI name buffer and convert the unicode name 00432 * to ANSI. 00433 */ 00434 pcls->lpszAnsiClassName = (LPSTR)ClassAlloc(pdesk, cch); 00435 if (pcls->lpszAnsiClassName == NULL) { 00436 goto MemError2; 00437 } 00438 00439 /* 00440 * Form the ANSI class name. 00441 */ 00442 if (IS_PTR(cczlpwndcls->lpszClassName)) { 00443 00444 /* 00445 * Class name is a string. 00446 */ 00447 AString.Length = 0; 00448 AString.MaximumLength = (USHORT)cch; 00449 AString.Buffer = pcls->lpszAnsiClassName; 00450 try { 00451 RtlUnicodeStringToAnsiString(&AString, &UString, FALSE); 00452 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00453 goto MemError3; 00454 } 00455 } else { 00456 00457 /* 00458 * Class name is an integer atom. 00459 */ 00460 pcls->lpszAnsiClassName[0] = L'#'; 00461 RtlIntegerToChar(PTR_TO_ID(cczlpwndcls->lpszClassName), 10, cch - 1, 00462 &pcls->lpszAnsiClassName[1]); 00463 } 00464 00465 /* 00466 * Make local copy of menu name. 00467 */ 00468 pszT1 = pcls->lpszMenuName; 00469 00470 if (pszT1 != NULL) { 00471 if (IS_PTR(pszT1)) { 00472 try { 00473 RtlInitUnicodeString(&UString, pszT1); 00474 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00475 goto MemError3; 00476 } 00477 if (UString.Length == 0) { 00478 00479 /* 00480 * app passed an empty string for the name 00481 */ 00482 pcls->lpszMenuName = NULL; 00483 } else { 00484 UNICODE_STRING strMenuName; 00485 00486 /* 00487 * Alloc space for the Menu Name. 00488 */ 00489 if (!AllocateUnicodeString(&strMenuName, &UString)) { 00490 MemError3: 00491 ClassFree(pdesk, pcls->lpszAnsiClassName); 00492 MemError2: 00493 UserDeleteAtom(pcls->atomClassName); 00494 AtomError: 00495 Unlock(&pcls->spicnSm); 00496 ValidateError3: 00497 Unlock(&pcls->spicn); 00498 ValidateError2: 00499 Unlock(&pcls->spcur); 00500 ValidateError1: 00501 UnlockDesktop(&pcls->rpdeskParent, LDU_CLS_DESKPARENT1, (ULONG_PTR)pcls); 00502 ClassFree(pdesk, pcls); 00503 return NULL; 00504 } 00505 00506 pcls->lpszMenuName = strMenuName.Buffer; 00507 } 00508 } 00509 } 00510 00511 if ((CSF_flags & CSF_SERVERSIDEPROC) || (pcls->style & CS_GLOBALCLASS)) { 00512 if (pcls->CSF_flags & CSF_SYSTEMCLASS) { 00513 pcls->pclsNext = gpclsList; 00514 gpclsList = pcls; 00515 } else { 00516 pcls->pclsNext = ptiCurrent->ppi->pclsPublicList; 00517 ptiCurrent->ppi->pclsPublicList = pcls; 00518 } 00519 } else { 00520 pcls->pclsNext = ptiCurrent->ppi->pclsPrivateList; 00521 ptiCurrent->ppi->pclsPrivateList = pcls; 00522 } 00523 00524 /* 00525 * Because Memory is allocated with ZEROINIT, the pcls->cWndReferenceCount 00526 * field is automatically initialised to zero. 00527 */ 00528 00529 return pcls; 00530 }

HANDLE InternalRemoveProp PWND  pwnd,
LPWSTR  pszKey,
BOOL  fInternal
 

Definition at line 98 of file kernel/winprop.c.

References _FindProp(), tagPROPLIST::aprop, tagPROP::hData, tagPROPLIST::iFirstFree, NULL, and tagWND::ppropList.

Referenced by _DdeSetQualityOfService(), _SetWindowContextHelpId(), DestroyWindowSmIcon(), MESSAGECALL(), NtUserRemoveProp(), RemoveRedirectionBitmap(), UnlinkConv(), UserAssociateHwnd(), and xxxFreeWindow().

00102 { 00103 PPROP pprop; 00104 PPROP ppropLast; 00105 HANDLE hT; 00106 00107 /* 00108 * Find the property to be removed. 00109 */ 00110 pprop = _FindProp(pwnd, pszKey, fInternal); 00111 if (pprop == NULL) 00112 return NULL; 00113 00114 /* 00115 * Remember what it was pointing at. 00116 */ 00117 hT = pprop->hData; 00118 00119 /* 00120 * Move the property at the end of the list into this slot. 00121 */ 00122 pwnd->ppropList->iFirstFree--; 00123 ppropLast = &pwnd->ppropList->aprop[pwnd->ppropList->iFirstFree]; 00124 *pprop = *ppropLast; 00125 RtlZeroMemory(ppropLast, sizeof(*ppropLast)); 00126 00127 return hT; 00128 }

BOOL InternalSetClipboardData PWINDOWSTATION  pwinsta,
UINT  format,
HANDLE  hData,
BOOL  fGlobalHandle,
BOOL  fIncSerialNumber
 

Definition at line 1007 of file ntuser/kernel/clipbrd.c.

References BOOL, CCHFORMATNAME, CLIP, tagWINDOWSTATION::cNumClipFormats, DWORD, FALSE, tagWINDOWSTATION::fClipboardChanged, tagCLIP::fGlobalHandle, FindClipFormat(), tagWINDOWSTATION::fInDelayedRendering, tagCLIP::fmt, GETPTI, tagCLIP::hData, tagWINDOWSTATION::iClipSequenceNumber, tagWINDOWSTATION::iClipSerialNumber, NULL, tagWINDOWSTATION::pClipBase, tagWINDOWSTATION::ptiClipLock, PtiCurrent, tagWINDOWSTATION::spwndClipOwner, TRUE, UserAddAtom(), UserGetAtomName(), and UT_FreeCBFormat().

Referenced by _SetClipboardData(), MungeClipData(), and PasteScreenPalette().

01013 { 01014 PCLIP pClip; 01015 WCHAR achFormatName[CCHFORMATNAME]; 01016 01017 /* 01018 * Just check for pwinsta->ptiClipLock being NULL instead of checking 01019 * against PtiCurrent because an app needs to call SetClipboardData if 01020 * he's rendering data while another app has the clipboard open. 01021 */ 01022 if ((pwinsta->ptiClipLock == NULL) || (fmt == 0)) { 01023 RIPERR0(ERROR_CLIPBOARD_NOT_OPEN, RIP_WARNING, "SetClipboardData: Clipboard not open"); 01024 return FALSE; 01025 } 01026 01027 if ((pClip = FindClipFormat(pwinsta, fmt)) != NULL) { 01028 01029 /* 01030 * If data already exists, free it before we replace it. 01031 */ 01032 UT_FreeCBFormat(pClip); 01033 01034 } else { 01035 01036 if (pwinsta->pClipBase == NULL) { 01037 pClip = (PCLIP)UserAllocPool(sizeof(CLIP), TAG_CLIPBOARD); 01038 } else { 01039 DWORD dwSize = sizeof(CLIP) * pwinsta->cNumClipFormats; 01040 01041 pClip = (PCLIP)UserReAllocPool(pwinsta->pClipBase, 01042 dwSize, 01043 dwSize + sizeof(CLIP), 01044 TAG_CLIPBOARD); 01045 } 01046 01047 /* 01048 * Out of memory... return. 01049 */ 01050 if (pClip == NULL) { 01051 RIPMSG0(RIP_WARNING, "SetClipboardData: Out of memory"); 01052 return FALSE; 01053 } 01054 01055 /* 01056 * Just in case the data moved 01057 */ 01058 pwinsta->pClipBase = pClip; 01059 01060 /* 01061 * Increment the reference count of this atom format so that if 01062 * the application frees this atom we don't get stuck with a 01063 * bogus atom. We call DeleteAtom in the EmptyClipboard() code, 01064 * which decrements this count when we're done with this clipboard 01065 * data. 01066 */ 01067 if (UserGetAtomName((ATOM)fmt, achFormatName, CCHFORMATNAME) != 0) 01068 UserAddAtom(achFormatName, FALSE); 01069 01070 /* 01071 * Point to the new entry in the clipboard. 01072 */ 01073 pClip += pwinsta->cNumClipFormats++; 01074 pClip->fmt = fmt; 01075 } 01076 01077 /* 01078 * Start updating the new entry in the clipboard. 01079 */ 01080 pClip->hData = hData; 01081 pClip->fGlobalHandle = fGlobalHandle; 01082 01083 if (fIncSerialNumber) 01084 pwinsta->fClipboardChanged = TRUE; 01085 01086 if (fIncSerialNumber && !pwinsta->fInDelayedRendering) { 01087 pwinsta->iClipSequenceNumber++; 01088 } 01089 01090 /* 01091 * If the thread didn't bother emptying the clipboard before 01092 * writing to it, change the clipboard serial number 01093 * so that the client-side clipboard caches of all the 01094 * processes will get flushed on the next OpenClipboard. 01095 */ 01096 if ((pwinsta->spwndClipOwner == NULL) || 01097 (GETPTI(pwinsta->spwndClipOwner) != PtiCurrent())) { 01098 01099 RIPMSG0(RIP_VERBOSE, "Clipboard: SetClipboardData called without emptying clipboard"); 01100 01101 if (fIncSerialNumber) 01102 pwinsta->iClipSerialNumber++; 01103 } 01104 01105 return TRUE; 01106 }

BOOL InternalSetProp PWND  pwnd,
LPWSTR  pszKey,
HANDLE  hData,
DWORD  dwFlags
 

Definition at line 39 of file kernel/winprop.c.

References _FindProp(), tagPROP::atomKey, BOOL, CreateProp(), dwFlags, FALSE, tagPROP::fs, tagPROP::hData, IS_PTR, NULL, PROPF_INTERNAL, PTR_TO_ID, and TRUE.

Referenced by _DdeSetQualityOfService(), _SetWindowContextHelpId(), AddConvProp(), CkptRestore(), CreateRedirectionBitmap(), MESSAGECALL(), NtUserSetAppImeLevel(), NtUserSetProp(), UnlinkConv(), UserAssociateHwnd(), xxxCreateWindowSmIcon(), and xxxDWP_SetIcon().

00044 { 00045 PPROP pprop; 00046 00047 if (pszKey == NULL) { 00048 RIPERR0(ERROR_INVALID_PARAMETER, 00049 RIP_WARNING, 00050 "Invalid parameter \"pszKey\" (NULL) to InternalSetProp"); 00051 00052 return FALSE; 00053 } 00054 00055 /* 00056 * If no property list exists for this window, create one. 00057 */ 00058 pprop = _FindProp(pwnd, pszKey, dwFlags & PROPF_INTERNAL); 00059 if (pprop == NULL) { 00060 00061 /* 00062 * pszKey must be an atom within the server. 00063 */ 00064 UserAssert(!IS_PTR(pszKey)); 00065 00066 /* 00067 * CreateProp allocates the property and links it into the window's 00068 * property list. 00069 */ 00070 pprop = CreateProp(pwnd); 00071 if (pprop == NULL) 00072 return FALSE; 00073 00074 pprop->atomKey = PTR_TO_ID(pszKey); 00075 pprop->fs = (WORD)dwFlags; 00076 } 00077 00078 pprop->hData = hData; 00079 00080 return TRUE; 00081 }

UINT_PTR InternalSetTimer PWND  pwnd,
UINT_PTR  nIDEvent,
UINT  dwElapse,
TIMERPROC_PWND  pTimerFunc,
UINT  flags
 

Definition at line 225 of file timers.c.

References CheckCritIn, tagTIMER::cmsCountdown, tagTIMER::cmsRate, cTimerId, DecTimerCount(), ELAPSED_MAX, FALSE, FindTimer(), tagTIMER::flags, gbMasterTimerSet, GETPTI, gptiRit, gptmrFirst, gptmrMaster, HMAllocObject(), HMFreeObject(), KeSetTimer(), Lock, tagTIMER::nID, NULL, tagTIMER::pfn, tagTIMER::pti, tagTIMER::ptiOptCreator, tagTIMER::ptmrNext, tagTIMER::ptmrPrev, tagTIMER::spwnd, TIF_16BIT, tagTHREADINFO::TIF_flags, TIMER, TIMERID_MAX, TIMERID_MIN, TRUE, TYPE_TIMER, and UINT.

Referenced by _SetSystemTimer(), _SetTimer(), _UserSoundSentryWorker(), AccessTimeOutReset(), FilterKeys(), FKActivationTimer(), IncrementRedirectedCount(), ProcessKeyboardInput(), ResetMouseHover(), SetAppStarting(), SetJournalTimer(), SetTooltipTimer(), SoundSentryTimer(), StartFade(), StartTimers(), ToggleKeys(), UserSetTimer(), xxxFKAcceptanceDelayTimer(), xxxFKRepeatRateTimer(), xxxFlashWindow(), xxxMKMouseMove(), xxxMKMoveAccelCursorTimer(), xxxTrackMouseMove(), zzzAnimateCursor(), and zzzUpdateCursorImage().

00231 { 00232 LARGE_INTEGER liT = {1, 0}; 00233 PTIMER ptmr; 00234 PTHREADINFO ptiCurrent; 00235 00236 CheckCritIn(); 00237 00238 /* 00239 * Assert if someone tries to set a timer after InitiateWin32kCleanup 00240 * killed the RIT. 00241 */ 00242 UserAssert(gptiRit != NULL); 00243 00244 /* 00245 * 1.0 compatibility weirdness. Also, don't allow negative elapse times 00246 * because this'll cause ScanTimers() to generate negative elapse times 00247 * between timers. 00248 */ 00249 if ((dwElapse == 0) || (dwElapse > ELAPSED_MAX)) 00250 dwElapse = 1; 00251 00252 /* 00253 * Attempt to first locate the timer, then create a new one 00254 * if one isn't found. 00255 */ 00256 if ((ptmr = FindTimer(pwnd, nIDEvent, flags, FALSE)) == NULL) { 00257 00258 /* 00259 * Not found. Create a new one. 00260 */ 00261 ptmr = (PTIMER)HMAllocObject(NULL, NULL, TYPE_TIMER, sizeof(TIMER)); 00262 if (ptmr == NULL) { 00263 return 0; 00264 } 00265 00266 ptmr->spwnd = NULL; 00267 00268 if (pwnd == NULL) { 00269 00270 WORD timerIdInitial = cTimerId; 00271 00272 /* 00273 * Pick a unique, unused timer ID. 00274 */ 00275 do { 00276 00277 if (--cTimerId <= TIMERID_MIN) 00278 cTimerId = TIMERID_MAX; 00279 00280 if (cTimerId == timerIdInitial) { 00281 00282 /* 00283 * Flat out of timers bud. 00284 */ 00285 HMFreeObject(ptmr); 00286 return 0; 00287 } 00288 00289 } while (FindTimer(NULL, cTimerId, flags, FALSE) != NULL); 00290 00291 ptmr->nID = (UINT)cTimerId; 00292 00293 } else { 00294 ptmr->nID = nIDEvent; 00295 } 00296 00297 /* 00298 * Link the new timer into the front of the list. 00299 * Handily this works even when gptmrFirst is NULL. 00300 */ 00301 ptmr->ptmrNext = gptmrFirst; 00302 ptmr->ptmrPrev = NULL; 00303 if (gptmrFirst) 00304 gptmrFirst->ptmrPrev = ptmr; 00305 gptmrFirst = ptmr; 00306 00307 } else { 00308 00309 /* 00310 * If this timer was just about to be processed, 00311 * decrement cTimersReady since we're resetting it. 00312 */ 00313 if (ptmr->flags & TMRF_READY) 00314 DecTimerCount(ptmr->pti); 00315 } 00316 00317 /* 00318 * If pwnd is NULL, create a unique id by 00319 * using the timer handle. RIT timers are 'owned' by the RIT pti 00320 * so they are not deleted when the creating pti dies. 00321 * 00322 * We used to record the pti as the pti of the window if one was 00323 * specified. This is not what Win 3.1 does and it broke 10862 00324 * where some merge app was setting the timer on winword's window 00325 * it it still expected to get the messages not winword. 00326 * 00327 * MS Visual C NT was counting on this bug in the NT 3.1 so if 00328 * a thread sets a timer for a window in another thread in the 00329 * same process the timer goes off in the thread of the window. 00330 * You can see this by doing a build in msvcnt and the files being 00331 * compiled do not show up. 00332 */ 00333 ptiCurrent = (PTHREADINFO)(W32GetCurrentThread()); /* 00334 * This will be NULL 00335 * for a non-GUI thread. 00336 */ 00337 00338 if (pwnd == NULL) { 00339 00340 if (flags & TMRF_RIT) { 00341 ptmr->pti = gptiRit; 00342 } else { 00343 ptmr->pti = ptiCurrent; 00344 UserAssert(ptiCurrent); 00345 } 00346 00347 } else { 00348 00349 /* 00350 * As enforced in the API wrappers. We shouldn't get here 00351 * any other way for an app timer. 00352 * 00353 * Always use pti of the window when TMRF_PTIWINDOW is passed in. 00354 */ 00355 if ((ptiCurrent->TIF_flags & TIF_16BIT) && !(flags & TMRF_PTIWINDOW)) { 00356 ptmr->pti = ptiCurrent; 00357 UserAssert(ptiCurrent); 00358 } else { 00359 ptmr->pti = GETPTI(pwnd); 00360 } 00361 } 00362 00363 /* 00364 * Initialize the timer-struct. 00365 * 00366 * NOTE: The ptiOptCreator is used to identify a JOURNAL-timer. We 00367 * want to allow these timers to be destroyed when the creator 00368 * thread goes away. For other threads that create timers across 00369 * threads, we do not want to destroy these timers when the 00370 * creator goes away. Currently, we're only checking for a 00371 * TMRF_RIT. However, in the future we might want to add this 00372 * same check for TMRF_SYSTEM. 00373 */ 00374 Lock(&(ptmr->spwnd), pwnd); 00375 00376 ptmr->cmsCountdown = ptmr->cmsRate = dwElapse; 00377 ptmr->flags = flags | TMRF_INIT; 00378 ptmr->pfn = pTimerFunc; 00379 ptmr->ptiOptCreator = (flags & TMRF_RIT ? ptiCurrent : NULL); 00380 00381 /* 00382 * Force the RIT to scan timers. 00383 * 00384 * N.B. The following code sets the raw input thread timer to expire 00385 * at the absolute time 1 which is very far into the past. This 00386 * causes the timer to immediately expire before the set timer 00387 * call returns. 00388 */ 00389 if (ptiCurrent == gptiRit) { 00390 /* 00391 * Don't let RIT timer loop reset the master timer - we already have. 00392 */ 00393 gbMasterTimerSet = TRUE; 00394 } 00395 00396 UserAssert(gptmrMaster); 00397 KeSetTimer(gptmrMaster, liT, NULL); 00398 00399 /* 00400 * Windows 3.1 returns the timer ID if non-zero, otherwise it returns 1. 00401 */ 00402 return (ptmr->nID == 0 ? 1 : ptmr->nID); 00403 }

SHORT InternalVkKeyScanEx WCHAR  cChar,
PKBDTABLES  pKbdTbl
 

Definition at line 803 of file tounicod.c.

References BYTE, FALSE, GetModificationNumber(), gspklBaseLayout, NULL, PBYTE, tagKBDFILE::pKbdTbl, SHORT, and tagKL::spkf.

Referenced by NtUserVkKeyScanEx(), and xxxInternalToUnicode().

00806 { 00807 PVK_TO_WCHARS1 pVK; 00808 PVK_TO_WCHAR_TABLE pVKT; 00809 BYTE nShift; 00810 WORD wModBits; 00811 WORD wModNumCtrl, wModNumShiftCtrl; 00812 SHORT shRetvalCtrl = 0; 00813 SHORT shRetvalShiftCtrl = 0; 00814 00815 if (pKbdTbl == NULL) { 00816 pKbdTbl = gspklBaseLayout->spkf->pKbdTbl; 00817 } 00818 00819 /* 00820 * Ctrl and Shift-Control combinations are less favored, so determine 00821 * the values for nShift which we prefer not to use if at all possible. 00822 * This is for compatibility with Windows 95/98, which only returns a 00823 * Ctrl or Shift+Ctrl combo as a last resort. See bugs #78891 & #229141 00824 */ 00825 wModNumCtrl = GetModificationNumber(pKbdTbl->pCharModifiers, KBDCTRL); 00826 wModNumShiftCtrl = GetModificationNumber(pKbdTbl->pCharModifiers, KBDSHIFT | KBDCTRL); 00827 00828 for (pVKT = pKbdTbl->pVkToWcharTable; pVKT->pVkToWchars != NULL; pVKT++) { 00829 for (pVK = pVKT->pVkToWchars; 00830 pVK->VirtualKey != 0; 00831 pVK = (PVK_TO_WCHARS1)((PBYTE)pVK + pVKT->cbSize)) { 00832 for (nShift = 0; nShift < pVKT->nModifications; nShift++) { 00833 if (pVK->wch[nShift] == wchChar) { 00834 /* 00835 * A matching character has been found! 00836 */ 00837 if (pVK->VirtualKey == 0xff) { 00838 /* 00839 * dead char: back up to previous line to get the VK. 00840 */ 00841 pVK = (PVK_TO_WCHARS1)((PBYTE)pVK - pVKT->cbSize); 00842 } 00843 00844 /* 00845 * If this is the first Ctrl or the first Shift+Ctrl match, 00846 * remember in case we don't find any better match. 00847 * In the meantime, keep on looking. 00848 */ 00849 if (nShift == wModNumCtrl) { 00850 if (shRetvalCtrl == 0) { 00851 shRetvalCtrl = (SHORT)MAKEWORD(pVK->VirtualKey, KBDCTRL); 00852 } 00853 } else if (nShift == wModNumShiftCtrl) { 00854 if (shRetvalShiftCtrl == 0) { 00855 shRetvalShiftCtrl = (SHORT)MAKEWORD(pVK->VirtualKey, KBDCTRL | KBDSHIFT); 00856 } 00857 } else { 00858 /* 00859 * this seems like a very good match! 00860 */ 00861 goto GoodMatchFound; 00862 } 00863 } 00864 } 00865 } 00866 } 00867 00868 /* 00869 * Didn't find a good match: use whatever Ctrl/Shift+Ctrl match was found 00870 */ 00871 if (shRetvalCtrl) { 00872 return shRetvalCtrl; 00873 } 00874 if (shRetvalShiftCtrl) { 00875 return shRetvalShiftCtrl; 00876 } 00877 00878 /* 00879 * May be a control character not explicitly in the layout tables 00880 */ 00881 if (wchChar < 0x0020) { 00882 /* 00883 * Ctrl+char -> char - 0x40 00884 */ 00885 return (SHORT)MAKEWORD((wchChar + 0x40), KBDCTRL); 00886 } 00887 return -1; 00888 00889 GoodMatchFound: 00890 /* 00891 * Scan aModification[] to find nShift: the index will be a bitmask 00892 * representing the Shifter Keys that need to be pressed to produce 00893 * this Shift State. 00894 */ 00895 for (wModBits = 0; 00896 wModBits <= pKbdTbl->pCharModifiers->wMaxModBits; 00897 wModBits++) 00898 { 00899 if (pKbdTbl->pCharModifiers->ModNumber[wModBits] == nShift) { 00900 if (pVK->VirtualKey == 0xff) { 00901 /* 00902 * The previous entry contains the actual virtual key in this case. 00903 */ 00904 pVK = (PVK_TO_WCHARS1)((PBYTE)pVK - pVKT->cbSize); 00905 } 00906 return (SHORT)MAKEWORD(pVK->VirtualKey, wModBits); 00907 } 00908 } 00909 00910 /* 00911 * huh? should never reach here! (IanJa) 00912 */ 00913 UserAssertMsg1(FALSE, "InternalVkKeyScanEx error: wchChar = 0x%x", wchChar); 00914 return -1; 00915 }

int IntersectVisRect HDC  ,
int  ,
int  ,
int  ,
int 
 

BOOL IntersectWithParents PWND  pwnd,
LPRECT  lprc
 

Definition at line 1772 of file update.c.

References BOOL, FALSE, FLayeredOrRedirected(), IntersectRect(), NULL, tagWND::rcClient, tagWND::spwndParent, TestWF, TRUE, WFMINIMIZED, and WFVISIBLE.

Referenced by SpbTransfer(), ValidateParents(), xxxGetUpdateRect(), xxxGetUpdateRgn(), and xxxInternalInvalidate().

01775 { 01776 if (FLayeredOrRedirected(pwnd)) 01777 return TRUE; 01778 01779 while ((pwnd = pwnd->spwndParent) != NULL) { 01780 01781 if (!TestWF(pwnd, WFVISIBLE) || TestWF(pwnd, WFMINIMIZED)) 01782 return FALSE; 01783 01784 if (!IntersectRect(lprc, lprc, &pwnd->rcClient)) 01785 return FALSE; 01786 01787 if (FLayeredOrRedirected(pwnd)) 01788 return TRUE; 01789 } 01790 01791 return TRUE; 01792 }

VOID InvalidateDce PDCE  pdce  ) 
 

Definition at line 470 of file dc.c.

References CFPARENTDC, tagDCE::DCX_flags, gpDispInfo, tagDCE::hdc, tagDISPLAYINFO::hDev, tagDCE::hrgnClip, tagDCE::hrgnClipPublic, MarkDCEInvalid(), NULL, tagDCE::pwndClip, tagDCE::pwndOrg, SpbCheckDce(), TestCF, TestWF, UserSetDCVisRgn(), VOID(), WFCLIPCHILDREN, WFCLIPSIBLINGS, WFMINIMIZED, WFVISIBLE, and WFWIN31COMPAT.

Referenced by ConvertRedirectionDCs(), CreateCacheDC(), DeleteHrgnClip(), and zzzInvalidateDCCache().

00472 { 00473 GreLockDisplay(gpDispInfo->hDev); 00474 00475 if (!(pdce->DCX_flags & DCX_INUSE)) { 00476 00477 /* 00478 * Accumulate any bounds for this CE 00479 * since we're about to mark it invalid. 00480 */ 00481 SpbCheckDce(pdce); 00482 00483 MarkDCEInvalid(pdce); 00484 00485 pdce->pwndOrg = NULL; 00486 pdce->pwndClip = NULL; 00487 pdce->hrgnClip = NULL; 00488 pdce->hrgnClipPublic = NULL; 00489 00490 /* 00491 * Remove the vis rgn since it is still owned - if we did not, 00492 * gdi would not be able to clean up properly if the app that 00493 * owns this vis rgn exist while the vis rgn is still selected. 00494 */ 00495 GreSelectVisRgn(pdce->hdc, NULL, SVR_DELETEOLD); 00496 00497 } else { 00498 00499 PWND pwndOrg = pdce->pwndOrg; 00500 PWND pwndClip = pdce->pwndClip; 00501 00502 /* 00503 * In case the window's clipping style bits changed, 00504 * reset the DCE flags from the window style bits. 00505 * Note that minimized windows never exclude their children. 00506 */ 00507 pdce->DCX_flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS); 00508 00509 /* 00510 * Chicago stuff... 00511 */ 00512 if (TestCF(pwndOrg, CFPARENTDC) && 00513 (TestWF(pwndOrg, WFWIN31COMPAT) || !TestWF(pwndClip, WFCLIPCHILDREN)) && 00514 (TestWF(pwndOrg, WFVISIBLE) == TestWF(pwndClip, WFVISIBLE))) { 00515 00516 if (TestWF(pwndClip, WFCLIPSIBLINGS)) 00517 pdce->DCX_flags |= DCX_CLIPSIBLINGS; 00518 00519 } else { 00520 00521 if (TestWF(pwndOrg, WFCLIPCHILDREN) && !TestWF(pwndOrg, WFMINIMIZED)) 00522 pdce->DCX_flags |= DCX_CLIPCHILDREN; 00523 00524 if (TestWF(pwndOrg, WFCLIPSIBLINGS)) 00525 pdce->DCX_flags |= DCX_CLIPSIBLINGS; 00526 } 00527 00528 /* 00529 * Mark that any saved visrgn needs to be recomputed. 00530 */ 00531 pdce->DCX_flags |= DCX_SAVEDRGNINVALID; 00532 00533 UserSetDCVisRgn(pdce); 00534 } 00535 00536 GreUnlockDisplay(gpDispInfo->hDev); 00537 }

BOOL IPostQuitMessage PTHREADINFO  pti,
int  nExitCode
 

Definition at line 1102 of file ntuser/kernel/input.c.

References BOOL, tagTHREADINFO::cQuit, tagTHREADINFO::exitCode, SetWakeBit(), and TRUE.

Referenced by _PostQuitMessage(), and xxxSwitchDesktop().

01103 { 01104 pti->cQuit = 1; 01105 pti->exitCode = nExitCode; 01106 SetWakeBit(pti, QS_POSTMESSAGE | QS_ALLPOSTMESSAGE); 01107 return TRUE; 01108 }

BOOL Is31TrayWindow PWND  pwnd  ) 
 

Definition at line 40 of file winloop2.c.

References BOOL, FALSE, FHas31TrayStyles, IsVSlick(), tagWND::spwndOwner, TestWF, TRUE, and WEFTOOLWINDOW.

Referenced by IsTrayWindow(), and xxxUpdateTray().

00041 { 00042 PWND pwnd2; 00043 00044 if (!(pwnd2 = pwnd->spwndOwner)) 00045 return (!IsVSlick(pwnd)); // unowned -- do we want you? 00046 00047 if (TestWF(pwnd2, WEFTOOLWINDOW)) 00048 return(FALSE); // owned by a tool window -- we don't want 00049 00050 return((FHas31TrayStyles(pwnd2) ? (IsVSlick(pwnd2)) : TRUE)); 00051 }

BOOL IsChildSameThread IN PWND  pwndParent,
IN PWND  pwndChild
 

Referenced by ImeCanDestroyDefIMEforChild().

__inline BOOL IsForegroundLocked  ) 
 

Definition at line 7022 of file userk.h.

Referenced by FAllowForegroundActivate(), xxxActiveWindowTracking(), and xxxSetForegroundWindow().

07023 { 07024 UserAssert(guModalMenuStateCount != 0); 07025 guModalMenuStateCount--;

PHOTKEY IsHotKey UINT  fsModifiers,
UINT  vk
 

Definition at line 735 of file hotkeys.c.

References CheckCritIn, tagHOTKEY::fsModifiers, gphkFirst, NULL, tagHOTKEY::phkNext, and tagHOTKEY::vk.

Referenced by xxxDoHotKeyStuff(), and xxxKeyEvent().

00738 { 00739 PHOTKEY phk; 00740 00741 CheckCritIn(); 00742 00743 phk = gphkFirst; 00744 00745 while (phk != NULL) { 00746 00747 /* 00748 * Do the modifiers and vk for this hotkey match the current state? 00749 */ 00750 if ((phk->fsModifiers == fsModifiers) && (phk->vk == vk)) { 00751 return phk; 00752 } 00753 00754 phk = phk->phkNext; 00755 } 00756 00757 return NULL; 00758 }

__inline BOOL IsInsideMenuLoop PTHREADINFO  pti  ) 
 

Definition at line 4735 of file userk.h.

Referenced by xxxCancelTrackingForThread(), xxxScanSysQueue(), and zzzAttachToQueue().

04738 {

__inline BOOL IsMDIItem PITEM  pitem  ) 
 

Definition at line 4772 of file userk.h.

References NULL, and PMENUSTATE.

Referenced by MBC_RightJustifyMenu().

04778 {

__inline BOOL IsMenuStarted PTHREADINFO  pti  ) 
 

Definition at line 4739 of file userk.h.

Referenced by xxxButtonEvent(), and xxxScanSysQueue().

04742 {

BOOL IsMFMWFPWindow ULONG_PTR  uHitArea  ) 
 

Definition at line 3145 of file ntuser/kernel/menu.c.

References BOOL, FALSE, MFMWFP_ALTMENU, MFMWFP_NOITEM, MFMWFP_OFFMENU, and TRUE.

Referenced by LockMFMWFPWindow(), UnlockMFMWFPWindow(), xxxHandleMenuMessages(), xxxMenuWindowProc(), xxxMNFindWindowFromPoint(), xxxMNSetGapState(), and xxxMNUpdateDraggingInfo().

03146 { 03147 switch(uHitArea) { 03148 case MFMWFP_OFFMENU: 03149 case MFMWFP_NOITEM: 03150 case MFMWFP_ALTMENU: 03151 return FALSE; 03152 03153 default: 03154 return TRUE; 03155 } 03156 }

__inline BOOL IsModelessMenuNotificationWindow PWND  pwnd  ) 
 

Definition at line 4760 of file userk.h.

Referenced by GetActiveTrackPwnd(), and xxxDWP_DoNCActivate().

04762 { 04763 return ppopupmenu->spmenu->rgItems + ppopupmenu->posSelectedItem; 04764 } 04765 __inline BOOL MNIsScrollArrowSelected(PPOPUPMENU ppopupmenu) 04766 {

BOOL IsPrivileged PPRIVILEGE_SET  ppSet  ) 
 

Definition at line 593 of file w32/ntuser/kernel/security.c.

References BOOL, FALSE, L, NT_SUCCESS, NtClose(), NtOpenThreadToken(), NtPrivilegeCheck(), NtPrivilegeObjectAuditAlarm(), NTSTATUS(), NULL, RtlInitUnicodeString(), RtlNtStatusToDosError(), SeCaptureSubjectContext(), SeLockSubjectContext(), SePrivilegeCheck(), SePrivilegeObjectAuditAlarm(), SeReleaseSubjectContext(), SeUnlockSubjectContext(), Status, TRUE, and UserMode.

Referenced by _RegisterLogonProcess(), InitiateShutdown(), SrvRegisterServicesProcess(), and xxxWrapSendMessageBSM().

00595 { 00596 SECURITY_SUBJECT_CONTEXT Context; 00597 BOOLEAN bHeld; 00598 00599 SeCaptureSubjectContext(&Context); 00600 SeLockSubjectContext(&Context); 00601 00602 bHeld = SePrivilegeCheck(ppSet, &Context, UserMode); 00603 SePrivilegeObjectAuditAlarm(NULL, &Context, 0, ppSet, bHeld, UserMode); 00604 00605 SeUnlockSubjectContext(&Context); 00606 SeReleaseSubjectContext(&Context); 00607 00608 if (!bHeld) 00609 RIPERR0(ERROR_PRIVILEGE_NOT_HELD, RIP_VERBOSE, ""); 00610 00611 /* 00612 * Return result of privilege check 00613 */ 00614 return (BOOL)bHeld; 00615 }

__inline BOOL IsRecursedMenuState PMENUSTATE  pMenuState,
PPOPUPMENU  ppopupmenu
 

Definition at line 4767 of file userk.h.

References MFMWFP_DOWNARROW, and MFMWFP_UPARROW.

Referenced by xxxMenuWindowProc().

04771 {

BOOLEAN IsRestricted PETHREAD  Thread  ) 
 

Definition at line 95 of file ex.c.

References FALSE, NULL, ObDereferenceObject, PsReferenceImpersonationToken(), PsReferencePrimaryToken(), SeTokenIsRestricted(), and _ETHREAD::ThreadsProcess.

00098 { 00099 PACCESS_TOKEN UserToken; 00100 BOOLEAN fCopyOnOpen; 00101 BOOLEAN fEffectiveOnly; 00102 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 00103 BOOLEAN fRestricted = FALSE; 00104 00105 /* 00106 * Check for a thread token first. 00107 */ 00108 UserToken = PsReferenceImpersonationToken(Thread, 00109 &fCopyOnOpen, &fEffectiveOnly, &ImpersonationLevel); 00110 00111 /* 00112 * If no thread token, go to the process. 00113 */ 00114 if (UserToken == NULL) { 00115 UserToken = PsReferencePrimaryToken(Thread->ThreadsProcess); 00116 } 00117 00118 /* 00119 * If we got a token, is it restricted? 00120 */ 00121 if (UserToken != NULL) { 00122 fRestricted = SeTokenIsRestricted(UserToken); 00123 ObDereferenceObject(UserToken); 00124 } 00125 00126 return fRestricted; 00127 }

__inline BOOL IsRootPopupMenu PPOPUPMENU  ppopupmenu  ) 
 

Definition at line 4719 of file userk.h.

References BOOL.

Referenced by MNFlushDestroyedPopups(), MNFreePopup(), UnlockPopupMenu(), xxxEndMenuLoop(), xxxMNDestroyHandler(), xxxMNKeyDown(), xxxMNLoop(), xxxMNMouseMove(), and xxxMNStartMenu().

04730 {

BOOL IsSAS BYTE  vk,
UINT *  pfsModifiers
 

Definition at line 372 of file hotkeys.c.

References BOOL, CheckCritIn, FALSE, gfsSASModifiers, gfsSASModifiersDown, gvkSAS, TRUE, and UINT.

Referenced by xxxDoHotKeyStuff(), xxxKeyEvent(), and xxxNumpadCursor().

00375 { 00376 UINT fsDown = 0; 00377 00378 CheckCritIn(); 00379 00380 if (gvkSAS != vk) { 00381 return FALSE; 00382 } 00383 00384 /* 00385 * Special case for SAS - examine real physical modifier-key state! 00386 * 00387 * An evil daemon process can fool convincingly pretend to be winlogon 00388 * by registering Alt+Del as a hotkey, and spinning another thread that 00389 * continually calls keybd_event() to send the Ctrl key up: when the 00390 * user types Ctrl+Alt+Del, only Alt+Del will be seen by the system, 00391 * the evil daemon will get woken by WM_HOTKEY and can pretend to be 00392 * winlogon. So look at gfsSASModifiersDown in this case, to see what keys 00393 * were physically pressed. 00394 * NOTE: If hotkeys are ever made to work under journal playback, make 00395 * sure they don't affect the gfsSASModifiersDown! - IanJa. 00396 */ 00397 if (gfsSASModifiersDown == gfsSASModifiers) { 00398 *pfsModifiers = gfsSASModifiersDown; 00399 return TRUE; 00400 } 00401 00402 return FALSE; 00403 }

__inline BOOL IsShellProcess PPROCESSINFO  ppi  ) 
 

Definition at line 6039 of file userk.h.

Referenced by CheckAllowForeground(), and DestroyProcessInfo().

06050 {

BOOL IsSmallerThanScreen PWND  pwnd  ) 
 

Definition at line 208 of file mnsys.c.

References _MonitorFromWindow(), BOOL, FALSE, tagWND::rcWindow, tagMONITOR::rcWork, and TRUE.

Referenced by xxxSetSysMenu(), and zzzChangeStates().

00209 { 00210 int dxMax, dyMax; 00211 PMONITOR pMonitor; 00212 00213 pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 00214 dxMax = pMonitor->rcWork.right - pMonitor->rcWork.left; 00215 dyMax = pMonitor->rcWork.bottom - pMonitor->rcWork.top; 00216 00217 if ((pwnd->rcWindow.right - pwnd->rcWindow.left < dxMax) || 00218 (pwnd->rcWindow.bottom - pwnd->rcWindow.top < dyMax)) { 00219 return TRUE; 00220 } 00221 return FALSE; 00222 }

__inline BOOL IsTimeFromLastInput DWORD  dwTimeout  ) 
 

Definition at line 6996 of file userk.h.

References DWORD.

Referenced by IdleTimerProc().

07001 {

__inline BOOL IsTimeFromLastRITEvent DWORD  dwTimeout  ) 
 

Definition at line 7001 of file userk.h.

References DWORD.

Referenced by CanForceForeground().

07001 { 07002 UserAssertMsg0(nDelta >= 0, "Delta must be postive"); 07003 return dwTime - (DWORD) nDelta; 07004 }

BOOL IsTrayWindow PWND   ) 
 

Definition at line 62 of file winloop2.c.

References BOOL, FALSE, FCallHookTray, FDoTray, FHas31TrayStyles, FPostTray, FTopLevel, tagWND::head, Is31TrayWindow(), NULL, tagWND::spwndOwner, TestWF, TRUE, WEFAPPWINDOW, WEFNOACTIVATE, WEFTOOLWINDOW, and WFWIN40COMPAT.

Referenced by ParkIcon(), xxxArrangeIconicWindows(), xxxCalcValidRects(), xxxDestroyWindow(), xxxFlashWindow(), xxxHandleOwnerSwitch(), xxxMinMaximize(), xxxMNPositionHierarchy(), xxxRedrawFrameAndHook(), xxxRedrawTitle(), xxxSetForegroundWindow(), xxxSetSysMenu(), xxxUpdateTray(), and zzzChangeStates().

00063 { 00064 if ((pwnd==NULL) || !(FDoTray() && (FCallHookTray() || FPostTray(pwnd->head.rpdesk))) || 00065 !FTopLevel(pwnd)) 00066 return(FALSE); 00067 00068 // Check for WS_EX_APPWINDOW or WS_EX_TOOLWINDOW "overriding" bits 00069 if (TestWF(pwnd, WEFAPPWINDOW)) 00070 return(TRUE); 00071 00072 if (TestWF(pwnd, WEFTOOLWINDOW)) 00073 return(FALSE); 00074 00075 if (TestWF(pwnd, WEFNOACTIVATE)) { 00076 return FALSE; 00077 } 00078 00079 if (TestWF(pwnd, WFWIN40COMPAT)) { 00080 if (pwnd->spwndOwner == NULL) 00081 return(TRUE); 00082 if (TestWF(pwnd->spwndOwner, WFWIN40COMPAT)) 00083 return(FALSE); 00084 // if this window is owned by a 3.1 window, check it like a 3.1 window 00085 } 00086 00087 if (!FHas31TrayStyles(pwnd)) 00088 return(FALSE); 00089 00090 return(Is31TrayWindow(pwnd)); 00091 }

VOID ISV_InitMinMaxInfo PWND  pwnd,
PPOINT  aptMinMaxWnd
 

VOID ISV_ValidateMinMaxInfo PWND  pwnd,
PPOINT  aptMinMaxWnd
 

BOOL IsVSlick PWND  pwnd  ) 
 

Definition at line 17 of file winloop2.c.

References BOOL, tagDISPLAYINFO::cMonitors, FALSE, gpDispInfo, tagDISPLAYINFO::rcScreen, tagWND::rcWindow, and TRUE.

Referenced by Is31TrayWindow().

00018 { 00019 if (gpDispInfo->cMonitors == 1 && 00020 ((unsigned) pwnd->rcWindow.left > (unsigned) gpDispInfo->rcScreen.right ) && 00021 ((unsigned) pwnd->rcWindow.top > (unsigned) gpDispInfo->rcScreen.bottom) && 00022 (pwnd->rcWindow.top == (gpDispInfo->rcScreen.bottom+100)) && 00023 (pwnd->rcWindow.left == (gpDispInfo->rcScreen.right+100))) 00024 { 00025 // MUST BE THE ONE AND ONLY V-SLICK 00026 return(TRUE); 00027 } 00028 00029 return(FALSE); 00030 }

BOOL KEOEMProcs PKE  pke  ) 
 

Definition at line 635 of file xlate.c.

References aKEProcOEM, BOOL, CheckCritIn, FALSE, NULL, and TRUE.

Referenced by xxxProcessKeyEvent().

00636 { 00637 int i; 00638 00639 CheckCritIn(); 00640 00641 for (i = 0; aKEProcOEM[i] != NULL; i++) { 00642 if (!aKEProcOEM[i](pKe)) { 00643 /* 00644 * Eat the key event 00645 */ 00646 return FALSE; 00647 } 00648 } 00649 00650 /* 00651 * Pass the (possibly altered) key event on. 00652 */ 00653 return TRUE; 00654 }

HANDLE KernelPtoH PVOID  pObj  ) 
 

BOOL KillTimer2 PWND  pwnd,
UINT_PTR  nIDEvent,
BOOL  fSystemTimer
 

Definition at line 447 of file timers.c.

References BOOL, FindTimer(), NULL, and TRUE.

Referenced by _KillSystemTimer(), and _KillTimer().

00451 { 00452 /* 00453 * Call FindTimer() with fKill == TRUE. This will 00454 * basically delete the timer. 00455 */ 00456 return (FindTimer(pwnd, 00457 nIDEvent, 00458 (fSystemTimer ? TMRF_SYSTEM : 0), 00459 TRUE) != NULL); 00460 }

VOID LeaveCrit VOID   ) 
 

__inline VOID LeaveDeviceInfoListCrit  ) 
 

Definition at line 7258 of file userk.h.

References VOID().

Referenced by CreateDeviceInfo(), InputApc(), NlsKbdSendIMENotification(), ProcessDeviceChanges(), RawInputThread(), RequestDeviceChange(), StartDeviceRead(), UpdateKeyLights(), UpdateMouseInfo(), and Win32kNtUserCleanup().

07264 {

__inline VOID LeaveHandleFlagsCrit  ) 
 

Definition at line 7312 of file userk.h.

Referenced by CheckHandleFlag(), CheckHandleInUse(), SetHandleFlag(), SetHandleInUse(), and UserDeleteW32Process().

07317 {

__inline VOID LeaveMouseCrit  ) 
 

Definition at line 7239 of file userk.h.

References ExAcquireResourceExclusiveLite(), gpresMouseEventQueue, KeEnterCriticalRegion, TRUE, and VOID().

Referenced by QueueMouseEvent(), and UnqueueMouseEvent().

07243 {

VOID LinkCursor PCURSOR  pcur  ) 
 

Definition at line 269 of file kernel/acons.c.

References CURSORF_ACONFRAME, CURSORF_LINKED, CURSORF_LRSHARED, gpcurFirst, NULL, tagPROCESSINFO::pCursorCache, and VOID().

Referenced by _SetCursorIconData().

00271 { 00272 /* 00273 * Should never try to link twice! 00274 */ 00275 UserAssert(!(pcur->CURSORF_flags & CURSORF_LINKED)); 00276 /* 00277 * We don't cache acon frames because they all belong to the 00278 * root acon object. 00279 * 00280 * We don't cache process owned objects that are not LRSHARED 00281 * either. 00282 */ 00283 if (!(pcur->CURSORF_flags & CURSORF_ACONFRAME)) { 00284 PPROCESSINFO ppi = pcur->head.ppi; 00285 if (ppi == NULL) { 00286 /* 00287 * Public cache object. 00288 */ 00289 pcur->pcurNext = gpcurFirst; 00290 gpcurFirst = pcur; 00291 pcur->CURSORF_flags |= CURSORF_LINKED; 00292 } else if (pcur->CURSORF_flags & CURSORF_LRSHARED) { 00293 /* 00294 * Private cache LR_SHARED object. 00295 */ 00296 pcur->pcurNext = ppi->pCursorCache; 00297 ppi->pCursorCache = pcur; 00298 pcur->CURSORF_flags |= CURSORF_LINKED; 00299 } 00300 } 00301 }

VOID LinkWindow PWND  pwnd,
PWND  pwndInsert,
PWND  pwndParent
 

Definition at line 1478 of file createw.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, CFIME, FALSE, FSwpTopmost(), gpsi, ICLS_IME, Lock, NULL, tagWND::pcls, PWND_BOTTOM, PWND_TOP, PWNDDESKTOP, PWNDMESSAGE, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndParent, TestCF, TestWF, TrackLayeredZorder(), TRUE, WEFLAYERED, WEFTOPMOST, WFBOTTOMMOST, WFDESTROYED, and WFTOGGLETOPMOST.

Referenced by ImeSetTopmost(), xxxCreateDesktop(), xxxCreateWindowEx(), xxxSetParent(), and zzzChangeStates().

01482 { 01483 if (pwndParent->spwndChild == pwnd) { 01484 RIPMSG0(RIP_WARNING, "Attempting to link a window to itself"); 01485 return; 01486 } 01487 UserAssert(pwnd != pwndInsert); 01488 UserAssert((pwnd->spwndParent == NULL) || (pwnd->spwndParent == pwndParent)); 01489 01490 if (pwndInsert == PWND_TOP) { 01491 01492 /* 01493 * We are at the top of the list. 01494 */ 01495 LinkTop: 01496 #if DBG 01497 /* 01498 * If the first child is topmost, so must be pwnd, but only for top-level windows. 01499 * 01500 * IME or IME related windows are the exceptions, because ImeSetTopmost() and its fellow 01501 * do most of the relinking by its own: when LinkWindow() is called, it's possible TOPMOST flags 01502 * are left in intermediate state. By the time the all window relinking finishes, TOPMOST 01503 * flags have been taken care of and they are just fine. 01504 */ 01505 if (pwndParent == PWNDDESKTOP(pwndParent) && 01506 pwndParent->spwndChild && 01507 FSwpTopmost(pwndParent->spwndChild) && 01508 pwndParent != PWNDMESSAGE(pwndParent) && 01509 // Check if the target is IME related window 01510 !TestCF(pwnd, CFIME) && pwnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME]) { 01511 01512 /* 01513 * There are few cases that cause the z-ordering code to leave the WFTOGGLETOPMOST bit set. 01514 * One is when SWP_NOOWNERZORDER is used when changing the topmost state of a window; 01515 * in this case, ZOrderByOwner2 doesn't add ownees to the psmwp list, still SetTopMost 01516 * sets the bit on all the ownees. 01517 * Another case is when SetWindowPos gets re-entered on the same window. 01518 * It's too late to attempt to fix this ancient behavior (2/24/99) so let's turn off 01519 * the assert for now. 01520 */ 01521 if (!FSwpTopmost(pwnd)) { 01522 RIPMSG1(RIP_WARNING, "LinkWindow pwnd:%p is not FSwpTopmost", pwnd); 01523 } 01524 } 01525 #endif 01526 01527 Lock(&pwnd->spwndNext, pwndParent->spwndChild); 01528 Lock(&(pwndParent->spwndChild), pwnd); 01529 } else { 01530 if (pwndInsert == PWND_BOTTOM) { 01531 01532 /* 01533 * Find bottom-most window. 01534 */ 01535 if (((pwndInsert = pwndParent->spwndChild) == NULL) || 01536 TestWF(pwndInsert, WFBOTTOMMOST)) 01537 goto LinkTop; 01538 01539 /* 01540 * Since we know (ahem) that there's only one bottommost window, 01541 * we can't possibly insert after it. Either we're inserting 01542 * the bottomost window, in which case it's not in the linked 01543 * list currently, or we're inserting some other window. 01544 */ 01545 01546 while (pwndInsert->spwndNext != NULL) { 01547 if (TestWF(pwndInsert->spwndNext, WFBOTTOMMOST)) { 01548 #if DBG 01549 UserAssert(pwnd != pwndInsert->spwndNext); 01550 if (TestWF(pwnd, WFBOTTOMMOST)) 01551 UserAssert(FALSE); 01552 #endif 01553 break; 01554 } 01555 01556 pwndInsert = pwndInsert->spwndNext; 01557 } 01558 } 01559 01560 UserAssert(pwnd != pwndInsert); 01561 UserAssert(pwnd != pwndInsert->spwndNext); 01562 UserAssert(!TestWF(pwndInsert, WFDESTROYED)); 01563 UserAssert(!TestWF(pwnd, WEFTOPMOST) || TestWF(pwndInsert, WEFTOPMOST) || TestWF(pwnd, WFTOGGLETOPMOST) || (pwndParent != PWNDDESKTOP(pwndInsert))); 01564 UserAssert(pwnd->spwndParent == pwndInsert->spwndParent); 01565 01566 Lock(&pwnd->spwndNext, pwndInsert->spwndNext); 01567 Lock(&pwndInsert->spwndNext, pwnd); 01568 } 01569 01570 if (TestWF(pwnd, WEFLAYERED)) 01571 TrackLayeredZorder(pwnd); 01572 01573 #if DBG 01574 VerifyWindowLink (pwnd, pwndParent, TRUE); 01575 #endif 01576 01577 }

__inline VOID LockCaptureWindow PQ  pq,
PWND  pwnd
 

Definition at line 7267 of file userk.h.

Referenced by xxxCapture(), and zzzAttachToQueue().

07268 { 07269 ExReleaseResource(gpresDeviceInfoList); 07270 KeLeaveCriticalRegion(); 07271 } 07272 #endif 07273 07274 /* 07275 * Keep some capture state visible from user-mode for performance. 07276 */

PVOID LockDesktopMenu PMENU ppmenu,
PMENU  pmenu
 

Definition at line 74 of file mnsys.c.

References tagMENU::cItems, HMChangeOwnerProcess, Lock, MFDESKTOP, NULL, PtiCurrent, tagMENU::rgItems, SetMF, tagITEM::spSubMenu, and UINT.

Referenced by xxxGetScrollMenu(), and xxxLoadSysDesktopMenu().

00075 { 00076 PMENU pSubMenu; 00077 PTHREADINFO ptiDesktop; 00078 /* 00079 * We only load desktop sys menus once. 00080 */ 00081 UserAssert(*ppmenu == NULL); 00082 00083 if (pmenu == NULL) { 00084 return NULL; 00085 } 00086 00087 SetMF(pmenu, MFDESKTOP); 00088 /* 00089 * This is awful but this is the real owner of this object. We used to set it 00090 * to NULL but that was forcing us to handle the NULL owner all over the place 00091 */ 00092 ptiDesktop = PtiCurrent()->rpdesk->rpwinstaParent->pTerm->ptiDesktop; 00093 HMChangeOwnerProcess(pmenu, ptiDesktop); 00094 00095 pSubMenu = pmenu->rgItems->spSubMenu; 00096 UserAssert(pSubMenu != NULL); 00097 00098 SetMF(pSubMenu, MFDESKTOP); 00099 HMChangeOwnerProcess(pSubMenu, ptiDesktop); 00100 00101 #if DBG 00102 { 00103 /* 00104 * Assert that there are no other submenus that would need to be 00105 * marked as MFDESKTOP. 00106 */ 00107 PITEM pitem; 00108 UINT uItems; 00109 00110 UserAssert(pmenu->cItems == 1); 00111 00112 pitem = pSubMenu->rgItems; 00113 uItems = pSubMenu->cItems; 00114 while (uItems--) { 00115 UserAssert(pitem->spSubMenu == NULL); 00116 pitem++; 00117 } 00118 } 00119 #endif 00120 00121 return Lock(ppmenu, pmenu); 00122 }

__inline void LockMenuState PMENUSTATE  pMenuState  ) 
 

Definition at line 4873 of file userk.h.

References BOOL, and PMENUSTATE.

Referenced by xxxMenuWindowProc(), xxxMNDragLeave(), and xxxMNDragOver().

04884 {

void LockMFMWFPWindow PULONG_PTR  puHitArea,
ULONG_PTR  uNewHitArea
 

Definition at line 3097 of file ntuser/kernel/menu.c.

References IsMFMWFPWindow(), Lock, and UnlockMFMWFPWindow().

Referenced by xxxHandleMenuMessages(), and xxxMNUpdateDraggingInfo().

03098 { 03099 /* 03100 * Bail if there is nothing to do. 03101 */ 03102 if (*puHitArea == uNewHitArea) { 03103 return; 03104 } 03105 03106 /* 03107 * Unlock current hit area 03108 */ 03109 UnlockMFMWFPWindow(puHitArea); 03110 03111 /* 03112 * Lock new hit area 03113 */ 03114 if (IsMFMWFPWindow(uNewHitArea)) { 03115 Lock(puHitArea, (PWND)uNewHitArea); 03116 } else { 03117 *puHitArea = uNewHitArea; 03118 } 03119 }

VOID LockObjectAssignment PVOID *  ,
PVOID 
 

Definition at line 368 of file ex.c.

References ExDesktopObjectType, FALSE, LogDesktop, NULL, ObDereferenceObject, OBJECT_TO_OBJECT_HEADER, ObReferenceObject, TRUE, and VOID().

00376 { 00377 PVOID pobjectOld; 00378 00379 /* 00380 * Save old object to dereference AFTER the new object is 00381 * referenced. This will avoid problems with relocking 00382 * the same object. 00383 */ 00384 pobjectOld = *pplock; 00385 00386 /* 00387 * Reference the new object. 00388 */ 00389 if (pobject != NULL) { 00390 ObReferenceObject(pobject); 00391 #ifdef LOGDESKTOPLOCKS 00392 if (OBJECT_TO_OBJECT_HEADER(pobject)->Type == *ExDesktopObjectType) { 00393 LogDesktop(pobject, tag, TRUE, extra); 00394 } 00395 #endif 00396 } 00397 *pplock = pobject; 00398 00399 /* 00400 * Dereference the old object 00401 */ 00402 if (pobjectOld != NULL) { 00403 #ifdef LOGDESKTOPLOCKS 00404 if (OBJECT_TO_OBJECT_HEADER(pobjectOld)->Type == *ExDesktopObjectType) { 00405 LogDesktop(pobjectOld, tag, FALSE, extra); 00406 } 00407 #endif 00408 ObDereferenceObject(pobjectOld); 00409 } 00410 }

PVOID LockPopupMenu PPOPUPMENU  ppopup,
PMENU pspmenu,
PMENU  pmenu
 

Definition at line 296 of file ntuser/kernel/menu.c.

References tagWND::head, Lock, NULL, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagMENU::spwndNotify, tagPOPUPMENU::spwndNotify, UnlockPopupMenuWindow(), and Validateppopupmenu.

Referenced by xxxMenuWindowProc(), xxxMNKeyDown(), xxxMNOpenHierarchy(), xxxMNStartMenu(), and xxxTrackPopupMenuEx().

00297 { 00298 /* 00299 * If you hit this assertion, you're probably not passing the right thing 00300 */ 00301 UserAssert((pspmenu == &ppopup->spmenu) || (pspmenu == &ppopup->spmenuAlternate)); 00302 Validateppopupmenu(ppopup); 00303 /* 00304 * This won't work properly if the popup hasn't locked the notification 00305 * window. 00306 */ 00307 UserAssert(ppopup->spwndNotify != NULL); 00308 00309 /* 00310 * When using modeless menus, menus can be shared by several active popups. 00311 * If the menu has owner draw items, the app better knows how to draw them 00312 * correctly. This shouldn't happen with modal menus though 00313 */ 00314 #if DBG 00315 if ((*pspmenu != NULL) 00316 && ((*pspmenu)->spwndNotify != NULL) 00317 && ((*pspmenu)->spwndNotify != ppopup->spwndNotify)) { 00318 00319 RIPMSG3(RIP_WARNING, "LockPopupMenu: Current Menu %#p shared by %#p and %#p", 00320 *pspmenu, (*pspmenu)->spwndNotify, ppopup->spwndNotify); 00321 } 00322 #endif 00323 00324 /* 00325 * Unlock the current's menu spwndNotify if needed 00326 */ 00327 UnlockPopupMenuWindow(*pspmenu, ppopup->spwndNotify); 00328 00329 /* 00330 * Lock the notification window into the menu structure 00331 */ 00332 if (pmenu != NULL) { 00333 00334 /* 00335 * Display a warning if this menu is being shared 00336 */ 00337 #if DBG 00338 if ((pmenu->spwndNotify != NULL) 00339 && (pmenu->spwndNotify != ppopup->spwndNotify) 00340 && (pmenu != pmenu->spwndNotify->head.rpdesk->spmenuDialogSys)) { 00341 00342 RIPMSG3(RIP_WARNING, "LockPopupMenu: New Menu %#p shared by %#p and %#p", 00343 pmenu, pmenu->spwndNotify, ppopup->spwndNotify); 00344 } 00345 #endif 00346 00347 /* 00348 * spwndNotify "owns" this menu now. 00349 */ 00350 Lock(&pmenu->spwndNotify, ppopup->spwndNotify); 00351 } 00352 00353 /* 00354 * Lock the menu into the popup structure (unlock the previous one) 00355 */ 00356 return Lock(pspmenu, pmenu); 00357 }

NTSTATUS __inline LockProcessByClientId HANDLE  dwProcessId,
PEPROCESS ppEProcess
 

Definition at line 4503 of file userk.h.

References CheckCritOut, NTSTATUS(), and Status.

Referenced by CheckAllowForeground(), UserSetConsoleProcessWindowStation(), xxxActivateDebugger(), xxxAllowSetForegroundWindow(), xxxUserNotifyConsoleApplication(), xxxUserNotifyProcessCreate(), and xxxWaitForInputIdle().

04514 { 04515 NTSTATUS Status; 04516

NTSTATUS __inline LockThreadByClientId HANDLE  dwThreadId,
PETHREAD ppEThread
 

Definition at line 4518 of file userk.h.

References gSessionId, and Status.

Referenced by PtiFromThreadId(), TerminateConsole(), and xxxUserNotifyProcessCreate().

04521 { 04522 UnlockProcess(*ppEProcess); 04523 return STATUS_UNSUCCESSFUL; 04524 } 04525 return Status; 04526 } 04527 04528 NTSTATUS __inline LockThreadByClientId(HANDLE dwThreadId, PETHREAD* ppEThread) 04529 {

BOOL LockWindowUpdate2 PWND  pwndLock,
BOOL  fThreadOverride
 

Definition at line 802 of file spb.c.

References BEGINATOMICCHECK, BOOL, CreateSpb(), DeferWinEventNotify, ENDATOMICCHECK, FALSE, tagSPB::flags, FreeSpb(), ghrgnSPB1, gpDispInfo, gptiLockUpdate, gspwndLockUpdate, tagDISPLAYINFO::hDev, tagSPB::hrgn, HRGN_FULL, IDC_DEFAULT, IsWinEventNotifyDeferredOK, Lock, NULL, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, PtiCurrent, PUDF_LOCKFULLSCREEN, PWNDDESKTOP, tagSPB::rc, SetRectRgnIndirect(), SPB_LOCKUPDATE, SpbCheck(), SpbCheckPwnd(), SubtractRgn, TEST_PUDF, TRUE, Unlock, xxxInternalInvalidate(), zzzEndDeferWinEventNotify, and zzzInvalidateDCCache().

Referenced by FullScreenCleanup(), NtUserLockWindowUpdate(), xxxMakeWindowForegroundWithState(), xxxMS_TrackMove(), xxxProcessEventMessage(), and xxxSetForegroundWindow2().

00805 { 00806 PSPB pspb; 00807 BOOL fInval; 00808 HRGN hrgn; 00809 PTHREADINFO ptiCurrent = PtiCurrent(); 00810 00811 if ( /* 00812 * If we're full screen right now, fail this call. 00813 */ 00814 TEST_PUDF(PUDF_LOCKFULLSCREEN) 00815 00816 || 00817 00818 /* 00819 * If the screen is already locked, and it's being locked 00820 * by some other app, then fail. If fThreadOverride is set 00821 * then we're calling internally and it's okay to cancel 00822 * someone elses LockUpdate. 00823 */ 00824 ( gptiLockUpdate != NULL && 00825 gptiLockUpdate != PtiCurrent() && 00826 !fThreadOverride)) { 00827 UserAssert(IsWinEventNotifyDeferredOK()); 00828 00829 RIPERR0(ERROR_SCREEN_ALREADY_LOCKED, 00830 RIP_WARNING, 00831 "LockWindowUpdate failed because screen is locked by another application."); 00832 00833 return FALSE; 00834 } 00835 00836 if ((pwndLock != NULL) == (gptiLockUpdate != NULL)) { 00837 if (!fThreadOverride) { 00838 RIPERR1(ERROR_INVALID_PARAMETER, 00839 RIP_WARNING, 00840 "LockWindowUpdate failed because it is already %s.", 00841 (pwndLock != NULL) ? "locked" : "unlocked"); 00842 } 00843 00844 return FALSE; 00845 } 00846 00847 /* 00848 * This must be done while holding the screen critsec. 00849 * Deadlock if we callback during this, so defer WinEvent notifications 00850 */ 00851 DeferWinEventNotify(); 00852 GreLockDisplay(gpDispInfo->hDev); 00853 00854 if (pwndLock != NULL) { 00855 /* 00856 * We're about to make pwndLock and its siblings invisible: 00857 * go invalidate any other affected SPBs. 00858 */ 00859 SpbCheckPwnd(pwndLock); 00860 00861 CreateSpb(pwndLock, SPB_LOCKUPDATE, NULL); 00862 00863 Lock(&(gspwndLockUpdate), pwndLock); 00864 gptiLockUpdate = ptiCurrent; 00865 00866 zzzInvalidateDCCache(pwndLock, IDC_DEFAULT); 00867 00868 } else { 00869 /* 00870 * Flush any accumulated rectangles and invalidate spbs. 00871 */ 00872 SpbCheck(); 00873 00874 /* 00875 * Save this in a local before we set it to NULL 00876 */ 00877 pwndLock = gspwndLockUpdate; 00878 00879 gptiLockUpdate = NULL; 00880 Unlock(&gspwndLockUpdate); 00881 00882 zzzInvalidateDCCache(pwndLock, IDC_DEFAULT); 00883 00884 /* 00885 * Assume SPB doesn't exist, or couldn't be created, and that we 00886 * must invalidate the entire window. 00887 */ 00888 fInval = TRUE; 00889 hrgn = HRGN_FULL; 00890 00891 /* 00892 * Find the LOCKUPDATE spb in the list, and if present calculate 00893 * the area that has been invalidated, if any. 00894 */ 00895 for (pspb = gpDispInfo->pspbFirst; pspb != NULL; pspb = pspb->pspbNext) { 00896 00897 if (pspb->flags & SPB_LOCKUPDATE) { 00898 00899 if (pspb->hrgn == NULL) { 00900 00901 /* 00902 * If no invalid area, then no invalidation needed. 00903 */ 00904 fInval = FALSE; 00905 00906 } else { 00907 00908 /* 00909 * Subtract SPB valid region from SPB rectangle, to 00910 * yield invalid region. 00911 */ 00912 hrgn = ghrgnSPB1; 00913 SetRectRgnIndirect(hrgn, &pspb->rc); 00914 00915 /* 00916 * If spb rect minus the spb valid rgn is empty, 00917 * then there is nothing to invalidate. 00918 */ 00919 fInval = SubtractRgn(hrgn, hrgn, pspb->hrgn) != NULLREGION; 00920 } 00921 00922 FreeSpb(pspb); 00923 00924 /* 00925 * Exit this loop (there can be only one LOCKUPDATE spb) 00926 */ 00927 break; 00928 } 00929 } 00930 00931 if (fInval) { 00932 BEGINATOMICCHECK(); 00933 // want to prevent WinEvent notifies, but this make break asserts 00934 DeferWinEventNotify(); 00935 xxxInternalInvalidate(PWNDDESKTOP(pwndLock), 00936 hrgn, 00937 RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN); 00938 zzzEndDeferWinEventNotify(); 00939 ENDATOMICCHECK(); 00940 } 00941 00942 /* 00943 * Invalidate any other SPBs affected by the fact that this window 00944 * and its children are being made visible. 00945 */ 00946 SpbCheckPwnd(pwndLock); 00947 } 00948 00949 GreUnlockDisplay(gpDispInfo->hDev); 00950 zzzEndDeferWinEventNotify(); 00951 00952 return TRUE; 00953 }

PVOID LockWndMenu PWND  pwnd,
PMENU pspmenu,
PMENU  pmenu
 

Definition at line 422 of file ntuser/kernel/menu.c.

References Lock, NULL, tagWND::spmenu, tagWND::spmenuSys, tagMENU::spwndNotify, and Unlock.

Referenced by xxxCreateWindowEx(), xxxGetSystemMenu(), xxxSetDialogSystemMenu(), xxxSetMenu(), xxxSetSystemMenu(), and xxxSetWindowData().

00423 { 00424 /* 00425 * If you hit this assertion, you're probably not passing the right thing 00426 */ 00427 UserAssert((pspmenu == &pwnd->spmenu) || (pspmenu == &pwnd->spmenuSys)); 00428 00429 /* 00430 * If the current menu is owned by this window, unlock it 00431 */ 00432 if ((*pspmenu != NULL) && ((*pspmenu)->spwndNotify == pwnd)) { 00433 Unlock(&((*pspmenu)->spwndNotify)); 00434 } 00435 00436 /* 00437 * If nobody owns the new menu, make this window the owner 00438 */ 00439 if ((pmenu != NULL) && (pmenu->spwndNotify == NULL)) { 00440 Lock(&pmenu->spwndNotify, pwnd); 00441 } 00442 00443 /* 00444 * Lock the menu into the window structure (unlock the previous menu) 00445 */ 00446 return Lock(pspmenu, pmenu); 00447 00448 }

PDCE LookupDC HDC  hdc  ) 
 

Definition at line 2123 of file dc.c.

References tagDCE::DCX_flags, gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, and tagDCE::pMonitor.

Referenced by UserGetRedirectedWindowOrigin(), and xxxEnumDisplayMonitors().

02124 { 02125 PDCE pdce; 02126 02127 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 02128 02129 if (pdce->DCX_flags & (DCX_INVALID | DCX_DESTROYTHIS)) 02130 continue; 02131 02132 if (pdce->hdc == hdc && pdce->pMonitor == NULL && 02133 (pdce->DCX_flags & DCX_INUSE)) { 02134 return pdce; 02135 } 02136 } 02137 return NULL; 02138 }

BOOL LW_BrushInit VOID   ) 
 

Definition at line 1820 of file w32/ntuser/kernel/init.c.

References BOOL, FALSE, ghbrBlack, ghbrHungApp, ghbrWhite, gpsi, NULL, and TRUE.

Referenced by RemoteConnect(), and UserInitialize().

01821 { 01822 HBITMAP hbmGray; 01823 CONST static WORD patGray[8] = {0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa}; 01824 01825 /* 01826 * Create a gray brush to be used with GrayString 01827 */ 01828 hbmGray = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)patGray); 01829 01830 if (hbmGray == NULL) { 01831 return FALSE; 01832 } 01833 01834 gpsi->hbrGray = GreCreatePatternBrush(hbmGray); 01835 ghbrWhite = GreGetStockObject(WHITE_BRUSH); 01836 ghbrBlack = GreGetStockObject(BLACK_BRUSH); 01837 01838 UserAssert(ghbrWhite != NULL && ghbrBlack != NULL); 01839 01840 if (gpsi->hbrGray == NULL) { 01841 return FALSE; 01842 } 01843 01844 GreDeleteObject(hbmGray); 01845 GreSetBrushOwnerPublic(gpsi->hbrGray); 01846 ghbrHungApp = GreCreateSolidBrush(0); 01847 01848 if (ghbrHungApp == NULL) { 01849 return FALSE; 01850 } 01851 01852 GreSetBrushOwnerPublic(ghbrHungApp); 01853 01854 return TRUE; 01855 }

VOID LW_LoadProfileInitData  ) 
 

Referenced by xxxInitWindowStation().

VOID LW_LoadSomeStrings VOID   ) 
 

Definition at line 1422 of file w32/ntuser/kernel/init.c.

References gpsi, gszMAX, gszMIN, gszRESDOWN, gszRESUP, gszSCLOSE, hModuleWin, MAX_MB_STRINGS, tagSERVERINFO::MBStrings, ServerLoadString, tagMBSTRING::szName, tagMBSTRING::uID, tagMBSTRING::uStr, and VOID().

Referenced by Win32UserInitialize().

01423 { 01424 int i, str, id; 01425 01426 /* 01427 * MessageBox strings 01428 */ 01429 for (i = 0, str = STR_OK, id = IDOK; i<MAX_MB_STRINGS; i++, str++, id++) { 01430 gpsi->MBStrings[i].uStr = str; 01431 gpsi->MBStrings[i].uID = id; 01432 ServerLoadString(hModuleWin, str, gpsi->MBStrings[i].szName, sizeof(gpsi->MBStrings[i].szName) / sizeof(WCHAR)); 01433 } 01434 01435 /* 01436 * Tooltips strings 01437 */ 01438 ServerLoadString(hModuleWin, STR_MIN, gszMIN, sizeof(gszMIN) / sizeof(WCHAR)); 01439 ServerLoadString(hModuleWin, STR_MAX, gszMAX, sizeof(gszMAX) / sizeof(WCHAR)); 01440 ServerLoadString(hModuleWin, STR_RESUP, gszRESUP, sizeof(gszRESUP) / sizeof(WCHAR)); 01441 ServerLoadString(hModuleWin, STR_RESDOWN,gszRESDOWN,sizeof(gszRESDOWN)/ sizeof(WCHAR)); 01442 /* Commented out due to TandyT ... 01443 * ServerLoadString(hModuleWin, STR_SMENU, gszSMENU, sizeof(gszSMENU) / sizeof(WCHAR)); 01444 */ 01445 ServerLoadString(hModuleWin, STR_SCLOSE, gszSCLOSE, sizeof(gszSCLOSE) / sizeof(WCHAR)); 01446 }

BOOL LW_RegisterWindows BOOL  fSystem  ) 
 

Definition at line 1863 of file w32/ntuser/kernel/init.c.

References BOOL, CCLASSES, CSF_SERVERSIDEPROC, CSF_SYSTEMCLASS, CSF_WIN40COMPAT, DESKTOPCLASS, DESKWND, FALSE, FNID_DESKTOP, FNID_ICONTITLE, FNID_MENU, FNID_SCROLLBAR, FNID_SWITCH, FNID_TOOLTIP, hModuleWin, ICONTITLECLASS, InternalRegisterClassEx(), L, MENUCLASS, NULL, PtoH, SBWND, SWITCHWND, SWITCHWNDCLASS, SYSCUR, TOOLTIPCLASS, TOOLTIPWND, TRUE, UINT, xxxDefWindowProc(), xxxDesktopWndProc(), xxxEventWndProc(), xxxMenuWindowProc(), xxxSBWndProc(), xxxSwitchWndProc(), and xxxTooltipWndProc().

Referenced by xxxCreateThreadInfo().

01865 { 01866 #ifdef HUNGAPP_GHOSTING 01867 #define CCLASSES 9 01868 #else // HUNGAPP_GHOSTING 01869 #define CCLASSES 8 01870 #endif // HUNGAPP_GHOSTING 01871 01872 int i; 01873 WNDCLASSEX wndcls; 01874 01875 CONST static struct { 01876 BOOLEAN fSystem; 01877 BOOLEAN fGlobalClass; 01878 WORD fnid; 01879 UINT style; 01880 WNDPROC lpfnWndProc; 01881 int cbWndExtra; 01882 BOOL fNormalCursor : 1; 01883 HBRUSH hbrBackground; 01884 LPCTSTR lpszClassName; 01885 } rc[CCLASSES] = { 01886 { TRUE, TRUE, FNID_DESKTOP, 01887 CS_DBLCLKS, 01888 (WNDPROC)xxxDesktopWndProc, 01889 sizeof(DESKWND) - sizeof(WND), 01890 TRUE, 01891 (HBRUSH)(COLOR_BACKGROUND + 1), 01892 DESKTOPCLASS}, 01893 { TRUE, FALSE, FNID_SWITCH, 01894 CS_VREDRAW | CS_HREDRAW | CS_SAVEBITS, 01895 (WNDPROC)xxxSwitchWndProc, 01896 sizeof(SWITCHWND) - sizeof(WND), 01897 TRUE, 01898 NULL, 01899 SWITCHWNDCLASS}, 01900 { TRUE, FALSE, FNID_MENU, 01901 CS_DBLCLKS | CS_SAVEBITS, 01902 (WNDPROC)xxxMenuWindowProc, 01903 sizeof(PPOPUPMENU), 01904 FALSE, 01905 (HBRUSH)(COLOR_MENU + 1), 01906 MENUCLASS}, 01907 { FALSE, FALSE, FNID_SCROLLBAR, 01908 CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS | CS_PARENTDC, 01909 (WNDPROC)xxxSBWndProc, 01910 sizeof(SBWND) - sizeof(WND), 01911 TRUE, 01912 NULL, 01913 L"ScrollBar"}, 01914 { TRUE, FALSE, FNID_TOOLTIP, 01915 CS_DBLCLKS | CS_SAVEBITS, 01916 (WNDPROC)xxxTooltipWndProc, 01917 sizeof(TOOLTIPWND) - sizeof(WND), 01918 TRUE, 01919 NULL, 01920 TOOLTIPCLASS}, 01921 { TRUE, TRUE, FNID_ICONTITLE, 01922 0, 01923 (WNDPROC)xxxDefWindowProc, 01924 0, 01925 TRUE, 01926 NULL, 01927 ICONTITLECLASS}, 01928 { FALSE, FALSE, 0, 01929 0, 01930 (WNDPROC)xxxEventWndProc, 01931 sizeof(PSVR_INSTANCE_INFO), 01932 FALSE, 01933 NULL, 01934 L"DDEMLEvent"}, 01935 #ifdef HUNGAPP_GHOSTING 01936 { TRUE, TRUE, 0, 01937 0, 01938 (WNDPROC)xxxGhostWndProc, 01939 0, 01940 TRUE, 01941 NULL, 01942 L"Ghost"}, 01943 #endif // HUNGAPP_GHOSTING 01944 { TRUE, TRUE, 0, 01945 0, 01946 (WNDPROC)xxxDefWindowProc, 01947 4, 01948 TRUE, 01949 NULL, 01950 L"Message"} 01951 }; 01952 01953 01954 /* 01955 * All other classes are registered via the table. 01956 */ 01957 wndcls.cbClsExtra = 0; 01958 wndcls.hInstance = hModuleWin; 01959 wndcls.hIcon = NULL; 01960 wndcls.hIconSm = NULL; 01961 wndcls.lpszMenuName = NULL; 01962 01963 for (i = 0; i < CCLASSES; i++) { 01964 if (fSystem && !rc[i].fSystem) { 01965 continue; 01966 } 01967 wndcls.style = rc[i].style; 01968 wndcls.lpfnWndProc = rc[i].lpfnWndProc; 01969 wndcls.cbWndExtra = rc[i].cbWndExtra; 01970 wndcls.hCursor = rc[i].fNormalCursor ? PtoH(SYSCUR(ARROW)) : NULL; 01971 wndcls.hbrBackground= rc[i].hbrBackground; 01972 wndcls.lpszClassName= rc[i].lpszClassName; 01973 01974 if (InternalRegisterClassEx(&wndcls, 01975 rc[i].fnid, 01976 CSF_SERVERSIDEPROC | CSF_WIN40COMPAT) == NULL) { 01977 RIPMSG0(RIP_WARNING, "LW_RegisterWindows: InternalRegisterClassEx failed"); 01978 return FALSE; 01979 } 01980 01981 if (fSystem && rc[i].fGlobalClass) { 01982 if (InternalRegisterClassEx(&wndcls, 01983 rc[i].fnid, 01984 CSF_SERVERSIDEPROC | CSF_SYSTEMCLASS | CSF_WIN40COMPAT) == NULL) { 01985 01986 RIPMSG0(RIP_WARNING, "LW_RegisterWindows: InternalRegisterClassEx failed"); 01987 return FALSE; 01988 } 01989 } 01990 } 01991 return TRUE; 01992 }

PMENU MakeMenuRtoL PMENU  pMenu,
BOOL  bRtoL
 

Definition at line 995 of file mncomput.c.

References tagMENU::cItems, ClearMF, ClearMFT, MFRTL, tagMENU::rgItems, SetMF, SetMFT, and tagITEM::spSubMenu.

Referenced by xxxInsertMenuItem(), and xxxSetMenuItemInfo().

00996 { 00997 PITEM pItem; 00998 int cItem; 00999 01000 if (bRtoL) 01001 SetMF(pMenu,MFRTL); 01002 else 01003 ClearMF(pMenu,MFRTL); 01004 01005 for (cItem = 0; cItem < (int)pMenu->cItems; cItem++) { 01006 pItem = pMenu->rgItems + cItem; 01007 if (bRtoL) { 01008 SetMFT(pItem, MFT_RIGHTJUSTIFY); 01009 SetMFT(pItem, MFT_RIGHTORDER); 01010 } else { 01011 ClearMFT(pItem, MFT_RIGHTJUSTIFY); 01012 ClearMFT(pItem, MFT_RIGHTORDER); 01013 } 01014 if (pItem->spSubMenu) 01015 MakeMenuRtoL(pItem->spSubMenu, bRtoL); 01016 } 01017 return pMenu; 01018 }

ULONG_PTR MapClientToServerPfn ULONG_PTR  dw  ) 
 

Definition at line 978 of file ntuser/kernel/getset.c.

References tagSERVERINFO::apfnClientA, tagSERVERINFO::apfnClientW, FNID_WNDPROCEND, FNID_WNDPROCSTART, gpsi, and STOCID.

Referenced by InternalRegisterClassEx(), xxxSetClassData(), and xxxSetWindowData().

00980 { 00981 ULONG_PTR *pdw; 00982 int i; 00983 00984 pdw = (ULONG_PTR *)&gpsi->apfnClientW; 00985 for (i = FNID_WNDPROCSTART; i <= FNID_WNDPROCEND; i++, pdw++) { 00986 if (*pdw == dw) 00987 return (ULONG_PTR)STOCID(i); 00988 } 00989 00990 pdw = (ULONG_PTR *)&gpsi->apfnClientA; 00991 for (i = FNID_WNDPROCSTART; i <= FNID_WNDPROCEND; i++, pdw++) { 00992 if (*pdw == dw) 00993 return (ULONG_PTR)STOCID(i); 00994 } 00995 00996 return 0; 00997 }

VOID MapDesktop IN OB_OPEN_REASON  OpenReason,
IN PEPROCESS Process  OPTIONAL,
IN PVOID  Object,
IN ACCESS_MASK  GrantedAccess,
IN ULONG  HandleCount
 

Referenced by UserCommitDesktopMemory(), xxxCreateDesktop(), xxxResolveDesktop(), and xxxSetThreadDesktop().

__inline VOID MarkDCEInvalid PDCE  pdce  ) 
 

Definition at line 5695 of file userk.h.

References BOOL, and VOID().

Referenced by InvalidateDce(), and xxxFreeWindow().

05706 {

VOID MarkThreadsObjects PTHREADINFO  pti  ) 
 

Definition at line 2595 of file handtabl.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bFlags, tagHANDLETYPEINFO::bObjectCreateFlags, _HANDLEENTRY::bType, gahti, giheLast, gptiRit, gSharedInfo, gTermIO, _HEAD::h, HANDLEF_DESTROY, HMChangeOwnerThread(), ISTS, OCF_PROCESSOWNED, _HANDLEENTRY::phead, _HANDLEENTRY::pOwner, tagTERMINAL::ptiDesktop, ShowLocks(), and TYPE_FREE.

Referenced by xxxDestroyThreadInfo().

02597 { 02598 PHE pheT, pheMax; 02599 02600 pheMax = &gSharedInfo.aheList[giheLast]; 02601 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 02602 /* 02603 * Check against free before we look at pti... because pti is stored 02604 * in the object itself, which won't be there if TYPE_FREE. 02605 */ 02606 if (pheT->bType == TYPE_FREE) 02607 continue; 02608 02609 /* 02610 * Change ownership! 02611 */ 02612 if (gahti[pheT->bType].bObjectCreateFlags & OCF_PROCESSOWNED || 02613 (PTHREADINFO)pheT->pOwner != pti) 02614 continue; 02615 02616 #if DBG 02617 /* 02618 * This is just to make sure that RIT or DT never get here 02619 */ 02620 if (ISTS() && (pti == gptiRit || pti == gTermIO.ptiDesktop)) { 02621 RIPMSG2(RIP_ERROR, "pti %#p is RIT or DT. phe %#p\n", pti, pheT); 02622 } 02623 #endif 02624 02625 HMChangeOwnerThread(pheT->phead, gptiRit); 02626 02627 #if DEBUGTAGS 02628 02629 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 02630 /* 02631 * Object still around: print warning message. 02632 */ 02633 if (pheT->bFlags & HANDLEF_DESTROY) { 02634 TAGMSG2(DBGTAG_TrackLocks, 02635 "Zombie %s %#p still locked", 02636 gahti[pheT->bType].szObjectType, pheT->phead->h); 02637 } else { 02638 TAGMSG1(DBGTAG_TrackLocks, 02639 "Thread object %#p not destroyed.\n", 02640 pheT->phead->h); 02641 } 02642 02643 ShowLocks(pheT); 02644 } 02645 02646 #endif // DEBUGTAGS 02647 } 02648 }

void MenuRecalc void   ) 
 

Definition at line 20 of file metrics.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bType, tagMENU::cItems, tagITEM::cxBmp, tagMENU::cxMenu, tagMENU::cyMenu, DWORD, giheLast, gSharedInfo, MNIS_MEASUREBMP, _HANDLEENTRY::phead, tagMENU::rgItems, TYPE_MENU, UINT, tagITEM::ulWidth, tagITEM::ulX, and UNDERLINE_RECALC.

Referenced by xxxSetAndDrawNCMetrics().

00021 { 00022 PMENU lpMenu; 00023 UINT iItem; 00024 PHE pheT; 00025 DWORD i; 00026 00027 /* 00028 * for (ppi = gppiFirst; ppi; ppi = ppi->ppiNext) 00029 * { 00030 * for (pMenu = ppi->lpMenus; TESTFAR(lpMenu); lpMenu = lpMenu->lpMenuNext) 00031 * { 00032 * 00033 * That was the Chicao way of walking the objects. In NT, we 00034 * walk the handle table. 00035 */ 00036 for (pheT = gSharedInfo.aheList, i = 0; i <= giheLast; i++, pheT++) { 00037 00038 if (pheT->bType == TYPE_MENU) { 00039 /* 00040 * Get a pointer to the menu. 00041 */ 00042 lpMenu = (PMENU)pheT->phead; 00043 00044 /* 00045 * Set menu size to 0 so it recalculates later when we go to 00046 * draw it again. 00047 */ 00048 lpMenu->cxMenu = 0; 00049 lpMenu->cyMenu = 0; 00050 00051 /* 00052 * Reset mnemonic underline info 00053 */ 00054 for (iItem = 0; iItem < lpMenu->cItems; iItem++) { 00055 lpMenu->rgItems[iItem].ulX = UNDERLINE_RECALC; 00056 lpMenu->rgItems[iItem].ulWidth = 0; 00057 lpMenu->rgItems[iItem].cxBmp = MNIS_MEASUREBMP; 00058 } 00059 } 00060 } 00061 }

BOOL MinToTray PWND  pwnd  ) 
 

PPOPUPMENU MNAllocPopup BOOL  fForceAlloc  ) 
 

Definition at line 143 of file mnstate.c.

References gpopupMenu, PUDF_POPUPINUSE, SET_PUDF, and TEST_PUDF.

Referenced by xxxMenuWindowProc(), and xxxMNStartMenuState().

00144 { 00145 PPOPUPMENU ppm; 00146 if (!fForceAlloc && !TEST_PUDF(PUDF_POPUPINUSE)) { 00147 SET_PUDF(PUDF_POPUPINUSE); 00148 00149 ppm = &gpopupMenu; 00150 } else { 00151 ppm = (PPOPUPMENU)UserAllocPoolWithQuota(sizeof(POPUPMENU), TAG_POPUPMENU); 00152 } 00153 00154 if (ppm) { 00155 RtlZeroMemory(ppm, sizeof(POPUPMENU)); 00156 } 00157 00158 return (ppm); 00159 }

void MNAnimate PMENUSTATE  pMenuState,
BOOL  fIterate
 

Definition at line 290 of file mndraw.c.

References _KillTimer(), _ReleaseDC(), CMS_QANIMATION, tagMENUSTATE::cxAni, tagMENUSTATE::cyAni, tagMENUSTATE::dwAniStartTime, DWORD, ExGetExclusiveWaiterCount(), ExGetSharedWaiterCount(), FADE_MENU, gcxMenuFontChar, gcyMenuFontChar, gpresUser, tagMENUSTATE::hdcWndAni, tagMENUSTATE::iAniDropDir, IDSYS_MNANIMATE, tagMENUSTATE::ixAni, tagMENUSTATE::iyAni, MNDestroyAnimationBitmap(), MultDiv, NtGetTickCount(), NULL, PAS_HORZ, PAS_LEFT, PAS_UP, PAS_VERT, tagMENUSTATE::pGlobalPopupMenu, tagPOPUPMENU::spwndActivePopup, StopFade(), TestFadeFlags(), TestWF, and WFVISIBLE.

Referenced by MNGetPopupFromMenu(), xxxMenuWindowProc(), xxxMNCloseHierarchy(), xxxMNSelectItem(), and xxxTrackPopupMenuEx().

00291 { 00292 DWORD dwTimeElapsed; 00293 int x, y, xOff, yOff, xLast, yLast; 00294 00295 if (TestFadeFlags(FADE_MENU)) { 00296 if (!fIterate) { 00297 StopFade(); 00298 } 00299 return; 00300 } 00301 00302 /* 00303 * If we're not animating, bail 00304 */ 00305 if (pMenuState->hdcWndAni == NULL) { 00306 return; 00307 } 00308 00309 /* 00310 * The active popup must be visible. It's supposed to be the 00311 * window we're animating 00312 */ 00313 UserAssert(TestWF(pMenuState->pGlobalPopupMenu->spwndActivePopup, WFVISIBLE)); 00314 00315 /* 00316 * End animation if asked to do so, if it's taking too long 00317 * or someone is waiting for the critical section 00318 */ 00319 dwTimeElapsed = NtGetTickCount() - pMenuState->dwAniStartTime; 00320 if (!fIterate 00321 || (dwTimeElapsed > CMS_QANIMATION) 00322 || (ExGetExclusiveWaiterCount(gpresUser) > 0) 00323 || (ExGetSharedWaiterCount(gpresUser) > 0)) { 00324 00325 GreBitBlt(pMenuState->hdcWndAni, 0, 0, pMenuState->cxAni, pMenuState->cyAni, pMenuState->hdcAni, 00326 0, 0, SRCCOPY | NOMIRRORBITMAP, 0xFFFFFF); 00327 00328 goto AnimationCompleted; 00329 } 00330 00331 /* 00332 * Remember current animation point and calculate new one 00333 */ 00334 xLast = pMenuState->ixAni; 00335 yLast = pMenuState->iyAni; 00336 if (pMenuState->iAniDropDir & PAS_HORZ) { 00337 pMenuState->ixAni = MultDiv(gcxMenuFontChar, dwTimeElapsed, CMS_QANIMATION / 20); 00338 if (pMenuState->ixAni > pMenuState->cxAni) { 00339 pMenuState->ixAni = pMenuState->cxAni; 00340 } 00341 } 00342 00343 if (pMenuState->iAniDropDir & PAS_VERT) { 00344 pMenuState->iyAni = MultDiv(gcyMenuFontChar, dwTimeElapsed, CMS_QANIMATION / 10); 00345 if (pMenuState->iyAni > pMenuState->cyAni) { 00346 pMenuState->iyAni = pMenuState->cyAni; 00347 } 00348 } 00349 00350 /* 00351 * if no change -- bail out 00352 */ 00353 if ((pMenuState->ixAni == xLast) && (pMenuState->iyAni == yLast)) { 00354 return; 00355 } 00356 00357 /* 00358 * Calculate source and dest coordinates 00359 */ 00360 if (pMenuState->iAniDropDir & PAS_LEFT) { 00361 x = pMenuState->cxAni - pMenuState->ixAni; 00362 xOff = 0; 00363 } else { 00364 xOff = pMenuState->cxAni - pMenuState->ixAni; 00365 x = 0; 00366 } 00367 00368 if (pMenuState->iAniDropDir & PAS_UP) { 00369 y = pMenuState->cyAni - pMenuState->iyAni; 00370 yOff = 0; 00371 } else { 00372 yOff = pMenuState->cyAni - pMenuState->iyAni; 00373 y = 0; 00374 } 00375 00376 /* 00377 * Do it 00378 */ 00379 GreBitBlt(pMenuState->hdcWndAni, x, y, pMenuState->ixAni, pMenuState->iyAni, 00380 pMenuState->hdcAni, xOff, yOff, SRCCOPY | NOMIRRORBITMAP, 0xFFFFFF); 00381 00382 /* 00383 * Check if we're done 00384 */ 00385 if ((pMenuState->cxAni == pMenuState->ixAni) 00386 && (pMenuState->cyAni == pMenuState->iyAni)) { 00387 00388 AnimationCompleted: 00389 00390 MNDestroyAnimationBitmap(pMenuState); 00391 _ReleaseDC(pMenuState->hdcWndAni); 00392 pMenuState->hdcWndAni = NULL; 00393 _KillTimer(pMenuState->pGlobalPopupMenu->spwndActivePopup, IDSYS_MNANIMATE); 00394 } 00395 00396 }

void MNCheckButtonDownState PMENUSTATE  pMenuState  ) 
 

Definition at line 206 of file ntuser/kernel/menu.c.

References _GetKeyState(), FALSE, tagMENUSTATE::fButtonDown, tagMENUSTATE::fDragAndDrop, tagMENUSTATE::fDragging, tagMENUSTATE::fIgnoreButtonUp, tagMENUSTATE::fModelessMenu, tagMENUSTATE::uButtonDownHitArea, UnlockMFMWFPWindow(), and tagMENUSTATE::vkButtonDown.

Referenced by xxxCallHandleMenuMessages(), and xxxMenuWindowProc().

00207 { 00208 /* 00209 * Modeless menus don't capture the mouse so when a mouse down 00210 * goes off the window, we need to keep watching its state. 00211 * We also might not see the button up when going on DoDragDrop loop 00212 */ 00213 UserAssert(pMenuState->fDragAndDrop || pMenuState->fModelessMenu); 00214 pMenuState->fButtonDown = ((_GetKeyState(pMenuState->vkButtonDown) & 0x8000) != 0); 00215 if (!pMenuState->fButtonDown) { 00216 pMenuState->fDragging = 00217 pMenuState->fIgnoreButtonUp = FALSE; 00218 UnlockMFMWFPWindow(&pMenuState->uButtonDownHitArea); 00219 } 00220 }

BOOL MNCreateAnimationBitmap PMENUSTATE  pMenuState,
UINT  cx,
UINT  cy
 

Definition at line 389 of file mnstate.c.

References BOOL, cy, FALSE, gpDispInfo, tagMENUSTATE::hbmAni, tagDISPLAYINFO::hdcScreen, NULL, and TRUE.

Referenced by xxxMenuWindowProc().

00390 { 00391 HBITMAP hbm = GreCreateCompatibleBitmap(gpDispInfo->hdcScreen, cx, cy); 00392 if (hbm == NULL) { 00393 RIPMSG0(RIP_WARNING, "MNSetupAnimationBitmap: Failed to create hbmAni"); 00394 return FALSE; 00395 } 00396 00397 #if DBG 00398 if (pMenuState->hdcAni == NULL) { 00399 RIPMSG0(RIP_WARNING, "MNCreateAnimationBitmap: hdcAni is NULL"); 00400 } 00401 if (pMenuState->hbmAni != NULL) { 00402 RIPMSG0(RIP_WARNING, "MNCreateAnimationBitmap: hbmAni already exists"); 00403 } 00404 #endif 00405 00406 GreSelectBitmap(pMenuState->hdcAni, hbm); 00407 pMenuState->hbmAni = hbm; 00408 return TRUE; 00409 }

void MNDestroyAnimationBitmap PMENUSTATE  pMenuState  ) 
 

Definition at line 414 of file mnstate.c.

References tagMENUSTATE::hbmAni, and NULL.

Referenced by MNAnimate(), and xxxMNEndMenuState().

00415 { 00416 GreSelectBitmap(pMenuState->hdcAni, GreGetStockObject(PRIV_STOCK_BITMAP)); 00417 UserVerify(GreDeleteObject(pMenuState->hbmAni)); 00418 pMenuState->hbmAni = NULL; 00419 }

void MNDrawArrow HDC  hdcIn,
PPOPUPMENU  ppopup,
UINT  uArrow
 

Definition at line 102 of file mndraw.c.

References _GetDCEx(), _ReleaseDC(), BitBltSysBmp(), DrawFrameControl(), tagMENU::dwArrowsOn, DWORD, gcyMenuScrollArrow, gpsi, tagMENU::hbrBack, MFMWFP_UPARROW, MSA_ATBOTTOM, MSA_ATTOP, MSA_OFF, NULL, OBI_MENUARROWDOWN, OBI_MENUARROWUP, OBI_MENUCHECK, tagWND::rcWindow, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndPopupMenu, SYSMET, and TestMF.

Referenced by MNDrawFullNC(), xxxMNInvertItem(), and xxxMNSetTop().

00103 { 00104 PWND pwnd = ppopup->spwndPopupMenu; 00105 HDC hdc; 00106 int x, y; 00107 DWORD dwBmp; 00108 DWORD dwAtCheck; 00109 DWORD dwState; 00110 00111 if (ppopup->spmenu->dwArrowsOn == MSA_OFF) { 00112 return; 00113 } 00114 00115 if (hdcIn == NULL) { 00116 hdc = _GetDCEx(pwnd, NULL, DCX_USESTYLE | DCX_WINDOW | DCX_LOCKWINDOWUPDATE); 00117 } else { 00118 hdc = hdcIn; 00119 } 00120 00121 x = SYSMET(CXFIXEDFRAME); 00122 if (!TestMF(ppopup->spmenu, MNS_NOCHECK)) { 00123 /* 00124 * Win9x: x += MNByteAlignItem(oemInfo.bm[OBI_MENUCHECK].cx); 00125 */ 00126 x += gpsi->oembmi[OBI_MENUCHECK].cx; 00127 } else { 00128 x += SYSMET(CXEDGE) * 2; 00129 } 00130 00131 if (uArrow == MFMWFP_UPARROW) { 00132 y = SYSMET(CXFIXEDFRAME); 00133 dwBmp = OBI_MENUARROWUP; 00134 dwAtCheck = MSA_ATTOP; 00135 dwState = DFCS_MENUARROWUP; 00136 } else { 00137 y = pwnd->rcWindow.bottom - pwnd->rcWindow.top - SYSMET(CYFIXEDFRAME) - gcyMenuScrollArrow; 00138 dwBmp = OBI_MENUARROWDOWN; 00139 dwAtCheck = MSA_ATBOTTOM; 00140 dwState = DFCS_MENUARROWDOWN; 00141 } 00142 00143 if (ppopup->spmenu->dwArrowsOn == dwAtCheck) { 00144 /* 00145 * go 2 ahead to inactive state bitmap 00146 */ 00147 dwBmp += 2; 00148 dwState |= DFCS_INACTIVE; 00149 } 00150 00151 if (ppopup->spmenu->hbrBack != NULL) { 00152 /* 00153 * for menus with background brushes, we can't do a straight blt 00154 * of the scroll arrows 'cause the background wouldn't be right; 00155 * need to call DrawFrameControl with DFCS_TRANSPARENT instead 00156 */ 00157 RECT rc; 00158 rc.top = y; 00159 rc.left = x; 00160 rc.right = x + gpsi->oembmi[OBI_MENUARROWUP].cx; 00161 rc.bottom = y + gpsi->oembmi[OBI_MENUARROWUP].cy; 00162 DrawFrameControl(hdc, &rc, DFC_MENU, dwState | DFCS_TRANSPARENT); 00163 } else { 00164 BitBltSysBmp(hdc, x, y, dwBmp); 00165 BitBltSysBmp(hdc, x, y, dwBmp); 00166 } 00167 00168 if (hdcIn == NULL) { 00169 _ReleaseDC(hdc); 00170 } 00171 }

void MNDrawFullNC PWND  pwnd,
HDC  hdcIn,
PPOPUPMENU  ppopup
 

Definition at line 181 of file mndraw.c.

References _GetDCEx(), _ReleaseDC(), DF_3DFACE, DrawEdge(), DrawFrame(), gcyMenuScrollArrow, tagMENU::hbrBack, InflateRect(), MFMWFP_DOWNARROW, MFMWFP_UPARROW, MNDrawArrow(), MNGetToppItem(), NULL, tagWND::rcWindow, tagPOPUPMENU::spmenu, SYSHBR, SYSMET, and tagITEM::yItem.

Referenced by xxxMenuWindowProc(), and xxxMNSetTop().

00182 { 00183 RECT rc; 00184 HDC hdc; 00185 HBRUSH hbrOld; 00186 int yTop, yBottom; 00187 POINT ptOrg; 00188 if (hdcIn == NULL) { 00189 hdc = _GetDCEx(pwnd, NULL, DCX_USESTYLE | DCX_WINDOW | DCX_LOCKWINDOWUPDATE); 00190 } else { 00191 hdc = hdcIn; 00192 } 00193 00194 rc.left = rc.top = 0; 00195 rc.right = pwnd->rcWindow.right - pwnd->rcWindow.left; 00196 rc.bottom = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 00197 DrawEdge(hdc, &rc, EDGE_RAISED, (BF_RECT | BF_ADJUST)); 00198 DrawFrame(hdc, &rc, 1, DF_3DFACE); 00199 InflateRect(&rc, -SYSMET(CXBORDER), -SYSMET(CYBORDER)); 00200 00201 yTop = rc.top; 00202 yBottom = rc.bottom - gcyMenuScrollArrow; 00203 00204 GreGetBrushOrg(hdc, &ptOrg); 00205 if (ppopup->spmenu->hbrBack != NULL) { 00206 GreSetBrushOrg(hdc, 0, 00207 -(int)MNGetToppItem(ppopup->spmenu)->yItem, NULL); 00208 hbrOld = GreSelectBrush(hdc, ppopup->spmenu->hbrBack); 00209 } else { 00210 hbrOld = GreSelectBrush(hdc, SYSHBR(MENU)); 00211 } 00212 00213 rc.right -= rc.left; 00214 GrePatBlt(hdc, rc.left, yTop, rc.right, gcyMenuScrollArrow, PATCOPY); 00215 MNDrawArrow(hdc, ppopup, MFMWFP_UPARROW); 00216 GrePatBlt(hdc, rc.left, yBottom, rc.right, gcyMenuScrollArrow, PATCOPY); 00217 MNDrawArrow(hdc, ppopup, MFMWFP_DOWNARROW); 00218 00219 GreSetBrushOrg(hdc, ptOrg.x, ptOrg.y, NULL); 00220 GreSelectBrush(hdc, hbrOld); 00221 00222 if (hdcIn == NULL) { 00223 _ReleaseDC(hdc); 00224 } 00225 }

BOOL MNEndMenuStateNotify PMENUSTATE  pMenuState  ) 
 

Definition at line 234 of file mnstate.c.

References BOOL, FALSE, GETPTI, NULL, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagMENUSTATE::pmnsPrev, tagMENUSTATE::ptiMenuStateOwner, tagPOPUPMENU::spwndNotify, and TRUE.

Referenced by xxxDestroyWindow(), and xxxMNEndMenuState().

00235 { 00236 PTHREADINFO ptiNotify; 00237 00238 if (pMenuState->pGlobalPopupMenu->spwndNotify != NULL) { 00239 ptiNotify = GETPTI(pMenuState->pGlobalPopupMenu->spwndNotify); 00240 if (ptiNotify != pMenuState->ptiMenuStateOwner) { 00241 /* 00242 * Later5.0 GerardoB. xxxMNStartMenuState no longer allows this. 00243 * This is dead code that I'll remove eventually 00244 */ 00245 UserAssert(ptiNotify == pMenuState->ptiMenuStateOwner); 00246 00247 UserAssert(ptiNotify->pMenuState == pMenuState); 00248 UserAssert(pMenuState->pmnsPrev == NULL); 00249 ptiNotify->pMenuState = NULL; 00250 return TRUE; 00251 } 00252 } 00253 00254 return FALSE; 00255 }

void MNEraseBackground HDC  hdc,
PMENU  pmenu,
int  x,
int  y,
int  cx,
int  cy
 

Definition at line 235 of file mndraw.c.

References BOOL, cy, tagMENU::dwArrowsOn, FALSE, gcyMenuScrollArrow, tagMENU::hbrBack, MFWINDOWDC, MNGetToppItem(), MNXBORDER, MNYBORDER, MSA_OFF, NULL, TestMF, TRUE, and tagITEM::yItem.

Referenced by xxxMenuWindowProc(), and xxxMNInvertItem().

00236 { 00237 BOOL fSetOrg; 00238 HBRUSH hbrOld; 00239 POINT ptOrg; 00240 00241 UserAssert(pmenu->hbrBack != NULL); 00242 00243 fSetOrg = TRUE; 00244 GreGetBrushOrg(hdc, &ptOrg); 00245 /* 00246 * If we have scrollbars 00247 */ 00248 if (pmenu->dwArrowsOn != MSA_OFF) { 00249 /* 00250 * If not drawing on the client area only 00251 */ 00252 if (TestMF(pmenu, MFWINDOWDC)) { 00253 ptOrg.x = 0; 00254 ptOrg.y = -(int)MNGetToppItem(pmenu)->yItem; 00255 } else { 00256 ptOrg.x = -MNXBORDER; 00257 ptOrg.y = -MNYBORDER - gcyMenuScrollArrow - MNGetToppItem(pmenu)->yItem; 00258 } 00259 } else { 00260 if (TestMF(pmenu, MFWINDOWDC)) { 00261 ptOrg.x = MNXBORDER; 00262 ptOrg.y = MNYBORDER; 00263 } else { 00264 fSetOrg = FALSE; 00265 } 00266 } 00267 00268 if (fSetOrg) { 00269 GreSetBrushOrg(hdc, ptOrg.x, ptOrg.y, &ptOrg); 00270 } 00271 hbrOld = GreSelectBrush(hdc, pmenu->hbrBack); 00272 00273 GrePatBlt(hdc, x, y, cx, cy, PATCOPY); 00274 00275 if (fSetOrg) { 00276 GreSetBrushOrg(hdc, ptOrg.x, ptOrg.y, NULL); 00277 } 00278 GreSelectBrush(hdc, hbrOld); 00279 }

UINT MNFindItemInColumn PMENU  pMenu,
UINT  idxB,
int  dir,
BOOL  fRoot
 

Definition at line 124 of file mnkey.c.

References tagMENU::cItems, dir(), End, MFMWFP_NOITEM, MNFindNextValidItem(), tagMENU::rgItems, UINT, tagITEM::xItem, and tagITEM::yItem.

Referenced by xxxMNKeyDown().

00129 { 00130 int dxMin; 00131 int dyMin; 00132 int dxMax; 00133 int dyMax; 00134 int xB; 00135 int yB; 00136 UINT idxE; 00137 UINT idxR; 00138 UINT cItems; 00139 PITEM pItem; 00140 00141 cItems = pMenu->cItems; 00142 idxR = MFMWFP_NOITEM; 00143 idxE = MNFindNextValidItem(pMenu, MFMWFP_NOITEM, dir, 0); 00144 if (idxE == -1) 00145 goto End; 00146 00147 dxMin = dyMin = 20000; 00148 00149 if (idxB >= pMenu->cItems) 00150 return idxR; 00151 00152 pItem = &pMenu->rgItems[idxB]; 00153 xB = pItem->xItem; 00154 yB = pItem->yItem; 00155 00156 while (cItems-- > 0 && 00157 (idxB = MNFindNextValidItem(pMenu, idxB, dir, 0)) != idxE) { 00158 pItem = &pMenu->rgItems[idxB]; 00159 dxMax = xB - pItem->xItem; 00160 dyMax = yB - pItem->yItem; 00161 00162 if (dxMax < 0) 00163 dxMax = (-dxMax); 00164 if (dyMax < 0) 00165 dyMax = (-dyMax); 00166 00167 // See if this item is nearer than the last item found 00168 // -------------------------------------------------------- 00169 // (fRoot || dxMax) -- this condition means that if it's 00170 // not the actual menu bar menu that we're dealing with, 00171 // then the item below/above (same X value as) the selected 00172 // item is not a valid one to move to 00173 if ((dyMax < dyMin) && (fRoot || dxMax) && dxMax <= dxMin) { 00174 dxMin = dxMax; 00175 dyMin = dyMax; 00176 idxR = idxB; 00177 } 00178 } 00179 00180 End: 00181 return idxR; 00182 }

UINT MNFindNextValidItem PMENU  pMenu,
int  i,
int  dir,
UINT  flags
 

Definition at line 34 of file mnkey.c.

References BOOL, tagMENU::cItems, dir(), FALSE, tagITEM::hbmp, MFMWFP_NOITEM, MNF_DONTSKIPSEPARATORS, tagMENU::rgItems, TestMFT, TRUE, and UINT.

Referenced by MNFindItemInColumn(), xxxMenuWindowProc(), xxxMNFindChar(), and xxxMNKeyDown().

00039 { 00040 int iStart; 00041 BOOL cont = TRUE; 00042 int cItems = pMenu->cItems; 00043 PITEM pItem; 00044 00045 if ((i < 0) && (dir > 0)) 00046 // going forward from beginning -- stop after last menu item 00047 i = iStart = cItems; 00048 else if ((i >= cItems) && (dir < 0)) 00049 // going backward from end -- stop after first menu item 00050 i = iStart = -1; 00051 else 00052 iStart = i; 00053 00054 if (!cItems) 00055 return(MFMWFP_NOITEM); 00056 00057 // b#8997 - if we have these conditions and enter 00058 // loop will go blistic ( infin ) 00059 // fix: jump over code and come loop to i == iStart will now stop us 00060 if ( ( i == 0 ) && ( cItems == 1 ) && ( dir > 0 ) ) 00061 { 00062 dir = 0; 00063 goto artsquickndirtybugfix; 00064 } 00065 00066 // 00067 // Loop thru menu items til (1) we find a valid item 00068 // or (2) we make it back to the start item (iStart) 00069 while (TRUE) { 00070 i += dir; 00071 00072 if ((i == iStart) || (dir == 0)) 00073 // we made it back to start item -- return NOT FOUND 00074 return MFMWFP_NOITEM; 00075 00076 // keep 'i' in the range: 0 <= i < cItems 00077 if (i >= cItems) { 00078 i = -1; 00079 continue; 00080 } 00081 else if (i < 0) { 00082 i = cItems; 00083 continue; 00084 } 00085 00086 artsquickndirtybugfix: 00087 pItem = pMenu->rgItems + i; 00088 00089 // skip ownerdraw - seperators even though there not NULL 00090 if (TestMFT(pItem, MFT_SEPARATOR)) { 00091 // 00092 // Skip non-separator (if asked) empty items. With hot-tracking, 00093 // it is acceptable for them to be selected. In truth, it was possible 00094 // in Win3.1 too, but less likely. 00095 // 00096 if (!(flags & MNF_DONTSKIPSEPARATORS)) { 00097 continue; 00098 } 00099 } else if ((pItem->hbmp >= HBMMENU_MBARFIRST) && (pItem->hbmp <= HBMMENU_MBARLAST)) { 00100 /* 00101 * Skip close & minimize & restore buttons 00102 */ 00103 continue; 00104 } 00105 00106 // return index of found item 00107 return(i); 00108 } 00109 00110 // 00111 // We should never get here! 00112 // 00113 UserAssert(FALSE); 00114 }

void MNFlushDestroyedPopups PPOPUPMENU  ppopupmenu,
BOOL  fUnlock
 

Definition at line 91 of file mnstate.c.

References FALSE, tagPOPUPMENU::fDelayedFree, tagPOPUPMENU::fDestroyed, IsRootPopupMenu(), MNFreePopup(), NULL, tagPOPUPMENU::ppmDelayedFree, and tagPOPUPMENU::ppopupmenuRoot.

Referenced by MNFreePopup(), and xxxMNLoop().

00092 { 00093 PPOPUPMENU ppmDestroyed, ppmFree; 00094 00095 UserAssert(IsRootPopupMenu(ppopupmenu)); 00096 00097 /* 00098 * Walk ppmDelayedFree 00099 */ 00100 ppmDestroyed = ppopupmenu; 00101 while (ppmDestroyed->ppmDelayedFree != NULL) { 00102 /* 00103 * If it's marked as destroyed, unlink it and free it 00104 */ 00105 if (ppmDestroyed->ppmDelayedFree->fDestroyed) { 00106 ppmFree = ppmDestroyed->ppmDelayedFree; 00107 ppmDestroyed->ppmDelayedFree = ppmFree->ppmDelayedFree; 00108 UserAssert(ppmFree != ppmFree->ppopupmenuRoot); 00109 MNFreePopup(ppmFree); 00110 } else { 00111 /* 00112 * fUnlock is TRUE if the root popup is being destroyed; if 00113 * so, reset fDelayedFree and unlink it 00114 */ 00115 if (fUnlock) { 00116 /* 00117 * This means that the root popup is going away before 00118 * some of the hierarchical popups have been destroyed. 00119 * This can happen if someone destroys one of the menu 00120 * windows breaking the spwndNextPopup chain. 00121 */ 00122 ppmDestroyed->ppmDelayedFree->fDelayedFree = FALSE; 00123 /* 00124 * Stop here so we can figure how this happened. 00125 */ 00126 UserAssert(ppmDestroyed->ppmDelayedFree->fDelayedFree); 00127 ppmDestroyed->ppmDelayedFree = ppmDestroyed->ppmDelayedFree->ppmDelayedFree; 00128 } else { 00129 /* 00130 * Not fDestroyed so move to the next one. 00131 */ 00132 ppmDestroyed = ppmDestroyed->ppmDelayedFree; 00133 } /* fUnlock */ 00134 } /* fDestroyed */ 00135 } /* while ppmDelayedFree */ 00136 00137 }

VOID MNFreeItem PMENU  pMenu,
PITEM  pItem,
BOOL  fFreeItemPopup
 

Definition at line 617 of file mnchange.c.

References _DestroyMenu(), FreeItemBitmap(), FreeItemString(), tagITEM::spSubMenu, and UnlockSubMenu().

Referenced by _DestroyMenu(), xxxInsertMenuItem(), and xxxRemoveDeleteMenuHelper().

00621 { 00622 PMENU pSubMenu; 00623 00624 FreeItemBitmap(pItem); 00625 FreeItemString(pMenu, pItem); 00626 00627 pSubMenu = UnlockSubMenu(pMenu, &(pItem->spSubMenu)); 00628 if (pSubMenu) { 00629 if (fFreeItemPopup) { 00630 _DestroyMenu(pSubMenu); 00631 } 00632 } 00633 }

VOID MNFreePopup PPOPUPMENU  ppopupmenu  ) 
 

Definition at line 165 of file mnstate.c.

References CLEAR_PUDF, DF_MENUINUSE, tagDESKTOP::dwDTFlags, tagPOPUPMENU::fDesktopMenu, tagPOPUPMENU::fFreed, tagPOPUPMENU::fIsMenuBar, FNID_MENU, GETFNID, gpopupMenu, IsRootPopupMenu(), MNFlushDestroyedPopups(), NULL, tagPOPUPMENU::ppopupmenuRoot, PtiCurrent, PUDF_POPUPINUSE, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndActivePopup, tagDESKTOP::spwndMenu, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, tagPOPUPMENU::spwndPrevPopup, TEST_PUDF, TRUE, Unlock, UnlockPopupMenu(), Validateppopupmenu, and VOID().

Referenced by MNFlushDestroyedPopups(), xxxMNDestroyHandler(), xxxMNEndMenuState(), and xxxMNStartMenuState().

00167 { 00168 00169 Validateppopupmenu(ppopupmenu); 00170 00171 if (IsRootPopupMenu(ppopupmenu)) { 00172 MNFlushDestroyedPopups (ppopupmenu, TRUE); 00173 } 00174 #if DBG 00175 /* 00176 * If this is not a cached menu and it corresponds to a menu window, 00177 * then the reference to the popup must be cleared at this point since 00178 * we're going to free this popup 00179 */ 00180 if (ppopupmenu->spwndPopupMenu != NULL) { 00181 if (!ppopupmenu->fDesktopMenu && !ppopupmenu->fIsMenuBar) { 00182 UserAssert(GETFNID(ppopupmenu->spwndPopupMenu) == FNID_MENU); 00183 UserAssert(((PMENUWND)ppopupmenu->spwndPopupMenu)->ppopupmenu == NULL); 00184 } 00185 } 00186 #endif 00187 Unlock(&ppopupmenu->spwndPopupMenu); 00188 /* 00189 * if spwndNextPopup is not NULL, we're breaking the chain and spwndNext won't 00190 * get closed. I won't remove the unlock since it has 00191 * always been there. 00192 */ 00193 UserAssert(ppopupmenu->spwndNextPopup == NULL); 00194 Unlock(&ppopupmenu->spwndNextPopup); 00195 00196 Unlock(&ppopupmenu->spwndPrevPopup); 00197 UnlockPopupMenu(ppopupmenu, &ppopupmenu->spmenu); 00198 UnlockPopupMenu(ppopupmenu, &ppopupmenu->spmenuAlternate); 00199 Unlock(&ppopupmenu->spwndNotify); 00200 Unlock(&ppopupmenu->spwndActivePopup); 00201 00202 #if DBG 00203 if (!ppopupmenu->fDesktopMenu) { 00204 ppopupmenu->fFreed = TRUE; 00205 } else { 00206 PDESKTOP pdesk = PtiCurrent()->rpdesk; 00207 UserAssert(pdesk->dwDTFlags & DF_MENUINUSE); 00208 UserAssert(((PMENUWND)pdesk->spwndMenu)->ppopupmenu == ppopupmenu); 00209 } 00210 #endif 00211 00212 if (ppopupmenu->fDesktopMenu) { 00213 PtiCurrent()->rpdesk->dwDTFlags &= ~DF_MENUINUSE; 00214 /* The desktop menu window points to this popup so don't leave bogus stuff in it */ 00215 ppopupmenu->ppopupmenuRoot = NULL; 00216 } else if (ppopupmenu == &gpopupMenu) { 00217 UserAssert(TEST_PUDF(PUDF_POPUPINUSE)); 00218 CLEAR_PUDF(PUDF_POPUPINUSE); 00219 } else { 00220 UserFreePool(ppopupmenu); 00221 } 00222 }

PITEM MNGetpItem PPOPUPMENU  ppopup,
UINT  uIndex
 

Definition at line 136 of file ntuser/kernel/menu.c.

References tagMENU::cItems, NULL, tagMENU::rgItems, and tagPOPUPMENU::spmenu.

Referenced by xxxMenuWindowProc(), xxxMNSetGapState(), and xxxMNUpdateDraggingInfo().

00137 { 00138 if ((ppopup == NULL) 00139 || (uIndex >= ppopup->spmenu->cItems)) { 00140 00141 return NULL; 00142 } 00143 00144 return ppopup->spmenu->rgItems + uIndex; 00145 }

PPOPUPMENU MNGetPopupFromMenu PMENU  pMenu,
PMENUSTATE ppMenuState
 

Definition at line 1027 of file mnchange.c.

References FALSE, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, GetpMenuState(), MNAnimate(), NULL, tagMENUSTATE::pGlobalPopupMenu, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndNextPopup, and tagMENU::spwndNotify.

Referenced by GetMenuPwnd(), MNFadeSelection(), xxxEnableMenuItem(), xxxInsertMenuItem(), xxxRemoveDeleteMenuHelper(), xxxSetLPITEMInfo(), and xxxSetMenuInfo().

01028 { 01029 PPOPUPMENU ppopup; 01030 PMENUSTATE pMenuState; 01031 01032 /* 01033 * If this menu doesn't have a notification window, then 01034 * it cannot be in menu mode 01035 */ 01036 if (pMenu->spwndNotify == NULL) { 01037 return NULL; 01038 } 01039 01040 /* 01041 * If no pMenuState, no menu mode 01042 */ 01043 pMenuState = GetpMenuState(pMenu->spwndNotify); 01044 if (pMenuState == NULL) { 01045 return NULL; 01046 } 01047 01048 /* 01049 * If not in the menu loop, not yet or no longer in menu mode 01050 */ 01051 if (!pMenuState->fInsideMenuLoop) { 01052 return NULL; 01053 } 01054 01055 /* 01056 * return pMenuState if requested 01057 */ 01058 if (ppMenuState != NULL) { 01059 *ppMenuState = pMenuState; 01060 } 01061 01062 01063 /* 01064 * Starting from the root popup, find the popup associated to this menu 01065 */ 01066 ppopup = pMenuState->pGlobalPopupMenu; 01067 while (ppopup != NULL) { 01068 /* 01069 * found? 01070 */ 01071 if (ppopup->spmenu == pMenu) { 01072 if (ppopup->fIsMenuBar) { 01073 return NULL; 01074 } 01075 /* 01076 * Since the menu is being modified, let's kill any animation. 01077 */ 01078 MNAnimate(pMenuState, FALSE); 01079 return ppopup; 01080 } 01081 /* 01082 * If no more popups, bail 01083 */ 01084 if (ppopup->spwndNextPopup == NULL) { 01085 return NULL; 01086 } 01087 01088 /* 01089 * Next popup 01090 */ 01091 ppopup = ((PMENUWND)ppopup->spwndNextPopup)->ppopupmenu; 01092 } 01093 01094 return NULL; 01095 }

__inline PITEM MNGetSelectedpitem PPOPUPMENU  ppopupmenu  ) 
 

Definition at line 4751 of file userk.h.

References NULL.

04754 {

__inline PITEM MNGetToppItem PMENU  pMenu  ) 
 

Definition at line 4743 of file userk.h.

References NULL.

Referenced by MNDrawFullNC(), MNEraseBackground(), MNItemHitTest(), xxxMenuDraw(), xxxMNInvertItem(), xxxMNPositionHierarchy(), xxxMNSetGapState(), xxxMNSetTop(), xxxMNUpdateDraggingInfo(), and xxxMNUpdateShownMenu().

04743 : NULL); 04744 } 04745 __inline BOOL IsInsideMenuLoop(PTHREADINFO pti) 04746 {

__inline BOOL MNIsItemSelected PPOPUPMENU  ppopupmenu  ) 
 

Definition at line 4747 of file userk.h.

References NULL.

Referenced by xxxHandleMenuMessages(), xxxMNDestroyHandler(), and xxxMNSelectItem().

04750 {

__inline BOOL MNIsScrollArrowSelected PPOPUPMENU  ppopupmenu  ) 
 

Definition at line 4755 of file userk.h.

Referenced by xxxMNSelectItem().

04758 { 04759 return ((int)ppopupmenu->posSelectedItem >= 0);

VOID MNPositionSysMenu PWND  pwnd,
PMENU  pSysMenu
 

Definition at line 25 of file mnstate.c.

References tagMENU::cItems, tagITEM::cxItem, tagITEM::cyItem, FALSE, GetWindowBorders(), Lock, NULL, OffsetRect(), tagMENU::rgItems, tagMENU::spwndNotify, SYSMET, TestMF, TestWF, TRUE, WEFTOOLWINDOW, WFMINIMIZED, tagITEM::xItem, and tagITEM::yItem.

Referenced by xxxMNInvertItem(), xxxMNKeyFilter(), xxxMNStartMenu(), and xxxSetSystemMenu().

00028 { 00029 RECT rc; 00030 PITEM pItem; 00031 00032 if (pmenusys == NULL) { 00033 RIPERR0(ERROR_INVALID_HANDLE, 00034 RIP_WARNING, 00035 "Invalid menu handle pmenusys (NULL) to MNPositionSysMenu"); 00036 00037 return; 00038 } 00039 00040 /* 00041 * Whoever positions the menu becomes the owner 00042 */ 00043 if (pwnd != pmenusys->spwndNotify) { 00044 Lock(&pmenusys->spwndNotify, pwnd); 00045 } 00046 00047 /* 00048 * Setup the SysMenu hit rectangle. 00049 */ 00050 rc.top = rc.left = 0; 00051 00052 if (TestWF(pwnd, WEFTOOLWINDOW)) { 00053 rc.right = SYSMET(CXSMSIZE); 00054 rc.bottom = SYSMET(CYSMSIZE); 00055 } else { 00056 rc.right = SYSMET(CXSIZE); 00057 rc.bottom = SYSMET(CYSIZE); 00058 } 00059 00060 if (!TestWF(pwnd, WFMINIMIZED)) { 00061 int cBorders; 00062 00063 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00064 OffsetRect(&rc, cBorders*SYSMET(CXBORDER), cBorders*SYSMET(CYBORDER)); 00065 } 00066 00067 /* 00068 * Offset the System popup menu. 00069 */ 00070 if (!TestMF(pmenusys, MF_POPUP) && (pmenusys->cItems > 0)) { 00071 pItem = pmenusys->rgItems; 00072 if (pItem) { 00073 pItem->yItem = rc.top; 00074 pItem->xItem = rc.left; 00075 pItem->cyItem = rc.bottom - rc.top; 00076 pItem->cxItem = rc.right - rc.left; 00077 } 00078 } 00079 else 00080 // BOGUS -- MF_POPUP should never be set on a MENU -- only a MENU ITEM 00081 UserAssert(FALSE); 00082 }

UINT MNSetTimerToCloseHierarchy PPOPUPMENU  ppopup  ) 
 

Definition at line 3917 of file ntuser/kernel/menu.c.

References _SetTimer(), tagPOPUPMENU::fAboutToHide, tagPOPUPMENU::fHideTimer, tagPOPUPMENU::fHierarchyDropped, gdtMNDropDown, IDSYS_MNHIDE, NULL, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndPopupMenu, TRUE, and UINT.

Referenced by xxxMNSelectItem().

03918 { 03919 03920 if (!ppopup->fHierarchyDropped) 03921 return(0); 03922 03923 if (ppopup->fHideTimer) 03924 return(1); 03925 03926 if (!_SetTimer(ppopup->spwndPopupMenu, IDSYS_MNHIDE, gdtMNDropDown, NULL)) 03927 return((UINT) -1); 03928 03929 ppopup->fHideTimer = TRUE; 03930 03931 ppopup = ((PMENUWND)(ppopup->spwndNextPopup))->ppopupmenu; 03932 ppopup->fAboutToHide = TRUE; 03933 03934 return(1); 03935 }

BOOL MNSetupAnimationDC PMENUSTATE  pMenuState  ) 
 

Definition at line 425 of file mnstate.c.

References BOOL, FALSE, ghMenuFont, gMenuState, gpDispInfo, tagDISPLAYINFO::hdcScreen, NULL, and TRUE.

Referenced by FinalUserInit(), and xxxMNAllocMenuState().

00426 { 00427 pMenuState->hdcAni = GreCreateCompatibleDC(gpDispInfo->hdcScreen); 00428 if (pMenuState->hdcAni == NULL) { 00429 RIPMSG0(RIP_WARNING, "MNSetupAnimationDC: Failed to create hdcAnimate"); 00430 UserAssert(pMenuState != &gMenuState); 00431 return FALSE; 00432 } 00433 GreSelectFont(pMenuState->hdcAni, ghMenuFont); 00434 return TRUE; 00435 }

ULONG MonotonicTick  ) 
 

Definition at line 48 of file ntinput.c.

References NtGetTickCount().

00049 { 00050 static ULONG lasttick = 0; 00051 ULONG newtick; 00052 00053 newtick = NtGetTickCount(); 00054 if (newtick > lasttick) { 00055 lasttick = newtick; // use the new tick since it is larger 00056 } else { 00057 lasttick++; // artificially bump the tick up one. 00058 } 00059 return lasttick; 00060 }

PWND NextTopWindow PTHREADINFO  pti,
PWND  pwnd,
PWND  pwndSkip,
DWORD  flags
 

Definition at line 2431 of file focusact.c.

References BOOL, CheckTopLevelOnly(), FALSE, GNT_NextTopScan(), NTW_GetNextTop(), NTW_GetPrevTop(), NTW_IGNORETOOLWINDOW, NTW_PREVIOUS, NULL, PWNDDESKTOP, TestWF, TRUE, WEFNOACTIVATE, WEFTOOLWINDOW, WFDISABLED, and WFVISIBLE.

Referenced by IsTopmostRealApp(), xxxActivateWindow(), xxxMenuWindowProc(), xxxNextWindow(), and xxxOldNextWindow().

02436 { 02437 BOOL fFoundFirstUnowned; 02438 PWND pwndPrev; 02439 PWND pwndStart = pwnd; 02440 PWND pwndFirstUnowned; 02441 02442 /* 02443 * If the search gets to the first unowned window TWICE (See NTW_GetNextTop), 02444 * we couldn't find a window 02445 */ 02446 pwndFirstUnowned = GNT_NextTopScan(pti, NULL, NULL); 02447 fFoundFirstUnowned = FALSE; 02448 02449 if (pwnd == NULL) { 02450 pwnd = NTW_GetNextTop(pti, NULL); 02451 02452 /* 02453 * Don't allow desktop windows. 02454 */ 02455 pwnd = pwndStart = CheckTopLevelOnly(pwnd); 02456 02457 if (pwnd == NULL) 02458 return NULL; // No more windows owned by the thread 02459 02460 goto Loop; 02461 } 02462 02463 /* 02464 * Don't allow desktop windows. 02465 */ 02466 pwnd = pwndStart = CheckTopLevelOnly(pwnd); 02467 if (pwnd == NULL) 02468 return NULL; // No more windows owned by this thread 02469 02470 /* 02471 * Don't allow desktop windows. 02472 */ 02473 pwndSkip = CheckTopLevelOnly(pwndSkip); 02474 02475 02476 02477 while (TRUE) { 02478 pwndPrev = pwnd; 02479 pwnd = ((flags & NTW_PREVIOUS) ? NTW_GetPrevTop(pti, pwnd) : NTW_GetNextTop(pti, pwnd)); 02480 02481 /* 02482 * If we've cycled to where we started, couldn't find one: return NULL 02483 */ 02484 if (pwnd == pwndStart) 02485 break; 02486 02487 if (pwnd == pwndFirstUnowned) { 02488 if (fFoundFirstUnowned) { 02489 break; 02490 } else { 02491 fFoundFirstUnowned = TRUE; 02492 } 02493 } 02494 02495 if (pwnd == NULL) 02496 break; 02497 02498 /* 02499 * If we've cycled over desktops, then return NULL because we'll 02500 * never hit pwndStart. 02501 */ 02502 if (PWNDDESKTOP(pwndStart) != PWNDDESKTOP(pwnd)) 02503 break; 02504 02505 /* 02506 * going nowhere is a bad sign. 02507 */ 02508 if (pwndPrev == pwnd) { 02509 /* 02510 * This is a temporary fix chosen because its safe. This case 02511 * was hit when a window failed the NCCREATE message and fell 02512 * into xxxFreeWindow and left the critical section after being 02513 * unlinked. The app then died and entered cleanup code and 02514 * tried to destroy this window again. 02515 */ 02516 break; 02517 } 02518 02519 Loop: 02520 if (pwnd == pwndSkip) 02521 continue; 02522 02523 /* 02524 * If it's visible, not disabled, not a noactivate window 02525 * and either we're not ignoringtool windows or it's not a 02526 * tool window, then we've got it. 02527 */ 02528 if (TestWF(pwnd, WFVISIBLE) && 02529 !TestWF(pwnd, WFDISABLED) && 02530 !TestWF(pwnd, WEFNOACTIVATE) && 02531 (!(flags & NTW_IGNORETOOLWINDOW) || !TestWF(pwnd, WEFTOOLWINDOW))) { 02532 02533 return pwnd; 02534 } 02535 } 02536 02537 return NULL; 02538 }

VOID NlsKbdSendIMEProc DWORD  dwImeOpen,
DWORD  dwImeConversion
 

Definition at line 1071 of file fekbd.c.

References GetAppImeCompatFlags(), gpqForeground, NlsKbdSendIMENotification(), NULL, tagQ::ptiKeyboard, and VOID().

Referenced by NlsAlphanumericModeProc(), NlsConvOrNonConvProc(), NlsHiraganaModeProc(), NlsKanaEventProc(), and NlsKatakanaModeProc().

01072 { 01073 if (gpqForeground != NULL && gpqForeground->ptiKeyboard != NULL && 01074 (!(GetAppImeCompatFlags(gpqForeground->ptiKeyboard) & IMECOMPAT_HYDRACLIENT))) { 01075 NlsKbdSendIMENotification(dwImeOpen, dwImeConversion); 01076 } 01077 }

VOID OffsetChildren PWND  pwnd,
int  dx,
int  dy,
LPRECT  prcHitTest
 

Definition at line 5543 of file swp.c.

References FindSpb(), gpDispInfo, tagDISPLAYINFO::hDev, HRGN_FULL, IntersectRect(), NULL, OffsetRect(), PtoHq, tagWND::rcWindow, tagWND::spwndChild, TestWF, VOID(), WEFLAYERED, WFHASSPB, and WFMAXFAKEREGIONAL.

Referenced by xxxScrollWindowEx(), and zzzChangeStates().

05548 { 05549 RECT rc; 05550 PWND pwndStop; 05551 05552 if (!pwnd->spwndChild) 05553 return; 05554 05555 pwndStop = pwnd; 05556 pwnd = pwndStop->spwndChild; 05557 for (;;) { 05558 /* 05559 * Skip windows that don't intersect prcHitTest... 05560 */ 05561 if (prcHitTest && !IntersectRect(&rc, prcHitTest, &pwnd->rcWindow)) 05562 goto NextWindow; 05563 05564 pwnd->rcWindow.left += dx; 05565 pwnd->rcWindow.right += dx; 05566 pwnd->rcWindow.top += dy; 05567 pwnd->rcWindow.bottom += dy; 05568 05569 pwnd->rcClient.left += dx; 05570 pwnd->rcClient.right += dx; 05571 pwnd->rcClient.top += dy; 05572 pwnd->rcClient.bottom += dy; 05573 05574 if (pwnd->hrgnUpdate > HRGN_FULL && !TestWF(pwnd, WFMAXFAKEREGIONAL)) { 05575 GreOffsetRgn(pwnd->hrgnUpdate, dx, dy); 05576 } 05577 05578 /* 05579 * Change position of window region, if it has one 05580 */ 05581 if (pwnd->hrgnClip != NULL) 05582 GreOffsetRgn(pwnd->hrgnClip, dx, dy); 05583 05584 if (TestWF(pwnd, WFHASSPB)) 05585 OffsetRect(&(FindSpb(pwnd))->rc, dx, dy); 05586 05587 #ifdef CHILD_LAYERING 05588 if (TestWF(pwnd, WEFLAYERED)) { 05589 POINT ptPos = {pwnd->rcWindow.left, pwnd->rcWindow.top}; 05590 05591 GreUpdateSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL, NULL, 05592 &ptPos, NULL, NULL, NULL, 0, NULL, 0, NULL); 05593 } 05594 #endif // CHILD_LAYERING 05595 05596 /* 05597 * Recurse into the child tree if there are children. 05598 */ 05599 if (pwnd->spwndChild) { 05600 pwnd = pwnd->spwndChild; 05601 continue; 05602 } 05603 05604 NextWindow: 05605 if (pwnd->spwndNext) { 05606 /* 05607 * Recurse to the next sibling in the list. 05608 */ 05609 pwnd = pwnd->spwndNext; 05610 } else { 05611 for (;;) { 05612 /* 05613 * We're at the end of the sibling window list. 05614 * Go to the parent's next window. 05615 */ 05616 pwnd = pwnd->spwndParent; 05617 if (pwnd == pwndStop) 05618 return; 05619 05620 if (pwnd->spwndNext) { 05621 pwnd = pwnd->spwndNext; 05622 break; 05623 } 05624 } 05625 } 05626 } 05627 }

BOOLEAN OkayToCloseDesktop IN PEPROCESS Process  OPTIONAL,
IN PVOID  Object,
IN HANDLE  Handle
 

BOOLEAN OkayToCloseWindowStation IN PEPROCESS Process  OPTIONAL,
IN PVOID  Object,
IN HANDLE  Handle
 

Referenced by Win32UserInitialize().

HANDLE OpenCacheKeyEx PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
ACCESS_MASK  amRequest,
PDWORD  pdwPolicyFlags
 

Referenced by CheckDesktopPolicy(), CheckDesktopPolicyChange(), FastGetProfileDwordW(), FastGetProfileKeysW(), FastGetProfileStringW(), FastGetProfileValue(), FastWriteProfileStringW(), FastWriteProfileValue(), and xxxUpdatePerUserSystemParameters().

BOOL OpenDesktopCompletion PDESKTOP  pdesk,
HDESK  hdesk,
DWORD  dwFlags,
BOOL * 
 

Definition at line 3192 of file desktop.c.

References BOOL, dwFlags, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetDesktopView(), GetProcessLuid(), gpidLogon, HF_DESKTOPHOOK, tagWINDOWSTATION::luidEndSession, NT_SUCCESS, NTSTATUS(), NULL, PpiCurrent, tagDESKTOP::rpwinstaParent, RtlEqualLuid(), SetHandleFlag(), Status, TRUE, WSF_OPENLOCK, and WSF_REALSHUTDOWN.

Referenced by NtUserOpenInputDesktop(), and xxxOpenDesktop().

03197 { 03198 PPROCESSINFO ppi = PpiCurrent(); 03199 PWINDOWSTATION pwinsta; 03200 BOOL fMapped; 03201 03202 /* 03203 * If the desktop was not mapped in as a result of the open, 03204 * fail. 03205 */ 03206 fMapped = (GetDesktopView(ppi, pdesk) != NULL); 03207 if (!fMapped) { 03208 03209 RIPMSG0(RIP_WARNING, "OpenDesktopCompletion failed." 03210 " The desktop is not mapped"); 03211 03212 /* 03213 * Desktop mapping failed. Status is set by MapDesktop 03214 */ 03215 return FALSE; 03216 } else { 03217 03218 /* 03219 * Fail if the windowstation is locked 03220 */ 03221 pwinsta = pdesk->rpwinstaParent; 03222 if (pwinsta->dwWSF_Flags & WSF_OPENLOCK && 03223 ppi->Process->UniqueProcessId != gpidLogon) { 03224 LUID luidCaller; 03225 NTSTATUS Status; 03226 03227 /* 03228 * If logoff is occuring and the caller does not 03229 * belong to the session that is ending, allow the 03230 * open to proceed. 03231 */ 03232 Status = GetProcessLuid(NULL, &luidCaller); 03233 03234 if (!NT_SUCCESS(Status) || 03235 (pwinsta->dwWSF_Flags & WSF_REALSHUTDOWN) || 03236 RtlEqualLuid(&luidCaller, &pwinsta->luidEndSession)) { 03237 03238 RIPERR0(ERROR_BUSY, RIP_WARNING, "OpenDesktopCompletion failed"); 03239 03240 /* 03241 * Set the shut down flag 03242 */ 03243 *pbShutDown = TRUE; 03244 return FALSE; 03245 } 03246 } 03247 } 03248 03249 SetHandleFlag(hdesk, HF_DESKTOPHOOK, dwFlags & DF_ALLOWOTHERACCOUNTHOOK); 03250 03251 return TRUE; 03252 }

NTSTATUS OpenEffectiveToken PHANDLE  phToken  ) 
 

Definition at line 17 of file ex.c.

References NT_SUCCESS, NTSTATUS(), Status, and TRUE.

Referenced by _UserTestForWinStaAccess(), and xxxConnectService().

00019 { 00020 NTSTATUS Status; 00021 00022 /* 00023 * Open the client's token. 00024 */ 00025 Status = ZwOpenThreadToken( 00026 NtCurrentThread(), 00027 TOKEN_QUERY, 00028 (BOOLEAN)TRUE, // OpenAsSelf 00029 phToken 00030 ); 00031 if (Status == STATUS_NO_TOKEN) { 00032 00033 /* 00034 * Client wasn't impersonating anyone. Open its process token. 00035 */ 00036 Status = ZwOpenProcessToken( 00037 NtCurrentProcess(), 00038 TOKEN_QUERY, 00039 phToken 00040 ); 00041 } 00042 00043 if (!NT_SUCCESS(Status)) { 00044 RIPMSG1(RIP_WARNING, "Can't open client's token! - Status = %lx", Status); 00045 } 00046 return Status; 00047 }

BOOL OpenMouse PDEVICEINFO  pMouseInfo  ) 
 

PWND ParentNeedsPaint PWND  pwnd  ) 
 

Definition at line 1120 of file paint.c.

References NEEDSPAINT, NULL, tagWND::spwndParent, TestWF, and WFCLIPCHILDREN.

Referenced by xxxDoSyncPaint().

01122 { 01123 while ((pwnd = pwnd->spwndParent) != NULL) { 01124 01125 if (TestWF(pwnd, WFCLIPCHILDREN)) 01126 break; 01127 01128 if (NEEDSPAINT(pwnd)) 01129 return pwnd; 01130 } 01131 01132 return NULL; 01133 }

NTSTATUS ParseDesktop IN PVOID  ParseObject,
IN PVOID  ObjectType,
IN OUT PACCESS_STATE  AccessState,
IN KPROCESSOR_MODE  AccessMode,
IN ULONG  Attributes,
IN OUT PUNICODE_STRING  CompleteName,
IN OUT PUNICODE_STRING  RemainingName,
IN OUT PVOID Context  OPTIONAL,
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos  OPTIONAL,
OUT PVOID *  Object
 

Referenced by ParseWindowStation().

NTSTATUS ParseWindowStation IN PVOID  ParseObject,
IN PVOID  ObjectType,
IN OUT PACCESS_STATE  AccessState,
IN KPROCESSOR_MODE  AccessMode,
IN ULONG  Attributes,
IN OUT PUNICODE_STRING  CompleteName,
IN OUT PUNICODE_STRING  RemainingName,
IN OUT PVOID Context  OPTIONAL,
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos  OPTIONAL,
OUT PVOID *  Object
 

Referenced by Win32UserInitialize().

VOID PatchThreadWindows PTHREADINFO   ) 
 

Definition at line 2972 of file createw.c.

References tagSHAREDINFO::aheList, _HANDLEENTRY::bFlags, _HANDLEENTRY::bType, ClrWF, FNID_WNDPROCEND, FNID_WNDPROCSTART, giheLast, gSharedInfo, HANDLEF_DESTROY, tagWND::head, tagWND::lpfnWndProc, NULL, tagDESKTOP::pDeskInfo, _HANDLEENTRY::phead, _HANDLEENTRY::pOwner, PTHROBJHEAD, tagTHREADINFO::rpdesk, SetWF, tagDESKTOPINFO::spwnd, tagDESKTOP::spwndMenu, STOCID, TYPE_WINDOW, VOID(), WFANSIPROC, WFSERVERSIDEPROC, and xxxDefWindowProc().

Referenced by xxxDestroyThreadInfo().

02974 { 02975 PHE pheT; 02976 PHE pheMax; 02977 PWND pwnd; 02978 02979 /* 02980 * First do any preparation work: windows need to be "patched" so that 02981 * their window procs point to server only windowprocs, for example. 02982 */ 02983 pheMax = &gSharedInfo.aheList[giheLast]; 02984 for (pheT = gSharedInfo.aheList; pheT <= pheMax; pheT++) { 02985 02986 /* 02987 * Make sure this object is a window, it hasn't been marked for 02988 * destruction, and that it is owned by this thread. 02989 */ 02990 if (pheT->bType != TYPE_WINDOW) 02991 continue; 02992 02993 if (pheT->bFlags & HANDLEF_DESTROY) 02994 continue; 02995 02996 if ((PTHREADINFO)pheT->pOwner != pti) 02997 continue; 02998 02999 /* 03000 * don't patch the shared menu window 03001 */ 03002 if (pti->rpdesk && (PHEAD)pti->rpdesk->spwndMenu == pheT->phead) { 03003 03004 ((PTHROBJHEAD)pheT->phead)->pti = pti->rpdesk->pDeskInfo->spwnd->head.pti; 03005 pheT->pOwner = pti->rpdesk->pDeskInfo->spwnd->head.pti; 03006 03007 continue; 03008 } 03009 03010 /* 03011 * Don't patch the window based on the class it was created from - 03012 * because apps can sometimes sub-class a class - make a random class, 03013 * then call ButtonWndProc with windows of that class by using 03014 * the CallWindowProc() api. So patch the wndproc based on what 03015 * wndproc this window has been calling. 03016 */ 03017 pwnd = (PWND)pheT->phead; 03018 03019 if ((pwnd->fnid >= (WORD)FNID_WNDPROCSTART) && 03020 (pwnd->fnid <= (WORD)FNID_WNDPROCEND)) { 03021 03022 pwnd->lpfnWndProc = STOCID(pwnd->fnid); 03023 03024 if (pwnd->lpfnWndProc == NULL) 03025 pwnd->lpfnWndProc = xxxDefWindowProc; 03026 03027 } else { 03028 03029 pwnd->lpfnWndProc = xxxDefWindowProc; 03030 } 03031 03032 /* 03033 * This is a server side window now... 03034 */ 03035 SetWF(pwnd, WFSERVERSIDEPROC); 03036 ClrWF(pwnd, WFANSIPROC); 03037 } 03038 }

PHOOK PhkFirstGlobalValid PTHREADINFO  pti,
int  nFilterType
 

Definition at line 2151 of file hooks.c.

References tagDESKTOPINFO::aphkStart, CheckCritIn, DbgValidatefsHook, DbgValidateHooks, tagHOOK::flags, HF_DESTROYED, NULL, tagTHREADINFO::pDeskInfo, PhkNextValid(), and TRUE.

Referenced by CheckWHFBits(), GetJournallingQueue(), xxxCallJournalPlaybackHook(), xxxCallJournalRecordHook(), xxxGetNextSysMsg(), xxxInternalGetMessage(), xxxSkipSysMsg(), zzzCancelJournalling(), and zzzUnhookWindowsHookEx().

02152 { 02153 PHOOK phk; 02154 02155 CheckCritIn(); 02156 phk = pti->pDeskInfo->aphkStart[nFilterType + 1]; 02157 /* 02158 * Return the first hook that it's not destroyed (i.e, the 02159 * first valid one). 02160 */ 02161 if ((phk != NULL) && (phk->flags & HF_DESTROYED)) { 02162 phk = PhkNextValid(phk); 02163 } 02164 /* 02165 * Good place to check fsHooks. If the bits are out of sync, 02166 * someone must be adjusting them. 02167 */ 02168 DbgValidatefsHook(phk, nFilterType, pti, TRUE); 02169 DbgValidateHooks(phk, nFilterType); 02170 return phk; 02171 }

PHOOK PhkFirstValid PTHREADINFO  pti,
int  nFilterType
 

Definition at line 2183 of file hooks.c.

References tagDESKTOPINFO::aphkStart, tagTHREADINFO::aphkStart, CheckCritIn, DbgValidatefsHook, DbgValidateHooks, FALSE, tagHOOK::flags, HF_DESTROYED, NULL, tagTHREADINFO::pDeskInfo, and PhkNextValid().

Referenced by CheckWHFBits(), xxxButtonEvent(), xxxCallHook(), xxxCallMouseHook(), xxxDoButtonEvent(), xxxKeyEvent(), xxxMoveEventAbsolute(), and zzzUnhookWindowsHook().

02186 { 02187 PHOOK phk; 02188 CheckCritIn(); 02189 /* 02190 * Grab the first hook off the local hook-list 02191 * for the current queue. 02192 */ 02193 phk = pti->aphkStart[nFilterType + 1]; 02194 /* 02195 * If there aren't any local hooks, try the global hooks. 02196 */ 02197 if (phk == NULL) { 02198 phk = pti->pDeskInfo->aphkStart[nFilterType + 1]; 02199 } 02200 /* 02201 * Return the first hook that it's not destroyed (i.e, the 02202 * first valid one). 02203 */ 02204 if ((phk != NULL) && (phk->flags & HF_DESTROYED)) { 02205 phk = PhkNextValid(phk); 02206 } 02207 /* 02208 * Good place to check fsHooks. If the bits are out of sync, 02209 * someone must be adjusting them. 02210 */ 02211 02212 DbgValidatefsHook(phk, nFilterType, pti, FALSE); 02213 DbgValidateHooks(phk, nFilterType); 02214 return phk; 02215 }

VOID PlayEventSound UINT  idSound  ) 
 

Definition at line 108 of file kernel/msgbeep.c.

References _PostMessage(), gspwndLogonNotify, PtiCurrent, PUDF_EXTENDEDSOUNDS, TEST_PUDF, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, and VOID().

Referenced by xxxCreateThreadInfo(), xxxMenuWindowProc(), xxxMNCancel(), xxxMNOpenHierarchy(), xxxSnapWindow(), xxxSysCommand(), and xxxTrackPopupMenuEx().

00109 { 00110 PTHREADINFO pti = PtiCurrent(); 00111 00112 if (!TEST_PUDF(PUDF_EXTENDEDSOUNDS)) 00113 return; 00114 00115 if (pti->TIF_flags & TIF_SYSTEMTHREAD) 00116 return; 00117 00118 if (gspwndLogonNotify) { 00119 _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, idSound); 00120 } 00121 00122 // BUGBUG -- we should only flash SoundSentry if a sound is played. With the 00123 // new technique of posting to WinLogon, we can't determine this here. 00124 // _UserSoundSentryWorker(); 00125 00126 }

BOOL PostEventMessage PTHREADINFO  pti,
PQ  pq,
DWORD  dwQEvent,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 2068 of file ntuser/kernel/input.c.

References AllocQEntry(), BOOL, CheckCritIn, FALSE, tagQ::mlInput, NULL, tagQ::ptiKeyboard, tagQ::ptiMouse, SetWakeBit(), StoreQMessage(), StoreQMessagePti(), tagTHREADINFO::TIF_flags, TIF_INCLEANUP, and TRUE.

Referenced by _ShowWindowAsync(), AsyncWindowPos(), FKActivationTimer(), PostAccessibility(), PostRitSound(), PostUpdateKeyStateEvent(), xxxButtonEvent(), xxxFW_DestroyAllChildren(), xxxKeyEvent(), xxxMinimizeHungWindow(), xxxProcessEventMessage(), xxxProcessNotifyWinEvent(), xxxSetForegroundWindow(), xxxSwitchToThisWindow(), xxxTrackMouseMove(), zzzReattachThreads(), and zzzSetFMouseMoved().

02076 { 02077 PQMSG pqmsgEvent; 02078 02079 CheckCritIn(); 02080 02081 /* 02082 * If the thread is in cleanup, then it's possible the queue has 02083 * already been removed for this thread. If this is the case, then 02084 * we should fail to post the event to a dying thread. 02085 */ 02086 if (pti && (pti->TIF_flags & TIF_INCLEANUP)) 02087 return FALSE; 02088 02089 if ((pqmsgEvent = AllocQEntry(&pq->mlInput)) == NULL) 02090 return FALSE; 02091 02092 StoreQMessage(pqmsgEvent, pwnd, message, wParam, lParam, 0, dwQEvent, 0); 02093 02094 StoreQMessagePti(pqmsgEvent, pti); 02095 02096 /* 02097 * Let this thread know it has an event message to process. 02098 */ 02099 if (pti == NULL) { 02100 UserAssert(pti); 02101 SetWakeBit(pq->ptiMouse, QS_EVENTSET); 02102 SetWakeBit(pq->ptiKeyboard, QS_EVENTSET); 02103 } else { 02104 SetWakeBit(pti, QS_EVENTSET); 02105 } 02106 02107 return TRUE; 02108 }

void PostInputMessage PQ  pq,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
DWORD  time,
ULONG_PTR  dwExtraInfo
 

Definition at line 1575 of file ntuser/kernel/input.c.

References AllocQEntry(), DelQEntry(), tagQ::idSysPeek, tagQ::mlInput, tagQMSG::msg, NULL, PostUpdateKeyStateEvent(), tagMLIST::pqmsgWriteLast, tagQ::QF_flags, QF_UPDATEKEYSTATE, StoreQMessage(), and WakeSomeone().

Referenced by PostMove(), xxxButtonEvent(), xxxDoButtonEvent(), and xxxKeyEvent().

01583 { 01584 PQMSG pqmsgInput, pqmsgPrev; 01585 short sWheelDelta; 01586 01587 /* 01588 * Grab the last written message before we start allocing new ones, 01589 * so we're sure to point to the correct message. 01590 */ 01591 pqmsgPrev = pq->mlInput.pqmsgWriteLast; 01592 01593 /* 01594 * Allocate a key state update event if needed. 01595 */ 01596 if (pq->QF_flags & QF_UPDATEKEYSTATE) { 01597 PostUpdateKeyStateEvent(pq); 01598 } 01599 01600 /* 01601 * We want to coalesce sequential WM_MOUSEMOVE and WM_MOUSEWHEEL. 01602 * WM_MOUSEMOVEs are coalesced by just storing the most recent 01603 * event over the last one. 01604 * WM_MOUSEWHEELs also add up the wheel rolls. 01605 */ 01606 if (pqmsgPrev != NULL && 01607 pqmsgPrev->msg.message == message && 01608 (message == WM_MOUSEMOVE || message == WM_MOUSEWHEEL)) { 01609 01610 if (message == WM_MOUSEWHEEL) { 01611 sWheelDelta = (short)HIWORD(wParam) + (short)HIWORD(pqmsgPrev->msg.wParam); 01612 01613 #if 0 01614 /* 01615 * LATER: We can't remove a wheel message with zero delta 01616 * unless we know it hasn't been peeked. Ideally, 01617 * we would check idsyspeek for this, but we're too close 01618 * to ship and idsyspeek is too fragile. Consider also 01619 * checking to see if mouse move messages have been peeked. 01620 */ 01621 01622 if (sWheelDelta == 0) { 01623 if ((PQMSG)pq->idSysPeek == pqmsgPrev) { 01624 RIPMSG0(RIP_VERBOSE, 01625 "Coalescing of mouse wheel messages causing " 01626 "idSysPeek to be reset to 0"); 01627 01628 pq->idSysPeek = 0; 01629 } 01630 01631 DelQEntry(&pq->mlInput, pqmsgPrev); 01632 return; 01633 } 01634 #endif 01635 01636 wParam = MAKEWPARAM(LOWORD(wParam), sWheelDelta); 01637 } 01638 01639 StoreQMessage(pqmsgPrev, pwnd, message, wParam, lParam, time, 0, dwExtraInfo); 01640 WakeSomeone(pq, message, pqmsgPrev); 01641 01642 return; 01643 } 01644 01645 /* 01646 * Fill in pqmsgInput. 01647 */ 01648 pqmsgInput = AllocQEntry(&pq->mlInput); 01649 if (pqmsgInput != NULL) { 01650 StoreQMessage(pqmsgInput, pwnd, message, wParam, lParam, time, 0, dwExtraInfo); 01651 WakeSomeone(pq, message, pqmsgInput); 01652 } 01653 }

VOID PostMove PQ  pq  ) 
 

Definition at line 1254 of file ntuser/kernel/input.c.

References CheckCritIn, gdwMouseMoveExtraInfo, gdwMouseMoveTimeStamp, gpsi, NtGetTickCount(), NULL, PostInputMessage(), tagQ::QF_flags, QF_MOUSEMOVED, SHORT, and VOID().

Referenced by xxxButtonEvent(), xxxGetNextSysMsg(), and xxxKeyEvent().

01256 { 01257 #ifdef REDIRECTION 01258 POINT pt; 01259 #endif // REDIRECTION 01260 01261 CheckCritIn(); 01262 01263 /* 01264 * set gdwMouseMoveTimeStamp to 0 after posting the move so 01265 * subsequent calls to SetFMouseMove doesn't use the same value 01266 * of gdwMouseMoveTimeStamp. Bug 74508. 01267 */ 01268 if (gdwMouseMoveTimeStamp == 0) { 01269 gdwMouseMoveTimeStamp = NtGetTickCount(); 01270 } 01271 01272 #ifdef REDIRECTION 01273 01274 PopMouseMove(pq, &pt); 01275 01276 PostInputMessage(pq, NULL, WM_MOUSEMOVE, 0, 01277 MAKELONG((SHORT)pt.x, (SHORT)pt.y), 01278 gdwMouseMoveTimeStamp, gdwMouseMoveExtraInfo); 01279 #else 01280 PostInputMessage(pq, NULL, WM_MOUSEMOVE, 0, 01281 MAKELONG((SHORT)gpsi->ptCursor.x, (SHORT)gpsi->ptCursor.y), 01282 gdwMouseMoveTimeStamp, gdwMouseMoveExtraInfo); 01283 #endif // REDIRECTION 01284 01285 gdwMouseMoveTimeStamp = 0; 01286 01287 pq->QF_flags &= ~QF_MOUSEMOVED; 01288 }

void PostShellHookMessages UINT  message,
LPARAM  lParam
 

Definition at line 3719 of file rare.c.

References _PostMessage(), DWORD, GETDESKINFO, glinp, gpsi, guiOtherWindowCreated, guiOtherWindowDestroyed, NULL, PtiCurrent, tagLASTINPUT::ptiLastWoken, tagDESKTOPINFO::pvwplShellHook, tagDESKTOPINFO::spwndProgman, tagSERVERINFO::uiShellMsg, and VWPLNext().

Referenced by xxxDefWindowProc(), xxxDesktopThread(), xxxDestroyWindow(), xxxEndDeferWindowPosEx(), xxxFlashWindow(), xxxHandleOwnerSwitch(), xxxMinMaximize(), xxxProcessEventMessage(), xxxRedrawFrameAndHook(), xxxRedrawTitle(), xxxSetTrayWindow(), and xxxSystemParametersInfo().

03719 { 03720 PDESKTOPINFO pdeskinfo = GETDESKINFO(PtiCurrent()); 03721 DWORD nPwndShellHook; 03722 PWND pwndShellHook; 03723 03724 nPwndShellHook = 0; 03725 pwndShellHook = NULL; 03726 03727 /* 03728 * Hack for WM_APPCOMMAND (bug 389210): 03729 * We want to allow anyone who's listening for these wm_appcommand messages to be able to 03730 * take the foreground. ie pressing mail will launch outlook AND bring it to the foreground 03731 * We set the token to null so anyone can steal the foreground - else it isn't clear who should 03732 * have the right to steal it - only one person gets the right. We let them fight it out to 03733 * decide who gets foreground if more than one listener will try make a foreground change. 03734 */ 03735 if (HSHELL_APPCOMMAND == message) { 03736 TAGMSG0(DBGTAG_FOREGROUND, "PostShellHookMessages cleared last input token - open foreground."); 03737 03738 glinp.ptiLastWoken = NULL; 03739 } 03740 03741 /* 03742 * Loop through all the windows registered to listen for shell hooks and post the message 03743 * to them 03744 */ 03745 while (pwndShellHook = VWPLNext(pdeskinfo->pvwplShellHook, pwndShellHook, &nPwndShellHook)) { 03746 if (pwndShellHook == pdeskinfo->spwndProgman) { 03747 switch (message) { 03748 case HSHELL_WINDOWCREATED: 03749 _PostMessage(pwndShellHook, gpsi->uiShellMsg, guiOtherWindowCreated, lParam); 03750 break; 03751 case HSHELL_WINDOWDESTROYED: 03752 _PostMessage(pwndShellHook, gpsi->uiShellMsg, guiOtherWindowDestroyed, lParam); 03753 break; 03754 } 03755 } else { 03756 _PostMessage(pwndShellHook, gpsi->uiShellMsg, message, lParam); 03757 } 03758 } 03759 03760 }

void PostUpdateKeyStateEvent PQ  pq  ) 
 

Definition at line 1874 of file ntuser/kernel/input.c.

References tagQ::afKeyRecentDown, BYTE, CBKEYSTATE, CBKEYSTATERECENTDOWN, tagMLIST::cMsgs, DWORD, tagQMSG::dwQEvent, tagCLIENTTHREADINFO::fsWakeBits, gafAsyncKeyState, gptiRit, KEYSTATESIZE, tagQ::mlInput, tagQMSG::msg, NULL, PBYTE, tagTHREADINFO::pcti, PostEventMessage(), tagQMSG::pqmsgNext, tagMLIST::pqmsgRead, tagMLIST::pqmsgWriteLast, ProcessUpdateKeyStateEvent(), tagQ::ptiKeyboard, tagQ::ptiMouse, QEVENT_UPDATEKEYSTATE, tagQ::QF_flags, QF_UPDATEKEYSTATE, and SetWakeBit().

Referenced by _PostMessage(), NtUserGetKeyState(), PostInputMessage(), UpdateAsyncKeyState(), and xxxSwitchDesktop().

01876 { 01877 BYTE *pb; 01878 PQMSG pqmsg; 01879 01880 if (!(pq->QF_flags & QF_UPDATEKEYSTATE)) 01881 return; 01882 01883 /* 01884 * Exclude the RIT - it's queue is never read, so don't waste memory 01885 */ 01886 if (pq->ptiKeyboard == gptiRit) { 01887 return; 01888 } 01889 01890 /* 01891 * If there's no mousebutton or keystroke input pending, process the 01892 * UpdateKeyState Event now: thus saving memory allocation and giving 01893 * applications the correct KeyState immediately. 01894 * NOTE: There may be event/activation msgs in pq->mlInput that don't 01895 * affect keystate, so I'd like to just test QS_KEY | QS_MOUSEBUTTON 01896 * specifically, instead of the cMsgss. However, sometimes there are 01897 * keystroke or mousebutton msgs in the q without those bits set! - IanJa 01898 */ 01899 if (pq->mlInput.cMsgs == 0) { 01900 ProcessUpdateKeyStateEvent(pq, gafAsyncKeyState, pq->afKeyRecentDown); 01901 goto SyncQueue; 01902 } 01903 #if DBG 01904 else if ((!pq->ptiKeyboard || !(pq->ptiKeyboard->pcti->fsWakeBits & QS_KEY)) && 01905 (!pq->ptiMouse || !(pq->ptiMouse->pcti->fsWakeBits & QS_MOUSEBUTTON))) { 01906 /* 01907 * See if there are any key or mousebutton messages that aren't 01908 * indicated by QS_KEY or QS_MOUSEBUTTON bits. 01909 */ 01910 PQMSG pqmsgT; 01911 for (pqmsgT = pq->mlInput.pqmsgRead; pqmsgT; pqmsgT = pqmsgT->pqmsgNext) { 01912 if (pqmsgT->msg.message >= WM_KEYFIRST && pqmsgT->msg.message <= WM_KEYLAST) { 01913 TAGMSG1(DBGTAG_InputWithoutQS, 01914 "PostUpdateKeyStateEvent() pushing in front of a keystroke: Q %#p", pq); 01915 } else if (pqmsgT->msg.message >= WM_LBUTTONDOWN && pqmsgT->msg.message <= WM_XBUTTONDBLCLK) { 01916 TAGMSG1(DBGTAG_InputWithoutQS, 01917 "PostUpdateKeyStateEvent() pushing in front of a mousebutton: Q %#p", pq); 01918 } 01919 } 01920 } 01921 #endif 01922 01923 UserAssert(pq->mlInput.pqmsgWriteLast != NULL); 01924 01925 /* 01926 * If the last input message is an UPDATEKEYSTATE event, coalesce with it. 01927 * (Prevents big memory leaks on apps that don't read input messages) 01928 */ 01929 pqmsg = pq->mlInput.pqmsgWriteLast; 01930 if (pqmsg->dwQEvent == QEVENT_UPDATEKEYSTATE) { 01931 int i; 01932 DWORD *pdw; 01933 01934 pb = (PBYTE)(pqmsg->msg.wParam); 01935 pdw = (DWORD *) (pb + CBKEYSTATE); 01936 01937 /* 01938 * Copy in the new key state 01939 */ 01940 RtlCopyMemory(pb, gafAsyncKeyState, CBKEYSTATE); 01941 01942 /* 01943 * Or in the recent key down state (DWORD at a time) 01944 */ 01945 #if (CBKEYSTATERECENTDOWN % 4) != 0 01946 #error "CBKEYSTATERECENTDOWN assumed to be an integral number of DWORDs" 01947 #endif 01948 for (i = 0; i < CBKEYSTATERECENTDOWN / sizeof(*pdw); i++) { 01949 *pdw++ |= ((DWORD *)(pq->afKeyRecentDown))[i]; 01950 } 01951 01952 /* 01953 * Set QS_EVENTSET as in PostEventMessage, although this is 01954 * usually, but not always already set 01955 */ 01956 SetWakeBit(pq->ptiKeyboard, QS_EVENTSET); 01957 goto SyncQueue; 01958 } 01959 01960 /* 01961 * Make a copy of the async key state buffer, point to it, and add an 01962 * event to the end of the input queue. 01963 */ 01964 if ((pb = UserAllocPool(KEYSTATESIZE, TAG_KBDSTATE)) == NULL) { 01965 return; 01966 } 01967 01968 RtlCopyMemory(pb, gafAsyncKeyState, CBKEYSTATE); 01969 RtlCopyMemory(pb + CBKEYSTATE, pq->afKeyRecentDown, CBKEYSTATERECENTDOWN); 01970 01971 if (!PostEventMessage(pq->ptiKeyboard, pq, QEVENT_UPDATEKEYSTATE, 01972 NULL, 0 , (WPARAM)pb, 0)) { 01973 UserFreePool(pb); 01974 return; 01975 } 01976 01977 /* 01978 * The key state of the queue is input-synchronized with the user. Erase 01979 * all 'recent down' flags. 01980 */ 01981 SyncQueue: 01982 RtlZeroMemory(pq->afKeyRecentDown, CBKEYSTATERECENTDOWN); 01983 pq->QF_flags &= ~QF_UPDATEKEYSTATE; 01984 }

BOOL PrepareForLogoff UINT  uFlags  ) 
 

Definition at line 33 of file kernel/exitwin.c.

References BOOL, CheckCritIn, CreateProfileUserName(), FALSE, FreeProfileUserName(), gpidLogon, NULL, tagTHREADINFO::ppi, PtiCurrent, tagPROCESSINFO::pW32Job, PW32JOB, RegisterPerUserKeyboardIndicators(), tagW32JOB::restrictions, tagTHREADINFO::TIF_flags, TIF_RESTRICTED, and TRUE.

00035 { 00036 PTHREADINFO ptiCurrent = PtiCurrent(); 00037 00038 CheckCritIn(); 00039 00040 if (ptiCurrent->TIF_flags & TIF_RESTRICTED) { 00041 PW32JOB pW32Job; 00042 00043 pW32Job = ptiCurrent->ppi->pW32Job; 00044 00045 UserAssert(pW32Job != NULL); 00046 00047 if (pW32Job->restrictions & JOB_OBJECT_UILIMIT_EXITWINDOWS) { 00048 // Not permitted to ExitWindows. 00049 return FALSE; 00050 } 00051 } 00052 00053 /* 00054 * There are no restrictions, or the restriction do not deny shutdown: 00055 * The caller is about to ExitWindowsEx via CSR, so save the volatile 00056 * elements of the User preferences in their profile 00057 */ 00058 if (ptiCurrent->pEThread->Cid.UniqueProcess == gpidLogon) { 00059 /* 00060 * Save the current user's NumLock state 00061 */ 00062 TL tlName; 00063 PUNICODE_STRING pProfileUserName = CreateProfileUserName(&tlName); 00064 RegisterPerUserKeyboardIndicators(pProfileUserName); 00065 FreeProfileUserName(pProfileUserName, &tlName); 00066 } 00067 00068 return TRUE; 00069 UNREFERENCED_PARAMETER(uFlags); 00070 }

PSOFTKBDDATA ProbeAndCaptureSoftKbdData PSOFTKBDDATA  Source  ) 
 

Definition at line 2154 of file ntimm.c.

References BYTE, DWORD, ExRaiseStatus(), NULL, ProbeAndReadUlong, ProbeForReadBuffer, TRUE, and UINT.

Referenced by MESSAGECALL().

02156 { 02157 PSOFTKBDDATA Destination = NULL; 02158 DWORD cbSize; 02159 UINT uCount; 02160 02161 try { 02162 uCount = ProbeAndReadUlong((PULONG)Source); 02163 02164 #if defined(_X86_) 02165 ProbeForReadBuffer(&Source->wCode, uCount, sizeof(BYTE)); 02166 #else 02167 ProbeForReadBuffer(&Source->wCode, uCount, sizeof(WORD)); 02168 #endif 02169 02170 cbSize = FIELD_OFFSET(SOFTKBDDATA, wCode[0]) 02171 + uCount * sizeof(WORD) * 256; 02172 02173 Destination = (PSOFTKBDDATA)UserAllocPool(cbSize, TAG_IME); 02174 02175 if (Destination != NULL) { 02176 RtlCopyMemory(Destination, Source, cbSize); 02177 } else { 02178 ExRaiseStatus(STATUS_NO_MEMORY); 02179 } 02180 02181 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 02182 02183 if (Destination != NULL) { 02184 UserFreePool(Destination); 02185 } 02186 02187 return NULL; 02188 } 02189 02190 return Destination; 02191 }

void ProcessDeviceChanges DWORD  DeviceType  ) 
 

Definition at line 1191 of file w32/ntuser/kernel/pnp.c.

References tagMOUSE_DEVICE_INFO::Attr, tagKEYBOARD_DEVICE_INFO::Attr, BEGINATOMICCHECK, BEGINATOMICDEVICEINFOLISTCHECK, CheckCritIn, CLEAR_GTERMF, CloseDevice(), DEVICE_TYPE_KEYBOARD, DEVICE_TYPE_MOUSE, DWORD, ENDATOMICCHECK, ENDATOMICDEVICEINFOLISTCHECK, EnterDeviceInfoListCrit(), EVENT_INCREMENT, FALSE, FreeDeviceInfo(), gbRemoteSession, GDIAF_ARRIVED, GDIAF_DEPARTED, GDIAF_IME_STATUS, GDIAF_PNPWAITING, GDIAF_QUERYREMOVE, GDIAF_RECONNECT, GDIAF_REFRESH_MOUSE, GDIAF_REMOVECANCELLED, GDIAF_RETRYREAD, giosbKbdControl, gKbdImeStatus, gKbdIoctlLEDSStatus, gKeyboardInfo, gklpBootTime, gnKeyboards, gnMice, gpDeviceInfoList, gpDispInfo, gpepCSRSS, gpsi, gptiRit, gRemoteClientKeyboardType, GTERMF_MOUSE, gTermIO, gwMouseOwnerButton, tagDISPLAYINFO::hDev, KeSetEvent(), tagDEVICEINFO::keyboard, LeaveDeviceInfoListCrit(), max, tagDEVICEINFO::mouse, NT_SUCCESS, NTSTATUS(), NULL, OpenDevice(), PpiFromProcess, PtiCurrentShared, tagTERMINAL::ptiDesktop, QueryDeviceInfo(), RegisterForDeviceChangeNotifications(), SET_GTERMF, SetDebugHotKeys(), SetGlobalCursorLevel(), StartDeviceRead(), Status, SYSMET, TRUE, UnregisterForDeviceChangeNotifications(), UpdateKeyLights(), USHORT, and VOID().

Referenced by RawInputThread(), and xxxDesktopThread().

01192 { 01193 PDEVICEINFO pDeviceInfo; 01194 USHORT usOriginalActions; 01195 #if DBG 01196 int nChanges = 0; 01197 ULONG timeStartReadPrev; 01198 #endif 01199 01200 /* 01201 * Reset summary information for all Mice and Keyboards 01202 */ 01203 DWORD nMice = 0; 01204 DWORD nWheels = 0; 01205 DWORD nMaxButtons = 0; 01206 int nKeyboards = 0; 01207 01208 CheckCritIn(); 01209 BEGINATOMICCHECK(); 01210 UserAssert((PtiCurrentShared() == gptiRit) || (PtiCurrentShared() == gTermIO.ptiDesktop)); 01211 01212 EnterDeviceInfoListCrit(); 01213 BEGINATOMICDEVICEINFOLISTCHECK(); 01214 01215 /* 01216 * Look for devices to Create (those which have newly arrived) 01217 * and for devices to Terminate (these which have just departed) 01218 * and for device change notifications. 01219 * Make sure the actions are processed in the right order in case we 01220 * are being asked for more than one action per device: for example, 01221 * we sometimes get QueryRemove followed quickly by RemoveCancelled 01222 * and both actions arrive here together: we should do them in the 01223 * correct order. 01224 */ 01225 pDeviceInfo = gpDeviceInfoList; 01226 while (pDeviceInfo) { 01227 if (pDeviceInfo->type != DeviceType) { 01228 pDeviceInfo = pDeviceInfo->pNext; 01229 continue; 01230 } 01231 01232 usOriginalActions = pDeviceInfo->usActions; 01233 UserAssert((usOriginalActions == 0) || (usOriginalActions & ~GDIAF_PNPWAITING)); 01234 01235 /* 01236 * Refresh Mouse: 01237 * We read a MOUSE_ATTRIBUTES_CHANGED flag when a PS/2 mouse 01238 * is plugged back in. Find out the attributes of the device. 01239 */ 01240 if (pDeviceInfo->usActions & GDIAF_REFRESH_MOUSE) { 01241 pDeviceInfo->usActions &= ~GDIAF_REFRESH_MOUSE; 01242 01243 UserAssert(pDeviceInfo->type == DEVICE_TYPE_MOUSE); 01244 #if DBG 01245 nChanges++; 01246 #endif 01247 TAGMSG1(DBGTAG_PNP, "QueryDeviceInfo: %lx", pDeviceInfo); 01248 QueryDeviceInfo(pDeviceInfo); 01249 } 01250 01251 /* 01252 * QueryRemove: 01253 * Close the file object, but retain the DEVICEINFO struct and the 01254 * registration in case we later get a RemoveCancelled. 01255 */ 01256 if (pDeviceInfo->usActions & GDIAF_QUERYREMOVE) { 01257 pDeviceInfo->usActions &= ~GDIAF_QUERYREMOVE; 01258 #if DBG 01259 nChanges++; 01260 #endif 01261 TAGMSG1(DBGTAG_PNP, "QueryRemove: %lx", pDeviceInfo); 01262 CloseDevice(pDeviceInfo); 01263 } 01264 01265 /* 01266 * New device arrived or RemoveCancelled: 01267 * If new device, Open it, register for notifications and start reading 01268 * If RemoveCancelled, unregister the old notfications first 01269 */ 01270 if (pDeviceInfo->usActions & (GDIAF_ARRIVED | GDIAF_REMOVECANCELLED)) { 01271 // Reopen the file object, (this is a new file object, of course), 01272 // Unregister for the old file, register with this new one. 01273 if (pDeviceInfo->usActions & GDIAF_REMOVECANCELLED) { 01274 pDeviceInfo->usActions &= ~GDIAF_REMOVECANCELLED; 01275 #if DBG 01276 nChanges++; 01277 #endif 01278 TAGMSG1(DBGTAG_PNP, "RemoveCancelled: %lx", pDeviceInfo); 01279 UnregisterForDeviceChangeNotifications(pDeviceInfo); 01280 } 01281 01282 #if DBG 01283 if (pDeviceInfo->usActions & GDIAF_ARRIVED) { 01284 nChanges++; 01285 } 01286 #endif 01287 01288 pDeviceInfo->usActions &= ~GDIAF_ARRIVED; 01289 if (OpenDevice(pDeviceInfo)) { 01290 PDEVICEINFO pDeviceInfoNext; 01291 RegisterForDeviceChangeNotifications(pDeviceInfo); 01292 01293 if (!(gbRemoteSession && (pDeviceInfo->usActions & GDIAF_RECONNECT))) { 01294 01295 pDeviceInfoNext = StartDeviceRead(pDeviceInfo); 01296 if (pDeviceInfoNext) { 01297 /* 01298 * pDeviceInfo wasa freed, move onto the next 01299 */ 01300 pDeviceInfo = pDeviceInfoNext; 01301 continue; 01302 } 01303 } 01304 pDeviceInfo->usActions &= ~GDIAF_RECONNECT; 01305 01306 } else { 01307 /* 01308 * If the Open failed, we free the device here, and move on to 01309 * the next device. 01310 * Assert to catch re-open failure upon RemoveCancelled. 01311 */ 01312 #if DBG 01313 if ((usOriginalActions & GDIAF_ARRIVED) == 0) { 01314 RIPMSG2(RIP_WARNING, "Re-Open %#p failed status %x during RemoveCancelled", 01315 pDeviceInfo, pDeviceInfo->OpenStatus); 01316 } 01317 #endif 01318 pDeviceInfo = FreeDeviceInfo(pDeviceInfo); 01319 continue; 01320 } 01321 } 01322 01323 /* 01324 * RemoveComplete: 01325 * Close the file object, if you have not already done so, Unregister. 01326 * FreeDeviceInfo here (which will actually request a free from the 01327 * reader or the PnP requestor thread), and move on to the next device. 01328 */ 01329 if (pDeviceInfo->usActions & GDIAF_DEPARTED) { 01330 pDeviceInfo->usActions &= ~GDIAF_DEPARTED; 01331 #if DBG 01332 nChanges++; 01333 #endif 01334 TAGMSG1(DBGTAG_PNP, "RemoveComplete: %lx (process %#x)", pDeviceInfo); 01335 CloseDevice(pDeviceInfo); 01336 UnregisterForDeviceChangeNotifications(pDeviceInfo); 01337 pDeviceInfo = FreeDeviceInfo(pDeviceInfo); 01338 continue; 01339 } 01340 01341 if (pDeviceInfo->usActions & GDIAF_IME_STATUS) { 01342 pDeviceInfo->usActions &= ~GDIAF_IME_STATUS; 01343 #if DBG 01344 nChanges++; 01345 #endif 01346 if ((pDeviceInfo->type == DEVICE_TYPE_KEYBOARD) && (pDeviceInfo->handle)) { 01347 if (FUJITSU_KBD_CONSOLE(pDeviceInfo->keyboard.Attr.KeyboardIdentifier) || 01348 (gbRemoteSession && 01349 FUJITSU_KBD_REMOTE(gRemoteClientKeyboardType)) 01350 ) { 01351 /* 01352 * Fill up the KEYBOARD_IME_STATUS structure. 01353 */ 01354 ZwDeviceIoControlFile(pDeviceInfo->handle, NULL, NULL, NULL, 01355 &giosbKbdControl, IOCTL_KEYBOARD_SET_IME_STATUS, 01356 (PVOID)&gKbdImeStatus, sizeof(gKbdImeStatus), NULL, 0); 01357 } 01358 } 01359 } 01360 01361 if (pDeviceInfo->usActions & GDIAF_RETRYREAD) { 01362 PDEVICEINFO pDeviceInfoNext; 01363 pDeviceInfo->usActions &= ~GDIAF_RETRYREAD; 01364 UserAssert(pDeviceInfo->ReadStatus == STATUS_INSUFFICIENT_RESOURCES); 01365 #if DBG 01366 timeStartReadPrev = pDeviceInfo->timeStartRead; 01367 #endif 01368 TAGMSG2(DBGTAG_PNP, "Retry Read %#p after %lx ticks", 01369 pDeviceInfo, pDeviceInfo->timeStartRead - timeStartReadPrev); 01370 pDeviceInfoNext = StartDeviceRead(pDeviceInfo); 01371 if (pDeviceInfoNext) { 01372 /* 01373 * pDeviceInfo wasa freed, move onto the next 01374 */ 01375 pDeviceInfo = pDeviceInfoNext; 01376 continue; 01377 } 01378 } 01379 01380 /* 01381 * Gather summary information on open devices 01382 */ 01383 if (pDeviceInfo->handle) { 01384 switch (pDeviceInfo->type) { 01385 case DEVICE_TYPE_MOUSE: 01386 UserAssert(PtiCurrentShared() == gTermIO.ptiDesktop); 01387 if (pDeviceInfo->usActions & GDIAF_REFRESH_MOUSE) { 01388 pDeviceInfo->usActions &= ~GDIAF_REFRESH_MOUSE; 01389 #if DBG 01390 nChanges++; 01391 #endif 01392 } 01393 nMice++; 01394 nMaxButtons = max(nMaxButtons, pDeviceInfo->mouse.Attr.NumberOfButtons); 01395 switch(pDeviceInfo->mouse.Attr.MouseIdentifier) { 01396 case WHEELMOUSE_I8042_HARDWARE: 01397 case WHEELMOUSE_SERIAL_HARDWARE: 01398 case WHEELMOUSE_HID_HARDWARE: 01399 nWheels++; 01400 } 01401 break; 01402 01403 case DEVICE_TYPE_KEYBOARD: 01404 UserAssert(PtiCurrentShared() == gptiRit); 01405 { 01406 NTSTATUS Status; 01407 // BUG BUG: why query each keyboard for indicators? They should all 01408 // be the same. 01409 #ifdef DIAGNOSE_IO 01410 gKbdIoctlLEDSStatus = 01411 #endif 01412 Status = ZwDeviceIoControlFile(pDeviceInfo->handle, NULL, NULL, NULL, 01413 &giosbKbdControl, IOCTL_KEYBOARD_QUERY_INDICATORS, 01414 NULL, 0, 01415 (PVOID)&gklpBootTime, sizeof(gklpBootTime)); 01416 UserAssertMsg2(NT_SUCCESS(Status), 01417 "IOCTL_KEYBOARD_QUERY_INDICATORS failed: DeviceInfo %#x, Status %#x", 01418 pDeviceInfo, Status); 01419 // BUG BUG, Don't handle multiple keyboards properly: the last 01420 // keyboard on the list is the one whose attributes we report! 01421 gKeyboardInfo = pDeviceInfo->keyboard.Attr; 01422 } 01423 nKeyboards++; 01424 break; 01425 01426 default: 01427 // Add code for a new type of input device here 01428 RIPMSG2(RIP_ERROR, "pDeviceInfo %#p has strange type %d", 01429 pDeviceInfo, pDeviceInfo->type); 01430 break; 01431 } 01432 } 01433 01434 /* 01435 * Notify the PnP thread that a change has been completed 01436 */ 01437 if (usOriginalActions & GDIAF_PNPWAITING) { 01438 KeSetEvent(pDeviceInfo->pkeHidChangeCompleted, EVENT_INCREMENT, FALSE); 01439 } 01440 01441 pDeviceInfo = pDeviceInfo->pNext; 01442 } 01443 01444 ENDATOMICDEVICEINFOLISTCHECK(); 01445 LeaveDeviceInfoListCrit(); 01446 01447 01448 switch (DeviceType) { 01449 case DEVICE_TYPE_MOUSE: 01450 /* 01451 * Apply summary information for Mice 01452 */ 01453 if (nMice) { 01454 if (gnMice == 0) { 01455 /* 01456 * We had no mouse before but we have one now: add a cursor 01457 */ 01458 SET_GTERMF(GTERMF_MOUSE); 01459 SYSMET(MOUSEPRESENT) = TRUE; 01460 SetGlobalCursorLevel(0); 01461 UserAssert(PpiFromProcess(gpepCSRSS)->ptiList->iCursorLevel == 0); 01462 UserAssert(PpiFromProcess(gpepCSRSS)->ptiList->pq->iCursorLevel == 0); 01463 GreMovePointer(gpDispInfo->hDev, gpsi->ptCursor.x, gpsi->ptCursor.y); 01464 } 01465 } else { 01466 if (gnMice != 0) { 01467 /* 01468 * We had a mouse before but we don't now: remove the cursor 01469 */ 01470 CLEAR_GTERMF(GTERMF_MOUSE); 01471 SYSMET(MOUSEPRESENT) = FALSE; 01472 SetGlobalCursorLevel(-1); 01473 /* 01474 * Don't leave mouse buttons stuck down, clear the global button 01475 * state here, otherwise weird stuff might happen. 01476 * Also do this in Alt-Tab processing and zzzCancelJournalling. 01477 */ 01478 #if DBG 01479 if (gwMouseOwnerButton) 01480 RIPMSG1(RIP_WARNING, 01481 "gwMouseOwnerButton=%x, being cleared forcibly\n", 01482 gwMouseOwnerButton); 01483 #endif 01484 gwMouseOwnerButton = 0; 01485 } 01486 } 01487 /* 01488 * Mouse button count represents the number of buttons on the mouse with 01489 * the most buttons. 01490 */ 01491 SYSMET(CMOUSEBUTTONS) = nMaxButtons; 01492 SYSMET(MOUSEWHEELPRESENT) = (nWheels > 0); 01493 gnMice = nMice; 01494 break; 01495 01496 case DEVICE_TYPE_KEYBOARD: 01497 /* 01498 * Apply summary information for Keyboards 01499 */ 01500 01501 if (nKeyboards > gnKeyboards) { 01502 /* 01503 * We have more keyboards, let set their LEDs properly 01504 */ 01505 UpdateKeyLights(FALSE); 01506 } 01507 01508 if ((nKeyboards != 0) && (gnKeyboards == 0)) { 01509 /* 01510 * We had no keyboard but we have one now: set the system hotkeys. 01511 */ 01512 SetDebugHotKeys(); 01513 } 01514 gnKeyboards = nKeyboards; 01515 break; 01516 01517 default: 01518 break; 01519 } 01520 01521 ENDATOMICCHECK(); 01522 }

VOID ProcessKeyboardInput PDEVICEINFO  pDeviceInfo  ) 
 

Definition at line 2615 of file ntinput.c.

References AccessProceduresStream(), ACCF_ACCESSENABLED, BYTE, tagKEYBOARD_DEVICE_INFO::Data, DEVICE_TYPE_KEYBOARD, EnterCrit, FALSE, gAccessTimeOut, gafRawKeyState, gbRemoteSession, gCurrentModifierBit, gfEnableWindowsKey, gPhysModifierState, gpScancodeMap, gSetLedReceived, gtmridAccessTimeOut, InternalSetTimer(), tagDEVICEINFO::keyboard, LeaveCrit, MapScancode(), NULL, PBYTE, RemoteSyncToggleKeys(), TEST_ACCESSFLAG, TEST_ACCF, UINT, UserBeep(), VKFromVSC(), VOID(), xxxAccessTimeOutTimer(), and xxxProcessKeyEvent().

02616 { 02617 BYTE Vk; 02618 BYTE bPrefix; 02619 KE ke; 02620 PKEYBOARD_INPUT_DATA pkei; 02621 PKEYBOARD_INPUT_DATA pkeiStart, pkeiEnd; 02622 02623 EnterCrit(); 02624 UserAssert(pDeviceInfo->type == DEVICE_TYPE_KEYBOARD); 02625 02626 pkeiStart = pDeviceInfo->keyboard.Data; 02627 pkeiEnd = (PKEYBOARD_INPUT_DATA)((PBYTE)pkeiStart + pDeviceInfo->iosb.Information); 02628 for (pkei = pkeiStart; pkei < pkeiEnd; pkei++) { 02629 02630 /* 02631 * Remote terminal server clients occationally need to be able to set 02632 * the server's toggle key state to match the client. All other 02633 * standard keyboard inputs are processed below since this is the most 02634 * frequent code path. 02635 */ 02636 if (!(pkei->Flags & KEY_TERMSRV_SET_LED)) { 02637 02638 // Process any deferred remote key sync requests 02639 if (!(gSetLedReceived & KEYBOARD_LED_INJECTED)) 02640 goto ProcessKeys; 02641 else 02642 RemoteSyncToggleKeys(gSetLedReceived); 02643 02644 ProcessKeys: 02645 if (pkei->Flags & KEY_E0) { 02646 bPrefix = 0xE0; 02647 } else if (pkei->Flags & KEY_E1) { 02648 bPrefix = 0xE1; 02649 } else { 02650 bPrefix = 0; 02651 } 02652 02653 if (pkei->MakeCode == 0xFF) { 02654 /* 02655 * Kbd overrun (kbd hardware and/or keyboard driver) : Beep! 02656 * (some DELL keyboards send 0xFF if keys are hit hard enough, 02657 * presumably due to keybounce) 02658 */ 02659 LeaveCrit(); 02660 UserBeep(440, 125); 02661 EnterCrit(); 02662 continue; 02663 } 02664 02665 ke.bScanCode = (BYTE)(pkei->MakeCode & 0x7F); 02666 if (gpScancodeMap) { 02667 MapScancode(&ke.bScanCode, &bPrefix); 02668 } 02669 02670 Vk = VKFromVSC(&ke, bPrefix, gafRawKeyState); 02671 02672 if (Vk == 0) { 02673 continue; 02674 } 02675 02676 if (pkei->Flags & KEY_BREAK) { 02677 ke.usFlaggedVk |= KBDBREAK; 02678 } 02679 02680 02681 /* 02682 * We don't know if the client system or the host should get the 02683 * windows key, so the choice is to not support it on the host. 02684 * (The windows key is a local key.) 02685 * 02686 * The other practical problem is that the local shell intercepts 02687 * the "break" of the windows key and switches to the start menu. 02688 * The client never sees the "break" so the host thinks the 02689 * windows key is always depressed. 02690 * 02691 * Newer clients may indicate they support the windows key. 02692 * If the client has indicated this through the gfEnableWindowsKey, 02693 * then we allow it to be processed here on the host. 02694 */ 02695 if (gbRemoteSession) { 02696 BYTE CheckVk = (BYTE)ke.usFlaggedVk; 02697 02698 if (CheckVk == VK_LWIN || CheckVk == VK_RWIN) 02699 if ( !gfEnableWindowsKey ) 02700 continue; 02701 } 02702 02703 // 02704 // Keep track of real modifier key state. Conveniently, the values for 02705 // VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU and 02706 // VK_RMENU are contiguous. We'll construct a bit field to keep track 02707 // of the current modifier key state. If a bit is set, the corresponding 02708 // modifier key is down. The bit field has the following format: 02709 // 02710 // +---------------------------------------------------+ 02711 // | Right | Left | Right | Left | Right | Left | 02712 // | Alt | Alt | Control | Control | Shift | Shift | 02713 // +---------------------------------------------------+ 02714 // 5 4 3 2 1 0 Bit 02715 // 02716 // Add bit 7 -- VK_RWIN 02717 // bit 6 -- VK_LWIN 02718 02719 switch (Vk) { 02720 case VK_LSHIFT: 02721 case VK_RSHIFT: 02722 case VK_LCONTROL: 02723 case VK_RCONTROL: 02724 case VK_LMENU: 02725 case VK_RMENU: 02726 gCurrentModifierBit = 1 << (Vk & 0xf); 02727 break; 02728 case VK_LWIN: 02729 gCurrentModifierBit = 0x40; 02730 break; 02731 case VK_RWIN: 02732 gCurrentModifierBit = 0x80; 02733 break; 02734 default: 02735 gCurrentModifierBit = 0; 02736 } 02737 if (gCurrentModifierBit) { 02738 /* 02739 * If this is a break of a modifier key then clear the bit value. 02740 * Otherwise, set it. 02741 */ 02742 if (pkei->Flags & KEY_BREAK) { 02743 gPhysModifierState &= ~gCurrentModifierBit; 02744 } else { 02745 gPhysModifierState |= gCurrentModifierBit; 02746 } 02747 } 02748 02749 if (!TEST_ACCF(ACCF_ACCESSENABLED)) { 02750 xxxProcessKeyEvent(&ke, (ULONG_PTR)pkei->ExtraInformation, FALSE); 02751 } else { 02752 if ((gtmridAccessTimeOut != 0) && TEST_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON)) { 02753 gtmridAccessTimeOut = InternalSetTimer( 02754 NULL, 02755 gtmridAccessTimeOut, 02756 (UINT)gAccessTimeOut.iTimeOutMSec, 02757 xxxAccessTimeOutTimer, 02758 TMRF_RIT | TMRF_ONESHOT 02759 ); 02760 } 02761 if (AccessProceduresStream(&ke, pkei->ExtraInformation, 0)) { 02762 xxxProcessKeyEvent(&ke, (ULONG_PTR)pkei->ExtraInformation, FALSE); 02763 } 02764 } 02765 } 02766 02767 // Special toggle key synchronization for Terminal Server 02768 else { 02769 RemoteSyncToggleKeys(pkei->ExtraInformation); 02770 } 02771 } 02772 02773 LeaveCrit(); 02774 }

VOID ProcessMouseInput PDEVICEINFO  pDeviceInfo  ) 
 

Definition at line 1137 of file ntinput.c.

References ACCF_ACCESSENABLED, tagMOUSE_DEVICE_INFO::Attr, CheckCritOut, CheckDeviceInfoListCritOut, tagMOUSE_DEVICE_INFO::Data, EnterCrit, fAbsoluteMouse, FALSE, FKMOUSEMOVE, gbRemoteSession, GDIAF_REFRESH_MOUSE, GetMouseCoord(), gFilterKeysState, gMouseProcessMiceInputTime, gptCursorAsync, gptiBlockInput, gStickyKeysLeftShiftCount, gStickyKeysRightShiftCount, gTermIO, gTermNOIO, gtmridFKActivation, KILLRITTIMER, LeaveCrit, LOGTIME, tagDEVICEINFO::mouse, NT_SUCCESS, NtGetTickCount(), NULL, PtiCurrentShared, tagTERMINAL::ptiDesktop, QueueMouseEvent(), RequestDeviceChange(), TEST_ACCF, VOID(), and xxxMoveEventAbsolute().

01139 { 01140 PMOUSE_INPUT_DATA pmei, pmeiNext; 01141 LONG time; 01142 POINT ptLastMove; 01143 01144 /* 01145 * This is an APC, so we don't need the DeviceInfoList Critical Section 01146 * In fact, we don't want it either. We will not remove the device until 01147 * ProcessMouseInput has signalled that it is OK to do so. (TBD) 01148 */ 01149 CheckCritOut(); 01150 CheckDeviceInfoListCritOut(); 01151 01152 UserAssert(pMouseInfo); 01153 UserAssert((PtiCurrentShared() == gTermIO.ptiDesktop) || 01154 (PtiCurrentShared() == gTermNOIO.ptiDesktop)); 01155 01156 LOGTIME(gMouseProcessMiceInputTime); 01157 01158 if (gptiBlockInput != NULL) { 01159 return; 01160 } 01161 01162 if (TEST_ACCF(ACCF_ACCESSENABLED)) { 01163 /* 01164 * Any mouse movement resets the count of consecutive shift key 01165 * presses. The shift key is used to enable & disable the 01166 * stickykeys accessibility functionality. 01167 */ 01168 gStickyKeysLeftShiftCount = 0; 01169 gStickyKeysRightShiftCount = 0; 01170 01171 /* 01172 * Any mouse movement also cancels the FilterKeys activation timer. 01173 * Entering critsect here breaks non-jerky mouse movement 01174 */ 01175 if (gtmridFKActivation != 0) { 01176 EnterCrit(); 01177 KILLRITTIMER(NULL, gtmridFKActivation); 01178 gtmridFKActivation = 0; 01179 gFilterKeysState = FKMOUSEMOVE; 01180 LeaveCrit(); 01181 return; 01182 } 01183 } 01184 01185 if (!NT_SUCCESS(pMouseInfo->iosb.Status)) { 01186 /* 01187 * If we get a bad status, we abandon reading this mouse. 01188 */ 01189 if (!gbRemoteSession) 01190 if (pMouseInfo->iosb.Status != STATUS_DELETE_PENDING) { 01191 RIPMSG3(RIP_ERROR, "iosb.Status %lx for mouse %#p (id %x) tell IanJa x63321", 01192 pMouseInfo->iosb.Status, 01193 pMouseInfo, pMouseInfo->mouse.Attr.MouseIdentifier); 01194 } 01195 return; 01196 } 01197 01198 /* 01199 * get the last move point from ptCursorAsync 01200 */ 01201 ptLastMove = gptCursorAsync; 01202 01203 pmei = pMouseInfo->mouse.Data; 01204 while (pmei != NULL) { 01205 01206 time = NtGetTickCount(); 01207 01208 /* 01209 * Figure out where the next event is. 01210 */ 01211 pmeiNext = pmei + 1; 01212 if ((PUCHAR)pmeiNext >= 01213 (PUCHAR)(((PUCHAR)pMouseInfo->mouse.Data) + pMouseInfo->iosb.Information)) { 01214 01215 /* 01216 * If there isn't another event set pmeiNext to 01217 * NULL so we exit the loop and don't get confused. 01218 */ 01219 pmeiNext = NULL; 01220 } 01221 01222 /* 01223 * If a PS/2 mouse was plugged in, evaluate the (new) mouse and 01224 * the skip the input record. 01225 */ 01226 if (pmei->Flags & MOUSE_ATTRIBUTES_CHANGED) { 01227 RequestDeviceChange(pMouseInfo, GDIAF_REFRESH_MOUSE, FALSE); 01228 goto NextMouseInputRecord; 01229 } 01230 01231 /* 01232 * First process any mouse movement that occured. 01233 * It is important to process movement before button events, otherwise 01234 * absolute coordinate pointing devices like touch-screens and tablets 01235 * will produce button clicks at old coordinates. 01236 */ 01237 if (pmei->LastX || pmei->LastY) { 01238 01239 /* 01240 * Get the actual point that will be injected. 01241 */ 01242 GetMouseCoord(pmei->LastX, 01243 pmei->LastY, 01244 pmei->Flags, 01245 time, 01246 pmei->ExtraInformation, 01247 &ptLastMove); 01248 01249 /* 01250 * If this is a move-only event, and the next one is also a 01251 * move-only event, skip/coalesce it. 01252 */ 01253 if ( (pmeiNext != NULL) && 01254 (pmei->ButtonFlags == 0) && 01255 (pmeiNext->ButtonFlags == 0) && 01256 (fAbsoluteMouse(pmei) == fAbsoluteMouse(pmeiNext))) { 01257 01258 pmei = pmeiNext; 01259 01260 continue; 01261 } 01262 01263 /* 01264 * Moves the cursor on the screen and updates gptCursorAsync 01265 * Call directly xxxMoveEventAbsolute because we already did the 01266 * acceleration sensitivity and clipping. 01267 */ 01268 xxxMoveEventAbsolute( 01269 ptLastMove.x, 01270 ptLastMove.y, 01271 pmei->ExtraInformation, 01272 time, 01273 FALSE 01274 ); 01275 01276 /* 01277 * Now update ptLastMove with ptCursorAsync because ptLastMove 01278 * doesn't reflect the clipping. 01279 */ 01280 ptLastMove = gptCursorAsync; 01281 } 01282 01283 /* 01284 * Queue mouse event for the other thread to pick up when it finishes 01285 * with the USER critical section. 01286 * If pmeiNext == NULL, there is no more mouse input yet, so wake RIT. 01287 */ 01288 QueueMouseEvent( 01289 pmei->ButtonFlags, 01290 pmei->ButtonData, 01291 pmei->ExtraInformation, 01292 gptCursorAsync, 01293 time, 01294 FALSE, 01295 (pmeiNext == NULL)); 01296 01297 NextMouseInputRecord: 01298 pmei = pmeiNext; 01299 } 01300 01301 return; 01302 }

void ProcessUpdateKeyStateEvent PQ  pq,
CONST PBYTE  pbKeyState,
CONST PBYTE  pbRecentDown
 

Definition at line 1996 of file ntuser/kernel/input.c.

References BYTE, CBKEYSTATERECENTDOWN, ClearKeyStateDown, ClearKeyStateToggle, gafAsyncKeyState, gpsi, SetKeyStateDown, SetKeyStateToggle, TestKeyDownBit, TestKeyRecentDownBit, and TestKeyToggleBit.

Referenced by PostUpdateKeyStateEvent(), and xxxProcessEventMessage().

02000 { 02001 int i, j; 02002 BYTE *pbChange; 02003 int vk; 02004 02005 pbChange = pbRecentDown; 02006 for (i = 0; i < CBKEYSTATERECENTDOWN; i++, pbChange++) { 02007 02008 /* 02009 * Find some keys that have changed. 02010 */ 02011 if (*pbChange == 0) 02012 continue; 02013 02014 /* 02015 * Some keys have changed in this byte. find out which key it is. 02016 */ 02017 for (j = 0; j < 8; j++) { 02018 02019 /* 02020 * Convert our counts to a virtual key index and check to see 02021 * if this key has changed. 02022 */ 02023 vk = (i << 3) + j; 02024 if (!TestKeyRecentDownBit(pbRecentDown, vk)) 02025 continue; 02026 02027 /* 02028 * This key has changed. Update it's state in the thread key 02029 * state table. 02030 */ 02031 02032 if (TestKeyDownBit(pbKeyState, vk)) { 02033 SetKeyStateDown(pq, vk); 02034 } else { 02035 ClearKeyStateDown(pq, vk); 02036 } 02037 02038 if (TestKeyToggleBit(pbKeyState, vk)) { 02039 SetKeyStateToggle(pq, vk); 02040 } else { 02041 ClearKeyStateToggle(pq, vk); 02042 } 02043 } 02044 } 02045 02046 /* 02047 * Update the key cache index. 02048 */ 02049 gpsi->dwKeyCache++; 02050 02051 /* 02052 * All updated. Free the key state table if it was posted as an Event Message 02053 */ 02054 if (pbKeyState != gafAsyncKeyState) { 02055 UserFreePool(pbKeyState); 02056 } 02057 }

NTSTATUS ProtectHandle IN HANDLE  Handle,
IN BOOLEAN  Protect
 

Definition at line 464 of file ex.c.

References Handle, NT_SUCCESS, NTSTATUS(), NULL, and Status.

Referenced by RtlInitializeCriticalSectionAndSpinCount(), RtlpCreateCriticalSectionSem(), xxxCreateThreadInfo(), and xxxDestroyThreadInfo().

00467 { 00468 OBJECT_HANDLE_FLAG_INFORMATION HandleInfo; 00469 NTSTATUS Status; 00470 00471 Status = ZwQueryObject( 00472 Handle, 00473 ObjectHandleFlagInformation, 00474 &HandleInfo, 00475 sizeof(HandleInfo), 00476 NULL); 00477 if (NT_SUCCESS(Status)) { 00478 HandleInfo.ProtectFromClose = Protect; 00479 00480 Status = ZwSetInformationObject( 00481 Handle, 00482 ObjectHandleFlagInformation, 00483 &HandleInfo, 00484 sizeof(HandleInfo)); 00485 } 00486 00487 return Status; 00488 }

PTHREADINFO PtiFromThreadId DWORD  idThread  ) 
 

Definition at line 4737 of file queue.c.

References FALSE, LockThreadByClientId(), NT_SUCCESS, NULL, PsIsThreadTerminating, PtiFromThread, tagTHREADINFO::TIF_flags, TIF_GUITHREADINITIALIZED, TIF_INCLEANUP, and UnlockThread.

Referenced by _SetWinEventHook(), NtUserAttachThreadInput(), NtUserBuildHimcList(), NtUserBuildHwndList(), NtUserDisableThreadIme(), NtUserGetGUIThreadInfo(), NtUserGetThreadState(), NtUserPostThreadMessage(), NtUserSetWindowsHookEx(), UT_CaretSet(), xxxConsoleControl(), xxxDirectedYield(), xxxGetThreadDesktop(), and zzzAttachThreadInput().

04739 { 04740 PETHREAD pEThread; 04741 PTHREADINFO pti; 04742 04743 /* 04744 * BUG BUG: Pretty much every place else we do call LockThreadByClientId 04745 * while outside the user critical section so we don't cause any 04746 * potential deadlock in the kernel. 04747 * It's too late to change it now. 2/17/99 04748 */ 04749 04750 if (!NT_SUCCESS(LockThreadByClientId((HANDLE)LongToHandle( dwThreadId ), &pEThread))) 04751 return NULL; 04752 04753 /* 04754 * If the thread is not terminating, look up the pti. This is 04755 * needed because the value returned by PtiFromThread() is 04756 * undefined if the thread is terminating. See PspExitThread in 04757 * ntos\ps\psdelete.c. 04758 */ 04759 if (!PsIsThreadTerminating(pEThread)) { 04760 pti = PtiFromThread(pEThread); 04761 } else { 04762 pti = NULL; 04763 } 04764 04765 /* 04766 * Do a sanity check on the pti to make sure it's really valid. 04767 */ 04768 if (pti != NULL) { 04769 try { 04770 if (pti->pEThread->Cid.UniqueThread != (HANDLE)LongToHandle( dwThreadId )) { 04771 pti = NULL; 04772 } else if (!(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) { 04773 RIPMSG1(RIP_WARNING, "PtiFromThreadId: pti %#p not initialized", pti); 04774 pti = NULL; 04775 } else if (pti->TIF_flags & TIF_INCLEANUP) { 04776 RIPMSG1(RIP_WARNING, "PtiFromThreadId: pti %#p in cleanup", pti); 04777 pti = NULL; 04778 } 04779 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 04780 pti = NULL; 04781 } 04782 } 04783 04784 UnlockThread(pEThread); 04785 04786 return pti; 04787 }

BOOL QueryTrackMouseEvent LPTRACKMOUSEEVENT  lpTME  ) 
 

Definition at line 2679 of file ntuser/kernel/input.c.

References BOOL, DF_TRACKMOUSEEVENT, DF_TRACKMOUSEHOVER, DF_TRACKMOUSELEAVE, tagDESKTOP::dwDTFlags, tagDESKTOP::dwMouseHoverTime, GETPTI, tagDESKTOP::htEx, HWq, tagTHREADINFO::pq, PtiCurrent, tagTHREADINFO::rpdesk, tagDESKTOP::spwndTrack, and TRUE.

Referenced by NtUserTrackMouseEvent().

02681 { 02682 PTHREADINFO ptiCurrent = PtiCurrent(); 02683 PDESKTOP pdesk = ptiCurrent->rpdesk; 02684 02685 /* 02686 * initialize the struct 02687 */ 02688 RtlZeroMemory(lpTME, sizeof(*lpTME)); 02689 lpTME->cbSize = sizeof(*lpTME); 02690 /* 02691 * Bail if not tracking any mouse event 02692 * or if the current thread is not in spwndTrack's queue 02693 */ 02694 if (!(pdesk->dwDTFlags & DF_TRACKMOUSEEVENT) 02695 || (ptiCurrent->pq != GETPTI(pdesk->spwndTrack)->pq)) { 02696 return TRUE; 02697 } 02698 /* 02699 * fill in the requested information 02700 */ 02701 if (pdesk->htEx != HTCLIENT) { 02702 lpTME->dwFlags |= TME_NONCLIENT; 02703 } 02704 if (pdesk->dwDTFlags & DF_TRACKMOUSELEAVE) { 02705 lpTME->dwFlags |= TME_LEAVE; 02706 } 02707 if (pdesk->dwDTFlags & DF_TRACKMOUSEHOVER) { 02708 lpTME->dwFlags |= TME_HOVER; 02709 lpTME->dwHoverTime = pdesk->dwMouseHoverTime; 02710 } 02711 02712 lpTME->hwndTrack = HWq(pdesk->spwndTrack); 02713 02714 return TRUE; 02715 }

VOID QueueMouseEvent USHORT  ButtonFlags,
USHORT  ButtonData,
ULONG_PTR  ExtraInfo,
POINT  ptMouse,
LONG  time,
BOOL  bInjected,
BOOL  bWakeRIT
 

Definition at line 925 of file ntinput.c.

References tagMOUSEEVENT::bInjected, tagMOUSEEVENT::ButtonData, tagMOUSEEVENT::ButtonFlags, CheckCritOut, EnterMouseCrit(), EVENT_INCREMENT, tagMOUSEEVENT::ExtraInfo, FALSE, gdwMouseEvents, gdwMouseQueueHead, gMouseEventQueue, gMouseQueueMouseEventTime, gpkeMouseData, KeSetEvent(), LeaveMouseCrit(), LOGTIME, NELEM_BUTTONQUEUE, tagMOUSEEVENT::ptPointer, tagMOUSEEVENT::time, UserBeep(), and VOID().

Referenced by ProcessMouseInput(), xxxMKMouseMove(), xxxMKMoveAccelCursorTimer(), xxxMKMoveConstCursorTimer(), and xxxMouseEventDirect().

00934 { 00935 CheckCritOut(); 00936 00937 EnterMouseCrit(); 00938 00939 LOGTIME(gMouseQueueMouseEventTime); 00940 00941 /* 00942 * Button data must always be accompanied by a flag to interpret it. 00943 */ 00944 UserAssert(ButtonData == 0 || ButtonFlags != 0); 00945 00946 /* 00947 * We can coalesce this mouse event with the previous event if there is a 00948 * previous event, and if the previous event and this event involve no 00949 * key transitions. 00950 */ 00951 if ((gdwMouseEvents == 0) || 00952 (ButtonFlags != 0) || 00953 (gMouseEventQueue[gdwMouseQueueHead].ButtonFlags != 0)) { 00954 /* 00955 * Can't coalesce: must add a new mouse event 00956 */ 00957 if (gdwMouseEvents >= NELEM_BUTTONQUEUE) { 00958 /* 00959 * But no more room! 00960 */ 00961 LeaveMouseCrit(); 00962 UserBeep(440, 125); 00963 return; 00964 } 00965 00966 gdwMouseQueueHead = (gdwMouseQueueHead + 1) % NELEM_BUTTONQUEUE; 00967 gMouseEventQueue[gdwMouseQueueHead].ButtonFlags = ButtonFlags; 00968 gMouseEventQueue[gdwMouseQueueHead].ButtonData = ButtonData; 00969 gdwMouseEvents++; 00970 } 00971 00972 gMouseEventQueue[gdwMouseQueueHead].ExtraInfo = ExtraInfo; 00973 gMouseEventQueue[gdwMouseQueueHead].ptPointer = ptMouse; 00974 gMouseEventQueue[gdwMouseQueueHead].time = time; 00975 gMouseEventQueue[gdwMouseQueueHead].bInjected = bInjected; 00976 00977 LeaveMouseCrit(); 00978 00979 if (bWakeRIT) { 00980 /* 00981 * Signal RIT to complete the mouse input processing 00982 */ 00983 KeSetEvent(gpkeMouseData, EVENT_INCREMENT, FALSE); 00984 } 00985 }

void QueueNotifyMessage PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 969 of file kernel/sendmsg.c.

Referenced by CancelInputState(), DoQueuedSyncPaint(), xxxActivateApp(), xxxResetDisplayDevice(), and xxxSendBSMtoDesktop().

00987 {

VOID ReceiverDied PSMS  psms,
PSMS ppsmsUnlink
 

Referenced by InterQueueMsgCleanup(), and SendMsgCleanup().

VOID RecolorDeskPattern  ) 
 

Referenced by xxxSetDeskPattern(), and xxxSetSysColors().

BOOL RecreateRedirectionBitmap PWND  pwnd  ) 
 

Definition at line 337 of file sprite.c.

References _GetProp(), BOOL, CreateRedirectionBitmap(), cy, tagDCE::DCX_flags, DeleteRedirectionBitmap(), FALSE, FLayeredOrRedirected(), GetTopLevelWindow(), ghdcMem, ghdcMem2, gpDispInfo, tagDCE::hdc, tagDISPLAYINFO::hDev, min, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PROP_LAYER, tagDCE::pwndOrg, RemoveRedirectionBitmap(), and TRUE.

Referenced by UserRecreateRedirectionBitmap(), and zzzChangeStates().

00338 { 00339 HBITMAP hbm, hbmNew, hbmMem, hbmMem2; 00340 BITMAP bm, bmNew; 00341 int cx, cy; 00342 PDCE pdce; 00343 00344 UserAssert(FLayeredOrRedirected(pwnd)); 00345 00346 /* 00347 * No need to do anything if this layered window doesn't have 00348 * a redirection bitmap. 00349 */ 00350 if ((hbm = (HBITMAP)_GetProp(pwnd, PROP_LAYER, TRUE)) == NULL) 00351 return FALSE; 00352 00353 /* 00354 * Try to create a new redirection bitmap with the new size. If failed, 00355 * delete the old one and remove it from the window property list. 00356 */ 00357 if ((hbmNew = CreateRedirectionBitmap(pwnd)) == NULL) { 00358 RemoveRedirectionBitmap(pwnd); 00359 return FALSE; 00360 } 00361 00362 /* 00363 * Make sure that the display is locked, so that nobody can be drawing 00364 * into the redirection DCs while we're switching bitmaps under them. 00365 */ 00366 UserAssert(GreIsDisplayLocked(gpDispInfo->hDev)); 00367 00368 /* 00369 * Get the size of the old bitmap to know how much to copy. 00370 */ 00371 GreExtGetObjectW(hbm, sizeof(bm), (LPSTR)&bm); 00372 GreExtGetObjectW(hbmNew, sizeof(bmNew), (LPSTR)&bmNew); 00373 00374 /* 00375 * Copy the bitmap from the old bitmap into the new one. 00376 */ 00377 hbmMem = GreSelectBitmap(ghdcMem, hbm); 00378 hbmMem2 = GreSelectBitmap(ghdcMem2, hbmNew); 00379 00380 cx = min(bm.bmWidth, bmNew.bmWidth); 00381 cy = min(bm.bmHeight, bmNew.bmHeight); 00382 00383 GreBitBlt(ghdcMem2, 0, 0, cx, cy, ghdcMem, 0, 0, SRCCOPY | NOMIRRORBITMAP, 0); 00384 00385 /* 00386 * Find layered DCs that are in use corresponding to this window and 00387 * replace the old redirection bitmap by the new one. 00388 */ 00389 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 00390 00391 if (!(pdce->DCX_flags & DCX_LAYERED) || !(pdce->DCX_flags & DCX_INUSE)) 00392 continue; 00393 00394 if (GetTopLevelWindow(pdce->pwndOrg) != pwnd) 00395 continue; 00396 00397 UserVerify(GreSelectRedirectionBitmap(pdce->hdc, hbmNew)); 00398 } 00399 00400 GreSelectBitmap(ghdcMem, hbmMem); 00401 GreSelectBitmap(ghdcMem2, hbmMem2); 00402 00403 /* 00404 * Finally, delete the old redirection bitmap. 00405 */ 00406 DeleteRedirectionBitmap(hbm); 00407 00408 return TRUE; 00409 }

VOID RecreateSmallIcons PWND  pwnd  ) 
 

BOOL ReferenceClass PCLS  pcls,
PWND  pwnd
 

Definition at line 1645 of file class.c.

References BOOL, ClassAlloc(), ClassFree(), CLS, tagCLS::CSF_flags, CSF_WOWCLASS, tagCLS::cWndReferenceCount, DWORD, FALSE, tagWND::head, Lock, LockDesktop, NULL, tagWND::pcls, tagCLS::pclsClone, tagCLS::pclsNext, tagCLS::rpdeskParent, strlen(), and TRUE.

Referenced by xxxCreateWindowEx().

01648 { 01649 DWORD cbName; 01650 PCLS pclsClone; 01651 PDESKTOP pdesk; 01652 01653 /* 01654 * If the window is on the same desktop as the base class, just 01655 * increment the window count. 01656 */ 01657 if (pcls->rpdeskParent == pwnd->head.rpdesk) { 01658 pcls->cWndReferenceCount++; 01659 return TRUE; 01660 } 01661 01662 /* 01663 * The window is not on the base desktop. Try to find a cloned 01664 * class. 01665 */ 01666 for (pclsClone = pcls->pclsClone; pclsClone != NULL; 01667 pclsClone = pclsClone->pclsNext) { 01668 if (pclsClone->rpdeskParent == pwnd->head.rpdesk) 01669 break; 01670 } 01671 01672 /* 01673 * If we can't find one, clone the base class. 01674 */ 01675 if (pclsClone == NULL) { 01676 pdesk = pwnd->head.rpdesk; 01677 pclsClone = ClassAlloc(pdesk, sizeof(CLS) + pcls->cbclsExtra + (pcls->CSF_flags & CSF_WOWCLASS ?sizeof(WC):0)); 01678 if (pclsClone == NULL) { 01679 RIPMSG0(RIP_WARNING, "ReferenceClass: Failed Clone-Class Allocation\n"); 01680 return FALSE; 01681 } 01682 01683 RtlCopyMemory(pclsClone, pcls, sizeof(CLS) + pcls->cbclsExtra + (pcls->CSF_flags & CSF_WOWCLASS?sizeof(WC):0)); 01684 cbName = strlen(pcls->lpszAnsiClassName) + 1; 01685 pclsClone->lpszAnsiClassName = ClassAlloc(pdesk, cbName); 01686 if (pclsClone->lpszAnsiClassName == NULL) { 01687 ClassFree(pdesk, pclsClone); 01688 RIPMSG0(RIP_WARNING, "ReferenceClass: No Clone Class Name\n"); 01689 return FALSE; 01690 } 01691 01692 /* 01693 * Everything has been allocated, now lock everything down. 01694 * NULL pointers in clone to prevent Lock() from incorrectly 01695 * decrementing object reference count 01696 */ 01697 pclsClone->rpdeskParent = NULL; 01698 LockDesktop(&pclsClone->rpdeskParent, pdesk, 01699 LDL_CLS_DESKPARENT2, (ULONG_PTR)pclsClone); 01700 pclsClone->pclsNext = pcls->pclsClone; 01701 pclsClone->pclsClone = NULL; 01702 pcls->pclsClone = pclsClone; 01703 RtlCopyMemory(pclsClone->lpszAnsiClassName, pcls->lpszAnsiClassName, cbName); 01704 01705 pclsClone->spicn = pclsClone->spicnSm = pclsClone->spcur = NULL; 01706 01707 Lock(&pclsClone->spicn, pcls->spicn); 01708 Lock(&pclsClone->spicnSm, pcls->spicnSm); 01709 Lock(&pclsClone->spcur, pcls->spcur); 01710 pclsClone->spcpdFirst = NULL; 01711 pclsClone->cWndReferenceCount = 0; 01712 } 01713 01714 /* 01715 * Increment reference counts. 01716 */ 01717 pcls->cWndReferenceCount++; 01718 pclsClone->cWndReferenceCount++; 01719 pwnd->pcls = pclsClone; 01720 01721 return TRUE; 01722 }

NTSTATUS ReferenceWindowStation PETHREAD  Thread,
HWINSTA  hwinsta,
ACCESS_MASK  amDesiredAccess,
PWINDOWSTATION ppwinsta,
BOOL  fUseDesktop
 

Definition at line 1366 of file winsta.c.

References AccessCheckObject(), tagPROCESSINFO::amwinsta, ExWindowStationObjectType, KernelMode, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PpiFromProcess, PtiFromThread, RETURN_IF_ACCESS_DENIED, tagTHREADINFO::rpdesk, tagPROCESSINFO::rpwinsta, tagDESKTOP::rpwinstaParent, Status, _ETHREAD::ThreadsProcess, and WinStaMapping.

Referenced by CheckClipboardAccess(), UserGlobalAtomTableCallout(), and xxxSnapWindow().

01372 { 01373 PPROCESSINFO ppi; 01374 PTHREADINFO pti; 01375 PWINDOWSTATION pwinsta = NULL; 01376 NTSTATUS Status; 01377 01378 /* 01379 * We prefer to use the thread's desktop to dictate which 01380 * windowstation/Atom table to use rather than the process. 01381 * This allows NetDDE, which has threads running under 01382 * different desktops on different windowstations but whos 01383 * process is set to only one of these windowstations, to 01384 * get global atoms properly without having to change its 01385 * process windowstation a billion times and synchronize. 01386 */ 01387 ppi = PpiFromProcess(Thread->ThreadsProcess); 01388 pti = PtiFromThread(Thread); 01389 01390 /* 01391 * First, try to get the windowstation from the pti, and then 01392 * from the ppi. 01393 */ 01394 if (ppi != NULL) { 01395 if (!fUseDesktop || pti == NULL || pti->rpdesk == NULL || 01396 ppi->rpwinsta == pti->rpdesk->rpwinstaParent) { 01397 01398 /* 01399 * Use the windowstation assigned to the process. 01400 */ 01401 pwinsta = ppi->rpwinsta; 01402 if (pwinsta != NULL) { 01403 RETURN_IF_ACCESS_DENIED(ppi->amwinsta, amDesiredAccess, 01404 STATUS_ACCESS_DENIED); 01405 } 01406 } 01407 01408 /* 01409 * If we aren't using the process' windowstation, try to 01410 * go through the thread's desktop. 01411 */ 01412 if (pwinsta == NULL && pti != NULL && pti->rpdesk != NULL) { 01413 01414 /* 01415 * Perform access check the parent windowstation. This 01416 * is an expensive operation. 01417 */ 01418 pwinsta = pti->rpdesk->rpwinstaParent; 01419 if (!AccessCheckObject(pwinsta, amDesiredAccess, KernelMode, &WinStaMapping)) 01420 return STATUS_ACCESS_DENIED; 01421 } 01422 } 01423 01424 /* 01425 * If we still don't have a windowstation and a handle was 01426 * passed in, use it. 01427 */ 01428 if (pwinsta == NULL) { 01429 if (hwinsta != NULL) { 01430 Status = ObReferenceObjectByHandle( 01431 hwinsta, 01432 amDesiredAccess, 01433 *ExWindowStationObjectType, 01434 KernelMode, 01435 &pwinsta, 01436 NULL); 01437 if (!NT_SUCCESS(Status)) 01438 return Status; 01439 ObDereferenceObject(pwinsta); 01440 } else { 01441 return STATUS_NOT_FOUND; 01442 } 01443 } 01444 01445 *ppwinsta = pwinsta; 01446 01447 return STATUS_SUCCESS; 01448 }

void RegisterLPK DWORD   ) 
 

Definition at line 2769 of file w32/ntuser/kernel/init.c.

References PpiCurrent, and VOID().

02771 { 02772 PpiCurrent()->dwLpkEntryPoints = dwLpkEntryPoints; 02773 }

VOID RegisterPerUserKeyboardIndicators PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 223 of file keyboard.c.

References FastWriteProfileStringW(), ISTS, L, PMAP_KEYBOARD, TestAsyncKeyStateToggle, and wszInitialKeyboardIndicators.

Referenced by PrepareForLogoff().

00224 { 00225 WCHAR wszInitKbdInd[2] = L"0"; 00226 00227 /* 00228 * Initial Keyboard state (Num-Lock only) 00229 */ 00230 00231 /* 00232 * For HYDRA we do not want to save this as set, since it confuses 00233 * dial in laptop computers. So we force it off in the profile on 00234 * logoff. 00235 */ 00236 if (!ISTS()) { 00237 wszInitKbdInd[0] += TestAsyncKeyStateToggle(VK_NUMLOCK) ? 2 : 0; 00238 } 00239 00240 FastWriteProfileStringW(pProfileUserName, 00241 PMAP_KEYBOARD, 00242 wszInitialKeyboardIndicators, 00243 wszInitKbdInd); 00244 }

UINT ReleaseCacheDC HDC  hdc,
BOOL  fEndPaint
 

Definition at line 1337 of file dc.c.

References DCE_FREED, DCE_NORELEASE, DCE_RELEASED, DCE_SIZE_CACHETHRESHOLD, tagDCE::DCX_flags, DeleteHrgnClip(), DestroyCacheDC(), FALSE, gnDCECount, gpDispInfo, tagDCE::hdc, tagDISPLAYINFO::hDev, IncrementFreeDCECount(), NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagDCE::ptiOwner, UINT, and UpdateLayeredSprite().

Referenced by _ReleaseDC(), xxxEndPaint(), xxxEnumDisplayMonitors(), xxxFreeWindow(), and xxxSendEraseBkgnd().

01340 { 01341 PDCE pdce; 01342 PDCE *ppdce; 01343 01344 for (ppdce = &gpDispInfo->pdceFirst; (pdce = *ppdce); ppdce = &pdce->pdceNext) { 01345 01346 if (pdce->hdc == hdc) { 01347 01348 /* 01349 * Check for redundant releases or release of an invalid entry 01350 */ 01351 if ((pdce->DCX_flags & (DCX_DESTROYTHIS | DCX_INVALID | DCX_INUSE)) != DCX_INUSE) 01352 return DCE_NORELEASE; 01353 01354 /* 01355 * Lock the display since we may be playing with visrgns. 01356 */ 01357 GreLockDisplay(gpDispInfo->hDev); 01358 01359 if (pdce->DCX_flags & DCX_LAYERED) { 01360 UpdateLayeredSprite(pdce); 01361 } 01362 01363 /* 01364 * If this is a permanent DC, then don't reset its state. 01365 */ 01366 if (pdce->DCX_flags & DCX_CACHE) { 01367 /* 01368 * Restore the DC state and mark the entry as not in use. 01369 * Set owner back to server as well, since it's going back 01370 * into the cache. 01371 */ 01372 if (!(pdce->DCX_flags & DCX_NORESETATTRS)) { 01373 /* 01374 * If bSetupDC() failed, the DC is busy (ie. in-use 01375 * by another thread), so don't release it. 01376 */ 01377 if ( (!(GreCleanDC(hdc))) || 01378 (!(GreSetDCOwner(hdc, OBJECT_OWNER_NONE))) ) { 01379 01380 GreUnlockDisplay(gpDispInfo->hDev); 01381 return DCE_NORELEASE; 01382 } 01383 01384 } else if (!GreSetDCOwner(pdce->hdc, OBJECT_OWNER_NONE)) { 01385 01386 GreUnlockDisplay(gpDispInfo->hDev); 01387 return DCE_NORELEASE; 01388 } 01389 01390 pdce->ptiOwner = NULL; 01391 pdce->DCX_flags &= ~DCX_INUSE; 01392 01393 #if DBG 01394 /* 01395 * Turn off checked only surface validation for now, since 01396 * we may select a different surface (screen) in this DC that 01397 * may not correspond to the visrgn currently in the DC. When 01398 * the DC is given out again, it will be revalidated. 01399 */ 01400 GreValidateVisrgn(pdce->hdc, FALSE); 01401 #endif 01402 01403 /* 01404 * The DC is no longer in use, so unselect the redirection 01405 * bitmap from it. 01406 */ 01407 if (pdce->DCX_flags & DCX_LAYERED) { 01408 UserVerify(GreSelectRedirectionBitmap(pdce->hdc, NULL)); 01409 } 01410 01411 /* 01412 * Increment the Free DCE count. This holds the count 01413 * of available DCEs. Check the threshold, and destroy 01414 * the dce if it's above the mark. 01415 */ 01416 IncrementFreeDCECount(); 01417 01418 if (gnDCECount > DCE_SIZE_CACHETHRESHOLD) { 01419 if (DestroyCacheDC(ppdce, pdce->hdc)) { 01420 GreUnlockDisplay(gpDispInfo->hDev); 01421 return DCE_FREED; 01422 } 01423 } 01424 } 01425 01426 /* 01427 * If we have an EXCLUDERGN or INTERSECTRGN cache entry, 01428 * convert it back to a "normal" cache entry by restoring 01429 * the visrgn and blowing away hrgnClip. 01430 * 01431 * Note that for non-DCX_CACHE DCs, we only do this if 01432 * we're being called from EndPaint(). 01433 */ 01434 if ((pdce->DCX_flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && 01435 ((pdce->DCX_flags & DCX_CACHE) || fEndPaint)) { 01436 DeleteHrgnClip(pdce); 01437 } 01438 01439 GreUnlockDisplay(gpDispInfo->hDev); 01440 return DCE_RELEASED; 01441 } 01442 } 01443 01444 /* 01445 * Yell if DC couldn't be found... 01446 */ 01447 RIPERR1(ERROR_DC_NOT_FOUND, RIP_WARNING, 01448 "Invalid device context (DC) handle passed to ReleaseCacheDC (0x%08lx)", hdc); 01449 01450 return DCE_NORELEASE; 01451 }

NTSTATUS RemoteConnect IN PDOCONNECTDATA  pDoConnectData,
IN ULONG  DisplayDriverNameLength,
IN PWCHAR  DisplayDriverName
 

Definition at line 20 of file w32/ntuser/kernel/misc.c.

References CreateKernelEvent(), DWORD, FALSE, gbClientDoubleClickSupport, gbConnected, gbRemoteSession, gbVideoInitialized, gfEnableWindowsKey, ghRemoteBeepChannel, ghRemoteKeyboardChannel, ghRemoteMouseChannel, ghRemoteThinwireChannel, ghRemoteVideoChannel, gpevtDesktopDestroyed, gpRemoteBeepDevice, gpThinWireCache, gRemoteClientKeyboardType, gstrBaseWinStationName, gThinwireFileObject, gVideoFileObject, gWinStationInfo, HH_REMOTECONNECT, HYDRA_HINT, InitLoadResources(), InitVideo(), IoGetRelatedDeviceObject(), ISCSRSS, KernelMode, L, LW_BrushInit(), min, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), PBYTE, PDOCONNECTDATA, Status, ThinWireCache, TRACE_HYDAPI, and TRUE.

Referenced by NtUserRemoteConnect().

00024 { 00025 NTSTATUS Status = STATUS_SUCCESS; 00026 PFILE_OBJECT pFileObject = NULL; 00027 PDEVICE_OBJECT pDeviceObject = NULL; 00028 PWCHAR pSep; 00029 00030 TRACE_HYDAPI(("RemoteConnect: display %ws\n", DisplayDriverName)); 00031 00032 HYDRA_HINT(HH_REMOTECONNECT); 00033 00034 UserAssert(ISCSRSS()); 00035 00036 gpThinWireCache = &ThinWireCache; 00037 00038 if (pDoConnectData->fMouse) { 00039 ghRemoteMouseChannel = pDoConnectData->IcaMouseChannel; 00040 } else { 00041 ghRemoteMouseChannel = NULL; 00042 } 00043 00044 ghRemoteVideoChannel = pDoConnectData->IcaVideoChannel; 00045 ghRemoteBeepChannel = pDoConnectData->IcaBeepChannel; 00046 ghRemoteKeyboardChannel = pDoConnectData->IcaKeyboardChannel; 00047 ghRemoteThinwireChannel = pDoConnectData->IcaThinwireChannel; 00048 00049 gRemoteClientKeyboardType = pDoConnectData->ClientKeyboardType; 00050 00051 gbClientDoubleClickSupport = pDoConnectData->fClientDoubleClickSupport; 00052 00053 gfEnableWindowsKey = pDoConnectData->fEnableWindowsKey; 00054 00055 RtlCopyMemory(gWinStationInfo.ProtocolName, pDoConnectData->ProtocolName, 00056 WPROTOCOLNAME_LENGTH * sizeof(WCHAR)); 00057 00058 RtlCopyMemory(gWinStationInfo.AudioDriverName, pDoConnectData->AudioDriverName, 00059 WAUDIONAME_LENGTH * sizeof(WCHAR)); 00060 00061 RtlZeroMemory(gstrBaseWinStationName, 00062 WINSTATIONNAME_LENGTH * sizeof(WCHAR)); 00063 00064 RtlCopyMemory(gstrBaseWinStationName, pDoConnectData->WinStationName, 00065 min(WINSTATIONNAME_LENGTH * sizeof(WCHAR), sizeof(pDoConnectData->WinStationName))); 00066 00067 if (pSep = wcschr(gstrBaseWinStationName, L'#')) 00068 *pSep = UNICODE_NULL; 00069 00070 /* 00071 * Create the event that is signaled when a desktop does away 00072 */ 00073 gpevtDesktopDestroyed = CreateKernelEvent(SynchronizationEvent, FALSE); 00074 if (gpevtDesktopDestroyed == NULL) { 00075 RIPMSG0(RIP_WARNING, "RemoteConnect couldn't create gpevtDesktopDestroyed"); 00076 return STATUS_NO_MEMORY; 00077 } 00078 00079 gbConnected = TRUE; 00080 00081 /* 00082 * WinStations must have the video device handle passed to them. 00083 */ 00084 if (gbRemoteSession && !gVideoFileObject) { 00085 00086 PFILE_OBJECT pFileObject = NULL; 00087 PDEVICE_OBJECT pDeviceObject = NULL; 00088 00089 // 00090 // Dereference the file handle 00091 // and obtain a pointer to the device object for the handle. 00092 // 00093 00094 Status = ObReferenceObjectByHandle(ghRemoteVideoChannel, 00095 0, 00096 NULL, 00097 KernelMode, 00098 (PVOID*)&pFileObject, 00099 NULL); 00100 if (NT_SUCCESS(Status)) { 00101 00102 gVideoFileObject = pFileObject; 00103 00104 // 00105 // Get a pointer to the device object for this file. 00106 // 00107 pDeviceObject = IoGetRelatedDeviceObject(pFileObject); 00108 00109 Status = ObReferenceObjectByHandle(ghRemoteThinwireChannel, 00110 0, 00111 NULL, 00112 KernelMode, 00113 (PVOID*)&gThinwireFileObject, 00114 NULL); 00115 00116 /* 00117 * This must be done before any thinwire data. 00118 */ 00119 if (NT_SUCCESS(Status)) { 00120 00121 if (!GreMultiUserInitSession(ghRemoteThinwireChannel, 00122 (PBYTE)gpThinWireCache, 00123 gVideoFileObject, 00124 gThinwireFileObject, 00125 DisplayDriverNameLength, 00126 DisplayDriverName)) { 00127 RIPMSG0(RIP_WARNING, "UserInit: GreMultiUserInitSession failed"); 00128 Status = STATUS_UNSUCCESSFUL; 00129 } else { 00130 00131 DWORD BytesReturned; 00132 00133 Status = GreDeviceIoControl( pDeviceObject, 00134 IOCTL_VIDEO_ICA_ENABLE_GRAPHICS, 00135 NULL, 00136 0, 00137 NULL, 00138 0, 00139 &BytesReturned); 00140 if (!NT_SUCCESS(Status)) { 00141 RIPMSG1(RIP_WARNING, "UserInit: Enable graphics status %08lx", 00142 Status); 00143 } 00144 } 00145 } 00146 } 00147 } 00148 00149 if (!NT_SUCCESS(Status)) { 00150 RIPMSG0(RIP_WARNING, "RemoteConnect failed"); 00151 return Status; 00152 } 00153 00154 if (InitVideo(FALSE) == NULL) { 00155 gbConnected = FALSE; 00156 RIPMSG0(RIP_WARNING, "InitVideo failed"); 00157 return STATUS_UNSUCCESSFUL; 00158 } 00159 00160 if (!LW_BrushInit()) { 00161 RIPMSG0(RIP_WARNING, "LW_BrushInit failed"); 00162 return STATUS_NO_MEMORY; 00163 } 00164 00165 InitLoadResources(); 00166 00167 Status = ObReferenceObjectByHandle(ghRemoteBeepChannel, 00168 0, 00169 NULL, 00170 KernelMode, 00171 (PVOID*)&gpRemoteBeepDevice, 00172 NULL); 00173 00174 /* 00175 * video is initialized at this point 00176 */ 00177 if (NT_SUCCESS(Status)) { 00178 gbVideoInitialized = TRUE; 00179 } else { 00180 RIPMSG0(RIP_WARNING, "Bad Remote Beep Channel"); 00181 } 00182 00183 return Status; 00184 }

DWORD RemoteConnectState VOID   ) 
 

Definition at line 843 of file w32/ntuser/kernel/misc.c.

References DWORD, gbConnected, gbExitInProgress, gbRemoteSession, and gbVideoInitialized.

00845 { 00846 DWORD state = 0; 00847 00848 if (!gbRemoteSession) { 00849 00850 state = CTX_W32_CONNECT_STATE_CONSOLE; 00851 00852 } else if (!gbVideoInitialized) { 00853 00854 state = CTX_W32_CONNECT_STATE_IDLE; 00855 00856 } else if (gbExitInProgress) { 00857 00858 state = CTX_W32_CONNECT_STATE_EXIT_IN_PROGRESS; 00859 00860 } else if (gbConnected) { 00861 00862 state = CTX_W32_CONNECT_STATE_CONNECTED; 00863 00864 } else { 00865 state = CTX_W32_CONNECT_STATE_DISCONNECTED; 00866 } 00867 00868 return state; 00869 }

NTSTATUS RemoteDisableScreen VOID   ) 
 

Definition at line 1733 of file fullscr.c.

References CheckCritIn, DWORD, tagWINDOWSTATION::dwWSF_Flags, FALSE, gbDesktopLocked, gpDispInfo, grpdeskRitInput, gspdeskDisconnect, gspdeskShouldBeForeground, LockDesktop, NTSTATUS(), NULL, tagDISPLAYINFO::pmdev, PtiCurrentShared, tagDESKTOP::rpwinstaParent, Status, ThreadLockDesktop, ThreadUnlockDesktop, TRACE_HYDAPI, TRUE, WSF_SWITCHLOCK, and xxxSwitchDesktop().

Referenced by xxxDesktopThread(), and xxxRemoteStopScreenUpdates().

01735 { 01736 TL tlpdesk; 01737 DWORD dwFlagsPrev; 01738 PTHREADINFO ptiCurrent; 01739 PWINDOWSTATION pwinsta; 01740 NTSTATUS Status = STATUS_SUCCESS; 01741 01742 CheckCritIn(); 01743 01744 TRACE_HYDAPI(("RemoteDisableScreen\n")); 01745 01746 01747 ptiCurrent = PtiCurrentShared(); 01748 01749 if (grpdeskRitInput != gspdeskDisconnect && 01750 gspdeskDisconnect != NULL) { 01751 01752 pwinsta = gspdeskDisconnect->rpwinstaParent; 01753 01754 /* 01755 * Save current desktop 01756 */ 01757 UserAssert(grpdeskRitInput == pwinsta->pdeskCurrent); 01758 01759 LockDesktop(&gspdeskShouldBeForeground, 01760 grpdeskRitInput, 01761 LDL_DESKSHOULDBEFOREGROUND3, 0); 01762 01763 /* 01764 * Set desktop switch lock 01765 * (WSF_SWITCHLOCK must be clear for xxxSwitchDesktop to succeed) 01766 */ 01767 dwFlagsPrev = pwinsta->dwWSF_Flags; 01768 pwinsta->dwWSF_Flags &= ~WSF_SWITCHLOCK; 01769 gbDesktopLocked = TRUE; 01770 01771 /* 01772 * Switch to Disconnected desktop 01773 */ 01774 ThreadLockDesktop(ptiCurrent, gspdeskDisconnect, &tlpdesk, LDLT_FN_CTXDISABLESCREEN); 01775 xxxSwitchDesktop(pwinsta, gspdeskDisconnect, FALSE); 01776 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_CTXDISABLESCREEN); 01777 01778 pwinsta->dwWSF_Flags = dwFlagsPrev; 01779 01780 /* 01781 * Disable screen updates 01782 */ 01783 DrvDisableMDEV(gpDispInfo->pmdev, TRUE); 01784 01785 } else if (gspdeskDisconnect != NULL) { 01786 /* 01787 * For some reason the disconnected desktop was the current desktop. 01788 * Now prevent switching from it. 01789 */ 01790 gbDesktopLocked = TRUE; 01791 } 01792 01793 return Status; 01794 }

NTSTATUS RemoteLogoff VOID   ) 
 

Definition at line 415 of file w32/ntuser/kernel/misc.c.

References _PostMessage(), gspwndLogonNotify, HH_REMOTELOGOFF, HYDRA_HINT, ISCSRSS, ISTS, NTSTATUS(), NULL, Status, and TRACE_HYDAPI.

00417 { 00418 NTSTATUS Status = STATUS_SUCCESS; 00419 00420 TRACE_HYDAPI(("RemoteLogoff\n")); 00421 00422 /* 00423 * Only allow CSRSS to do this 00424 */ 00425 if (!ISCSRSS() || !ISTS()) { 00426 return STATUS_ACCESS_DENIED; 00427 } 00428 00429 HYDRA_HINT(HH_REMOTELOGOFF); 00430 00431 UserAssert(ISCSRSS()); 00432 00433 /* 00434 * Tell winlogon about the logoff 00435 */ 00436 if (gspwndLogonNotify != NULL) { 00437 _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, 00438 SESSION_LOGOFF, EWX_LOGOFF | EWX_FORCE); 00439 } 00440 00441 return Status; 00442 }

NTSTATUS RemoteNtSecurity VOID   ) 
 

Definition at line 582 of file w32/ntuser/kernel/misc.c.

References _PostMessage(), gspwndLogonNotify, ISCSRSS, ISTS, NULL, and TRACE_HYDAPI.

00584 { 00585 TRACE_HYDAPI(("RemoteNtSecurity\n")); 00586 00587 /* 00588 * Only allow CSRSS to do this 00589 */ 00590 if (!ISCSRSS() || !ISTS()) { 00591 return STATUS_ACCESS_DENIED; 00592 } 00593 00594 UserAssert(ISCSRSS()); 00595 00596 UserAssert(gspwndLogonNotify != NULL); 00597 00598 if (gspwndLogonNotify != NULL) { 00599 _PostMessage(gspwndLogonNotify, WM_HOTKEY, 0, 0); 00600 } 00601 return STATUS_SUCCESS; 00602 }

NTSTATUS RemotePassthruDisable VOID   ) 
 

Definition at line 781 of file w32/ntuser/kernel/misc.c.

References BOOL, FALSE, gbConnected, ghRemoteThinwireChannel, gnShadowers, gpDispInfo, gThinwireFileObject, tagDISPLAYINFO::hDev, ISCSRSS, ISTS, RemoteRedrawScreen(), TRACE_HYDAPI, and UpdateKeyLights().

00783 { 00784 BOOL fResult; 00785 00786 TRACE_HYDAPI(("RemotePassthruDisable\n")); 00787 00788 /* 00789 * Only allow CSRSS to do this 00790 */ 00791 if (!ISCSRSS() || !ISTS()) { 00792 return STATUS_ACCESS_DENIED; 00793 } 00794 00795 UserAssert(gnShadowers == 0); 00796 UserAssert(ISCSRSS()); 00797 00798 fResult = bDrvReconnect(gpDispInfo->hDev, ghRemoteThinwireChannel, 00799 gThinwireFileObject); 00800 if (!fResult) { 00801 return STATUS_CTX_BAD_VIDEO_MODE; 00802 } 00803 00804 if (gbConnected) { 00805 RemoteRedrawScreen(); 00806 UpdateKeyLights(FALSE); // Make sure LED's are correct 00807 } 00808 00809 return STATUS_SUCCESS; 00810 }

NTSTATUS RemoteRedrawRectangle WORD  Left,
WORD  Top,
WORD  Right,
WORD  Bottom
 

Definition at line 1634 of file fullscr.c.

References CheckCritIn, gpDispInfo, gspdeskShouldBeForeground, gspwndFullScreen, tagDISPLAYINFO::hDev, ISCSRSS, NULL, ThreadLock, ThreadUnlock, TRACE_HYDAPI, and xxxRedrawWindow().

Referenced by CtxDisplayIOCtl(), and NtUserRemoteRedrawRectangle().

01639 { 01640 TL tlpwnd; 01641 RECT rcl; 01642 01643 CheckCritIn(); 01644 01645 TRACE_HYDAPI(("RemoteRedrawRectangle\n")); 01646 01647 UserAssert(ISCSRSS()); 01648 /* 01649 * If xxxRemoteStopScreenUpdates has not been called, 01650 * then just repaint the current foreground window. 01651 */ 01652 if (gspdeskShouldBeForeground == NULL) { 01653 if (gspwndFullScreen) { 01654 01655 ThreadLock(gspwndFullScreen, &tlpwnd); 01656 01657 rcl.left = Left; 01658 rcl.top = Top; 01659 rcl.right = Right; 01660 rcl.bottom = Bottom; 01661 01662 vDrvInvalidateRect(gpDispInfo->hDev, &rcl); 01663 01664 xxxRedrawWindow(gspwndFullScreen, &rcl, NULL, 01665 RDW_INVALIDATE | RDW_ALLCHILDREN | 01666 RDW_ERASE | RDW_ERASENOW); 01667 ThreadUnlock(&tlpwnd); 01668 } 01669 } 01670 01671 return STATUS_SUCCESS; 01672 }

NTSTATUS RemoteRedrawScreen VOID   ) 
 

Definition at line 1675 of file fullscr.c.

References CheckCritIn, DF_DESTROYED, tagDESKTOP::dwDTFlags, DWORD, tagWINDOWSTATION::dwWSF_Flags, FALSE, gbDesktopLocked, gbFreezeScreenUpdates, gpDispInfo, gspdeskShouldBeForeground, LockDesktop, NULL, tagDISPLAYINFO::pmdev, PtiCurrentShared, tagDESKTOP::rpwinstaParent, ThreadLockDesktop, ThreadUnlockDesktop, TRACE_HYDAPI, TRUE, WSF_SWITCHLOCK, and xxxSwitchDesktop().

Referenced by NtUserRemoteRedrawScreen(), RemotePassthruDisable(), RemoteShadowCleanup(), RemoteShadowStart(), xxxRemoteDisconnect(), and xxxRemoteReconnect().

01677 { 01678 TL tlpdesk; 01679 PWINDOWSTATION pwinsta; 01680 DWORD dwFlagsPrev; 01681 PTHREADINFO ptiCurrent; 01682 01683 TRACE_HYDAPI(("RemoteRedrawScreen\n")); 01684 01685 CheckCritIn(); 01686 01687 if (!gbFreezeScreenUpdates) 01688 return STATUS_SUCCESS; 01689 01690 ptiCurrent = PtiCurrentShared(); 01691 01692 gbFreezeScreenUpdates = FALSE; 01693 01694 /* 01695 * Switch back to the previous desktop 01696 */ 01697 if (gspdeskShouldBeForeground == NULL) { 01698 RIPMSG0(RIP_WARNING, "RemoteRedrawScreen called with no gspdeskShouldBeForeground"); 01699 return STATUS_SUCCESS; 01700 } 01701 01702 /* 01703 * Clear desktop switch lock 01704 * (WSF_SWITCHLOCK must be clear for xxxSwitchDesktop to succeed) 01705 */ 01706 gbDesktopLocked = FALSE; 01707 01708 pwinsta = gspdeskShouldBeForeground->rpwinstaParent; 01709 01710 dwFlagsPrev = pwinsta->dwWSF_Flags; 01711 pwinsta->dwWSF_Flags &= ~WSF_SWITCHLOCK; 01712 01713 /* 01714 * Switch back to previous desktop 01715 */ 01716 if (!(gspdeskShouldBeForeground->dwDTFlags & DF_DESTROYED)) { 01717 ThreadLockDesktop(ptiCurrent, gspdeskShouldBeForeground, &tlpdesk, LDLT_FN_CTXREDRAWSCREEN); 01718 xxxSwitchDesktop(pwinsta, gspdeskShouldBeForeground, FALSE); 01719 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_CTXREDRAWSCREEN); 01720 01721 /* 01722 * Enable screen updates 01723 */ 01724 DrvEnableMDEV(gpDispInfo->pmdev, TRUE); 01725 } 01726 pwinsta->dwWSF_Flags = dwFlagsPrev; 01727 LockDesktop(&gspdeskShouldBeForeground, NULL, LDL_DESKSHOULDBEFOREGROUND2, 0 ); 01728 01729 return STATUS_SUCCESS; 01730 }

NTSTATUS RemoteShadowCleanup IN PVOID  pThinwireData,
ULONG  ThinwireDataLength
 

Definition at line 700 of file w32/ntuser/kernel/misc.c.

References gbConnected, gnShadowers, gpDispInfo, tagDISPLAYINFO::hDev, ISCSRSS, ISTS, NTSTATUS(), RemoteRedrawScreen(), Status, and TRACE_HYDAPI.

00703 { 00704 NTSTATUS Status = STATUS_SUCCESS; 00705 00706 TRACE_HYDAPI(("RemoteShadowCleanup\n")); 00707 00708 /* 00709 * Only allow CSRSS to do this 00710 */ 00711 if (!ISCSRSS() || !ISTS()) { 00712 return STATUS_ACCESS_DENIED; 00713 } 00714 00715 UserAssert(ISCSRSS()); 00716 00717 /* 00718 * Tell the Thinwire driver about it 00719 */ 00720 bDrvShadowDisconnect(gpDispInfo->hDev, pThinwireData, 00721 ThinwireDataLength); 00722 00723 if (gnShadowers > 0) 00724 gnShadowers--; 00725 00726 if (gnShadowers || gbConnected) { 00727 RemoteRedrawScreen(); 00728 } 00729 00730 return Status; 00731 }

NTSTATUS RemoteShadowStart IN PVOID  pThinwireData,
ULONG  ThinwireDataLength
 

Definition at line 635 of file w32/ntuser/kernel/misc.c.

References BOOL, gpDispInfo, tagDISPLAYINFO::hDev, ISCSRSS, ISTS, NTSTATUS(), RemoteRedrawScreen(), Status, TRACE_HYDAPI, and TRUE.

00638 { 00639 BOOL fResult; 00640 NTSTATUS Status = STATUS_SUCCESS; 00641 00642 TRACE_HYDAPI(("RemoteShadowStart\n")); 00643 00644 /* 00645 * Only allow CSRSS to do this 00646 */ 00647 if (!ISCSRSS() || !ISTS()) { 00648 return STATUS_ACCESS_DENIED; 00649 } 00650 00651 UserAssert(ISCSRSS()); 00652 00653 /* 00654 * Call thinwire driver and check for thinwire mode compatibility 00655 */ 00656 fResult = bDrvShadowConnect(gpDispInfo->hDev, pThinwireData, 00657 ThinwireDataLength); 00658 00659 // Although originally defined as BOOL, allow more meaningful return codes. 00660 if (!fResult) { 00661 return STATUS_CTX_BAD_VIDEO_MODE; 00662 } 00663 else if (fResult != TRUE) { 00664 return fResult; 00665 } 00666 00667 RemoteRedrawScreen(); 00668 00669 return Status; 00670 }

NTSTATUS RemoteThinwireStats OUT PVOID  Stats  ) 
 

Definition at line 558 of file w32/ntuser/kernel/misc.c.

References DWORD, gpThinWireCache, ISCSRSS, ISTS, NULL, and TRACE_HYDAPI.

00560 { 00561 static DWORD sThinwireStatsLength = sizeof(CACHE_STATISTICS); 00562 00563 TRACE_HYDAPI(("RemoteThinwireStats\n")); 00564 00565 /* 00566 * Only allow CSRSS to do this 00567 */ 00568 if (!ISCSRSS() || !ISTS()) { 00569 return STATUS_ACCESS_DENIED; 00570 } 00571 00572 UserAssert(ISCSRSS()); 00573 if (gpThinWireCache != NULL) { 00574 RtlCopyMemory(Stats, gpThinWireCache, sThinwireStatsLength); 00575 return STATUS_SUCCESS; 00576 } 00577 return STATUS_NO_SUCH_DEVICE; 00578 }

__inline void RemoveFlashWindowState PWND  pwnd  ) 
 

Definition at line 5667 of file userk.h.

References _GetProp(), DWORD, gaFlashWState, MAKEINTATOM, and PROPF_INTERNAL.

Referenced by xxxFlashWindow().

05669 { 05670 return (DWORD)(ULONG_PTR)_GetProp(pwnd, MAKEINTATOM(gaFlashWState), PROPF_INTERNAL);

VOID RemoveHmodDependency int  iatom  ) 
 

Definition at line 158 of file libmgmt.c.

References aatomSysLoaded, acatomSysDepends, acatomSysUse, catomSysTableEntries, gcSysExpunge, gdwSysExpungeMask, and VOID().

Referenced by DestroyEventHook(), and FreeHook().

00160 { 00161 00162 UserAssert(iatom >= 0); 00163 if (iatom < catomSysTableEntries && 00164 --acatomSysDepends[iatom] == 0) { 00165 00166 if (acatomSysUse[iatom]) { 00167 00168 /* 00169 * Cause each thread to check for expunged dlls 00170 * the next time they awake. 00171 */ 00172 gcSysExpunge++; 00173 gdwSysExpungeMask |= (1 << iatom); 00174 } else { 00175 aatomSysLoaded[iatom] = 0; 00176 } 00177 } 00178 }

VOID RemoveKeyboardLayoutFile PKBDFILE  pkf  ) 
 

Definition at line 390 of file kbdlyout.c.

References gpKbdNlsTbl, gpKbdTbl, gpkfList, KbdTablesFallback, NULL, tagKBDFILE::pKbdNlsTbl, tagKBDFILE::pKbdTbl, tagKBDFILE::pkfNext, and VOID().

Referenced by DestroyKF().

00392 { 00393 PKBDFILE pkfPrev, pkfCur; 00394 00395 // FE: NT4 SP4 #107809 00396 if (gpKbdTbl == pkf->pKbdTbl) { 00397 gpKbdTbl = &KbdTablesFallback; 00398 } 00399 if (gpKbdNlsTbl == pkf->pKbdNlsTbl) { 00400 gpKbdNlsTbl = NULL; 00401 } 00402 00403 /* 00404 * Good old linked list management 101 00405 */ 00406 if (pkf == gpkfList) { 00407 /* 00408 * Head of the list. 00409 */ 00410 gpkfList = pkf->pkfNext; 00411 return; 00412 } 00413 pkfPrev = gpkfList; 00414 pkfCur = gpkfList->pkfNext; 00415 while (pkf != pkfCur) { 00416 pkfPrev = pkfCur; 00417 pkfCur = pkfCur->pkfNext; 00418 } 00419 /* 00420 * Found it! 00421 */ 00422 pkfPrev->pkfNext = pkfCur->pkfNext; 00423 }

BOOL RemoveProcessFromJob PPROCESSINFO  ppi  ) 
 

Definition at line 255 of file job.c.

References BOOL, CheckCritIn, FALSE, NULL, tagW32JOB::ppiTable, tagPROCESSINFO::pW32Job, TRUE, UINT, and tagW32JOB::uProcessCount.

Referenced by xxxUserProcessCallout().

00257 { 00258 PW32JOB pW32Job; 00259 UINT ip; 00260 00261 CheckCritIn(); 00262 00263 pW32Job = ppi->pW32Job; 00264 00265 TAGMSG2(DBGTAG_Job, "RemoveProcessFromJob: ppi 0x%x pW32Job 0x%x", 00266 ppi, pW32Job); 00267 00268 /* 00269 * The job might not have UI restrictions 00270 */ 00271 if (pW32Job == NULL) { 00272 return FALSE; 00273 } 00274 00275 /* 00276 * remove the ppi from the job's ppi table 00277 */ 00278 for (ip = 0; ip < pW32Job->uProcessCount; ip++) { 00279 00280 UserAssert(pW32Job->ppiTable[ip]->pW32Job == pW32Job); 00281 00282 if (ppi == pW32Job->ppiTable[ip]) { 00283 00284 ppi->pW32Job = NULL; 00285 00286 RtlMoveMemory(pW32Job->ppiTable + ip, 00287 pW32Job->ppiTable + ip + 1, 00288 (pW32Job->uProcessCount - ip - 1) * sizeof(PPROCESSINFO)); 00289 00290 (pW32Job->uProcessCount)--; 00291 00292 /* 00293 * free the process array if this is the last one. 00294 */ 00295 if (pW32Job->uProcessCount == 0) { 00296 UserFreePool(pW32Job->ppiTable); 00297 pW32Job->ppiTable = NULL; 00298 pW32Job->uMaxProcesses = 0; 00299 } 00300 00301 TAGMSG2(DBGTAG_Job, "RemoveProcessFromJob: ppi 0x%x removed from pW32Job 0x%x", 00302 ppi, pW32Job); 00303 00304 return TRUE; 00305 } 00306 } 00307 00308 TAGMSG2(DBGTAG_Job, "RemoveProcessFromJob: ppi 0x%x not found in pW32Job 0x%x", 00309 ppi, pW32Job); 00310 00311 UserAssert(0); 00312 00313 return FALSE; 00314 }

VOID RequestDeviceChange PDEVICEINFO  pDeviceInfo,
USHORT  usAction,
BOOL  fInDeviceInfoListCrit
 

Definition at line 1535 of file w32/ntuser/kernel/pnp.c.

References aDeviceTemplate, CheckCritOut, CheckDeviceInfoListCritIn, CheckDeviceInfoListCritOut, EnterDeviceInfoListCrit(), EVENT_INCREMENT, ExIsResourceAcquiredExclusiveLite(), FALSE, FreeDeviceInfo(), GDIAF_FREEME, GDIAF_PNPWAITING, gpresDeviceInfoList, KernelMode, KeSetEvent(), KeWaitForSingleObject(), LeaveDeviceInfoListCrit(), NULL, tagDEVICE_TEMPLATE::pkeHidChange, VOID(), and WrUserRequest.

Referenced by CreateDeviceInfo(), DeviceNotify(), NlsKbdSendIMENotification(), ProcessMouseInput(), and UpdateMouseInfo().

01539 { 01540 PDEVICE_TEMPLATE pDevTpl = &aDeviceTemplate[pDeviceInfo->type]; 01541 UserAssert(pDevTpl->pkeHidChange != NULL); 01542 UserAssert((usAction & GDIAF_FREEME) == 0); 01543 UserAssert((pDeviceInfo->usActions & GDIAF_PNPWAITING) == 0); 01544 01545 #if DBG 01546 if (pDeviceInfo->usActions != 0) { 01547 TAGMSG3(DBGTAG_PNP, "RequestDeviceChange(%#p, %x), but action %x pending", 01548 pDeviceInfo, usAction, pDeviceInfo->usActions); 01549 } 01550 01551 /* 01552 * We can't ask for synchronized actions to be performed on the Device List 01553 * if we are holding the Device List lock or the User Critical Section: 01554 * ProcessDeviceChanges() requires both of these itself. 01555 */ 01556 if (usAction & GDIAF_PNPWAITING) { 01557 CheckDeviceInfoListCritOut(); 01558 CheckCritOut(); 01559 } 01560 #endif 01561 01562 TAGMSG2(DBGTAG_PNP, "RequestDeviceChange(%p, %x)", pDeviceInfo, usAction); 01563 01564 /* 01565 * Grab the DeviceInfoList critical section if we don't already have it 01566 */ 01567 UserAssert(!fInDeviceInfoListCrit == !ExIsResourceAcquiredExclusiveLite(gpresDeviceInfoList)); 01568 if (fInDeviceInfoListCrit) { 01569 CheckDeviceInfoListCritIn(); 01570 pDeviceInfo->usActions |= usAction; 01571 } else { 01572 EnterDeviceInfoListCrit(); 01573 pDeviceInfo->usActions |= usAction; 01574 LeaveDeviceInfoListCrit(); 01575 } 01576 01577 if (usAction & GDIAF_PNPWAITING) { 01578 CheckDeviceInfoListCritOut(); 01579 KeSetEvent(pDevTpl->pkeHidChange, EVENT_INCREMENT, FALSE); 01580 KeWaitForSingleObject(pDeviceInfo->pkeHidChangeCompleted, WrUserRequest, KernelMode, FALSE, NULL); 01581 01582 EnterDeviceInfoListCrit(); 01583 /* 01584 * Assert that nothing else cleared GDIAF_PNPWAITING - only do it here. 01585 * Check that the action we were waiting for actually occurred. 01586 */ 01587 UserAssert(pDeviceInfo->usActions & GDIAF_PNPWAITING); 01588 pDeviceInfo->usActions &= ~GDIAF_PNPWAITING; 01589 UserAssert((pDeviceInfo->usActions & usAction) == 0); 01590 if (pDeviceInfo->usActions & GDIAF_FREEME) { 01591 FreeDeviceInfo(pDeviceInfo); 01592 } 01593 LeaveDeviceInfoListCrit(); 01594 } else { 01595 KeSetEvent(pDevTpl->pkeHidChange, EVENT_INCREMENT, FALSE); 01596 } 01597 }

void ResetMouseTracking PQ  pq,
PWND  pwnd
 

void RestoreForegroundActivate  ) 
 

Definition at line 1549 of file ntuser/kernel/input.c.

References gppiStarting, NULL, tagPROCESSINFO::ppiNext, PUDF_ALLOWFOREGROUNDACTIVATE, and SET_PUDF.

Referenced by xxxEndDeferWindowPosEx(), and xxxMinMaximize().

01550 { 01551 PPROCESSINFO ppiT; 01552 01553 for (ppiT = gppiStarting; ppiT != NULL; ppiT = ppiT->ppiNext) { 01554 if (ppiT->W32PF_Flags & W32PF_APPSTARTING) { 01555 ppiT->W32PF_Flags |= W32PF_ALLOWFOREGROUNDACTIVATE; 01556 TAGMSG1(DBGTAG_FOREGROUND, "RestoreForegroundActivate set W32PF %#p", ppiT); 01557 SET_PUDF(PUDF_ALLOWFOREGROUNDACTIVATE); 01558 TAGMSG0(DBGTAG_FOREGROUND, "RestoreForegroundActivate set PUDF"); 01559 } 01560 } 01561 }

UINT RestoreSpb PWND  pwnd,
HRGN  hrgnUncovered,
HDC *  phdcScreen
 

Definition at line 651 of file spb.c.

References Error, FindSpb(), tagSPB::flags, FreeSpb(), ghdcMem, ghrgnSPB1, ghrgnSPB2, gpDispInfo, tagSPB::hbm, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, tagSPB::hrgn, tagWND::hrgnClip, IntersectRgn, IsVisible(), NULL, tagSPB::rc, RSPB_INVALIDATE, RSPB_INVALIDATE_SSB, RSPB_NO_INVALIDATE, SetRectRgnIndirect(), SPB_SAVESCREENBITS, SubtractRgn, UINT, and tagSPB::ulSaveId.

Referenced by zzzBltValidBits().

00655 { 00656 PSPB pspb; 00657 UINT uInvalidate; 00658 HRGN hrgnRestorable; 00659 00660 /* 00661 * Note that we DON'T call SpbCheck() here -- 00662 * SpbCheck() is called by zzzBltValidBits(). 00663 */ 00664 pspb = FindSpb(pwnd); 00665 00666 /* 00667 * Assume all of hrgnUncovered was restored, and there's nothing 00668 * for our caller to invalidate. 00669 */ 00670 uInvalidate = RSPB_NO_INVALIDATE; 00671 hrgnRestorable = hrgnUncovered; 00672 00673 /* 00674 * First determine whether or not there is any area at all to restore. 00675 * If hrgnUncovered & pspb->hrgn is empty, then all of hrgnUncovered 00676 * needs to be invalidated, and there's nothing to restore. 00677 */ 00678 if (pspb->hrgn != NULL) { 00679 /* 00680 * At least some of hrgnUncovered needs to be invalidated. 00681 */ 00682 uInvalidate = RSPB_INVALIDATE; 00683 00684 /* 00685 * Calculate the true area of bits to be restored. If it becomes 00686 * empty, then just free the SPB without changing hrgnUncovered, 00687 * which is the area that must be invalidated. 00688 */ 00689 hrgnRestorable = ghrgnSPB1; 00690 switch (IntersectRgn(hrgnRestorable, hrgnUncovered, pspb->hrgn)) { 00691 case ERROR: 00692 case NULLREGION: 00693 goto Error; 00694 00695 default: 00696 break; 00697 } 00698 } 00699 00700 if (pspb->flags & SPB_SAVESCREENBITS) { 00701 00702 RECT rc = pspb->rc; 00703 00704 /* 00705 * Since the restore frees the onboard memory, clear this 00706 * bit so FreeSpb() won't try to free it again (regardless of 00707 * whether we get an error or not) 00708 */ 00709 pspb->flags &= ~SPB_SAVESCREENBITS; 00710 if (!(GreSaveScreenBits(gpDispInfo->hDev, 00711 SS_RESTORE, 00712 pspb->ulSaveId, 00713 (RECTL *)&rc))) { 00714 goto Error; 00715 } 00716 00717 /* 00718 * The SS_RESTORE call will always restore the entire SPB 00719 * rectangle, part of which may fall outside of hrgnUncovered. 00720 * The area that must be invalidated by our caller is simply 00721 * the SPB rectangle minus the area of restorable bits. 00722 * 00723 * If this region is not empty, then the SPB was not completely 00724 * restored, so we must return FALSE. 00725 */ 00726 SetRectRgnIndirect(ghrgnSPB2, &pspb->rc); 00727 if (SubtractRgn(hrgnUncovered, ghrgnSPB2, hrgnRestorable) != NULLREGION) { 00728 uInvalidate = RSPB_INVALIDATE_SSB; 00729 } 00730 } else { 00731 00732 HDC hdcScreen; 00733 HBITMAP hbmSave; 00734 00735 /* 00736 * In the unlikely event we need a screen DC and one wasn't passed in, 00737 * get it now. If we get one, we return the handle in *phdcScreen 00738 * so that our caller can release it later. 00739 */ 00740 if (!*phdcScreen) { 00741 *phdcScreen = gpDispInfo->hdcScreen; 00742 } 00743 00744 hdcScreen = *phdcScreen; 00745 00746 hbmSave = (HBITMAP)GreSelectBitmap(ghdcMem, pspb->hbm); 00747 if (!hbmSave) 00748 goto Error; 00749 00750 /* 00751 * Be sure to clip to the area of restorable bits. 00752 */ 00753 00754 GreSelectVisRgn(hdcScreen, hrgnRestorable, SVR_COPYNEW); 00755 00756 GreBitBlt(hdcScreen, 00757 pspb->rc.left, pspb->rc.top, 00758 pspb->rc.right - pspb->rc.left, 00759 pspb->rc.bottom - pspb->rc.top, 00760 ghdcMem, 00761 pspb->rc.left & 0x0007, 00762 0, 00763 SRCCOPY, 00764 0); 00765 00766 GreSelectBitmap(ghdcMem, hbmSave); 00767 00768 /* 00769 * Now compute the area to be invalidated for return. 00770 * This is simply the original hrgnUncovered - hrgnRestorable 00771 */ 00772 SubtractRgn(hrgnUncovered, hrgnUncovered, hrgnRestorable); 00773 } 00774 00775 if (pwnd->hrgnClip == NULL || !IsVisible(pwnd)) 00776 FreeSpb(pspb); 00777 00778 return uInvalidate; 00779 00780 Error: 00781 FreeSpb(pspb); 00782 return RSPB_INVALIDATE; 00783 }

VOID RetryReadInput  ) 
 

void RtlInitUnicodeStringOrId PUNICODE_STRING  pstrName,
LPWSTR  lpstrName
 

Definition at line 204 of file base.c.

References IS_PTR, and RtlInitUnicodeString().

Referenced by xxxCreateWindowEx(), xxxGetScrollMenu(), xxxLoadSysMenu(), xxxUpdateSystemCursorsFromRegistry(), and xxxUpdateSystemIconsFromRegistry().

00207 { 00208 if (IS_PTR(lpstrName)) { 00209 RtlInitUnicodeString(pstrName, lpstrName); 00210 } else { 00211 pstrName->Length = pstrName->MaximumLength = 0; 00212 pstrName->Buffer = lpstrName; 00213 } 00214 }

int RtlLoadStringOrError UINT  ,
LPTSTR  ,
int  ,
WORD 
 

VOID SaveVolatileUserSettings VOID   ) 
 

VOID SBCtlSetup PSBWND  psbwnd  ) 
 

Definition at line 1012 of file sbctl.c.

References CalcSBStuff2(), GetRect(), GRECT_CLIENT, and GRECT_CLIENTCOORDS.

Referenced by DrawCtlThumb(), xxxDoScrollMenu(), and xxxSBWndProc().

01014 { 01015 RECT rc; 01016 01017 GetRect((PWND)psbwnd, &rc, GRECT_CLIENT | GRECT_CLIENTCOORDS); 01018 CalcSBStuff2(&psbwnd->SBCalc, &rc, (PSBDATA)&psbwnd->SBCalc, psbwnd->fVert); 01019 }

PCURSOR SearchIconCache PCURSOR  pCursorCache,
ATOM  atomModName,
PUNICODE_STRING  pstrResName,
PCURSOR  pCursorSrc,
PCURSORFIND  pcfSearch
 

Definition at line 254 of file loadbits.c.

References tagCURSORFIND::bpp, CURSORF_ACON, CURSORF_LRSHARED, tagCURSORFIND::cx, tagCURSORFIND::cy, NULL, ResStrCmp(), and tagCURSORFIND::rt.

Referenced by _FindExistingCursorIcon().

00260 { 00261 /* 00262 * Run through the list of 'resource' objects created, 00263 * and see if the cursor requested has already been loaded. 00264 * If so just return it. We do this to be consistent with 00265 * Win 3.0 where they simply return a pointer to the res-data 00266 * for a cursor/icon handle. Many apps count on this and 00267 * call LoadCursor/Icon() often. 00268 * 00269 * LR_SHARED implies: 00270 * 1) icons never get deleted till process (LATER or WOW module) 00271 * goes away. 00272 * 2) This cache is consulted before trying to load a res. 00273 */ 00274 for (; pCursorCache != NULL; pCursorCache = pCursorCache->pcurNext) { 00275 00276 /* 00277 * If we are given a specific cursor to look for, then 00278 * search for that first. 00279 */ 00280 if (pcurSrc && (pCursorCache == pcurSrc)) 00281 return pcurSrc; 00282 00283 /* 00284 * No need to look further if the module name doesn't match. 00285 */ 00286 if (atomModName != pCursorCache->atomModName) 00287 continue; 00288 00289 /* 00290 * We only return images that cannot be destroyed by the app. 00291 * so we don't have to deal with ref counts. This is owned 00292 * by us, but not LR_SHARED. 00293 */ 00294 if (!(pCursorCache->CURSORF_flags & CURSORF_LRSHARED)) 00295 continue; 00296 00297 /* 00298 * Check the other distinguishing search criteria for 00299 * a match. 00300 */ 00301 if ((pCursorCache->rt == LOWORD(pcfSearch->rt)) && 00302 ResStrCmp(cczpstrResName, &pCursorCache->strName)) { 00303 00304 /* 00305 * Acons don't have a size per se because each frame 00306 * can be a different size. We always make it a hit 00307 * on acons so replacement of system icons is possible. 00308 */ 00309 if (pCursorCache->CURSORF_flags & CURSORF_ACON) 00310 return pCursorCache; 00311 00312 /* 00313 * First hit wins. Nothing fancy here. Apps that use 00314 * LR_SHARED have to watch out for this. 00315 */ 00316 if ((!pcfSearch->cx || (pCursorCache->cx == pcfSearch->cx)) && 00317 (!pcfSearch->cy || ((pCursorCache->cy / 2) == pcfSearch->cy)) && 00318 (!pcfSearch->bpp || (pCursorCache->bpp == pcfSearch->bpp))) { 00319 00320 return pCursorCache; 00321 } 00322 } 00323 } 00324 00325 return NULL; 00326 }

void SelectWindowRgn PWND  pwnd,
HRGN  hrgnClip
 

Definition at line 5753 of file swp.c.

References _MonitorFromWindow(), ClrWF, HRGN_FULL, HRGN_MONITOR, tagWND::hrgnClip, tagMONITOR::hrgnMonitor, NULL, PWNDDESKTOP, tagWND::rcWindow, SetWF, tagWND::spwndParent, TestWF, WFMAXFAKEREGIONAL, WFMAXIMIZED, and WFREALLYMAXIMIZABLE.

Referenced by xxxCreateDisconnectDesktop(), and zzzChangeStates().

05756 { 05757 /* 05758 * If there is a region already there, delete it because 05759 * a new one is being set. For maximized windows in multiple monitor 05760 * mode, we always use the monitor HRGN. We don't make a copy. This 05761 * way, when the hrgn changes because of monitor config, the window's 05762 * monitor region automatically gets updated. Clever huh? Also saves 05763 * memory. 05764 */ 05765 if (pwnd->hrgnClip != NULL) { 05766 if (TestWF(pwnd, WFMAXFAKEREGIONAL)) { 05767 ClrWF(pwnd, WFMAXFAKEREGIONAL); 05768 } else { 05769 /* 05770 * Do NOT select in a monitor region if the window is normally 05771 * regional. The MinMaximize code will always pass HRGN_MONITOR 05772 * to us no matter what. But when we get here, bail out and 05773 * don't destroy the app's region if it has one. 05774 */ 05775 if (hrgnClip == HRGN_MONITOR) 05776 return; 05777 05778 GreDeleteObject(pwnd->hrgnClip); 05779 } 05780 05781 pwnd->hrgnClip = NULL; 05782 } 05783 05784 /* 05785 * NULL or HRGN_FULL means "set to NULL". If we have a real region, 05786 * use it. USER needs to own it, and it needs to be in screen 05787 * coordinates. 05788 */ 05789 if (hrgnClip > HRGN_FULL) { 05790 05791 if (hrgnClip == HRGN_MONITOR) { 05792 PMONITOR pMonitor; 05793 05794 /* 05795 * Use the monitor region if the window is really maxed 05796 * on a monitor. It's already happened by the time we get here, 05797 * if so. And xxxCheckFullScreen will clear the reallymaximed 05798 * style for a maximized window if it doesn't cover the whole 05799 * max area. 05800 */ 05801 UserAssert(pwnd->spwndParent == PWNDDESKTOP(pwnd)); 05802 05803 if (!TestWF(pwnd, WFMAXIMIZED) || !TestWF(pwnd, WFREALLYMAXIMIZABLE)) 05804 return; 05805 05806 /* 05807 * Do nothing for windows off screen. 05808 */ 05809 pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTONULL); 05810 if (!pMonitor) 05811 return; 05812 05813 hrgnClip = pMonitor->hrgnMonitor; 05814 SetWF(pwnd, WFMAXFAKEREGIONAL); 05815 } else { 05816 if (pwnd != PWNDDESKTOP(pwnd)) { 05817 GreOffsetRgn(hrgnClip, pwnd->rcWindow.left, pwnd->rcWindow.top); 05818 } 05819 05820 GreSetRegionOwner(hrgnClip, OBJECT_OWNER_PUBLIC); 05821 } 05822 05823 pwnd->hrgnClip = hrgnClip; 05824 } 05825 }

VOID SendMsgCleanup PTHREADINFO  ptiCurrent  ) 
 

Definition at line 2364 of file kernel/sendmsg.c.

References CheckCritIn, gpsmsList, PSMS, ReceiverDied(), SenderDied(), and VOID().

Referenced by xxxDestroyThreadInfo(), and zzzCancelJournalling().

02364 : free sms 02365 * R replied, R dies: no problem 02366 * 02367 * double death: 02368 * R no reply, S dies, R dies: free sms 02369 * R no reply, R dies, S dies: free sms 02370 * R replied, S dies, R dies: sms freed when S dies, as in single death 02371 * R replied, R dies, S dies: sms freed when S dies, as in single death 02372 * 02373 * History: 02374 * 01-13-91 DavidPe Ported. 02375 \***********************************************************************/ 02376 02377 VOID SendMsgCleanup( 02378 PTHREADINFO ptiCurrent) 02379 { 02380 PSMS *ppsms; 02381 PSMS psmsNext; 02382 02383 CheckCritIn(); 02384 02385 for (ppsms = &gpsmsList; *ppsms; ) { 02386 psmsNext = (*ppsms)->psmsNext; 02387 02388 if ((*ppsms)->ptiSender == ptiCurrent ||

ULONG_PTR SetClassCursor PWND  pwnd,
PCLS  pcls,
DWORD  index,
ULONG_PTR  dwData
 

Definition at line 1329 of file class.c.

References CheckLock, HMValidateHandle(), Lock, NULL, tagCLS::pclsBase, tagCLS::pclsClone, tagCLS::pclsNext, PtoH, TYPE_CURSOR, and xxxSetClassIcon().

Referenced by xxxSetClassData().

01334 { 01335 ULONG_PTR dwOld; 01336 01337 CheckLock(pwnd); 01338 01339 if ((HANDLE)dwData != NULL) { 01340 dwData = (ULONG_PTR)HMValidateHandle((HANDLE)dwData, TYPE_CURSOR); 01341 if ((PVOID)dwData == NULL) { 01342 if (index == GCLP_HICON || index == GCLP_HICONSM) { 01343 RIPERR0(ERROR_INVALID_ICON_HANDLE, RIP_WARNING, "SetClassData: invalid icon"); 01344 } else { 01345 RIPERR0(ERROR_INVALID_CURSOR_HANDLE, RIP_WARNING, "SetClassData: invalid cursor"); 01346 } 01347 } 01348 } 01349 01350 /* 01351 * Handle the locking issue. 01352 */ 01353 pcls = pcls->pclsBase; 01354 switch (index) { 01355 case GCLP_HICON: 01356 case GCLP_HICONSM: 01357 dwOld = (ULONG_PTR)xxxSetClassIcon(pwnd, pcls, (PCURSOR)dwData, index); 01358 break; 01359 01360 case GCLP_HCURSOR: 01361 dwOld = (ULONG_PTR)Lock(&pcls->spcur, dwData); 01362 break; 01363 } 01364 01365 /* 01366 * Now set it for each clone class. 01367 */ 01368 pcls = pcls->pclsClone; 01369 while (pcls != NULL) { 01370 switch(index) { 01371 case GCLP_HICON: 01372 case GCLP_HICONSM: 01373 xxxSetClassIcon(pwnd, pcls, (PCURSOR)dwData, index); 01374 break; 01375 01376 case GCLP_HCURSOR: 01377 Lock(&pcls->spcur, dwData); 01378 break; 01379 } 01380 pcls = pcls->pclsNext; 01381 } 01382 01383 return (ULONG_PTR)PtoH((PVOID)dwOld); 01384 }

VOID SetDebugHotKeys  ) 
 

Definition at line 26 of file hotkeys.c.

References _RegisterHotKey(), _UnregisterHotKey(), FastGetProfileDwordW(), gKeyboardInfo, IDHOT_DEBUG, IDHOT_DEBUGSERVER, L, NULL, PMAP_AEDEBUG, PWND_INPUTOWNER, UINT, and VOID().

Referenced by ProcessDeviceChanges(), and RawInputThread().

00027 { 00028 UINT VkDebug; 00029 00030 VkDebug = FastGetProfileDwordW(NULL, PMAP_AEDEBUG, L"UserDebuggerHotkey", 0); 00031 if (VkDebug == 0) { 00032 if (ENHANCED_KEYBOARD(gKeyboardInfo.KeyboardIdentifier)) { 00033 VkDebug = VK_F12; 00034 } else { 00035 VkDebug = VK_SUBTRACT; 00036 } 00037 } else { 00038 UserAssert((0xFFFFFF00 & VkDebug) == 0); 00039 } 00040 00041 _UnregisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUG); 00042 _UnregisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUGSERVER); 00043 00044 _RegisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUG, 0, VkDebug); 00045 _RegisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUGSERVER, MOD_SHIFT, VkDebug); 00046 }

void FAR SetDesktopMetrics  ) 
 

Definition at line 336 of file rare.c.

References GetPrimaryMonitor(), tagMONITOR::rcWork, and SYSMET.

Referenced by SetNCMetrics(), UpdateUserScreen(), and xxxSystemParametersInfo().

00337 { 00338 LPRECT lprcWork; 00339 00340 lprcWork = &GetPrimaryMonitor()->rcWork; 00341 00342 SYSMET(CXFULLSCREEN) = lprcWork->right - lprcWork->left; 00343 SYSMET(CXMAXIMIZED) = lprcWork->right - lprcWork->left + 2*SYSMET(CXSIZEFRAME); 00344 00345 SYSMET(CYFULLSCREEN) = lprcWork->bottom - lprcWork->top - SYSMET(CYCAPTION); 00346 SYSMET(CYMAXIMIZED) = lprcWork->bottom - lprcWork->top + 2*SYSMET(CYSIZEFRAME); 00347 }

VOID SetDialogPointer PWND  pwnd,
LONG_PTR  lPtr
 

Definition at line 24 of file miscutil.c.

References tagWND::cbwndExtra, ClrWF, FNID_CLEANEDUP_BIT, FNID_DIALOG, GETPTI, PpiCurrent, SetWF, TestWF, VOID(), WFDIALOGWINDOW, and WFSERVERSIDEPROC.

00024 { 00025 00026 if ((pwnd->cbwndExtra < DLGWINDOWEXTRA) 00027 || TestWF(pwnd, WFSERVERSIDEPROC) 00028 || (PpiCurrent() != GETPTI(pwnd)->ppi)) { 00029 RIPMSG1(RIP_WARNING, "SetDialogPointer: Unexpected pwnd:%#p", pwnd); 00030 return; 00031 } 00032 00033 ((PDIALOG)pwnd)->pdlg = (PDLG)lPtr; 00034 00035 if (lPtr == 0) { 00036 pwnd->fnid |= FNID_CLEANEDUP_BIT; 00037 ClrWF(pwnd, WFDIALOGWINDOW); 00038 } else { 00039 if (pwnd->fnid == 0) { 00040 pwnd->fnid = FNID_DIALOG; 00041 } 00042 SetWF(pwnd, WFDIALOGWINDOW); 00043 } 00044 00045 00046 }

BOOL SetEmptyRgn HRGN  hrgn  ) 
 

Definition at line 97 of file visrgn.c.

References PZERO, and SetRectRgnIndirect().

Referenced by _GetDCEx(), InternalScrollDC(), UserSetDCVisRgn(), xxxGetUpdateRgn(), xxxInternalInvalidate(), and xxxScrollWindowEx().

00098 { 00099 return SetRectRgnIndirect(hrgn, PZERO(RECT)); 00100 }

__inline void SetFlashWindowState PWND  pwnd,
DWORD  dwState
 

Definition at line 5662 of file userk.h.

References BOOL.

Referenced by xxxFlashWindow().

05669 {

VOID SetForegroundPriority PTHREADINFO  pti,
BOOL  fSetForeground
 

Definition at line 2708 of file focusact.c.

References NULL, tagTHREADINFO::ppi, SetForegroundPriorityProcess(), TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, and VOID().

Referenced by CheckProcessForeground(), NtUserYieldTask(), SetForegroundThread(), SetWakeBit(), xxxCreateThreadInfo(), xxxInternalGetMessage(), and xxxMoveSize().

02711 { 02712 UserAssert(pti != NULL); 02713 02714 /* 02715 * We don't want to change the priority of system or console threads 02716 */ 02717 if (pti->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) 02718 return; 02719 02720 SetForegroundPriorityProcess(pti->ppi, pti, fSetForeground); 02721 }

VOID SetForegroundPriorityProcess PPROCESSINFO  ppi,
PTHREADINFO  pti,
BOOL  fSetForegound
 

Definition at line 2648 of file focusact.c.

References FALSE, gppiForegroundOld, gppiScreenSaver, NULL, _EPROCESS::PriorityClass, PsProcessPriorityBackground, PsProcessPriorityForeground, PsProcessPrioritySpinning, PsSetProcessPriorityByClass(), tagTHREADINFO::TIF_flags, TIF_GLOBALHOOKER, and VOID().

Referenced by IdleTimerProc(), SetForegroundPriority(), and xxxActivateThisWindow().

02652 { 02653 PEPROCESS Process; 02654 UCHAR PriorityClassSave; 02655 02656 UserAssert(ppi != NULL); 02657 02658 Process = ppi->Process; 02659 UserAssert(ppi->Process != NULL); 02660 02661 if (ppi->W32PF_Flags & W32PF_IDLESCREENSAVER) { 02662 fSetForeground = FALSE; 02663 PriorityClassSave = Process->PriorityClass; 02664 Process->PriorityClass = PROCESS_PRIORITY_CLASS_IDLE; 02665 } 02666 02667 /* 02668 * If we previously delayed setting some process to the background 02669 * because a screen saver was starting up, do it now. 02670 */ 02671 if (gppiForegroundOld != NULL) { 02672 if (gppiForegroundOld == ppi) { 02673 gppiForegroundOld = NULL; 02674 } else if (ppi != gppiScreenSaver) { 02675 PsSetProcessPriorityByClass(gppiForegroundOld->Process, PsProcessPriorityBackground); 02676 gppiForegroundOld = NULL; 02677 } 02678 } 02679 02680 /* 02681 * If this app should be background, don't let it go foreground. 02682 * Foreground apps run at a higher base priority. 02683 */ 02684 if (ppi->W32PF_Flags & W32PF_FORCEBACKGROUNDPRIORITY) { 02685 if (pti != NULL && !(pti->TIF_flags & TIF_GLOBALHOOKER)) { 02686 PsSetProcessPriorityByClass(Process, PsProcessPrioritySpinning); 02687 } 02688 } else if (fSetForeground) { 02689 PsSetProcessPriorityByClass(Process, PsProcessPriorityForeground); 02690 } else if (pti != NULL && !(pti->TIF_flags & TIF_GLOBALHOOKER)) { 02691 /* 02692 * Don't adjust the priority of the current foreground process if 02693 * the new foreground process is a screen saver. 02694 */ 02695 if (gppiScreenSaver && gppiScreenSaver != ppi) { 02696 gppiForegroundOld = ppi; 02697 } else { 02698 PsSetProcessPriorityByClass(Process, PsProcessPriorityBackground); 02699 } 02700 } 02701 02702 if (ppi->W32PF_Flags & W32PF_IDLESCREENSAVER) { 02703 Process->PriorityClass = PriorityClassSave; 02704 } 02705 }

VOID SetForegroundThread PTHREADINFO  pti  ) 
 

Definition at line 2588 of file focusact.c.

References CBKEYSTATERECENTDOWN, ChangeForegroundKeyboardTable(), FALSE, gafAsyncKeyStateRecentDown, gpqForeground, gpsi, gptiForeground, gptiRit, NULL, tagTHREADINFO::ppi, tagTHREADINFO::pq, SetForegroundPriority(), tagTHREADINFO::spklActive, TRUE, and VOID().

Referenced by xxxDestroyThreadInfo(), xxxSendFocusMessages(), and xxxSetForegroundWindow2().

02590 { 02591 PKL pklPrev; 02592 02593 if (pti == gptiForeground) 02594 return; 02595 02596 /* 02597 * The foregorund thread must be on the foreground queue. 02598 * xxxSendFocusMessages obtains this pti from a window 02599 * received as a parameter. If the owner of the window 02600 * exited during a callback (in the caller), then the pti 02601 * will be gptiRit,which might not be in the foreground queue 02602 */ 02603 UserAssert((pti == NULL) 02604 || (pti->pq == gpqForeground) 02605 || (pti == gptiRit)); 02606 02607 /* 02608 * If we're changing gptiForeground to another process, 02609 * change the base priorities of the two processes. We 02610 * know that if either 'pti' or 'gptiForeground' is NULL 02611 * that both aren't NULL due to the first test in this 02612 * function. 02613 */ 02614 if ((pti == NULL) || (gptiForeground == NULL) || 02615 (pti->ppi != gptiForeground->ppi)) { 02616 if (gptiForeground != NULL) { 02617 gptiForeground->ppi->W32PF_Flags &= ~W32PF_FORCEBACKGROUNDPRIORITY; 02618 SetForegroundPriority(gptiForeground, FALSE); 02619 } 02620 02621 if (pti != NULL) { 02622 SetForegroundPriority(pti, TRUE); 02623 } 02624 } 02625 02626 if (gptiForeground) { 02627 pklPrev = gptiForeground->spklActive; 02628 } else { 02629 pklPrev = NULL; 02630 } 02631 gptiForeground = pti; 02632 if (gptiForeground && gptiForeground->spklActive) { 02633 ChangeForegroundKeyboardTable(pklPrev, gptiForeground->spklActive); 02634 } 02635 02636 /* 02637 * Clear recent down information in the async key state to prevent 02638 * spying by apps. 02639 */ 02640 RtlZeroMemory(gafAsyncKeyStateRecentDown, CBKEYSTATERECENTDOWN); 02641 02642 /* 02643 * Update the async key cache index. 02644 */ 02645 gpsi->dwAsyncKeyCache++; 02646 }

BOOL SetHandleFlag HANDLE  ,
DWORD  ,
BOOL 
 

Definition at line 4494 of file desktop.c.

References tagPROCESSINFO::bmHandleFlags, BOOL, Buffer, EnterHandleFlagsCrit(), FALSE, HF_LIMIT, Index, LeaveHandleFlagsCrit(), NULL, PpiCurrent, RtlClearBits(), RtlInitializeBitMap(), RtlSetBits(), and TRUE.

Referenced by _SetUserObjectInformation(), EnterHandleFlagsCrit(), NtUserOpenInputDesktop(), OpenDesktopCompletion(), xxxCloseDesktop(), xxxCreateDesktop(), xxxGetInputDesktop(), xxxGetThreadDesktop(), xxxOpenDesktop(), xxxSetProcessWindowStation(), and zzzSetDesktop().

04498 { 04499 PPROCESSINFO ppi; 04500 ULONG Index = ((PEXHANDLE)&hObject)->Index * HF_LIMIT + dwFlag; 04501 PRTL_BITMAP pbm; 04502 ULONG cBits; 04503 PULONG Buffer; 04504 BOOL fRet = TRUE; 04505 04506 UserAssert(dwFlag < HF_LIMIT); 04507 04508 EnterHandleFlagsCrit(); 04509 04510 if ((ppi = PpiCurrent()) != NULL) { 04511 pbm = &ppi->bmHandleFlags; 04512 if (fSet) { 04513 04514 /* 04515 * Expand the bitmap if needed 04516 */ 04517 if (Index >= pbm->SizeOfBitMap) { 04518 /* 04519 * Index is zero-based - cBits is an exact number of dwords 04520 */ 04521 cBits = ((Index + 1) + 0x1F) & ~0x1F; 04522 Buffer = UserAllocPoolWithQuotaZInit(cBits / 8, TAG_PROCESSINFO); 04523 if (Buffer == NULL) { 04524 fRet = FALSE; 04525 goto Exit; 04526 } 04527 if (pbm->Buffer) { 04528 RtlCopyMemory(Buffer, pbm->Buffer, pbm->SizeOfBitMap / 8); 04529 UserFreePool(pbm->Buffer); 04530 } 04531 04532 RtlInitializeBitMap(pbm, Buffer, cBits); 04533 } 04534 04535 RtlSetBits(pbm, Index, 1); 04536 } else if (Index < pbm->SizeOfBitMap) { 04537 RtlClearBits(pbm, Index, 1); 04538 } 04539 } 04540 04541 Exit: 04542 LeaveHandleFlagsCrit(); 04543 04544 return fRet; 04545 }

VOID SetHandleInUse HANDLE   ) 
 

Definition at line 4579 of file desktop.c.

References EnterHandleFlagsCrit(), gHandleInUse, gProcessInUse, LeaveHandleFlagsCrit(), PsGetCurrentProcess, and VOID().

Referenced by NtUserGetObjectInformation(), and NtUserSetObjectInformation().

04581 { 04582 EnterHandleFlagsCrit(); 04583 gProcessInUse = PsGetCurrentProcess(); 04584 gHandleInUse = hObject; 04585 LeaveHandleFlagsCrit(); 04586 }

VOID SetHungFlag PWND  pwnd,
WORD  wFlag
 

Definition at line 26 of file hungapp.c.

References CHRLINCR, gpvwplHungRedraw, PWNDDESKTOP, SetWF, tagWND::spwndParent, TestWF, VOID(), VWPLAdd(), and WFANYHUNGREDRAW.

Referenced by InternalInvalidate3(), and xxxSetForegroundWindow2().

00029 { 00030 /* 00031 * If the window has no hung redraw bits set and it's a top-level 00032 * window, add it to the redraw list. 00033 */ 00034 if (!TestWF(pwnd, WFANYHUNGREDRAW) && pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00035 /* 00036 * Add pwnd to the Hung Redraw Volatile Window Pointer List. 00037 */ 00038 VWPLAdd(&gpvwplHungRedraw, pwnd, CHRLINCR); 00039 } 00040 00041 SetWF(pwnd, wFlag); 00042 }

BOOL SetIconMetrics PUNICODE_STRING  pProfileUserName,
LPICONMETRICS  lpicon
 

Definition at line 1213 of file inctlpan.c.

References BOOL, FALSE, HDCBITS, max, MetricGetID(), PUDF_ICONTITLEWRAP, SET_OR_CLEAR_PUDF, SetIconFonts(), SYSMET, and TRUE.

Referenced by SPISetIconMetrics(), xxxInitWindowStation(), and xxxUpdatePerUserSystemParameters().

01216 { 01217 ICONMETRICS icon; 01218 01219 if (!SetIconFonts(pProfileUserName,lpicon)) { 01220 RIPMSG0(RIP_WARNING, "SetIconMetrics failed in SetIconFonts"); 01221 return FALSE; 01222 } 01223 01224 if (!lpicon) { 01225 01226 icon.iTitleWrap = MetricGetID(pProfileUserName, 01227 STR_ICONTITLEWRAP, TRUE); 01228 01229 icon.iHorzSpacing = MetricGetID(pProfileUserName, 01230 STR_ICONHORZSPACING, 01231 (GreGetDeviceCaps(HDCBITS(), LOGPIXELSX) * 75) / 96); 01232 01233 icon.iVertSpacing = MetricGetID(pProfileUserName, 01234 STR_ICONVERTSPACING, 01235 (GreGetDeviceCaps(HDCBITS(), LOGPIXELSY) * 75) / 96); 01236 01237 lpicon = &icon; 01238 } 01239 01240 /* 01241 * SANITY CHECK for metric values 01242 */ 01243 lpicon->iHorzSpacing = max(lpicon->iHorzSpacing, (int)SYSMET(CXICON)); 01244 lpicon->iVertSpacing = max(lpicon->iVertSpacing, (int)SYSMET(CYICON)); 01245 01246 SYSMET(CXICONSPACING) = (int) lpicon->iHorzSpacing; 01247 SYSMET(CYICONSPACING) = (int) lpicon->iVertSpacing; 01248 SET_OR_CLEAR_PUDF(PUDF_ICONTITLEWRAP, lpicon->iTitleWrap); 01249 01250 return TRUE; 01251 }

BOOL SetImeHotKey DWORD  dwHotKeyID,
UINT  uModifiers,
UINT  uVKey,
HKL  hKL,
DWORD  dwAction
 

Definition at line 106 of file imehotky.c.

References AddImeHotKey(), DeleteImeHotKey(), _tagIMEHOTKEY::dwHotKeyID, FALSE, FindImeHotKeyByID(), FindImeHotKeyByKeyWithLang(), GetHotKeyLangID(), gpImeHotKeyListHeader, _tagIMEHOTKEYOBJ::hk, _tagIMEHOTKEY::hKL, IMEHOTKEYOBJ, ISHK_ADD, ISHK_INITIALIZE, ISHK_REMOVE, MOD_BOTH_SIDES, MOD_MODIFY_KEYS, NULL, _tagIMEHOTKEYOBJ::pNext, TRUE, _tagIMEHOTKEY::uModifiers, and _tagIMEHOTKEY::uVKey.

Referenced by NtUserSetImeHotKey().

00112 { 00113 PIMEHOTKEYOBJ ph; 00114 00115 switch ( dwAction ) { 00116 case ISHK_REMOVE: 00117 ph = FindImeHotKeyByID( gpImeHotKeyListHeader, dwHotKeyID ); 00118 if ( ph != NULL ) { 00119 if ( DeleteImeHotKey( &gpImeHotKeyListHeader, ph ) == ph ) { 00120 UserFreePool( ph ); 00121 return ( TRUE ); 00122 } else { 00123 RIPMSG0( RIP_ERROR, "IME hotkey list is messed up" ); 00124 return FALSE; 00125 } 00126 } else { 00127 RIPERR0( ERROR_INVALID_PARAMETER, 00128 RIP_WARNING, 00129 "no such IME hotkey registered"); 00130 return FALSE; 00131 } 00132 break; 00133 00134 case ISHK_INITIALIZE: 00135 ph = gpImeHotKeyListHeader; 00136 while ( ph != NULL ) { 00137 PIMEHOTKEYOBJ phNext; 00138 00139 phNext = ph->pNext; 00140 UserFreePool( ph ); 00141 ph = phNext; 00142 } 00143 gpImeHotKeyListHeader = NULL; 00144 return TRUE; 00145 00146 case ISHK_ADD: 00147 if (dwHotKeyID >= IME_KHOTKEY_FIRST && dwHotKeyID <= IME_KHOTKEY_LAST) { 00148 // Korean IME does not want any IMM hotkey handling. 00149 // We should not register any Korean IME hot keys. 00150 return FALSE; 00151 } 00152 00153 if ((WORD)uVKey == VK_PACKET) { 00154 // 00155 // VK_PACKET should not be a IME hot key. 00156 // 00157 return FALSE; 00158 } 00159 00160 ph = FindImeHotKeyByKeyWithLang(gpImeHotKeyListHeader, 00161 uModifiers & MOD_MODIFY_KEYS, 00162 uModifiers & MOD_BOTH_SIDES, 00163 uVKey, 00164 GetHotKeyLangID(dwHotKeyID)); 00165 if ( ph != NULL ) { 00166 if ( ph->hk.dwHotKeyID != dwHotKeyID ) { 00167 RIPERR0( ERROR_HOTKEY_ALREADY_REGISTERED, 00168 RIP_WARNING, 00169 "There is an IME hotkey that has the same vkey/modifiers/Lang Id"); 00170 return FALSE; 00171 } 00172 // So far we found a hotkey that has the 00173 // same vkey and same ID. 00174 // But because modifiers may be slightly 00175 // different, so go ahead and change it. 00176 } else { 00177 // 00178 // the specified vkey/modifiers combination cound not be found 00179 // in the hotkey list. The caller may want to change the key 00180 // assignment of an existing hotkey or add a new hotkey. 00181 // 00182 ph = FindImeHotKeyByID( gpImeHotKeyListHeader, dwHotKeyID ); 00183 } 00184 00185 if ( ph == NULL ) { 00186 // 00187 // adding a new hotkey 00188 // 00189 ph = (PIMEHOTKEYOBJ)UserAllocPool( sizeof(IMEHOTKEYOBJ), TAG_IMEHOTKEY ); 00190 if ( ph == NULL ) { 00191 RIPERR0( ERROR_OUTOFMEMORY, 00192 RIP_WARNING, 00193 "Memory allocation failed in SetImeHotKey"); 00194 return FALSE; 00195 } 00196 ph->hk.dwHotKeyID = dwHotKeyID; 00197 ph->hk.uModifiers = uModifiers; 00198 ph->hk.uVKey = uVKey; 00199 ph->hk.hKL = hKL; 00200 ph->pNext = NULL; 00201 AddImeHotKey( &gpImeHotKeyListHeader, ph ); 00202 00203 } else { 00204 // 00205 // changing an existing hotkey 00206 // 00207 ph->hk.uModifiers = uModifiers; 00208 ph->hk.uVKey = uVKey; 00209 ph->hk.hKL = hKL; 00210 00211 } 00212 return TRUE; 00213 } 00214 00215 return FALSE; 00216 }

BOOL SetImeInfoEx IN PWINDOWSTATION  pwinsta,
IN PIMEINFOEX  piiex
 

Referenced by NtUserSetImeInfoEx().

NTSTATUS SetInformationProcess IN HANDLE  hProcess,
IN USERPROCESSINFOCLASS  ProcessInfoClass,
IN PVOID  ProcessInformation,
IN ULONG  ProcessInformationLength
 

Definition at line 6357 of file queue.c.

References DWORD, FALSE, ISCSRSS, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), PpiFromProcess, PsProcessType, Status, UnlockProcess, and UserMode.

Referenced by NtUserSetInformationProcess().

06362 { 06363 PUSERPROCESS_FLAGS pFlags; 06364 DWORD dwOldFlags; 06365 NTSTATUS Status = STATUS_SUCCESS; 06366 PEPROCESS Process; 06367 PPROCESSINFO ppi; 06368 06369 UNREFERENCED_PARAMETER(ProcessInformationLength); 06370 06371 UserAssert(ISCSRSS()); 06372 06373 Status = ObReferenceObjectByHandle(hProcess, 06374 PROCESS_SET_INFORMATION, 06375 *PsProcessType, 06376 UserMode, 06377 &Process, 06378 NULL); 06379 if (!NT_SUCCESS(Status)) { 06380 return Status; 06381 } 06382 06383 ppi = PpiFromProcess(Process); 06384 06385 switch (ProcessInfoClass) { 06386 case UserProcessFlags: 06387 if (ppi == NULL) { 06388 Status = STATUS_INVALID_HANDLE; 06389 } else { 06390 UserAssert(ProcessInformationLength == sizeof(USERPROCESS_FLAGS)); 06391 pFlags = ProcessInformation; 06392 dwOldFlags = ppi->W32PF_Flags; 06393 ppi->W32PF_Flags ^= ((dwOldFlags ^ pFlags->dwFlags) & pFlags->dwMask); 06394 } 06395 break; 06396 06397 default: 06398 Status = STATUS_INVALID_INFO_CLASS; 06399 UserAssert(FALSE); 06400 break; 06401 } 06402 06403 UnlockProcess(Process); 06404 06405 return Status; 06406 }

VOID SetJournalTimer DWORD  dt,
UINT  msgJournal
 

Definition at line 693 of file timers.c.

References dt(), InternalSetTimer(), JournalTimer(), NULL, and PtiCurrent.

Referenced by xxxGetNextSysMsg().

00696 { 00697 static UINT_PTR idJournal = 0; 00698 00699 PtiCurrent()->pq->msgJournal = msgJournal; 00700 00701 /* 00702 * Remember idJournal - because TMRF_ONESHOT timers stay in the timer 00703 * list - by remembering the idJournal, we always reuse the same timer 00704 * rather than creating new ones always. 00705 */ 00706 idJournal = InternalSetTimer(NULL, 00707 idJournal, 00708 dt, 00709 JournalTimer, 00710 TMRF_RIT | TMRF_ONESHOT); 00711 }

VOID SetKeyboardRate UINT  nKeySpeed  ) 
 

Definition at line 2932 of file ntinput.c.

References gdwUpdateKeyboard, gKeyboardInfo, gktp, KDELAY_MASK, KDELAY_SHIFT, KSPEED_MASK, UINT, UPDATE_KBD_TYPEMATIC, USHORT, and VOID().

Referenced by LW_DriversInit(), and xxxSystemParametersInfo().

02935 { 02936 UINT nKeyDelay; 02937 UINT nKeySpeed; 02938 02939 nKeyDelay = (nKeySpeedAndDelay & KDELAY_MASK) >> KDELAY_SHIFT; 02940 02941 nKeySpeed = KSPEED_MASK & nKeySpeedAndDelay; 02942 02943 gktp.Rate = (USHORT)( ( gKeyboardInfo.KeyRepeatMaximum.Rate - 02944 gKeyboardInfo.KeyRepeatMinimum.Rate 02945 ) * nKeySpeed / KSPEED_MASK 02946 ) + 02947 gKeyboardInfo.KeyRepeatMinimum.Rate; 02948 02949 gktp.Delay = (USHORT)( ( gKeyboardInfo.KeyRepeatMaximum.Delay - 02950 gKeyboardInfo.KeyRepeatMinimum.Delay 02951 ) * nKeyDelay / (KDELAY_MASK >> KDELAY_SHIFT) 02952 ) + 02953 gKeyboardInfo.KeyRepeatMinimum.Delay; 02954 02955 /* 02956 * Hand off the IOCTL to the RIT, since only the system process can 02957 * access keyboard handles 02958 */ 02959 gdwUpdateKeyboard |= UPDATE_KBD_TYPEMATIC; 02960 }

VOID SetMinimize PWND  pwnd,
UINT  uFlags
 

Definition at line 5176 of file swp.c.

References cDecVis(), ClrWF, DecVisWindows(), IncVisWindows(), SetWF, SMIN_SET, TestWF, VOID(), WFMINIMIZED, and WFVISIBLE.

Referenced by xxxCreateWindowEx(), xxxMinMaximize(), and xxxMS_TrackMove().

05179 { 05180 /* 05181 * Note that Dec and IncVisWindows check the WFMINIMIZED flag, so the order 05182 * in which we set/clear the flag and call these functions is important 05183 * If the window is not WFVISIBLE, cVisWindows must not change. 05184 */ 05185 if (uFlags & SMIN_SET) { 05186 UserAssert(!TestWF(pwnd, WFMINIMIZED)); 05187 if (TestWF(pwnd, WFVISIBLE)) { 05188 /* 05189 * Decrement the count because the window is not minimized 05190 * and visible, and we're about to mark it as minimized 05191 */ 05192 05193 #if DBG 05194 cDecVis(pwnd); 05195 #else 05196 DecVisWindows(pwnd); 05197 #endif 05198 } 05199 SetWF(pwnd, WFMINIMIZED); 05200 05201 #if DBG 05202 VerifycVisWindows(pwnd); 05203 #endif 05204 } else { 05205 05206 UserAssert(TestWF(pwnd, WFMINIMIZED)); 05207 ClrWF(pwnd, WFMINIMIZED); 05208 if (TestWF(pwnd, WFVISIBLE)) { 05209 /* 05210 * Increment the count because the window is visible 05211 * and it's no longer marked as minimized 05212 */ 05213 IncVisWindows(pwnd); 05214 } 05215 } 05216 }

VOID SetMinMetrics PUNICODE_STRING  pProfileUserName,
LPMINIMIZEDMETRICS  lpmin
 

Definition at line 1170 of file inctlpan.c.

References max, MetricGetID(), min, SYSMET, and VOID().

Referenced by xxxInitWindowStation(), xxxSetAndDrawMinMetrics(), and xxxUpdatePerUserSystemParameters().

01173 { 01174 MINIMIZEDMETRICS min; 01175 01176 if (!lpmin) { 01177 01178 /* 01179 * Minimized 01180 */ 01181 min.iWidth = MetricGetID(pProfileUserName,STR_MINWIDTH, 154); 01182 min.iHorzGap = MetricGetID(pProfileUserName,STR_MINHORZGAP, 0); 01183 min.iVertGap = MetricGetID(pProfileUserName,STR_MINVERTGAP, 0); 01184 min.iArrange = MetricGetID(pProfileUserName,STR_MINARRANGE, ARW_BOTTOMLEFT | ARW_RIGHT); 01185 lpmin = &min; 01186 } 01187 01188 /* 01189 * SANITY CHECK for metric values 01190 */ 01191 01192 /* 01193 * Minimized window -- Text area must be >= 0, as must gap between 01194 * windows horizontally and vertically. 01195 */ 01196 lpmin->iWidth = max(lpmin->iWidth, 0); 01197 lpmin->iHorzGap = max(lpmin->iHorzGap, 0); 01198 lpmin->iVertGap = max(lpmin->iVertGap, 0); 01199 lpmin->iArrange &= ARW_VALID; 01200 01201 /* 01202 * Minimized size 01203 */ 01204 SYSMET(CXMINIMIZED) = 2*SYSMET(CXFIXEDFRAME) + (int) lpmin->iWidth; 01205 SYSMET(CYMINIMIZED) = 2*SYSMET(CYFIXEDFRAME) + SYSMET(CYSIZE); 01206 01207 SYSMET(CXMINSPACING) = SYSMET(CXMINIMIZED) + (int) lpmin->iHorzGap; 01208 SYSMET(CYMINSPACING) = SYSMET(CYMINIMIZED) + (int) lpmin->iVertGap; 01209 01210 SYSMET(ARRANGE) = (int) lpmin->iArrange; 01211 }

void SetMsgBox PWND  pwnd  ) 
 

Definition at line 3779 of file rare.c.

References tagWND::head, SetWF, and WFMSGBOX.

03780 { 03781 pwnd->head.rpdesk->pDeskInfo->cntMBox++; 03782 SetWF(pwnd, WFMSGBOX); 03783 return; 03784 }

HRGN SetOrCreateRectRgnIndirectPublic HRGN *  phrgn,
LPCRECT  lprc
 

Definition at line 115 of file visrgn.c.

References SetRectRgnIndirect().

Referenced by CalcVisRgn(), CalcWindowVisRgn(), SpbCheckRect2(), and UpdateUserScreen().

00116 { 00117 if (*phrgn) { 00118 UserVerify(SetRectRgnIndirect(*phrgn, lprc)); 00119 } else if (*phrgn = GreCreateRectRgnIndirect((LPRECT) lprc)) { 00120 UserVerify(GreSetRegionOwner(*phrgn, OBJECT_OWNER_PUBLIC)); 00121 } 00122 00123 return *phrgn; 00124 }

void SetPointer BOOL  fSet  ) 
 

Definition at line 676 of file ntuser/kernel/cursor.c.

References FCursorShadowed(), GETPCI, gpDispInfo, gpqCursor, tagDISPLAYINFO::hDev, tagQ::iCursorLevel, NULL, tagQ::spcurCurrent, and SYSMET.

Referenced by xxxMakeWindowForegroundWithState(), xxxRemoteReconnect(), xxxSwitchDesktop(), xxxSystemParametersInfo(), xxxUserChangeDisplaySettings(), xxxUserResetDisplayDevice(), and zzzUpdateCursorImage().

00677 { 00678 if (fSet) { 00679 if (gpqCursor != NULL && gpqCursor->iCursorLevel >= 0 && 00680 gpqCursor->spcurCurrent != NULL && 00681 SYSMET(MOUSEPRESENT)) { 00682 00683 PCURSINFO pci = GETPCI(gpqCursor->spcurCurrent); 00684 ULONG fl = FCursorShadowed(pci) ? SPS_ALPHA : 0; 00685 00686 GreSetPointer(gpDispInfo->hDev, pci, fl); 00687 } 00688 } else { 00689 GreSetPointer(gpDispInfo->hDev, NULL, 0); 00690 } 00691 }

BOOL SetRectRgnIndirect HRGN  hrgn,
LPCRECT  lprc
 

Definition at line 40 of file visrgn.c.

Referenced by CalcWindowRgn(), CalcWindowVisRgn(), CreateSpb(), InternalInvalidate2(), InternalScrollDC(), LockWindowUpdate2(), RestoreSpb(), SetEmptyRgn(), SetOrCreateRectRgnIndirectPublic(), SmartRectInRegion(), SpbCheckRect2(), ValidateParents(), xxxGetUpdateRgn(), xxxRedrawHungWindow(), xxxRedrawWindow(), and zzzBltValidBits().

00041 { 00042 return GreSetRectRgn(hrgn, lprc->left, lprc->top, lprc->right, lprc->bottom); 00043 }

VOID SetSysColor UINT  icol,
DWORD  rgb,
UINT  uOptions
 

Definition at line 121 of file sysmet.c.

References DWORD, tagDISPLAYINFO::fAnyPalette, gpDispInfo, gpsi, tagDISPLAYINFO::hdcScreen, NULL, SSCF_16COLORS, SSCF_FORCESOLIDCOLOR, SSCF_SETMAGICCOLORS, SYSHBRUSH, and VOID().

Referenced by xxxSetSysColors().

00126 { 00127 00128 if ((uOptions & SSCF_SETMAGICCOLORS) && gpDispInfo->fAnyPalette) { 00129 union { 00130 DWORD rgb; 00131 PALETTEENTRY pe; 00132 } peMagic; 00133 00134 peMagic.rgb = rgb; 00135 00136 /* 00137 * when any of the 3D colors are changing, call GDI to 00138 * set the apropiate "magic" color 00139 * 00140 * the four magic colors are reserved like so 00141 * 00142 * 8 - UI color (3D shadow) 00143 * 9 - UI color (3D face) 00144 * 00145 * F6 - UI color (3D hilight) 00146 * F7 - UI color (desktop) 00147 * 00148 * NOTE (3D hilight) inverts to (3D shadow) 00149 * (3D face) inverts to sys gray 00150 * 00151 */ 00152 00153 switch (icol) 00154 { 00155 case COLOR_3DSHADOW: 00156 GreSetMagicColors(gpDispInfo->hdcScreen, peMagic.pe, 8); 00157 break; 00158 00159 case COLOR_3DFACE: 00160 GreSetMagicColors(gpDispInfo->hdcScreen, peMagic.pe, 9); 00161 break; 00162 00163 case COLOR_3DHILIGHT: 00164 GreSetMagicColors(gpDispInfo->hdcScreen, peMagic.pe, 246); 00165 break; 00166 00167 case COLOR_DESKTOP: 00168 GreSetMagicColors(gpDispInfo->hdcScreen, peMagic.pe, 247); 00169 break; 00170 } 00171 } 00172 00173 if (uOptions & SSCF_16COLORS) { 00174 /* 00175 * Force solid colors for all elements in 16 color or less modes. 00176 */ 00177 rgb = GreGetNearestColor(gpDispInfo->hdcScreen, rgb); 00178 } else if (uOptions & SSCF_FORCESOLIDCOLOR) { 00179 /* 00180 * Force solid colors for certain window elements. 00181 */ 00182 switch (icol) { 00183 00184 /* 00185 * These can be dithers 00186 */ 00187 case COLOR_DESKTOP: 00188 case COLOR_ACTIVEBORDER: 00189 case COLOR_INACTIVEBORDER: 00190 case COLOR_APPWORKSPACE: 00191 case COLOR_INFOBK: 00192 case COLOR_GRADIENTACTIVECAPTION: 00193 case COLOR_GRADIENTINACTIVECAPTION: 00194 break; 00195 00196 default: 00197 rgb = GreGetNearestColor(gpDispInfo->hdcScreen, rgb); 00198 break; 00199 } 00200 } 00201 00202 gpsi->argbSystem[icol] = rgb; 00203 if (SYSHBRUSH(icol) == NULL) { 00204 /* 00205 * This is the first time we're setting up the system colors. 00206 * We need to create the brush 00207 */ 00208 SYSHBRUSH(icol) = GreCreateSolidBrush(rgb); 00209 GreMarkUndeletableBrush(SYSHBRUSH(icol)); 00210 GreSetBrushOwnerPublic(SYSHBRUSH(icol)); 00211 } else { 00212 GreSetSolidBrush(SYSHBRUSH(icol), rgb); 00213 } 00214 }

VOID SetTiledRect PWND  pwnd,
LPRECT  lprc,
PMONITOR  pMonitor
 

Definition at line 1333 of file createw.c.

References tagMONITOR::cWndStack, GetRealClientRect(), GRC_MINWNDS, MultDiv, PWNDDESKTOP, and SYSMET.

Referenced by xxxCreateWindowEx().

01337 { 01338 POINT pt; 01339 RECT rcT; 01340 01341 UserAssert(pMonitor->cWndStack >= 0); 01342 01343 /* 01344 * Get available desktop area, minus minimized spacing area. 01345 */ 01346 GetRealClientRect(PWNDDESKTOP(pwnd), &rcT, GRC_MINWNDS, pMonitor); 01347 01348 /* 01349 * Normalized rectangle is 3/4 width, 3/4 height of desktop area. We 01350 * offset it based on the value of giwndStack for cascading. 01351 */ 01352 01353 /* 01354 * We want the left edge of the new window to align with the 01355 * right edge of the old window's system menu. And we want the 01356 * top edge of the new window to align with the bottom edge of the 01357 * selected caption area (caption height - cyBorder) of the old 01358 * window. 01359 */ 01360 pt.x = pMonitor->cWndStack * (SYSMET(CXSIZEFRAME) + SYSMET(CXSIZE)); 01361 pt.y = pMonitor->cWndStack * (SYSMET(CYSIZEFRAME) + SYSMET(CYSIZE)); 01362 01363 /* 01364 * If below upper top left 1/4 of free area, reset. 01365 */ 01366 if ( (pt.x > ((rcT.right-rcT.left) / 4)) || 01367 (pt.y > ((rcT.bottom-rcT.top) / 4)) ) { 01368 01369 pMonitor->cWndStack = 0; 01370 pt.x = 0; 01371 pt.y = 0; 01372 } 01373 01374 /* 01375 * Get starting position 01376 */ 01377 pt.x += rcT.left; 01378 pt.y += rcT.top; 01379 01380 lprc->left = pt.x; 01381 lprc->top = pt.y; 01382 lprc->right = pt.x + MultDiv(rcT.right-rcT.left, 3, 4); 01383 lprc->bottom = pt.y + MultDiv(rcT.bottom-rcT.top, 3, 4); 01384 01385 /* 01386 * Increment the count of stacked windows. 01387 */ 01388 pMonitor->cWndStack++; 01389 }

VOID SetVisible PWND  pwnd,
UINT  flags
 

Definition at line 5237 of file swp.c.

References ClrFTrueVis(), ClrWF, DecVisWindows(), IncVisWindows(), SetWF, SV_CLRFTRUEVIS, SV_SET, TestWF, VOID(), WFDESTROYED, WFINDESTROY, and WFVISIBLE.

Referenced by xxxCreateWindowEx(), xxxCreateWindowStation(), xxxDesktopThread(), xxxDestroyWindow(), xxxDWP_SetRedraw(), xxxDWPPrint(), xxxFW_DestroyAllChildren(), xxxMinimizeHungWindow(), xxxMNCloseHierarchy(), xxxProcessHungThreadEvent(), xxxShowOwnedWindows(), xxxShowWindow(), zzzActiveCursorTracking(), and zzzChangeStates().

05240 { 05241 if (flags & SV_SET) { 05242 05243 #if DBG 05244 if (TestWF(pwnd, WFINDESTROY)) { 05245 RIPMSG1(RIP_WARNING, "SetVisible: show INDESTROY %#p", pwnd); 05246 } 05247 #endif 05248 05249 if (TestWF(pwnd, WFVISIBLE)) { 05250 RIPMSG1(RIP_WARNING, "SetVisible: already visible %#p", pwnd); 05251 } else { 05252 SetWF(pwnd, WFVISIBLE); 05253 IncVisWindows(pwnd); 05254 } 05255 } else { 05256 05257 if (flags & SV_CLRFTRUEVIS) 05258 ClrFTrueVis(pwnd); 05259 05260 #if DBG 05261 if (TestWF(pwnd, WFDESTROYED)) { 05262 RIPMSG1(RIP_WARNING, "SetVisible: hide DESTROYED %#p", pwnd); 05263 } 05264 #endif 05265 05266 if (TestWF(pwnd, WFVISIBLE)) { 05267 ClrWF(pwnd, WFVISIBLE); 05268 DecVisWindows(pwnd); 05269 } else { 05270 RIPMSG1(RIP_WARNING, "SetVisible: already hidden %#p", pwnd); 05271 } 05272 } 05273 }

VOID SetWakeBit PTHREADINFO  pti,
UINT  wWakeBit
 

Definition at line 4578 of file queue.c.

References CheckCritIn, FALSE, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeBits, tagCLIENTTHREADINFO::fsWakeMask, gpsi, gptSSCursor, KeSetEvent(), tagTDB::nEvents, tagTHREADINFO::pcti, tagTHREADINFO::pEventQueueServer, tagTHREADINFO::ppi, tagTHREADINFO::pq, tagTHREADINFO::ptdb, tagQ::ptiKeyboard, tagQ::ptiMouse, SetForegroundPriority(), TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, VOID(), and WakeWowTask().

Referenced by _PostMessage(), _PostThreadMessage(), _ReplyMessage(), DestroyProcessInfo(), DoTimer(), IncPaintCount(), IPostQuitMessage(), PostEventMessage(), PostUpdateKeyStateEvent(), ReceiverDied(), RedistributeInput(), TimersProc(), WakeSomeone(), xxxCancelTrackingForThread(), xxxDeactivate(), xxxInterSendMsgEx(), xxxProcessEventMessage(), xxxReceiveMessage(), xxxScanSysQueue(), xxxSetForegroundWindow2(), xxxSystemTimerProc(), zzzDestroyQueue(), and zzzSetFMouseMoved().

04581 { 04582 CheckCritIn(); 04583 04584 UserAssert(pti); 04585 04586 /* 04587 * Win3.1 changes ptiKeyboard and ptiMouse accordingly if we're setting 04588 * those bits. 04589 */ 04590 if (wWakeBit & QS_MOUSE) 04591 pti->pq->ptiMouse = pti; 04592 04593 if (wWakeBit & QS_KEY) 04594 pti->pq->ptiKeyboard = pti; 04595 04596 /* 04597 * OR in these bits - these bits represent what input this app has 04598 * (fsWakeBits), or what input has arrived since that last look 04599 * (fsChangeBits). 04600 */ 04601 pti->pcti->fsWakeBits |= wWakeBit; 04602 pti->pcti->fsChangeBits |= wWakeBit; 04603 04604 /* 04605 * Before waking, do screen saver check to see if it should 04606 * go away. 04607 */ 04608 if ((wWakeBit & QS_INPUT) 04609 && (pti->ppi->W32PF_Flags & W32PF_IDLESCREENSAVER)) { 04610 if ((wWakeBit & QS_MOUSEMOVE) 04611 && (gpsi->ptCursor.x == gptSSCursor.x) 04612 && (gpsi->ptCursor.y == gptSSCursor.y)) { 04613 goto SkipScreenSaverStuff; 04614 } 04615 04616 /* 04617 * Our idle screen saver needs to be given a priority boost so that it 04618 * can process input. 04619 */ 04620 pti->ppi->W32PF_Flags &= ~W32PF_IDLESCREENSAVER; 04621 SetForegroundPriority(pti, TRUE); 04622 } 04623 04624 SkipScreenSaverStuff: 04625 if (wWakeBit & pti->pcti->fsWakeMask) { 04626 /* 04627 * Wake the Thread 04628 */ 04629 if (pti->TIF_flags & TIF_16BIT) { 04630 pti->ptdb->nEvents++; 04631 gpsi->nEvents++; 04632 WakeWowTask(pti); 04633 } else { 04634 KeSetEvent(pti->pEventQueueServer, 2, FALSE); 04635 } 04636 } 04637 }

VOID SetWindowState PWND  pwnd,
DWORD  flags
 

Definition at line 83 of file w32/ntuser/kernel/random.c.

References dwFlags, GETPTI, PtiCurrent, SetWF, and ValidateState().

Referenced by AnimateWindow(), ButtonWndProcWorker(), CalcClientScrolling(), CBNcCreateHandler(), DefDlgProcWorker(), DefFrameProcWorker(), ECSetPasswordChar(), EditWndProc(), MDIRemoveSysMenu(), and StaticWndProcWorker().

00086 { 00087 /* 00088 * Don't let anyone mess with someone else's window 00089 */ 00090 if (GETPTI(pwnd)->ppi == PtiCurrent()->ppi) { 00091 if (ValidateState(dwFlags)) { 00092 SetWF(pwnd, dwFlags); 00093 } else { 00094 RIPMSG1(RIP_ERROR, "SetWindowState: invalid flag %x", dwFlags); 00095 } 00096 } else { 00097 RIPMSG1(RIP_WARNING, "SetWindowState: current ppi doesn't own pwnd %#p", pwnd); 00098 } 00099 00100 }

PVOID __inline SharedAlloc ULONG  cb  ) 
 

Definition at line 2137 of file userk.h.

References gpvSharedAlloc.

Referenced by HMAllocObject(), InitWindowMsgTable(), and Win32UserInitialize().

02140 {

BOOL __inline SharedFree PVOID  pv  ) 
 

Definition at line 2143 of file userk.h.

References BOOL, and gpvSharedAlloc.

Referenced by HMFreeObject().

02146 {

__inline PVOID SharedRebaseToClient PPROCESSINFO  ppi,
PVOID  p
 

Definition at line 6723 of file userk.h.

References BOOL.

06729 {

void ShowFade void   ) 
 

Definition at line 850 of file sprite.c.

References ALPHASTART, BOOL, tagFADE::dwFlags, FADE_SHOW, FADE_SHOWN, gfade, tagFADE::hbm, tagFADE::hdc, NULL, tagFADE::ptDst, tagFADE::size, and UpdateFade().

Referenced by MNFadeSelection(), StartFade(), and xxxMenuWindowProc().

00851 { 00852 BLENDFUNCTION blend; 00853 POINT ptSrc; 00854 BOOL fShow; 00855 00856 UserAssert(gfade.hdc != NULL); 00857 UserAssert(gfade.hbm != NULL); 00858 00859 if (gfade.dwFlags & FADE_SHOWN) 00860 return; 00861 00862 fShow = (gfade.dwFlags & FADE_SHOW); 00863 ptSrc.x = ptSrc.y = 0; 00864 blend.BlendOp = AC_SRC_OVER; 00865 blend.BlendFlags = 0; 00866 blend.AlphaFormat = 0; 00867 blend.SourceConstantAlpha = fShow ? ALPHASTART : (255 - ALPHASTART); 00868 UpdateFade(&gfade.ptDst, &gfade.size, gfade.hdc, &ptSrc, &blend); 00869 00870 gfade.dwFlags |= FADE_SHOWN; 00871 }

PWND FAR SizeBoxHwnd PWND  pwnd  ) 
 

Definition at line 636 of file rtl/winmgr.c.

References BOOL, FNID_DESKTOP, GETFNID, NULL, tagWND::rcClient, tagWND::rcWindow, REBASEPWND, SYSMETRTL, TestWF, WFCHILD, WFCPRESENT, WFMAXIMIZED, and WFSIZEBOX.

Referenced by DrawSize(), FindNCHit(), and xxxWindowHitTest2().

00638 { 00639 #ifdef USE_MIRRORING 00640 BOOL bMirroredSizeBox = (BOOL) TestWF(pwnd, WEFLAYOUTRTL); 00641 #endif 00642 00643 int xbrChild; 00644 int ybrChild = pwnd->rcWindow.bottom; 00645 00646 #ifdef USE_MIRRORING 00647 if (bMirroredSizeBox) { 00648 xbrChild = pwnd->rcWindow.left; 00649 } else 00650 #endif 00651 { 00652 xbrChild = pwnd->rcWindow.right; 00653 } 00654 00655 while (GETFNID(pwnd) != FNID_DESKTOP) { 00656 if (TestWF(pwnd, WFSIZEBOX)) { 00657 // First sizeable parent found 00658 int xbrParent; 00659 int ybrParent; 00660 00661 if (TestWF(pwnd, WFMAXIMIZED)) 00662 return(NULL); 00663 00664 #ifdef USE_MIRRORING 00665 if (bMirroredSizeBox) { 00666 xbrParent = pwnd->rcClient.left; 00667 } else 00668 #endif 00669 { 00670 xbrParent = pwnd->rcClient.right; 00671 } 00672 ybrParent = pwnd->rcClient.bottom; 00673 00674 /* If the sizebox dude is within an EDGE of the client's bottom 00675 * right corner (left corner for mirrored windows), let this succeed. 00676 * That way people who draw their own sunken clients will be happy. 00677 */ 00678 #ifdef USE_MIRRORING 00679 if (bMirroredSizeBox) { 00680 if ((xbrChild - SYSMETRTL(CXEDGE) > xbrParent) || (ybrChild + SYSMETRTL(CYEDGE) < ybrParent)) { 00681 // 00682 // Child's bottom, left corner of SIZEBOX isn't close enough 00683 // to bottom left of parent's client. 00684 // 00685 return(NULL); 00686 } 00687 } else 00688 #endif 00689 { 00690 if ((xbrChild + SYSMETRTL(CXEDGE) < xbrParent) || (ybrChild + SYSMETRTL(CYEDGE) < ybrParent)) { 00691 // 00692 // Child's bottom, right corner of SIZEBOX isn't close enough 00693 // to bottom right of parent's client. 00694 // 00695 return(NULL); 00696 } 00697 } 00698 00699 return(pwnd); 00700 } 00701 00702 if (!TestWF(pwnd, WFCHILD) || TestWF(pwnd, WFCPRESENT)) 00703 break; 00704 00705 pwnd = REBASEPWND(pwnd, spwndParent); 00706 } 00707 return(NULL); 00708 }

VOID SleepInputIdle PTHREADINFO  pti  ) 
 

Definition at line 5249 of file ntuser/kernel/input.c.

References NULL, tagWOWTHREADINFO::pIdleEvent, tagTHREADINFO::ppi, tagTHREADINFO::ptdb, tagPROCESSINFO::ptiMainThread, tagTDB::pwti, RESET_PSEUDO_EVENT, TIF_16BIT, tagTHREADINFO::TIF_flags, and TIF_SHAREDWOW.

Referenced by xxxMsgWaitForMultipleObjects(), and xxxSleepThread().

05251 { 05252 PW32PROCESS W32Process; 05253 05254 /* 05255 * Shared Wow Apps use the per thread idle event for synchronization. 05256 * Separate Wow VDMs use the regular mechanism. 05257 */ 05258 if (pti->TIF_flags & TIF_SHAREDWOW) { 05259 UserAssert(pti->TIF_flags & TIF_16BIT); 05260 if (pti->ptdb->pwti) { 05261 RESET_PSEUDO_EVENT(&pti->ptdb->pwti->pIdleEvent); 05262 } 05263 } else { 05264 /* 05265 * If the main thread is NULL, set it to this queue: it is calling 05266 * GetMessage(). 05267 */ 05268 if (pti->ppi->ptiMainThread == NULL) 05269 pti->ppi->ptiMainThread = pti; 05270 05271 /* 05272 * Put to sleep up anyone waiting on this event. 05273 */ 05274 if (pti->ppi->ptiMainThread == pti) { 05275 W32Process = W32GetCurrentProcess(); 05276 RESET_PSEUDO_EVENT(&W32Process->InputIdleEvent); 05277 } 05278 } 05279 }

SMESSAGEPROTO INLPKDRAWSWITCHWND   ) 
 

SMESSAGEPROTO IMEREQUEST   ) 
 

SMESSAGEPROTO IMECONTROL   ) 
 

SMESSAGEPROTO LOGONNOTIFY   ) 
 

SMESSAGEPROTO POWERBROADCAST   ) 
 

SMESSAGEPROTO INOUTMENUGETOBJECT   ) 
 

SMESSAGEPROTO INDEVICECHANGE   ) 
 

SMESSAGEPROTO IMAGEOUT   ) 
 

SMESSAGEPROTO IMAGEIN   ) 
 

SMESSAGEPROTO INOUTSTYLECHANGE   ) 
 

SMESSAGEPROTO INOUTNEXTMENU   ) 
 

SMESSAGEPROTO INDESTROYCLIPBRD   ) 
 

SMESSAGEPROTO COPYDATA   ) 
 

SMESSAGEPROTO COPYGLOBALDATA   ) 
 

SMESSAGEPROTO OPTOUTLPDWORDOPTOUTLPDWORD   ) 
 

SMESSAGEPROTO OUTDWORDINDWORD   ) 
 

SMESSAGEPROTO OUTDWORDDWORD   ) 
 

SMESSAGEPROTO INSIZECLIPBRD   ) 
 

SMESSAGEPROTO INPAINTCLIPBRD   ) 
 

SMESSAGEPROTO FULLSCREEN   ) 
 

SMESSAGEPROTO INOUTDRAG   ) 
 

SMESSAGEPROTO OUTCBOXSTRING   ) 
 

SMESSAGEPROTO INCBOXSTRING   ) 
 

SMESSAGEPROTO OUTLBOXSTRING   ) 
 

SMESSAGEPROTO INLBOXSTRING   ) 
 

SMESSAGEPROTO INLPWINDOWPOS   ) 
 

SMESSAGEPROTO INOUTLPWINDOWPOS   ) 
 

SMESSAGEPROTO POPTINLPUINT   ) 
 

SMESSAGEPROTO POUTLPINT   ) 
 

SMESSAGEPROTO INCNTOUTSTRING   ) 
 

SMESSAGEPROTO OUTSTRING   ) 
 

SMESSAGEPROTO INPOSTEDSTRING   ) 
 

SMESSAGEPROTO INSTRING   ) 
 

SMESSAGEPROTO INOUTLPMEASUREITEMSTRUCT   ) 
 

SMESSAGEPROTO INLPDRAWITEMSTRUCT   ) 
 

SMESSAGEPROTO INLPHELPINFOSTRUCT   ) 
 

SMESSAGEPROTO INLPHLPSTRUCT   ) 
 

SMESSAGEPROTO INLPDELETEITEMSTRUCT   ) 
 

SMESSAGEPROTO INLPCOMPAREITEMSTRUCT   ) 
 

SMESSAGEPROTO INLPMDICREATESTRUCT   ) 
 

SMESSAGEPROTO OUTLPRECT   ) 
 

SMESSAGEPROTO INOUTNCCALCSIZE   ) 
 

SMESSAGEPROTO INOUTLPRECT   ) 
 

SMESSAGEPROTO INOUTLPSCROLLINFO   ) 
 

SMESSAGEPROTO INOUTLPPOINT5   ) 
 

SMESSAGEPROTO INLPDROPSTRUCT   ) 
 

SMESSAGEPROTO INLPCREATESTRUCT   ) 
 

SMESSAGEPROTO GETDBCSTEXTLENGTHS   ) 
 

SMESSAGEPROTO GETTEXTLENGTHS   ) 
 

SMESSAGEPROTO INWPARAMDBCSCHAR   ) 
 

SMESSAGEPROTO INWPARAMCHAR   ) 
 

SMESSAGEPROTO DWORD   ) 
 

SMESSAGEPROTO DDEINIT   ) 
 

SMESSAGEPROTO SENTDDEMSG   ) 
 

PMONITORRECTS SnapshotMonitorRects void   ) 
 

Definition at line 40 of file rare.c.

References tagMONITORRECTS::amp, tagMONITORRECTS::cMonitor, tagDISPLAYINFO::cMonitors, CopyRect, tagMONITOR::dwMONFlags, gpDispInfo, HdevFromMonitor(), MONF_VISIBLE, MONITORPOS, MONITORRECTS, NULL, tagMONITORPOS::pMonitor, tagDISPLAYINFO::pMonitorFirst, tagMONITOR::pMonitorNext, PMONITORPOS, tagMONITOR::rcMonitor, tagMONITORPOS::rcMonitor, tagMONITOR::rcWork, and tagMONITORPOS::rcWork.

Referenced by xxxResetDisplayDevice(), and xxxSystemParametersInfo().

00041 { 00042 PMONITOR pMonitor; 00043 PMONITORRECTS pmr; 00044 PMONITORPOS pmp; 00045 #if DBG 00046 ULONG cVisMon = 0; 00047 #endif 00048 00049 pmr = UserAllocPool( 00050 sizeof(MONITORRECTS) + sizeof(MONITORPOS) * (gpDispInfo->cMonitors - 1), 00051 TAG_MONITORRECTS); 00052 00053 if (!pmr) { 00054 RIPERR0(ERROR_OUTOFMEMORY, RIP_WARNING, "Out of memory in SnapshotMonitorRects"); 00055 return NULL; 00056 } 00057 00058 pmp = pmr->amp; 00059 for ( pMonitor = gpDispInfo->pMonitorFirst; 00060 pMonitor; 00061 pMonitor = pMonitor->pMonitorNext) { 00062 00063 if (!(pMonitor->dwMONFlags & MONF_VISIBLE)) 00064 continue; 00065 #if DBG 00066 cVisMon++; 00067 #endif 00068 00069 CopyRect(&pmp->rcMonitor, &pMonitor->rcMonitor); 00070 CopyRect(&pmp->rcWork, &pMonitor->rcWork); 00071 00072 /* 00073 * If the device for this monitor object is not active, don't store 00074 * the pointer to it in the list. This way the windows on the inactive 00075 * monitor will be later moved to the default one. 00076 */ 00077 if (HdevFromMonitor(pMonitor) == -1) { 00078 pmp->pMonitor = NULL; 00079 } else { 00080 pmp->pMonitor = pMonitor; 00081 } 00082 00083 pmp++; 00084 } 00085 UserAssert(cVisMon == gpDispInfo->cMonitors); 00086 00087 pmr->cMonitor = (int)(pmp - pmr->amp); 00088 00089 return pmr; 00090 }

VOID SpbCheck VOID   ) 
 

Definition at line 995 of file spb.c.

References AnySpbs, tagDCE::DCX_flags, gpDispInfo, tagDISPLAYINFO::hDev, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, SpbCheckDce(), SpbCheckRect(), and VOID().

Referenced by CreateSpb(), LockWindowUpdate2(), and zzzBltValidBits().

00996 { 00997 PDCE pdce; 00998 RECT rcBounds; 00999 01000 if (AnySpbs()) { 01001 01002 GreLockDisplay(gpDispInfo->hDev); 01003 01004 /* 01005 * Walk through all of the DC's, accumulating dirty areas. 01006 */ 01007 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 01008 01009 /* 01010 * Only check valid cache entries... 01011 */ 01012 if (pdce->DCX_flags & (DCX_INVALID | DCX_DESTROYTHIS)) 01013 continue; 01014 01015 SpbCheckDce(pdce); 01016 } 01017 01018 /* 01019 * Subtact out DirectDraw dirty rect from all the SPB's. The call to 01020 * GreGetDirectDrawBounds will also reset the accumulated bounds. 01021 */ 01022 if (GreGetDirectDrawBounds(gpDispInfo->hDev, &rcBounds)) { 01023 SpbCheckRect(NULL, &rcBounds, 0); 01024 } 01025 01026 GreUnlockDisplay(gpDispInfo->hDev); 01027 } 01028 }

VOID SpbCheckDce PDCE  pdce  ) 
 

Definition at line 1040 of file spb.c.

References tagDCE::DCX_flags, tagDCE::hdc, IntersectRect(), NULL, OffsetRect(), tagDCE::pMonitor, tagDCE::pwndOrg, tagMONITOR::rcMonitor, SpbCheckRect(), and VOID().

Referenced by _GetDCEx(), GetMonitorDC(), InvalidateDce(), and SpbCheck().

01042 { 01043 RECT rc; 01044 01045 if (pdce->DCX_flags & DCX_LAYERED) 01046 return; 01047 01048 /* 01049 * Query the dirty bounds rectangle. Doing this clears the bounds 01050 * as well. 01051 */ 01052 if (GreGetBounds(pdce->hdc, &rc, 0)) { 01053 01054 if (pdce->pMonitor != NULL) { 01055 /* 01056 * Convert the bounds rect to screen coords. 01057 */ 01058 OffsetRect(&rc, pdce->pMonitor->rcMonitor.left, 01059 pdce->pMonitor->rcMonitor.top); 01060 } 01061 01062 /* 01063 * Intersect the returned rectangle with the window rectangle 01064 * in case the guy was drawing outside his window 01065 */ 01066 if (IntersectRect(&rc, &rc, &(pdce->pwndOrg)->rcWindow)) 01067 SpbCheckRect(pdce->pwndOrg, &rc, pdce->DCX_flags); 01068 } 01069 }

VOID SpbCheckPwnd PWND  pwnd  ) 
 

Definition at line 1126 of file spb.c.

References FreeSpb(), gpDispInfo, NULL, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, tagWND::rcWindow, SpbCheckRect(), tagSPB::spwnd, tagWND::spwndParent, and VOID().

Referenced by LockWindowUpdate2(), and xxxDWP_SetRedraw().

01128 { 01129 PSPB pspb; 01130 PWND pwndSpb; 01131 PSPB pspbNext; 01132 01133 /* 01134 * First blow away any SPBs owned by this window or its children. 01135 */ 01136 for (pspb = gpDispInfo->pspbFirst; pspb != NULL; pspb = pspbNext) { 01137 01138 /* 01139 * Get pspbNext now in case we free the SPB 01140 */ 01141 pspbNext = pspb->pspbNext; 01142 01143 /* 01144 * If pspb->spwnd is == pwnd or a child of pwnd, then free the SPB 01145 */ 01146 for (pwndSpb = pspb->spwnd; pwndSpb; pwndSpb = pwndSpb->spwndParent) { 01147 01148 if (pwnd == pwndSpb) 01149 FreeSpb(pspb); 01150 } 01151 } 01152 01153 /* 01154 * Then see if any other SPBs are affected... 01155 */ 01156 if (gpDispInfo->pspbFirst != NULL) { 01157 SpbCheckRect(pwnd, &pwnd->rcWindow, 0); 01158 } 01159 }

VOID SpbCheckRect PWND  pwnd,
LPRECT  lprc,
DWORD  flags
 

Definition at line 1081 of file spb.c.

References gpDispInfo, IsVisible(), NULL, tagDISPLAYINFO::pspbFirst, tagSPB::pspbNext, SpbCheckRect2(), and VOID().

Referenced by _ScrollDC(), BltValidInit(), SpbCheck(), SpbCheckDce(), SpbCheckPwnd(), xxxInternalInvalidate(), xxxScrollWindowEx(), and zzzBltValidBits().

01085 { 01086 PSPB pspb, pspbNext; 01087 01088 /* 01089 * If this window isn't visible, we're done. 01090 */ 01091 if (!IsVisible(pwnd)) 01092 return; 01093 01094 for (pspb = gpDispInfo->pspbFirst; pspb != NULL; pspb = pspbNext) { 01095 01096 /* 01097 * Get the pointer to the next save popup bits structure now 01098 * in case SpbCheckRect2() frees the current one. 01099 */ 01100 pspbNext = pspb->pspbNext; 01101 01102 /* 01103 * In win3.1 they used to exit the function if this function 01104 * returned false. This meant that if one of the spbs was freed 01105 * the rest of the spbs would not be invalidated. 01106 */ 01107 SpbCheckRect2(pspb, pwnd, lprc, flags); 01108 } 01109 }

PWND SpeedHitTest PWND  pwndParent,
POINT  pt
 

Definition at line 198 of file winwhere.c.

References tagWND::hrgnClip, LayerHitTest(), NULL, PtInRect(), tagWND::rcClient, tagWND::rcWindow, tagWND::spwndChild, tagWND::spwndNext, TestWF, WEFLAYERED, and WFVISIBLE.

Referenced by xxxButtonEvent(), and zzzSetFMouseMoved().

00201 { 00202 PWND pwndT; 00203 PWND pwnd; 00204 00205 if (pwndParent == NULL) 00206 return NULL; 00207 00208 for (pwnd = pwndParent->spwndChild; pwnd != NULL; pwnd = pwnd->spwndNext) { 00209 00210 /* 00211 * Are we looking at an hidden window? 00212 */ 00213 if (!TestWF(pwnd, WFVISIBLE)) 00214 continue; 00215 00216 /* 00217 * Are we barking up the wrong tree? 00218 */ 00219 if (!PtInRect((LPRECT)&pwnd->rcWindow, pt)) { 00220 continue; 00221 } 00222 00223 /* 00224 * Check to see if in window region (if it has one) 00225 */ 00226 if (pwnd->hrgnClip != NULL) { 00227 if (!GrePtInRegion(pwnd->hrgnClip, pt.x, pt.y)) 00228 continue; 00229 } 00230 00231 /* 00232 * Is this a sprite? 00233 */ 00234 if (TestWF(pwnd, WEFLAYERED)) { 00235 if (!LayerHitTest(pwnd, pt)) 00236 continue; 00237 } 00238 00239 #ifdef REDIRECTION 00240 if (TestWF(pwnd, WEFREDIRECTED)) { 00241 continue; 00242 } 00243 #endif // REDIRECTION 00244 00245 /* 00246 * Children? 00247 */ 00248 if ((pwnd->spwndChild != NULL) && 00249 PtInRect((LPRECT)&pwnd->rcClient, pt)) { 00250 00251 pwndT = SpeedHitTest(pwnd, pt); 00252 if (pwndT != NULL) 00253 return pwndT; 00254 } 00255 00256 return pwnd; 00257 } 00258 00259 return pwndParent; 00260 }

PDEVICEINFO StartDeviceRead PDEVICEINFO  pDeviceInfo  ) 
 

Definition at line 1099 of file w32/ntuser/kernel/pnp.c.

References aDeviceTemplate, BOOL, tagDEVICE_TEMPLATE::cbData, EnterDeviceInfoListCrit(), ExIsResourceAcquiredExclusiveLite(), FreeDeviceInfo(), GDIAF_FREEME, GDIAF_RETRYREAD, GDIF_DBGREAD, GDIF_READING, gnRetryReadInput, gpresDeviceInfoList, InputApc(), ISTS, LeaveDeviceInfoListCrit(), LOGTIME, MAXIMUM_READ_RETRIES, NT_SUCCESS, NULL, tagDEVICE_TEMPLATE::offData, PBYTE, PsGetCurrentThread, and PZERO.

Referenced by InputApc(), and ProcessDeviceChanges().

01101 { 01102 PDEVICE_TEMPLATE pDevTpl; 01103 01104 pDeviceInfo->bFlags |= GDIF_READING; 01105 01106 /* 01107 * If this device needs freeing, abandon reading now and request the free. 01108 */ 01109 if (pDeviceInfo->usActions & GDIAF_FREEME) { 01110 BOOL fPreviouslyAcquired = ExIsResourceAcquiredExclusiveLite(gpresDeviceInfoList); 01111 if (!fPreviouslyAcquired) { 01112 EnterDeviceInfoListCrit(); 01113 } 01114 pDeviceInfo->bFlags &= ~GDIF_READING; 01115 pDeviceInfo = FreeDeviceInfo(pDeviceInfo); 01116 if (!fPreviouslyAcquired) { 01117 LeaveDeviceInfoListCrit(); 01118 } 01119 return pDeviceInfo; 01120 } 01121 01122 /* 01123 * Initialize in case read fails 01124 */ 01125 pDeviceInfo->iosb.Status = STATUS_UNSUCCESSFUL; // catch concurrent writes? 01126 pDeviceInfo->iosb.Information = 0; 01127 01128 pDevTpl = &aDeviceTemplate[pDeviceInfo->type]; 01129 01130 UserAssert(pDeviceInfo->OpenerProcess == PsGetCurrentThread()->Cid.UniqueProcess); 01131 LOGTIME(pDeviceInfo->timeStartRead); 01132 #ifdef DIAGNOSE_IO 01133 pDeviceInfo->nReadsOutstanding++; 01134 #endif 01135 pDeviceInfo->ReadStatus = ZwReadFile( 01136 pDeviceInfo->handle, 01137 NULL, // hReadEvent 01138 InputApc, // InputApc() 01139 pDeviceInfo, // ApcContext 01140 &pDeviceInfo->iosb, 01141 (PVOID)((PBYTE)pDeviceInfo + pDevTpl->offData), 01142 pDevTpl->cbData, 01143 PZERO(LARGE_INTEGER), NULL); 01144 LOGTIME(pDeviceInfo->timeEndRead); 01145 01146 #if DBG 01147 if (pDeviceInfo->bFlags & GDIF_DBGREAD) { 01148 TAGMSG2(DBGTAG_PNP, "ZwReadFile of Device handle %lx returned status %lx", 01149 pDeviceInfo->handle, pDeviceInfo->ReadStatus); 01150 } 01151 #endif 01152 01153 if (!NT_SUCCESS(pDeviceInfo->ReadStatus)) { 01154 BOOL fPreviouslyAcquired = ExIsResourceAcquiredExclusiveLite(gpresDeviceInfoList); 01155 if (!fPreviouslyAcquired) { 01156 EnterDeviceInfoListCrit(); 01157 } 01158 01159 /* 01160 * If insufficient resources, retry the read the next time the RIT 01161 * wakes up for the ID_TIMER event by incrementing gnRetryReadInput 01162 * (Cheaper than setting our own timer), 01163 * Else just abandon reading. 01164 */ 01165 if (pDeviceInfo->ReadStatus == STATUS_INSUFFICIENT_RESOURCES) { 01166 if (pDeviceInfo->nRetryRead++ < MAXIMUM_READ_RETRIES) { 01167 pDeviceInfo->usActions |= GDIAF_RETRYREAD; 01168 gnRetryReadInput++; 01169 } 01170 } else { 01171 pDeviceInfo->bFlags &= ~GDIF_READING; 01172 } 01173 01174 #ifdef DIAGNOSE_IO 01175 pDeviceInfo->nReadsOutstanding--; 01176 #endif 01177 if (!fPreviouslyAcquired) { 01178 LeaveDeviceInfoListCrit(); 01179 } 01180 } else { 01181 pDeviceInfo->nRetryRead = 0; 01182 } 01183 01184 if (!ISTS() && !NT_SUCCESS(pDeviceInfo->ReadStatus)) 01185 RIPMSG2(RIP_WARNING, "StartDeviceRead %#p failed Status %#x", 01186 pDeviceInfo, pDeviceInfo->ReadStatus); 01187 01188 return NULL; 01189 }

void StartFade void   ) 
 

Definition at line 879 of file sprite.c.

References ALPHASTART, DWORD, tagFADE::dwStart, tagFADE::dwTime, gfade, gTermIO, tagFADE::hbm, tagFADE::hdc, IDSYS_FADE, InternalSetTimer(), NtGetTickCount(), NULL, ShowFade(), tagTERMINAL::spwndDesktopOwner, and xxxSystemTimerProc().

Referenced by xxxMenuWindowProc(), xxxMNDismissWithNotify(), and xxxTooltipWndProc().

00880 { 00881 DWORD dwElapsed; 00882 00883 UserAssert(gfade.hdc != NULL); 00884 UserAssert(gfade.hbm != NULL); 00885 00886 /* 00887 * Set dc and bitmap to public so the desktop thread can use them. 00888 */ 00889 GreSetDCOwner(gfade.hdc, OBJECT_OWNER_PUBLIC); 00890 GreSetBitmapOwner(gfade.hbm, OBJECT_OWNER_PUBLIC); 00891 00892 /* 00893 * If it's not already shown, do the initial update that makes copy of 00894 * the source. All other updates will only need to change the alpha value. 00895 */ 00896 ShowFade(); 00897 00898 /* 00899 * Get the start time for the fade animation. 00900 */ 00901 dwElapsed = (gfade.dwTime * ALPHASTART + 255) / 255; 00902 gfade.dwStart = NtGetTickCount() - dwElapsed; 00903 00904 /* 00905 * Set the timer in the desktop thread. This will insure that the 00906 * animation is smooth and won't get stuck if the current thread hangs. 00907 */ 00908 InternalSetTimer(gTermIO.spwndDesktopOwner, IDSYS_FADE, 10, 00909 xxxSystemTimerProc, TMRF_SYSTEM | TMRF_PTIWINDOW); 00910 }

VOID StartScreenSaver BOOL  bOnlyIfSecure  ) 
 

Definition at line 165 of file syscmd.c.

References _PostMessage(), tagPOWERSTATE::fInProgress, gPowerState, gppiScreenSaver, gspwndLogonNotify, and NULL.

Referenced by IdleTimerProc(), and xxxSysCommand().

00167 { 00168 /* 00169 * If a screen saver is already running or we're in the midst of powering 00170 * down the machine, ignore this request. 00171 */ 00172 if (gppiScreenSaver != NULL || gPowerState.fInProgress) 00173 return; 00174 00175 if (gspwndLogonNotify != NULL) { 00176 /* 00177 * Let the logon process take care of the screen saver 00178 */ 00179 _PostMessage(gspwndLogonNotify, 00180 WM_LOGONNOTIFY, LOGON_INPUT_TIMEOUT, bOnlyIfSecure); 00181 } 00182 }

UINT_PTR StartTimers VOID   ) 
 

Definition at line 722 of file timers.c.

References InternalSetTimer(), NULL, and xxxHungAppDemon().

Referenced by RawInputThread().

00723 { 00724 /* 00725 * Let GDI know that it can start settings timers on the RIT. 00726 */ 00727 GreStartTimers(); 00728 00729 /* 00730 * TMRF_RIT timers are called directly from ScanTimers -- no nasty 00731 * thread switching for these boys. 00732 */ 00733 return InternalSetTimer(NULL, 0, 1000, xxxHungAppDemon, TMRF_RIT); 00734 }

void StopFade void   ) 
 

Definition at line 918 of file sprite.c.

References _GetDCEx(), _KillSystemTimer(), _ReleaseDC(), DeleteFadeSprite(), tagFADE::dwFlags, DWORD, FADE_COMPLETED, FADE_SHOW, gfade, gpDispInfo, gTermIO, tagFADE::hbm, tagFADE::hdc, tagDISPLAYINFO::hdcScreen, IDSYS_FADE, NULL, tagFADE::ptDst, tagFADE::size, and tagTERMINAL::spwndDesktopOwner.

Referenced by AnimateFade(), MNAnimate(), xxxTooltipWndProc(), and xxxUserChangeDisplaySettings().

00919 { 00920 DWORD dwRop=SRCCOPY; 00921 PWND pwnd; 00922 00923 UserAssert(gfade.hdc != NULL); 00924 UserAssert(gfade.hbm != NULL); 00925 00926 /* 00927 * Stop the fade animation timer. 00928 */ 00929 _KillSystemTimer(gTermIO.spwndDesktopOwner, IDSYS_FADE); 00930 00931 pwnd = DeleteFadeSprite(); 00932 00933 /* 00934 * If showing and the animation isn't completed, blt the last frame. 00935 */ 00936 if (!(gfade.dwFlags & FADE_COMPLETED) && (gfade.dwFlags & FADE_SHOW)) { 00937 int x, y; 00938 HDC hdc; 00939 00940 /* 00941 * For a windowed fade, make sure we observe the current visrgn. 00942 */ 00943 if (pwnd != NULL) { 00944 hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_CACHE); 00945 x = 0; 00946 y = 0; 00947 } else { 00948 hdc = gpDispInfo->hdcScreen; 00949 x = gfade.ptDst.x; 00950 y = gfade.ptDst.y; 00951 } 00952 00953 #ifdef USE_MIRRORING 00954 /* 00955 * If the destination DC is RTL mirrored, then BitBlt call should mirror the 00956 * content, since we want the menu to preserve it text (i.e. not to 00957 * be flipped). [samera] 00958 */ 00959 if (GreGetLayout(hdc) & LAYOUT_RTL) { 00960 dwRop |= NOMIRRORBITMAP; 00961 } 00962 #endif 00963 00964 GreBitBlt(hdc, x, y, gfade.size.cx, gfade.size.cy, gfade.hdc, 0, 0, dwRop, 0); 00965 _ReleaseDC(hdc); 00966 } 00967 00968 /* 00969 * Clean up the animation data. 00970 */ 00971 GreSelectBitmap(gfade.hdc, GreGetStockObject(PRIV_STOCK_BITMAP)); 00972 GreDeleteObject(gfade.hbm); 00973 00974 gfade.hbm = NULL; 00975 gfade.dwFlags = 0; 00976 }

VOID StoreMessage LPMSG  pmsg,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
DWORD  time
 

Definition at line 4799 of file queue.c.

References CheckCritIn, gpsi, HW, and NtGetTickCount().

Referenced by CheckQuitMessage(), and DoPaint().

04806 { 04807 CheckCritIn(); 04808 04809 pmsg->hwnd = HW(pwnd); 04810 pmsg->message = message; 04811 pmsg->wParam = wParam; 04812 pmsg->lParam = lParam; 04813 pmsg->time = (time != 0 ? time : NtGetTickCount()); 04814 04815 pmsg->pt = gpsi->ptCursor; 04816 }

VOID StoreQMessage PQMSG  pqmsg,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
DWORD  time,
DWORD  dwQEvent,
ULONG_PTR  dwExtraInfo
 

Definition at line 4831 of file queue.c.

References CheckCritIn, tagQMSG::dwQEvent, tagQMSG::ExtraInfo, gpsi, HW, tagQMSG::msg, and NtGetTickCount().

Referenced by _PostMessage(), _PostThreadMessage(), DestroyProcessInfo(), DoTimer(), PostEventMessage(), PostInputMessage(), xxxCallJournalPlaybackHook(), and xxxSetForegroundWindow2().

04840 { 04841 CheckCritIn(); 04842 04843 pqmsg->msg.hwnd = HW(pwnd); 04844 pqmsg->msg.message = message; 04845 pqmsg->msg.wParam = wParam; 04846 pqmsg->msg.lParam = lParam; 04847 pqmsg->msg.time = (time == 0) ? NtGetTickCount() : time; 04848 04849 #ifdef REDIRECTION 04850 if (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) { 04851 pqmsg->msg.pt.x = LOWORD(lParam); 04852 pqmsg->msg.pt.y = HIWORD(lParam); 04853 } else { 04854 pqmsg->msg.pt = gpsi->ptCursor; 04855 } 04856 #else 04857 pqmsg->msg.pt = gpsi->ptCursor; 04858 #endif 04859 pqmsg->dwQEvent = dwQEvent; 04860 pqmsg->ExtraInfo = dwExtraInfo; 04861 }

void __inline StoreQMessagePti PQMSG  pqmsg,
PTHREADINFO  pti
 

Definition at line 5138 of file userk.h.

References tagQMSG::msg.

Referenced by DoTimer(), PostEventMessage(), WakeSomeone(), and xxxSetForegroundWindow2().

05138 { 05139 pqmsg->msg.pt.x = LOWORD(pqmsg->msg.lParam); 05140 pqmsg->msg.pt.y = HIWORD(pqmsg->msg.lParam); 05141 } else {

__inline DWORD SubtractTick IN DWORD  dwTime,
IN int  nDelta
 

Definition at line 6988 of file userk.h.

07001 {

BOOL SysHasKanji VOID   ) 
 

UINT SystoChar UINT  message,
LPARAM  lParam
 

Definition at line 461 of file mnaccel.c.

References CheckMsgFilter, SYS_ALTERNATE, and UINT.

Referenced by xxxSBTrackLoop(), and xxxTranslateAccelerator().

00464 { 00465 if (CheckMsgFilter(message, WM_SYSKEYDOWN, WM_SYSDEADCHAR) && 00466 !(HIWORD(lParam) & SYS_ALTERNATE)) 00467 return (message - (WM_SYSKEYDOWN - WM_KEYDOWN)); 00468 00469 return message; 00470 }

VOID TerminateConsole PDESKTOP   ) 
 

Definition at line 4420 of file desktop.c.

References _PostThreadMessage(), tagDESKTOP::dwConsoleThreadId, LockThreadByClientId(), NT_SUCCESS, NTSTATUS(), NULL, PtiFromThread, Status, UnlockThread, and VOID().

Referenced by DestroyWindowStation(), and UnmapDesktop().

04422 { 04423 NTSTATUS Status; 04424 PETHREAD Thread; 04425 PTHREADINFO pti; 04426 04427 if (pdesk->dwConsoleThreadId == 0) 04428 return; 04429 04430 /* 04431 * Locate the console thread. 04432 */ 04433 Status = LockThreadByClientId((HANDLE)LongToHandle( pdesk->dwConsoleThreadId ), &Thread); 04434 if (!NT_SUCCESS(Status)) 04435 return; 04436 04437 /* 04438 * Post a quit message to the console. 04439 */ 04440 pti = PtiFromThread(Thread); 04441 UserAssert(pti != NULL); 04442 if (pti != NULL) { 04443 _PostThreadMessage(pti, WM_QUIT, 0, 0); 04444 } 04445 04446 /* 04447 * Clear thread id so we don't post twice 04448 */ 04449 pdesk->dwConsoleThreadId = 0; 04450 04451 UnlockThread(Thread); 04452 }

__inline DWORD TestFadeFlags DWORD  dwFlags  ) 
 

Definition at line 6754 of file userk.h.

References dwFlags, DWORD, and gfade.

Referenced by MNAnimate(), xxxMenuWindowProc(), and xxxTooltipWndProc().

06765 {

NTSTATUS TestForInteractiveUser PLUID  pluidCaller  ) 
 

Definition at line 255 of file w32/ntuser/kernel/security.c.

References grpWinStaList, tagWINDOWSTATION::luidUser, NULL, and RtlEqualLuid().

Referenced by NtUserTestForInteractiveUser().

00258 { 00259 PWINDOWSTATION pwinsta; 00260 00261 UserAssert(grpWinStaList != NULL); 00262 00263 /* 00264 * !!! 00265 * 00266 * This relies on the fact that there is only ONE interactive 00267 * windowstation and that it is the first one in the list. 00268 * If multiple windowstations are ever supported 00269 * a lookup will have to be done here. 00270 */ 00271 pwinsta = grpWinStaList; 00272 00273 /* 00274 * Compare it with the id of the logged on user. 00275 */ 00276 if (RtlEqualLuid(pluidCaller, &pwinsta->luidUser)) 00277 return STATUS_SUCCESS; 00278 else 00279 return STATUS_ACCESS_DENIED; 00280 }

PVOID __inline ThreadLockExchange PVOID  pobj,
PTL  ptl
 

Definition at line 1316 of file userk.h.

References HMLockObject, and HMUnlockObject.

Referenced by xxxScanSysQueue().

01317 { 01318 PVOID pobjOld; 01319 01320 pobjOld = ptl->pobj; 01321 ptl->pobj = pobj; 01322 if (pobj) { 01323 HMLockObject(pobj); 01324 } 01325 01326 if (pobjOld) { 01327 pobjOld = HMUnlockObject((PHEAD)pobjOld); 01328 } 01329 01330 return pobjOld; 01331 }

PVOID __inline ThreadLockExchangeAlways PVOID  pobj,
PTL  ptl
 

Definition at line 1342 of file userk.h.

References HMLockObject, and HMUnlockObject.

Referenced by xxxRedrawHungWindow(), xxxScrollWindowEx(), xxxSendChildNCPaint(), xxxUpdateOtherThreadsWindows(), xxxUpdateThreadsWindows(), xxxUpdateWindow2(), and xxxWindowHitTest().

01343 { 01344 PVOID pobjOld; 01345 01346 pobjOld = ptl->pobj; 01347 ptl->pobj = pobj; 01348 HMLockObject(pobj); 01349 if (pobjOld) { 01350 pobjOld = HMUnlockObject((PHEAD)pobjOld); 01351 } 01352 01353 return pobjOld; 01354 }

PVOID ThreadUnlock1 VOID   ) 
 

Definition at line 1939 of file handtabl.c.

References HMUnlockObject, NULL, PtiCurrent, tagTHREADINFO::ptl, and TRUE.

01942 { 01943 PHEAD phead; 01944 PTHREADINFO ptiCurrent; 01945 PTL ptl; 01946 01947 ptiCurrent = PtiCurrent(); 01948 ptl = ptiCurrent->ptl; 01949 UserAssert(ptl != NULL); 01950 /* 01951 * Validate the thread lock list. 01952 */ 01953 ValidateThreadLocks(NULL, ptl, (ULONG_PTR)&ptlIn, TRUE); 01954 /* 01955 * Make sure the caller wants to unlock the top lock. 01956 */ 01957 UserAssert(ptlIn == ptl); 01958 ptiCurrent->ptl = ptl->next; 01959 /* 01960 * If the object address is not NULL, then unlock the object. 01961 */ 01962 phead = (PHEAD)(ptl->pobj); 01963 if (phead != NULL) { 01964 01965 /* 01966 * Unlock the object. 01967 */ 01968 01969 phead = (PHEAD)HMUnlockObject(phead); 01970 } 01971 #if DBG 01972 { 01973 /* 01974 * Remove the corresponding element from gFreeTLList 01975 */ 01976 ptl->ptl->next = gFreeTLList; 01977 ptl->ptl->uTLCount += TL_FREED_PATTERN; 01978 gFreeTLList = ptl->ptl; 01979 } 01980 #endif 01981 return (PVOID)phead; 01982 }

VOID TimersProc VOID   ) 
 

Definition at line 746 of file timers.c.

References tagTIMER::cmsCountdown, tagTIMER::cmsRate, ComputePastTickDelta(), tagTHREADINFO::cTimersReady, DWORD, EnterCrit, FALSE, tagTIMER::flags, gbMasterTimerSet, gcmsLastTimer, gdmsNextTimer, gptmrFirst, gptmrMaster, HMIsMarkDestroy, INT, KeSetTimer(), LeaveCrit, tagTIMER::nID, NtGetTickCount(), NULL, tagTIMER::pfn, tagTIMER::pti, tagTIMER::ptmrNext, SetWakeBit(), ThreadLock, ThreadUnlock, VOID(), and WM_SYSTIMER.

Referenced by RawInputThread().

00748 { 00749 INT dmsSinceLast; 00750 LARGE_INTEGER liT; 00751 PTIMER ptmr; 00752 DWORD cmsCur; 00753 00754 /* 00755 * Calculate how long it was since the last time we 00756 * processed timers so we can subtract that much time 00757 * from each timer's countdown value. 00758 */ 00759 EnterCrit(); 00760 00761 cmsCur = NtGetTickCount(); 00762 dmsSinceLast = ComputePastTickDelta(cmsCur, gcmsLastTimer); 00763 gcmsLastTimer = cmsCur; 00764 00765 /* 00766 * dmsNextTimer is the time delta before the next 00767 * timer should go off. As we loop through the 00768 * timers below this will shrink to the smallest 00769 * cmsCountdown value in the list. 00770 */ 00771 gdmsNextTimer = 0x7FFFFFFF; 00772 ptmr = gptmrFirst; 00773 gbMasterTimerSet = FALSE; 00774 while (ptmr != NULL) { 00775 00776 /* 00777 * ONESHOT timers go to a WAITING state after 00778 * they go off. This allows us to leave them 00779 * in the list but keep them from going off 00780 * over and over. 00781 */ 00782 if (ptmr->flags & TMRF_WAITING) { 00783 ptmr = ptmr->ptmrNext; 00784 continue; 00785 } 00786 00787 /* 00788 * The first time we encounter a timer we don't 00789 * want to set it off, we just want to use it to 00790 * compute the shortest countdown value. 00791 */ 00792 if (ptmr->flags & TMRF_INIT) { 00793 ptmr->flags &= ~TMRF_INIT; 00794 00795 } else { 00796 /* 00797 * If this timer is going off, wake up its 00798 * owner. 00799 */ 00800 ptmr->cmsCountdown -= dmsSinceLast; 00801 if (ptmr->cmsCountdown <= 0) { 00802 ptmr->cmsCountdown = ptmr->cmsRate; 00803 00804 /* 00805 * If the timer's owner hasn't handled the 00806 * last time it went off yet, throw this event 00807 * away. 00808 */ 00809 if (!(ptmr->flags & TMRF_READY)) { 00810 /* 00811 * A ONESHOT timer goes into a WAITING state 00812 * until SetTimer is called again to reset it. 00813 */ 00814 if (ptmr->flags & TMRF_ONESHOT) 00815 ptmr->flags |= TMRF_WAITING; 00816 00817 /* 00818 * RIT timers have the distinction of being 00819 * called directly and executing serially with 00820 * with incoming timer events. 00821 * NOTE: RIT timers get called while we're 00822 * inside the critical section. 00823 */ 00824 if (ptmr->flags & TMRF_RIT) { 00825 TL tlTimer; 00826 00827 ThreadLock(ptmr, &tlTimer); 00828 /* 00829 * May set gbMasterTimerSet 00830 */ 00831 (ptmr->pfn)(NULL, 00832 WM_SYSTIMER, 00833 ptmr->nID, 00834 (LPARAM)ptmr); 00835 00836 if (HMIsMarkDestroy(ptmr)) { 00837 ptmr = ptmr->ptmrNext; 00838 ThreadUnlock(&tlTimer); 00839 continue; 00840 } 00841 ThreadUnlock(&tlTimer); 00842 00843 } else { 00844 ptmr->flags |= TMRF_READY; 00845 ptmr->pti->cTimersReady++; 00846 SetWakeBit(ptmr->pti, QS_TIMER); 00847 } 00848 } 00849 } 00850 } 00851 00852 /* 00853 * Remember the shortest time left of the timers. 00854 */ 00855 if (ptmr->cmsCountdown < gdmsNextTimer) 00856 gdmsNextTimer = ptmr->cmsCountdown; 00857 00858 /* 00859 * Advance to the next timer structure. 00860 */ 00861 ptmr = ptmr->ptmrNext; 00862 } 00863 00864 if (!gbMasterTimerSet) { 00865 /* 00866 * Time in NT should be negative to specify a relative 00867 * time. It's also in hundred nanosecond units so multiply 00868 * by 10000 to get the right value from milliseconds. 00869 */ 00870 liT.QuadPart = Int32x32To64(-10000, gdmsNextTimer); 00871 KeSetTimer(gptmrMaster, liT, NULL); 00872 } 00873 00874 LeaveCrit(); 00875 }

void TrackLayeredZorder PWND  pwnd  ) 
 

Definition at line 1184 of file sprite.c.

References gpDispInfo, tagDISPLAYINFO::hDev, NULL, PtoH, PtoHq, tagWND::spwndNext, TestWF, and WEFLAYERED.

Referenced by LinkWindow(), and xxxSetLayeredWindow().

01185 { 01186 #ifdef CHILD_LAYERING 01187 01188 PWND pwndT = GetNextLayeredWindow(pwnd); 01189 01190 #else // CHILD_LAYERING 01191 01192 PWND pwndT = pwnd->spwndNext; 01193 01194 while (pwndT != NULL) { 01195 01196 if (TestWF(pwndT, WEFLAYERED)) 01197 break; 01198 01199 pwndT = pwndT->spwndNext; 01200 } 01201 01202 #endif // CHILD_LAYERING 01203 01204 GreZorderSprite(gpDispInfo->hDev, PtoHq(pwnd), PtoH(pwndT)); 01205 }

VOID TransferWakeBit PTHREADINFO  pti,
UINT  message
 

Definition at line 4649 of file queue.c.

References CalcWakeMask(), tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeBits, tagTHREADINFO::pcti, tagTHREADINFO::pq, tagQ::ptiKeyboard, tagQ::ptiMouse, and UINT.

Referenced by xxxScanSysQueue().

04652 { 04653 PTHREADINFO ptiT; 04654 UINT fsMask; 04655 04656 /* 04657 * Calculate the mask from the message range. Only interested 04658 * in hardware input here: mouse and keys. 04659 */ 04660 fsMask = CalcWakeMask(message, message, 0) & (QS_MOUSE | QS_KEY); 04661 04662 /* 04663 * If it is set in this thread's wakebits, nothing to do. 04664 * Otherwise transfer them from the owner to this thread. 04665 */ 04666 if (!(pti->pcti->fsWakeBits & fsMask)) { 04667 /* 04668 * Either mouse or key is set (not both). Remove this bit 04669 * from the thread that currently owns it, and change mouse / 04670 * key ownership to this thread. 04671 */ 04672 if (fsMask & QS_KEY) { 04673 ptiT = pti->pq->ptiKeyboard; 04674 pti->pq->ptiKeyboard = pti; 04675 } else { 04676 ptiT = pti->pq->ptiMouse; 04677 pti->pq->ptiMouse = pti; 04678 } 04679 ptiT->pcti->fsWakeBits &= ~fsMask; 04680 04681 /* 04682 * Transfer them to this thread (certainly this may be the 04683 * same thread for win32 threads not sharing queues). 04684 */ 04685 pti->pcti->fsWakeBits |= fsMask; 04686 pti->pcti->fsChangeBits |= fsMask; 04687 } 04688 }

VOID UnlinkWindow PWND  pwndUnlink,
PWND  pwndParent
 

Definition at line 2867 of file createw.c.

References FALSE, Lock, NULL, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndParent, Unlock, and VOID().

Referenced by ImeSetTopmost(), xxxDestroyWindow(), xxxFW_DestroyAllChildren(), xxxSetParent(), and zzzChangeStates().

02870 { 02871 PWND pwnd; 02872 02873 pwnd = pwndParent->spwndChild; 02874 02875 if (pwnd == pwndUnlink) { 02876 Lock(&(pwndParent->spwndChild), pwndUnlink->spwndNext); 02877 Unlock(&pwndUnlink->spwndNext); 02878 02879 #if DBG 02880 VerifyWindowLink (pwnd, pwndParent, FALSE); 02881 #endif 02882 02883 return; 02884 } 02885 02886 while (pwnd != NULL) { 02887 UserAssert(pwnd->spwndParent == pwndParent); 02888 if (pwnd->spwndNext == pwndUnlink) { 02889 Lock(&(pwnd->spwndNext), pwndUnlink->spwndNext); 02890 Unlock(&pwndUnlink->spwndNext); 02891 02892 #if DBG 02893 VerifyWindowLink (pwnd, pwndParent, FALSE); 02894 #endif 02895 return; 02896 } 02897 02898 pwnd = pwnd->spwndNext; 02899 } 02900 02901 /* 02902 * We should never get here unless the window isn't in the list! 02903 */ 02904 RIPMSG1(RIP_WARNING, 02905 "Unlinking previously unlinked window %#p\n", 02906 pwndUnlink); 02907 02908 #if DBG 02909 VerifyWindowLink (pwnd, pwndParent, FALSE); 02910 #endif 02911 02912 return; 02913 }

void UnloadCursorsAndIcons VOID   ) 
 

Definition at line 1642 of file w32/ntuser/kernel/init.c.

References gasyscur, gasysico, NULL, PpiCurrent, tagSYSCFGICO::spcur, TRACE_HYDAPI, Unlock, and VOID().

Referenced by CleanupResources().

01644 { 01645 PCURSOR pcur; 01646 int ind; 01647 01648 TRACE_HYDAPI(("UnloadCursorsAndIcons\n")); 01649 01650 /* 01651 * unlock the icons 01652 */ 01653 for (ind = 0; ind < COIC_CONFIGURABLE; ind++) { 01654 pcur = gasysico[ind].spcur; 01655 01656 if (pcur == NULL) 01657 continue; 01658 01659 pcur->head.ppi = PpiCurrent(); 01660 Unlock(&gasysico[ind].spcur); 01661 } 01662 01663 /* 01664 * unlock the cursors 01665 */ 01666 for (ind = 0; ind < COCR_CONFIGURABLE; ind++) { 01667 pcur = gasyscur[ind].spcur; 01668 01669 if (pcur == NULL) 01670 continue; 01671 01672 pcur->head.ppi = PpiCurrent(); 01673 Unlock(&gasyscur[ind].spcur); 01674 } 01675 }

__inline VOID UnlockCaptureWindow PQ  pq  ) 
 

Definition at line 7278 of file userk.h.

References gpsi.

Referenced by CancelInputState(), zzzAttachToQueue(), and zzzDestroyQueue().

07278 { 07279 UserAssert(gpsi->cCaptures > 0); 07280 gpsi->cCaptures--; 07281 } 07282 if (pwnd) { 07283 gpsi->cCaptures++; 07284 }

PVOID UnlockDesktopMenu PMENU ppmenu  ) 
 

Definition at line 124 of file mnsys.c.

References ClearMF, MFDESKTOP, NULL, TestMF, and Unlock.

Referenced by xxxDesktopThread().

00125 { 00126 UserAssert(*ppmenu != NULL); 00127 UserAssert(TestMF(*ppmenu, MFDESKTOP)); 00128 ClearMF(*ppmenu, MFDESKTOP); 00129 UserAssert(TestMF((*ppmenu)->rgItems->spSubMenu, MFDESKTOP)); 00130 ClearMF((*ppmenu)->rgItems->spSubMenu, MFDESKTOP); 00131 return Unlock(ppmenu); 00132 }

__inline PVOID UnlockDesktopSysMenu PMENU ppmenu  ) 
 

Definition at line 5479 of file userk.h.

References BOOL.

Referenced by xxxDesktopThread(), and xxxUpdatePerUserSystemParameters().

05490 {

void UnlockMFMWFPWindow PULONG_PTR  puHitArea  ) 
 

Definition at line 3128 of file ntuser/kernel/menu.c.

References IsMFMWFPWindow(), MFMWFP_OFFMENU, and Unlock.

Referenced by LockMFMWFPWindow(), MNCheckButtonDownState(), xxxHandleMenuMessages(), xxxMNDragLeave(), and xxxMNEndMenuState().

03129 { 03130 if (IsMFMWFPWindow(*puHitArea)) { 03131 Unlock(puHitArea); 03132 } else { 03133 *puHitArea = MFMWFP_OFFMENU; 03134 } 03135 }

VOID UnlockObjectAssignment PVOID *   ) 
 

Definition at line 421 of file ex.c.

References ExDesktopObjectType, FALSE, LogDesktop, NULL, ObDereferenceObject, OBJECT_TO_OBJECT_HEADER, and VOID().

00428 { 00429 if (*pplock != NULL) { 00430 #ifdef LOGDESKTOPLOCKS 00431 if (OBJECT_TO_OBJECT_HEADER(*pplock)->Type == *ExDesktopObjectType) { 00432 LogDesktop(*pplock, tag, FALSE, extra); 00433 } 00434 #endif 00435 ObDereferenceObject(*pplock); 00436 *pplock = NULL; 00437 } 00438 }

PVOID UnlockPopupMenu PPOPUPMENU  ppopup,
PMENU pspmenu
 

Definition at line 367 of file ntuser/kernel/menu.c.

References IsRootPopupMenu(), NULL, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndNotify, Unlock, and UnlockPopupMenuWindow().

Referenced by MNFreePopup(), and xxxMNKeyDown().

00368 { 00369 /* 00370 * If you hit this assertion, you're probably not passing the right thing 00371 */ 00372 UserAssert((pspmenu == &ppopup->spmenu) || (pspmenu == &ppopup->spmenuAlternate)); 00373 /* 00374 * If nothing is locked, bail. 00375 */ 00376 if (*pspmenu == NULL) { 00377 return NULL; 00378 } 00379 00380 /* 00381 * This won't work properly if the popup already unlocked the notification 00382 * window. However, this can happen with the root popup if the 00383 * notification window gets destroyed while in menu mode. 00384 */ 00385 UserAssert((ppopup->spwndNotify != NULL) || IsRootPopupMenu(ppopup)); 00386 00387 /* 00388 * When using modeless menus, menus can be shared by several active 00389 * popups/notification windows. If the menu has owner draw items, 00390 * the app better knows how to paint them right. It shouldn't 00391 * happen with modal menus though. 00392 */ 00393 #if DBG 00394 if (((*pspmenu)->spwndNotify != NULL) 00395 && (ppopup->spwndNotify != NULL) 00396 && (ppopup->spwndNotify != (*pspmenu)->spwndNotify)) { 00397 00398 RIPMSG3(RIP_WARNING, "UnlockPopupMenu: Menu %#p shared by %#p and %#p", 00399 *pspmenu, (*pspmenu)->spwndNotify, ppopup->spwndNotify); 00400 } 00401 #endif 00402 00403 /* 00404 * Unlock the menu's spwndNotify if needed 00405 */ 00406 UnlockPopupMenuWindow(*pspmenu, ppopup->spwndNotify); 00407 00408 /* 00409 * Unlock the menu from the popup structure 00410 */ 00411 return Unlock(pspmenu); 00412 }

PVOID UnlockWndMenu PWND  pwnd,
PMENU pspmenu
 

Definition at line 458 of file ntuser/kernel/menu.c.

References NULL, tagWND::spmenu, tagWND::spmenuSys, and Unlock.

Referenced by xxxFreeWindow(), xxxGetSystemMenu(), xxxSetWindowData(), and xxxSetWindowStyle().

00459 { 00460 /* 00461 * If you hit this assertion, you're probably not passing the right thing 00462 */ 00463 UserAssert((pspmenu == &pwnd->spmenu) || (pspmenu == &pwnd->spmenuSys)); 00464 00465 /* 00466 * If nothing is locked, bail 00467 */ 00468 if (*pspmenu == NULL) { 00469 return NULL; 00470 } 00471 00472 /* 00473 * If this window owns the menu, unlock it from the menu strucutre 00474 */ 00475 if (pwnd == (*pspmenu)->spwndNotify) { 00476 Unlock(&((*pspmenu)->spwndNotify)); 00477 } 00478 00479 /* 00480 * Unlock the menu from the window structure 00481 */ 00482 return Unlock(pspmenu); 00483 }

VOID UnmapDesktop IN PEPROCESS Process  OPTIONAL,
IN PVOID  Object,
IN ACCESS_MASK  GrantedAccess,
IN ULONG  ProcessHandleCount,
IN ULONG  SystemHandleCount
 

BOOL UnqueueMouseEvent PMOUSEEVENT  pme  ) 
 

Definition at line 997 of file ntinput.c.

References BOOL, DWORD, EnterMouseCrit(), FALSE, gdwMouseEvents, gdwMouseQueueHead, gMouseEventQueue, gMouseUnqueueMouseEventTime, LeaveMouseCrit(), LOGTIME, NELEM_BUTTONQUEUE, PMOUSEEVENT, and TRUE.

Referenced by ProcessQueuedMouseEvents().

01000 { 01001 DWORD dwTail; 01002 01003 EnterMouseCrit(); 01004 01005 LOGTIME(gMouseUnqueueMouseEventTime); 01006 01007 if (gdwMouseEvents == 0) { 01008 LeaveMouseCrit(); 01009 return FALSE; 01010 } else { 01011 dwTail = (gdwMouseQueueHead - gdwMouseEvents + 1) % NELEM_BUTTONQUEUE; 01012 *pme = gMouseEventQueue[dwTail]; 01013 gdwMouseEvents--; 01014 } 01015 01016 LeaveMouseCrit(); 01017 return TRUE; 01018 }

BOOL UnsetLayeredWindow PWND  pwnd  ) 
 

Definition at line 417 of file sprite.c.

References BEGINATOMICCHECK, BOOL, ClrWF, ENDATOMICCHECK, FALSE, gpDispInfo, tagDISPLAYINFO::hDev, IDC_DEFAULT, IDC_NOMOUSE, NULL, PtoHq, RemoveRedirectionBitmap(), TestWF, TRUE, WEFLAYERED, WFVISIBLE, and zzzInvalidateDCCache().

Referenced by DeleteFadeSprite(), xxxFreeWindow(), and xxxSetWindowStyle().

00418 { 00419 HWND hwnd = PtoHq(pwnd); 00420 00421 /* 00422 * Remove the layered redirection bitmap. 00423 */ 00424 RemoveRedirectionBitmap(pwnd); 00425 00426 /* 00427 * If the window is still visible, leave the sprite bits on the screen. 00428 */ 00429 if (TestWF(pwnd, WFVISIBLE)) { 00430 GreUpdateSprite(gpDispInfo->hDev, hwnd, NULL, NULL, NULL, NULL, 00431 NULL, NULL, 0, NULL, ULW_NOREPAINT, NULL); 00432 } 00433 00434 /* 00435 * Delete the sprite object. 00436 */ 00437 if (!GreDeleteSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL)) { 00438 RIPMSG1(RIP_WARNING, "xxxSetLayeredWindow failed %X", pwnd); 00439 return FALSE; 00440 } 00441 ClrWF(pwnd, WEFLAYERED); 00442 00443 /* 00444 * No need to jiggle the mouse when the sprite is removed. As an 00445 * added bonus that means that zzzInvalidateDCCache won't leave 00446 * the critical section. 00447 * 00448 * Make sure the window gets painted if visible. 00449 * 00450 * BUGBUG: should jiggle the mouse. Remove IDC_NOMOUSE when 00451 * SetFMouseMoved and thus InvalidateDCCache don't leave crit. 00452 */ 00453 if (TestWF(pwnd, WFVISIBLE)) { 00454 BEGINATOMICCHECK(); 00455 zzzInvalidateDCCache(pwnd, IDC_DEFAULT | IDC_NOMOUSE); 00456 ENDATOMICCHECK(); 00457 } 00458 return TRUE; 00459 }

VOID UpdateAsyncKeyState PQ  pq,
UINT  wVK,
BOOL  fBreak
 

Definition at line 322 of file keyboard.c.

References tagQ::afKeyRecentDown, CheckCritIn, ClearAsyncKeyStateDown, ClearAsyncKeyStateToggle, CVKASYNCKEYCACHE, gpsi, grpdeskRitInput, NULL, PostUpdateKeyStateEvent(), tagTHREADINFO::pq, tagDESKTOP::PtiList, tagQ::QF_flags, QF_UPDATEKEYSTATE, SetAsyncKeyStateDown, SetAsyncKeyStateRecentDown, SetAsyncKeyStateToggle, SetKeyRecentDownBit, TestAsyncKeyStateDown, and TestAsyncKeyStateToggle.

Referenced by xxxButtonEvent(), and xxxKeyEvent().

00326 { 00327 PQ pqT; 00328 PLIST_ENTRY pHead, pEntry; 00329 PTHREADINFO pti; 00330 00331 CheckCritIn(); 00332 00333 /* 00334 * First check to see if the queue this key is going to has a pending 00335 * key state event. If it does, post it because we need to copy the 00336 * async key state into this event as it is before we modify 00337 * this key's state, or else we'll generate a key state event with 00338 * the wrong key state in it. 00339 */ 00340 if (pqOwner != NULL && pqOwner->QF_flags & QF_UPDATEKEYSTATE) { 00341 PostUpdateKeyStateEvent(pqOwner); 00342 } 00343 00344 if (!fBreak) { 00345 /* 00346 * This key has gone down - update the "recent down" bit in the 00347 * async key state table. 00348 */ 00349 SetAsyncKeyStateRecentDown(wVK); 00350 00351 /* 00352 * This is a key make. If the key was not already down, update the 00353 * toggle bit. 00354 */ 00355 if (!TestAsyncKeyStateDown(wVK)) { 00356 if (TestAsyncKeyStateToggle(wVK)) { 00357 ClearAsyncKeyStateToggle(wVK); 00358 } else { 00359 SetAsyncKeyStateToggle(wVK); 00360 } 00361 } 00362 00363 /* 00364 * This is a make, so turn on the key down bit. 00365 */ 00366 SetAsyncKeyStateDown(wVK); 00367 00368 } else { 00369 /* 00370 * This is a break, so turn off the key down bit. 00371 */ 00372 ClearAsyncKeyStateDown(wVK); 00373 } 00374 00375 /* 00376 * If this is one of the keys we cache, update the async key cache index. 00377 */ 00378 if (wVK < CVKASYNCKEYCACHE) { 00379 gpsi->dwAsyncKeyCache++; 00380 } 00381 00382 /* 00383 * A key has changed state. Update all queues not receiving this input so 00384 * they know that this key has changed state. This lets us know which keys to 00385 * update in the thread specific key state table to keep it in sync 00386 * with the user. Walking down the thread list may mean that an 00387 * individual queue may by updated more than once, but it is cheaper 00388 * than maintaining a list of queues on the desktop. 00389 */ 00390 UserAssert(grpdeskRitInput != NULL); 00391 00392 pHead = &grpdeskRitInput->PtiList; 00393 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 00394 pti = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 00395 00396 /* 00397 * Don't update the queue this message is going to - it'll be 00398 * in sync because it is receiving this message. 00399 */ 00400 pqT = pti->pq; 00401 if (pqT == pqOwner) 00402 continue; 00403 00404 /* 00405 * Set the "recent down" bit. In this case this doesn't really mean 00406 * "recent down", it means "recent change" (since the last time 00407 * we synced this queue), either up or down. This tells us which 00408 * keys went down since the last time this thread synced with key 00409 * state. Set the "update key state" flag so we know that later 00410 * we need to sync with these keys. 00411 */ 00412 SetKeyRecentDownBit(pqT->afKeyRecentDown, wVK); 00413 pqT->QF_flags |= QF_UPDATEKEYSTATE; 00414 } 00415 00416 /* 00417 * Update the key cache index. 00418 */ 00419 gpsi->dwKeyCache++; 00420 }

BOOL UpdateInputContext IN PIMC  pImc,
IN UPDATEINPUTCONTEXTCLASS  UpdateType,
IN ULONG_PTR  UpdateValue
 

Definition at line 239 of file ntimm.c.

References BOOL, FALSE, GETPTI, tagTHREADINFO::ppi, PtiCurrent, TRUE, UpdateClientInputContext, and UpdateInUseImeWindow.

Referenced by NtUserUpdateInputContext().

00243 { 00244 PTHREADINFO ptiCurrent, ptiImcOwner; 00245 00246 ptiCurrent = PtiCurrent(); 00247 ptiImcOwner = GETPTI(pImc); 00248 00249 /* 00250 * Cannot update input context from other process. 00251 */ 00252 if (ptiImcOwner->ppi != ptiCurrent->ppi) { 00253 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, "UpdateInputContext: pImc not of current ppi"); 00254 return FALSE; 00255 } 00256 00257 00258 switch (UpdateType) { 00259 00260 case UpdateClientInputContext: 00261 if (pImc->dwClientImcData != 0) { 00262 RIPERR0(RIP_WARNING, RIP_WARNING, "UpdateInputContext: pImc->dwClientImcData != 0"); 00263 return FALSE; 00264 } 00265 pImc->dwClientImcData = UpdateValue; 00266 break; 00267 00268 case UpdateInUseImeWindow: 00269 pImc->hImeWnd = (HWND)UpdateValue; 00270 break; 00271 00272 default: 00273 return FALSE; 00274 } 00275 00276 return TRUE; 00277 }

VOID UpdateKeyLights BOOL  bInjected  ) 
 

Definition at line 2985 of file ntinput.c.

References CheckCritIn, ClearRawKeyToggle, DEVICE_TYPE_KEYBOARD, EnterDeviceInfoListCrit(), gbRemoteSession, gdwUpdateKeyboard, giosbKbdControl, gKeyboardInfo, gklp, gpDeviceInfoList, gptiRit, LeaveDeviceInfoListCrit(), NULL, PtiCurrent, SetRawKeyToggle, TestAsyncKeyStateToggle, UPDATE_KBD_LEDS, and VOID().

Referenced by _SetKeyboardState(), ChangeForegroundKeyboardTable(), ProcessDeviceChanges(), RemotePassthruDisable(), UpdatePerUserKeyboardIndicators(), xxxKeyEvent(), and xxxRemoteReconnect().

02986 { 02987 /* 02988 * Looking at async keystate. Must be in critical section. 02989 */ 02990 CheckCritIn(); 02991 02992 /* 02993 * Based on the toggle bits in the async keystate table, 02994 * set the key lights. 02995 */ 02996 gklp.LedFlags = 0; 02997 if (TestAsyncKeyStateToggle(VK_CAPITAL)) { 02998 gklp.LedFlags |= KEYBOARD_CAPS_LOCK_ON; 02999 SetRawKeyToggle(VK_CAPITAL); 03000 } else { 03001 ClearRawKeyToggle(VK_CAPITAL); 03002 } 03003 03004 if (TestAsyncKeyStateToggle(VK_NUMLOCK)) { 03005 gklp.LedFlags |= KEYBOARD_NUM_LOCK_ON; 03006 SetRawKeyToggle(VK_NUMLOCK); 03007 } else { 03008 ClearRawKeyToggle(VK_NUMLOCK); 03009 } 03010 03011 if (TestAsyncKeyStateToggle(VK_SCROLL)) { 03012 gklp.LedFlags |= KEYBOARD_SCROLL_LOCK_ON; 03013 SetRawKeyToggle(VK_SCROLL); 03014 } else { 03015 ClearRawKeyToggle(VK_SCROLL); 03016 } 03017 03018 /* 03019 * Only "Japanese keyboard hardware" has "KANA" LEDs, and switch to 03020 * "KANA" state. 03021 */ 03022 if (JAPANESE_KEYBOARD(gKeyboardInfo.KeyboardIdentifier)) { 03023 if (TestAsyncKeyStateToggle(VK_KANA)) { 03024 gklp.LedFlags |= KEYBOARD_KANA_LOCK_ON; 03025 SetRawKeyToggle(VK_KANA); 03026 } else { 03027 ClearRawKeyToggle(VK_KANA); 03028 } 03029 } 03030 03031 /* 03032 * On terminal server, we need to tell the WD about application injected 03033 * toggle keys so it can update the client accordingly. 03034 */ 03035 if (gbRemoteSession) { 03036 if (bInjected) 03037 gklp.LedFlags |= KEYBOARD_LED_INJECTED; 03038 else 03039 gklp.LedFlags &= ~KEYBOARD_LED_INJECTED; 03040 } 03041 03042 03043 if (PtiCurrent() != gptiRit) { 03044 /* 03045 * Hand off the IOCTL to the RIT, since only the system process can 03046 * access the keyboard handles. Happens when applying user's profile. 03047 * IanJa: Should we check PpiCurrent() == gptiRit->ppi instead? 03048 */ 03049 gdwUpdateKeyboard |= UPDATE_KBD_LEDS; 03050 } else { 03051 /* 03052 * Do it immediately (avoids a small delay between keydown and LED 03053 * on when typing) 03054 */ 03055 PDEVICEINFO pDeviceInfo; 03056 03057 EnterDeviceInfoListCrit(); 03058 for (pDeviceInfo = gpDeviceInfoList; pDeviceInfo; pDeviceInfo = pDeviceInfo->pNext) { 03059 if ((pDeviceInfo->type == DEVICE_TYPE_KEYBOARD) && (pDeviceInfo->handle)) { 03060 ZwDeviceIoControlFile(pDeviceInfo->handle, NULL, NULL, NULL, 03061 &giosbKbdControl, IOCTL_KEYBOARD_SET_INDICATORS, 03062 (PVOID)&gklp, sizeof(gklp), NULL, 0); 03063 } 03064 } 03065 LeaveDeviceInfoListCrit(); 03066 } 03067 }

VOID UpdateLayeredSprite PDCE  pdce  ) 
 

Definition at line 141 of file sprite.c.

References _GetProp(), BEGINATOMICCHECK, ENDATOMICCHECK, FLayeredOrRedirected(), FWINABLE, GetLayeredWindow(), ghdcMem, gpDispInfo, tagDCE::hdc, tagDISPLAYINFO::hDev, NULL, PROP_LAYER, PtoHq, tagDCE::pwndOrg, tagWND::rcWindow, TestWF, TRUE, VOID(), WEF_ASYNC, WEFLAYERED, and xxxWindowEvent().

Referenced by _GetDCEx(), ReleaseCacheDC(), and xxxSystemTimerProc().

00142 { 00143 RECT rcBounds; 00144 PWND pwnd; 00145 SIZE size; 00146 POINT pt; 00147 HBITMAP hbm, hbmOld; 00148 00149 /* 00150 * Check to see if any drawing has been done into this DC 00151 * that should be transferred to the sprite. 00152 */ 00153 if (!GreGetBounds(pdce->hdc, &rcBounds, 0)) 00154 return; 00155 00156 pwnd = GetLayeredWindow(pdce->pwndOrg); 00157 00158 UserAssert(FLayeredOrRedirected(pwnd)); 00159 00160 if (TestWF(pwnd, WEFLAYERED)) { 00161 hbm = (HBITMAP)_GetProp(pwnd, PROP_LAYER, TRUE); 00162 00163 UserAssert(hbm != NULL); 00164 00165 hbmOld = GreSelectBitmap(ghdcMem, hbm); 00166 00167 size.cx = pwnd->rcWindow.right - pwnd->rcWindow.left; 00168 size.cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 00169 00170 pt.x = pt.y = 0; 00171 GreUpdateSprite(gpDispInfo->hDev, PtoHq(pwnd), NULL, NULL, NULL, 00172 &size, ghdcMem, &pt, 0, NULL, ULW_DEFAULT_ATTRIBUTES, &rcBounds); 00173 00174 GreSelectBitmap(ghdcMem, hbmOld); 00175 } 00176 00177 #ifdef REDIRECTION 00178 if (FWINABLE()) { 00179 BEGINATOMICCHECK(); 00180 xxxWindowEvent(EVENT_SYSTEM_REDIRECTEDPAINT, pwnd, 00181 MAKELONG(rcBounds.left, rcBounds.top), 00182 MAKELONG(rcBounds.right, rcBounds.bottom), 00183 WEF_ASYNC); 00184 ENDATOMICCHECK(); 00185 } 00186 #endif // REDIRECTION 00187 }

void UpdateMouseInfo void   ) 
 

Definition at line 385 of file ntinput.c.

References CheckCritIn, DEVICE_TYPE_MOUSE, DEVICEINFO, EnterDeviceInfoListCrit(), gbRemoteSession, GDIAF_ARRIVED, GDIAF_RECONNECT, ghRemoteMouseChannel, gnMice, gpDeviceInfoList, LeaveDeviceInfoListCrit(), NULL, RequestDeviceChange(), and TRUE.

Referenced by xxxRemoteReconnect().

00386 { 00387 DEVICEINFO *pDeviceInfo; 00388 CheckCritIn(); // expect no surprises 00389 00390 UserAssert(gbRemoteSession); 00391 00392 if (ghRemoteMouseChannel == NULL) { 00393 return; 00394 } 00395 00396 UserAssert(gnMice == 1); 00397 00398 /* 00399 * Mark the mice and signal the RIT to do the work asynchronously 00400 */ 00401 EnterDeviceInfoListCrit(); 00402 for (pDeviceInfo = gpDeviceInfoList; pDeviceInfo; pDeviceInfo = pDeviceInfo->pNext) { 00403 if (pDeviceInfo->type == DEVICE_TYPE_MOUSE) { 00404 TAGMSG1(DBGTAG_PNP, "UpdateMouseInfo(): pDeviceInfo %#p ARRIVED", pDeviceInfo); 00405 RequestDeviceChange(pDeviceInfo, GDIAF_ARRIVED | GDIAF_RECONNECT, TRUE); 00406 } 00407 } 00408 LeaveDeviceInfoListCrit(); 00409 }

VOID UpdatePerUserKeyboardIndicators PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 256 of file keyboard.c.

References ClearAsyncKeyStateToggle, ClearKeyStateToggle, ClearRawKeyToggle, DWORD, FALSE, FastGetProfileIntW(), gbRemoteSession, gfKanaToggle, gklpBootTime, PMAP_KEYBOARD, tagTHREADINFO::pq, PtiCurrent, SetAsyncKeyStateToggle, SetKeyStateToggle, SetRawKeyToggle, UpdateKeyLights(), and wszInitialKeyboardIndicators.

Referenced by xxxUpdatePerUserSystemParameters().

00257 { 00258 DWORD dw; 00259 PQ pq; 00260 PTHREADINFO ptiCurrent = PtiCurrent(); 00261 pq = ptiCurrent->pq; 00262 00263 /* 00264 * For terminal server, the client is responsible for synchronizing the 00265 * keyboard state. 00266 */ 00267 if (gbRemoteSession) { 00268 return; 00269 } 00270 00271 /* 00272 * Initial Keyboard state (Num-Lock only) 00273 */ 00274 dw = FastGetProfileIntW(pProfileUserName, 00275 PMAP_KEYBOARD, 00276 wszInitialKeyboardIndicators, 00277 2); 00278 00279 dw &= 0x80000002; 00280 00281 00282 /* 00283 * The special value 0x80000000 in the registry indicates that the BIOS 00284 * settings are to be used as the initial LED state. (This is undocumented) 00285 */ 00286 if (dw == 0x80000000) { 00287 dw = gklpBootTime.LedFlags; 00288 } 00289 if (dw & 0x02) { 00290 SetKeyStateToggle(pq, VK_NUMLOCK); 00291 SetAsyncKeyStateToggle(VK_NUMLOCK); 00292 SetRawKeyToggle(VK_NUMLOCK); 00293 } else { 00294 ClearKeyStateToggle(pq, VK_NUMLOCK); 00295 ClearAsyncKeyStateToggle(VK_NUMLOCK); 00296 ClearRawKeyToggle(VK_NUMLOCK); 00297 } 00298 00299 /* 00300 * Initialize KANA Toggle status 00301 */ 00302 gfKanaToggle = FALSE; 00303 ClearKeyStateToggle(pq, VK_KANA); 00304 ClearAsyncKeyStateToggle(VK_KANA); 00305 ClearRawKeyToggle(VK_KANA); 00306 00307 UpdateKeyLights(FALSE); 00308 }

BOOL UpdateWinIniInt PUNICODE_STRING  pProfileUserName,
UINT  idSection,
UINT  wKeyNameId,
int  value
 

Definition at line 306 of file rare.c.

References BOOL, FastWriteProfileStringW(), hModuleWin, L, and ServerLoadString.

Referenced by SetWindowMetricInt(), xxxSetIMEShowStatus(), and xxxSystemParametersInfo().

00311 { 00312 WCHAR szTemp[40]; 00313 WCHAR szKeyName[40]; 00314 swprintf(szTemp, L"%d", value); 00315 00316 ServerLoadString(hModuleWin, 00317 wKeyNameId, 00318 szKeyName, 00319 sizeof(szKeyName) / sizeof(WCHAR)); 00320 00321 return FastWriteProfileStringW(pProfileUserName, 00322 idSection, 00323 szKeyName, 00324 szTemp); 00325 00326 00327 }

__inline PPROFILEVALUEINFO UPDWORDPointer UINT  uSetting  ) 
 

Definition at line 6940 of file userk.h.

06943 { 06944 if (pttwnd != NULL) {

__inline DWORD UPDWORDValue UINT  uSetting  ) 
 

Definition at line 7059 of file userk.h.

References guSFWLockCount.

Referenced by xxxSystemParametersInfo().

07059 { 07060 guSFWLockCount++; 07061 } 07062

ATOM UserAddAtom LPCWSTR  lpAtom,
BOOL  bPin
 

Definition at line 35 of file w32/ntuser/kernel/atom.c.

References IS_PTR, NT_SUCCESS, NTSTATUS(), RtlAddAtomToAtomTable(), RtlPinAtomInAtomTable(), Status, and UserAtomTableHandle.

Referenced by _SetCursorIconData(), GetHmodTableIndex(), InitOLEFormats(), InternalRegisterClassEx(), InternalSetClipboardData(), NtUserRegisterWindowMessage(), SetupClassAtoms(), and Win32UserInitialize().

00037 { 00038 NTSTATUS Status; 00039 ATOM atom; 00040 00041 UserAssert(IS_PTR(ccxlpAtom)); 00042 00043 /* 00044 * Rtl routines protect accesses to strings with their 00045 * own try/except blocks. 00046 */ 00047 atom = 0; 00048 Status = RtlAddAtomToAtomTable( UserAtomTableHandle, 00049 (PWSTR)ccxlpAtom, 00050 &atom 00051 ); 00052 if (!NT_SUCCESS(Status)) { 00053 RIPNTERR0(Status, RIP_VERBOSE, "UserAddAtom: add failed"); 00054 } 00055 00056 if (atom && bPin) 00057 RtlPinAtomInAtomTable(UserAtomTableHandle,atom); 00058 00059 return atom; 00060 }

BOOL UserBeep DWORD  dwFreq,
DWORD  dwDuration
 

Definition at line 102 of file base.c.

References _UserSoundSentryWorker(), BOOL, CheckCritOut, DWORD, EnterCrit, FALSE, gbRemoteSession, gpRemoteBeepDevice, KeDelayExecutionThread(), KernelMode, L, LeaveCrit, NT_SUCCESS, NTSTATUS(), NULL, ObjectAttributes, ObOpenObjectByPointer(), RtlInitUnicodeString(), Status, TRUE, UserMode, and ZwCreateFile().

Referenced by DownSiren(), HighBeep(), KeyClick(), LowBeep(), ProcessKeyboardInput(), QueueMouseEvent(), UpSiren(), and xxxOldMessageBeep().

00105 { 00106 OBJECT_ATTRIBUTES ObjectAttributes; 00107 UNICODE_STRING NameString; 00108 NTSTATUS Status; 00109 IO_STATUS_BLOCK IoStatus; 00110 BEEP_SET_PARAMETERS BeepParameters; 00111 HANDLE hBeepDevice; 00112 LARGE_INTEGER TimeOut; 00113 00114 CheckCritOut(); 00115 00116 if (gbRemoteSession) { 00117 if (gpRemoteBeepDevice == NULL) 00118 Status = STATUS_UNSUCCESSFUL; 00119 else 00120 Status = ObOpenObjectByPointer( 00121 gpRemoteBeepDevice, 00122 0, 00123 NULL, 00124 EVENT_ALL_ACCESS, 00125 NULL, 00126 KernelMode, 00127 &hBeepDevice); 00128 } else { 00129 00130 RtlInitUnicodeString(&NameString, DD_BEEP_DEVICE_NAME_U); 00131 00132 InitializeObjectAttributes(&ObjectAttributes, 00133 &NameString, 00134 0, 00135 NULL, 00136 NULL); 00137 00138 Status = ZwCreateFile(&hBeepDevice, 00139 FILE_READ_DATA | FILE_WRITE_DATA, 00140 &ObjectAttributes, 00141 &IoStatus, 00142 NULL, 00143 0, 00144 FILE_SHARE_READ | FILE_SHARE_WRITE, 00145 FILE_OPEN_IF, 00146 0, 00147 (PVOID) NULL, 00148 0L); 00149 } 00150 00151 if (!NT_SUCCESS(Status)) { 00152 return FALSE; 00153 } 00154 00155 /* 00156 * 0,0 is a special case used to turn off a beep. Otherwise 00157 * validate the dwFreq parameter to be in range. 00158 */ 00159 if ((dwFreq != 0 || dwDuration != 0) && 00160 (dwFreq < (ULONG)0x25 || dwFreq > (ULONG)0x7FFF)) { 00161 00162 Status = STATUS_INVALID_PARAMETER; 00163 } else { 00164 BeepParameters.Frequency = dwFreq; 00165 BeepParameters.Duration = dwDuration; 00166 00167 Status = ZwDeviceIoControlFile(hBeepDevice, 00168 NULL, 00169 NULL, 00170 NULL, 00171 &IoStatus, 00172 IOCTL_BEEP_SET, 00173 &BeepParameters, 00174 sizeof(BeepParameters), 00175 NULL, 00176 0); 00177 } 00178 00179 EnterCrit(); 00180 _UserSoundSentryWorker(); 00181 LeaveCrit(); 00182 00183 if (!NT_SUCCESS(Status)) { 00184 ZwClose(hBeepDevice); 00185 return FALSE; 00186 } 00187 00188 /* 00189 * Beep device is asynchronous, so sleep for duration 00190 * to allow this beep to complete. 00191 */ 00192 if (dwDuration != (DWORD)-1 && (dwFreq != 0 || dwDuration != 0)) { 00193 TimeOut.QuadPart = Int32x32To64( dwDuration, -10000); 00194 00195 do { 00196 Status = KeDelayExecutionThread(UserMode, FALSE, &TimeOut); 00197 } 00198 while (Status == STATUS_ALERTED); 00199 } 00200 ZwClose(hBeepDevice); 00201 return TRUE; 00202 }

NTSTATUS UserCommitDesktopMemory PVOID  pBase,
PVOID *  ppCommit,
PSIZE_T  pCommitSize
 

Definition at line 15 of file w32/ntuser/kernel/heap.c.

References CommitReadOnlyMemory(), DWORD, GetDesktopView(), grpWinStaList, tagDESKTOP::hsectionDesktop, IS_SYSTEM_THREAD, MapDesktop(), NT_SUCCESS, NTSTATUS(), NULL, ObOpenHandle, PBYTE, tagDESKTOPVIEW::pdesk, tagDESKTOP::pDeskInfo, tagDESKTOPVIEW::pdvNext, PpiCurrent, PsGetCurrentProcess, PsGetCurrentThread, tagDESKTOPINFO::pvDesktopBase, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, tagWINDOWSTATION::rpwinstaNext, Status, TRUE, and tagDESKTOPVIEW::ulClientDelta.

Referenced by CreateDesktopHeap().

00019 { 00020 PDESKTOPVIEW pdv; 00021 DWORD dwCommitOffset; 00022 PWINDOWSTATION pwinsta; 00023 PDESKTOP pdesk; 00024 PBYTE pUserBase; 00025 int dCommit; 00026 NTSTATUS Status; 00027 ETHREAD *Thread = PsGetCurrentThread(); 00028 00029 /* 00030 * If this is a system thread, we have no view of the desktop 00031 * and must map it in. Fortunately, this does not happen often. 00032 * 00033 * We use the Thread variable because IS_SYSTEM_THREAD is a macro 00034 * that multiply resolves the parameter. 00035 */ 00036 if (IS_SYSTEM_THREAD(Thread)) { 00037 00038 /* 00039 * Find the desktop that owns the section. 00040 */ 00041 for (pwinsta = grpWinStaList; pwinsta; pwinsta = pwinsta->rpwinstaNext) { 00042 for (pdesk = pwinsta->rpdeskList; pdesk; pdesk = pdesk->rpdeskNext) { 00043 if (pdesk->pDeskInfo->pvDesktopBase == pBase) 00044 goto FoundIt; 00045 } 00046 } 00047 FoundIt: 00048 if (pwinsta == NULL) { 00049 RIPMSG3(RIP_ERROR, "UserCommitDesktopMemory failed: pBase %#p, ppCommit %#p, pCommitSize %d", 00050 pBase, ppCommit, *pCommitSize); 00051 return STATUS_NO_MEMORY; 00052 } 00053 00054 /* 00055 * Map the section into the current process and commit the 00056 * first page of the section. 00057 */ 00058 dwCommitOffset = (ULONG)((PBYTE)*ppCommit - (PBYTE)pBase); 00059 Status = CommitReadOnlyMemory(pdesk->hsectionDesktop, pCommitSize, 00060 dwCommitOffset, &dCommit); 00061 if (NT_SUCCESS(Status)) { 00062 *ppCommit = (PBYTE)*ppCommit + dCommit; 00063 } 00064 } else { 00065 00066 /* 00067 * Find the current process' view of the desktop 00068 */ 00069 for (pdv = PpiCurrent()->pdvList; pdv != NULL; pdv = pdv->pdvNext) { 00070 if (pdv->pdesk->pDeskInfo->pvDesktopBase == pBase) 00071 break; 00072 } 00073 00074 /* 00075 * 254954: If we didn't find a desktop view then map the desktop view 00076 * to the current process. 00077 */ 00078 if (pdv == NULL) { 00079 /* 00080 * Find the desktop that owns the section. 00081 */ 00082 for (pwinsta = grpWinStaList; pwinsta; pwinsta = pwinsta->rpwinstaNext) { 00083 for (pdesk = pwinsta->rpdeskList; pdesk; pdesk = pdesk->rpdeskNext) { 00084 if (pdesk->pDeskInfo->pvDesktopBase == pBase) 00085 goto FoundTheDesktop; 00086 } 00087 } 00088 00089 FoundTheDesktop: 00090 if (pwinsta == NULL) { 00091 RIPMSG3(RIP_ERROR, "UserCommitDesktopMemory failed: pBase %#p, ppCommit %#p, pCommitSize %d", 00092 pBase, ppCommit, *pCommitSize); 00093 return STATUS_NO_MEMORY; 00094 } 00095 00096 UserAssert(pdesk != NULL); 00097 00098 /* 00099 * Map the desktop into the current process 00100 */ 00101 try { 00102 MapDesktop(ObOpenHandle, PsGetCurrentProcess(), pdesk, 0, 1); 00103 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 00104 00105 RIPMSG2(RIP_WARNING, "UserCommitDesktopMemory: Could't map pdesk %#p in ppi %#p", 00106 pdesk, PpiCurrent()); 00107 return STATUS_NO_MEMORY; 00108 } 00109 00110 pdv = GetDesktopView(PpiCurrent(), pdesk); 00111 } 00112 00113 UserAssert(pdv != NULL); 00114 00115 /* 00116 * Commit the memory 00117 */ 00118 pUserBase = (PVOID)((PBYTE)*ppCommit - pdv->ulClientDelta); 00119 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), 00120 &pUserBase, 00121 0, 00122 pCommitSize, 00123 MEM_COMMIT, 00124 PAGE_EXECUTE_READ 00125 ); 00126 if (NT_SUCCESS(Status)) 00127 *ppCommit = (PVOID)((PBYTE)pUserBase + pdv->ulClientDelta); 00128 } 00129 00130 return Status; 00131 }

NTSTATUS UserCommitSharedMemory PVOID  pBase,
PVOID *  ppCommit,
PSIZE_T  pCommitSize
 

Definition at line 133 of file w32/ntuser/kernel/heap.c.

References CommitReadOnlyMemory(), DWORD, ghSectionShared, gpvSharedAlloc, gpvSharedBase, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, PpiCurrent, PsGetCurrentProcess, Status, ValidateProcessSessionId, and _EPROCESS::Win32Process.

Referenced by InitCreateSharedSection().

00137 { 00138 ULONG_PTR ulClientDelta; 00139 DWORD dwCommitOffset; 00140 PBYTE pUserBase; 00141 NTSTATUS Status; 00142 PEPROCESS Process; 00143 int dCommit; 00144 00145 #if DBG 00146 if (pBase != Win32HeapGetHandle(gpvSharedAlloc)) { 00147 RIPMSG0(RIP_WARNING, "pBase != gpvSharedAlloc"); 00148 } 00149 #else 00150 UNREFERENCED_PARAMETER(pBase); 00151 #endif 00152 00153 Process = PsGetCurrentProcess(); 00154 00155 ValidateProcessSessionId(Process); 00156 00157 if (Process->Win32Process == NULL || 00158 ((PPROCESSINFO)Process->Win32Process)->pClientBase == NULL) { 00159 00160 dwCommitOffset = (ULONG)((PBYTE)*ppCommit - (PBYTE)gpvSharedBase); 00161 Status = CommitReadOnlyMemory( 00162 ghSectionShared, pCommitSize, dwCommitOffset, &dCommit); 00163 00164 if (NT_SUCCESS(Status)) { 00165 *ppCommit = (PBYTE) *ppCommit + dCommit; 00166 } 00167 } else { 00168 00169 /* 00170 * Commit the memory 00171 */ 00172 ulClientDelta = (ULONG_PTR)((PBYTE)gpvSharedBase - (PBYTE)(PpiCurrent()->pClientBase)); 00173 pUserBase = (PVOID)((PBYTE)*ppCommit - ulClientDelta); 00174 Status = ZwAllocateVirtualMemory( 00175 NtCurrentProcess(), 00176 &pUserBase, 00177 0, 00178 pCommitSize, 00179 MEM_COMMIT, 00180 PAGE_EXECUTE_READ); 00181 if (NT_SUCCESS(Status)) { 00182 *ppCommit = (PVOID)((PBYTE)pUserBase + ulClientDelta); 00183 } 00184 } 00185 00186 return Status; 00187 }

PWIN32HEAP UserCreateHeap HANDLE  hSection,
ULONG  ulViewOffset,
PVOID  pvBaseAddress,
DWORD  dwSize,
PRTL_HEAP_COMMIT_ROUTINE  pfnCommit
 

Definition at line 189 of file w32/ntuser/kernel/heap.c.

References MmMapViewOfSection(), MmUnmapViewOfSection(), NT_SUCCESS, NTSTATUS(), NULL, PAGE_SIZE, PsGetCurrentProcess, and Status.

Referenced by CreateDesktopHeap(), and InitCreateSharedSection().

00195 { 00196 PVOID pUserBase; 00197 SIZE_T ulViewSize; 00198 LARGE_INTEGER liOffset; 00199 PEPROCESS Process = PsGetCurrentProcess(); 00200 RTL_HEAP_PARAMETERS HeapParams; 00201 NTSTATUS Status; 00202 ULONG HeapFlags; 00203 00204 /* 00205 * Map the section into the current process and commit the 00206 * first page of the section. 00207 */ 00208 ulViewSize = 0; 00209 liOffset.LowPart = ulViewOffset; 00210 liOffset.HighPart = 0; 00211 pUserBase = NULL; 00212 00213 Status = MmMapViewOfSection( 00214 hSection, 00215 Process, 00216 &pUserBase, 00217 0, 00218 PAGE_SIZE, 00219 &liOffset, 00220 &ulViewSize, 00221 ViewUnmap, 00222 SEC_NO_CHANGE, 00223 PAGE_EXECUTE_READ); 00224 00225 if (!NT_SUCCESS(Status)) 00226 return NULL; 00227 00228 MmUnmapViewOfSection(Process, pUserBase); 00229 00230 /* 00231 * We now have a committed page to create the heap in. 00232 */ 00233 RtlZeroMemory(&HeapParams, sizeof(HeapParams)); 00234 00235 HeapParams.Length = sizeof(HeapParams); 00236 HeapParams.InitialCommit = PAGE_SIZE; 00237 HeapParams.InitialReserve = dwSize; 00238 HeapParams.CommitRoutine = pfnCommit; 00239 00240 UserAssert(HeapParams.InitialCommit < dwSize); 00241 00242 00243 HeapFlags = HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY; 00244 00245 #if DBG 00246 HeapFlags |= HEAP_TAIL_CHECKING_ENABLED; 00247 #endif // DBG 00248 00249 return Win32HeapCreate("UH_HEAD", 00250 "UH_TAIL", 00251 HeapFlags, 00252 pvBaseAddress, 00253 dwSize, 00254 PAGE_SIZE, 00255 NULL, 00256 &HeapParams); 00257 }

ATOM UserDeleteAtom ATOM  atom  ) 
 

Definition at line 84 of file w32/ntuser/kernel/atom.c.

References gatomFirstPinned, gatomLastPinned, NT_SUCCESS, NTSTATUS(), RtlDeleteAtomFromAtomTable(), Status, and UserAtomTableHandle.

Referenced by _DestroyCursor(), CleanEventMessage(), DestroyClass(), GetHmodTableIndex(), InternalRegisterClassEx(), xxxDoSysExpunge(), and xxxEmptyClipboard().

00086 { 00087 NTSTATUS Status; 00088 00089 if ((atom >= gatomFirstPinned) && (atom <= gatomLastPinned)) 00090 return 0; // if pinned, just return 00091 00092 Status = RtlDeleteAtomFromAtomTable( UserAtomTableHandle, atom ); 00093 if (NT_SUCCESS(Status)) { 00094 return 0; 00095 } else { 00096 RIPNTERR0(Status, RIP_VERBOSE, "UserDeleteAtom: delete failed"); 00097 return atom; 00098 } 00099 }

VOID UserDereferenceObject PVOID  pobj  ) 
 

Definition at line 448 of file ex.c.

References ObDereferenceObject, and VOID().

00450 { 00451 ObDereferenceObject(pobj); 00452 }

ATOM UserFindAtom LPCWSTR  lpAtom  ) 
 

Definition at line 62 of file w32/ntuser/kernel/atom.c.

References NT_SUCCESS, NTSTATUS(), RtlLookupAtomInAtomTable(), Status, and UserAtomTableHandle.

Referenced by _GetWOWClass(), NtUserFindExistingCursorIcon(), and xxxCreateWindowEx().

00064 { 00065 NTSTATUS Status; 00066 ATOM atom; 00067 00068 /* 00069 * Rtl routines protect accesses to strings with their 00070 * own try/except blocks. 00071 */ 00072 atom = 0; 00073 Status = RtlLookupAtomInAtomTable( UserAtomTableHandle, 00074 (PWSTR)ccxlpAtom, 00075 &atom 00076 ); 00077 if (!NT_SUCCESS(Status)) { 00078 RIPNTERR0(Status, RIP_VERBOSE, "UserFindAtom: lookup failed"); 00079 } 00080 00081 return atom; 00082 }

UINT UserGetAtomName ATOM  atom,
LPWSTR  lpch,
int  cchMax
 

Definition at line 101 of file w32/ntuser/kernel/atom.c.

References NT_SUCCESS, NTSTATUS(), NULL, RtlQueryAtomInAtomTable(), Status, UINT, and UserAtomTableHandle.

Referenced by _InternalGetIconInfo(), InternalSetClipboardData(), NtUserGetClassName(), NtUserGetClipboardFormatName(), and xxxLoadHmodIndex().

00105 { 00106 NTSTATUS Status; 00107 ULONG AtomNameLength; 00108 00109 AtomNameLength = cchMax * sizeof(WCHAR); 00110 Status = RtlQueryAtomInAtomTable( UserAtomTableHandle, 00111 atom, 00112 NULL, 00113 NULL, 00114 ccxlpch, 00115 &AtomNameLength 00116 ); 00117 if (!NT_SUCCESS(Status)) { 00118 RIPNTERR0(Status, RIP_VERBOSE, "UserGetAtomName: query failed"); 00119 return 0; 00120 } else { 00121 return AtomNameLength / sizeof(WCHAR); 00122 } 00123 }

NTSTATUS UserJobCallout PKWIN32_JOBCALLOUT_PARAMETERS  Parm  ) 
 

Definition at line 26 of file job.c.

References BEGINATOMICCHECK, _WIN32_JOBCALLOUT_PARAMETERS::CalloutType, CreateW32Job(), _WIN32_JOBCALLOUT_PARAMETERS::Data, ENDATOMICCHECK, ExIsResourceAcquiredExclusiveLite(), gpJobsList, gpresUser, tagW32JOB::Job, _WIN32_JOBCALLOUT_PARAMETERS::Job, JobCalloutAddProcess(), JobCalloutTerminate(), _EJOB::JobLock, NTSTATUS(), NULL, PKWIN32_JOBCALLOUT_PARAMETERS, tagW32JOB::pNext, PsW32JobCalloutAddProcess, PsW32JobCalloutSetInformation, PsW32JobCalloutTerminate, PSW32JOBCALLOUTTYPE, tagW32JOB::restrictions, Status, _EJOB::UIRestrictionsClass, and UpdateJob().

Referenced by xxxUserProcessCallout().

00028 { 00029 NTSTATUS Status = STATUS_SUCCESS; 00030 PW32JOB pW32Job = NULL; 00031 PEJOB Job; 00032 PSW32JOBCALLOUTTYPE CalloutType; 00033 PVOID Data; 00034 00035 00036 Job = Parm->Job; 00037 CalloutType = Parm->CalloutType; 00038 Data = Parm->Data; 00039 00040 /* 00041 * The EJOB lock must be acquired at this time. 00042 */ 00043 UserAssert(ExIsResourceAcquiredExclusiveLite(&Job->JobLock)); 00044 00045 UserAssert(gpresUser != NULL); 00046 00047 BEGIN_REENTERCRIT(); 00048 00049 BEGINATOMICCHECK(); 00050 00051 /* 00052 * find the W32JOB in the global list (if any) 00053 */ 00054 pW32Job = gpJobsList; 00055 00056 while (pW32Job) { 00057 if (pW32Job->Job == Job) { 00058 break; 00059 } 00060 pW32Job = pW32Job->pNext; 00061 } 00062 00063 switch (CalloutType) { 00064 case PsW32JobCalloutSetInformation: 00065 00066 if (pW32Job == NULL) { 00067 00068 /* 00069 * The W32Job is not created yet. Assert that this is not 00070 * a call to remove UI restrictions 00071 */ 00072 UserAssert(Data != 0); 00073 00074 if ((pW32Job = CreateW32Job(Job)) == NULL) { 00075 Status = STATUS_UNSUCCESSFUL; 00076 break; 00077 } 00078 } else { 00079 00080 /* 00081 * The W32Job structure is already created. Return if 00082 * the restrictions are the same as before. 00083 */ 00084 if (PtrToUlong(Data) == pW32Job->restrictions) { 00085 TAGMSG0(DBGTAG_Job, "UserJobCallout: SetInformation same as before"); 00086 break; 00087 } 00088 } 00089 00090 /* 00091 * Set the restrictions 00092 */ 00093 pW32Job->restrictions = PtrToUlong(Data); 00094 00095 UpdateJob(pW32Job); 00096 break; 00097 00098 case PsW32JobCalloutAddProcess: 00099 00100 /* 00101 * 'Data' parameter is a pointer to W32PROCESS. So this callout 00102 * happens only for GUI processes. 00103 */ 00104 UserAssert(Job->UIRestrictionsClass != 0); 00105 00106 /* 00107 * Assert that the W32JOB structure is already created. 00108 */ 00109 UserAssert(pW32Job != NULL); 00110 00111 TAGMSG3(DBGTAG_Job, "UserJobCallout: AddProcess Job 0x%x W32Job 0x%x Process 0x%x", 00112 Job, pW32Job, (ULONG_PTR)Data); 00113 00114 /* 00115 * this callout must be only for GUI processes 00116 */ 00117 UserAssert(Data != NULL); 00118 00119 JobCalloutAddProcess(pW32Job, (PPROCESSINFO)Data); 00120 00121 break; 00122 00123 case PsW32JobCalloutTerminate: 00124 00125 TAGMSG2(DBGTAG_Job, "UserJobCallout: Terminate Job 0x%x W32Job 0x%x", 00126 Job, pW32Job); 00127 00128 if (pW32Job) { 00129 JobCalloutTerminate(pW32Job); 00130 } 00131 break; 00132 00133 default: 00134 TAGMSG2(DBGTAG_Job, "UserJobCallout: Invalid callout 0x%x Job 0x%x", 00135 CalloutType, Job); 00136 00137 Status = STATUS_NOT_IMPLEMENTED; 00138 break; 00139 } 00140 00141 ENDATOMICCHECK(); 00142 00143 END_REENTERCRIT(); 00144 00145 return Status; 00146 }

NTSTATUS UserRtlCreateAtomTable ULONG  NumberOfBuckets  ) 
 

Referenced by Win32UserInitialize().

BOOL UserSetFont PUNICODE_STRING  pProfileUserName,
LPLOGFONTW  lplf,
UINT  idFont,
HFONT *  phfont
 

Definition at line 827 of file inctlpan.c.

References BOOL, CreateFontFromWinIni(), FALSE, ghFontSys, NULL, and TRUE.

Referenced by SetIconFonts(), and xxxSetNCFonts().

00832 { 00833 HFONT hNewFont; 00834 00835 if (hNewFont = CreateFontFromWinIni(pProfileUserName, lplf, idFont)) { 00836 if (*phfont != NULL && *phfont != ghFontSys) { 00837 GreMarkDeletableFont(*phfont); 00838 GreDeleteObject(*phfont); 00839 } 00840 00841 *phfont = hNewFont; 00842 return TRUE; 00843 } 00844 return FALSE; 00845 }

VOID UserSleep DWORD  dwMilliseconds  ) 
 

Definition at line 83 of file base.c.

References FALSE, KeDelayExecutionThread(), UserMode, and VOID().

Referenced by DoBeep(), RawInputThread(), xxxAnimateCaption(), and xxxCreateDesktop().

00085 { 00086 LARGE_INTEGER TimeOut; 00087 00088 TimeOut.QuadPart = Int32x32To64( dwMilliseconds, -10000 ); 00089 KeDelayExecutionThread(UserMode, FALSE, &TimeOut); 00090 }

HRGN UserValidateCopyRgn HRGN   ) 
 

Definition at line 151 of file validate.c.

References CopyRgn, CreateEmptyRgn(), and NULL.

Referenced by xxxDWP_DoNCActivate(), and xxxSetWindowRgn().

00153 { 00154 HRGN hrgnCopy = NULL; 00155 00156 00157 if (hrgn && (GreValidateServerHandle(hrgn, RGN_TYPE))) { 00158 00159 hrgnCopy = CreateEmptyRgn(); 00160 00161 if (CopyRgn(hrgnCopy, hrgn) == ERROR) { 00162 00163 GreDeleteObject(hrgnCopy); 00164 00165 hrgnCopy = NULL; 00166 } 00167 } 00168 00169 return hrgnCopy; 00170 }

int UT_GetParentDCClipBox PWND  pwnd,
HDC  hdc,
LPRECT  lprc
 

Definition at line 1293 of file paint.c.

References CFPARENTDC, FALSE, GetRect(), GRECT_CLIENT, GRECT_CLIENTCOORDS, IntersectRect(), NULL, TestCF, and TRUE.

Referenced by xxxBeginPaint(), and xxxFillWindow().

01297 { 01298 RECT rc; 01299 01300 if (GreGetClipBox(hdc, lprc, TRUE) == NULLREGION) 01301 return FALSE; 01302 01303 if ((pwnd == NULL) || !TestCF(pwnd, CFPARENTDC)) 01304 return TRUE; 01305 01306 GetRect(pwnd, &rc, GRECT_CLIENT | GRECT_CLIENTCOORDS); 01307 01308 return IntersectRect(lprc, lprc, &rc); 01309 }

BOOL ValidateHandleSecure HANDLE  h  ) 
 

Definition at line 321 of file validate.c.

References BeginTypeValidateHandleMacro, BOOL, CheckCritInShared, EndTypeValidateHandleMacro, EndValidateHandleMacro, FALSE, IsHandleEntrySecure(), StartValidateHandleMacro, TRUE, and TYPE_GENERIC.

Referenced by NtUserValidateHandleSecure().

00323 { 00324 PVOID pobj; 00325 00326 CheckCritInShared(); 00327 00328 StartValidateHandleMacro(h) 00329 BeginTypeValidateHandleMacro(pobj, TYPE_GENERIC) 00330 00331 if (IsHandleEntrySecure(h, phe)) { 00332 return TRUE; 00333 } 00334 00335 EndTypeValidateHandleMacro 00336 EndValidateHandleMacro 00337 00338 return FALSE; 00339 }

NTSTATUS ValidateHdesk HDESK  ,
KPROCESSOR_MODE  ,
ACCESS_MASK  ,
PDESKTOP
 

Definition at line 92 of file validate.c.

References DF_DESKWNDDESTROYED, DF_DESTROYED, DF_DYING, Error, ExDesktopObjectType, gSessionId, LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PtiCurrent, Status, and TRUE.

Referenced by NtUserBuildHwndList(), NtUserSetThreadDesktop(), and NtUserSwitchDesktop().

00097 { 00098 NTSTATUS Status; 00099 00100 Status = ObReferenceObjectByHandle( 00101 hdesk, 00102 amDesired, 00103 *ExDesktopObjectType, 00104 AccessMode, 00105 ppdesk, 00106 NULL); 00107 00108 if (NT_SUCCESS(Status)) { 00109 00110 if ((*ppdesk)->dwSessionId != gSessionId) { 00111 00112 RIPNTERR3(STATUS_INVALID_HANDLE, RIP_WARNING, 00113 "SessionId %d. Wrong session id %d for pdesk %#p", 00114 gSessionId, (*ppdesk)->dwSessionId, *ppdesk); 00115 00116 goto Error; 00117 } 00118 00119 LogDesktop(*ppdesk, LDL_VALIDATE_HDESK, TRUE, (ULONG_PTR)PtiCurrent()); 00120 00121 if ((*ppdesk)->dwDTFlags & (DF_DESTROYED | DF_DESKWNDDESTROYED | DF_DYING)) { 00122 RIPNTERR1(STATUS_INVALID_HANDLE, RIP_ERROR, 00123 "ValidateHdesk: destroyed desktop %#p", 00124 *ppdesk); 00125 Error: 00126 ObDereferenceObject(*ppdesk); 00127 #if DBG 00128 *ppdesk = NULL; 00129 #endif // DBG 00130 00131 return STATUS_INVALID_HANDLE; 00132 } 00133 } else { 00134 RIPNTERR1(Status, RIP_VERBOSE, "ValidateHdesk failed for %#p", hdesk); 00135 } 00136 00137 return Status; 00138 }

PMENU ValidateHmenu HMENU  hmenu  ) 
 

Definition at line 181 of file validate.c.

References tagMENU::head, HMValidateHandle(), NULL, PtiCurrentShared, tagTHREADINFO::rpdesk, and TYPE_MENU.

Referenced by xxxMenuWindowProc(), xxxSetLPITEMInfo(), and xxxSetWindowData().

00183 { 00184 PTHREADINFO pti = PtiCurrentShared(); 00185 PMENU pmenuRet; 00186 00187 pmenuRet = (PMENU)HMValidateHandle(hmenu, TYPE_MENU); 00188 00189 if (pmenuRet != NULL && 00190 ((pti->rpdesk != NULL && // hack so console initialization works. 00191 pmenuRet->head.rpdesk != pti->rpdesk))) { 00192 RIPERR1(ERROR_INVALID_MENU_HANDLE, RIP_WARNING, "Invalid menu handle (%#p)", hmenu); 00193 return NULL; 00194 } 00195 00196 return pmenuRet; 00197 }

PMONITOR ValidateHmonitor HMONITOR  hmonitor  ) 
 

Definition at line 210 of file validate.c.

References HMValidateSharedHandle(), and TYPE_MONITOR.

Referenced by GetHDevName(), xxxCreateThreadInfo(), and xxxCreateWindowEx().

00212 { 00213 return (PMONITOR)HMValidateSharedHandle(hmonitor, TYPE_MONITOR); 00214 }

NTSTATUS ValidateHwinsta HWINSTA  ,
KPROCESSOR_MODE  ,
ACCESS_MASK  ,
PWINDOWSTATION
 

Definition at line 46 of file validate.c.

References ExWindowStationObjectType, gSessionId, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), and Status.

Referenced by NtUserBuildNameList(), NtUserCloseWindowStation(), NtUserLockWindowStation(), NtUserSetWindowStationUser(), and NtUserUnlockWindowStation().

00051 { 00052 NTSTATUS Status; 00053 00054 Status = ObReferenceObjectByHandle( 00055 hwinsta, 00056 amDesired, 00057 *ExWindowStationObjectType, 00058 AccessMode, 00059 ppwinsta, 00060 NULL); 00061 00062 if (!NT_SUCCESS(Status)) { 00063 RIPNTERR1(Status, RIP_VERBOSE, "ValidateHwinsta failed for %#p", hwinsta); 00064 00065 } else if ((*ppwinsta)->dwSessionId != gSessionId) { 00066 00067 RIPNTERR3(STATUS_INVALID_HANDLE, RIP_WARNING, 00068 "SessionId %d. Wrong session id %d for pwinsta %#p", 00069 gSessionId, (*ppwinsta)->dwSessionId, *ppwinsta); 00070 00071 ObDereferenceObject(*ppwinsta); 00072 #if DBG 00073 *ppwinsta = NULL; 00074 #endif // DBG 00075 00076 return STATUS_INVALID_HANDLE; 00077 } 00078 00079 return Status; 00080 }

PWND FASTCALL ValidateHwnd HWND  hwnd  ) 
 

Definition at line 28 of file client/wow.c.

References _CLIENTINFO::CallbackWnd, EndValidateHandleMacro, FASTCALL, GetClientInfo, GetDesktopView(), GETPTI, HANDLEF_DESTROY, tagWND::head, HMValidateHandle(), _CALLBACKWND::hwnd, IS_THREAD_RESTRICTED, IsHandleEntrySecure(), NULL, tagTHREADINFO::ppi, PtiCurrentShared, _CALLBACKWND::pwnd, tagTHREADINFO::rpdesk, StartValidateHandleMacro, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, and TYPE_WINDOW.

00030 { 00031 PCLIENTINFO pci = GetClientInfo(); 00032 00033 /* 00034 * Attempt fast window validation 00035 */ 00036 if (hwnd != NULL && hwnd == pci->CallbackWnd.hwnd) { 00037 return pci->CallbackWnd.pwnd; 00038 } 00039 00040 /* 00041 * Validate the handle is of the proper type. 00042 */ 00043 return HMValidateHandle(hwnd, TYPE_WINDOW); 00044 }

BOOL ValidateOwnerDepth PWND  pwnd,
PWND  pwndOwner
 

Definition at line 1265 of file kernel/winmgr.c.

References BOOL, FALSE, NESTED_WINDOW_LIMIT, NULL, tagWND::spwndOwner, and UINT.

Referenced by xxxCreateWindowEx(), and xxxSetWindowData().

01266 { 01267 UINT cDepth = 1; 01268 01269 while (pwndOwner != NULL) { 01270 01271 /* 01272 * Do not allow loops in the owner chain. 01273 */ 01274 if (pwndOwner == pwnd) { 01275 return FALSE; 01276 } 01277 01278 pwndOwner = pwndOwner->spwndOwner; 01279 cDepth++; 01280 } 01281 01282 return (cDepth <= NESTED_WINDOW_LIMIT); 01283 }

BOOL ValidateParentDepth PWND  pwnd,
PWND  pwndParent
 

Definition at line 1197 of file kernel/winmgr.c.

References BOOL, NESTED_WINDOW_LIMIT, NULL, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndParent, and UINT.

Referenced by xxxCreateWindowEx(), and xxxSetParent().

01198 { 01199 UINT cDepth = 1, cDepthMax; 01200 PWND pwndStop; 01201 01202 /* 01203 * Calculate the depth of the parent chain. 01204 */ 01205 while (pwndParent != NULL) { 01206 pwndParent = pwndParent->spwndParent; 01207 cDepth++; 01208 } 01209 01210 cDepthMax = cDepth; 01211 01212 /* 01213 * When pwnd is NULL, it means that we want to add one more 01214 * level to the existing depth of pwndParent. 01215 */ 01216 if (pwnd == NULL || pwnd->spwndChild == NULL) { 01217 goto Exit; 01218 } else { 01219 pwndStop = pwnd->spwndParent; 01220 } 01221 01222 Restart: 01223 if (pwnd->spwndChild != NULL) { 01224 pwnd = pwnd->spwndChild; 01225 cDepth++; 01226 } else if (pwnd->spwndNext != NULL) { 01227 pwnd = pwnd->spwndNext; 01228 } else { 01229 if (cDepth > cDepthMax) { 01230 cDepthMax = cDepth; 01231 } 01232 01233 /* 01234 * Find a parent with siblings and recurse on them. Terminate 01235 * when we reach the parent of the original pwnd. 01236 */ 01237 do { 01238 pwnd = pwnd->spwndParent; 01239 cDepth--; 01240 01241 if (pwnd == pwndStop) 01242 goto Exit; 01243 01244 } while (pwnd->spwndNext == NULL); 01245 01246 pwnd = pwnd->spwndNext; 01247 } 01248 goto Restart; 01249 01250 Exit: 01251 return (cDepthMax <= NESTED_WINDOW_LIMIT); 01252 }

BYTE VKFromVSC PKE  pke,
BYTE  bPrefix,
LPBYTE  afKeyState
 

Definition at line 73 of file xlate.c.

References BOOL, BYTE, CheckCritIn, FALSE, gafRawKeyState, gapulCvt_VK, GetActiveHKL(), GetModificationNumber(), GetModifierBits(), gpKbdTbl, gpModifiers_VK, gptiForeground, IS_IME_ENABLED, LOBYTE, NULL, tagKBDFILE::pKbdTbl, tagKL::spkf, tagTHREADINFO::spklActive, TRUE, and USHORT.

Referenced by ProcessKeyboardInput(), and xxxInternalKeyEventDirect().

00078 { 00079 USHORT usVKey; 00080 PVSC_VK pVscVk; 00081 PKBDTABLES pKbdTbl; 00082 static BOOL fVkPause; 00083 00084 CheckCritIn(); 00085 DBG_UNREFERENCED_PARAMETER(afKeyState); 00086 00087 /* 00088 * Initialize as an unknown VK (unrecognised scancode) 00089 */ 00090 pke->usFlaggedVk = usVKey = 0xFF; 00091 00092 /* HACK ALERT 00093 * For Korean 103 keyboard: 00094 * Check this is Korean keyboard layout or not. 00095 */ 00096 if (IS_IME_ENABLED() && 00097 KOREAN_KBD_LAYOUT(GetActiveHKL())) { 00098 if ((pke->bScanCode == 0x71) || (pke->bScanCode == 0x72)) { 00099 pke->bScanCode |= 0x80; 00100 bPrefix = 0xE0; 00101 } else { 00102 pke->bScanCode &= 0x7F; 00103 } 00104 } else { 00105 pke->bScanCode &= 0x7F; 00106 } 00107 00108 if (gptiForeground == NULL) { 00109 RIPMSG0(RIP_VERBOSE, "VKFromVSC: NULL gptiForeground\n"); 00110 pKbdTbl = gpKbdTbl; 00111 } else { 00112 if (gptiForeground->spklActive) { 00113 pKbdTbl = gptiForeground->spklActive->spkf->pKbdTbl; 00114 } else { 00115 RIPMSG0(RIP_VERBOSE, "VKFromVSC: NULL spklActive\n"); 00116 pKbdTbl = gpKbdTbl; 00117 } 00118 } 00119 if (bPrefix == 0) { 00120 if (pke->bScanCode < pKbdTbl->bMaxVSCtoVK) { 00121 /* 00122 * direct index into non-prefix table 00123 */ 00124 usVKey = pKbdTbl->pusVSCtoVK[pke->bScanCode]; 00125 if (usVKey == 0) { 00126 return 0xFF; 00127 } 00128 } else { 00129 /* 00130 * unexpected scancode 00131 */ 00132 RIPMSG2(RIP_VERBOSE, "unrecognized scancode 0x%x, prefix %x", 00133 pke->bScanCode, bPrefix); 00134 return 0xFF; 00135 } 00136 } else { 00137 /* 00138 * Scan the E0 or E1 prefix table for a match 00139 */ 00140 if (bPrefix == 0xE0) { 00141 /* 00142 * Set the KBDEXT (extended key) bit in case the scancode is not 00143 * found in the table (eg: FUJITSU POS keyboard #65436) 00144 */ 00145 usVKey |= KBDEXT; 00146 /* 00147 * Ignore the SHIFT keystrokes generated by the hardware 00148 */ 00149 if ((pke->bScanCode == SCANCODE_LSHIFT) || 00150 (pke->bScanCode == SCANCODE_RSHIFT)) { 00151 return 0; 00152 } 00153 pVscVk = pKbdTbl->pVSCtoVK_E0; 00154 } else if (bPrefix == 0xE1) { 00155 pVscVk = pKbdTbl->pVSCtoVK_E1; 00156 } else { 00157 /* 00158 * Unrecognized prefix (from ScancodeMap?) produces an 00159 * unextended and unrecognized VK. 00160 */ 00161 return 0xFF; 00162 } 00163 while (pVscVk->Vk) { 00164 if (pVscVk->Vsc == pke->bScanCode) { 00165 usVKey = pVscVk->Vk; 00166 break; 00167 } 00168 pVscVk++; 00169 } 00170 } 00171 00172 /* 00173 * Scancode set 1 returns PAUSE button as E1 1D 45 (E1 Ctrl NumLock) 00174 * so convert E1 Ctrl to VK_PAUSE, and remember to discard the NumLock 00175 */ 00176 if (fVkPause) { 00177 /* 00178 * This is the "45" part of the Pause scancode sequence. 00179 * Discard this key event: it is a false NumLock 00180 */ 00181 fVkPause = FALSE; 00182 return 0; 00183 } 00184 if (usVKey == VK_PAUSE) { 00185 /* 00186 * This is the "E1 1D" part of the Pause scancode sequence. 00187 * Alter the scancode to the value Windows expects for Pause, 00188 * and remember to discard the "45" scancode that will follow 00189 */ 00190 pke->bScanCode = 0x45; 00191 fVkPause = TRUE; 00192 } 00193 00194 /* 00195 * Convert to a different VK if some modifier keys are depressed. 00196 */ 00197 if (usVKey & KBDMULTIVK) { 00198 WORD nMod; 00199 PULONG pul; 00200 00201 nMod = GetModificationNumber( 00202 gpModifiers_VK, 00203 GetModifierBits(gpModifiers_VK, gafRawKeyState)); 00204 00205 /* 00206 * Scan gapulCvt_VK[nMod] for matching VK. 00207 */ 00208 if ((nMod != SHFT_INVALID) && ((pul = gapulCvt_VK[nMod]) != NULL)) { 00209 while (*pul != 0) { 00210 if (LOBYTE(*pul) == LOBYTE(usVKey)) { 00211 pke->usFlaggedVk = (USHORT)HIWORD(*pul); 00212 return (BYTE)pke->usFlaggedVk; 00213 } 00214 pul++; 00215 } 00216 } 00217 } 00218 00219 pke->usFlaggedVk = usVKey; 00220 return (BYTE)usVKey; 00221 }

BOOL VWPLAdd PVWPL ppvwpl,
PWND  pwnd,
DWORD  dwThreshold
 

Definition at line 3916 of file rare.c.

References BOOL, DbgCheckVWPL, DWORD, FALSE, NULL, PVWPL, PWND, and TRUE.

Referenced by _RegisterShellHookWindow(), and SetHungFlag().

03920 { 03921 PVWPL pvwpl; 03922 DWORD ixPwnd; 03923 03924 TAGMSG2(DBGTAG_VWPL, "VWPL %#p + %#p", *ppvwpl, pwnd); 03925 UserAssert(pwnd); 03926 03927 if (*ppvwpl == NULL) { 03928 /* 03929 * Initialize the VWPL 03930 */ 03931 UserAssert(dwThreshhold >= 2); // could be 1, but that would be silly 03932 pvwpl = (PVWPL)UserAllocPool( 03933 sizeof(VWPL) + (sizeof(PWND) * dwThreshhold), TAG_VWPL); 03934 if (pvwpl == NULL) { 03935 RIPMSG1(RIP_WARNING, 03936 "VWPLAdd fail to allocate initial %lx", 03937 sizeof(VWPL) + (sizeof(PWND) * dwThreshhold)); 03938 DbgCheckVWPL(*ppvwpl); 03939 return FALSE; 03940 } 03941 pvwpl->cElem = dwThreshhold; 03942 pvwpl->cThreshhold = dwThreshhold; 03943 #if ZERO_INIT_VWPL 03944 RtlZeroMemory(&(pvwpl->aPwnd[0]), (sizeof(PWND) * dwThreshhold)); 03945 #endif 03946 pvwpl->cPwnd = 0; 03947 *ppvwpl = pvwpl; 03948 ixPwnd = 0; 03949 goto AddPwnd; 03950 } else { 03951 pvwpl = *ppvwpl; 03952 for (ixPwnd = 0; ixPwnd < pvwpl->cElem; ixPwnd++) { 03953 if (pwnd == pvwpl->aPwnd[ixPwnd]) { 03954 DbgCheckVWPL(*ppvwpl); 03955 return FALSE; // callers require FALSE this case 03956 } 03957 } 03958 03959 if (pvwpl->cPwnd >= pvwpl->cElem ) { 03960 /* 03961 * didn't find it already there, and no space so grow the VWPL 03962 */ 03963 DWORD dwSize; 03964 DWORD dwSizeNew; 03965 03966 dwSize = sizeof(VWPL) + (sizeof(PWND) * pvwpl->cElem); 03967 dwSizeNew = dwSize + (sizeof(PWND) * pvwpl->cThreshhold); 03968 pvwpl = (PVWPL)UserReAllocPool(pvwpl, dwSize, dwSizeNew, TAG_VWPL); 03969 if (pvwpl == NULL) { 03970 RIPMSG2(RIP_WARNING, 03971 "VWPLAdd fail to reallocate %lx to %lx", dwSize, dwSizeNew); 03972 DbgCheckVWPL(*ppvwpl); 03973 return FALSE; 03974 } 03975 #if ZERO_INIT_VWPL 03976 RtlZeroMemory(&(pvwpl->aPwnd[pvwpl->cPwnd]), (sizeof(PWND) * dwThreshhold)); 03977 #endif 03978 pvwpl->cElem += pvwpl->cThreshhold; 03979 *ppvwpl = pvwpl; 03980 } 03981 } 03982 03983 AddPwnd: 03984 ixPwnd = pvwpl->cPwnd; 03985 pvwpl->aPwnd[ixPwnd] = pwnd; 03986 pvwpl->cPwnd++; 03987 DbgCheckVWPL(*ppvwpl); 03988 return TRUE; 03989 }

PWND VWPLNext PVWPL  pvwpl,
PWND  pwndPrev,
DWORD pnPrev
 

Definition at line 4083 of file rare.c.

References DbgCheckVWPL, and NULL.

Referenced by PostShellHookMessages(), xxxHungAppDemon(), and xxxSendMinRectMessages().

04084 { 04085 DbgCheckVWPL(pvwpl); 04086 04087 if (!pvwpl) { 04088 TAGMSG1(DBGTAG_VWPL, "VWPL %#p => NULL (empty)", pvwpl); 04089 return NULL; 04090 } 04091 04092 if (*pnPrev >= pvwpl->cPwnd) { 04093 goto NoMorePwnds; 04094 } 04095 04096 /* 04097 * If our previous pwnd is still there, advance to the next slot 04098 * (else it has gone, so return the one now occupying its slot) 04099 */ 04100 if (pvwpl->aPwnd[*pnPrev] == pwndPrev) { 04101 (*pnPrev)++; 04102 } 04103 04104 if (*pnPrev < pvwpl->cPwnd) { 04105 UserAssert(pvwpl->aPwnd[*pnPrev] != pwndPrev); 04106 TAGMSG2(DBGTAG_VWPL, "VWPL %#p => %#p", pvwpl, pvwpl->aPwnd[*pnPrev]); 04107 return pvwpl->aPwnd[*pnPrev]; 04108 } 04109 04110 /* 04111 * We came to the end 04112 */ 04113 NoMorePwnds: 04114 TAGMSG1(DBGTAG_VWPL, "VWPL %#p => NULL (end)", pvwpl); 04115 *pnPrev = 0; 04116 return NULL; 04117 }

BOOL VWPLRemove PVWPL ppvwpl,
PWND  pwnd
 

Definition at line 4002 of file rare.c.

References BOOL, DbgCheckVWPL, DWORD, FALSE, NULL, PVWPL, and TRUE.

Referenced by _DeregisterShellHookWindow(), and ClearHungFlag().

04005 { 04006 PVWPL pvwpl = *ppvwpl; 04007 DWORD ixPwnd; 04008 04009 TAGMSG2(DBGTAG_VWPL, "VWPL %#p - %#p", *ppvwpl, pwnd); 04010 UserAssert(pwnd); 04011 04012 if (!pvwpl) { 04013 return FALSE; 04014 } 04015 for (ixPwnd = 0; ixPwnd < pvwpl->cElem; ixPwnd++) { 04016 if (pwnd == pvwpl->aPwnd[ixPwnd]) { 04017 goto PwndIsFound; 04018 } 04019 } 04020 DbgCheckVWPL(*ppvwpl); 04021 return FALSE; 04022 04023 PwndIsFound: 04024 pvwpl->aPwnd[ixPwnd] = NULL; 04025 pvwpl->cPwnd--; 04026 04027 if (pvwpl->cPwnd == 0) { 04028 UserFreePool(pvwpl); 04029 *ppvwpl = NULL; 04030 return TRUE; 04031 } 04032 04033 /* 04034 * Compact the VWPL to keep all the empty slots at the end. 04035 * If these free slots exceeds the threshhold, realloc to shrink. 04036 * It doesn't matter that we change the order. 04037 */ 04038 pvwpl->aPwnd[ixPwnd] = pvwpl->aPwnd[pvwpl->cPwnd]; 04039 #if ZERO_INIT_VWPL 04040 pvwpl->aPwnd[pvwpl->cPwnd] = NULL; 04041 #endif 04042 04043 04044 if ((pvwpl->cElem - pvwpl->cPwnd) >= pvwpl->cThreshhold) { 04045 DWORD dwSize; 04046 DWORD dwSizeNew; 04047 04048 // Low memory may have made a shrinking realloc fail, which doesn't 04049 // really bother us. 04050 // UserAssert((pvwpl->cElem - pvwpl->cPwnd) == pvwpl->cThreshhold); 04051 04052 dwSize = sizeof(VWPL) + (sizeof(PWND) * pvwpl->cElem); 04053 dwSizeNew = sizeof(VWPL) + (sizeof(PWND) * pvwpl->cPwnd); 04054 pvwpl = (PVWPL)UserReAllocPool(pvwpl, dwSize, dwSizeNew, TAG_VWPL); 04055 if (pvwpl == NULL) { 04056 RIPMSG2(RIP_WARNING, 04057 "VWPLRemove fail to reallocate %lx to %lx", 04058 dwSize, dwSizeNew); 04059 DbgCheckVWPL(*ppvwpl); 04060 return TRUE; 04061 } 04062 pvwpl->cElem = pvwpl->cPwnd; 04063 *ppvwpl = pvwpl; 04064 } 04065 04066 DbgCheckVWPL(*ppvwpl); 04067 return TRUE; 04068 }

DWORD WaitOnPseudoEvent HANDLE *  phE,
DWORD  dwMilliseconds
 

Definition at line 5671 of file queue.c.

References CheckCritIn, DWORD, ExEventObjectType, FALSE, KernelMode, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), PSEUDO_EVENT_OFF, PSEUDO_EVENT_ON, and Status.

Referenced by xxxWaitForInputIdle().

05674 { 05675 HANDLE hEvent; 05676 NTSTATUS Status; 05677 05678 CheckCritIn(); 05679 if (*phE == PSEUDO_EVENT_OFF) { 05680 if (!NT_SUCCESS(ZwCreateEvent(&hEvent, EVENT_ALL_ACCESS, NULL, 05681 NotificationEvent, FALSE))) { 05682 UserAssert(!"Could not create event on the fly."); 05683 if (dwMilliseconds != INFINITE) { 05684 return STATUS_TIMEOUT; 05685 } else { 05686 return (DWORD)-1; 05687 } 05688 } 05689 Status = ObReferenceObjectByHandle(hEvent, EVENT_ALL_ACCESS, *ExEventObjectType, 05690 KernelMode, phE, NULL); 05691 ZwClose(hEvent); 05692 if (!NT_SUCCESS(Status)) 05693 return (DWORD)-1; 05694 } else if (*phE == PSEUDO_EVENT_ON) { 05695 return STATUS_WAIT_0; 05696 } 05697 return(STATUS_ABANDONED); 05698 }

VOID WakeSomeone PQ  pq,
UINT  message,
PQMSG  pqmsg
 

Definition at line 1664 of file ntuser/kernel/input.c.

References BOOL, CancelForegroundActivate(), FALSE, GETPTI, glinp, tagQMSG::msg, NULL, tagQ::ptiKeyboard, tagLASTINPUT::ptiLastWoken, tagQ::ptiMouse, SetWakeBit(), tagQ::spwndActive, tagQ::spwndCapture, StoreQMessagePti(), TestKeyStateDown, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, and TRUE.

Referenced by JournalTimer(), PostInputMessage(), xxxGetNextSysMsg(), xxxKeyEvent(), and zzzSetFMouseMoved().

01668 { 01669 BOOL fSetLastWoken = FALSE; 01670 PTHREADINFO ptiT; 01671 01672 /* 01673 * Set the appropriate wakebits for this queue. 01674 */ 01675 ptiT = NULL; 01676 switch (message) { 01677 01678 case WM_SYSKEYDOWN: 01679 case WM_KEYDOWN: 01680 /* 01681 * Don't change input ownership if the user is holding down 01682 * a modifier key. When doing a ctrl-drag operation for example, 01683 * the ctrl key must be down when the user drops the object (ie, mouse up). 01684 * On mouse up the RIT gives input ownership to the target; but since 01685 * ctrl is down, on the next repeat key we used to give input ownership 01686 * to the focus window (usually the drag source). Hence the target 01687 * would lose owenerhip and couldn't take the foreground. 01688 */ 01689 if (pqmsg != NULL) { 01690 switch (pqmsg->msg.wParam) { 01691 case VK_SHIFT: 01692 case VK_CONTROL: 01693 case VK_MENU: 01694 if (TestKeyStateDown(pq, pqmsg->msg.wParam)) { 01695 break; 01696 } 01697 /* Fall through */ 01698 01699 default: 01700 fSetLastWoken = TRUE; 01701 break; 01702 } 01703 } else { 01704 fSetLastWoken = TRUE; 01705 } 01706 /* fall through */ 01707 01708 case WM_SYSCHAR: 01709 case WM_CHAR: 01710 /* Freelance graphics seems to pass in WM_SYSCHARs and WM_CHARs into 01711 * the journal playback hook, so we need to set an input bit for 01712 * this case since that is what win3.1 does. VB2 "learning" demo does 01713 * the same, as does Excel intro. 01714 * 01715 * On win3.1, the WM_CHAR would by default set the QS_MOUSEBUTTON bit. 01716 * On NT, the WM_CHAR sets the QS_KEY bit. This is because 01717 * ScanSysQueue() calls TransferWakeBit() with the QS_KEY bit when 01718 * a WM_CHAR message is passed in. By using the QS_KEY bit on NT, 01719 * we're more compatible with what win3.1 wants to be. 01720 * 01721 * This fixes a case where the mouse was over progman, the WM_CHAR 01722 * would come in via journal playback, wakesomeone would be called, 01723 * and set the mouse bit in progman. Progman would then get into 01724 * ScanSysQueue(), callback the journal playback hook, get the WM_CHAR, 01725 * and do it again, looping. This caught VB2 in a loop. 01726 */ 01727 01728 CancelForegroundActivate(); 01729 01730 /* fall through */ 01731 01732 case WM_KEYUP: 01733 case WM_SYSKEYUP: 01734 case WM_MOUSEWHEEL: 01735 /* 01736 * Win3.1 first looks at what thread has the active status. This 01737 * means that we don't depend on the thread owning ptiKeyboard 01738 * to wake up and process this key in order to give it to the 01739 * active window, which is potentially newly active. Case in 01740 * point: excel bringing up CBT, cbt has an error, brings up 01741 * a message box: since excel is filtering for CBT messages only, 01742 * ptiKeyboard never gets reassigned to CBT so CBT doesn't get 01743 * any key messages and appears hung. 01744 */ 01745 ptiT = pq->ptiKeyboard; 01746 if (pq->spwndActive != NULL) 01747 ptiT = GETPTI(pq->spwndActive); 01748 01749 SetWakeBit(ptiT, message == WM_MOUSEWHEEL ? QS_MOUSEBUTTON : QS_KEY); 01750 break; 01751 01752 case WM_MOUSEMOVE: 01753 /* 01754 * Make sure we wake up the thread with the capture, if there is 01755 * one. This fixes PC Tools screen capture program, which sets 01756 * capture and then loops trying to remove messages from the 01757 * queue. 01758 */ 01759 if (pq->spwndCapture != NULL) 01760 ptiT = GETPTI(pq->spwndCapture); 01761 else 01762 ptiT = pq->ptiMouse; 01763 SetWakeBit(ptiT, QS_MOUSEMOVE); 01764 break; 01765 01766 01767 case WM_LBUTTONDOWN: 01768 case WM_LBUTTONDBLCLK: 01769 case WM_RBUTTONDOWN: 01770 case WM_RBUTTONDBLCLK: 01771 case WM_MBUTTONDOWN: 01772 case WM_MBUTTONDBLCLK: 01773 case WM_XBUTTONDOWN: 01774 case WM_XBUTTONDBLCLK: 01775 fSetLastWoken = TRUE; 01776 01777 /* fall through */ 01778 01779 default: 01780 /* 01781 * The default case in Win3.1 for this is QS_MOUSEBUTTON. 01782 */ 01783 01784 CancelForegroundActivate(); 01785 01786 /* fall through */ 01787 01788 case WM_LBUTTONUP: 01789 case WM_RBUTTONUP: 01790 case WM_MBUTTONUP: 01791 case WM_XBUTTONUP: 01792 /* 01793 * Make sure we wake up the thread with the capture, if there is 01794 * one. This fixes PC Tools screen capture program, which sets 01795 * capture and then loops trying to remove messages from the 01796 * queue. 01797 */ 01798 if (pq->spwndCapture != NULL && 01799 message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) 01800 ptiT = GETPTI(pq->spwndCapture); 01801 else 01802 ptiT = pq->ptiMouse; 01803 SetWakeBit(ptiT, QS_MOUSEBUTTON); 01804 break; 01805 } 01806 01807 /* 01808 * If a messaged was passed in, remember in it who we woke up for this 01809 * message. We do this so each message is ownership marked. This way 01810 * we can merge/unmerge message streams when zzzAttachThreadInput() is 01811 * called. 01812 */ 01813 if (ptiT != NULL) { 01814 if (pqmsg != NULL) { 01815 01816 StoreQMessagePti(pqmsg, ptiT); 01817 01818 UserAssert(!(ptiT->TIF_flags & TIF_INCLEANUP)); 01819 } 01820 01821 /* 01822 * Remember who got the last key/click down. 01823 */ 01824 if (fSetLastWoken) { 01825 glinp.ptiLastWoken = ptiT; 01826 } 01827 } 01828 01829 }

VOID WakeWowTask PTHREADINFO  Pti  ) 
 

Definition at line 30 of file taskman.c.

References EVENT_INCREMENT, FALSE, KeSetEvent(), tagTHREADINFO::pEventQueueServer, tagTHREADINFO::ppi, tagWOWPROCESSINFO::ptiScheduled, and tagPROCESSINFO::pwpi.

Referenced by DirectedScheduleTask(), and SetWakeBit().

00033 { 00034 PWOWPROCESSINFO pwpi; 00035 00036 pwpi = pti->ppi->pwpi; 00037 if (pwpi && !pwpi->ptiScheduled) { 00038 KeSetEvent(pti->pEventQueueServer, EVENT_INCREMENT, FALSE); 00039 } 00040 }

PWND WindowFromCacheDC HDC  hdc  ) 
 

Definition at line 1574 of file dc.c.

References tagDCE::DCX_flags, gpDispInfo, tagDCE::hdc, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, and tagDCE::pwndOrg.

Referenced by _SelectPalette(), and xxxRealizePalette().

01576 { 01577 PDCE pdce; 01578 for (pdce = gpDispInfo->pdceFirst; pdce; pdce = pdce->pdceNext) { 01579 01580 if (pdce->hdc == hdc) 01581 return (pdce->DCX_flags & DCX_DESTROYTHIS) ? NULL : pdce->pwndOrg; 01582 } 01583 01584 return NULL; 01585 }

void WPUpdateCheckPointSettings PWND  pwnd,
UINT  uWPFlags
 

Definition at line 884 of file kernel/winmgr.c.

References FALSE, tagCHECKPOINT::fDragged, tagCHECKPOINT::fWasMaximizedBeforeMinimized, TestWF, TRUE, UpdateCheckpoint(), and WFMINIMIZED.

Referenced by xxxProcessEventMessage(), and xxxSetWindowPlacement().

00885 { 00886 CHECKPOINT * pcp; 00887 00888 UserAssert(TestWF(pwnd, WFMINIMIZED)); 00889 if (pcp = UpdateCheckpoint(pwnd)) { 00890 00891 /* 00892 * Save settings in the checkpoint struct 00893 */ 00894 if (uWPFlags & WPF_SETMINPOSITION) 00895 pcp->fDragged = TRUE; 00896 00897 if (uWPFlags & WPF_RESTORETOMAXIMIZED) { 00898 pcp->fWasMaximizedBeforeMinimized = TRUE; 00899 } else { 00900 pcp->fWasMaximizedBeforeMinimized = FALSE; 00901 } 00902 } 00903 }

BOOL xxxActivateApp PWND  pwnd,
AAS paas
 

Definition at line 336 of file focusact.c.

References BOOL, CheckLock, tagAAS::fActivating, tagAAS::fQueueNotify, GETPTI, tagAAS::ptiNotify, QueueNotifyMessage(), tagAAS::tidActDeact, TRUE, and xxxSendMessage().

Referenced by CancelInputState(), xxxActivateThisWindow(), and xxxDeactivate().

00339 { 00340 CheckLock(pwnd); 00341 00342 if (GETPTI(pwnd) == paas->ptiNotify) { 00343 00344 if (paas->fQueueNotify) { 00345 QueueNotifyMessage(pwnd, WM_ACTIVATEAPP, paas->fActivating, 00346 paas->tidActDeact); 00347 } else { 00348 xxxSendMessage(pwnd, WM_ACTIVATEAPP, paas->fActivating, 00349 paas->tidActDeact); 00350 } 00351 } 00352 00353 return TRUE; 00354 }

BOOL xxxActivateDebugger UINT  fsModifiers  ) 
 

Definition at line 32 of file w32/ntuser/kernel/debug.c.

References _USER_API_MSG::ApiNumber, BOOL, _USER_API_MSG::CaptureBuffer, _ACTIVATEDEBUGGERMSG::ClientId, CsrApiPort, _EPROCESS::DebugPort, EnterCrit, FALSE, gpepCSRSS, gpqForeground, _USER_API_MSG::h, LeaveCrit, LockProcessByClientId(), LpcRequestPort(), NT_SUCCESS, NTSTATUS(), NULL, tagQ::ptiKeyboard, Status, TRUE, _USER_API_MSG::u, _EPROCESS::UniqueProcessId, UnlockProcess, and UserpActivateDebugger.

Referenced by xxxDoHotKeyStuff().

00034 { 00035 ULONG ArgLength; 00036 USER_API_MSG m; 00037 PACTIVATEDEBUGGERMSG a = &m.u.ActivateDebugger; 00038 PEPROCESS Process; 00039 HANDLE hDebugPort; 00040 NTSTATUS Status; 00041 if (fsModifiers & MOD_CONTROL) { 00042 #if DBG 00043 if (RipOutput(0, RIP_WARNING, "User debugger", 0, "Debug prompt", NULL)) { 00044 DbgBreakPoint(); 00045 } 00046 #endif 00047 return FALSE; 00048 } else if (fsModifiers & MOD_SHIFT) { 00049 00050 /* 00051 * Bail out if the process is not being debugged. 00052 */ 00053 if (gpepCSRSS->DebugPort == NULL) 00054 return FALSE; 00055 00056 a->ClientId.UniqueProcess = gpepCSRSS->UniqueProcessId; 00057 } else { 00058 00059 if ((gpqForeground == NULL) || (gpqForeground->ptiKeyboard == NULL)) 00060 return FALSE; 00061 00062 a->ClientId = gpqForeground->ptiKeyboard->pEThread->Cid; 00063 00064 LeaveCrit(); 00065 Status = LockProcessByClientId(a->ClientId.UniqueProcess, &Process); 00066 EnterCrit(); 00067 00068 /* 00069 * Bail out if the process is not being debugged or the process id 00070 * is invalid. 00071 */ 00072 if (!NT_SUCCESS(Status)) 00073 return FALSE; 00074 00075 hDebugPort = Process->DebugPort; 00076 UnlockProcess(Process); 00077 00078 if (hDebugPort == NULL) 00079 return FALSE; 00080 } 00081 00082 /* 00083 * Send the datagram to CSR 00084 */ 00085 if (CsrApiPort != NULL) { 00086 ArgLength = sizeof(*a); 00087 ArgLength |= (ArgLength << 16); 00088 ArgLength += ((sizeof( CSR_API_MSG ) - sizeof( m.u )) << 16) | 00089 (FIELD_OFFSET( CSR_API_MSG, u ) - sizeof( m.h )); 00090 m.h.u1.Length = ArgLength; 00091 m.h.u2.ZeroInit = 0; 00092 m.CaptureBuffer = NULL; 00093 m.ApiNumber = CSR_MAKE_API_NUMBER( USERSRV_SERVERDLL_INDEX, 00094 UserpActivateDebugger); 00095 LeaveCrit(); 00096 Status = LpcRequestPort(CsrApiPort, (PPORT_MESSAGE)&m); 00097 EnterCrit(); 00098 UserAssert(NT_SUCCESS(Status)); 00099 } 00100 00101 /* 00102 * Don't eat this event unless we are breaking into CSR! Since we have 00103 * choosen an arbitrary hot key like F12 for the debug key, we need to 00104 * pass on the key to the application, or apps that want this key would 00105 * never see it. If we had an api for installing a debug hot key 00106 * (export or MOD_DEBUG flag to RegisterHotKey()), then it would be ok 00107 * to eat because the user selected the hot key. But it is not ok to 00108 * eat it as long as we've picked an arbitrary hot key. scottlu. 00109 */ 00110 if (fsModifiers & MOD_SHIFT) 00111 return TRUE; 00112 else 00113 return FALSE; 00114 }

HKL xxxActivateKeyboardLayout PWINDOWSTATION  pwinsta,
HKL  hkl,
UINT  Flags,
PWND  pwnd
 

Definition at line 916 of file kbdlyout.c.

References CheckLock, HKLtoPKL(), NULL, PtiCurrent, ReorderKeyboardLayouts(), ThreadLockAlwaysWithPti, ThreadUnlock, and xxxInternalActivateKeyboardLayout().

Referenced by NtUserActivateKeyboardLayout(), and xxxDefWindowProc().

00921 { 00922 PKL pkl; 00923 TL tlPKL; 00924 HKL hklRet; 00925 PTHREADINFO ptiCurrent = PtiCurrent(); 00926 00927 CheckLock(pwnd); 00928 00929 pkl = HKLtoPKL(ptiCurrent, hkl); 00930 if (pkl == NULL) { 00931 return 0; 00932 } 00933 00934 if (Flags & KLF_REORDER) { 00935 ReorderKeyboardLayouts(pwinsta, pkl); 00936 } 00937 00938 ThreadLockAlwaysWithPti(ptiCurrent, pkl, &tlPKL); 00939 hklRet = xxxInternalActivateKeyboardLayout(pkl, Flags, pwnd); 00940 ThreadUnlock(&tlPKL); 00941 return hklRet; 00942 }

BOOL xxxActivateThisWindow PWND  pwnd,
DWORD  tidLoseForeground,
DWORD  fFlags
 

Definition at line 472 of file focusact.c.

References ATW_ASYNC, ATW_MOUSE, ATW_NOZORDER, ATW_SETFOCUS, BOOL, BWL_ENUMLIST, CheckLock, ClrWF, dwFlags, DWORD, tagAAS::fActivating, FALSE, tagAAS::fQueueNotify, FWINABLE, GETPTI, GetTopLevelWindow(), glinp, gppiScreenSaver, gpqForeground, gpqForegroundPrev, grpdeskRitInput, tagWND::head, HMIsMarkDestroy, HW, HWq, IsHooked, IsVisible(), Lock, NtGetTickCount(), NULL, tagDESKTOP::pDeskInfo, tagTHREADINFO::pq, PtiCurrent, tagPROCESSINFO::ptiMainThread, tagAAS::ptiNotify, PUSIF_PALETTEDISPLAY, PWND_BROADCAST, PWND_TOP, PWNDDESKTOP, QEVENT_ACTIVATE, QEVENT_DEACTIVATE, QF_ACTIVATIONCHANGE, QF_EVENTDEACTIVATEREMOVED, tagQ::QF_flags, QF_FOCUSNULLSINCEACTIVE, RemoveEventMessage(), tagTHREADINFO::rpdesk, tagPROCESSINFO::rpdeskStartup, SetForegroundPriorityProcess(), SetWF, tagDESKTOPINFO::spwnd, tagQ::spwndActive, tagQ::spwndActivePrev, tagWND::spwndChild, tagQ::spwndFocus, tagWND::spwndLastActive, tagWND::spwndNext, tagWND::spwndOwner, TEST_PUSIF, TestWF, ThreadLockPti, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPti, tagAAS::tidActDeact, TIDq, tagTHREADINFO::TIF_flags, TIF_INACTIVATEAPPMSG, tagLASTINPUT::timeLastInputMessage, TRUE, WEF_USEPWNDTHREAD, WFBEINGACTIVATED, WFCHILD, WFDESTROYED, WFFRAMEON, WFMINIMIZED, WFNONCPAINT, WFVISIBLE, WHF_CBT, WNDENUMPROC_PWND, xxxActivateApp(), xxxCallHook(), xxxInternalEnumWindow(), xxxMakeWindowForegroundWithState(), xxxSendFocusMessages(), xxxSendMessage(), xxxSendNotifyMessage(), xxxSetWindowPos(), xxxUpdateTray(), and xxxWindowEvent().

Referenced by xxxActivateWindow(), xxxActiveWindowTracking(), xxxMenuWindowProc(), xxxMNCloseHierarchy(), xxxMNEndMenuState(), xxxProcessEventMessage(), xxxSetFocus(), and xxxSetForegroundWindow2().

00476 { 00477 PTHREADINFO ptiCurrent = PtiCurrent(); 00478 PWND pwndT, pwndActivePrev, pwndActiveSave; 00479 TL tlpwndActive; 00480 TL tlpwndChild; 00481 TL tlpwndActivePrev; 00482 WPARAM wParam; 00483 BOOL fSetActivateAppBit; 00484 00485 BOOL fMouse = (BOOL)(fFlags & ATW_MOUSE); 00486 BOOL fSetFocus = (BOOL)(fFlags & ATW_SETFOCUS); 00487 BOOL fAsync = (BOOL)(fFlags & ATW_ASYNC); 00488 00489 #if DBG 00490 PQ pqSave = ptiCurrent->pq; 00491 #endif 00492 00493 00494 CheckLock(pwnd); 00495 00496 /* 00497 * If pwnd is NULL, then we can't do anything. 00498 */ 00499 if ((pwnd == NULL) || (pwnd == PWNDDESKTOP(pwnd))) { 00500 return FALSE; 00501 } 00502 00503 /* 00504 * Don't activate a window that has been destroyed. 00505 */ 00506 if (HMIsMarkDestroy(pwnd)) 00507 return FALSE; 00508 00509 /* 00510 * We don't activate top-level windows of a different queue. 00511 */ 00512 if (GETPTI(pwnd)->pq != ptiCurrent->pq) { 00513 return FALSE; 00514 } 00515 00516 pwndActiveSave = ptiCurrent->pq->spwndActive; 00517 00518 /* 00519 * Do the change-in-activation if the two-windows are different, 00520 * and if we're not recursing 00521 */ 00522 if ((pwnd != pwndActiveSave) && !TestWF(pwnd, WFBEINGACTIVATED)) { 00523 00524 /* 00525 * Ask the CBT hook whether it is OK to activate this window. 00526 */ 00527 { 00528 CBTACTIVATESTRUCT CbtActivateParams; 00529 00530 if (IsHooked(ptiCurrent, WHF_CBT)) { 00531 00532 CbtActivateParams.fMouse = fMouse; 00533 CbtActivateParams.hWndActive = HW(pwndActiveSave); 00534 00535 if (xxxCallHook(HCBT_ACTIVATE, 00536 (WPARAM)HWq(pwnd), (LPARAM)&CbtActivateParams, WH_CBT)) { 00537 return FALSE; 00538 } 00539 } 00540 } 00541 00542 ptiCurrent->pq->QF_flags &= ~QF_EVENTDEACTIVATEREMOVED; 00543 00544 /* 00545 * If the active window went away but somehow was left referenced 00546 * in the queue, then we do not want to do any deactivation of 00547 * that window. 00548 * 00549 * Don't thread lock this because the next thing we do with it 00550 * is just an equality check. 00551 * 00552 * A DBG check is placed in xxxDestroyWindow to attempt to 00553 * catch the situation where we return from the function with 00554 * the destroyed window set in the active (pq). If that situation 00555 * can be detected and solved, then this conditional might be 00556 * removed: ChrisWil - 08/22/95. 00557 */ 00558 if (ptiCurrent->pq->spwndActive && TestWF(ptiCurrent->pq->spwndActive, WFDESTROYED)) { 00559 Lock(&ptiCurrent->pq->spwndActive, NULL); 00560 } else { 00561 Lock(&ptiCurrent->pq->spwndActivePrev, ptiCurrent->pq->spwndActive); 00562 } 00563 pwndActivePrev = ptiCurrent->pq->spwndActive; 00564 00565 /* 00566 * If there was a previously active window, 00567 * and we're in the foreground then assign 00568 * gpqForegroundPrev to ourself. 00569 */ 00570 if ((pwndActivePrev != NULL) && (ptiCurrent->pq == gpqForeground)) { 00571 gpqForegroundPrev = ptiCurrent->pq; 00572 } 00573 00574 /* 00575 * Deactivate currently active window if possible. 00576 */ 00577 if (pwndActivePrev != NULL) { 00578 ThreadLockWithPti(ptiCurrent, pwndActivePrev, &tlpwndActive); 00579 00580 /* 00581 * The active window can prevent itself from losing the 00582 * activation by returning FALSE to this WM_NCACTIVATE message 00583 */ 00584 wParam = MAKELONG(WA_INACTIVE, TestWF(pwndActivePrev, WFMINIMIZED)); 00585 if (!xxxSendMessage(pwndActivePrev, WM_NCACTIVATE, 00586 wParam, (LPARAM)HWq(pwnd))) { 00587 ThreadUnlock(&tlpwndActive); 00588 return FALSE; 00589 } 00590 00591 xxxSendMessage(pwndActivePrev, WM_ACTIVATE, wParam, (LPARAM)HWq(pwnd)); 00592 00593 ThreadUnlock(&tlpwndActive); 00594 } 00595 00596 /* 00597 * If the activation changed while we were gone, we'd better 00598 * not send any more messages, since they'd go to the wrong window. 00599 * (and, they've already been sent anyhow) 00600 */ 00601 if (ptiCurrent->pq->spwndActivePrev != ptiCurrent->pq->spwndActive || 00602 pwndActiveSave != ptiCurrent->pq->spwndActive) { 00603 #if DBG 00604 if (ptiCurrent->pq->spwndActivePrev == ptiCurrent->pq->spwndActive) { 00605 RIPMSG0(RIP_WARNING, "xxxActivateThisWindow: ptiCurrent->pq->spwndActive changed in callbacks"); 00606 } 00607 #endif 00608 return FALSE; 00609 } 00610 00611 /* 00612 * If the window being activated has been destroyed, don't 00613 * do anything else. Making it the active window in this 00614 * case can cause console to hang during shutdown. 00615 */ 00616 if (HMIsMarkDestroy(pwnd)) 00617 return FALSE; 00618 00619 /* 00620 * Before we lock the new pwndActivate, make sure we're still 00621 * on the same queue. 00622 */ 00623 if (GETPTI(pwnd)->pq != ptiCurrent->pq) { 00624 RIPMSG1(RIP_WARNING, "xxxActivateThisWindow: Queue unattached:%#p", pqSave); 00625 return FALSE; 00626 } 00627 00628 /* 00629 * This bit, which means the app set the focus to NULL after becoming 00630 * active, doesn't make sense if the app is just becoming active, so 00631 * clear it in this case. It is used below in this routine to 00632 * determine whether to send focus messages (read comment in this 00633 * routine). 00634 */ 00635 if (ptiCurrent->pq->spwndActive == NULL) 00636 ptiCurrent->pq->QF_flags &= ~QF_FOCUSNULLSINCEACTIVE; 00637 00638 Lock(&ptiCurrent->pq->spwndActive, pwnd); 00639 00640 /* 00641 * Tp prevent recursion, set pwnd's WFBEINGACTIVATED bit. 00642 * Recursion can happen if we have an activation battle with other 00643 * threads which keep changing ptiCurrent->pq->spwndActive behind our 00644 * callbacks. 00645 * WARNING: Do NOT return from this routine without clearing this bit! 00646 */ 00647 SetWF(pwnd, WFBEINGACTIVATED); 00648 00649 if (FWINABLE()) { 00650 xxxWindowEvent(EVENT_SYSTEM_FOREGROUND, pwnd, OBJID_WINDOW, INDEXID_OBJECT, WEF_USEPWNDTHREAD); 00651 } 00652 00653 /* 00654 * Remove all async activates up to the next async deactivate. We 00655 * do this so that any queued activates don't reset this synchronous 00656 * activation state we're now setting. Only remove up till the next 00657 * deactivate because active state is synchronized with reading 00658 * input from the input queue. 00659 * 00660 * For example, an activate event gets put in an apps queue. Before 00661 * processing it the app calls ActivateWindow(), which is synchronous. 00662 * You want the ActivateWindow() to win because it is newer 00663 * information. 00664 * 00665 * msmail32 demonstrates this. Minimize msmail. Alt-tab to it. It 00666 * brings up the password dialog, but it isn't active. It correctly 00667 * activates the password dialog but then processes an old activate 00668 * event activating the icon, so the password dialog is not active. 00669 */ 00670 RemoveEventMessage(ptiCurrent->pq, QEVENT_ACTIVATE, QEVENT_DEACTIVATE); 00671 00672 xxxMakeWindowForegroundWithState(NULL, 0); 00673 00674 pwndActivePrev = ptiCurrent->pq->spwndActivePrev; 00675 ThreadLockWithPti(ptiCurrent, pwndActivePrev, &tlpwndActivePrev); 00676 00677 if (TEST_PUSIF(PUSIF_PALETTEDISPLAY) && xxxSendMessage(pwnd, WM_QUERYNEWPALETTE, 0, 0)) { 00678 xxxSendNotifyMessage(PWND_BROADCAST, WM_PALETTEISCHANGING, 00679 (WPARAM)HWq(pwnd), 0); 00680 } 00681 00682 /* 00683 * If the window becoming active is not already the top window in the 00684 * Z-order, then call xxxBringWindowToTop() to do so. 00685 */ 00686 00687 /* 00688 * If this isn't a child window, first check to see if the 00689 * window isn't already 'on top'. If not, then call 00690 * xxxBringWindowToTop(). 00691 */ 00692 if (!(fFlags & ATW_NOZORDER) && !TestWF(pwnd, WFCHILD)) { 00693 00694 /* 00695 * Look for the first visible child of the desktop. 00696 * ScottLu changed this to start looking at the desktop 00697 * window. Since the desktop window was always visible, 00698 * BringWindowToTop was always called regardless of whether 00699 * it was needed or not. No one can remember why this 00700 * change was made, so I'll change it back to the way it 00701 * was in Windows 3.1. - JerrySh 00702 */ 00703 pwndT = PWNDDESKTOP(pwnd)->spwndChild; 00704 00705 while (pwndT && (!TestWF(pwndT, WFVISIBLE))) { 00706 pwndT = pwndT->spwndNext; 00707 } 00708 00709 /* 00710 * If this activation came from an async call (i.e. 00711 * xxxProcessEventMessage), we need to check to see 00712 * if the thread is the foreground-queue. If not, then 00713 * we do not want to bring the window to the top. This 00714 * is because another window could have already been 00715 * place on top w/foreground. Bringing the window to 00716 * the top in this case would result in a top-level window 00717 * without activation. - ChrisWil 00718 * 00719 * Added a check to see if the previous-active window went 00720 * invisible during the deactivation time. This will ensure 00721 * that we bring the new window to the top. Otherwise, we 00722 * could end up skipping over the previous-window from the 00723 * above tests. Office95 apps demonstrate this behaviour by 00724 * turning their windows invisible during the painting of their 00725 * captionbars. By the time we use to get here, we failed to 00726 * bring the new window to top. 00727 */ 00728 if ((pwnd != pwndT) || (pwndActivePrev && !IsVisible(pwndActivePrev))) { 00729 00730 if (!(fAsync && (gpqForeground != ptiCurrent->pq))) { 00731 DWORD dwFlags; 00732 00733 /* 00734 * Bring the window to the top. If we're already 00735 * activating the window, don't reactivate it. 00736 */ 00737 dwFlags = SWP_NOSIZE | SWP_NOMOVE; 00738 if (pwnd == pwndT) 00739 dwFlags |= SWP_NOACTIVATE; 00740 00741 xxxSetWindowPos(pwnd, PWND_TOP, 0, 0, 0, 0, dwFlags); 00742 } 00743 } 00744 } 00745 00746 /* 00747 * If there was no previous active window, or if the 00748 * previously active window belonged to another thread 00749 * send the WM_ACTIVATEAPP messages. The fActivate == FALSE 00750 * case is handled in xxxDeactivate when 'hwndActivePrev == NULL'. 00751 * 00752 * Harvard Graphics/Windows setup calls SetActiveWindow when it 00753 * receives a deactivationg WM_ACTIVATEAPP. The TIF_INACTIVATEAPPMSG 00754 * prevents an activating WM_ACTIVATEAPP(TRUE) from being sent while 00755 * deactivation is occuring. 00756 */ 00757 fSetActivateAppBit = FALSE; 00758 if (!(ptiCurrent->TIF_flags & TIF_INACTIVATEAPPMSG) && 00759 ((pwndActivePrev == NULL) || 00760 (GETPTI(pwndActivePrev) != GETPTI(pwnd)))) { 00761 AAS aas; 00762 00763 /* 00764 * First send the deactivating WM_ACTIVATEAPP if there 00765 * was a previously active window of another thread in 00766 * the current queue. 00767 */ 00768 if (pwndActivePrev != NULL) { 00769 PTHREADINFO ptiPrev = GETPTI(pwndActivePrev); 00770 TL tlptiPrev; 00771 00772 /* 00773 * Ensure that the other thread can't recurse 00774 * and send more WM_ACTIVATEAPP msgs. 00775 */ 00776 ptiPrev->TIF_flags |= TIF_INACTIVATEAPPMSG; 00777 00778 aas.ptiNotify = ptiPrev; 00779 aas.tidActDeact = TIDq(ptiCurrent); 00780 aas.fActivating = FALSE; 00781 aas.fQueueNotify = FALSE; 00782 00783 ThreadLockPti(ptiCurrent, ptiPrev, &tlptiPrev); 00784 ThreadLockWithPti(ptiCurrent, pwndActivePrev->head.rpdesk->pDeskInfo->spwnd->spwndChild, &tlpwndChild); 00785 xxxInternalEnumWindow(pwndActivePrev->head.rpdesk->pDeskInfo->spwnd->spwndChild, 00786 (WNDENUMPROC_PWND)xxxActivateApp, (LPARAM)&aas, BWL_ENUMLIST); 00787 ThreadUnlock(&tlpwndChild); 00788 ptiPrev->TIF_flags &= ~TIF_INACTIVATEAPPMSG; 00789 ThreadUnlockPti(ptiCurrent, &tlptiPrev); 00790 } 00791 00792 /* 00793 * This will ensure that the current thread will not 00794 * send any more WM_ACTIVATEAPP messages until it 00795 * is done performing its activation. 00796 */ 00797 ptiCurrent->TIF_flags |= TIF_INACTIVATEAPPMSG; 00798 fSetActivateAppBit = TRUE; 00799 00800 aas.ptiNotify = GETPTI(pwnd); 00801 aas.tidActDeact = tidLoseForeground; 00802 aas.fActivating = TRUE; 00803 aas.fQueueNotify = FALSE; 00804 00805 ThreadLockWithPti(ptiCurrent, ptiCurrent->rpdesk->pDeskInfo->spwnd->spwndChild, &tlpwndChild); 00806 xxxInternalEnumWindow(ptiCurrent->rpdesk->pDeskInfo->spwnd->spwndChild, 00807 (WNDENUMPROC_PWND)xxxActivateApp, (LPARAM)&aas, BWL_ENUMLIST); 00808 ThreadUnlock(&tlpwndChild); 00809 } 00810 00811 /* 00812 * If this window has already been drawn as active, set the 00813 * flag so that we don't draw it again. 00814 */ 00815 if (TestWF(pwnd, WFFRAMEON)) { 00816 SetWF(pwnd, WFNONCPAINT); 00817 } 00818 00819 /* 00820 * If the window is marked for destruction, don't do 00821 * the lock because xxxFreeWindow has already been called 00822 * and a lock here will result in the window locking itself 00823 * and never being freed. 00824 */ 00825 if (!HMIsMarkDestroy(pwnd)) { 00826 00827 /* 00828 * Set most recently active window in owner/ownee list. 00829 */ 00830 pwndT = pwnd; 00831 while (pwndT->spwndOwner != NULL) { 00832 pwndT = pwndT->spwndOwner; 00833 } 00834 Lock(&pwndT->spwndLastActive, pwnd); 00835 } 00836 00837 00838 xxxSendMessage(pwnd, WM_NCACTIVATE, 00839 MAKELONG(GETPTI(pwnd)->pq == gpqForeground, 00840 ptiCurrent->pq->spwndActive != NULL ? 00841 TestWF(ptiCurrent->pq->spwndActive, WFMINIMIZED) : 0), 00842 (LPARAM)HW(pwndActivePrev)); 00843 00844 if (ptiCurrent->pq->spwndActive != NULL) { 00845 xxxSendMessage(pwnd, WM_ACTIVATE, 00846 MAKELONG((fMouse ? WA_CLICKACTIVE : WA_ACTIVE), 00847 TestWF(ptiCurrent->pq->spwndActive, WFMINIMIZED)), 00848 (LPARAM)HW(pwndActivePrev)); 00849 } else { 00850 xxxSendMessage(pwnd, WM_ACTIVATE, 00851 MAKELONG((fMouse ? WA_CLICKACTIVE : WA_ACTIVE), 0), 00852 (LPARAM)HW(pwndActivePrev)); 00853 } 00854 00855 xxxUpdateTray(pwnd); 00856 00857 ThreadUnlock(&tlpwndActivePrev); 00858 00859 ClrWF(pwnd, WFNONCPAINT); 00860 00861 /* 00862 * If xxxActivateThisWindow() is called from xxxSetFocus() then 00863 * fSetFocus is FALSE. In this case, we don't set the focus since 00864 * xxxSetFocus() will do that for us. Otherwise, we set the focus 00865 * to the newly activated window if the window with the focus is 00866 * not the new active window or one of its children. Normally, 00867 * xxxDefWindowProc() will set the focus. 00868 */ 00869 ThreadLockWithPti(ptiCurrent, ptiCurrent->pq->spwndActive, &tlpwndActive); 00870 00871 /* 00872 * Win3.1 checks spwndFocus != NULL - we check QF_FOCUSNULLSINCEACTIVE, 00873 * which is the win32 equivalent. On win32, 32 bit apps each have their 00874 * own focus. If the app is not foreground, most of the time spwndFocus 00875 * is NULL when the window is being activated and brought to the 00876 * foreground. It wouldn't go through this code in this case. Win3.1 in 00877 * effect is checking if the previous active application had an 00878 * hwndFocus != NULL. Win32 effectively assumes the last window has a 00879 * non-NULL hwndFocus, so win32 instead checks to see if the focus has 00880 * been set to NULL since this application became active (meaning, did 00881 * it purposefully set the focus to NULL). If it did, don't go through 00882 * this codepath (like win3.1). If it didn't, go through this code path 00883 * because the previous application had an hwndFocus != NULL 00884 * (like win3.1). Effectively it is the same check as win3.1, but 00885 * updated to deal with async input. 00886 * 00887 * Case in point: bring up progman, hit f1 (to get win32 help). Click 00888 * history to get a popup (has the focus in a listbox in the client 00889 * area). Activate another app, now click on title bar only of history 00890 * popup. The focus should get set by going through this code path. 00891 * 00892 * Alternate case: Ventura Publisher brings up "Special Effects" 00893 * dialog. If "Bullet" from this dialog was clicked last time the 00894 * dialog was brought up, sending focus messages here when 00895 * hwndFocus == NULL, would reset the focus to "None" incorrectly 00896 * because Ventura does its state setting when it gets the focus 00897 * messages. The real focus messages it is depending on are the 00898 * ones that come from the SetFocus() call in DlgSetFocus() in 00899 * the dialog management code. (In this case, before the dialog 00900 * comes up, focus == active window. When the dialog comes up 00901 * and EnableWindow(hwndOwner, FALSE) is called, EnableWindow() calls 00902 * SetFocus(NULL) (because it is disabling the window that is also 00903 * the focus window). When the dialog comes up it gets activated via 00904 * SwpActivate(), but since the focus is NULL vpwin does not expect 00905 * to go through this code path.) 00906 * 00907 * - scottlu 00908 */ 00909 #if 0 00910 // this is what win3.1 does - which won't work for win32 00911 00912 if (fSetFocus && ptiCurrent->pq->spwndFocus != NULL && ptiCurrent->pq->spwndActive != 00913 GetTopLevelWindow(ptiCurrent->pq->spwndFocus)) 00914 #else 00915 if (fSetFocus && !(ptiCurrent->pq->QF_flags & QF_FOCUSNULLSINCEACTIVE) && 00916 ptiCurrent->pq->spwndActive != GetTopLevelWindow(ptiCurrent->pq->spwndFocus)) { 00917 #endif 00918 00919 xxxSendFocusMessages(ptiCurrent, 00920 (ptiCurrent->pq->spwndActive != NULL && 00921 TestWF(ptiCurrent->pq->spwndActive, WFMINIMIZED)) ? 00922 NULL : ptiCurrent->pq->spwndActive); 00923 } 00924 00925 ThreadUnlock(&tlpwndActive); 00926 00927 /* 00928 * This flag is examined in the menu loop code so that we exit from 00929 * menu mode if another window was activated while we were tracking 00930 * menus. 00931 */ 00932 ptiCurrent->pq->QF_flags |= QF_ACTIVATIONCHANGE; 00933 00934 if (gppiScreenSaver == NULL) { 00935 00936 /* 00937 * Activation has occurred, update our last idle time counter if 00938 * we're on the input desktop. 00939 */ 00940 if (ptiCurrent->rpdesk == grpdeskRitInput) { 00941 glinp.timeLastInputMessage = NtGetTickCount(); 00942 } 00943 00944 } else { 00945 00946 if (GETPTI(pwnd)->ppi != gppiScreenSaver) { 00947 /* 00948 * Activation ocurred by an app other than the screen saver. 00949 * Update the idle time counter and mark our screen saver as 00950 * active (so it can quit). 00951 */ 00952 00953 #if 0 00954 // LATER 00955 if (ptiCurrent->rpdesk != gppiScreenSaver->rpdeskStartup) { 00956 /* 00957 * Activation is occurring on different desktops, let WinLogon decide 00958 * if it wants to switch. 00959 */ 00960 } 00961 #endif 00962 00963 glinp.timeLastInputMessage = NtGetTickCount(); 00964 gppiScreenSaver->W32PF_Flags &= ~W32PF_IDLESCREENSAVER; 00965 SetForegroundPriorityProcess(gppiScreenSaver, gppiScreenSaver->ptiMainThread, TRUE); 00966 } 00967 } 00968 00969 /* 00970 * If WM_ACTIVATEAPP messages were sent, it is now 00971 * safe to allow them to be sent again. 00972 */ 00973 if (fSetActivateAppBit) 00974 ptiCurrent->TIF_flags &= ~TIF_INACTIVATEAPPMSG; 00975 00976 00977 } else { 00978 #if DBG 00979 if (TestWF(pwnd, WFBEINGACTIVATED)) { 00980 RIPMSG1(RIP_WARNING, "xxxActivateThisWindow recursing on pwnd %#p\n", pwnd); 00981 } 00982 #endif 00983 ptiCurrent->pq->QF_flags &= ~QF_EVENTDEACTIVATEREMOVED; 00984 if (TEST_PUSIF(PUSIF_PALETTEDISPLAY) && xxxSendMessage(pwnd, WM_QUERYNEWPALETTE, 0, 0)) { 00985 xxxSendNotifyMessage(PWND_BROADCAST, WM_PALETTEISCHANGING, 00986 (WPARAM)HWq(pwnd), 0); 00987 } 00988 } 00989 00990 ClrWF(pwnd, WFBEINGACTIVATED); 00991 return ptiCurrent->pq->spwndActive == pwnd; 00992 }

BOOL xxxActivateWindow PWND  pwnd,
UINT  cmd
 

Definition at line 2060 of file focusact.c.

References ATW_MOUSE, ATW_SETFOCUS, AW_SKIP, AW_SKIP2, AW_TRY, AW_TRY2, AW_USE, AW_USE2, BOOL, CheckLock, tagTHREADINFO::cVisWindows, DWORD, FAllowForegroundActivate(), FALSE, FBadWindow(), GETPTI, gpqForeground, gpqForegroundPrev, NextTopWindow(), NTW_IGNORETOOLWINDOW, NULL, tagTHREADINFO::pq, PtiCurrent, tagQ::spwndActivePrev, tagWND::spwndLastActive, tagWND::spwndOwner, TestWF, TestwndChild, TestwndPopup, ThreadLockAlwaysWithPti, ThreadUnlock, TIF_ALLOWFOREGROUNDACTIVATE, tagTHREADINFO::TIF_flags, TRUE, WFBOTTOMMOST, xxxActivateThisWindow(), and xxxSetForegroundWindow().

Referenced by xxxDestroyWindow(), xxxHandleNCMouseGuys(), xxxMenuWindowProc(), xxxMinMaximize(), xxxMouseActivate(), xxxSetActiveWindow(), xxxSetForegroundWindow(), xxxShowWindow(), and xxxSwpActivate().

02063 { 02064 DWORD fFlags = ATW_SETFOCUS; 02065 PTHREADINFO ptiCurrent = PtiCurrent(); 02066 TL tlpwnd; 02067 BOOL fSuccess; 02068 BOOL fAllowForeground, fSetForegroundRight; 02069 02070 CheckLock(pwnd); 02071 02072 02073 if (pwnd != NULL) { 02074 02075 /* 02076 * See if this window is OK to activate 02077 * (Cannot activate child windows). 02078 */ 02079 if (TestwndChild(pwnd)) 02080 return FALSE; 02081 02082 } else { 02083 cmd = AW_SKIP2; 02084 } 02085 02086 switch (cmd) { 02087 02088 case AW_TRY2: 02089 fFlags |= ATW_MOUSE; 02090 02091 /* 02092 *** FALL THRU ** 02093 */ 02094 case AW_TRY: 02095 02096 /* 02097 * See if this window is OK to activate. 02098 */ 02099 if (!FBadWindow(pwnd)) { 02100 break; 02101 } 02102 02103 /* 02104 * If pwnd can not be activated, drop into the AW_SKIP case. 02105 */ 02106 case AW_SKIP: 02107 02108 /* 02109 * Try the owner of this popup. 02110 */ 02111 if (TestwndPopup(pwnd) && !FBadWindow(pwnd->spwndOwner)) { 02112 pwnd = pwnd->spwndOwner; 02113 break; 02114 } 02115 02116 /* 02117 * fall through 02118 */ 02119 02120 case AW_SKIP2: 02121 02122 /* 02123 * Try the previously active window but don't activate a shell window 02124 */ 02125 if ((gpqForegroundPrev != NULL) 02126 && !FBadWindow(gpqForegroundPrev->spwndActivePrev) 02127 /* 02128 * Bug 290129 - joejo 02129 * 02130 * Test for WFBOTTOMMOST as opposed to WEFTOOLWINDOW to fix 02131 * issue with Office2000 assistant and balloon help. 02132 */ 02133 && !TestWF(gpqForegroundPrev->spwndActivePrev, WFBOTTOMMOST)) { 02134 02135 pwnd = gpqForegroundPrev->spwndActivePrev; 02136 break; 02137 } 02138 02139 { 02140 PWND pwndSave = pwnd; 02141 DWORD flags = NTW_IGNORETOOLWINDOW; 02142 02143 TryAgain: 02144 /* 02145 * Find a new active window from the top-level window list, 02146 * skip tool windows the first time through. 02147 */ 02148 pwnd = NextTopWindow(ptiCurrent, pwndSave, (cmd == AW_SKIP ? pwndSave : NULL), 02149 flags); 02150 02151 if (pwnd) { 02152 if (!FBadWindow(pwnd->spwndLastActive)) 02153 pwnd = pwnd->spwndLastActive; 02154 } else { 02155 if (flags == NTW_IGNORETOOLWINDOW) { 02156 flags = 0; 02157 goto TryAgain; 02158 } 02159 } 02160 } 02161 02162 02163 case AW_USE: 02164 break; 02165 02166 case AW_USE2: 02167 fFlags |= ATW_MOUSE; 02168 break; 02169 02170 default: 02171 return FALSE; 02172 } 02173 02174 if (pwnd == NULL) 02175 return FALSE; 02176 02177 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 02178 02179 if (GETPTI(pwnd)->pq == ptiCurrent->pq) { 02180 /* 02181 * Activation is within this queue. Usually this means just do 02182 * all the normal message sending. But if this queue isn't the 02183 * foreground queue, check to see if it is allowed to become 02184 * foreground. 02185 */ 02186 02187 /* 02188 * Sometimes processes are granted the right to foreground 02189 * activate themselves, if they aren't foreground, like 02190 * when starting up (there are other cases). Grant this if 02191 * this process is allowed. 02192 */ 02193 02194 /* 02195 * Removed the first clause from the following if statement 02196 * if (pti->pq == gpqForeground || !FAllowForegroundActivate(pti->pq)) { 02197 * This fixes the problem where foreground app A activates app B 02198 * the user switches to app C, then B does something to activate A 02199 * (like destroy an owned window). A now comes to the foreground 02200 * unexpectedly. This clause is not in Win95 code and was added in 02201 * 3.51 code to fix some test script hang (Bug 7461) 02202 */ 02203 02204 if (!FAllowForegroundActivate(ptiCurrent->pq, pwnd)) { 02205 fSuccess = xxxActivateThisWindow(pwnd, 0, fFlags); 02206 ThreadUnlock(&tlpwnd); 02207 return fSuccess; 02208 } 02209 02210 fAllowForeground = TRUE; 02211 /* 02212 * If this thread doesn't have any top-level non-minimized visible windows, 02213 * let it keep the right since it's probably not done with activation yet. 02214 * Bug 274383 - joejo 02215 */ 02216 fSetForegroundRight = (ptiCurrent->cVisWindows == 0); 02217 02218 } else { 02219 /* 02220 * If the caller is in the foreground, it has the right to change 02221 * the foreground itself. 02222 */ 02223 fAllowForeground = (gpqForeground == ptiCurrent->pq) 02224 || (gpqForeground == NULL); 02225 /* 02226 * Give the right to change the foreground to this thread only if it already 02227 * has it, it has more visible windows or this is an explicit request to 02228 * activate the given window. 02229 * When an app destroys/hides the active (foreground) window, we choose a new 02230 * active window and will probably hit this code. We don't want to give them the 02231 * right to change the foreground in this case since it's us making the activation 02232 * (See comments below). We let them keep the right so apps destroying their last 02233 * visible window (ie a splash initialization window) can take the foreground again 02234 * when they create another window (the main window). 02235 */ 02236 if (fAllowForeground) { 02237 fSetForegroundRight = ((ptiCurrent->TIF_flags & TIF_ALLOWFOREGROUNDACTIVATE) 02238 || (ptiCurrent->cVisWindows != 0) 02239 || (cmd == AW_USE)); 02240 } else { 02241 fSetForegroundRight = FALSE; 02242 } 02243 } 02244 02245 fSuccess = FALSE; 02246 if (fAllowForeground) { 02247 /* 02248 * Hack! Temporarily give this thread a foreground right to make sure 02249 * this call succeds. 02250 */ 02251 ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 02252 TAGMSG1(DBGTAG_FOREGROUND, "xxxActivateWindow temporarly set TIF %#p", ptiCurrent); 02253 fSuccess = xxxSetForegroundWindow(pwnd, (cmd == AW_USE)); 02254 02255 if (fSetForegroundRight) { 02256 /* 02257 * We activated some other app on purpose. If so that means this 02258 * thread is probably controlling this window and will probably want 02259 * to set itself active and foreground really soon again (for example, 02260 * a setup program doing dde to progman). A real live case: wingz - 02261 * bring up page setup..., options..., ok, ok. Under Win3.1 the 02262 * activation goes somewhere strange and then wingz calls 02263 * SetActiveWindow() to bring it back. This'll make sure that works. 02264 * 02265 * We used to set this before calling xxxSetForegeroundWindow above. 02266 * This would cause callers doing an intra-queue activation to 02267 * retain their foreground right eventhough it is supposed to be 02268 * a one shot deal (that's why FAllowForeground clears the bits). 02269 * In addtion, xxxSetForegroundWindow might clear the bits (it didnt' 02270 * used to); so we do it here, and only if we did an inter-queue 02271 * activation 02272 */ 02273 ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 02274 TAGMSG1(DBGTAG_FOREGROUND, "xxxActivateWindow set TIF %#p", ptiCurrent); 02275 } else { 02276 /* 02277 * Make sure to remove the temporary right. 02278 */ 02279 ptiCurrent->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE; 02280 TAGMSG1(DBGTAG_FOREGROUND, "xxxActivateWindow clear TIF %#p", ptiCurrent); 02281 } 02282 } 02283 02284 ThreadUnlock(&tlpwnd); 02285 return fSuccess; 02286 }

int xxxActiveWindowTracking PWND  pwnd,
UINT  uMsg,
int  iHitTest
 

Definition at line 2327 of file ntuser/kernel/input.c.

References ATW_NOZORDER, BOOL, CheckLock, GetActiveTrackPwnd(), GETPTI, gpqForeground, HWq, IsForegroundLocked(), MA_PASSTHRU, MA_SKIP, NULL, QF_ACTIVEWNDTRACKING, tagQ::QF_flags, SFW_NOZORDER, SFW_SWITCH, SHORT, TestUP, ThreadLockAlways, ThreadUnlock, xxxActivateThisWindow(), xxxSendMessage(), and xxxSetForegroundWindow2().

Referenced by xxxDWP_SetCursor(), and xxxMouseActivate().

02331 { 02332 02333 BOOL fSuccess; 02334 int iRet; 02335 PWND pwndActivate; 02336 Q *pq; 02337 TL tlpwndActivate; 02338 02339 CheckLock(pwnd); 02340 UserAssert(TestUP(ACTIVEWINDOWTRACKING)); 02341 02342 /* 02343 * If the mouse hasn't been long enough on this queue, bail. 02344 */ 02345 pq = GETPTI(pwnd)->pq; 02346 if (!(pq->QF_flags & QF_ACTIVEWNDTRACKING)) { 02347 return MA_PASSTHRU; 02348 } 02349 pq->QF_flags &= ~QF_ACTIVEWNDTRACKING; 02350 02351 /* 02352 * If the foreground is locked, bail 02353 */ 02354 if (IsForegroundLocked()) { 02355 return MA_PASSTHRU; 02356 } 02357 02358 /* 02359 * Get the window we need to activate. If none, bail. 02360 */ 02361 pwndActivate = GetActiveTrackPwnd(pwnd, &pq); 02362 if (pwndActivate == NULL) { 02363 return MA_PASSTHRU; 02364 } 02365 02366 /* 02367 * Lock if needed because we're about to callback 02368 */ 02369 if (pwnd != pwndActivate) { 02370 ThreadLockAlways(pwndActivate, &tlpwndActivate); 02371 } 02372 02373 /* 02374 * Let's ask if it's OK to do this 02375 * 02376 * This message is supposed to go to the window the mouse is on. 02377 * This could be a child window which might return MA_NOACTIVATE*. 02378 * For mouse clicks (which is what we want to emulate here) 02379 * xxxButtonEvent calls xxxSetForegroundWindow2 so their 02380 * pwndActivate gets brought to the foreground regardless. 02381 * So we send the message to pwndActivate instead. 02382 */ 02383 iRet = (int)xxxSendMessage(pwndActivate, WM_MOUSEACTIVATE, 02384 (WPARAM)(HWq(pwndActivate)), MAKELONG((SHORT)iHitTest, uMsg)); 02385 02386 02387 switch (iRet) { 02388 case MA_ACTIVATE: 02389 case MA_ACTIVATEANDEAT: 02390 if (pq == gpqForeground) { 02391 fSuccess = xxxActivateThisWindow(pwndActivate, 0, 02392 (TestUP(ACTIVEWNDTRKZORDER) ? 0 : ATW_NOZORDER)); 02393 } else { 02394 fSuccess = xxxSetForegroundWindow2(pwndActivate, NULL, 02395 SFW_SWITCH | (TestUP(ACTIVEWNDTRKZORDER) ? 0 : SFW_NOZORDER)); 02396 } 02397 02398 /* 02399 * Eat the message if activation failed. 02400 */ 02401 if (!fSuccess) { 02402 iRet = MA_SKIP; 02403 } else if (iRet == MA_ACTIVATEANDEAT) { 02404 iRet = MA_SKIP; 02405 } 02406 break; 02407 02408 case MA_NOACTIVATEANDEAT: 02409 iRet = MA_SKIP; 02410 break; 02411 02412 02413 case MA_NOACTIVATE: 02414 default: 02415 iRet = MA_PASSTHRU; 02416 break; 02417 } 02418 02419 if (pwnd != pwndActivate) { 02420 ThreadUnlock(&tlpwndActivate); 02421 } 02422 02423 return iRet; 02424 02425 }

int xxxAddFontResourceW LPWSTR  lpFile,
FLONG  flags,
DESIGNVECTOR *  pdv
 

Definition at line 1119 of file w32/ntuser/kernel/init.c.

References RtlInitUnicodeString(), and xxxClientAddFontResourceW().

Referenced by bEnumerateRegistryFonts(), and xxxLW_LoadFonts().

01123 { 01124 UNICODE_STRING strFile; 01125 01126 RtlInitUnicodeString(&strFile, lpFile); 01127 01128 /* 01129 * Callbacks leave the critsec, so make sure that we're in it. 01130 */ 01131 01132 return xxxClientAddFontResourceW(&strFile, flags, pdv); 01133 }

BOOL xxxAddFullScreen PWND  pwnd,
PMONITOR  pMonitor
 

Definition at line 151 of file winloop2.c.

References BOOL, tagMONITOR::cFullScreen, CheckLock, FALSE, FCallTray, tagWND::head, NULL, tagWND::rcWindow, SetWF, tagWND::spwndOwner, STW_SAME, TestWF, ThreadLock, ThreadUnlock, TRUE, WFCHILD, WFFULLSCREEN, WFVISIBLE, and xxxSetTrayWindow().

Referenced by xxxCheckFullScreen().

00152 { 00153 BOOL fYielded; 00154 00155 PDESKTOP pdesk = pwnd->head.rpdesk; 00156 00157 CheckLock(pwnd); 00158 CheckLock(pMonitor); 00159 00160 if (pdesk == NULL) 00161 return FALSE; 00162 00163 fYielded = FALSE; 00164 if (!TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk)) 00165 { 00166 SetWF(pwnd, WFFULLSCREEN); 00167 00168 if (pMonitor->cFullScreen++ == 0) { 00169 xxxSetTrayWindow(pdesk, STW_SAME, pMonitor); 00170 fYielded = TRUE; 00171 } 00172 00173 pwnd = pwnd->spwndOwner; 00174 if ( pwnd && 00175 !TestWF(pwnd, WFCHILD) && 00176 pwnd->rcWindow.right == 0 && 00177 pwnd->rcWindow.left == 0 && 00178 !TestWF(pwnd, WFVISIBLE)) { 00179 00180 TL tlpwnd; 00181 ThreadLock(pwnd, &tlpwnd); 00182 if (xxxAddFullScreen(pwnd, pMonitor)) { 00183 fYielded = TRUE; 00184 } 00185 00186 ThreadUnlock(&tlpwnd); 00187 } 00188 } 00189 00190 return fYielded; 00191 }

VOID xxxAdjustSize PWND  pwnd,
LPINT  lpcx,
LPINT  lpcy
 

Definition at line 1401 of file createw.c.

References CheckLock, max, min, TestWF, TestwndTiled, WFMINIMIZED, WFSIZEBOX, and xxxInitSendValidateMinMaxInfo().

Referenced by xxxCreateWindowEx(), and xxxDefWindowProc().

01405 { 01406 POINT ptmin, 01407 ptmax; 01408 MINMAXINFO mmi; 01409 01410 CheckLock(pwnd); 01411 01412 /* 01413 * If this window is sizeable or if this window is tiled, check size 01414 */ 01415 if (TestwndTiled(pwnd) || TestWF(pwnd, WFSIZEBOX)) { 01416 01417 /* 01418 * Get size info from pwnd 01419 */ 01420 xxxInitSendValidateMinMaxInfo(pwnd, &mmi); 01421 01422 if (TestWF(pwnd, WFMINIMIZED)) { 01423 ptmin = mmi.ptReserved; 01424 ptmax = mmi.ptMaxSize; 01425 } else { 01426 ptmin = mmi.ptMinTrackSize; 01427 ptmax = mmi.ptMaxTrackSize; 01428 } 01429 01430 // 01431 // Make sure we're less than the max, and greater than the min 01432 // 01433 *lpcx = max(ptmin.x, min(*lpcx, ptmax.x)); 01434 *lpcy = max(ptmin.y, min(*lpcy, ptmax.y)); 01435 } 01436 }

BOOL xxxAllowSetForegroundWindow DWORD  dwProcessId  ) 
 

Definition at line 1101 of file focusact.c.

References BOOL, CanForceForeground(), DWORD, EnterCrit, FALSE, glinp, LeaveCrit, LockProcessByClientId(), NT_SUCCESS, NTSTATUS(), NULL, pep, PpiCurrent, PpiFromProcess, tagLASTINPUT::ptiLastWoken, tagPROCESSINFO::ptiList, Status, TRUE, and UnlockProcess.

01103 { 01104 DWORD dwError; 01105 PEPROCESS pep; 01106 NTSTATUS Status; 01107 PPROCESSINFO ppi; 01108 /* 01109 * Get the ppi for dwProcessId 01110 * ASFW_ANY NULLs out the input owner so any process can take the foreground 01111 */ 01112 if (dwProcessId != ASFW_ANY) { 01113 LeaveCrit(); 01114 Status = LockProcessByClientId((HANDLE)LongToHandle( dwProcessId ), &pep); 01115 EnterCrit(); 01116 if (!NT_SUCCESS(Status)) { 01117 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 01118 return FALSE; 01119 } 01120 ppi = PpiFromProcess(pep); 01121 if (ppi == NULL) { 01122 dwError = ERROR_INVALID_PARAMETER; 01123 goto UnlockAndFail; 01124 } 01125 } 01126 /* 01127 * Do nothing if the current process cannot force a foreground change. 01128 * We could have checked this upfront but we didn't since we had to 01129 * leave the crit section and the state could have changed. 01130 */ 01131 if (!CanForceForeground(PpiCurrent())) { 01132 dwError = ERROR_ACCESS_DENIED; 01133 goto UnlockAndFail; 01134 } 01135 /* 01136 * Let's make a thread (if any) of this process be the last input owner 01137 */ 01138 if (dwProcessId != ASFW_ANY) { 01139 TAGMSG2(DBGTAG_FOREGROUND, "xxxAllowSetForegroundWindow by %#p to %#p", PpiCurrent(), ppi); 01140 glinp.ptiLastWoken = ppi->ptiList; 01141 UnlockProcess(pep); 01142 } else { 01143 TAGMSG1(DBGTAG_FOREGROUND, "xxxAllowSetForegroundWindow by %#p to ANY", PpiCurrent()); 01144 glinp.ptiLastWoken = NULL; 01145 } 01146 return TRUE; 01147 01148 UnlockAndFail: 01149 if (dwProcessId != ASFW_ANY) { 01150 UnlockProcess(pep); 01151 } 01152 RIPERR0(dwError, RIP_VERBOSE, ""); 01153 return FALSE; 01154 }

UINT xxxArrangeIconicWindows PWND  pwnd  ) 
 

Definition at line 31 of file icons.c.

References _DeferWindowPos(), _GetProp(), _ScreenToClient(), BOOL, BuildHwndList(), BWL_ENUMLIST, CheckLock, CHECKPOINT, DX_GAP, DY_GAP, FALSE, tagCHECKPOINT::fDragged, tagCHECKPOINT::fMinInitialized, FreeHwndList(), GetRealClientRect(), ghwndSwitch, GRC_SCROLLS, HW, InternalBeginDeferWindowPos(), IsTrayWindow(), max, NULL, PROP_CHECKPOINT, PROPF_INTERNAL, PSMWP, tagCHECKPOINT::ptMin, PW, tagWND::rcWindow, RevalidateHwnd, tagBWL::rghwnd, tagWND::spwndChild, SYSMET, TestWF, ThreadLockAlways, ThreadUnlock, TRUE, UINT, WFMINIMIZED, WFVISIBLE, WHERE_NOONE_CAN_SEE_ME, and xxxEndDeferWindowPosEx().

00033 { 00034 PBWL pbwl; 00035 PSMWP psmwp; 00036 PWND pwndTest, pwndSort, pwndSwitch; 00037 HWND *phwnd, *phwndSort; 00038 CHECKPOINT *pcp, *pcpSort; 00039 POINT ptSort, ptSrc; 00040 WORD nIcons = 0; 00041 RECT rc; 00042 POINT ptMin; 00043 int xOrg, yOrg; 00044 int dx, dy; 00045 int dxSlot, dySlot; 00046 int cIconsPerPass, iIconPass; 00047 BOOL fHorizontal, fBreak; 00048 TL tlpwndTest; 00049 BOOL fHideMe; 00050 00051 CheckLock(pwnd); 00052 00053 /* 00054 * Create a window list of all children of pwnd 00055 */ 00056 if ((pbwl = BuildHwndList(pwnd->spwndChild, BWL_ENUMLIST, NULL)) == NULL) 00057 return 0; 00058 00059 fHideMe = IsTrayWindow(pwnd->spwndChild); 00060 00061 // 00062 // Put these into local vars for efficiency (see ParkIcon()) 00063 // 00064 dxSlot = SYSMET(CXMINSPACING); 00065 dySlot = SYSMET(CYMINSPACING); 00066 00067 // 00068 // We need to adjust the client rectangle if the parent has scrollbars. 00069 // 00070 GetRealClientRect(pwnd, &rc, GRC_SCROLLS, NULL); 00071 00072 /* 00073 * find all icons 00074 */ 00075 pwndSwitch = RevalidateHwnd(ghwndSwitch); 00076 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00077 if (((pwndTest = RevalidateHwnd(*phwnd)) == NULL) || 00078 !TestWF(pwndTest , WFVISIBLE) || 00079 pwndTest == pwndSwitch || 00080 (pcp = (CHECKPOINT *)_GetProp(pwndTest, PROP_CHECKPOINT, 00081 PROPF_INTERNAL)) == NULL) { 00082 *phwnd = NULL; 00083 continue; 00084 } 00085 00086 if (!TestWF(pwndTest, WFMINIMIZED)) { 00087 pcp->fMinInitialized = FALSE; 00088 pcp->ptMin.x = pcp->ptMin.y = -1; 00089 *phwnd = NULL; 00090 continue; 00091 } 00092 00093 /* 00094 * inc count of icons 00095 */ 00096 nIcons++; 00097 00098 /* 00099 * we will park in default position again... 00100 */ 00101 pcp->fDragged = FALSE; 00102 00103 /* 00104 * ensure the original position is up to date 00105 */ 00106 pcp->ptMin.x = pwndTest->rcWindow.left; 00107 pcp->ptMin.y = pwndTest->rcWindow.top; 00108 _ScreenToClient(pwnd, &pcp->ptMin); 00109 00110 // Slide into the nearest row or column 00111 switch (SYSMET(ARRANGE) & ~ARW_HIDE) { 00112 case ARW_TOPLEFT | ARW_RIGHT: 00113 case ARW_TOPRIGHT | ARW_LEFT: 00114 // Slide into top row 00115 pcp->ptMin.y += dySlot / 2; 00116 pcp->ptMin.y -= pcp->ptMin.y % dySlot; 00117 break; 00118 00119 case ARW_TOPLEFT | ARW_DOWN: 00120 case ARW_BOTTOMLEFT | ARW_UP: 00121 // Slide into left column 00122 pcp->ptMin.x += dxSlot / 2; 00123 pcp->ptMin.x -= pcp->ptMin.x % dxSlot; 00124 break; 00125 00126 case ARW_BOTTOMLEFT | ARW_RIGHT: 00127 case ARW_BOTTOMRIGHT | ARW_LEFT: 00128 // Slide into bottom row 00129 pcp->ptMin.y = rc.bottom - pcp->ptMin.y; 00130 pcp->ptMin.y += dySlot / 2; 00131 pcp->ptMin.y -= pcp->ptMin.y % dySlot; 00132 pcp->ptMin.y = rc.bottom - pcp->ptMin.y; 00133 break; 00134 00135 case ARW_BOTTOMRIGHT | ARW_UP: 00136 case ARW_TOPRIGHT | ARW_DOWN: 00137 // Slide into right column 00138 pcp->ptMin.x = rc.right - pcp->ptMin.x; 00139 pcp->ptMin.x += dxSlot / 2; 00140 pcp->ptMin.x -= pcp->ptMin.x % dxSlot; 00141 pcp->ptMin.x = rc.right - pcp->ptMin.x; 00142 break; 00143 } 00144 } 00145 00146 if (nIcons == 0) { 00147 00148 /* 00149 * no icons were found... break out 00150 */ 00151 FreeHwndList(pbwl); 00152 return 0; 00153 } 00154 00155 if (fHideMe) { 00156 ptMin.x = WHERE_NOONE_CAN_SEE_ME; 00157 ptMin.y = WHERE_NOONE_CAN_SEE_ME; 00158 goto JustParkEm; 00159 } 00160 00161 // 00162 // Get gravity && move vars 00163 // 00164 if (SYSMET(ARRANGE) & ARW_STARTRIGHT) { 00165 // Starting on right side 00166 ptMin.x = xOrg = rc.right - dxSlot; 00167 dx = -dxSlot; 00168 } else { 00169 // Starting on left 00170 ptMin.x = xOrg = rc.left + DX_GAP; 00171 dx = dxSlot; 00172 } 00173 00174 if (SYSMET(ARRANGE) & ARW_STARTTOP) { 00175 // Starting on top 00176 ptMin.y = yOrg = rc.top + DY_GAP; 00177 dy = dySlot; 00178 } else { 00179 // Starting on bottom 00180 ptMin.y = yOrg = rc.bottom - dySlot; 00181 dy = -dySlot; 00182 } 00183 00184 // 00185 // Get arrange dir 00186 // 00187 fHorizontal = ( (SYSMET(ARRANGE) & ARW_DOWN) ? FALSE : TRUE ); 00188 00189 iIconPass = fHorizontal ? (rc.right / dxSlot) : (rc.bottom / dySlot); 00190 cIconsPerPass = iIconPass = max(1, iIconPass); 00191 00192 /* 00193 * insertion sort of windows by y, and by x within a row. 00194 */ 00195 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00196 00197 /* 00198 * Check for 0 (window was not icon) and 00199 * Check for invalid HWND (window has been destroyed) 00200 */ 00201 if (*phwnd == NULL || (pwndTest = RevalidateHwnd(*phwnd)) == NULL) 00202 continue; 00203 00204 pcp = (CHECKPOINT *)_GetProp(pwndTest, PROP_CHECKPOINT, 00205 PROPF_INTERNAL); 00206 ptSrc = pcp->ptMin; 00207 00208 fBreak = FALSE; 00209 for (phwndSort = pbwl->rghwnd; phwndSort < phwnd; phwndSort++) { 00210 if (*phwndSort == NULL || 00211 (pwndSort = RevalidateHwnd(*phwndSort)) == NULL) 00212 continue; 00213 00214 pcpSort = (CHECKPOINT*)_GetProp(pwndSort, PROP_CHECKPOINT, 00215 PROPF_INTERNAL); 00216 00217 ptSort = pcpSort->ptMin; 00218 00219 // 00220 // Is this the position in which to sort this min window? 00221 // 00222 switch (SYSMET(ARRANGE) & ~ARW_HIDE) { 00223 case ARW_BOTTOMLEFT | ARW_RIGHT: 00224 // Lower left, moving horizontally 00225 if (((ptSort.y == ptSrc.y) && (ptSort.x > ptSrc.x)) || 00226 (ptSort.y < ptSrc.y)) 00227 fBreak = TRUE; 00228 break; 00229 00230 case ARW_BOTTOMLEFT | ARW_UP: 00231 // Lower left, moving vertically 00232 if (((ptSort.x == ptSrc.x) && (ptSort.y < ptSrc.y)) || 00233 (ptSort.x > ptSrc.x)) 00234 fBreak = TRUE; 00235 break; 00236 00237 case ARW_BOTTOMRIGHT | ARW_LEFT: 00238 // Lower right, moving horizontally 00239 if (((ptSort.y == ptSrc.y) && (ptSort.x < ptSrc.x)) || 00240 (ptSort.y < ptSrc.y)) 00241 fBreak = TRUE; 00242 break; 00243 00244 case ARW_BOTTOMRIGHT | ARW_UP: 00245 // Lower right, moving vertically 00246 if (((ptSort.x == ptSrc.x) && (ptSort.y < ptSrc.y)) || 00247 (ptSort.x < ptSrc.x)) 00248 fBreak = TRUE; 00249 break; 00250 00251 case ARW_TOPLEFT | ARW_RIGHT: 00252 // Top left, moving horizontally 00253 if (((ptSort.y == ptSrc.y) && (ptSort.x > ptSrc.x)) || 00254 (ptSort.y > ptSrc.y)) 00255 fBreak = TRUE; 00256 break; 00257 00258 case ARW_TOPLEFT | ARW_DOWN: 00259 // Top left, moving vertically 00260 if (((ptSort.x == ptSrc.x) && (ptSort.y > ptSrc.y)) || 00261 (ptSort.x > ptSrc.x)) 00262 fBreak = TRUE; 00263 break; 00264 00265 case ARW_TOPRIGHT | ARW_LEFT: 00266 // Top right, moving horizontally 00267 if (((ptSort.y == ptSrc.y) && (ptSort.x < ptSrc.x)) || 00268 (ptSort.y > ptSrc.y)) 00269 fBreak = TRUE; 00270 break; 00271 00272 case ARW_TOPRIGHT | ARW_DOWN: 00273 // Top right, moving vertically 00274 if (((ptSort.x == ptSrc.x) && (ptSort.y > ptSrc.y)) || 00275 (ptSort.x < ptSrc.x)) 00276 fBreak = TRUE; 00277 break; 00278 } 00279 00280 if (fBreak) 00281 break; 00282 } 00283 00284 /* 00285 * insert the window at this position by sliding the rest up. 00286 * LATER IanJa, use hwnd intermediate variables, avoid PW() & HW() 00287 */ 00288 while (phwndSort < phwnd) { 00289 pwndSort = PW(*phwndSort); 00290 *phwndSort = HW(pwndTest); 00291 pwndTest = pwndSort; 00292 phwndSort++; 00293 } 00294 00295 /* 00296 * replace the window handle in the original position 00297 */ 00298 *phwnd = HW(pwndTest); 00299 } 00300 00301 // 00302 // Now park the icons. 00303 // 00304 00305 JustParkEm: 00306 00307 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00308 if (*phwnd == NULL || (pwndTest = RevalidateHwnd(*phwnd)) == NULL) 00309 continue; 00310 00311 pcp = (CHECKPOINT *)_GetProp(pwndTest, PROP_CHECKPOINT, 00312 PROPF_INTERNAL); 00313 if (pcp != NULL) { 00314 pcp->fMinInitialized = TRUE; 00315 pcp->ptMin = ptMin; 00316 } 00317 00318 if (fHideMe) { 00319 continue; 00320 } 00321 00322 // Setup to process the next position 00323 if (--iIconPass <= 0) { 00324 // Need to setup next pass 00325 iIconPass = cIconsPerPass; 00326 00327 if (fHorizontal) { 00328 ptMin.x = xOrg; 00329 ptMin.y += dy; 00330 } else { 00331 ptMin.x += dx; 00332 ptMin.y = yOrg; 00333 } 00334 } else { 00335 // Same pass 00336 if (fHorizontal) 00337 ptMin.x += dx; 00338 else 00339 ptMin.y += dy; 00340 } 00341 } 00342 00343 psmwp = InternalBeginDeferWindowPos(2 * nIcons); 00344 if (psmwp == NULL) 00345 goto ParkExit; 00346 00347 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00348 00349 /* 00350 * Check for a NULL (window has gone away) 00351 */ 00352 if (*phwnd == NULL || (pwndTest = RevalidateHwnd(*phwnd)) == NULL) 00353 continue; 00354 00355 pcp = (CHECKPOINT *)_GetProp(pwndTest, PROP_CHECKPOINT, 00356 PROPF_INTERNAL); 00357 00358 00359 ThreadLockAlways(pwndTest, &tlpwndTest); 00360 00361 psmwp = _DeferWindowPos( 00362 psmwp, 00363 pwndTest, 00364 NULL, 00365 pcp->ptMin.x, 00366 pcp->ptMin.y, 00367 SYSMET(CXMINIMIZED), 00368 SYSMET(CYMINIMIZED), 00369 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS); 00370 00371 ThreadUnlock(&tlpwndTest); 00372 00373 if (psmwp == NULL) 00374 break; 00375 } 00376 if (psmwp != NULL) { 00377 /* 00378 * Make the swp async so we don't hang waiting for hung apps. 00379 */ 00380 xxxEndDeferWindowPosEx(psmwp, TRUE); 00381 } 00382 00383 ParkExit: 00384 FreeHwndList(pbwl); 00385 return nIcons; 00386 }

HDC xxxBeginPaint PWND  pwnd,
PAINTSTRUCT *  lpps
 

Referenced by NtUserBeginPaint(), xxxDesktopWndProc(), xxxDWP_Paint(), xxxMenuWindowProc(), xxxSBWndProc(), and xxxTooltipWndProc().

BOOL xxxbFullscreenSwitch BOOL  bFullscreenSwitch,
HWND  hwnd
 

Definition at line 1545 of file fullscr.c.

References BOOL, FALSE, gbFullScreen, GetFullScreen, idSwitcher, NOSWITCHER, PUDF_ANIMATE, TEST_PUDF, ThreadLock, ThreadUnlock, TRACE_INIT, TRUE, ValidateHwnd, xxxMakeWindowForegroundWithState(), xxxShowWindow(), xxxSleepThread(), and xxxUpdateWindow().

Referenced by xxxConsoleControl().

01548 { 01549 01550 PWND pwnd; 01551 TL tlpwnd; 01552 BOOL bStat = TRUE; 01553 01554 pwnd = ValidateHwnd(hwnd); 01555 01556 if (!pwnd) { 01557 return DISP_CHANGE_BADPARAM; 01558 } 01559 01560 /* 01561 * Lock the PWND, if it is provided 01562 */ 01563 01564 ThreadLock(pwnd, &tlpwnd); 01565 01566 /* 01567 * We don't want our mode switch to be posted on the looping thread. 01568 * So let's loop until the system has settled down and no mode switch 01569 * is currently occuring. 01570 */ 01571 01572 while (idSwitcher != NOSWITCHER) { 01573 /* 01574 * Make sure we aren't blocking anyone who's sending us a message. 01575 * They can have idSwitcher and never release it because they are 01576 * waiting on us to process the sent message. And we're waiting on 01577 * idSwitcher, hence a deadlock. 01578 */ 01579 xxxSleepThread(0, 1, FALSE); 01580 } 01581 01582 /* 01583 * If there is a window, we want to check the state of the window. 01584 * For most calls, we want to ensure we are in windowed mode. 01585 * However, for Console, we want to make sure we are in fullscreen mode. 01586 * So differentiate between the two. We will check if the TEXTMODE 01587 * flag is passed in the DEVMODE. 01588 */ 01589 01590 if (bFullscreenSwitch) { 01591 01592 if (GetFullScreen(pwnd) != FULLSCREEN) { 01593 01594 xxxShowWindow(pwnd, SW_SHOWMINIMIZED | TEST_PUDF(PUDF_ANIMATE)); 01595 01596 xxxUpdateWindow(pwnd); 01597 } 01598 01599 if (!xxxMakeWindowForegroundWithState(pwnd, FULLSCREEN)) { 01600 goto FullscreenSwitchFailed; 01601 } 01602 01603 if ((idSwitcher != NOSWITCHER) || 01604 (gbFullScreen != FULLSCREEN)) { 01605 goto FullscreenSwitchFailed; 01606 } 01607 01608 } else { 01609 01610 /* 01611 * For the console windows, we want to call with WINDOWED 01612 */ 01613 01614 if (!xxxMakeWindowForegroundWithState(pwnd, WINDOWED)) { 01615 goto FullscreenSwitchFailed; 01616 } 01617 01618 if ((idSwitcher != NOSWITCHER) || 01619 (gbFullScreen != GDIFULLSCREEN)) { 01620 01621 FullscreenSwitchFailed: 01622 TRACE_INIT(("ChangeDisplaySettings: Can not switch out of fullscreen\n")); 01623 bStat = FALSE; 01624 } 01625 } 01626 01627 ThreadUnlock(&tlpwnd); 01628 01629 return bStat; 01630 }

VOID xxxBroadcastDisplaySettingsChange PDESKTOP  ,
BOOL 
 

Definition at line 1797 of file fullscr.c.

References BMSG_SENDNOTIFYMSG, gpsi, NULL, tagDESKTOP::pDeskInfo, tagDESKTOPINFO::spwnd, SYSMET, and xxxBroadcastMessage().

Referenced by xxxResetDisplayDevice(), and xxxSwitchDesktop().

01800 { 01801 01802 /* 01803 * Broadcast that the display has changed resolution. We are going 01804 * to specify the desktop for the changing-desktop. That way we 01805 * don't get confused as to what desktop to broadcast to. 01806 */ 01807 xxxBroadcastMessage(pdesk->pDeskInfo->spwnd, 01808 WM_DISPLAYCHANGE, 01809 gpsi->BitCount, 01810 MAKELONG(SYSMET(CXSCREEN), SYSMET(CYSCREEN)), 01811 BMSG_SENDNOTIFYMSG, 01812 NULL); 01813 01814 /* 01815 * Broadcast a color-change if requested to do so. 01816 */ 01817 01818 if (bBroadcastColorChange){ 01819 #if 1 // We might want to remove this call, since color-change seems 01820 // to provide apps the notification. Need to review 01821 // chriswil - 06/11/96 01822 01823 xxxBroadcastMessage(pdesk->pDeskInfo->spwnd, 01824 WM_SETTINGCHANGE, 01825 0, 01826 0, 01827 BMSG_SENDNOTIFYMSG, 01828 NULL); 01829 #endif 01830 01831 xxxBroadcastMessage(pdesk->pDeskInfo->spwnd, 01832 WM_SYSCOLORCHANGE, 01833 0, 01834 0, 01835 BMSG_SENDNOTIFYMSG, 01836 NULL); 01837 } 01838 01839 }

VOID xxxBroadcastImeShowStatusChange IN PWND  pwndDefIme,
IN BOOL  fShow
 

LONG xxxBroadcastMessage PWND  ,
UINT  ,
WPARAM  ,
LPARAM  ,
UINT  ,
PBROADCASTMSG 
 

Definition at line 2937 of file kernel/sendmsg.c.

Referenced by _PostMessage(), xxxBroadcastDisplaySettingsChange(), xxxSendMessageCallback(), xxxSendMessageTimeout(), xxxSystemBroadcastMessage(), and xxxUserResetDisplayDevice().

02946 : 02947 * 02-21-91 DavidPe Created. 02948 \***************************************************************************/ 02949 02950 LONG xxxBroadcastMessage( 02951 PWND pwnd, 02952 UINT message, 02953 WPARAM wParam, 02954 LPARAM lParam, 02955 UINT wCmd, 02956 PBROADCASTMSG pbcm) 02957 { 02958 PBWL pbwl; 02959 HWND *phwnd; 02960 TL tlpwnd; 02961 PASYNCSENDMSG pmsg; 02962 PPROCESSINFO ppiCurrent; 02963 LONG lRet = TRUE; 02964 TL tlPool; 02965 PTHREADINFO ptiCurrent = PtiCurrent(); 02966 BOOL fPrivateMessage = (message >= WM_USER) && (message < MAXINTATOM); 02967 02968 if (fPrivateMessage) { 02969 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Attempt to broadcast a private message"); 02970 } 02971 02972 if (pwnd == NULL) { 02973 LARGE_UNICODE_STRING str; 02974 PLARGE_STRING pstr; 02975 02976 /* 02977 * Handle special system-wide broadcasts. 02978 */ 02979 switch (message) { 02980 case WM_SPOOLERSTATUS: 02981 xxxSystemBroadcastMessage(message, wParam, lParam, wCmd, pbcm); 02982 return 1; 02983 02984 case WM_WININICHANGE: 02985 case WM_DEVMODECHANGE: 02986 02987 /* 02988 * Probe and capture the string. 02989 */ 02990 if (lParam) { 02991 UINT cbAlloc; 02992 NTSTATUS Status; 02993 02994 /* 02995 * Allocate a temp buffer and convert 02996 * the string to Unicode 02997 */ 02998 pstr = ((PLARGE_STRING)lParam); 02999 if (pstr->bAnsi) 03000 cbAlloc = (pstr->Length + 1) * sizeof(WCHAR); 03001 else 03002 cbAlloc = pstr->Length + sizeof(WCHAR); 03003 str.Buffer = UserAllocPoolWithQuota(cbAlloc, TAG_SMS_STRING); 03004 if (str.Buffer == NULL) { 03005 return 0; 03006 } 03007 str.MaximumLength = cbAlloc; 03008 str.bAnsi = FALSE; 03009 try { 03010 if (pstr->bAnsi) { 03011 Status = RtlMultiByteToUnicodeN( 03012 (PWCH)str.Buffer, 03013 cbAlloc, 03014 &cbAlloc, 03015 (PCH)pstr->Buffer, 03016 pstr->Length 03017 ); 03018 str.Length = cbAlloc; 03019 } else { 03020 str.Length = pstr->Length; 03021 RtlCopyMemory(str.Buffer, pstr->Buffer, str.Length); 03022 Status = STATUS_SUCCESS; 03023 } 03024 str.Buffer[str.Length / sizeof(WCHAR)] = 0; 03025 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 03026 Status = GetExceptionCode(); 03027 } 03028 if (!NT_SUCCESS(Status)) { 03029 UserFreePool(str.Buffer); 03030 return 0; 03031 } 03032 pstr->Buffer = str.Buffer; 03033 } 03034 if (lParam) { 03035 ThreadLockPool(ptiCurrent, str.Buffer, &tlPool); 03036 } 03037 xxxSystemBroadcastMessage(message, wParam, 03038 lParam ? (LPARAM)&str : 0, wCmd, pbcm); 03039 if (lParam) 03040 ThreadUnlockAndFreePool(ptiCurrent, &tlPool); 03041 return 1; 03042 03043 case WM_TIMECHANGE: 03044 /* 03045 * We automatically broadcast a WM_TIMECHANGE message whenever the 03046 * kernel tells us the time has changed, so blow off any apps who 03047 * are trying to do the same thing. 03048 */ 03049 if (!(ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD)) { 03050 RIPMSG0(RIP_WARNING, "Only system should broadcast WM_TIMECHANGE"); 03051 return 0; 03052 } 03053 break; 03054 } 03055 03056 UserAssert(ptiCurrent->rpdesk); 03057 03058 pwnd = ptiCurrent->rpdesk->pDeskInfo->spwnd; 03059 03060 if (pwnd == NULL) { 03061 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, "sender must have an associated desktop"); 03062 return 0; 03063 } 03064 } 03065 03066 pbwl = BuildHwndList(pwnd->spwndChild, BWL_ENUMLIST, NULL); 03067 if (pbwl == NULL) 03068 return 0; 03069 03070 ppiCurrent = PpiCurrent(); 03071 03072 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 03073 03074 /* 03075 * Make sure this hwnd is still around. 03076 */ 03077 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 03078 continue; 03079 03080 /* 03081 * Make sure this window can handle broadcast messages 03082 */ 03083 if (!fBroadcastProc(pwnd)) 03084 continue; 03085 03086 if (fPrivateMessage && TestWF(pwnd, WFWIN40COMPAT)) { // Don't broadcast 03087 continue; // private message 03088 } // to 4.0 apps. 03089 03090 /* 03091 * Don't bother sending palette messages to windows that are not 03092 * visible on threads that are not palette aware. 03093 */ 03094 if ((message == WM_PALETTEISCHANGING || message == WM_PALETTECHANGED) && 03095 !TestWF(pwnd, WFVISIBLE) && 03096 !(GETPTI(pwnd)->TIF_flags & TIF_PALETTEAWARE)) { 03097 continue; 03098 } 03099 03100 ThreadLockAlways(pwnd, &tlpwnd); 03101 03102 switch (wCmd) { 03103 case BMSG_SENDMSG: 03104 xxxSendMessage(pwnd, message, wParam, lParam); 03105 break; 03106 03107 case BMSG_SENDNOTIFYMSG: 03108 { 03109 ATOM Atom = 0; 03110 03111 switch (message) { 03112 case WM_WININICHANGE: 03113 case WM_DEVMODECHANGE: 03114 if (lParam) { 03115 PLARGE_STRING pstr = (PLARGE_STRING)lParam; 03116 03117 /* 03118 * Convert strings to atoms for the post. 03119 */ 03120 if (pstr) 03121 Atom = UserAddAtom(pstr->Buffer, FALSE); 03122 if (!Atom) { 03123 lRet = FALSE; 03124 break; 03125 } 03126 } 03127 03128 /* 03129 * These messages need to be able to cross 03130 * desktops so PostEvent 'em. 03131 */ 03132 pmsg = UserAllocPool(sizeof(ASYNCSENDMSG), 03133 TAG_SMS_ASYNC); 03134 if (pmsg == NULL) { 03135 goto CleanupAtom; 03136 } 03137 03138 pmsg->hwnd = *phwnd; 03139 pmsg->message = message; 03140 pmsg->wParam = wParam; 03141 pmsg->lParam = Atom; 03142 03143 if (!PostEventMessage(GETPTI(pwnd), GETPTI(pwnd)->pq, 03144 QEVENT_ASYNCSENDMSG,NULL, 0, 03145 (WPARAM)pmsg, 0)) { 03146 03147 UserFreePool(pmsg); 03148 CleanupAtom: 03149 if (Atom) { 03150 UserDeleteAtom(Atom); 03151 } 03152 lRet = FALSE; 03153 } 03154 break; 03155 03156 default: 03157 /* 03158 * A regular kind of guy. No desktop crossing. 03159 */ 03160 xxxSendNotifyMessage(pwnd, message, wParam, lParam); 03161 break; 03162 } 03163 } 03164 break; 03165 03166 case BMSG_SENDNOTIFYMSGPROCESS: 03167 UserAssert(message != WM_WININICHANGE && message != WM_DEVMODECHANGE); 03168 03169 /* 03170 * Intra-process messages are synchronous; 22238. 03171 * WM_PALETTECHANGED was being sent after the WM_DESTROY 03172 * but console thread must not be synchronous. 03173 */ 03174 if ((GETPTI(pwnd)->ppi == ppiCurrent) && !(GETPTI(pwnd)->TIF_flags & TIF_CSRSSTHREAD)) { 03175 xxxSendMessage(pwnd, message, wParam, lParam); 03176 } else { 03177 xxxSendNotifyMessage(pwnd, message, wParam, lParam); 03178 } 03179 break; 03180 03181 case BMSG_POSTMSG: 03182 /* 03183 * Don't broadcast-post to owned windows (Win3.1 compatiblilty) 03184 */ 03185 if (pwnd->spwndOwner == NULL) 03186 _PostMessage(pwnd, message, wParam, lParam); 03187 break; 03188 03189 case BMSG_SENDMSGCALLBACK: 03190 xxxSendMessageCallback(pwnd, message, wParam, lParam, 03191 pbcm->cb.lpResultCallBack, pbcm->cb.dwData, pbcm->cb.bClientRequest); 03192 break; 03193 03194 case BMSG_SENDMSGTIMEOUT: 03195 xxxSendMessageTimeout(pwnd, message, wParam, lParam, 03196 pbcm->to.fuFlags, pbcm->to.uTimeout, pbcm->to.lpdwResult); 03197 break; 03198 } 03199 03200 ThreadUnlock(&tlpwnd); 03201 } 03202 FreeHwndList(pbwl);

VOID xxxBroadcastPaletteChanged PWND  pwnd,
BOOL  fForceDesktop
 

Definition at line 243 of file palette.c.

References CheckLock, HWq, L, PWND_BROADCAST, PWNDDESKTOP, ThreadLockAlways, ThreadUnlock, VOID(), xxxRealizeDesktop(), and xxxSendNotifyMessage().

Referenced by xxxFlushPalette(), and xxxRealizePalette().

00244 { 00245 PWND pwndDesk; 00246 HWND hwnd = HWq(pwnd); 00247 00248 CheckLock(pwnd); 00249 00250 pwndDesk = PWNDDESKTOP(pwnd); 00251 if (fForceDesktop || pwnd != pwndDesk) { 00252 TL tlpwndDesk; 00253 ThreadLockAlways(pwndDesk, &tlpwndDesk); 00254 xxxRealizeDesktop(pwndDesk); 00255 ThreadUnlock(&tlpwndDesk); 00256 } 00257 00258 xxxSendNotifyMessage(PWND_BROADCAST, WM_PALETTECHANGED, (WPARAM)hwnd, 0L); 00259 }

VOID xxxButtonEvent DWORD  ButtonNumber,
POINT  ptPointer,
BOOL  fBreak,
DWORD  time,
ULONG_PTR  ExtraInfo,
BOOL  bInjected,
BOOL  fDblClk
 

Definition at line 472 of file ntinput.c.

References _PostMessage(), BOOL, CFIME, CheckCritIn, CMSHUNGAPPTIMEOUT, tagTHREADINFO::dwExpWinVer, DWORD, tagWINDOWSTATION::dwWSF_Flags, EVENT_INCREMENT, FALSE, FHungApp(), gbMouseButtonsRecentlySwapped, GetActiveHKL(), GetAppImeCompatFlags(), GETPTI, GetTopLevelWindow(), glinp, gpEventHungThread, gpqForeground, gpsi, grpdeskRitInput, gspwndAltTab, gspwndMouseOwner, gspwndScreenCapture, gwMouseOwnerButton, IS_IME_ENABLED, IsMenuStarted(), ISTS, KeSetEvent(), Lock, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_X1, MOUSE_BUTTON_X2, MouseKeys(), NULL, tagDESKTOP::pDeskInfo, PhkFirstValid(), PostEventMessage(), PostInputMessage(), PostMove(), PtiCurrent, tagLASTINPUT::ptiLastWoken, tagQ::ptiMouse, tagLASTINPUT::ptLastClick, PwndForegroundCapture(), QEVENT_CANCELMODE, QF_MOUSEMOVED, tagDESKTOP::rpwinstaParent, SHORT, SpeedHitTest(), tagDESKTOPINFO::spwnd, tagQ::spwndCapture, tagTHREADINFO::spwndDefaultIme, SYSMET, TEST_ACCESSFLAG, TestAsyncKeyStateDown, TestCF, TestWF, ThreadLockAlways, ThreadUnlock, UINT, Unlock, UpdateAsyncKeyState(), VER40, VOID(), WEFNOACTIVATE, WFINDESTROY, WSF_NOIO, xxxCallHook2(), xxxCancelCoolSwitch(), xxxHardwareMouseKeyUp(), and xxxSetForegroundWindow2().

Referenced by xxxDoButtonEvent(), xxxMKButtonSetState(), and xxxRemoteStopScreenUpdates().

00480 { 00481 UINT message, usVK, usOtherVK, wHardwareButton; 00482 PWND pwnd; 00483 LPARAM lParam; 00484 WPARAM wParam; 00485 int xbutton; 00486 TL tlpwnd; 00487 PHOOK pHook; 00488 00489 #ifdef REDIRECTION 00490 PWND pwndStart; 00491 #endif // REDIRECTION 00492 00493 CheckCritIn(); 00494 00495 00496 /* 00497 * Cancel Alt-Tab if the user presses a mouse button 00498 */ 00499 if (gspwndAltTab != NULL) { 00500 xxxCancelCoolSwitch(); 00501 } 00502 00503 /* 00504 * Grab the mouse button before we process any button swapping. 00505 * This is so we won't get confused if someone calls 00506 * SwapMouseButtons() inside a down-click/up-click. 00507 */ 00508 wHardwareButton = (UINT)ButtonNumber; 00509 00510 /* 00511 * If this is the left or right mouse button, we have to handle mouse 00512 * button swapping. 00513 */ 00514 if (ButtonNumber & (MOUSE_BUTTON_LEFT | MOUSE_BUTTON_RIGHT)) { 00515 /* 00516 * If button swapping is on, swap the mouse buttons 00517 */ 00518 if (SYSMET(SWAPBUTTON)) { 00519 ButtonNumber ^= (MOUSE_BUTTON_LEFT | MOUSE_BUTTON_RIGHT); 00520 } 00521 00522 /* 00523 * Figure out VK 00524 */ 00525 if (ButtonNumber == MOUSE_BUTTON_RIGHT) { 00526 usVK = VK_RBUTTON; 00527 usOtherVK = VK_LBUTTON; 00528 } else if (ButtonNumber == MOUSE_BUTTON_LEFT) { 00529 usVK = VK_LBUTTON; 00530 usOtherVK = VK_RBUTTON; 00531 } else { 00532 RIPMSG1(RIP_ERROR, "Unexpected Button number %d", ButtonNumber); 00533 } 00534 00535 /* 00536 * If the mouse buttons have recently been swapped AND the button 00537 * transition doesn't match what we have in our keystate, then swap the 00538 * button to match. 00539 * This is to fix the ruler (tabs and margins) in Word 97 SR1, which 00540 * calls SwapMouseButtons(0) to determine if button swapping is on, and 00541 * if so then calls SwapMouseButtons(1) to restore it: if we receive a 00542 * button event between these two calls, we may swap incorrectly, and 00543 * be left with a mouse button stuck down or see the wrong button going 00544 * down. This really messed up single/double button tab/margin setting! 00545 * The same bug shows up under Windows '95, although very infrequently: 00546 * Word 9 will use GetSystemMetrics(SM_SWAPBUTTON) instead according to 00547 * to Mark Walker (MarkWal). (IanJa) #165157 00548 */ 00549 if (gbMouseButtonsRecentlySwapped) { 00550 if ((!fBreak == !!TestAsyncKeyStateDown(usVK)) && 00551 (fBreak == !!TestAsyncKeyStateDown(usOtherVK))) { 00552 RIPMSG4(RIP_WARNING, "Correct %s %s to %s %s", 00553 ButtonNumber == MOUSE_BUTTON_LEFT ? "Left" : "Right", 00554 fBreak ? "Up" : "Down", 00555 ButtonNumber == MOUSE_BUTTON_LEFT ? "Right" : "Left", 00556 fBreak ? "Up" : "Down"); 00557 ButtonNumber ^= (MOUSE_BUTTON_LEFT | MOUSE_BUTTON_RIGHT); 00558 usVK = usOtherVK; 00559 } 00560 gbMouseButtonsRecentlySwapped = FALSE; 00561 } 00562 } 00563 00564 xbutton = 0; 00565 switch (ButtonNumber) { 00566 case MOUSE_BUTTON_RIGHT: 00567 if (fBreak) { 00568 message = WM_RBUTTONUP; 00569 } else { 00570 if (ISTS() && fDblClk) 00571 message = WM_RBUTTONDBLCLK; 00572 else 00573 message = WM_RBUTTONDOWN; 00574 } 00575 break; 00576 00577 case MOUSE_BUTTON_LEFT: 00578 if (fBreak) { 00579 message = WM_LBUTTONUP; 00580 } else { 00581 if (ISTS() && fDblClk) 00582 message = WM_LBUTTONDBLCLK; 00583 else 00584 message = WM_LBUTTONDOWN; 00585 } 00586 break; 00587 00588 case MOUSE_BUTTON_MIDDLE: 00589 if (fBreak) { 00590 message = WM_MBUTTONUP; 00591 } else { 00592 if (ISTS() && fDblClk) 00593 message = WM_MBUTTONDBLCLK; 00594 else 00595 message = WM_MBUTTONDOWN; 00596 } 00597 usVK = VK_MBUTTON; 00598 break; 00599 00600 case MOUSE_BUTTON_X1: 00601 case MOUSE_BUTTON_X2: 00602 if (fBreak) { 00603 message = WM_XBUTTONUP; 00604 } else { 00605 if (ISTS() && fDblClk) 00606 message = WM_XBUTTONDBLCLK; 00607 else 00608 message = WM_XBUTTONDOWN; 00609 } 00610 00611 if (ButtonNumber == MOUSE_BUTTON_X1) { 00612 usVK = VK_XBUTTON1; 00613 xbutton = XBUTTON1; 00614 } else { 00615 usVK = VK_XBUTTON2; 00616 xbutton = XBUTTON2; 00617 } 00618 break; 00619 00620 default: 00621 /* 00622 * Unknown button. Since we don't 00623 * have messages for these buttons, ignore them. 00624 */ 00625 return; 00626 } 00627 UserAssert(usVK != 0); 00628 00629 wParam = MAKEWPARAM(0, xbutton); 00630 00631 /* 00632 * Call low level mouse hooks to see if they allow this message 00633 * to pass through USER 00634 */ 00635 if ((pHook = PhkFirstValid(PtiCurrent(), WH_MOUSE_LL)) != NULL) { 00636 MSLLHOOKSTRUCT mslls; 00637 BOOL bAnsiHook; 00638 00639 mslls.pt = ptPointer; 00640 mslls.mouseData = (LONG)wParam; 00641 mslls.flags = bInjected; 00642 mslls.time = time; 00643 mslls.dwExtraInfo = ExtraInfo; 00644 00645 if (xxxCallHook2(pHook, HC_ACTION, (DWORD)message, (LPARAM)&mslls, &bAnsiHook)) { 00646 return; 00647 } 00648 } 00649 00650 /* 00651 * This is from HYDRA 00652 */ 00653 UserAssert(grpdeskRitInput != NULL); 00654 00655 #ifdef REDIRECTION 00656 /* 00657 * Call the speed hit test hook 00658 */ 00659 pwndStart = xxxCallSpeedHitTestHook(&ptPointer); 00660 if (pwndStart == NULL) { 00661 pwndStart = grpdeskRitInput->pDeskInfo->spwnd; 00662 } 00663 00664 pwnd = SpeedHitTest(pwndStart, ptPointer); 00665 #else 00666 pwnd = SpeedHitTest(grpdeskRitInput->pDeskInfo->spwnd, ptPointer); 00667 #endif // REDIRECTION 00668 00669 /* 00670 * Only post the message if we actually hit a window. 00671 */ 00672 if (pwnd == NULL) 00673 return; 00674 00675 /* 00676 * Assign the message to a window. 00677 */ 00678 lParam = MAKELONG((SHORT)ptPointer.x, (SHORT)ptPointer.y); 00679 00680 /* 00681 * KOREAN: 00682 * Send VK_PROCESSKEY to finalize current composition string (NT4 behavior) 00683 * Post private message to let IMM finalize the composition string (NT5) 00684 */ 00685 if (IS_IME_ENABLED() && 00686 !fBreak && 00687 KOREAN_KBD_LAYOUT(GetActiveHKL()) && 00688 !TestCF(pwnd, CFIME) && 00689 gpqForeground != NULL) { 00690 00691 PTHREADINFO ptiWnd = GETPTI(pwnd); 00692 00693 /* 00694 * 274007: MFC flushes mouse related messages if keyup is posted 00695 * while it's in context help mode. 00696 */ 00697 if (gpqForeground->spwndCapture == NULL && 00698 /* 00699 * Hack for OnScreen Keyboard: no finalization on button event. 00700 */ 00701 (GetAppImeCompatFlags(ptiWnd) & IMECOMPAT_NOFINALIZECOMPSTR) == 0) { 00702 00703 if (ptiWnd->dwExpWinVer > VER40) { 00704 PWND pwndIme = ptiWnd->spwndDefaultIme; 00705 00706 if (pwndIme && !TestWF(pwndIme, WFINDESTROY)) { 00707 /* 00708 * For new applications, we no longer post hacky WM_KEYUP. 00709 * Instead, we use private IME_SYSTEM message. 00710 */ 00711 _PostMessage(pwndIme, WM_IME_SYSTEM, IMS_FINALIZE_COMPSTR, 0); 00712 } 00713 } else { 00714 /* 00715 * For the backward compatibility w/NT4, we post WM_KEYUP to finalize 00716 * the composition string. 00717 */ 00718 PostInputMessage(gpqForeground, NULL, WM_KEYUP, VK_PROCESSKEY, 0, 0, 0); 00719 } 00720 } 00721 } 00722 00723 /* 00724 * If screen capture is active do it 00725 */ 00726 if (gspwndScreenCapture != NULL) 00727 pwnd = gspwndScreenCapture; 00728 00729 /* 00730 * If this is a button down event and there isn't already 00731 * a mouse owner, setup the mouse ownership globals. 00732 */ 00733 if (gspwndMouseOwner == NULL) { 00734 if (!fBreak) { 00735 PWND pwndCapture; 00736 00737 /* 00738 * BIG HACK: If the foreground window has the capture 00739 * and the mouse is outside the foreground queue then 00740 * send a buttondown/up pair to that queue so it'll 00741 * cancel it's modal loop. 00742 */ 00743 if (pwndCapture = PwndForegroundCapture()) { 00744 00745 if (GETPTI(pwnd)->pq != GETPTI(pwndCapture)->pq) { 00746 PQ pqCapture; 00747 00748 pqCapture = GETPTI(pwndCapture)->pq; 00749 PostInputMessage(pqCapture, pwndCapture, message, 00750 0, lParam, 0, 0); 00751 PostInputMessage(pqCapture, pwndCapture, message + 1, 00752 0, lParam, 0, 0); 00753 00754 /* 00755 * EVEN BIGGER HACK: To maintain compatibility 00756 * with how tracking deals with this, we don't 00757 * pass this event along. This prevents mouse 00758 * clicks in other windows from causing them to 00759 * become foreground while tracking. The exception 00760 * to this is when we have the sysmenu up on 00761 * an iconic window. 00762 */ 00763 if ((GETPTI(pwndCapture)->pmsd != NULL) && 00764 !IsMenuStarted(GETPTI(pwndCapture))) { 00765 return; 00766 } 00767 } 00768 } 00769 00770 Lock(&(gspwndMouseOwner), pwnd); 00771 gwMouseOwnerButton |= wHardwareButton; 00772 glinp.ptLastClick = gpsi->ptCursor; 00773 } else { 00774 00775 /* 00776 * The mouse owner must have been destroyed or unlocked 00777 * by a fullscreen switch. Keep the button state in sync. 00778 */ 00779 gwMouseOwnerButton &= ~wHardwareButton; 00780 } 00781 00782 } else { 00783 00784 /* 00785 * Give any other button events to the mouse-owner window 00786 * to be consistent with old capture semantics. 00787 */ 00788 if (gspwndScreenCapture == NULL) { 00789 /* 00790 * NT5 Foreground and Drag Drop. 00791 * If the mouse goes up on a different thread 00792 * make the mouse up thread the owner of this click 00793 */ 00794 if (fBreak && (GETPTI(pwnd) != GETPTI(gspwndMouseOwner))) { 00795 glinp.ptiLastWoken = GETPTI(pwnd); 00796 TAGMSG1(DBGTAG_FOREGROUND, "xxxButtonEvent. ptiLastWoken %#p", glinp.ptiLastWoken); 00797 } 00798 pwnd = gspwndMouseOwner; 00799 } 00800 00801 /* 00802 * If this is the button-up event for the mouse-owner 00803 * clear gspwndMouseOwner. 00804 */ 00805 if (fBreak) { 00806 gwMouseOwnerButton &= ~wHardwareButton; 00807 if (!gwMouseOwnerButton) 00808 Unlock(&gspwndMouseOwner); 00809 } else { 00810 gwMouseOwnerButton |= wHardwareButton; 00811 } 00812 } 00813 00814 /* 00815 * Only update the async keystate when we know which window this 00816 * event goes to (or else we can't keep the thread specific key 00817 * state in sync). 00818 */ 00819 UserAssert(usVK != 0); 00820 UpdateAsyncKeyState(GETPTI(pwnd)->pq, usVK, fBreak); 00821 00822 /* 00823 * Put pwnd into the foreground if this is a button down event 00824 * and it isn't already the foreground window. 00825 */ 00826 if (!fBreak && GETPTI(pwnd)->pq != gpqForeground) { 00827 /* 00828 * If this is an WM_*BUTTONDOWN on a desktop window just do 00829 * cancel-mode processing. Check to make sure that there 00830 * wasn't already a mouse owner window. See comments below. 00831 */ 00832 if ((gpqForeground != NULL) && (pwnd == grpdeskRitInput->pDeskInfo->spwnd) && 00833 ((gwMouseOwnerButton & wHardwareButton) || 00834 (gwMouseOwnerButton == 0))) { 00835 PostEventMessage(gpqForeground->ptiMouse, 00836 gpqForeground, QEVENT_CANCELMODE, NULL, 0, 0, 0); 00837 00838 } else if ((gwMouseOwnerButton & wHardwareButton) || 00839 (gwMouseOwnerButton == 0)) { 00840 00841 /* 00842 * Don't bother setting the foreground window if there's 00843 * already mouse owner window from a button-down different 00844 * than this event. This prevents weird things from happening 00845 * when the user starts a tracking operation with the left 00846 * button and clicks the right button during the tracking 00847 * operation. 00848 */ 00849 /* 00850 * If pwnd is a descendent of a WS_EX_NOACTIVATE window, then we 00851 * won't set it to the foreground 00852 */ 00853 PWND pwndTopLevel = GetTopLevelWindow(pwnd); 00854 if (!TestWF(pwndTopLevel, WEFNOACTIVATE)) { 00855 ThreadLockAlways(pwnd, &tlpwnd); 00856 xxxSetForegroundWindow2(pwnd, NULL, 0); 00857 /* 00858 * Ok to unlock right away: the above didn't really leave the crit sec. 00859 * We lock here for consistency so the debug macros work ok. 00860 */ 00861 ThreadUnlock(&tlpwnd); 00862 00863 } 00864 } 00865 } 00866 00867 if (GETPTI(pwnd)->pq->QF_flags & QF_MOUSEMOVED) { 00868 PostMove(GETPTI(pwnd)->pq); 00869 } 00870 00871 PostInputMessage(GETPTI(pwnd)->pq, pwnd, message, wParam, lParam, time, ExtraInfo); 00872 00873 /* 00874 * If this is a mouse up event and stickykeys is enabled all latched 00875 * keys will be released. 00876 */ 00877 if (fBreak && (TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) || 00878 TEST_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON))) { 00879 xxxHardwareMouseKeyUp(ButtonNumber); 00880 } 00881 00882 if (message == WM_LBUTTONDOWN) { 00883 PDESKTOP pdesk = GETPTI(pwnd)->rpdesk; 00884 if (pdesk != NULL && pdesk->rpwinstaParent != NULL) { 00885 00886 UserAssert(!(pdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)); 00887 00888 #ifdef HUNGAPP_GHOSTING 00889 if (FHungApp(GETPTI(pwnd), CMSHUNGAPPTIMEOUT)) { 00890 SignalGhost(pwnd); 00891 } 00892 #else // HUNGAPP_GHOSTING 00893 KeSetEvent(gpEventHungThread, EVENT_INCREMENT, FALSE); 00894 #endif // HUNGAPP_GHOSTING 00895 } 00896 } 00897 }

VOID xxxCalcClientRect PWND  pwnd,
LPRECT  lprc,
BOOL  fHungRedraw
 

Definition at line 21 of file calcclrc.c.

References BOOL, BYTE, CheckLock, ClrWF, CopyRect, FALSE, FWINABLE, GetCaptionHeight(), GetWindowBorders(), InflateRect(), IsWinEventNotifyDeferredOK, LOBYTE, SetWF, tagWND::spmenu, TestWF, TestwndChild, ThreadLockAlways, ThreadUnlock, TRUE, WEF_USEPWNDTHREAD, WEFCLIENTEDGE, WEFLEFTSCROLL, WFBORDERMASK, WFCAPTION, WFCEPRESENT, WFCPRESENT, WFFRAMEPRESENTMASK, WFHPRESENT, WFHSCROLL, WFMINIMIZED, WFMPRESENT, WFVPRESENT, WFVSCROLL, WFWIN40COMPAT, xxxMenuBarCompute(), and xxxWindowEvent().

Referenced by xxxDefWindowProc(), xxxRedrawHungWindow(), and xxxUpdateClientRect().

00025 { 00026 int cxFrame, yTopOld; 00027 RECT rcTemp; 00028 PMENU pMenu; 00029 TL tlpmenu; 00030 int cBorders; 00031 BOOL fEmptyClient; 00032 BYTE bFramePresent; 00033 00034 CheckLock(pwnd); 00035 UserAssert(IsWinEventNotifyDeferredOK()); 00036 00037 bFramePresent = TestWF(pwnd, WFFRAMEPRESENTMASK); 00038 00039 /* 00040 * Clear all the frame bits. NOTE: The HIBYTE of all these #defines 00041 * must stay the same for this line to work. 00042 */ 00043 ClrWF(pwnd, WFFRAMEPRESENTMASK); 00044 00045 // 00046 // We need to clear the client border bits also. Otherwise, when the 00047 // window gets really small, the client border will draw over the menu 00048 // and caption. 00049 // 00050 ClrWF(pwnd, WFCEPRESENT); 00051 00052 /* 00053 * If the window is iconic, the client area is empty. 00054 */ 00055 if (TestWF(pwnd, WFMINIMIZED)) { 00056 // SetRectEmpty(lprc); 00057 // We must make it an empty rectangle. 00058 // But, that empty rectangle should be at the top left corner of the 00059 // window rect. Else, ScreenToClient() will return bad values. 00060 lprc->right = lprc->left; 00061 lprc->bottom = lprc->top; 00062 goto CalcClientDone; 00063 } 00064 00065 // Save rect into rcTemp for easy local calculations. 00066 CopyRect(&rcTemp, lprc); 00067 00068 // Save the top so we'll know how tall the caption was 00069 yTopOld = rcTemp.top; 00070 00071 // Adjustment for the caption 00072 if (TestWF(pwnd, WFBORDERMASK) == LOBYTE(WFCAPTION)) 00073 { 00074 SetWF(pwnd, WFCPRESENT); 00075 00076 rcTemp.top += GetCaptionHeight(pwnd); 00077 } 00078 00079 // Subtract out window borders 00080 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00081 cxFrame = cBorders * SYSMETFROMPROCESS(CXBORDER); 00082 InflateRect(&rcTemp, -cxFrame, -cBorders * SYSMETFROMPROCESS(CYBORDER)); 00083 00084 if (!TestwndChild(pwnd) && (pMenu = pwnd->spmenu)) { 00085 SetWF(pwnd, WFMPRESENT); 00086 if (!fHungRedraw) { 00087 ThreadLockAlways(pMenu, &tlpmenu); 00088 rcTemp.top += xxxMenuBarCompute(pMenu, pwnd, rcTemp.top - yTopOld, 00089 cxFrame, rcTemp.right - rcTemp.left); 00090 ThreadUnlock(&tlpmenu); 00091 } 00092 } 00093 /* 00094 * We should have cleared WFMPRESENT in the else case here. Win9x doesn't do 00095 * it either. Any code checking this flag will do the wrong thing... 00096 * It seems that it's pretty unsual for apps to remove the menu.... 00097 * No code checking this flag can assume that pwnd->spmenu is not NULL -- we 00098 * would need to clear it way earlier (at unlock time) for such assumption to hold true. 00099 */ 00100 00101 // 00102 // Fix for B#1425 -- Sizing window really small used to move children's 00103 // rects because the client calculations were wrong. So we make the 00104 // bottom of the client match up with the top (the bottom of the menu 00105 // bar). 00106 // 00107 fEmptyClient = FALSE; 00108 00109 if (rcTemp.top >= rcTemp.bottom) { 00110 rcTemp.bottom = rcTemp.top; 00111 fEmptyClient = TRUE; 00112 } 00113 00114 // 00115 // BOGUS BOGUS BOGUS 00116 // Hack for Central Point PC Tools. 00117 // Possibly for M5 only. 00118 // B#8445 00119 // 00120 // They check for div-by-zero all over, but they jump to the wrong place 00121 // if a zero divisor is encountered, and end up faulting anyway. So this 00122 // code path was never tested basically. There's a period when starting 00123 // up where the window rect of their drives ribbon is empty. In Win3.x, 00124 // the client would be shrunk to account for the border it had, and it 00125 // would look like it wasn't empty because the width would be negative, 00126 // signed! So we version-switch this code, since other apps have 00127 // reported the non-emptiness as an annoying bug. 00128 // 00129 if (TestWF(pwnd, WFWIN40COMPAT) && (rcTemp.left >= rcTemp.right)) { 00130 rcTemp.right = rcTemp.left; 00131 fEmptyClient = TRUE; 00132 } 00133 00134 if (fEmptyClient) 00135 goto ClientCalcEnd; 00136 00137 // 00138 // Subtract client edge if we have space 00139 // 00140 if ( TestWF(pwnd, WEFCLIENTEDGE) && 00141 (rcTemp.right - rcTemp.left >= (2 * SYSMETFROMPROCESS(CXEDGE))) && 00142 (rcTemp.bottom - rcTemp.top >= (2 * SYSMETFROMPROCESS(CYEDGE))) ) { 00143 SetWF(pwnd, WFCEPRESENT); 00144 InflateRect(&rcTemp, -SYSMETFROMPROCESS(CXEDGE), -SYSMETFROMPROCESS(CYEDGE)); 00145 } 00146 00147 // 00148 // Subtract scrollbars 00149 // Note compatibility with 3.1: 00150 // * You don't get a horizontal scrollbar unless you have MORE 00151 // space (> ) in your client than you need for one. 00152 // * You get a vertical scrollbar if you have AT LEAST ENOUGH 00153 // space (>=) in your client for one. 00154 // 00155 if (TestWF(pwnd, WFHSCROLL) && (rcTemp.bottom - rcTemp.top > SYSMETFROMPROCESS(CYHSCROLL))) { 00156 SetWF(pwnd, WFHPRESENT); 00157 if (!fHungRedraw) { 00158 rcTemp.bottom -= SYSMETFROMPROCESS(CYHSCROLL); 00159 } 00160 } 00161 00162 if (TestWF(pwnd, WFVSCROLL) && (rcTemp.right - rcTemp.left >= SYSMETFROMPROCESS(CXVSCROLL))) { 00163 SetWF(pwnd, WFVPRESENT); 00164 if (!fHungRedraw) { 00165 #ifdef USE_MIRRORING 00166 if ((!!TestWF(pwnd, WEFLEFTSCROLL)) ^ (!!TestWF(pwnd, WEFLAYOUTRTL))) 00167 #else 00168 if (TestWF(pwnd, WEFLEFTSCROLL)) 00169 #endif 00170 rcTemp.left += SYSMETFROMPROCESS(CXVSCROLL); 00171 else 00172 rcTemp.right -= SYSMETFROMPROCESS(CXVSCROLL); 00173 } 00174 } 00175 00176 ClientCalcEnd: 00177 00178 CopyRect(lprc, &rcTemp); 00179 00180 CalcClientDone: 00181 if (FWINABLE() && (bFramePresent != TestWF(pwnd, WFFRAMEPRESENTMASK))) { 00182 xxxWindowEvent(EVENT_OBJECT_REORDER, pwnd, OBJID_WINDOW, 0, WEF_USEPWNDTHREAD); 00183 } 00184 }

BOOL xxxCallHandleMenuMessages PMENUSTATE  pMenuState,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 3951 of file ntuser/kernel/menu.c.

References BOOL, CheckLock, ExitMenuLoop(), FALSE, tagMENUSTATE::fButtonDown, tagMENUSTATE::fInCallHandleMenuMessages, tagMENUSTATE::fInDoDragDrop, tagMENUSTATE::fModelessMenu, tagMENUSTATE::fMouseOffMenu, GET_X_LPARAM, GET_Y_LPARAM, HW, MNCheckButtonDownState(), msg, NULL, tagMENUSTATE::pGlobalPopupMenu, tagWND::rcClient, TRUE, xxxEndMenuLoop(), xxxHandleMenuMessages(), and xxxMNEndMenuState().

Referenced by xxxMenuWindowProc(), xxxMNDragOver(), and xxxScanSysQueue().

03952 { 03953 BOOL fHandled; 03954 MSG msg; 03955 03956 CheckLock(pwnd); 03957 03958 UserAssert(pMenuState->fModelessMenu || pMenuState->fInDoDragDrop); 03959 03960 /* 03961 * Since modeless menus don't capture the mouse, then we need to 03962 * keep checking on the mouse button when the mouse is off the 03963 * menu. 03964 * Note that we do not set fMouseOffMenu if fInDoDragDrop is set 03965 */ 03966 if (pMenuState->fMouseOffMenu && pMenuState->fButtonDown) { 03967 UserAssert(!pMenuState->fInDoDragDrop && pMenuState->fModelessMenu); 03968 MNCheckButtonDownState(pMenuState); 03969 } 03970 03971 /* 03972 * Setup the msg structure 03973 */ 03974 msg.hwnd = HW(pwnd); 03975 msg.message = message; 03976 msg.wParam = wParam; 03977 03978 /* 03979 * xxxHandleMenuMessages expects screen coordinates 03980 */ 03981 if ((message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST)) { 03982 msg.lParam = MAKELONG(GET_X_LPARAM(lParam) + pwnd->rcClient.left, 03983 GET_Y_LPARAM(lParam) + pwnd->rcClient.top); 03984 } else { 03985 msg.lParam = lParam; 03986 } 03987 03988 /* 03989 * Not used by xxxHandleMenuMessages 03990 */ 03991 msg.time = 0; 03992 msg.pt.x = msg.pt.x = 0; 03993 03994 03995 UserAssert(pMenuState->pGlobalPopupMenu != NULL); 03996 03997 pMenuState->fInCallHandleMenuMessages = TRUE; 03998 fHandled = xxxHandleMenuMessages(&msg, pMenuState, pMenuState->pGlobalPopupMenu); 03999 pMenuState->fInCallHandleMenuMessages = FALSE; 04000 04001 /* 04002 * If the message was handled and this is a modeless menu, 04003 * check to see if it's time to go. 04004 */ 04005 if (fHandled 04006 && pMenuState->fModelessMenu 04007 && ExitMenuLoop (pMenuState, pMenuState->pGlobalPopupMenu)) { 04008 04009 xxxEndMenuLoop (pMenuState, pMenuState->pGlobalPopupMenu); 04010 xxxMNEndMenuState(TRUE); 04011 } 04012 04013 return fHandled; 04014 }

int xxxCallHook int  ,
WPARAM  ,
LPARAM  ,
int 
 

Definition at line 1246 of file hooks.c.

References BOOL, PhkFirstValid(), PtiCurrent, and xxxCallHook2().

Referenced by _CallMsgFilter(), xxxActivateThisWindow(), xxxCallHook2(), xxxCallJournalPlaybackHook(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyWindow(), xxxEndDeferWindowPosEx(), xxxFlashWindow(), xxxGetInputEvent(), xxxHandleOwnerSwitch(), xxxInternalActivateKeyboardLayout(), xxxInternalGetMessage(), xxxInternalUnloadKeyboardLayout(), xxxIsDragging(), xxxLoadKeyboardLayoutEx(), xxxMinMaximize(), xxxMoveSize(), xxxMS_TrackMove(), xxxMsgWaitForMultipleObjects(), xxxNotifyIMEStatus(), xxxProcessEventMessage(), xxxReceiveMessage(), xxxRedrawFrameAndHook(), xxxRedrawTitle(), xxxScanSysQueue(), xxxSendMessageCallback(), xxxSendMessageTimeout(), xxxSendMinRectMessages(), xxxSetFocus(), xxxSetTrayWindow(), xxxSleepTask(), xxxSleepThread(), xxxSysCommand(), and xxxSystemParametersInfo().

01251 { 01252 BOOL bAnsiHook; 01253 01254 return (int)xxxCallHook2(PhkFirstValid(PtiCurrent(), iHook), nCode, wParam, lParam, &bAnsiHook); 01255 }

LRESULT xxxCallHook2 PHOOK  ,
int  ,
WPARAM  ,
LPARAM  ,
LPBOOL 
 

Definition at line 1288 of file hooks.c.

References abHookFlags, ampiHookError, BOOL, BYTE, CheckCritIn, CMSHUNGAPPTIMEOUT, FHungApp(), tagHOOK::flags, FreeHook(), tagINTERSENDMSGEX::fuCall, tagINTERSENDMSGEX::fuSend, GETPTI, gnllHooksTimeout, gptiRit, HF_ANSI, HF_GLOBAL, HF_HOOKFAULTED, HF_WX86KNOWNDLL, HKF_INTERSENDABLE, HKF_JOURNAL, HKF_LOWLEVEL, HMIsMarkDestroy, HOOKMSGSTRUCT, tagHOOK::ihmod, tagHOOK::iHook, INTRSENDMSGEX, IsHooked, ISM_TIMEOUT, IsRestricted(), Lock, tagHOOKMSGSTRUCT::lParam, tagINTERSENDMSGEX::lpdwResult, tagPROCESSINFO::luidSession, luidSystem, tagHOOKMSGSTRUCT::nCode, NULL, tagTHREADINFO::pClientInfo, tagHOOKMSGSTRUCT::phk, _CLIENTINFO::phkCurrent, PhkNextValid(), tagTHREADINFO::ppi, PtiCurrent, tagHOOK::ptiHooked, tagTHREADINFO::rpdesk, RtlEqualLuid(), SET_TIME_LAST_READ, tagTHREADINFO::sphkCurrent, TESTHMODLOADED, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TIDq, TIF_16BIT, TIF_ALLOWOTHERACCOUNTHOOK, TIF_CSRSSTHREAD, TIF_DISABLEHOOKS, TIF_DOSEMULATOR, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TIF_SYSTEMTHREAD, TIF_WOW64, UINT, tagINTERSENDMSGEX::uTimeout, WHF_DEBUG, xxxCallHook(), xxxHkCallHook(), xxxInterSendMsgEx(), and xxxLoadHmodIndex().

Referenced by xxxButtonEvent(), xxxCallHook(), xxxCallJournalPlaybackHook(), xxxCallJournalRecordHook(), xxxCallMouseHook(), xxxCallNextHookEx(), xxxDoButtonEvent(), xxxKeyEvent(), xxxMoveEventAbsolute(), and xxxReceiveMessage().

01294 { 01295 UINT iHook; 01296 PHOOK phkSave; 01297 LONG_PTR nRet; 01298 PTHREADINFO ptiCurrent; 01299 BOOL fLoadSuccess; 01300 TL tlphkCall; 01301 TL tlphkSave; 01302 BYTE bHookFlags; 01303 BOOL fMustIntersend; 01304 01305 CheckCritIn(); 01306 01307 if (phkCall == NULL) { 01308 return 0; 01309 } 01310 01311 iHook = phkCall->iHook; 01312 01313 ptiCurrent = PtiCurrent(); 01314 /* 01315 * Only low level hooks are allowed in the RIT context 01316 * (This check used to be done in PhkFirstValid). 01317 */ 01318 if (ptiCurrent == gptiRit) { 01319 switch (iHook) { 01320 case WH_MOUSE_LL: 01321 case WH_KEYBOARD_LL: 01322 01323 #ifdef REDIRECTION 01324 case WH_HITTEST: 01325 #endif // REDIRECTION 01326 01327 break; 01328 01329 default: 01330 return 0; 01331 } 01332 } 01333 01334 /* 01335 * If this queue is in cleanup, exit: it has no business calling back 01336 * a hook proc. Also check if hooks are disabled for the thread. 01337 */ 01338 if ( ptiCurrent->TIF_flags & (TIF_INCLEANUP | TIF_DISABLEHOOKS) || 01339 ((ptiCurrent->rpdesk == NULL) && (phkCall->iHook != WH_MOUSE_LL))) { 01340 return ampiHookError[iHook + 1]; 01341 } 01342 01343 /* 01344 * Try to call each hook in the list until one is successful or 01345 * we reach the end of the list. 01346 */ 01347 do { 01348 *lpbAnsiHook = phkCall->flags & HF_ANSI; 01349 bHookFlags = abHookFlags[phkCall->iHook + 1]; 01350 01351 /* 01352 * Some WH_SHELL hook types can be called from console 01353 * HSHELL_APPCOMMAND added for bug 346575 DefWindowProc invokes a shell hook 01354 * for console windows if they don't handle the wm_appcommand message - we need the hook 01355 * to go through for csrss. 01356 */ 01357 if ((phkCall->iHook == WH_SHELL) && (ptiCurrent->TIF_flags & TIF_CSRSSTHREAD)) { 01358 if ((nCode == HSHELL_LANGUAGE) || (nCode == HSHELL_WINDOWACTIVATED) || 01359 (nCode == HSHELL_APPCOMMAND)) { 01360 bHookFlags |= HKF_INTERSENDABLE; 01361 } 01362 } 01363 01364 if ((phkCall->iHook == WH_SHELL) && (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD)) { 01365 if ((nCode == HSHELL_ACCESSIBILITYSTATE) ) { 01366 bHookFlags |= HKF_INTERSENDABLE; 01367 } 01368 } 01369 01370 fMustIntersend = 01371 (GETPTI(phkCall) != ptiCurrent) && 01372 ( 01373 /* 01374 * We always want to intersend journal hooks. 01375 * CONSIDER (adams): Why? There's a performance hit by 01376 * doing so, so if we haven't a reason, we shouldn't 01377 * do it. 01378 * 01379 * we also need to intersend low level hooks. They can be called 01380 * from the desktop thread, the raw input thread AND also from 01381 * any thread that calls CallNextHookEx. 01382 */ 01383 (bHookFlags & (HKF_JOURNAL | HKF_LOWLEVEL)) 01384 01385 /* 01386 * We must intersend if a 16bit app hooks a 32bit app 01387 * because we can't load a 16bit dll into a 32bit process. 01388 * We must also intersend if a 16bit app hooks another 16bit app 01389 * in a different VDM, because we can't load a 16bit dll from 01390 * one VDM into a 16bit app in another VDM (because that 01391 * VDM is actually a 32bit process). 01392 */ 01393 || 01394 ( GETPTI(phkCall)->TIF_flags & TIF_16BIT && 01395 ( !(ptiCurrent->TIF_flags & TIF_16BIT) || 01396 ptiCurrent->ppi != GETPTI(phkCall)->ppi)) 01397 01398 #if defined(_WIN64) 01399 01400 /* 01401 * Intersend if a 64bit app hooks a 32bit app or 01402 * a 32bit app hooks a 64bit app. 01403 * This is necessary since a hook DLL can not be loaded 01404 * cross bit type. 01405 */ 01406 || 01407 ( (GETPTI(phkCall)->TIF_flags & TIF_WOW64) != 01408 (ptiCurrent->TIF_flags & TIF_WOW64) 01409 ) 01410 01411 #endif /* defined(_WIN64) */ 01412 01413 /* 01414 * We must intersend if a console or system thread is calling a hook 01415 * that is not in the same console or the system process. 01416 */ 01417 || 01418 ( ptiCurrent->TIF_flags & (TIF_CSRSSTHREAD | TIF_SYSTEMTHREAD) && 01419 GETPTI(phkCall)->ppi != ptiCurrent->ppi) 01420 01421 /* 01422 * If this is a global and non-journal hook, do a security 01423 * check on the current desktop to see if we can call here. 01424 * Note that we allow processes with the SYSTEM_LUID to hook 01425 * other processes even if the other process says that it 01426 * doesn't allow other accounts to hook them. We did this 01427 * because there was a bug in NT 3.x that allowed it and some 01428 * services were written to use it. 01429 */ 01430 || 01431 ( phkCall->flags & HF_GLOBAL && 01432 !RtlEqualLuid(&GETPTI(phkCall)->ppi->luidSession, &ptiCurrent->ppi->luidSession) && 01433 !(ptiCurrent->TIF_flags & TIF_ALLOWOTHERACCOUNTHOOK) && 01434 !RtlEqualLuid(&GETPTI(phkCall)->ppi->luidSession, &luidSystem)) 01435 01436 /* 01437 * We must intersend if the hooking thread is running in 01438 * another process and is restricted. 01439 */ 01440 || 01441 ( GETPTI(phkCall)->ppi != ptiCurrent->ppi && 01442 IsRestricted(GETPTI(phkCall)->pEThread)) 01443 ); 01444 01445 /* 01446 * We're calling back... make sure the hook doesn't go away while 01447 * we're calling back. We've thread locked here: we must unlock before 01448 * returning or enumerating the next hook in the chain. 01449 */ 01450 ThreadLockAlwaysWithPti(ptiCurrent, phkCall, &tlphkCall); 01451 01452 if (!fMustIntersend) { 01453 /* 01454 * Make sure the DLL for this hook, if any, has been loaded 01455 * for the current process. 01456 */ 01457 if ((phkCall->ihmod != -1) && 01458 (TESTHMODLOADED(ptiCurrent, phkCall->ihmod) == 0)) { 01459 01460 BOOL bWx86KnownDll; 01461 01462 /* 01463 * Try loading the library, since it isn't loaded in this processes 01464 * context. First lock this hook so it doesn't go away while we're 01465 * loading this library. 01466 */ 01467 bWx86KnownDll = (phkCall->flags & HF_WX86KNOWNDLL) != 0; 01468 fLoadSuccess = (xxxLoadHmodIndex(phkCall->ihmod, bWx86KnownDll) != NULL); 01469 01470 /* 01471 * If the LoadLibrary() failed, skip to the next hook and try 01472 * again. 01473 */ 01474 if (!fLoadSuccess) { 01475 goto LoopAgain; 01476 } 01477 } 01478 01479 /* 01480 * Is WH_DEBUG installed? If we're not already calling it, do so. 01481 */ 01482 if (IsHooked(ptiCurrent, WHF_DEBUG) && (phkCall->iHook != WH_DEBUG)) { 01483 DEBUGHOOKINFO debug; 01484 01485 debug.idThread = TIDq(ptiCurrent); 01486 debug.idThreadInstaller = 0; 01487 debug.code = nCode; 01488 debug.wParam = wParam; 01489 debug.lParam = lParam; 01490 01491 if (xxxCallHook(HC_ACTION, phkCall->iHook, (LPARAM)&debug, WH_DEBUG)) { 01492 /* 01493 * If WH_DEBUG returned non-zero, skip this hook and 01494 * try the next one. 01495 */ 01496 goto LoopAgain; 01497 } 01498 } 01499 01500 /* 01501 * Make sure the hook is still around before we 01502 * try and call it. 01503 */ 01504 if (HMIsMarkDestroy(phkCall)) { 01505 goto LoopAgain; 01506 } 01507 01508 /* 01509 * Time to call the hook! Lock it first so that it doesn't go away 01510 * while we're using it. Thread lock right away in case the lock frees 01511 * the previous contents. 01512 */ 01513 01514 #if DBG 01515 if (phkCall->flags & HF_GLOBAL) { 01516 UserAssert(phkCall->ptiHooked == NULL); 01517 } else { 01518 UserAssert(phkCall->ptiHooked == ptiCurrent); 01519 } 01520 #endif 01521 phkSave = ptiCurrent->sphkCurrent; 01522 ThreadLockWithPti(ptiCurrent, phkSave, &tlphkSave); 01523 01524 Lock(&ptiCurrent->sphkCurrent, phkCall); 01525 if (ptiCurrent->pClientInfo) 01526 ptiCurrent->pClientInfo->phkCurrent = phkCall; 01527 01528 nRet = xxxHkCallHook(phkCall, nCode, wParam, lParam); 01529 01530 Lock(&ptiCurrent->sphkCurrent, phkSave); 01531 if (ptiCurrent->pClientInfo) 01532 ptiCurrent->pClientInfo->phkCurrent = phkSave; 01533 01534 ThreadUnlock(&tlphkSave); 01535 01536 /* 01537 * This hook proc faulted, so unhook it and try the next one. 01538 */ 01539 if (phkCall->flags & HF_HOOKFAULTED) { 01540 PHOOK phkFault; 01541 01542 phkCall = PhkNextValid(phkCall); 01543 phkFault = ThreadUnlock(&tlphkCall); 01544 if (phkFault != NULL) { 01545 FreeHook(phkFault); 01546 } 01547 01548 continue; 01549 } 01550 01551 /* 01552 * Lastly, we're done with this hook so it is ok to unlock it (it may 01553 * get freed here! 01554 */ 01555 ThreadUnlock(&tlphkCall); 01556 01557 return nRet; 01558 01559 } else if (bHookFlags & HKF_INTERSENDABLE) { 01560 01561 /* 01562 * Receiving thread can access this structure since the 01563 * sender thread's stack is locked down during xxxInterSendMsgEx 01564 */ 01565 HOOKMSGSTRUCT hkmp; 01566 int timeout = 200; // 1/5 second !!! 01567 01568 hkmp.lParam = lParam; 01569 hkmp.phk = phkCall; 01570 hkmp.nCode = nCode; 01571 01572 /* 01573 * Thread lock right away in case the lock frees the previous contents 01574 */ 01575 phkSave = ptiCurrent->sphkCurrent; 01576 01577 ThreadLockWithPti(ptiCurrent, phkSave, &tlphkSave); 01578 01579 Lock(&ptiCurrent->sphkCurrent, phkCall); 01580 if (ptiCurrent->pClientInfo) 01581 ptiCurrent->pClientInfo->phkCurrent = phkCall; 01582 01583 /* 01584 * Make sure we don't get hung! 01585 */ 01586 if (bHookFlags & HKF_LOWLEVEL) 01587 timeout = gnllHooksTimeout; 01588 01589 /* 01590 * CONSIDER(adams): Why should a journaling hook be allowed to 01591 * hang the console or a system thread? Will that interfere with 01592 * the user's ability to cancel journaling through Ctrl+Esc? 01593 */ 01594 if (((bHookFlags & HKF_LOWLEVEL) == 0) && 01595 ( (bHookFlags & HKF_JOURNAL) || 01596 !(ptiCurrent->TIF_flags & (TIF_CSRSSTHREAD | TIF_SYSTEMTHREAD)))) { 01597 01598 nRet = xxxInterSendMsgEx(NULL, WM_HOOKMSG, wParam, 01599 (LPARAM)&hkmp, ptiCurrent, GETPTI(phkCall), NULL); 01600 } else { 01601 /* 01602 * We are a server thread (console/desktop) and we aren't 01603 * journalling, so we can't allow the hookproc to hang us - 01604 * we must use a timeout. 01605 */ 01606 INTRSENDMSGEX ism; 01607 01608 ism.fuCall = ISM_TIMEOUT; 01609 ism.fuSend = SMTO_ABORTIFHUNG | SMTO_NORMAL; 01610 ism.uTimeout = timeout; 01611 ism.lpdwResult = &nRet; 01612 01613 /* 01614 * Don't hook DOS apps connected to the emulator - they often 01615 * grab too much CPU for the callback to the hookproc to 01616 * complete in a timely fashion, causing poor response. 01617 */ 01618 if ((ptiCurrent->TIF_flags & TIF_DOSEMULATOR) || 01619 FHungApp(GETPTI(phkCall), CMSHUNGAPPTIMEOUT) || 01620 !xxxInterSendMsgEx(NULL, WM_HOOKMSG, wParam, 01621 (LPARAM)&hkmp, ptiCurrent, GETPTI(phkCall), &ism)) { 01622 nRet = ampiHookError[iHook + 1]; 01623 } 01624 01625 /* 01626 * If the low-level hook is eaten, the app may wake up from 01627 * MsgWaitForMultipleObjects, clear the wake mask, but not get 01628 * anything in GetMessage / PeekMessage and we will think it's 01629 * hung. This causes problems in DirectInput because then the 01630 * app may miss some hooks if FHungApp returns true, see bug 01631 * 430342 for more details on this. 01632 */ 01633 if ((bHookFlags & HKF_LOWLEVEL) && nRet) { 01634 SET_TIME_LAST_READ(GETPTI(phkCall)); 01635 } 01636 } 01637 01638 Lock(&ptiCurrent->sphkCurrent, phkSave); 01639 if (ptiCurrent->pClientInfo) 01640 ptiCurrent->pClientInfo->phkCurrent = phkSave; 01641 01642 ThreadUnlock(&tlphkSave); 01643 ThreadUnlock(&tlphkCall); 01644 return nRet; 01645 } 01646 // fall-through 01647 01648 LoopAgain: 01649 phkCall = PhkNextValid(phkCall); 01650 ThreadUnlock(&tlphkCall); 01651 } while (phkCall != NULL); 01652 01653 return ampiHookError[iHook + 1]; 01654 }

DWORD xxxCallJournalPlaybackHook PQMSG  pqmsg  ) 
 

Definition at line 1797 of file hooks.c.

References BOOL, BYTE, dt(), DWORD, gpsi, IS_CHAR_MSG, IS_DBCS_ENABLED, IsWinEventNotifyDeferredOK, L, LOBYTE, tagQMSG::msg, NtGetTickCount(), NULL, tagHOOK::offPfn, PhkFirstGlobalValid(), tagTHREADINFO::pq, PtiCurrent, RevalidateHwnd, tagQ::spwndActive, StoreQMessage(), TestKeyStateDown, ThreadLockWithPti, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_IGNOREPLAYBACKDELAY, UINT, tagTHREADINFO::wchInjected, xxxCallHook(), xxxCallHook2(), and zzzInternalSetCursorPos().

Referenced by xxxGetNextSysMsg().

01799 { 01800 EVENTMSG emsg; 01801 LONG dt; 01802 PWND pwnd; 01803 WPARAM wParam; 01804 LPARAM lParam; 01805 POINT pt; 01806 PTHREADINFO ptiCurrent; 01807 BOOL bAnsiHook; 01808 PHOOK phkCall; 01809 TL tlphkCall; 01810 01811 UserAssert(IsWinEventNotifyDeferredOK()); 01812 01813 TryNextEvent: 01814 01815 /* 01816 * Initialized to the current time for compatibility with 01817 * <= 3.0. 01818 */ 01819 emsg.time = NtGetTickCount(); 01820 ptiCurrent = PtiCurrent(); 01821 pwnd = NULL; 01822 01823 phkCall = PhkFirstGlobalValid(ptiCurrent, WH_JOURNALPLAYBACK); 01824 ThreadLockWithPti(ptiCurrent, phkCall, &tlphkCall); 01825 01826 dt = (DWORD)xxxCallHook2(phkCall, HC_GETNEXT, 0, (LPARAM)&emsg, &bAnsiHook); 01827 01828 /* 01829 * -1 means some error occured. Return -1 for error. 01830 */ 01831 if (dt == 0xFFFFFFFF) { 01832 ThreadUnlock(&tlphkCall); 01833 return dt; 01834 } 01835 01836 /* 01837 * Update the message id. Need this if we decide to sleep. 01838 */ 01839 pqmsg->msg.message = emsg.message; 01840 01841 if (dt > 0) { 01842 if (ptiCurrent->TIF_flags & TIF_IGNOREPLAYBACKDELAY) { 01843 /* 01844 * This flag tells us to ignore the requested delay (set in mnloop) 01845 * We clear it to indicate that we did so. 01846 */ 01847 RIPMSG1(RIP_WARNING, "Journal Playback delay ignored (%lx)", emsg.message); 01848 ptiCurrent->TIF_flags &= ~TIF_IGNOREPLAYBACKDELAY; 01849 dt = 0; 01850 } else { 01851 ThreadUnlock(&tlphkCall); 01852 return dt; 01853 } 01854 } 01855 01856 /* 01857 * The app is ready to be asked for the next event 01858 */ 01859 01860 if ((emsg.message >= WM_MOUSEFIRST) && (emsg.message <= WM_MOUSELAST)) { 01861 01862 pt.x = (int)emsg.paramL; 01863 pt.y = (int)emsg.paramH; 01864 01865 lParam = MAKELONG(LOWORD(pt.x), LOWORD(pt.y)); 01866 wParam = 0; 01867 01868 /* 01869 * If the message has changed the mouse position, 01870 * update the cursor. 01871 */ 01872 if (pt.x != gpsi->ptCursor.x || pt.y != gpsi->ptCursor.y) { 01873 zzzInternalSetCursorPos(pt.x, pt.y); 01874 } 01875 01876 } else if ((emsg.message >= WM_KEYFIRST) && (emsg.message <= WM_KEYLAST)) { 01877 UINT wExtraStuff = 0; 01878 01879 if ((emsg.message == WM_KEYUP) || (emsg.message == WM_SYSKEYUP)) { 01880 wExtraStuff |= 0x8000; 01881 } 01882 01883 if ((emsg.message == WM_SYSKEYUP) || (emsg.message == WM_SYSKEYDOWN)) { 01884 wExtraStuff |= 0x2000; 01885 } 01886 01887 if (emsg.paramH & 0x8000) { 01888 wExtraStuff |= 0x0100; 01889 } 01890 01891 if (TestKeyStateDown(ptiCurrent->pq, (BYTE)emsg.paramL)) { 01892 wExtraStuff |= 0x4000; 01893 } 01894 lParam = MAKELONG(1, (UINT)((emsg.paramH & 0xFF) | wExtraStuff)); 01895 01896 if ((LOWORD(emsg.paramL) == VK_PACKET) && (LOBYTE(emsg.paramH) == 0)) { 01897 /* 01898 * We are playing back an injected Unicode char (see SendInput) 01899 * save the character for TranslateMessage to pick up. 01900 */ 01901 ptiCurrent->wchInjected = HIWORD(emsg.paramL); 01902 } else { 01903 /* 01904 * Raid# 65331 01905 * WM_KEY* and WM_SYSKEY* messages should only contain 8bit Virtual Keys. 01906 * Some applications passes scan code in HIBYTE and could screw up 01907 * the system. E.g. Tab Keydown, paramL: 0x0f09 where 0f is scan code 01908 */ 01909 DWORD dwMask = 0xff; 01910 01911 /* 01912 * There are old ANSI apps that only fill in the byte for when 01913 * they generate journal playback so we used to strip everything 01914 * else off. That however breaks unicode journalling; 22645 01915 * (Yes, some apps apparently do Playback WM_*CHAR msgs!) 01916 * 01917 */ 01918 if (!bAnsiHook || IS_DBCS_ENABLED()) { 01919 if (IS_CHAR_MSG(emsg.message)) { 01920 RIPMSG1(RIP_VERBOSE, "Unusual char message(%x) passed through JournalPlayback.", emsg.message); 01921 /* 01922 * Don't mask off HIBYTE(LOWORD(paramL)) for DBCS and UNICODE. 01923 */ 01924 dwMask = 0xffff; 01925 } 01926 } 01927 01928 wParam = emsg.paramL & dwMask; 01929 } 01930 01931 } else if (emsg.message == WM_QUEUESYNC) { 01932 if (emsg.paramL == 0) { 01933 pwnd = ptiCurrent->pq->spwndActive; 01934 } else { 01935 if ((pwnd = RevalidateHwnd((HWND)IntToPtr( emsg.paramL ))) == NULL) 01936 pwnd = ptiCurrent->pq->spwndActive; 01937 } 01938 01939 } else { 01940 /* 01941 * This event doesn't match up with what we're looking 01942 * for. If the hook is still valid, then skip this message 01943 * and try the next. 01944 */ 01945 if (phkCall == NULL || phkCall->offPfn == 0L) { 01946 /* Hook is nolonger valid, return -1 */ 01947 ThreadUnlock(&tlphkCall); 01948 return 0xFFFFFFFF; 01949 } 01950 01951 RIPMSG1(RIP_WARNING, 01952 "Bad journal playback message=0x%08lx", 01953 emsg.message); 01954 01955 xxxCallHook(HC_SKIP, 0, 0, WH_JOURNALPLAYBACK); 01956 ThreadUnlock(&tlphkCall); 01957 goto TryNextEvent; 01958 } 01959 01960 StoreQMessage(pqmsg, pwnd, emsg.message, wParam, lParam, 0, 0, 0); 01961 01962 ThreadUnlock(&tlphkCall); 01963 return 0; 01964 }

VOID xxxCallJournalRecordHook PQMSG  pqmsg  ) 
 

Definition at line 1695 of file hooks.c.

References BOOL, BYTE, tagQMSG::dwQEvent, HIBYTE, LOBYTE, tagQMSG::msg, NULL, PBYTE, PhkFirstGlobalValid(), PtiCurrent, RevalidateHwnd, UINT, and xxxCallHook2().

Referenced by xxxSkipSysMsg().

01697 { 01698 EVENTMSG emsg; 01699 BOOL bAnsiHook; 01700 01701 /* 01702 * Setup the EVENTMSG structure. 01703 */ 01704 emsg.message = pqmsg->msg.message; 01705 emsg.time = pqmsg->msg.time; 01706 01707 if (RevalidateHwnd(pqmsg->msg.hwnd)) { 01708 emsg.hwnd = pqmsg->msg.hwnd; 01709 } else { 01710 emsg.hwnd = NULL; 01711 } 01712 01713 if ((emsg.message >= WM_MOUSEFIRST) && (emsg.message <= WM_MOUSELAST)) { 01714 emsg.paramL = (UINT)pqmsg->msg.pt.x; 01715 emsg.paramH = (UINT)pqmsg->msg.pt.y; 01716 01717 } else if ((emsg.message >= WM_KEYFIRST) && (emsg.message <= WM_KEYLAST)) { 01718 BYTE bScanCode = LOBYTE(HIWORD(pqmsg->msg.lParam)); 01719 /* 01720 * Build up a Win 3.1 compatible journal record key 01721 * Win 3.1 ParamL 00 00 SC VK (SC=scan code VK=virtual key) 01722 * Also set ParamH 00 00 00 SC to be compatible with our Playback 01723 * 01724 * If WM_*CHAR messages ever come this way we would have a problem 01725 * because we would lose the top byte of the Unicode character. We'd 01726 * We'd get ParamL 00 00 SC CH (SC=scan code, CH = low byte of WCHAR) 01727 * 01728 */ 01729 if ((LOWORD(pqmsg->msg.wParam) == VK_PACKET) && (bScanCode == 0)) { 01730 /* 01731 * If we have an injected Unicode char (from SendInput), the 01732 * character value was cached, let's give that to them too. 01733 */ 01734 emsg.paramL = (UINT)MAKELONG(pqmsg->msg.wParam, PtiCurrent()->wchInjected); 01735 } else { 01736 emsg.paramL = MAKELONG(MAKEWORD(pqmsg->msg.wParam, bScanCode),0); 01737 } 01738 emsg.paramH = bScanCode; 01739 01740 UserAssert((emsg.message != WM_CHAR) && 01741 (emsg.message != WM_DEADCHAR) && 01742 (emsg.message != WM_SYSCHAR) && 01743 (emsg.message != WM_SYSDEADCHAR)); 01744 /* 01745 * Set extended-key bit. 01746 */ 01747 if (pqmsg->msg.lParam & 0x01000000) { 01748 emsg.paramH |= 0x8000; 01749 } 01750 01751 } else { 01752 RIPMSG2(RIP_WARNING, 01753 "Bad journal record message!\n" 01754 " message = 0x%08lx\n" 01755 " dwQEvent = 0x%08lx", 01756 pqmsg->msg.message, 01757 pqmsg->dwQEvent); 01758 } 01759 01760 /* 01761 * Call the journal recording hook. 01762 */ 01763 xxxCallHook2(PhkFirstGlobalValid(PtiCurrent(), WH_JOURNALRECORD), HC_ACTION, 0, 01764 (LPARAM)&emsg, &bAnsiHook); 01765 01766 /* 01767 * Write the MSG parameters back because the app may have modified it. 01768 * AfterDark's screen saver password actually zero's out the keydown 01769 * chars. 01770 * 01771 * If it was a mouse message patch up the mouse point. If it was a 01772 * WM_KEYxxx message convert the Win 3.1 compatible journal record key 01773 * back into a half backed WM_KEYxxx format. Only the VK and SC fields 01774 * where initialized at this point. 01775 * 01776 * wParam 00 00 00 VK lParam 00 SC 00 00 01777 */ 01778 if ((pqmsg->msg.message >= WM_MOUSEFIRST) && (pqmsg->msg.message <= WM_MOUSELAST)) { 01779 pqmsg->msg.pt.x = emsg.paramL; 01780 pqmsg->msg.pt.y = emsg.paramH; 01781 01782 } else if ((pqmsg->msg.message >= WM_KEYFIRST) && (pqmsg->msg.message <= WM_KEYLAST)) { 01783 (BYTE)pqmsg->msg.wParam = (BYTE)emsg.paramL; 01784 ((PBYTE)&pqmsg->msg.lParam)[2] = HIBYTE(LOWORD(emsg.paramL)); 01785 } 01786 }

BOOL xxxCallMouseHook UINT  message,
PMOUSEHOOKSTRUCTEX  pmhs,
BOOL  fRemove
 

Definition at line 1666 of file hooks.c.

References BOOL, DWORD, FALSE, PhkFirstValid(), PtiCurrent, TRUE, and xxxCallHook2().

Referenced by xxxScanSysQueue().

01670 { 01671 BOOL bAnsiHook; 01672 01673 /* 01674 * Call the mouse hook. 01675 */ 01676 if (xxxCallHook2(PhkFirstValid(PtiCurrent(), WH_MOUSE), fRemove ? 01677 HC_ACTION : HC_NOREMOVE, (DWORD)message, (LPARAM)pmhs, &bAnsiHook)) { 01678 return TRUE; 01679 } 01680 01681 return FALSE; 01682 }

LRESULT xxxCallNextHookEx int  nCode,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 961 of file hooks.c.

References BOOL, NULL, PhkNextValid(), PtiCurrent, and xxxCallHook2().

Referenced by fnHkINLPCWPEXSTRUCT(), fnHkINLPCWPRETEXSTRUCT(), NtUserCallNextHookEx(), NtUserfnHkINLPCBTACTIVATESTRUCT(), NtUserfnHkINLPCBTCREATESTRUCT(), NtUserfnHkINLPDEBUGHOOKSTRUCT(), NtUserfnHkINLPKBDLLHOOKSTRUCT(), NtUserfnHkINLPMOUSEHOOKSTRUCTEX(), NtUserfnHkINLPMSG(), NtUserfnHkINLPMSLLHOOKSTRUCT(), NtUserfnHkINLPRECT(), and NtUserfnHkOPTINLPEVENTMSG().

00965 { 00966 BOOL bAnsiHook; 00967 00968 if (PtiCurrent()->sphkCurrent == NULL) { 00969 return 0; 00970 } 00971 00972 return xxxCallHook2(PhkNextValid(PtiCurrent()->sphkCurrent), nCode, wParam, lParam, &bAnsiHook); 00973 }

VOID xxxCancelCoolSwitch void   ) 
 

Definition at line 1635 of file tmswitch.c.

References CheckCritIn, FWINABLE, gspwndAltTab, tagWND::head, IsWinEventNotifyDeferredOK, Lock, NULL, PtiCurrent, VOID(), WEF_USEPWNDTHREAD, xxxDestroyWindow(), and xxxWindowEvent().

Referenced by xxxButtonEvent(), xxxKeyEvent(), xxxNextWindow(), xxxOldNextWindow(), and xxxSwitchWndProc().

01637 { 01638 CheckCritIn(); 01639 UserAssert(IsWinEventNotifyDeferredOK()); 01640 01641 /* 01642 * Destroy the Cool Switch window 01643 */ 01644 if (gspwndAltTab != NULL) { 01645 01646 /* 01647 * Make sure that the thread calling this is the same 01648 * thread which created the alttab window. Otherwise, 01649 * we could end up with this window floating around until 01650 * the calling process dies. Remember, we can't destroy 01651 * windows across different threads. 01652 */ 01653 if (gspwndAltTab->head.pti != PtiCurrent()) 01654 return; 01655 01656 if (FWINABLE()) { 01657 xxxWindowEvent(EVENT_SYSTEM_SWITCHEND, gspwndAltTab, OBJID_CLIENT, 01658 0, WEF_USEPWNDTHREAD); 01659 } 01660 xxxDestroyWindow(gspwndAltTab); 01661 01662 Lock(&gspwndAltTab, NULL); 01663 } 01664 }

void xxxCancelMouseMoveTracking DWORD  dwDTFlags,
PWND  pwndTrack,
int  htEx,
DWORD  dwDTCancel
 

Definition at line 1125 of file tooltips.c.

References _KillSystemTimer(), _PostMessage(), CheckLock, DF_HOTTRACKING, DF_TOOLTIP, DF_TOOLTIPSHOWING, DF_TRACKMOUSEHOVER, DF_TRACKMOUSELEAVE, FALSE, GETPTI, IDSYS_MOUSEHOVER, PtiCurrent, PWNDTOOLTIP, ThreadLockAlways, ThreadUnlock, xxxHotTrack(), and xxxResetTooltip().

Referenced by xxxCapture(), xxxProcessEventMessage(), and xxxTrackMouseMove().

01126 { 01127 01128 CheckLock(pwndTrack); 01129 /* 01130 * Hottracking 01131 */ 01132 if ((dwDTFlags & DF_HOTTRACKING) && (dwDTCancel & DF_HOTTRACKING)) { 01133 /* 01134 * The current state must be owned by the current queue. 01135 * Otherwise, we're about to do an inter-queue cancelation. 01136 */ 01137 UserAssert(PtiCurrent()->pq == GETPTI(pwndTrack)->pq); 01138 01139 xxxHotTrack(pwndTrack, htEx, FALSE); 01140 } 01141 01142 /* 01143 * Tooltips 01144 */ 01145 if ((dwDTFlags & DF_TOOLTIPSHOWING) && (dwDTCancel & DF_TOOLTIP)) { 01146 PTOOLTIPWND pttwnd = (PTOOLTIPWND)PWNDTOOLTIP(pwndTrack); 01147 TL tlpwnd; 01148 01149 ThreadLockAlways(pttwnd, &tlpwnd); 01150 xxxResetTooltip(pttwnd); 01151 ThreadUnlock(&tlpwnd); 01152 } 01153 01154 /* 01155 * Mouse Leave 01156 */ 01157 if ((dwDTFlags & DF_TRACKMOUSELEAVE) && (dwDTCancel & DF_TRACKMOUSELEAVE)) { 01158 _PostMessage(pwndTrack, 01159 ((htEx == HTCLIENT) ? WM_MOUSELEAVE : WM_NCMOUSELEAVE), 01160 0, 0); 01161 } 01162 01163 /* 01164 * Mouse Hover 01165 */ 01166 if ((dwDTFlags & DF_TRACKMOUSEHOVER) && (dwDTCancel & DF_TRACKMOUSEHOVER)) { 01167 _KillSystemTimer(pwndTrack, IDSYS_MOUSEHOVER); 01168 } 01169 }

VOID xxxCancelTracking VOID   ) 
 

Definition at line 1891 of file movesize.c.

References grpdeskRitInput, INT, MAX_THREADS, NULL, tagTHREADINFO::pmsd, PtiCurrent, tagDESKTOP::PtiList, _MOVESIZEDATA::spwnd, ThreadLockAlwaysWithPti, ThreadLockPti, ThreadUnlock, ThreadUnlockPti, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, UINT, VOID(), and xxxCancelTrackingForThread().

Referenced by xxxProcessEventMessage(), and xxxSetForegroundWindow2().

01892 { 01893 PTHREADINFO pti; 01894 PTHREADINFO ptiList[MAX_THREADS]; 01895 TL tlptiList[MAX_THREADS]; 01896 TL tlspwndList[MAX_THREADS]; 01897 UINT cThreads = 0; 01898 INT i; 01899 PLIST_ENTRY pHead; 01900 PLIST_ENTRY pEntry; 01901 PTHREADINFO ptiCurrent = PtiCurrent(); 01902 01903 /* 01904 * Build a list of threads that we need to look at. We can't just 01905 * walk the pointer list while we're doing the work, because we 01906 * might leave the critical section and the pointer could get 01907 * deleted out from under us. 01908 */ 01909 pHead = &grpdeskRitInput->PtiList; 01910 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 01911 01912 pti = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 01913 01914 if (pti->pmsd != NULL) { 01915 01916 UserAssert(cThreads < MAX_THREADS); 01917 01918 if (cThreads < MAX_THREADS) { 01919 ThreadLockPti(ptiCurrent, pti, &tlptiList[cThreads]); 01920 ThreadLockAlwaysWithPti(ptiCurrent, pti->pmsd->spwnd, &tlspwndList[cThreads]); 01921 ptiList[cThreads++] = pti; 01922 } 01923 } 01924 } 01925 01926 /* 01927 * Walk the list backwards so the unlocks will be done in the right order. 01928 */ 01929 for (i = cThreads - 1; i >= 0; i--) { 01930 if (!(ptiList[i]->TIF_flags & TIF_INCLEANUP)) { 01931 xxxCancelTrackingForThread(ptiList[i]); 01932 } 01933 01934 ThreadUnlock(&tlspwndList[i]); 01935 ThreadUnlockPti(ptiCurrent, &tlptiList[i]); 01936 } 01937 }

VOID xxxCancelTrackingForThread PTHREADINFO  ptiCancel  ) 
 

Definition at line 1826 of file movesize.c.

References _PostMessage(), DDR_ENDCANCEL, _MOVESIZEDATA::fDragFullWindows, _MOVESIZEDATA::fTrackCancelled, gpDispInfo, tagDISPLAYINFO::hDev, IsInsideMenuLoop(), NO_CAP_CLIENT, NULL, tagTHREADINFO::pmsd, tagTHREADINFO::pq, SetWakeBit(), _MOVESIZEDATA::spwnd, tagTHREADINFO::TIF_flags, TIF_TRACKRECTVISIBLE, TRUE, VOID(), xxxCapture(), and xxxDrawDragRect().

Referenced by xxxCancelTracking(), and xxxDestroyThreadInfo().

01828 { 01829 PMOVESIZEDATA pmsdCancel; 01830 01831 UserAssert(ptiCancel); 01832 01833 /* 01834 * If this thread isn't around any more, skip it. 01835 */ 01836 if (ptiCancel == NULL) 01837 return; 01838 01839 if ((pmsdCancel = ptiCancel->pmsd) != NULL) { 01840 01841 /* 01842 * Found one, now stop tracking. 01843 */ 01844 pmsdCancel->fTrackCancelled = TRUE; 01845 01846 /* 01847 * Only remove the tracking rectangle if it's 01848 * been made visible. 01849 */ 01850 if (ptiCancel->TIF_flags & TIF_TRACKRECTVISIBLE) { 01851 bSetDevDragRect(gpDispInfo->hDev, NULL, NULL); 01852 if (!(pmsdCancel->fDragFullWindows)) { 01853 xxxDrawDragRect(pmsdCancel, NULL, DDR_ENDCANCEL); 01854 } 01855 } 01856 01857 /* 01858 * Leave TIF_TRACKING set to prevent xxxMoveSize() 01859 * recursion. 01860 */ 01861 ptiCancel->TIF_flags &= ~TIF_TRACKRECTVISIBLE; 01862 if (ptiCancel->pq) { 01863 SetWakeBit(ptiCancel, QS_MOUSEMOVE); 01864 } 01865 01866 /* 01867 * If the tracking window is still in menuloop, send the 01868 * WM_CANCELMODE message so that it can exit the menu. 01869 * This fixes the bug where we have 2 icons with their 01870 * system menu up. 01871 * 8/5/94 johannec 01872 */ 01873 if (IsInsideMenuLoop(ptiCancel) && ptiCancel->pmsd) 01874 _PostMessage(ptiCancel->pmsd->spwnd, WM_CANCELMODE, 0, 0); 01875 01876 /* 01877 * Turn off capture 01878 */ 01879 xxxCapture(ptiCancel, NULL, NO_CAP_CLIENT); 01880 } 01881 }

VOID xxxCapture PTHREADINFO  pti,
PWND  pwnd,
UINT  code
 

Definition at line 124 of file w32/ntuser/kernel/capture.c.

References BEGINATOMICCHECK, CheckLock, CLIENT_CAPTURE, CLIENT_CAPTURE_INTERNAL, tagQ::codeCapture, DeferWinEventNotify, DF_TRACKMOUSEEVENT, tagDESKTOP::dwDTFlags, ENDATOMICCHECK, FALSE, FNID_DELETED_BIT, FULLSCREEN_CAPTURE, FWINABLE, GETPTI, gspwndInternalCapture, gspwndMouseOwner, gspwndScreenCapture, tagDESKTOP::htEx, HW, IsGlobalHooked, IsWinEventNotifyDeferredOK, Lock, LockCaptureWindow(), NO_CAP_CLIENT, NULL, tagTHREADINFO::pq, QF_CAPTURELOCKED, tagQ::QF_flags, tagQ::spwndCapture, tagDESKTOP::spwndTrack, TestWF, ThreadLockAlways, ThreadUnlock, Unlock, VOID(), WEF_USEPWNDTHREAD, WFWIN40COMPAT, WHF_FROM_WH, xxxCancelMouseMoveTracking(), xxxSendMessageCallback(), zzzEndDeferWinEventNotify, zzzSetFMouseMoved(), and zzzWindowEvent.

Referenced by xxxCancelTrackingForThread(), xxxHelpLoop(), xxxMakeWindowForegroundWithState(), xxxMNSetCapture(), xxxMoveSize(), xxxOldNextWindow(), xxxReleaseCapture(), xxxSBTrackInit(), and xxxSetCapture().

00128 { 00129 CheckLock(pwnd); 00130 UserAssert(IsWinEventNotifyDeferredOK()); 00131 00132 if ((gspwndScreenCapture == NULL) || 00133 (code == FULLSCREEN_CAPTURE) || 00134 ((pwnd == NULL) && (code == NO_CAP_CLIENT) && (pti->pq != GETPTI(gspwndScreenCapture)->pq))) { 00135 00136 PQ pq; 00137 PWND pwndCaptureOld = NULL; 00138 00139 if (code == FULLSCREEN_CAPTURE) { 00140 if (pwnd) { 00141 00142 Lock(&gspwndScreenCapture, pwnd); 00143 00144 /* 00145 * We're going full screen so clear the mouse owner 00146 */ 00147 Unlock(&gspwndMouseOwner); 00148 00149 } else { 00150 00151 Unlock(&gspwndScreenCapture); 00152 } 00153 } 00154 00155 /* 00156 * Internal capture works like Win 3.1 capture unlike the NT capture 00157 * which can be lost if the user clicks down on another application 00158 */ 00159 if (code == CLIENT_CAPTURE_INTERNAL) { 00160 Lock(&gspwndInternalCapture, pwnd); 00161 code = CLIENT_CAPTURE; 00162 } 00163 00164 /* 00165 * Free the internal capture if the app (thread) that did the internal 00166 * capture is freeing the capture. 00167 */ 00168 if ((code == NO_CAP_CLIENT) && 00169 gspwndInternalCapture && 00170 (pti == GETPTI(gspwndInternalCapture))) { 00171 00172 Unlock(&gspwndInternalCapture); 00173 } 00174 00175 if ((pq = pti->pq) != NULL) { 00176 PDESKTOP pdesk = pti->rpdesk; 00177 00178 UserAssert(!(pq->QF_flags & QF_CAPTURELOCKED)); 00179 00180 /* 00181 * If someone is tracking mouse events in the client area and 00182 * we're setting or releasing an internal capture mode (!= CLIENT_CAPTURE), 00183 * then cancel tracking -- because we're either taking or relinquishing 00184 * control over the mouse. 00185 */ 00186 if ((pdesk->dwDTFlags & DF_TRACKMOUSEEVENT) 00187 && (pdesk->htEx == HTCLIENT) 00188 && ((pdesk->spwndTrack == pwnd) 00189 && (code != CLIENT_CAPTURE) 00190 || ((pdesk->spwndTrack == pq->spwndCapture) 00191 && (pq->codeCapture != CLIENT_CAPTURE)))) { 00192 00193 BEGINATOMICCHECK(); 00194 xxxCancelMouseMoveTracking(pdesk->dwDTFlags, pdesk->spwndTrack, 00195 pdesk->htEx, DF_TRACKMOUSEEVENT); 00196 ENDATOMICCHECK(); 00197 00198 } 00199 00200 pwndCaptureOld = pq->spwndCapture; 00201 LockCaptureWindow(pq, pwnd); 00202 pq->codeCapture = code; 00203 } else { 00204 /* 00205 * A thread without a queue? 00206 */ 00207 UserAssert(pti->pq != NULL); 00208 } 00209 00210 /* 00211 * If there was a capture window and we're releasing it, post 00212 * a WM_MOUSEMOVE to the window we're over so they can know about 00213 * the current mouse position. 00214 * Defer WinEvent notifications to protect pwndCaptureOld 00215 */ 00216 DeferWinEventNotify(); 00217 00218 if (pwnd == NULL && pwndCaptureOld != NULL) { 00219 #ifdef REDIRECTION 00220 if (!IsGlobalHooked(pti, WHF_FROM_WH(WH_HITTEST))) 00221 #endif 00222 zzzSetFMouseMoved(); 00223 } 00224 00225 if (FWINABLE()) { 00226 if (pwndCaptureOld) { 00227 zzzWindowEvent(EVENT_SYSTEM_CAPTUREEND, pwndCaptureOld, OBJID_WINDOW, 00228 INDEXID_CONTAINER, WEF_USEPWNDTHREAD); 00229 } 00230 00231 if (pwnd) { 00232 zzzWindowEvent(EVENT_SYSTEM_CAPTURESTART, pwnd, OBJID_WINDOW, 00233 INDEXID_CONTAINER, WEF_USEPWNDTHREAD); 00234 } 00235 } 00236 00237 /* 00238 * New for win95 - send WM_CAPTURECHANGED. 00239 * 00240 * The FNID_DELETED_BIT is set in xxxFreeWindow which means we 00241 * DON'T want to send the message. 00242 */ 00243 if (pwndCaptureOld && 00244 TestWF(pwndCaptureOld, WFWIN40COMPAT) && 00245 !(pwndCaptureOld->fnid & FNID_DELETED_BIT)) { 00246 00247 TL tlpwnd; 00248 00249 /* 00250 * If we are in menu mode and just set capture, 00251 * don't let them take it from us during this 00252 * callback. 00253 */ 00254 if ((pti->pMenuState != NULL) && (pwnd != NULL)) { 00255 pq->QF_flags |= QF_CAPTURELOCKED; 00256 } 00257 00258 ThreadLockAlways(pwndCaptureOld, &tlpwnd); 00259 zzzEndDeferWinEventNotify(); 00260 xxxSendMessageCallback(pwndCaptureOld, 00261 WM_CAPTURECHANGED, 00262 FALSE, 00263 (LPARAM)HW(pwnd), 00264 NULL, 00265 0, 00266 FALSE); 00267 /* The thread's queue may have changed during the callback, 00268 * so we need to refresh the local. Bug #377795 00269 */ 00270 pq = pti->pq; 00271 UserAssert(pq != NULL); 00272 ThreadUnlock(&tlpwnd); 00273 00274 /* 00275 * Release the temporary lock, if any 00276 */ 00277 pq->QF_flags &= ~QF_CAPTURELOCKED; 00278 } else { 00279 zzzEndDeferWinEventNotify(); 00280 } 00281 } 00282 }

BOOL xxxChangeClipboardChain PWND  pwndRemove,
PWND  pwndNewNext
 

Definition at line 2618 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), CheckLock, FALSE, GETPTI, HW, Lock, NULL, PtiCurrent, tagWINDOWSTATION::spwndClipViewer, ThreadLockAlways, ThreadLockWinSta, ThreadUnlock, ThreadUnlockWinSta, TRUE, and xxxSendMessage().

Referenced by NtUserChangeClipboardChain().

02621 { 02622 TL tlpwinsta; 02623 PWINDOWSTATION pwinsta; 02624 BOOL result; 02625 TL tlpwndClipViewer; 02626 PTHREADINFO ptiCurrent; 02627 02628 CheckLock(pwndRemove); 02629 CheckLock(pwndNewNext); 02630 02631 /* 02632 * Blow it off is the caller does not have the proper access rights. 02633 */ 02634 if ((pwinsta = CheckClipboardAccess()) == NULL) 02635 return FALSE; 02636 02637 /* 02638 * pwndRemove should be this thread's window, pwndNewNext will 02639 * either be NULL or another thread's window. 02640 */ 02641 ptiCurrent = PtiCurrent(); 02642 02643 if (GETPTI(pwndRemove) != ptiCurrent) { 02644 RIPMSG0(RIP_WARNING, "Clipboard: ChangeClipboardChain will not remove cross threads"); 02645 return FALSE; 02646 } 02647 02648 if (pwinsta->spwndClipViewer == NULL) { 02649 RIPMSG0(RIP_WARNING, "Clipboard: ChangeClipboardChain has no viewer window"); 02650 return FALSE; 02651 } 02652 02653 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 02654 02655 if (pwndRemove == pwinsta->spwndClipViewer) { 02656 02657 Lock(&pwinsta->spwndClipViewer, pwndNewNext); 02658 result = TRUE; 02659 02660 } else { 02661 02662 ThreadLockAlways(pwinsta->spwndClipViewer, &tlpwndClipViewer); 02663 result = (BOOL)xxxSendMessage(pwinsta->spwndClipViewer, 02664 WM_CHANGECBCHAIN, 02665 (WPARAM)HW(pwndRemove), 02666 (LPARAM)HW(pwndNewNext)); 02667 ThreadUnlock(&tlpwndClipViewer); 02668 } 02669 02670 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 02671 02672 return result; 02673 }

VOID xxxCheckFocus PWND  pwnd  ) 
 

Definition at line 2549 of file focusact.c.

References tagQ::caret, CheckLock, NULL, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, tagQ::spwndFocus, tagWND::spwndParent, TestwndChild, ThreadLockWithPti, ThreadUnlock, xxxSetFocus(), and zzzDestroyCaret().

Referenced by xxxDW_SendDestroyMessages(), and xxxShowWindow().

02551 { 02552 TL tlpwndParent; 02553 PTHREADINFO pti; 02554 02555 CheckLock(pwnd); 02556 02557 pti = PtiCurrent(); 02558 02559 if (pwnd == pti->pq->spwndFocus) { 02560 02561 /* 02562 * Set focus to parent of child window. 02563 */ 02564 if (TestwndChild(pwnd)) { 02565 ThreadLockWithPti(pti, pwnd->spwndParent, &tlpwndParent); 02566 xxxSetFocus(pwnd->spwndParent); 02567 ThreadUnlock(&tlpwndParent); 02568 } else { 02569 xxxSetFocus(NULL); 02570 } 02571 } 02572 02573 if (pwnd == pti->pq->caret.spwnd) { 02574 zzzDestroyCaret(); 02575 } 02576 }

BOOL xxxCheckFullScreen PWND  pwnd,
PSIZERECT  psrc
 

Definition at line 5305 of file swp.c.

References _MonitorFromRect(), _MonitorFromWindow(), tagCLS::atomClassName, BOOL, CheckLock, ClrWF, tagDISPLAYINFO::cMonitors, tagSIZERECT::cx, tagSIZERECT::cy, FALSE, gatomConsoleClass, GetPrimaryMonitor(), GetWindowBorders(), gpDispInfo, IsMaxedRect(), LOBYTE, min, tagWND::pcls, tagMONITOR::rcMonitor, tagDISPLAYINFO::rcScreen, RECTFromSIZERECT(), SetWF, SYSMET, TestWF, ThreadLockAlways, ThreadUnlock, TRUE, WEFTOOLWINDOW, WFBORDERMASK, WFCAPTION, WFCHILD, WFFULLSCREEN, WFMAXBOX, WFMAXIMIZED, WFREALLYMAXIMIZABLE, WFWIN40COMPAT, tagSIZERECT::x, xxxAddFullScreen(), xxxRemoveFullScreen(), and tagSIZERECT::y.

Referenced by xxxCalcValidRects(), and xxxCreateWindowEx().

05308 { 05309 BOOL fYielded = FALSE; 05310 PMONITOR pMonitor; 05311 PMONITOR pMonitorPrimary; 05312 TL tlpMonitor; 05313 RECT rc; 05314 BOOL fIsPrimary; 05315 05316 05317 CheckLock(pwnd); 05318 05319 /* 05320 * SINCE THIS IS ONLY CALLED IN 2 PLACES, make the checks there 05321 * instead of the overhead of calling this function in time critical 05322 * places. 05323 * 05324 * If 3 or more places call it, put the child/toolwindow checks here 05325 */ 05326 UserAssert(!TestWF(pwnd, WFCHILD)); 05327 UserAssert(!TestWF(pwnd, WEFTOOLWINDOW)); 05328 05329 pMonitorPrimary = GetPrimaryMonitor(); 05330 if (gpDispInfo->cMonitors == 1) { 05331 pMonitor = pMonitorPrimary; 05332 } else { 05333 /* 05334 * In multiple monitor mode, windows that take up the entire 05335 * virtual screen are not considered 'full screen'. 'Full screen' 05336 * means full single monitor only. This detection is so that any 05337 * docked bars--tray, office'95 tools--can get out of the way for 05338 * the application. 05339 * 05340 * There are only three types of windows that ought to go full 05341 * virtual screen. None of them need the tray et al. to get out of 05342 * the way: 05343 * (1) Normal app windows that want a lot of space 05344 * * Those guys just activate and deactivate normally. 05345 * (2) Desktop windows 05346 * * Shell, User desktop sit behind everything else. 05347 * (3) Screen savers, demos, etc. 05348 * * These guys should be WS_EX_TOPMOST to ensure they sit 05349 * over everybody. 05350 */ 05351 if (IsMaxedRect(&gpDispInfo->rcScreen, psrc)) 05352 return fYielded; 05353 05354 RECTFromSIZERECT(&rc, psrc); 05355 pMonitor = _MonitorFromRect(&rc, MONITOR_DEFAULTTOPRIMARY); 05356 } 05357 05358 fIsPrimary = (pMonitor == pMonitorPrimary); 05359 ThreadLockAlways(pMonitor, &tlpMonitor); 05360 05361 if (IsMaxedRect(&pMonitor->rcWork, psrc)) { 05362 if (TestWF(pwnd, WFMAXIMIZED)) { 05363 SetWF(pwnd, WFREALLYMAXIMIZABLE); 05364 05365 if (gpDispInfo->cMonitors > 1) { 05366 /* 05367 * BUGBUG: Check if app is before 4.1? 05368 */ 05369 05370 /* 05371 * This is for XL '95 going fullscreen when already maxed. It 05372 * always uses the primary display. Let's hack them, and any 05373 * other old app that tries to move its truly maximized window. 05374 * They will be clipped otherwise by our fake regional stuff. 05375 */ 05376 PMONITOR pMonitorReal; 05377 05378 pMonitorReal = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 05379 if (pMonitorReal != pMonitor && fIsPrimary) { 05380 /* 05381 * Transfer over the shape to the REAL monitor. 05382 */ 05383 psrc->x += pMonitorReal->rcMonitor.left; 05384 psrc->y += pMonitorReal->rcMonitor.top; 05385 psrc->cx -= (pMonitor->rcMonitor.right - pMonitor->rcMonitor.left) + 05386 (pMonitorReal->rcMonitor.right - pMonitorReal->rcMonitor.left); 05387 05388 psrc->cy -= (pMonitor->rcMonitor.bottom - pMonitor->rcMonitor.top) + 05389 (pMonitorReal->rcMonitor.bottom - pMonitorReal->rcMonitor.top); 05390 05391 ThreadUnlock(&tlpMonitor); 05392 pMonitor = pMonitorReal; 05393 fIsPrimary = FALSE; 05394 ThreadLockAlways(pMonitor, &tlpMonitor); 05395 } 05396 } 05397 } 05398 05399 if ( TestWF(pwnd, WFMAXIMIZED) && 05400 TestWF(pwnd, WFMAXBOX) && 05401 (TestWF(pwnd, WFBORDERMASK) == LOBYTE(WFCAPTION))) { 05402 05403 if ( psrc->y + SYSMET(CYCAPTION) <= pMonitor->rcMonitor.top && 05404 psrc->y + psrc->cy >= pMonitor->rcMonitor.bottom) { 05405 05406 if (!TestWF(pwnd, WFFULLSCREEN)) { 05407 /* 05408 * Only want to do full screen stuff on the tray 05409 * monitor. 05410 */ 05411 fYielded = xxxAddFullScreen(pwnd, pMonitor); 05412 } 05413 } else { 05414 int iRight; 05415 int iBottom; 05416 int dxy; 05417 05418 if (TestWF(pwnd, WFFULLSCREEN)) { 05419 fYielded = xxxRemoveFullScreen(pwnd, pMonitor); 05420 } 05421 05422 /* 05423 * Despite the code in GetMinMaxInfo() to fix up 05424 * the max rect, we still have to hack old apps. 05425 * Word '95 & XL '95 do weird things when going to/from 05426 * full screen when maximized already. 05427 * 05428 * NOTE: you can have more than one docked bar on a 05429 * monitor. Win '95 code doesn't work right in that 05430 * case. 05431 */ 05432 dxy = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 05433 dxy *= SYSMET(CXBORDER); 05434 05435 psrc->x = pMonitor->rcWork.left - dxy; 05436 psrc->y = pMonitor->rcWork.top - dxy; 05437 05438 dxy *= 2; 05439 iRight = 05440 pMonitor->rcWork.right - pMonitor->rcWork.left + dxy; 05441 iBottom = 05442 pMonitor->rcWork.bottom - pMonitor->rcWork.top + dxy; 05443 05444 /* 05445 * Let console windows maximize smaller than defaults. 05446 */ 05447 if (pwnd->pcls->atomClassName == gatomConsoleClass) { 05448 psrc->cx = min(iRight, psrc->cx); 05449 psrc->cy = min(iBottom, psrc->cy); 05450 } else { 05451 psrc->cx = iRight; 05452 05453 /* 05454 * B#14012 save QuickLink II that wants 4 pixels hanging off 05455 * the screen for every edge except the bottom edge, which 05456 * they only want to overhang by 2 pixels -- jeffbog 5/17/95 05457 * 05458 * BUT THIS CODE DOESN'T WORK FOR MULTIPLE MONITORS, so don't 05459 * do it on secondary dudes. Else, XL '95 flakes out. 05460 */ 05461 if (fIsPrimary && !TestWF(pwnd, WFWIN40COMPAT)) { 05462 psrc->cy = min(iBottom, psrc->cy); 05463 } else { 05464 psrc->cy = iBottom; 05465 } 05466 } 05467 } 05468 05469 } else if (IsMaxedRect(&pMonitor->rcMonitor, psrc)) { 05470 fYielded = xxxAddFullScreen(pwnd, pMonitor); 05471 } 05472 } else { 05473 if (TestWF(pwnd, WFMAXIMIZED)) { 05474 ClrWF(pwnd, WFREALLYMAXIMIZABLE); 05475 } 05476 05477 fYielded = xxxRemoveFullScreen(pwnd, pMonitor); 05478 } 05479 05480 ThreadUnlock(&tlpMonitor); 05481 return fYielded; 05482 }

VOID xxxCheckImeShowStatusInThread IN PWND  pwndDefIme  ) 
 

int xxxClientAddFontResourceW PUNICODE_STRING  ,
DWORD  ,
DESIGNVECTOR * 
 

Referenced by xxxAddFontResourceW().

BOOL xxxClientCallWinEventProc WINEVENTPROC  pfn,
PEVENTHOOK  pEventHook,
PNOTIFY  pNotify
 

Referenced by xxxProcessNotifyWinEvent().

HANDLE xxxClientCopyImage HANDLE  hImage,
UINT  type,
int  cxNew,
int  cyNew,
UINT  flags
 

Referenced by xxxCreateClassSmIcon(), and xxxCreateWindowSmIcon().

HANDLE xxxClientCopyImage IN HANDLE  hImage,
IN UINT  uImageType,
IN int  cxDesired,
IN int  cyDesired,
IN UINT  LR_flags
 

BOOL xxxClientExtTextOutW HDC  hdc,
int  x,
int  y,
int  flOpts,
RECT *  prcl,
LPCWSTR  pwsz,
UINT  cwc,
INT pdx
 

Referenced by xxxDrawCaptionTemp(), and xxxDrawMenuItemText().

BOOL xxxClientGetCharsetInfo LCID  lcid,
PCHARSETINFO  pcs
 

Referenced by xxxLoadKeyboardLayoutEx().

BOOL xxxClientGetTextExtentPointW HDC  hdc,
LPCWSTR  lpstr,
int  cch,
PSIZE  psize
 

Referenced by DT_GetExtentMinusPrefixes(), MNRecalcTabStrings(), xxxDrawCaptionTemp(), xxxDrawItemUnderline(), and xxxMB_FindLongestString().

HANDLE xxxClientLoadImage PUNICODE_STRING  pstrName,
ATOM  atomModName,
WORD  wImageType,
int  cxSize,
int  cySize,
UINT  LR_flags,
BOOL  fWallpaper
 

Referenced by xxxLoadDesktopWallpaper(), xxxUpdateSystemCursorsFromRegistry(), and xxxUpdateSystemIconsFromRegistry().

PMENU xxxClientLoadMenu HANDLE  hmod,
PUNICODE_STRING  pstrName
 

Referenced by xxxCreateWindowEx(), xxxGetScrollMenu(), and xxxLoadSysMenu().

NTSTATUS xxxClientLoadOLE VOID   ) 
 

int xxxClientLpkDrawTextEx HDC  hdc,
int  xLeft,
int  yTop,
LPCWSTR  lpsz,
int  nCount,
BOOL  fDraw,
UINT  wFormat,
LPDRAWTEXTDATA  lpDrawInfo,
UINT  bAction,
int  iCharSet
 

BOOL xxxClientMonitorEnumProc HMONITOR  hMonitor,
HDC  hdcMonitor,
LPRECT  lprc,
LPARAM  dwData,
MONITORENUMPROC  xpfnProc
 

Referenced by xxxEnumDisplayMonitors().

void xxxClientPSMTextOut HDC  hdc,
int  xLeft,
int  yTop,
PUNICODE_STRING  lpsz,
int  cch,
DWORD  dwFlags
 

Referenced by xxxPSMTextOut().

NTSTATUS xxxClientRegisterDragDrop HWND  hwnd  ) 
 

Definition at line 44 of file menudd.c.

References NTSTATUS(), NULL, and xxxUserModeCallback().

Referenced by xxxMNOpenHierarchy(), and xxxTrackPopupMenuEx().

00045 { 00046 return xxxUserModeCallback(FI_CLIENTREGISTERDRAGDROP, &hwnd, sizeof(&hwnd), NULL, 0); 00047 }

NTSTATUS xxxClientRevokeDragDrop HWND  hwnd  ) 
 

Definition at line 53 of file menudd.c.

References NTSTATUS(), NULL, and xxxUserModeCallback().

Referenced by xxxMenuWindowProc(), and xxxMNCloseHierarchy().

00054 { 00055 return xxxUserModeCallback(FI_CLIENTREVOKEDRAGDROP, &hwnd, sizeof(&hwnd), NULL, 0); 00056 00057 }

LONG xxxClientShutdown PWND  pwnd,
WPARAM  wParam
 

Definition at line 521 of file kernel/exitwin.c.

References BuildHwndList(), BWL_ENUMLIST, FreeHwndList(), GETPTI, NULL, tagDESKTOP::pDeskInfo, tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, tagWND::spwndChild, WMCS_QUERYEND, WMCSR_ALLOWSHUTDOWN, WMCSR_DONE, and xxxClientShutdown2().

Referenced by xxxDefWindowProc().

00524 { 00525 PBWL pbwl; 00526 PTHREADINFO ptiT; 00527 LONG lRet; 00528 00529 /* 00530 * Build a list of windows first. 00531 */ 00532 ptiT = GETPTI(pwnd); 00533 00534 if ((pbwl = BuildHwndList(ptiT->rpdesk->pDeskInfo->spwnd->spwndChild, 00535 BWL_ENUMLIST, ptiT)) == NULL) { 00536 /* 00537 * Can't allocate memory to notify this thread's windows of shutdown. 00538 * Can't do more than kill the app 00539 */ 00540 return WMCSR_ALLOWSHUTDOWN; 00541 } 00542 00543 if (wParam & WMCS_QUERYEND) { 00544 lRet = xxxClientShutdown2(pbwl, WM_QUERYENDSESSION, wParam); 00545 } else { 00546 xxxClientShutdown2(pbwl, WM_ENDSESSION, wParam); 00547 lRet = WMCSR_DONE; 00548 } 00549 00550 FreeHwndList(pbwl); 00551 return lRet; 00552 }

WORD xxxClientWOWGetProcModule WNDPROC_PWND  pfn  ) 
 

Referenced by xxxCreateWindowEx(), xxxSetClassData(), and xxxSetWindowData().

BOOL xxxCloseClipboard PWINDOWSTATION  pwinsta  ) 
 

Definition at line 538 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), FALSE, tagWINDOWSTATION::fClipboardChanged, MungeClipData(), NULL, tagWINDOWSTATION::ptiClipLock, PtiCurrent, tagWINDOWSTATION::spwndClipOpen, ThreadLockWinSta, ThreadUnlockWinSta, TRUE, Unlock, and xxxDrawClipboard().

Referenced by ForceEmptyClipboard(), NtUserCloseClipboard(), xxxDestroyThreadInfo(), and xxxSnapWindow().

00540 { 00541 PTHREADINFO ptiCurrent; 00542 TL tlpwinsta; 00543 00544 if ((pwinsta == NULL) && ((pwinsta = CheckClipboardAccess()) == NULL)) { 00545 return FALSE; 00546 } 00547 00548 /* 00549 * If the current thread does not have the clipboard open, return 00550 * FALSE. 00551 */ 00552 ptiCurrent = PtiCurrent(); 00553 00554 if (pwinsta->ptiClipLock != ptiCurrent) { 00555 RIPERR0(ERROR_CLIPBOARD_NOT_OPEN, RIP_WARNING, "xxxCloseClipboard not open"); 00556 return FALSE; 00557 } 00558 00559 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 00560 00561 /* 00562 * Convert data to independent formats. 00563 */ 00564 if (pwinsta->fClipboardChanged) 00565 MungeClipData(pwinsta); 00566 00567 /* 00568 * Release the clipboard explicitly after we're finished calling 00569 * SetClipboardData(). 00570 */ 00571 Unlock(&pwinsta->spwndClipOpen); 00572 pwinsta->ptiClipLock = NULL; 00573 00574 /* 00575 * Notify any clipboard viewers that the clipboard contents have 00576 * changed. 00577 */ 00578 if (pwinsta->fClipboardChanged) 00579 xxxDrawClipboard(pwinsta); 00580 00581 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00582 00583 return TRUE; 00584 }

BOOL xxxCloseDesktop HDESK  ,
KPROCESSOR_MODE 
 

Definition at line 4332 of file desktop.c.

References BOOL, CloseProtectedHandle(), tagDESKTOP::dwSessionId, ExDesktopObjectType, FALSE, gpepCSRSS, gSessionId, tagTHREADINFO::hdesk, tagPROCESSINFO::hdeskStartup, HF_DESKTOPHOOK, LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PpiCurrent, PtiCurrent, tagPROCESSINFO::ptiList, tagTHREADINFO::ptiSibling, tagPROCESSINFO::rpdeskStartup, SetHandleFlag(), Status, TRUE, and UnlockDesktop.

Referenced by NtUserCloseDesktop(), NtUserResolveDesktop(), xxxCreateDesktop(), and xxxCreateDisconnectDesktop().

04335 { 04336 PDESKTOP pdesk; 04337 PTHREADINFO ptiT; 04338 PPROCESSINFO ppi; 04339 NTSTATUS Status; 04340 04341 ppi = PpiCurrent(); 04342 04343 /* 04344 * Get a pointer to the desktop. 04345 */ 04346 Status = ObReferenceObjectByHandle( 04347 hdesk, 04348 0, 04349 *ExDesktopObjectType, 04350 AccessMode, 04351 &pdesk, 04352 NULL); 04353 if (!NT_SUCCESS(Status)) { 04354 RIPNTERR0(Status, RIP_VERBOSE, ""); 04355 return FALSE; 04356 } 04357 04358 UserAssert(pdesk->dwSessionId == gSessionId); 04359 04360 LogDesktop(pdesk, LD_REF_FN_CLOSEDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 04361 04362 if (ppi->Process != gpepCSRSS) { 04363 04364 /* 04365 * Disallow closing of the desktop if the handle is in use by 04366 * any threads in the process. 04367 */ 04368 for (ptiT = ppi->ptiList; ptiT != NULL; ptiT = ptiT->ptiSibling) { 04369 if (ptiT->hdesk == hdesk) { 04370 RIPERR2(ERROR_BUSY, RIP_WARNING, 04371 "CloseDesktop: Desktop %#p still in use by thread %#p", 04372 pdesk, ptiT); 04373 LogDesktop(pdesk, LD_DEREF_FN_CLOSEDESKTOP1, FALSE, (ULONG_PTR)PtiCurrent()); 04374 ObDereferenceObject(pdesk); 04375 return FALSE; 04376 } 04377 } 04378 04379 /* 04380 * If this is the startup desktop, unlock it 04381 */ 04382 /* 04383 * Bug 41394. Make sure that hdesk == ppi->hdeskStartup. We might 04384 * be getting a handle to the desktop object that is different 04385 * from ppi->hdeskStartup but we still end up 04386 * setting ppi->hdeskStartup to NULL. 04387 */ 04388 if ((pdesk == ppi->rpdeskStartup) && (hdesk == ppi->hdeskStartup)) { 04389 UnlockDesktop(&ppi->rpdeskStartup, LDU_PPI_DESKSTARTUP2, (ULONG_PTR)ppi); 04390 ppi->hdeskStartup = NULL; 04391 } 04392 } 04393 04394 /* 04395 * Clear hook flag 04396 */ 04397 SetHandleFlag(hdesk, HF_DESKTOPHOOK, FALSE); 04398 04399 /* 04400 * Close the handle 04401 */ 04402 Status = CloseProtectedHandle(hdesk); 04403 04404 LogDesktop(pdesk, LD_DEREF_FN_CLOSEDESKTOP2, FALSE, (ULONG_PTR)PtiCurrent()); 04405 ObDereferenceObject(pdesk); 04406 UserAssert(NT_SUCCESS(Status)); 04407 04408 return TRUE; 04409 }

HWINSTA xxxConnectService PUNICODE_STRING  ,
HDESK * 
 

Definition at line 25 of file service.c.

References AllocAce(), CreateSecurityDescriptor(), FALSE, KernelMode, NT_SUCCESS, NTSTATUS(), NULL, OpenEffectiveToken(), PtiCurrent, RtlInitUnicodeString(), _SE_EXPORTS::SeAliasAdminsSid, SeExports, Status, ThreadLockPool, ThreadUnlockPool, TRACE_INIT, xxxCreateDesktop(), and xxxCreateWindowStation().

Referenced by xxxResolveDesktop().

00028 { 00029 NTSTATUS Status; 00030 HANDLE hToken; 00031 ULONG ulLength; 00032 PTOKEN_USER ptuService; 00033 PSECURITY_DESCRIPTOR psdService; 00034 PSID psid; 00035 PACCESS_ALLOWED_ACE paceService = NULL, pace; 00036 OBJECT_ATTRIBUTES ObjService; 00037 HWINSTA hwinsta; 00038 UNICODE_STRING strDesktop; 00039 TL tlPoolSdService, tlPoolAceService, tlPoolToken; 00040 00041 /* 00042 * Open the token of the service. 00043 */ 00044 Status = OpenEffectiveToken(&hToken); 00045 if (!NT_SUCCESS(Status)) { 00046 RIPMSG1(RIP_WARNING, "ConnectService: Could not open process/thread token (0x%X)", Status); 00047 return NULL; 00048 } 00049 00050 /* 00051 * Get the user SID assigned to the service. 00052 */ 00053 ptuService = NULL; 00054 paceService = NULL; 00055 psdService = NULL; 00056 hwinsta = NULL; 00057 ZwQueryInformationToken(hToken, TokenUser, NULL, 0, &ulLength); 00058 ptuService = (PTOKEN_USER)UserAllocPool(ulLength, TAG_TOKEN); 00059 if (ptuService == NULL) { 00060 RIPMSG1(RIP_WARNING, "ConnectService: Can't alloc buffer (size=%d) for token info", ulLength); 00061 goto sd_error; 00062 } 00063 Status = ZwQueryInformationToken(hToken, TokenUser, ptuService, 00064 ulLength, &ulLength); 00065 ZwClose(hToken); 00066 if (!NT_SUCCESS(Status)) { 00067 RIPMSG1(RIP_WARNING, "ConnectService: QueryInformationToken failed (0x%X)", Status); 00068 goto sd_error; 00069 } 00070 psid = ptuService->User.Sid; 00071 00072 /* 00073 * Create ACE list. 00074 */ 00075 paceService = AllocAce(NULL, ACCESS_ALLOWED_ACE_TYPE, 0, 00076 WINSTA_CREATEDESKTOP | WINSTA_READATTRIBUTES | 00077 WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | 00078 WINSTA_ACCESSCLIPBOARD | STANDARD_RIGHTS_REQUIRED, 00079 psid, &ulLength); 00080 if (paceService == NULL) { 00081 RIPMSG0(RIP_WARNING, "ConnectService: AllocAce for WindowStation attributes failed"); 00082 goto sd_error; 00083 } 00084 pace = AllocAce(paceService, ACCESS_ALLOWED_ACE_TYPE, OBJECT_INHERIT_ACE | 00085 INHERIT_ONLY_ACE | NO_PROPAGATE_INHERIT_ACE, 00086 DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | DESKTOP_ENUMERATE | 00087 DESKTOP_CREATEWINDOW | DESKTOP_CREATEMENU | DESKTOP_HOOKCONTROL | 00088 STANDARD_RIGHTS_REQUIRED, 00089 psid, &ulLength); 00090 if (pace == NULL) { 00091 RIPMSG0(RIP_WARNING, "ConnectService: AllocAce for Desktop Attributes failed"); 00092 goto sd_error; 00093 } 00094 paceService = pace; 00095 pace = AllocAce(pace, ACCESS_ALLOWED_ACE_TYPE, 0, 00096 WINSTA_ENUMERATE, 00097 SeExports->SeAliasAdminsSid, &ulLength); 00098 if (pace == NULL) { 00099 RIPMSG0(RIP_WARNING, "ConnectService: AllocAce for admin WinSta enumerate failed"); 00100 goto sd_error; 00101 } 00102 paceService = pace; 00103 pace = AllocAce(pace, ACCESS_ALLOWED_ACE_TYPE, OBJECT_INHERIT_ACE | 00104 INHERIT_ONLY_ACE | NO_PROPAGATE_INHERIT_ACE, 00105 DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS | DESKTOP_ENUMERATE, 00106 SeExports->SeAliasAdminsSid, &ulLength); 00107 if (pace == NULL) { 00108 RIPMSG0(RIP_WARNING, "ConnectService: AllocAce for admin Desktop access failed"); 00109 goto sd_error; 00110 } 00111 paceService = pace; 00112 00113 /* 00114 * Initialize the SD 00115 */ 00116 psdService = CreateSecurityDescriptor(paceService, ulLength, FALSE); 00117 if (psdService == NULL) { 00118 RIPMSG0(RIP_WARNING, "ConnectService: CreateSecurityDescriptor failed"); 00119 goto sd_error; 00120 } 00121 00122 ThreadLockPool(PtiCurrent(), ptuService, &tlPoolToken); 00123 ThreadLockPool(PtiCurrent(), paceService, &tlPoolAceService); 00124 ThreadLockPool(PtiCurrent(), psdService, &tlPoolSdService); 00125 00126 /* 00127 * The windowstation does not exist and must be created. 00128 */ 00129 InitializeObjectAttributes(&ObjService, pstrWinSta, 00130 OBJ_OPENIF, NULL, psdService); 00131 hwinsta = xxxCreateWindowStation(&ObjService, 00132 KernelMode, 00133 MAXIMUM_ALLOWED, 00134 NULL, 0, NULL, 0); 00135 if (hwinsta != NULL) { 00136 00137 TRACE_INIT(("Service windowstation created\n")); 00138 00139 /* 00140 * We have the windowstation, now create the desktop. The security 00141 * descriptor will be inherited from the windowstation. Save the 00142 * winsta handle because the access struct may be moved by the 00143 * desktop creation. 00144 */ 00145 RtlInitUnicodeString(&strDesktop, TEXT("Default")); 00146 InitializeObjectAttributes(&ObjService, &strDesktop, 00147 OBJ_OPENIF | OBJ_CASE_INSENSITIVE, hwinsta, NULL); 00148 00149 *phdesk = xxxCreateDesktop(&ObjService, KernelMode, 00150 NULL, NULL, 0, MAXIMUM_ALLOWED); 00151 00152 if (*phdesk == NULL) { 00153 00154 /* 00155 * The creation failed, wake the desktop thread, close the 00156 * windowstation and leave. 00157 */ 00158 RIPMSG0(RIP_WARNING, "ConnectService: CreateDesktop('Default') failed."); 00159 00160 ZwClose(hwinsta); 00161 hwinsta = NULL; 00162 } else { 00163 TRACE_INIT(("Default desktop in Service windowstation created\n")); 00164 } 00165 } else { 00166 *phdesk = NULL; 00167 } 00168 00169 ThreadUnlockPool(PtiCurrent(), &tlPoolSdService); 00170 ThreadUnlockPool(PtiCurrent(), &tlPoolAceService); 00171 ThreadUnlockPool(PtiCurrent(), &tlPoolToken); 00172 00173 sd_error: 00174 if (ptuService != NULL) 00175 UserFreePool(ptuService); 00176 if (paceService != NULL) 00177 UserFreePool(paceService); 00178 if (psdService != NULL) 00179 UserFreePool(psdService); 00180 00181 return hwinsta; 00182 }

NTSTATUS xxxConsoleControl IN CONSOLECONTROL  ConsoleControl,
IN PVOID  ConsoleInformation,
IN ULONG  ConsoleInformationLength
 

Definition at line 6445 of file queue.c.

References tagDESKTOP::dwConsoleIMEThreadId, tagDESKTOP::dwConsoleThreadId, DWORD, ExDesktopObjectType, FALSE, gatomConsoleClass, ISCSRSS, LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PtiCurrent, PtiFromThreadId(), SetVDMCursorBounds(), Status, TIF_DONTATTACHQUEUE, tagTHREADINFO::TIF_flags, TRUE, UserMode, UserSetConsoleProcessWindowStation(), xxxbFullscreenSwitch(), xxxSetConsoleCaretInfo(), and xxxUserNotifyConsoleApplication().

Referenced by NtUserConsoleControl().

06449 { 06450 PCONSOLEDESKTOPCONSOLETHREAD pDesktopConsole; 06451 PCONSOLEWINDOWSTATIONPROCESS pConsoleWindowStationInfo; 06452 PDESKTOP pdesk; 06453 DWORD dwThreadIdOld; 06454 NTSTATUS Status = STATUS_SUCCESS; 06455 06456 UNREFERENCED_PARAMETER(ConsoleInformationLength); 06457 UserAssert(ISCSRSS()); 06458 06459 switch (ConsoleControl) { 06460 case ConsoleDesktopConsoleThread: 06461 UserAssert(ConsoleInformationLength == sizeof(CONSOLEDESKTOPCONSOLETHREAD)); 06462 pDesktopConsole = (PCONSOLEDESKTOPCONSOLETHREAD)ConsoleInformation; 06463 06464 Status = ObReferenceObjectByHandle( 06465 pDesktopConsole->hdesk, 06466 0, 06467 *ExDesktopObjectType, 06468 UserMode, 06469 &pdesk, 06470 NULL); 06471 if (!NT_SUCCESS(Status)) 06472 return Status; 06473 06474 LogDesktop(pdesk, LD_REF_FN_CONSOLECONTROL1, TRUE, (ULONG_PTR)PtiCurrent()); 06475 06476 dwThreadIdOld = pdesk->dwConsoleThreadId; 06477 06478 if (pDesktopConsole->dwThreadId != (DWORD)-1) { 06479 pdesk->dwConsoleThreadId = 06480 pDesktopConsole->dwThreadId; 06481 } 06482 06483 pDesktopConsole->dwThreadId = dwThreadIdOld; 06484 LogDesktop(pdesk, LD_DEREF_FN_CONSOLECONTROL1, FALSE, (ULONG_PTR)PtiCurrent()); 06485 ObDereferenceObject(pdesk); 06486 break; 06487 06488 case ConsoleClassAtom: 06489 UserAssert(ConsoleInformationLength == sizeof(ATOM)); 06490 gatomConsoleClass = *(ATOM *)ConsoleInformation; 06491 break; 06492 06493 case ConsoleNotifyConsoleApplication: 06494 /* 06495 * Bug 273518 - joejo 06496 * 06497 * Adding optimization to bug fix 06498 */ 06499 UserAssert(ConsoleInformationLength == sizeof(CONSOLE_PROCESS_INFO)); 06500 xxxUserNotifyConsoleApplication((PCONSOLE_PROCESS_INFO)ConsoleInformation); 06501 break; 06502 06503 case ConsoleSetVDMCursorBounds: 06504 UserAssert((ConsoleInformation == NULL) || 06505 (ConsoleInformationLength == sizeof(RECT))); 06506 SetVDMCursorBounds(ConsoleInformation); 06507 break; 06508 06509 case ConsolePublicPalette: 06510 UserAssert(ConsoleInformationLength == sizeof(HPALETTE)); 06511 GreSetPaletteOwner(*(HPALETTE *)ConsoleInformation, OBJECT_OWNER_PUBLIC); 06512 break; 06513 06514 case ConsoleWindowStationProcess: 06515 UserAssert(ConsoleInformationLength == sizeof(CONSOLEWINDOWSTATIONPROCESS)); 06516 06517 pConsoleWindowStationInfo = (PCONSOLEWINDOWSTATIONPROCESS)ConsoleInformation; 06518 UserSetConsoleProcessWindowStation(pConsoleWindowStationInfo->dwProcessId, 06519 pConsoleWindowStationInfo->hwinsta); 06520 break; 06521 06522 #if defined(FE_IME) 06523 /* 06524 * For console IME issue 06525 * 06526 * Console IME do register thread ID in DESKTOP info. 06527 * So should be per desktop. 06528 */ 06529 case ConsoleRegisterConsoleIME: 06530 { 06531 PCONSOLE_REGISTER_CONSOLEIME RegConIMEInfo; 06532 DWORD dwConsoleIMEThreadIdOld; 06533 06534 UserAssert(ConsoleInformationLength == sizeof(CONSOLE_REGISTER_CONSOLEIME)); 06535 06536 RegConIMEInfo = (PCONSOLE_REGISTER_CONSOLEIME)ConsoleInformation; 06537 RegConIMEInfo->dwConsoleInputThreadId = 0; 06538 06539 Status = ObReferenceObjectByHandle( 06540 RegConIMEInfo->hdesk, 06541 0, 06542 *ExDesktopObjectType, 06543 UserMode, 06544 &pdesk, 06545 NULL); 06546 if (!NT_SUCCESS(Status)) 06547 return Status; 06548 06549 LogDesktop(pdesk, LD_REF_FN_CONSOLECONTROL2, TRUE, (ULONG_PTR)PtiCurrent()); 06550 06551 Status = STATUS_SUCCESS; 06552 if (pdesk->dwConsoleThreadId) 06553 { 06554 /* 06555 * Exists console input thread 06556 */ 06557 RegConIMEInfo->dwConsoleInputThreadId = pdesk->dwConsoleThreadId; 06558 06559 dwConsoleIMEThreadIdOld = pdesk->dwConsoleIMEThreadId; 06560 06561 if (RegConIMEInfo->dwAction != REGCONIME_QUERY) { 06562 PTHREADINFO ptiConsoleIME; 06563 06564 if ((ptiConsoleIME = PtiFromThreadId(RegConIMEInfo->dwThreadId)) != NULL) 06565 { 06566 if ( (RegConIMEInfo->dwAction == REGCONIME_REGISTER) && 06567 !(ptiConsoleIME->TIF_flags & TIF_DONTATTACHQUEUE) ) 06568 { 06569 /* 06570 * Register 06571 */ 06572 ptiConsoleIME->TIF_flags |= TIF_DONTATTACHQUEUE; 06573 pdesk->dwConsoleIMEThreadId = RegConIMEInfo->dwThreadId; 06574 } 06575 else if ( (RegConIMEInfo->dwAction == REGCONIME_UNREGISTER) && 06576 (ptiConsoleIME->TIF_flags & TIF_DONTATTACHQUEUE) ) 06577 { 06578 /* 06579 * Unregister 06580 */ 06581 ptiConsoleIME->TIF_flags &= ~TIF_DONTATTACHQUEUE; 06582 pdesk->dwConsoleIMEThreadId = 0; 06583 } 06584 else if (RegConIMEInfo->dwAction == REGCONIME_TERMINATE) 06585 { 06586 /* 06587 * Terminate console IME (Logoff/Shutdown) 06588 */ 06589 pdesk->dwConsoleIMEThreadId = 0; 06590 } 06591 } 06592 else if (RegConIMEInfo->dwAction == REGCONIME_TERMINATE) 06593 { 06594 /* 06595 * Abnormal end console IME 06596 */ 06597 pdesk->dwConsoleIMEThreadId = 0; 06598 } 06599 else 06600 Status = STATUS_ACCESS_DENIED; 06601 } 06602 RegConIMEInfo->dwThreadId = dwConsoleIMEThreadIdOld; 06603 } 06604 LogDesktop(pdesk, LD_DEREF_FN_CONSOLECONTROL2, FALSE, (ULONG_PTR)PtiCurrent()); 06605 ObDereferenceObject(pdesk); 06606 return Status; 06607 } 06608 break; 06609 #endif 06610 06611 case ConsoleFullscreenSwitch: 06612 UserAssert(ConsoleInformationLength == sizeof(CONSOLE_FULLSCREEN_SWITCH)); 06613 xxxbFullscreenSwitch(((PCONSOLE_FULLSCREEN_SWITCH)ConsoleInformation)->bFullscreenSwitch, 06614 ((PCONSOLE_FULLSCREEN_SWITCH)ConsoleInformation)->hwnd); 06615 break; 06616 06617 case ConsoleSetCaretInfo: 06618 UserAssert(ConsoleInformationLength == sizeof(CONSOLE_CARET_INFO)); 06619 xxxSetConsoleCaretInfo((PCONSOLE_CARET_INFO)ConsoleInformation); 06620 break; 06621 06622 default: 06623 RIPMSG0(RIP_ERROR, "xxxConsoleControl - invalid control class\n"); 06624 UserAssert(FALSE); 06625 return STATUS_INVALID_INFO_CLASS; 06626 } 06627 return STATUS_SUCCESS; 06628 }

BOOL xxxCreateCaret PWND  ,
HBITMAP  ,
int  ,
int 
 

Definition at line 254 of file caret.c.

References _SetSystemTimer(), BOOL, tagQ::caret, CaretBlinkProc(), CheckLock, tagCARET::cx, tagCARET::cy, cy, DeferWinEventNotify, FALSE, tagCARET::fOn, tagCARET::fVisible, FWINABLE, GETPTI, gpsi, tagCARET::hBitmap, tagCARET::hTimer, IDSYS_CARET, tagCARET::iHideLevel, IsWinEventNotifyDeferredOK, Lock, NULL, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, SYSMET, tagCARET::tid, TIDq, TRUE, xxxWindowEvent(), zzzEndDeferWinEventNotify, and zzzInternalDestroyCaret().

Referenced by NtUserCreateCaret(), and xxxSBWndProc().

00259 { 00260 PQ pq; 00261 BITMAP bitmap; 00262 PTHREADINFO ptiCurrent = PtiCurrent(); 00263 00264 CheckLock(pwnd); 00265 UserAssert(IsWinEventNotifyDeferredOK()); 00266 00267 pq = ptiCurrent->pq; 00268 00269 /* 00270 * Don't allow the app to create a caret in a window 00271 * from another queue. 00272 */ 00273 if (GETPTI(pwnd)->pq != pq) { 00274 return FALSE; 00275 } 00276 00277 /* 00278 * Defer WinEvent notifications to preserve pq 00279 */ 00280 DeferWinEventNotify(); 00281 00282 if (pq->caret.spwnd != NULL) 00283 zzzInternalDestroyCaret(); 00284 00285 Lock(&pq->caret.spwnd, pwnd); 00286 pq->caret.iHideLevel = 1; 00287 pq->caret.fOn = TRUE; 00288 pq->caret.fVisible = FALSE; 00289 pq->caret.tid = TIDq(ptiCurrent); 00290 00291 if (cy == 0) 00292 cy = SYSMET(CYBORDER); 00293 if (cx == 0) 00294 cx = SYSMET(CXBORDER); 00295 00296 if ((pq->caret.hBitmap = hBitmap) > (HBITMAP)1) { 00297 GreExtGetObjectW(hBitmap, sizeof(BITMAP), &bitmap); 00298 cy = bitmap.bmHeight; 00299 cx = bitmap.bmWidth; 00300 } 00301 00302 pq->caret.cy = cy; 00303 pq->caret.cx = cx; 00304 00305 pq->caret.hTimer = _SetSystemTimer(pwnd, IDSYS_CARET, gpsi->dtCaretBlink, 00306 CaretBlinkProc); 00307 00308 UserAssert(pwnd == pq->caret.spwnd); 00309 zzzEndDeferWinEventNotify(); 00310 if (FWINABLE()) { 00311 /* 00312 * It's best to force this routine to be an xxx routine: that way we can 00313 * force pwnd to be locked and force notifications from within this routine 00314 * and all of the callers are happy with this. 00315 */ 00316 xxxWindowEvent(EVENT_OBJECT_CREATE, pwnd, OBJID_CARET, INDEXID_CONTAINER, 0); 00317 } 00318 00319 return TRUE; 00320 }

void xxxCreateClassSmIcon PCLS  pcls  ) 
 

Definition at line 172 of file classchg.c.

References CSF_CACHEDSMICON, tagCLS::CSF_flags, tagCLS::cWndReferenceCount, Lock, PtoH, PTR_TO_ID, SYSMET, VOID(), and xxxClientCopyImage().

Referenced by xxxCreateWindowEx(), xxxRecreateSmallIcons(), and xxxSetClassIcon().

00174 { 00175 PCURSOR pcur; 00176 00177 UserAssert(pcls->cWndReferenceCount > 0); 00178 UserAssert(pcls->spicn); 00179 UserAssert(!pcls->spicnSm); 00180 00181 pcur = xxxClientCopyImage(PtoH(pcls->spicn), 00182 pcls->spicn->rt == PTR_TO_ID(RT_ICON) ? IMAGE_ICON : IMAGE_CURSOR, 00183 SYSMET(CXSMICON), 00184 SYSMET(CYSMICON), 00185 LR_DEFAULTCOLOR | LR_COPYFROMRESOURCE); 00186 00187 Lock(&pcls->spicnSm, pcur); 00188 if (pcls->spicnSm) 00189 pcls->CSF_flags |= CSF_CACHEDSMICON; 00190 }

PWND xxxCreateDefaultImeWindow IN PWND  pwnd,
IN ATOM  atomT,
IN HANDLE  hInst
 

Definition at line 531 of file ntimm.c.

References tagSERVERINFO::atomSysClass, CFIME, CreateInputContext(), DesktopAlloc(), DesktopFree, DTAG_IMETEXT, DWORD, FALSE, GETPTI, gpidLogon, gpsi, hInst, ICLS_IME, NULL, tagDESKTOP::pheapDesktop, tagTHREADINFO::ppi, ProbeForWrite(), PtiCurrentShared, tagTHREADINFO::rpdesk, RtlInitLargeUnicodeString(), tagTHREADINFO::spDefaultImc, tagTHREADINFO::spwndDefaultIme, TestCF, TestWF, TestwndChild, ThreadLock, ThreadUnlock, TIF_DISABLEIME, tagTHREADINFO::TIF_flags, TRUE, UINT, VER40, WFSERVERSIDEPROC, wszDefaultIme, and xxxCreateWindowEx().

Referenced by xxxCreateWindowEx().

00535 { 00536 LARGE_STRING strWindowName; 00537 PWND pwndDefaultIme; 00538 TL tlpwnd; 00539 PIMEUI pimeui; 00540 PTHREADINFO ptiCurrent = PtiCurrentShared(); 00541 LPWSTR pwszDefaultIme; 00542 00543 UserAssert(ptiCurrent == GETPTI(pwnd) && ptiCurrent->spwndDefaultIme == NULL); 00544 00545 /* 00546 * Those conditions should have been checked by WantImeWindow() 00547 * before xxxCreateDefaultImeWindow gets called. 00548 */ 00549 UserAssert(!(ptiCurrent->TIF_flags & TIF_DISABLEIME)); 00550 UserAssert(!TestWF(pwnd, WFSERVERSIDEPROC)); 00551 00552 /* 00553 * The first Winlogon thread starts without default input context. 00554 * Create it now. 00555 */ 00556 if (ptiCurrent->spDefaultImc == NULL && 00557 ptiCurrent->pEThread->Cid.UniqueProcess == gpidLogon) 00558 CreateInputContext(0); 00559 00560 /* 00561 * No default IME window for thread that doesn't have 00562 * default input context 00563 */ 00564 if (ptiCurrent->spDefaultImc == NULL) 00565 return (PWND)NULL; 00566 00567 /* 00568 * Avoid recursion 00569 */ 00570 if (atomT == gpsi->atomSysClass[ICLS_IME] || TestCF(pwnd, CFIME)) 00571 return (PWND)NULL; 00572 00573 /* 00574 * B#12165-win95b 00575 * Yet MFC does another nice. We need to avoid to give an IME window 00576 * to the child of desktop window which is in different process. 00577 */ 00578 if (TestwndChild(pwnd) && GETPTI(pwnd->spwndParent)->ppi != ptiCurrent->ppi && 00579 !(pwnd->style & WS_VISIBLE)) 00580 return (PWND)NULL; 00581 00582 if (ptiCurrent->rpdesk->pheapDesktop == NULL) 00583 return (PWND)NULL; 00584 00585 /* 00586 * Allocate storage for L"Default IME" string from desktop heap 00587 * so that it can be referenced from USER32.DLL in user mode. 00588 */ 00589 pwszDefaultIme = (LPWSTR)DesktopAlloc(ptiCurrent->rpdesk, 00590 sizeof(wszDefaultIme), 00591 DTAG_IMETEXT); 00592 if (pwszDefaultIme == NULL) 00593 return (PWND)NULL; 00594 00595 RtlCopyMemory(pwszDefaultIme, wszDefaultIme, sizeof(wszDefaultIme)); 00596 00597 RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)&strWindowName, 00598 pwszDefaultIme, 00599 (UINT)-1); 00600 00601 ThreadLock(pwnd, &tlpwnd); 00602 00603 pwndDefaultIme = xxxCreateWindowEx( (DWORD)0, 00604 (PLARGE_STRING)gpsi->atomSysClass[ICLS_IME], 00605 (PLARGE_STRING)&strWindowName, 00606 WS_POPUP | WS_DISABLED, 00607 0, 0, 0, 0, 00608 pwnd, (PMENU)NULL, 00609 hInst, NULL, VER40); 00610 00611 00612 if (pwndDefaultIme != NULL) { 00613 pimeui = ((PIMEWND)pwndDefaultIme)->pimeui; 00614 UserAssert(pimeui != NULL && (LONG_PTR)pimeui != (LONG_PTR)-1); 00615 try { 00616 ProbeForWrite(pimeui, sizeof *pimeui, sizeof(DWORD)); 00617 pimeui->fDefault = TRUE; 00618 if (TestwndChild(pwnd) && GETPTI(pwnd->spwndParent) != ptiCurrent) { 00619 pimeui->fChildThreadDef = TRUE; 00620 } 00621 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00622 } 00623 } 00624 00625 ThreadUnlock(&tlpwnd); 00626 00627 DesktopFree(ptiCurrent->rpdesk, pwszDefaultIme); 00628 00629 return pwndDefaultIme; 00630 }

HDESK xxxCreateDesktop POBJECT_ATTRIBUTES  ,
KPROCESSOR_MODE  ,
PUNICODE_STRING  ,
LPDEVMODEW  ,
DWORD  ,
DWORD 
 

Definition at line 1797 of file desktop.c.

References BeginAtomicCheck, BOOL, CheckCritIn, CleanupDirtyDesktops(), CloseProtectedHandle(), DeferWinEventNotify, DESKTOPCLASS, DF_DESKCREATED, tagDESKTOP::dwDTFlags, dwFlags, _DESKTOP_CONTEXT::dwFlags, DWORD, tagTERMINAL::dwTERMF_Flags, tagWINDOWSTATION::dwWSF_Flags, EndAtomicCheck, EnterCrit, Error, EVENT_INCREMENT, ExDesktopObjectType, ExWindowStationObjectType, FALSE, tagDISPLAYINFO::fDesktopIsRect, fGdiEnabled, gatomMessage, gbRemoteSession, GetDesktopView(), gpepCSRSS, gpEventDiconnectDesktop, gptiRit, grpdeskLogon, grpdeskRitInput, gspdeskDisconnect, gspwndFullScreen, gTermIO, tagTHREADINFO::hdesk, HF_DESKTOPHOOK, HF_PROTECTED, HH_DISCONNECTDESKTOP, HMChangeOwnerThread(), hModuleWin, tagWND::hrgnClip, tagDISPLAYINFO::hrgnScreen, HYDRA_HINT, IsWinEventNotifyDeferredOK, KernelMode, KeSetEvent(), LeaveCrit, LinkWindow(), Lock, LogDesktop, _DESKTOP_CONTEXT::lpDevMode, MapDesktop(), MENUCLASS, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObOpenHandle, ObOpenObjectByName(), ObReferenceObjectByHandle(), tagDESKTOP::pDeskInfo, tagDESKTOP::pDispInfo, tagTERMINAL::pEventInputReady, tagTHREADINFO::ppi, PpiCurrent, PpiFromProcess, tagDESKTOPINFO::ppiShellProcess, _DESKTOP_CONTEXT::pstrDevice, tagWINDOWSTATION::pTerm, PtiCurrent, tagTERMINAL::ptiDesktop, tagTHREADINFO::pwinsta, PWND_BOTTOM, tagDISPLAYINFO::rcScreen, tagTHREADINFO::rpdesk, tagPROCESSINFO::rpdeskStartup, tagDESKTOP::rpwinstaParent, SetFullScreen, SetHandleFlag(), tagDESKTOPINFO::spwnd, tagTERMINAL::spwndDesktopOwner, tagDESKTOP::spwndMenu, tagDESKTOP::spwndMessage, tagWND::spwndOwner, tagWND::spwndParent, tagDESKTOP::spwndTooltip, Status, TERMF_NOIO, ThreadLock, ThreadLockWithPti, ThreadUnlock, TIF_DISABLEHOOKS, tagTHREADINFO::TIF_flags, TOOLTIPCLASS, TRACE_INIT, TRUE, Unlock, UnlockDesktop, UserSleep(), VER31, WSF_NOIO, xxxCloseDesktop(), xxxCreateDisconnectDesktop(), xxxCreateWindowEx(), xxxDestroyWindow(), xxxSetWindowPos(), xxxSwitchDesktop(), zzzEndDeferWinEventNotify, and zzzSetDesktop().

Referenced by NtUserCreateDesktop(), xxxConnectService(), and xxxCreateDisconnectDesktop().

01804 { 01805 HWINSTA hwinsta; 01806 HDESK hdesk; 01807 DESKTOP_CONTEXT Context; 01808 PDESKTOP pdesk; 01809 PDESKTOPINFO pdi; 01810 PWINDOWSTATION pwinsta; 01811 PDESKTOP pdeskTemp; 01812 HDESK hdeskTemp; 01813 PWND pwndDesktop = NULL; 01814 PWND pwndMessage = NULL; 01815 PWND pwndTooltip = NULL; 01816 PWND pwndMenu = NULL; 01817 TL tlpwnd; 01818 PTHREADINFO ptiCurrent = PtiCurrent(); 01819 BOOL fWasNull; 01820 BOOL bSuccess; 01821 PPROCESSINFO ppi; 01822 PPROCESSINFO ppiSave; 01823 PTERMINAL pTerm; 01824 NTSTATUS Status; 01825 DWORD dwDisableHooks; 01826 01827 #if DBG 01828 /* 01829 * Too many jumps in this function to use BEGIN/ENDATOMICHCECK 01830 */ 01831 DWORD dwCritSecUseSave = gdwCritSecUseCount; 01832 #endif 01833 01834 CheckCritIn(); 01835 01836 UserAssert(IsWinEventNotifyDeferredOK()); 01837 01838 /* 01839 * Capture directory handle and check for create access. 01840 */ 01841 try { 01842 hwinsta = ccxObjectAttributes->RootDirectory; 01843 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 01844 return NULL; 01845 } 01846 if (hwinsta != NULL) { 01847 Status = ObReferenceObjectByHandle( 01848 hwinsta, 01849 WINSTA_CREATEDESKTOP, 01850 *ExWindowStationObjectType, 01851 ProbeMode, 01852 &pwinsta, 01853 NULL); 01854 if (NT_SUCCESS(Status)) { 01855 ObDereferenceObject(pwinsta); 01856 } else { 01857 RIPNTERR0(Status, RIP_VERBOSE, "ObReferenceObjectByHandle Failed"); 01858 return NULL; 01859 } 01860 } 01861 01862 /* 01863 * Set up creation context 01864 */ 01865 Context.lpDevMode = ccxlpdevmode; 01866 Context.pstrDevice = ccxpstrDevice; 01867 Context.dwFlags = dwFlags; 01868 01869 /* 01870 * Create the desktop -- the object manager uses try blocks 01871 */ 01872 Status = ObOpenObjectByName( 01873 ccxObjectAttributes, 01874 *ExDesktopObjectType, 01875 ProbeMode, 01876 NULL, 01877 dwDesiredAccess, 01878 &Context, 01879 &hdesk); 01880 01881 if (!NT_SUCCESS(Status)) { 01882 01883 RIPNTERR1(Status, 01884 RIP_WARNING, 01885 "xxxCreateDesktop: ObOpenObjectByName failed with Status 0x%x", 01886 Status); 01887 01888 /* 01889 * Cleanup desktop objects that were created in xxxCreateDesktop2 01890 * but later on the Ob manager failed the creation for other 01891 * reasons (ex: no quota) 01892 */ 01893 CleanupDirtyDesktops(); 01894 01895 return NULL; 01896 } 01897 01898 /* 01899 * If the desktop already exists, we're done. This will only happen 01900 * if OBJ_OPENIF was specified. 01901 */ 01902 if (Status == STATUS_OBJECT_NAME_EXISTS) { 01903 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 01904 RIPMSG0(RIP_WARNING, "xxxCreateDesktop: Object name exists"); 01905 return hdesk; 01906 } 01907 01908 /* 01909 * Reference the desktop to finish initialization 01910 */ 01911 Status = ObReferenceObjectByHandle( 01912 hdesk, 01913 0, 01914 *ExDesktopObjectType, 01915 KernelMode, 01916 &pdesk, 01917 NULL); 01918 if (!NT_SUCCESS(Status)) { 01919 RIPNTERR0(Status, RIP_VERBOSE, ""); 01920 CloseProtectedHandle(hdesk); 01921 return NULL; 01922 } 01923 01924 pdesk->dwDTFlags |= DF_DESKCREATED; 01925 01926 LogDesktop(pdesk, LD_REF_FN_CREATEDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 01927 01928 pwinsta = pdesk->rpwinstaParent; 01929 pTerm = pwinsta->pTerm; 01930 pdi = pdesk->pDeskInfo; 01931 01932 pdi->ppiShellProcess = NULL; 01933 01934 /* 01935 * If the desktop was not mapped in as a result of the open, 01936 * fail. 01937 */ 01938 ppi = PpiCurrent(); 01939 if (GetDesktopView(ppi, pdesk) == NULL) { 01940 01941 /* 01942 * Desktop mapping failed. 01943 */ 01944 CloseProtectedHandle(hdesk); 01945 01946 LogDesktop(pdesk, LD_DEREF_FN_CREATEDESKTOP1, FALSE, (ULONG_PTR)PtiCurrent()); 01947 01948 ObDereferenceObject(pdesk); 01949 RIPNTERR0(STATUS_ACCESS_DENIED, RIP_WARNING, "Desktop mapping failed"); 01950 return NULL; 01951 } 01952 01953 if (gpepCSRSS != NULL) { 01954 /* 01955 * Map the desktop into CSRSS to ensure that the 01956 * hard error handler can get access. 01957 */ 01958 try { 01959 MapDesktop(ObOpenHandle, gpepCSRSS, pdesk, 0, 1); 01960 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 01961 01962 /* 01963 * Desktop mapping failed. 01964 */ 01965 CloseProtectedHandle(hdesk); 01966 01967 LogDesktop(pdesk, LD_DEREF_FN_CREATEDESKTOP2, FALSE, (ULONG_PTR)PtiCurrent()); 01968 01969 ObDereferenceObject(pdesk); 01970 RIPNTERR0(STATUS_ACCESS_DENIED, RIP_WARNING, "Desktop mapping failed (2)"); 01971 return NULL; 01972 } 01973 01974 UserAssert(GetDesktopView(PpiFromProcess(gpepCSRSS), pdesk) != NULL); 01975 } 01976 01977 /* 01978 * Set hook flags 01979 */ 01980 SetHandleFlag(hdesk, HF_DESKTOPHOOK, dwFlags & DF_ALLOWOTHERACCOUNTHOOK); 01981 01982 /* 01983 * Set up to create the desktop window. 01984 */ 01985 fWasNull = (ptiCurrent->ppi->rpdeskStartup == NULL); 01986 pdeskTemp = ptiCurrent->rpdesk; // save current desktop 01987 hdeskTemp = ptiCurrent->hdesk; 01988 01989 /* 01990 * Switch ppi values so window will be created using the 01991 * system's desktop window class. 01992 */ 01993 ppiSave = ptiCurrent->ppi; 01994 ptiCurrent->ppi = pTerm->ptiDesktop->ppi; 01995 01996 DeferWinEventNotify(); 01997 BeginAtomicCheck(); 01998 01999 zzzSetDesktop(ptiCurrent, pdesk, hdesk); 02000 02001 /* 02002 * Create the desktop window 02003 */ 02004 /* 02005 * HACK HACK HACK!!! (adams) In order to create the desktop window 02006 * with the correct desktop, we set the desktop of the current thread 02007 * to the new desktop. But in so doing we allow hooks on the current 02008 * thread to also hook this new desktop. This is bad, because we don't 02009 * want the desktop window to be hooked while it is created. So we 02010 * temporarily disable hooks of the current thread and its desktop, 02011 * and reenable them after switching back to the original desktop. 02012 */ 02013 02014 dwDisableHooks = ptiCurrent->TIF_flags & TIF_DISABLEHOOKS; 02015 ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS; 02016 02017 pwndDesktop = xxxCreateWindowEx( 02018 (DWORD)0, 02019 (PLARGE_STRING)DESKTOPCLASS, 02020 NULL, 02021 (WS_POPUP | WS_CLIPCHILDREN), 02022 pdesk->pDispInfo->rcScreen.left, 02023 pdesk->pDispInfo->rcScreen.top, 02024 pdesk->pDispInfo->rcScreen.right - pdesk->pDispInfo->rcScreen.left, 02025 pdesk->pDispInfo->rcScreen.bottom - pdesk->pDispInfo->rcScreen.top, 02026 NULL, 02027 NULL, 02028 hModuleWin, 02029 NULL, 02030 VER31); 02031 02032 if (pwndDesktop == NULL) { 02033 RIPMSG1(RIP_WARNING, 02034 "xxxCreateDesktop: Failed to create the desktop window for pdesk %#p", 02035 pdesk); 02036 goto Error; 02037 } 02038 02039 /* 02040 * NOTE: In order for the message window to be created without 02041 * the desktop as it's owner, it needs to be created before 02042 * setting pdi->spwnd to the desktop window. This is a complete 02043 * hack and should be fixed. 02044 */ 02045 pwndMessage = xxxCreateWindowEx( 02046 (DWORD)0, 02047 (PLARGE_STRING)gatomMessage, 02048 NULL, 02049 (WS_POPUP | WS_CLIPCHILDREN), 02050 0, 02051 0, 02052 100, 02053 100, 02054 NULL, 02055 NULL, 02056 hModuleWin, 02057 NULL, 02058 VER31); 02059 02060 if (pwndMessage == NULL) { 02061 RIPMSG0(RIP_WARNING, "xxxCreateDesktop: Failed to create the message window"); 02062 goto Error; 02063 } 02064 02065 UserAssert(pdi->spwnd == NULL); 02066 02067 Lock(&(pdi->spwnd), pwndDesktop); 02068 02069 SetFullScreen(pwndDesktop, GDIFULLSCREEN); 02070 02071 /* 02072 * set this windows to the fullscreen window if we don't have one yet 02073 */ 02074 02075 /* 02076 * LATER mikeke 02077 * this can be a problem if a desktop is created while we are in 02078 * FullScreenCleanup() 02079 */ 02080 02081 /* 02082 * Don't set gspwndFullScreen if fGdiEnabled has been cleared 02083 * (we may be in the middle of a disconnect). 02084 */ 02085 UserAssert(fGdiEnabled == TRUE); 02086 02087 if (gspwndFullScreen == NULL && !(pwinsta->dwWSF_Flags & WSF_NOIO)) { 02088 Lock(&(gspwndFullScreen), pwndDesktop); 02089 } 02090 02091 /* 02092 * NT Bug 388747: Link the message window to the mother desktop window 02093 * so that it properly has a parent. We will do this before we link the 02094 * desktop window just so the initial message window appears after the 02095 * initial desktop window (a minor optimization, but not necessary). 02096 */ 02097 Lock(&pwndMessage->spwndParent, pTerm->spwndDesktopOwner); 02098 LinkWindow(pwndMessage, NULL, pTerm->spwndDesktopOwner); 02099 Lock(&pdesk->spwndMessage, pwndMessage); 02100 Unlock(&pwndMessage->spwndOwner); 02101 02102 /* 02103 * Link it as a child but don't use WS_CHILD style 02104 */ 02105 LinkWindow(pwndDesktop, NULL, pTerm->spwndDesktopOwner); 02106 Lock(&pwndDesktop->spwndParent, pTerm->spwndDesktopOwner); 02107 Unlock(&pwndDesktop->spwndOwner); 02108 02109 /* 02110 * Make it regional if it's display configuration is regional. 02111 */ 02112 if (!pdesk->pDispInfo->fDesktopIsRect) { 02113 pwndDesktop->hrgnClip = pdesk->pDispInfo->hrgnScreen; 02114 } 02115 02116 /* 02117 * Create shared menu window and tooltip window 02118 */ 02119 ThreadLock(pdesk->spwndMessage, &tlpwnd); 02120 02121 /* 02122 * Create the tooltip window only for desktops in 02123 * interactive windowstations. 02124 */ 02125 if (!(pwinsta->dwWSF_Flags & WSF_NOIO)) { 02126 pwndTooltip = xxxCreateWindowEx( 02127 WS_EX_TOOLWINDOW | WS_EX_TOPMOST, 02128 (PLARGE_STRING)TOOLTIPCLASS, 02129 NULL, 02130 WS_POPUP | WS_BORDER, 02131 0, 02132 0, 02133 100, 02134 100, 02135 pdesk->spwndMessage, 02136 NULL, 02137 hModuleWin, 02138 NULL, 02139 VER31); 02140 02141 02142 if (pwndTooltip == NULL) { 02143 ThreadUnlock(&tlpwnd); 02144 RIPMSG0(RIP_WARNING, "xxxCreateDesktop: Failed to create the tooltip window"); 02145 goto Error; 02146 } 02147 02148 Lock(&pdesk->spwndTooltip, pwndTooltip); 02149 } 02150 02151 pwndMenu = xxxCreateWindowEx( 02152 WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 02153 (PLARGE_STRING)MENUCLASS, 02154 NULL, 02155 WS_POPUP | WS_BORDER, 02156 0, 02157 0, 02158 100, 02159 100, 02160 pdesk->spwndMessage, 02161 NULL, 02162 hModuleWin, 02163 NULL, 02164 WINVER); 02165 02166 ThreadUnlock(&tlpwnd); 02167 02168 if (pwndMenu == NULL) { 02169 RIPMSG0(RIP_WARNING, "xxxCreateDesktop: Failed to create the menu window"); 02170 goto Error; 02171 } 02172 02173 Lock(&(pdesk->spwndMenu), pwndMenu); 02174 02175 /* 02176 * Set the flag in the popupmenu structure that tells this 02177 * popup menu belongs to the pdesk->spwndMenu 02178 */ 02179 ((PMENUWND)pdesk->spwndMenu)->ppopupmenu->fDesktopMenu = TRUE; 02180 /* 02181 * Unlock spwndPopupMenu since the menu is not in use but mainly 02182 * so we won't have to special case this later when the menu is used. 02183 */ 02184 Unlock(&((PMENUWND)pdesk->spwndMenu)->ppopupmenu->spwndPopupMenu); 02185 02186 HMChangeOwnerThread(pdi->spwnd, pTerm->ptiDesktop); 02187 HMChangeOwnerThread(pwndMessage, pTerm->ptiDesktop); 02188 HMChangeOwnerThread(pdesk->spwndMenu, pTerm->ptiDesktop); 02189 02190 if (!(pwinsta->dwWSF_Flags & WSF_NOIO)) { 02191 HMChangeOwnerThread(pwndTooltip, pTerm->ptiDesktop); 02192 } 02193 02194 /* 02195 * Restore caller's ppi 02196 */ 02197 PtiCurrent()->ppi = ppiSave; 02198 02199 /* 02200 * HACK HACK HACK (adams): Renable hooks. 02201 */ 02202 UserAssert(ptiCurrent->TIF_flags & TIF_DISABLEHOOKS); 02203 ptiCurrent->TIF_flags = (ptiCurrent->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 02204 02205 /* 02206 * Restore the previous desktop 02207 */ 02208 zzzSetDesktop(ptiCurrent, pdeskTemp, hdeskTemp); 02209 02210 EndAtomicCheck(); 02211 UserAssert(dwCritSecUseSave == gdwCritSecUseCount); 02212 zzzEndDeferWinEventNotify(); 02213 02214 /* 02215 * If this is the first desktop, let the worker threads run now 02216 * that there is someplace to send input to. Reassign the event 02217 * to handle desktop destruction. 02218 */ 02219 if (pTerm->pEventInputReady != NULL) { 02220 02221 /* 02222 * Set the windowstation for RIT and desktop thread 02223 * so when EventInputReady is signaled the RIT and the desktop 02224 * will have a windowstation. 02225 */ 02226 if (!(pTerm->dwTERMF_Flags & TERMF_NOIO)) { 02227 gptiRit->pwinsta = pwinsta; 02228 } else { 02229 /* 02230 * let the desktop thread of the system terminal have 02231 * a rpdesk. 02232 */ 02233 zzzSetDesktop(pTerm->ptiDesktop, pdesk, NULL); 02234 } 02235 02236 pTerm->ptiDesktop->pwinsta = pwinsta; 02237 02238 KeSetEvent(pTerm->pEventInputReady, EVENT_INCREMENT, FALSE); 02239 02240 if (!(pTerm->dwTERMF_Flags & TERMF_NOIO)) { 02241 02242 LeaveCrit(); 02243 while (grpdeskRitInput == NULL) { 02244 UserSleep(20); 02245 RIPMSG0(RIP_WARNING, "Waiting for grpdeskRitInput to be set ..."); 02246 } 02247 EnterCrit(); 02248 } 02249 02250 ObDereferenceObject(pTerm->pEventInputReady); 02251 pTerm->pEventInputReady = NULL; 02252 } 02253 02254 02255 /* 02256 * HACK HACK: 02257 * LATER 02258 * 02259 * If we have a devmode passed in, then switch desktops ... 02260 */ 02261 02262 if (ccxlpdevmode) { 02263 02264 TRACE_INIT(("xxxCreateDesktop: about to call switch desktop\n")); 02265 02266 bSuccess = xxxSwitchDesktop(pwinsta, pdesk, TRUE); 02267 if (!bSuccess) { 02268 RIPMSG0(RIP_ERROR, "Failed to switch desktop on Create\n"); 02269 } 02270 02271 } else if (pTerm == &gTermIO){ 02272 02273 UserAssert(grpdeskRitInput != NULL); 02274 02275 /* 02276 * Force the window to the bottom of the z-order if there 02277 * is an active desktop so any drawing done on the desktop 02278 * window will not be seen. This will also allow 02279 * IsWindowVisible to work for apps on invisible 02280 * desktops. 02281 */ 02282 ThreadLockWithPti(ptiCurrent, pwndDesktop, &tlpwnd); 02283 xxxSetWindowPos(pwndDesktop, PWND_BOTTOM, 0, 0, 0, 0, 02284 SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | 02285 SWP_NOREDRAW | SWP_NOSIZE | SWP_NOSENDCHANGING); 02286 ThreadUnlock(&tlpwnd); 02287 } 02288 02289 /* 02290 * If it was null when we came in, make it null going out, or else 02291 * we'll have the wrong desktop selected into this. 02292 */ 02293 if (fWasNull) 02294 UnlockDesktop(&ptiCurrent->ppi->rpdeskStartup, 02295 LDU_PPI_DESKSTARTUP1, (ULONG_PTR)(ptiCurrent->ppi)); 02296 02297 if (gbRemoteSession && 02298 gspdeskDisconnect == NULL && 02299 pdesk == grpdeskLogon) { 02300 02301 UserAssert(hdesk != NULL); 02302 02303 /* 02304 * Create the 'disconnect' desktop 02305 */ 02306 if (!xxxCreateDisconnectDesktop(hwinsta, pwinsta)) { 02307 RIPMSG0(RIP_WARNING, "Failed to create the 'disconnect' desktop"); 02308 02309 LogDesktop(pdesk, LD_DEREF_FN_CREATEDESKTOP3, FALSE, (ULONG_PTR)PtiCurrent()); 02310 ObDereferenceObject(pdesk); 02311 02312 xxxCloseDesktop(hdesk, KernelMode); 02313 02314 return NULL; 02315 } 02316 02317 /* 02318 * Signal that the disconnect desktop got created. 02319 */ 02320 KeSetEvent(gpEventDiconnectDesktop, EVENT_INCREMENT, FALSE); 02321 02322 HYDRA_HINT(HH_DISCONNECTDESKTOP); 02323 } 02324 02325 Cleanup: 02326 02327 LogDesktop(pdesk, LD_DEREF_FN_CREATEDESKTOP3, FALSE, (ULONG_PTR)PtiCurrent()); 02328 ObDereferenceObject(pdesk); 02329 02330 TRACE_INIT(("xxxCreateDesktop: Leaving\n")); 02331 02332 if (hdesk != NULL) { 02333 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 02334 } 02335 return hdesk; 02336 02337 Error: 02338 02339 EndAtomicCheck(); 02340 UserAssert(dwCritSecUseSave == gdwCritSecUseCount); 02341 zzzEndDeferWinEventNotify(); 02342 02343 UserAssert(pwndMenu == NULL); 02344 02345 if (pwndTooltip != NULL) { 02346 xxxDestroyWindow(pwndTooltip); 02347 Unlock(&pdesk->spwndTooltip); 02348 } 02349 if (pwndMessage != NULL) { 02350 xxxDestroyWindow(pwndMessage); 02351 Unlock(&pdesk->spwndMessage); 02352 } 02353 if (pwndDesktop != NULL) { 02354 xxxDestroyWindow(pwndDesktop); 02355 Unlock(&pdi->spwnd); 02356 Unlock(&gspwndFullScreen); 02357 } 02358 /* 02359 * Restore caller's ppi 02360 */ 02361 PtiCurrent()->ppi = ppiSave; 02362 02363 UserAssert(ptiCurrent->TIF_flags & TIF_DISABLEHOOKS); 02364 ptiCurrent->TIF_flags = (ptiCurrent->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 02365 zzzSetDesktop(ptiCurrent, pdeskTemp, hdeskTemp); 02366 02367 CloseProtectedHandle(hdesk); 02368 hdesk = NULL; 02369 02370 /* 02371 * If it was null when we came in, make it null going out, or else 02372 * we'll have the wrong desktop selected into this. 02373 */ 02374 if (fWasNull) 02375 UnlockDesktop(&ptiCurrent->ppi->rpdeskStartup, 02376 LDU_PPI_DESKSTARTUP1, (ULONG_PTR)(ptiCurrent->ppi)); 02377 02378 goto Cleanup; 02379 02380 }

NTSTATUS xxxCreateThreadInfo PETHREAD  ,
BOOL 
 

Definition at line 1501 of file queue.c.

References AllocQueue(), ARRAY_SIZE, BEGINATOMICCHECK, BOOL, tagUSERSTARTUPINFO::cb, CheckCritIn, _CLIENTINFO::CI_flags, CI_REGISTERCLASSES, _ETHREAD::Cid, CLIENTINFO, ClientThreadSetup(), tagKL::CodePage, _CLIENTINFO::CodePage, CreateInputContext(), tagQ::cThreads, tagPROCESSINFO::cThreads, tagTHREADINFO::cti, DeferWinEventNotify, DF_DESTROYED, tagDESKTOP::dwDTFlags, _CLIENTINFO::dwExpWinVer, tagTHREADINFO::dwExpWinVer, tagUSERSTARTUPINFO::dwFlags, tagPROCESSINFO::dwHotkey, DWORD, _CLIENTINFO::dwTIFlags, tagUSERSTARTUPINFO::dwX, tagUSERSTARTUPINFO::dwXSize, tagUSERSTARTUPINFO::dwY, tagUSERSTARTUPINFO::dwYSize, ENDATOMICCHECK, EndDeferWinEventNotifyWithoutProcessing, EnterCrit, ExDesktopObjectType, ExEventObjectType, ExRaiseHardError(), FALSE, gbCleanedUpResources, gdwGuiThreads, GetJournallingQueue(), glinp, gpepCSRSS, gpidLogon, gppiScreenSaver, gpsi, gptiForeground, gptSSCursor, grpdeskRitInput, grpWinStaList, gspklBaseLayout, tagPROCESSINFO::hdeskStartup, tagTHREADINFO::hEventQueueClient, tagKL::hkl, _CLIENTINFO::hKL, tagPROCESSINFO::hMonitor, _EPROCESS::InheritedFromUniqueProcessId, IS_IME_ENABLED, IsWinEventNotifyDeferredOK, KernelMode, L, LeaveCrit, Lock, LockDesktop, LW_RegisterWindows(), NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), ParseReserved(), tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, tagDESKTOP::pDeskInfo, tagTHREADINFO::pDeskInfo, _EPROCESS::Peb, tagTHREADINFO::pEventQueueServer, PlayEventSound(), tagTHREADINFO::ppi, PpiCurrent, tagTHREADINFO::pq, ProtectHandle(), tagQ::ptiKeyboard, tagLASTINPUT::ptiLastWoken, tagPROCESSINFO::ptiList, tagQ::ptiMouse, tagTHREADINFO::ptiSibling, PUSERSTARTUPINFO, tagTHREADINFO::rpdesk, tagPROCESSINFO::rpdeskStartup, tagPROCESSINFO::rpwinsta, RtlGetExpWinVer(), _EPROCESS::SectionBaseAddress, SET_TIME_LAST_READ, SetAppCompatFlags(), SetForegroundPriority(), tagTHREADINFO::spklActive, Status, SYSCUR, _ETHREAD::Tcb, ThreadLockDesktop, _ETHREAD::ThreadsProcess, ThreadUnlockDesktop, TIF_ALLOWFOREGROUNDACTIVATE, TIF_CSRSSTHREAD, TIF_DISABLEIME, TIF_DONTATTACHQUEUE, tagTHREADINFO::TIF_flags, TIF_GUITHREADINITIALIZED, TIF_RESTRICTED, TIF_SYSTEMTHREAD, TIF_WAITFORINPUTIDLE, TIF_WOW64, TRUE, _EPROCESS::UniqueProcessId, USER_SOUND_OPEN, UserMode, tagPROCESSINFO::usi, ValidateHmonitor(), ValidateProcessSessionId, VER40, _EPROCESS::Win32Process, _KTHREAD::Win32Thread, tagUSERSTARTUPINFO::wShowWindow, xxxDestroyThreadInfo(), xxxResolveDesktop(), xxxSetProcessWindowStation(), zzzCalcStartCursorHide(), and zzzSetDesktop().

Referenced by InitSystemThread(), UserInitialize(), and UserThreadCallout().

01504 { 01505 DWORD dwTIFlags = 0; 01506 PPROCESSINFO ppi; 01507 PTHREADINFO ptiCurrent; 01508 PEPROCESS pEProcess = pEThread->ThreadsProcess; 01509 PUSERSTARTUPINFO pusi; 01510 PRTL_USER_PROCESS_PARAMETERS ProcessParams; 01511 PDESKTOP pdesk = NULL; 01512 HDESK hdesk = NULL; 01513 HWINSTA hwinsta; 01514 PQ pq; 01515 NTSTATUS Status; 01516 BOOL fFirstThread; 01517 PTEB pteb = NtCurrentTeb(); 01518 TL tlpdesk; 01519 01520 CheckCritIn(); 01521 UserAssert(IsWinEventNotifyDeferredOK()); 01522 01523 ValidateProcessSessionId(pEProcess); 01524 01525 /* 01526 * If CleanupResources was called for the last GUI thread then 01527 * we should not allow any more GUI threads 01528 */ 01529 if (gbCleanedUpResources) { 01530 RIPMSG0(RIP_ERROR, "No more GUI threads should be created"); 01531 return STATUS_PROCESS_IS_TERMINATING; 01532 } 01533 01534 /* 01535 * Increment the number of GUI threads in the session 01536 */ 01537 gdwGuiThreads++; 01538 01539 /* 01540 * Although all threads now have a ETHREAD structure, server-side 01541 * threads (RIT, Console, etc) don't have a client-server eventpair 01542 * handle. We use this to distinguish the two cases. 01543 */ 01544 01545 if (IsSystemThread) { 01546 dwTIFlags = TIF_SYSTEMTHREAD | TIF_DONTATTACHQUEUE | TIF_DISABLEIME; 01547 } 01548 01549 if (!(dwTIFlags & TIF_SYSTEMTHREAD) && pEProcess == gpepCSRSS) { 01550 dwTIFlags = TIF_CSRSSTHREAD | TIF_DONTATTACHQUEUE | TIF_DISABLEIME; 01551 } 01552 01553 ProcessParams = (pEProcess->Peb ? pEProcess->Peb->ProcessParameters : NULL); 01554 01555 /* 01556 * Locate the processinfo structure for the new thread. 01557 */ 01558 ppi = PpiCurrent(); 01559 01560 #if defined(_WIN64) 01561 /* 01562 * If the process is marked as an emulated 32bit app thus, 01563 * mark the thread as an emulated 32bit thread. 01564 * This is to be consistent with the way WOW16 marks threads. 01565 */ 01566 if (ppi->W32PF_Flags & W32PF_WOW64) { 01567 dwTIFlags |= TIF_WOW64; 01568 } 01569 #endif //defined(_WIN64) 01570 01571 /* 01572 * For Winlogon, only the first thread can have IME processing. 01573 */ 01574 if (gpidLogon == pEThread->Cid.UniqueProcess) { 01575 if (ppi->ptiList != NULL) { 01576 dwTIFlags |= TIF_DISABLEIME; 01577 RIPMSG1(RIP_VERBOSE, "WinLogon, second or other thread. pti=%x", pEThread->Tcb.Win32Thread); 01578 } 01579 } 01580 01581 /* 01582 * Allocate the thread-info structure. If it's a SYSTEMTHREAD, then 01583 * make sure we have enough space for the (pwinsta) pointer. This 01584 * is referenced in (paint.c: DoPaint) to assure desktop/input can 01585 * have a winsta to view. 01586 */ 01587 ptiCurrent = (PTHREADINFO)pEThread->Tcb.Win32Thread; 01588 01589 ptiCurrent->TIF_flags = dwTIFlags; 01590 Lock(&ptiCurrent->spklActive, gspklBaseLayout); 01591 ptiCurrent->pcti = &(ptiCurrent->cti); 01592 01593 /* 01594 * Check if no IME processing for all threads 01595 * in the same process. 01596 */ 01597 if (ppi->W32PF_Flags & W32PF_DISABLEIME) 01598 ptiCurrent->TIF_flags |= TIF_DISABLEIME; 01599 01600 /* 01601 * Hook up this queue to this process info structure, increment 01602 * the count of threads using this process info structure. Set up 01603 * the ppi before calling SetForegroundPriority(). 01604 */ 01605 UserAssert(ppi != NULL); 01606 01607 ptiCurrent->ppi = ppi; 01608 ptiCurrent->ptiSibling = ppi->ptiList; 01609 ppi->ptiList = ptiCurrent; 01610 ppi->cThreads++; 01611 01612 01613 if (pteb != NULL) 01614 pteb->Win32ThreadInfo = ptiCurrent; 01615 01616 /* 01617 * Point to the client info. 01618 */ 01619 if (dwTIFlags & TIF_SYSTEMTHREAD) { 01620 ptiCurrent->pClientInfo = UserAllocPoolWithQuota(sizeof(CLIENTINFO), 01621 TAG_CLIENTTHREADINFO); 01622 if (ptiCurrent->pClientInfo == NULL) { 01623 Status = STATUS_NO_MEMORY; 01624 goto CreateThreadInfoFailed; 01625 } 01626 } else { 01627 /* 01628 * If this is not a system thread then grab the user mode client info 01629 * elsewhere we use the GetClientInfo macro which looks here 01630 */ 01631 UserAssert(NtCurrentTeb() != NULL); 01632 ptiCurrent->pClientInfo = ((PCLIENTINFO)((NtCurrentTeb())->Win32ClientInfo)); 01633 01634 /* 01635 * set the SECURE flag in the thread flags if this is a secure process 01636 */ 01637 if (((PW32PROCESS)ppi)->W32PF_Flags & W32PF_RESTRICTED) { 01638 ptiCurrent->TIF_flags |= TIF_RESTRICTED; 01639 } 01640 } 01641 01642 01643 /* 01644 * Create the input event. 01645 */ 01646 Status = ZwCreateEvent(&ptiCurrent->hEventQueueClient, 01647 EVENT_ALL_ACCESS, 01648 NULL, 01649 SynchronizationEvent, 01650 FALSE); 01651 01652 if (NT_SUCCESS(Status)) { 01653 Status = ObReferenceObjectByHandle(ptiCurrent->hEventQueueClient, 01654 EVENT_ALL_ACCESS, 01655 *ExEventObjectType, 01656 UserMode, 01657 &ptiCurrent->pEventQueueServer, 01658 NULL); 01659 if (NT_SUCCESS(Status)) { 01660 Status = ProtectHandle(ptiCurrent->hEventQueueClient, TRUE); 01661 } else if (Status == STATUS_INVALID_HANDLE) { 01662 ptiCurrent->hEventQueueClient = NULL; 01663 } 01664 } 01665 if (!NT_SUCCESS(Status)) { 01666 goto CreateThreadInfoFailed; 01667 } 01668 01669 /* 01670 * Mark the process as having threads that need cleanup. See 01671 * DestroyProcessesObjects(). 01672 */ 01673 fFirstThread = !(ppi->W32PF_Flags & W32PF_THREADCONNECTED); 01674 ppi->W32PF_Flags |= W32PF_THREADCONNECTED; 01675 01676 /* 01677 * If we haven't copied over our startup info yet, do it now. 01678 * Don't bother copying the info if we aren't going to use it. 01679 */ 01680 if (ProcessParams) { 01681 01682 pusi = &ppi->usi; 01683 01684 if ((pusi->cb == 0) && (ProcessParams->WindowFlags != 0)) { 01685 pusi->cb = sizeof(USERSTARTUPINFO); 01686 pusi->dwX = ProcessParams->StartingX; 01687 pusi->dwY = ProcessParams->StartingY; 01688 pusi->dwXSize = ProcessParams->CountX; 01689 pusi->dwYSize = ProcessParams->CountY; 01690 pusi->dwFlags = ProcessParams->WindowFlags; 01691 pusi->wShowWindow = (WORD)ProcessParams->ShowWindowFlags; 01692 } 01693 01694 if (fFirstThread) { 01695 01696 /* 01697 * Set up the hot key, if there is one. 01698 * 01699 * If the STARTF_USEHOTKEY flag is given in the startup info, then 01700 * the hStdInput is the hotkey (new from Chicago). Otherwise, parse 01701 * it out in string format from the lpReserved string. 01702 */ 01703 if (ProcessParams->WindowFlags & STARTF_USEHOTKEY) { 01704 ppi->dwHotkey = HandleToUlong(ProcessParams->StandardInput); 01705 } else { 01706 ppi->dwHotkey = ParseReserved(ProcessParams->ShellInfo.Buffer, 01707 L"hotkey."); 01708 } 01709 01710 /* 01711 * Copy the monitor handle, if there is one. 01712 */ 01713 UserAssert(!ppi->hMonitor); 01714 if (ProcessParams->WindowFlags & STARTF_HASSHELLDATA) { 01715 HMONITOR hMonitor; 01716 01717 hMonitor = (HMONITOR)(ProcessParams->StandardOutput); 01718 if (ValidateHmonitor(hMonitor)) { 01719 ppi->hMonitor = hMonitor; 01720 } 01721 } 01722 } 01723 } 01724 01725 /* 01726 * Open the windowstation and desktop. If this is a system 01727 * thread only use the desktop that might be stored in the teb. 01728 */ 01729 UserAssert(ptiCurrent->rpdesk == NULL); 01730 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) && 01731 grpWinStaList) { 01732 01733 BOOL bShutDown = FALSE; 01734 01735 hdesk = xxxResolveDesktop( 01736 NtCurrentProcess(), 01737 &ProcessParams->DesktopInfo, 01738 &hwinsta, (ProcessParams->WindowFlags & STARTF_DESKTOPINHERIT), 01739 &bShutDown); 01740 01741 if (hdesk == NULL) { 01742 01743 if (bShutDown) { 01744 /* 01745 * Trying to create a new process during logoff 01746 */ 01747 ULONG_PTR adwParameters[5] = {0, 0, 0, 0, MB_DEFAULT_DESKTOP_ONLY}; 01748 ULONG ErrorResponse; 01749 01750 LeaveCrit(); 01751 01752 ExRaiseHardError((NTSTATUS)STATUS_DLL_INIT_FAILED_LOGOFF, 01753 ARRAY_SIZE(adwParameters), 01754 0, 01755 adwParameters, 01756 OptionOkNoWait, 01757 &ErrorResponse); 01758 01759 ZwTerminateProcess(NtCurrentProcess(), STATUS_DLL_INIT_FAILED); 01760 01761 EnterCrit(); 01762 } 01763 01764 Status = STATUS_DLL_INIT_FAILED; 01765 goto CreateThreadInfoFailed; 01766 01767 } else { 01768 01769 xxxSetProcessWindowStation(hwinsta, KernelMode); 01770 01771 /* 01772 * Reference the desktop handle 01773 */ 01774 Status = ObReferenceObjectByHandle( 01775 hdesk, 01776 0, 01777 *ExDesktopObjectType, 01778 KernelMode, 01779 &pdesk, 01780 NULL); 01781 01782 if (!NT_SUCCESS(Status)) { 01783 UserAssert(pdesk == NULL); 01784 goto CreateThreadInfoFailed; 01785 } 01786 01787 ThreadLockDesktop(ptiCurrent, pdesk, &tlpdesk, LDLT_FN_CREATETHREADINFO); 01788 01789 ObDereferenceObject(pdesk); 01790 01791 /* 01792 * The first desktop is the default for all succeeding threads. 01793 */ 01794 if ((ppi->hdeskStartup == NULL) && 01795 (pEProcess->UniqueProcessId != gpidLogon)) { 01796 01797 LockDesktop(&ppi->rpdeskStartup, pdesk, LDL_PPI_DESKSTARTUP2, (ULONG_PTR)ppi); 01798 ppi->hdeskStartup = hdesk; 01799 } 01800 } 01801 } 01802 01803 /* 01804 * Remember dwExpWinVer. This is used to return GetAppVer() (and 01805 * GetExpWinVer(NULL). 01806 */ 01807 if (pEProcess->Peb != NULL) 01808 ptiCurrent->dwExpWinVer = RtlGetExpWinVer(pEProcess->SectionBaseAddress); 01809 else 01810 ptiCurrent->dwExpWinVer = VER40; 01811 01812 ptiCurrent->pClientInfo->dwExpWinVer = ptiCurrent->dwExpWinVer; 01813 ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags; 01814 01815 if (ptiCurrent->spklActive) { 01816 ptiCurrent->pClientInfo->CodePage = ptiCurrent->spklActive->CodePage; 01817 ptiCurrent->pClientInfo->hKL = ptiCurrent->spklActive->hkl; 01818 } else { 01819 ptiCurrent->pClientInfo->CodePage = CP_ACP; 01820 ptiCurrent->pClientInfo->hKL = 0; 01821 } 01822 01823 /* 01824 * Set the desktop even if it is NULL to ensure that ptiCurrent->pDeskInfo 01825 * is set. 01826 * NOTE: This adds the pti to the desktop's PtiList, but we don't yet have 01827 * a pti->pq. zzzRecalcThreadAttachment loops through this PtiList expects 01828 * a pq, so we must not leave the critsect until we have a queue. 01829 * zzzSetDesktop only zzz leaves the critsect if there is a pti->pq, so we 01830 * can BEGINATOMICCHECK to ensure this, and make sure we allocate the queue 01831 * before we leave the critical section. 01832 */ 01833 BEGINATOMICCHECK(); 01834 zzzSetDesktop(ptiCurrent, pdesk, hdesk); 01835 ENDATOMICCHECK(); 01836 01837 /* 01838 * If we have a desktop and are journalling on that desktop, use 01839 * the journal queue, otherwise create a new queue. 01840 */ 01841 if (pdesk == grpdeskRitInput) { 01842 PQ pq; 01843 UserAssert((pdesk == NULL) || (ptiCurrent->pDeskInfo == pdesk->pDeskInfo)); 01844 UserAssert(ptiCurrent->rpdesk == pdesk); 01845 pq = GetJournallingQueue(ptiCurrent); 01846 if (pq != NULL) { 01847 ptiCurrent->pq = pq; 01848 pq->cThreads++; 01849 } 01850 } 01851 01852 /* 01853 * If not journalling, give this thread its own queue 01854 */ 01855 if (ptiCurrent->pq == NULL) { 01856 if ((pq = AllocQueue(NULL, NULL)) == NULL) { 01857 Status = STATUS_NO_MEMORY; 01858 goto CreateThreadInfoFailed; 01859 } 01860 /* 01861 * Attach the Q to the THREADINFO. 01862 */ 01863 ptiCurrent->pq = pq; 01864 pq->ptiMouse = pq->ptiKeyboard = ptiCurrent; 01865 pq->cThreads++; 01866 } 01867 01868 /* 01869 * Remember that this is a screen saver. That way we can set its 01870 * priority appropriately when it is idle or when it needs to go 01871 * away. At first we set it to normal priority, then we set the 01872 * TIF_IDLESCREENSAVER bit so that when it activates it will get 01873 * lowered in priority. 01874 */ 01875 if (ProcessParams && ProcessParams->WindowFlags & STARTF_SCREENSAVER) { 01876 01877 if (fFirstThread) { 01878 UserAssert(gppiScreenSaver == NULL); 01879 01880 /* 01881 * Make sure the parent's process is WinLogon, since only WinLogon is allowed to 01882 * use the STARTF_SCREENSAVER flag. 01883 */ 01884 if (gpidLogon == 0 || pEProcess->InheritedFromUniqueProcessId != gpidLogon) { 01885 RIPMSG0(RIP_WARNING,"Only the Logon process can launch a screen saver."); 01886 ProcessParams->WindowFlags &= ~STARTF_SCREENSAVER; 01887 goto NotAScreenSaver; 01888 } 01889 01890 gppiScreenSaver = ppi; 01891 gptSSCursor = gpsi->ptCursor; 01892 ppi->W32PF_Flags |= W32PF_SCREENSAVER; 01893 } 01894 #if DBG 01895 else { 01896 UserAssert(ppi->W32PF_Flags & W32PF_SCREENSAVER); 01897 } 01898 #endif 01899 01900 SetForegroundPriority(ptiCurrent, TRUE); 01901 01902 if (fFirstThread) { 01903 ppi->W32PF_Flags |= W32PF_IDLESCREENSAVER; 01904 } 01905 01906 /* 01907 * Screen saver doesn't need any IME processing. 01908 */ 01909 ptiCurrent->TIF_flags |= TIF_DISABLEIME; 01910 } 01911 01912 NotAScreenSaver: 01913 01914 /* 01915 * Do special processing for the first thread of a process. 01916 */ 01917 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD))) { 01918 01919 /* 01920 * I changed the code a while ago to unregister classes when the last 01921 * GUI thread is destroyed. Simply, there was too much stuff getting 01922 * unlocked and destroyed to guarantee that it would work on a non-GUI 01923 * thread. So if a process destroys its last GUI thread and then makes 01924 * a thread GUI later, we need to re-register the classes. 01925 */ 01926 01927 if (!(ppi->W32PF_Flags & W32PF_CLASSESREGISTERED)) { 01928 if (!LW_RegisterWindows(FALSE)) { 01929 RIPMSG0(RIP_WARNING, "xxxCreateThreadInfo: LW_RegisterWindows failed"); 01930 Status = STATUS_UNSUCCESSFUL; 01931 goto CreateThreadInfoFailed; 01932 } 01933 ppi->W32PF_Flags |= W32PF_CLASSESREGISTERED; 01934 if (ptiCurrent->pClientInfo) { 01935 ptiCurrent->pClientInfo->CI_flags |= CI_REGISTERCLASSES; 01936 } 01937 } 01938 01939 if (fFirstThread) { 01940 01941 /* 01942 * If this is an application starting (ie. not some thread of 01943 * the server context), enable the app-starting cursor. 01944 */ 01945 DeferWinEventNotify(); 01946 zzzCalcStartCursorHide((PW32PROCESS)pEProcess->Win32Process, 5000); 01947 EndDeferWinEventNotifyWithoutProcessing(); 01948 01949 /* 01950 * Open the windowstation 01951 */ 01952 if (grpWinStaList && ppi->rpwinsta == NULL) { 01953 RIPERR0(ERROR_CAN_NOT_COMPLETE, RIP_WARNING, "System is not initialized\n"); 01954 Status = STATUS_UNSUCCESSFUL; 01955 goto CreateThreadInfoFailed; 01956 } 01957 } 01958 } else { 01959 01960 /* 01961 * Don't register system windows until cursors and icons 01962 * have been loaded. 01963 */ 01964 if ((SYSCUR(ARROW) != NULL) && 01965 !(ppi->W32PF_Flags & W32PF_CLASSESREGISTERED)) { 01966 01967 ppi->W32PF_Flags |= W32PF_CLASSESREGISTERED; 01968 if (!LW_RegisterWindows(ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD)) { 01969 RIPMSG0(RIP_WARNING, "xxxCreateThreadInfo: LW_RegisterWindows failed"); 01970 Status = STATUS_UNSUCCESSFUL; 01971 goto CreateThreadInfoFailed; 01972 } 01973 } 01974 } 01975 01976 01977 /* 01978 * Initialize hung timer value 01979 */ 01980 01981 SET_TIME_LAST_READ(ptiCurrent); 01982 01983 /* 01984 * If someone is waiting on this process propagate that info into 01985 * the thread info 01986 */ 01987 if (ppi->W32PF_Flags & W32PF_WAITFORINPUTIDLE) 01988 ptiCurrent->TIF_flags |= TIF_WAITFORINPUTIDLE; 01989 01990 /* 01991 * Mark the thread as initialized. 01992 */ 01993 ptiCurrent->TIF_flags |= TIF_GUITHREADINITIALIZED; 01994 01995 /* 01996 * Allow the thread to come to foreground when it is created 01997 * if the current process is the foreground process or the last input owner 01998 * This Flag is a hack to fix Bug 28502. When we click on 01999 * "Map Network Drive" button on the toolbar, the explorer (Bobday) 02000 * creates another thread to create the dialog box. This will create 02001 * the dialog in the background. We are adding this fix at the request 02002 * of the Shell team so that this dialog comes up as foreground. 02003 * 02004 * If the process already has the foreground right, we don't give it 02005 * to this thread (it doesn't need it). We do this to narrow the number 02006 * of ways this process can force the foreground. 02007 * Also, if the process is starting, it already has the right unless 02008 * the user has canceled it -- in which case we don't want to give it back. 02009 * 02010 */ 02011 if (!(ppi->W32PF_Flags & (W32PF_ALLOWFOREGROUNDACTIVATE | W32PF_APPSTARTING))) { 02012 if (((gptiForeground != NULL) && (ppi == gptiForeground->ppi)) 02013 || ((glinp.ptiLastWoken != NULL) && (ppi == glinp.ptiLastWoken->ppi))) { 02014 02015 ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 02016 TAGMSG1(DBGTAG_FOREGROUND, "xxxCreateThreadInfo set TIF %#p", ptiCurrent); 02017 } 02018 } 02019 02020 if (IS_IME_ENABLED()) { 02021 /* 02022 * Create per-thread default input context 02023 */ 02024 CreateInputContext(0); 02025 } 02026 02027 /* 02028 * Call back to the client to finish initialization. 02029 */ 02030 if (!(dwTIFlags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD))) { 02031 02032 if (SetAppCompatFlags(ptiCurrent)) { 02033 /* 02034 * Flag this process as a setup app. 02035 */ 02036 ppi->W32PF_Flags |= W32PF_SETUPAPP; 02037 } 02038 02039 Status = ClientThreadSetup(); 02040 if (!NT_SUCCESS(Status)) { 02041 RIPMSG1(RIP_WARNING, "ClientThreadSetup failed with NTSTATUS %lx", Status); 02042 goto CreateThreadInfoFailed; 02043 } 02044 } 02045 02046 if ((NT_SUCCESS(Status) && fFirstThread) && 02047 !(ppi->W32PF_Flags & W32PF_CONSOLEAPPLICATION)) { 02048 02049 /* 02050 * Don't play the sound for console processes 02051 * since we will play it when the console window 02052 * will be created 02053 */ 02054 PlayEventSound(USER_SOUND_OPEN); 02055 } 02056 02057 /* 02058 * Release desktop. 02059 * Some other thread might have been waiting to destroy this desktop 02060 * when xxxResolveDestktop got a handle to it. So let's double 02061 * check this now that we have called back several times after getting 02062 * the handle back. 02063 */ 02064 if (pdesk != NULL) { 02065 if (pdesk->dwDTFlags & DF_DESTROYED) { 02066 RIPMSG1(RIP_WARNING, "xxxCreateThreadInfo: pdesk destroyed:%#p", pdesk); 02067 Status = STATUS_UNSUCCESSFUL; 02068 goto CreateThreadInfoFailed; 02069 } 02070 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_CREATETHREADINFO1); 02071 } 02072 02073 // We must return a success here. If the failure status is returned 02074 // W32Thread will be freed without us going thru xxxDestroyProcessInfo. 02075 UserAssert(NT_SUCCESS(Status)); 02076 02077 return Status; 02078 02079 CreateThreadInfoFailed: 02080 02081 RIPMSG2(RIP_WARNING, "xxxCreateThreadInfo: failed: pti %#p pdesk %#p", 02082 ptiCurrent, pdesk); 02083 02084 if (pdesk != NULL) { 02085 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_CREATETHREADINFO2); 02086 } 02087 xxxDestroyThreadInfo(); 02088 return Status; 02089 }

PWND xxxCreateWindowEx DWORD  dwStyle,
PLARGE_STRING  pstrClass,
PLARGE_STRING  pstrName,
DWORD  style,
int  x,
int  y,
int  cx,
int  cy,
PWND  pwndParent,
PMENU  pmenu,
HANDLE  hModule,
LPVOID  pCreateParams,
DWORD  dwExpWinVerAndFlags
 

Definition at line 33 of file createw.c.

References _GetDesktopWindow(), _MonitorFromWindow(), tagTHREADINFO::amdesk, ASSERT, tagCLS::atomClassName, tagSERVERINFO::atomSysClass, BOOL, _LARGE_UNICODE_STRING::Buffer, _LARGE_STRING::Buffer, CalcForegroundInsertAfter(), tagWND::cbwndExtra, CFCLASSDC, CFIME, CFNOCLOSE, CFOWNDC, CheckLock, _CLIENTINFO::CI_flags, CI_INPUTCONTEXT_REINIT, ClrWF, CopyRect, CreateCacheDC(), CREATESTRUCTEX, CSF_ANSIPROC, tagCLS::CSF_flags, CSF_SERVERSIDEPROC, tagPROCESSINFO::cThreads, CW2_USEDEFAULT, tagTHREADINFO::cWindows, tagMONITOR::cWndStack, tagSIZERECT::cx, tagSIZERECT::cy, cy, DF_DESKWNDDESTROYED, DF_DESTROYED, DF_DYING, DIALOGCLASS, tagDESKTOP::dwDTFlags, tagUSERSTARTUPINFO::dwFlags, tagPROCESSINFO::dwHotkey, DWORD, DWP_SetHotKey(), tagUSERSTARTUPINFO::dwX, tagUSERSTARTUPINFO::dwXSize, tagUSERSTARTUPINFO::dwY, tagUSERSTARTUPINFO::dwYSize, FALSE, FWINABLE, gaOleMainThreadWndClass, GetAppCompatFlags(), GetClassPtr(), GetPrimaryMonitor(), GETPTI, GetTopLevelWindow(), GETTOPMOSTINSERTAFTER, gpsi, tagTHREADINFO::hdesk, tagWND::head, tagWND::hImc, tagKL::hkl, HMAllocObject(), HMFreeObject(), tagPROCESSINFO::hMonitor, HW, HWq, ICLS_BUTTON, ICLS_COMBOBOX, ICLS_COMBOLISTBOX, ICLS_DIALOG, ICLS_EDIT, ICLS_IME, ICLS_LISTBOX, ICLS_MDICLIENT, ICLS_STATIC, Is310Compat, Is400Compat, Is500Compat, IS_IME_ENABLED, IS_PTR, IsHooked, IsWinEventNotifyDeferredOK, L, LARGE_STRING, LinkWindow(), Lock, LockWndMenu(), tagWND::lpfnWndProc, MapClientNeuterToClientPfn(), MaskWF, MINMAX_KEEPHIDDEN, NeedsWindowEdge(), NULL, NULL_HIMC, tagTHREADINFO::pClientInfo, tagWND::pcls, tagCLS::pdce, PLARGE_STRING, tagTHREADINFO::ppi, PtiCurrent, PtoH, PTR_TO_ID, PUDF_ANIMATE, PWND_BOTTOM, PWND_TOP, PWNDDESKTOP, PWNDMESSAGE, tagWND::rcClient, tagMONITOR::rcMonitor, tagWND::rcWindow, RECTFromSIZERECT(), ReferenceClass(), RETURN_IF_ACCESS_DENIED, RevalidateHwnd, tagTHREADINFO::rpdesk, RtlInitLargeAnsiString(), RtlInitUnicodeStringOrId(), SetMinimize(), SetTiledRect(), SetVisible(), SetWF, SIZERECT, SMIN_CLEAR, tagTHREADINFO::spDefaultImc, tagTHREADINFO::spklActive, tagWND::spmenu, tagTHREADINFO::spwndDefaultIme, tagWND::spwndLastActive, tagWND::spwndOwner, tagWND::spwndParent, tagWND::strName, SV_UNSET, TEST_PUDF, TestCF, TestCF2, TestWF, TestwndChild, TestwndPopup, TestwndTiled, ThreadLock, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TIF_16BIT, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, TYPE_WINDOW, UINT, UserFindAtom(), tagPROCESSINFO::usi, ValidateHmonitor(), ValidateOwnerDepth(), ValidateParentDepth(), WantImeWindow(), WEFAPPWINDOW, WEFNOPARENTNOTIFY, WEFTOOLWINDOW, WEFTOPMOST, WEFWINDOWEDGE, WFALWAYSSENDNCPAINT, WFANSICREATOR, WFANSIPROC, WFBORDER, WFCAPTION, WFCHILD, WFCLIPCHILDREN, WFCLIPSIBLINGS, WFDESTROYED, WFISINITIALIZED, WFMAXIMIZED, WFMINIMIZED, WFOLDUI, WFSENDSIZEMOVE, WFSERVERSIDEPROC, WFTITLESET, WFTYPEMASK, WFVISIBLE, WFWIN31COMPAT, WFWIN40COMPAT, WFWIN50COMPAT, WHF_CBT, WNDPROC_PWND, WS_EX_ANSICREATOR, tagSIZERECT::x, xxxAdjustSize(), xxxCallHook(), xxxCheckFullScreen(), xxxClientLoadMenu(), xxxClientWOWGetProcModule(), xxxCreateClassSmIcon(), xxxCreateDefaultImeWindow(), xxxDeleteMenu(), xxxDestroyWindow(), xxxFreeWindow(), xxxGetSystemMenu(), xxxMinMaximize(), xxxSendMessage(), xxxSendSizeMessage(), xxxSetLayeredWindow(), xxxShowWindow(), xxxWindowEvent(), tagSIZERECT::y, and zzzAttachThreadInput().

Referenced by NtUserCreateWindowEx(), xxxCreateDefaultImeWindow(), xxxCreateDesktop(), xxxCreateWindowStation(), xxxCsDdeInitialize(), xxxMNOpenHierarchy(), xxxNextWindow(), xxxOldNextWindow(), and xxxTrackPopupMenuEx().

00047 { 00048 /* 00049 * The buffers for Class and Name may be client memory, and access 00050 * to those buffers must be protected. 00051 */ 00052 UINT mask = 0; 00053 BOOL fChild; 00054 BOOL fDefPos = FALSE; 00055 BOOL fStartup = FALSE; 00056 PCLS pcls; 00057 PPCLS ppcls; 00058 RECT rc; 00059 int dx, dy; 00060 SIZERECT src; 00061 int sw = SW_SHOW; 00062 PWND pwnd; 00063 PWND pwndZOrder, pwndHardError; 00064 CREATESTRUCTEX csex; 00065 PDESKTOP pdesk; 00066 ATOM atomT; 00067 PTHREADINFO ptiCurrent; 00068 TL tlpwnd; 00069 TL tlpwndParent; 00070 TL tlpwndParentT; 00071 BOOL fLockParent = FALSE; 00072 WORD wWFAnsiCreator = 0; 00073 DWORD dw; 00074 DWORD dwMinMax; 00075 PMONITOR pMonitor; 00076 BOOL fTiled; 00077 #ifdef USE_MIRRORING 00078 DWORD dwLayout; 00079 #endif 00080 00081 CheckLock(pwndParent); 00082 UserAssert(IsWinEventNotifyDeferredOK()); 00083 00084 /* 00085 * For Edit Controls (including those in comboboxes), we must know whether 00086 * the App used an ANSI or a Unicode CreateWindow call. This is passed in 00087 * with the private WS_EX_ANSICREATOR dwExStyle bit, but we MUST NOT leave 00088 * out this bit in the window's dwExStyle! Transfer to the internal window 00089 * flag WFANSICREATOR immediately. 00090 */ 00091 if (dwExStyle & WS_EX_ANSICREATOR) { 00092 wWFAnsiCreator = WFANSICREATOR; 00093 dwExStyle &= ~WS_EX_ANSICREATOR; 00094 } 00095 00096 ptiCurrent = PtiCurrent(); 00097 /* 00098 * If this thread has already been in xxxDestroyThreadInfo, then this window 00099 * is probably going to end up with a bogus pti. 00100 */ 00101 UserAssert(!(ptiCurrent->TIF_flags & TIF_INCLEANUP)); 00102 pdesk = ptiCurrent->rpdesk; 00103 00104 /* 00105 * If a parent window is specified, make sure it's on the 00106 * same desktop. 00107 */ 00108 if (pwndParent != NULL && pwndParent->head.rpdesk != pdesk) { 00109 RIPERR0(ERROR_INVALID_PARAMETER, RIP_VERBOSE, ""); 00110 return NULL; 00111 } 00112 00113 /* 00114 * Set a flag to indicate whther a it is a child window 00115 */ 00116 fChild = ((HIWORD(style) & MaskWF(WFTYPEMASK)) == MaskWF(WFCHILD)); 00117 00118 #ifdef USE_MIRRORING 00119 /* 00120 00121 00122 The WS_EX_LAYOUT_RTL flag is set if, 00123 00124 1- WS_EX_LAYOUT_RTL set in dwExStyle parameter of the CreateWindow call. 00125 2- If the window is created from DialogBox class, then it can't inherit from its parent 00126 and it has to specify WS_EX_LAYOUTRTL explicitly to enable mirroring on it. 00127 3- If the window is an owned window then the window is left to right layout and the algorithm terminates. 00128 (An owned window is one created with an HWND passed in the hWndParent paremeter to CreateWindow(Ex), 00129 but without the WS_CHILD flag present in it's styles. 00130 4- If the window is a child window, and it's parent is right to left layout, 00131 and it's parent does not have the WS_EX_NOINHERIT_LAYOUT flag set in it's extended styles, 00132 then the window is right to left layout and the algorithm terminates. 00133 5- If the hWndParent parameter to Createwindow(Ex) was NULL, and the process calling CreateWindow(Ex) has called 00134 SetProcessDefaultLayout(LAYOUT_RTL), then the window is right to left layout and the algorithm terminates. 00135 6- In all other cases, the layout is left to right. 00136 */ 00137 00138 if (!(dwExStyle & WS_EX_LAYOUTRTL)) { 00139 if (pwndParent != NULL) { 00140 if (fChild && TestWF(pwndParent, WEFLAYOUTRTL) && !TestWF(pwndParent, WEFNOINHERITLAYOUT)) { 00141 dwExStyle |= WS_EX_LAYOUTRTL; 00142 } 00143 } else if (!(!IS_PTR(cczpstrClass) && (PTR_TO_ID(cczpstrClass) == PTR_TO_ID(DIALOGCLASS)))) { 00144 if ((_GetProcessDefaultLayout(&dwLayout)) && (dwLayout & LAYOUT_RTL)) { 00145 dwExStyle |= WS_EX_LAYOUTRTL; 00146 } 00147 } 00148 } 00149 #endif 00150 /* 00151 * Ensure that we can create the window. If there is no desktop 00152 * yet, assume that this will be the root desktop window and allow 00153 * the creation. 00154 */ 00155 if (ptiCurrent->hdesk) { 00156 RETURN_IF_ACCESS_DENIED( 00157 ptiCurrent->amdesk, DESKTOP_CREATEWINDOW, NULL); 00158 } 00159 00160 if (fChild) { 00161 00162 /* 00163 * Don't allow child windows without a parent handle. 00164 */ 00165 if (pwndParent == NULL) { 00166 RIPERR0(ERROR_TLW_WITH_WSCHILD, RIP_VERBOSE, ""); 00167 return NULL; 00168 } 00169 00170 if (!ValidateParentDepth(NULL, pwndParent)) { 00171 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Exceeded nested children limit"); 00172 return NULL; 00173 } 00174 } 00175 00176 /* 00177 * Make sure we can get the window class. 00178 */ 00179 if (IS_PTR(cczpstrClass)) { 00180 /* 00181 * UserFindAtom protects access of the string. 00182 */ 00183 atomT = UserFindAtom(cczpstrClass->Buffer); 00184 } else 00185 atomT = PTR_TO_ID(cczpstrClass); 00186 00187 if (atomT == 0) { 00188 CantFindClassMessageAndFail: 00189 #if DBG 00190 if (IS_PTR(cczpstrClass)) { 00191 try { 00192 RIPMSG1(RIP_WARNING, 00193 "Couldn't find class string %ws", 00194 cczpstrClass->Buffer); 00195 00196 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00197 } 00198 } else { 00199 RIPMSG1(RIP_WARNING, 00200 "Couldn't find class atom %lx", 00201 cczpstrClass); 00202 } 00203 #endif 00204 00205 RIPERR0(ERROR_CANNOT_FIND_WND_CLASS, RIP_VERBOSE, ""); 00206 return NULL; 00207 } 00208 00209 /* 00210 * First scan the private classes. If we don't find the class there 00211 * scan the public classes. If we don't find it there, fail. 00212 */ 00213 ppcls = GetClassPtr(atomT, ptiCurrent->ppi, hInstance); 00214 if (ppcls == NULL) { 00215 goto CantFindClassMessageAndFail; 00216 } 00217 00218 pcls = *ppcls; 00219 00220 if (NeedsWindowEdge(style, dwExStyle, Is400Compat(dwExpWinVerAndFlags))) { 00221 dwExStyle |= WS_EX_WINDOWEDGE; 00222 } else { 00223 dwExStyle &= ~WS_EX_WINDOWEDGE; 00224 } 00225 00226 /* 00227 * Allocate memory for regular windows. 00228 */ 00229 pwnd = HMAllocObject( 00230 ptiCurrent, pdesk, TYPE_WINDOW, sizeof(WND) + pcls->cbwndExtra); 00231 00232 if (pwnd == NULL) { 00233 RIPERR0(ERROR_OUTOFMEMORY, 00234 RIP_WARNING, 00235 "Out of pool in xxxCreateWindowEx"); 00236 00237 return NULL; 00238 } 00239 00240 /* 00241 * Stuff in the pq, class pointer, and window style. 00242 */ 00243 pwnd->pcls = pcls; 00244 pwnd->style = style & ~WS_VISIBLE; 00245 #ifdef REDIRECTION 00246 pwnd->ExStyle = dwExStyle & ~(WS_EX_LAYERED | WS_EX_REDIRECTED); 00247 #else 00248 pwnd->ExStyle = dwExStyle & ~WS_EX_LAYERED; 00249 #endif // REDIRECTION 00250 pwnd->cbwndExtra = pcls->cbwndExtra; 00251 00252 00253 /* 00254 * Increment the Window Reference Count in the Class structure 00255 * Because xxxFreeWindow() decrements the count, incrementing has 00256 * to be done now. Incase of error, xxxFreeWindow() will decrement it. 00257 */ 00258 if (!ReferenceClass(pcls, pwnd)) { 00259 HMFreeObject(pwnd); 00260 goto CantFindClassMessageAndFail; 00261 } 00262 00263 /* 00264 * Button control doesn't need input context. Other windows 00265 * will associate with the default input context. 00266 */ 00267 if (atomT == gpsi->atomSysClass[ICLS_BUTTON]) { 00268 pwnd->hImc = NULL_HIMC; 00269 } else { 00270 pwnd->hImc = (HIMC)PtoH(ptiCurrent->spDefaultImc); 00271 } 00272 00273 /* 00274 * Update the window count. Doing this now will ensure that if 00275 * the creation fails, xxxFreeWindow will keep the window count 00276 * correct. 00277 */ 00278 ptiCurrent->cWindows++; 00279 00280 /* 00281 * Get the class from the window because ReferenceClass may have 00282 * cloned the class. 00283 */ 00284 pcls = pwnd->pcls; 00285 00286 /* 00287 * This is a replacement for the &lpCreateParams stuff that used to 00288 * pass a pointer directly to the parameters on the stack. This 00289 * step must be done AFTER referencing the class because we 00290 * may use the ANSI class name. 00291 */ 00292 RtlZeroMemory(&csex, sizeof(csex)); 00293 csex.cs.dwExStyle = dwExStyle; 00294 csex.cs.hInstance = hInstance; 00295 00296 if (!IS_PTR(cczpstrClass)) { 00297 csex.cs.lpszClass = (LPWSTR)cczpstrClass; 00298 } else { 00299 if (wWFAnsiCreator) { 00300 csex.cs.lpszClass = (LPWSTR)pcls->lpszAnsiClassName; 00301 if (IS_PTR(csex.cs.lpszClass)) { 00302 RtlInitLargeAnsiString( 00303 (PLARGE_ANSI_STRING)&csex.strClass, 00304 (LPSTR)csex.cs.lpszClass, 00305 (UINT)-1); 00306 } 00307 } else { 00308 csex.cs.lpszClass = cczpstrClass->Buffer; 00309 csex.strClass = *cczpstrClass; 00310 } 00311 } 00312 00313 if (cczpstrName != NULL) { 00314 csex.cs.lpszName = cczpstrName->Buffer; 00315 csex.strName = *cczpstrName; 00316 } 00317 csex.cs.style = style; 00318 csex.cs.x = x; 00319 csex.cs.y = y; 00320 csex.cs.cx = cx; 00321 csex.cs.cy = cy; 00322 csex.cs.hwndParent = HW(pwndParent); 00323 00324 /* 00325 * If pMenu is non-NULL and the window is not a child, pMenu must 00326 * be a menu. 00327 * Child windows get their UIState bits from their parent. Top level ones 00328 * remain with the default cleared bits. 00329 * 00330 * The below test is equivalent to TestwndChild(). 00331 */ 00332 if (fChild) { 00333 csex.cs.hMenu = (HMENU)pMenu; 00334 00335 pwnd->ExStyle |= pwndParent->ExStyle & (WS_EXP_FOCUSHIDDEN | WS_EXP_ACCELHIDDEN); 00336 #if WS_EXP_ACCELHIDDEN != 0x40000000 00337 #error Fix UISTATE bits copying if you moved the UISTATE bits from ExStyle 00338 #endif 00339 00340 } else { 00341 csex.cs.hMenu = PtoH(pMenu); 00342 } 00343 00344 csex.cs.lpCreateParams = lpCreateParams; 00345 00346 /* 00347 * ThreadLock: we are going to be doing multiple callbacks here. 00348 */ 00349 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 00350 00351 /* 00352 * set the parent to be the desktop window (if exists) 00353 * before any callback. This way we'll always have a 00354 * pointer on spwndParent 00355 */ 00356 if (pwnd->head.rpdesk) { 00357 Lock(&(pwnd->spwndParent), PWNDMESSAGE(pwnd)); 00358 } 00359 00360 /* 00361 * Create the class small icon if there isn't one since we are in context 00362 * and we are creating a window from this class... 00363 */ 00364 if (pcls->spicn && !pcls->spicnSm) { 00365 xxxCreateClassSmIcon(pcls); 00366 } 00367 00368 /* 00369 * Store the instance handle and window proc address. We do this earlier 00370 * than Windows because they have a bug were a message can be sent 00371 * but lpfnWndProc is not set (3986 CBT WM_CREATE not allowed.) 00372 */ 00373 pwnd->hModule = hInstance; 00374 00375 /* 00376 * Get rid of EditWndProc plain. 00377 */ 00378 pwnd->lpfnWndProc = (WNDPROC_PWND)MapClientNeuterToClientPfn(pcls, 0, wWFAnsiCreator); 00379 00380 /* 00381 * If this window class has a server-side window procedure, mark 00382 * it as such. If the app subclasses it later with an app-side proc 00383 * then this mark will be removed. 00384 */ 00385 if (pcls->CSF_flags & CSF_SERVERSIDEPROC) { 00386 SetWF(pwnd, WFSERVERSIDEPROC); 00387 UserAssert(!(pcls->CSF_flags & CSF_ANSIPROC)); 00388 } 00389 00390 /* 00391 * If this window was created with an ANSI CreateWindow*() call, mark 00392 * it as such so edit controls will be created correctly. (A combobox 00393 * will be able to pass the WFANSICREATOR bit on to its edit control) 00394 */ 00395 SetWF(pwnd, wWFAnsiCreator); 00396 00397 /* 00398 * If this window belongs to an ANSI class or it is a WFANSICREATOR 00399 * control, then mark it as an ANSI window 00400 */ 00401 if ((pcls->CSF_flags & CSF_ANSIPROC) || 00402 (wWFAnsiCreator && 00403 ((atomT == gpsi->atomSysClass[ICLS_BUTTON]) || 00404 (atomT == gpsi->atomSysClass[ICLS_COMBOBOX]) || 00405 (atomT == gpsi->atomSysClass[ICLS_COMBOLISTBOX]) || 00406 (atomT == gpsi->atomSysClass[ICLS_DIALOG]) || 00407 (atomT == gpsi->atomSysClass[ICLS_EDIT]) || 00408 (atomT == gpsi->atomSysClass[ICLS_LISTBOX]) || 00409 (atomT == gpsi->atomSysClass[ICLS_MDICLIENT]) || 00410 (atomT == gpsi->atomSysClass[ICLS_IME]) || 00411 (atomT == gpsi->atomSysClass[ICLS_STATIC])))) { 00412 SetWF(pwnd, WFANSIPROC); 00413 } 00414 00415 /* 00416 * If a 3.1-compatible application is creating the window, set this 00417 * bit to enable various backward-compatibility hacks. 00418 * 00419 * If it's not 3.1 compatible, see if we need to turn on the PixieHack 00420 * (see wmupdate.c for more info on this) 00421 */ 00422 00423 dw = GetAppCompatFlags(ptiCurrent); 00424 00425 if (dw & GACF_RANDOM3XUI) { 00426 SetWF(pwnd, WFOLDUI); 00427 00428 dwExStyle &= 0x0000003f; 00429 csex.cs.dwExStyle &= 0x0000003f; 00430 } 00431 00432 pwnd->hMod16 = ((ptiCurrent->TIF_flags & TIF_16BIT) && !TestWF(pwnd, WFSERVERSIDEPROC))? xxxClientWOWGetProcModule(pwnd->lpfnWndProc):0; 00433 if (Is310Compat(dwExpWinVerAndFlags)) { 00434 SetWF(pwnd, WFWIN31COMPAT); 00435 if (Is400Compat(dwExpWinVerAndFlags)) { 00436 SetWF(pwnd, WFWIN40COMPAT); 00437 if (Is500Compat(dwExpWinVerAndFlags)) { 00438 SetWF(pwnd, WFWIN50COMPAT); 00439 } 00440 } 00441 } else if (dw & GACF_ALWAYSSENDNCPAINT) { 00442 SetWF(pwnd, WFALWAYSSENDNCPAINT); 00443 } 00444 00445 /* 00446 * Inform the CBT hook that a window is being created. Pass it the 00447 * CreateParams and the window handle that the new one will be inserted 00448 * after. The CBT hook handler returns TRUE to prevent the window 00449 * from being created. It can also modify the CREATESTRUCT info, which 00450 * will affect the size, parent, and position of the window. 00451 * Defaultly position non-child windows at the top of their list. 00452 */ 00453 00454 if (IsHooked(ptiCurrent, WHF_CBT)) { 00455 CBT_CREATEWND cbt; 00456 00457 /* 00458 * Use the extended createstruct so the hook thunk can 00459 * handle the strings correctly. 00460 */ 00461 cbt.lpcs = (LPCREATESTRUCT)&csex; 00462 cbt.hwndInsertAfter = HWND_TOP; 00463 00464 if ((BOOL)xxxCallHook(HCBT_CREATEWND, (WPARAM)HWq(pwnd), 00465 (LPARAM)&cbt, WH_CBT)) { 00466 00467 goto MemError; 00468 } else { 00469 /* 00470 * The CreateHook may have modified some parameters so write them 00471 * out (in Windows 3.1 we used to write directly to the variables 00472 * on the stack). 00473 */ 00474 00475 x = csex.cs.x; 00476 y = csex.cs.y; 00477 cx = csex.cs.cx; 00478 cy = csex.cs.cy; 00479 00480 if (!IS_PTR(cbt.hwndInsertAfter)) 00481 pwndZOrder = (PWND)cbt.hwndInsertAfter; 00482 else 00483 pwndZOrder = RevalidateHwnd(cbt.hwndInsertAfter); 00484 } 00485 } else { 00486 pwndZOrder = (PWND)HWND_TOP; 00487 } 00488 00489 if (!(fTiled = TestwndTiled(pwnd))) { 00490 00491 /* 00492 * CW_USEDEFAULT is only valid for tiled and overlapped windows. 00493 * Don't let it be used. 00494 */ 00495 if (x == CW_USEDEFAULT || x == CW2_USEDEFAULT) { 00496 x = 0; 00497 y = 0; 00498 } 00499 00500 if (cx == CW_USEDEFAULT || cx == CW2_USEDEFAULT) { 00501 cx = 0; 00502 cy = 0; 00503 } 00504 } 00505 00506 /* 00507 * Make local copies of these parameters. 00508 */ 00509 src.x = x; 00510 src.y = y; 00511 src.cx = cx; 00512 src.cy = cy; 00513 00514 /* 00515 * Position Child Windows 00516 */ 00517 if (fChild = (BOOL)TestwndChild(pwnd)) { 00518 00519 /* 00520 * Child windows are offset from the parent's origin. 00521 */ 00522 UserAssert(pwndParent); 00523 if (pwndParent != PWNDDESKTOP(pwnd)) { 00524 src.x += pwndParent->rcClient.left; 00525 src.y += pwndParent->rcClient.top; 00526 } 00527 00528 /* 00529 * Defaultly position child windows at bottom of their list. 00530 */ 00531 pwndZOrder = PWND_BOTTOM; 00532 } 00533 00534 /* 00535 * Position Tiled Windows 00536 */ 00537 00538 /* 00539 * Is this a Tiled/Overlapping window? 00540 */ 00541 if (fTiled) { 00542 00543 /* 00544 * Force the WS_CLIPSIBLINGS window style and add a caption and 00545 * a border. 00546 */ 00547 SetWF(pwnd, WFCLIPSIBLINGS); 00548 mask = MaskWF(WFCAPTION) | MaskWF(WFBORDER); 00549 00550 // 00551 // We add on a raised edge since IF the person had passed in WS_CAPTION, 00552 // and didn't specify any 3D borders, we would've added it on to the 00553 // style bits above. 00554 // 00555 00556 if (TestWF(pwnd, WFWIN40COMPAT)) { 00557 // if (!TestWF(pwnd, WEFEDGEMASK)) 00558 SetWF(pwnd, WEFWINDOWEDGE); 00559 } 00560 00561 /* 00562 * Set bit that will force size message to be sent at SHOW time. 00563 */ 00564 SetWF(pwnd, WFSENDSIZEMOVE); 00565 00566 /* 00567 * Here is how the "tiled" window initial positioning works... 00568 * If the app is a 1.0x app, then we use our standard "stair step" 00569 * default positioning scheme. Otherwise, we check the x & cx 00570 * parameters. If either of these == CW_USEDEFAULT then use the 00571 * default position/size, otherwise use the position/size they 00572 * specified. If not using default position, use SW_SHOW for the 00573 * xxxShowWindow() parameter, otherwise use the y parameter given. 00574 * 00575 * In 32-bit world, CW_USEDEFAULT is 0x80000000, but apps still 00576 * store word-oriented values either in dialog templates or 00577 * in their own structures. So CreateWindow still recognizes the 00578 * 16 bit equivalent, which is 0x8000, CW2_USEDEFAULT. The original 00579 * is changed because parameters to CreateWindow() are 32 bit 00580 * values, which can cause sign extention, or weird results if 00581 * 16 bit math assumptions are being made, etc. 00582 */ 00583 00584 /* 00585 * Default to passing the y parameter to xxxShowWindow(). 00586 */ 00587 if (x == CW_USEDEFAULT || x == CW2_USEDEFAULT) { 00588 00589 /* 00590 * If the y value is not CW_USEDEFAULT, use it as a SW_* command. 00591 */ 00592 if (src.y != CW_USEDEFAULT && src.y != CW2_USEDEFAULT) { 00593 sw = src.y; 00594 } 00595 } 00596 00597 00598 /* 00599 * Allow the shell to tell us what monitor to run this app on 00600 */ 00601 pMonitor = NULL; 00602 if ( x == CW_USEDEFAULT || 00603 x == CW2_USEDEFAULT || 00604 cx == CW_USEDEFAULT || 00605 cx == CW2_USEDEFAULT) { 00606 00607 if (ptiCurrent->ppi->hMonitor) { 00608 pMonitor = ValidateHmonitor(ptiCurrent->ppi->hMonitor); 00609 } else if (pwndParent) { 00610 pMonitor = _MonitorFromWindow(pwndParent, MONITOR_DEFAULTTONEAREST); 00611 } 00612 } 00613 00614 if (!pMonitor) { 00615 pMonitor = GetPrimaryMonitor(); 00616 } 00617 00618 SetTiledRect(pwnd, &rc, pMonitor); 00619 00620 /* 00621 * Did the app ask for default positioning? 00622 */ 00623 if (x == CW_USEDEFAULT || x == CW2_USEDEFAULT) { 00624 00625 /* 00626 * Use default positioning. 00627 */ 00628 if (ptiCurrent->ppi->usi.dwFlags & STARTF_USEPOSITION ) { 00629 fStartup = TRUE; 00630 x = src.x = ptiCurrent->ppi->usi.dwX; 00631 y = src.y = ptiCurrent->ppi->usi.dwY; 00632 } else { 00633 x = src.x = rc.left; 00634 y = src.y = rc.top; 00635 } 00636 fDefPos = TRUE; 00637 00638 } else { 00639 00640 /* 00641 * Use the apps specified positioning. Undo the "stacking" 00642 * effect caused by SetTiledRect(). 00643 */ 00644 if (pMonitor->cWndStack) { 00645 pMonitor->cWndStack--; 00646 } 00647 } 00648 00649 /* 00650 * Did the app ask for default sizing? 00651 */ 00652 if (src.cx == CW_USEDEFAULT || src.cx == CW2_USEDEFAULT) { 00653 00654 /* 00655 * Use default sizing. 00656 */ 00657 if (ptiCurrent->ppi->usi.dwFlags & STARTF_USESIZE) { 00658 fStartup = TRUE; 00659 src.cx = ptiCurrent->ppi->usi.dwXSize; 00660 src.cy = ptiCurrent->ppi->usi.dwYSize; 00661 } else { 00662 src.cx = rc.right - x; 00663 src.cy = rc.bottom - y; 00664 } 00665 fDefPos = TRUE; 00666 00667 } else if (fDefPos) { 00668 /* 00669 * The app wants default positioning but not default sizing. 00670 * Make sure that it's still entirely visible by moving the 00671 * window. 00672 */ 00673 dx = (src.x + src.cx) - pMonitor->rcMonitor.right; 00674 dy = (src.y + src.cy) - pMonitor->rcMonitor.bottom; 00675 if (dx > 0) { 00676 x -= dx; 00677 src.x = x; 00678 if (src.x < pMonitor->rcMonitor.left) { 00679 src.x = x = pMonitor->rcMonitor.left; 00680 } 00681 } 00682 00683 if (dy > 0) { 00684 y -= dy; 00685 src.y = y; 00686 if (src.y < pMonitor->rcMonitor.top) { 00687 src.y = y = pMonitor->rcMonitor.top; 00688 } 00689 } 00690 } 00691 } 00692 00693 /* 00694 * If we have used any startup postitions, turn off the startup 00695 * info so we don't use it again. 00696 */ 00697 if (fStartup) { 00698 ptiCurrent->ppi->usi.dwFlags &= 00699 ~(STARTF_USESIZE | STARTF_USEPOSITION); 00700 } 00701 00702 /* 00703 * Position Popup Windows 00704 */ 00705 00706 if (TestwndPopup(pwnd)) { 00707 // LATER: Why is this test necessary? Can one create a popup desktop? 00708 if (pwnd != _GetDesktopWindow()) { 00709 00710 /* 00711 * Force the clipsiblings/overlap style. 00712 */ 00713 SetWF(pwnd, WFCLIPSIBLINGS); 00714 } 00715 } 00716 00717 /* 00718 * Shove in those default style bits. 00719 */ 00720 *(((WORD *)&pwnd->style) + 1) |= mask; 00721 00722 /* 00723 * Menu/SysMenu Stuff 00724 */ 00725 00726 /* 00727 * If there is no menu handle given and it's not a child window but 00728 * there is a class menu, use the class menu. 00729 */ 00730 if (pMenu == NULL && !fChild && (pcls->lpszMenuName != NULL)) { 00731 UNICODE_STRING strMenuName; 00732 00733 RtlInitUnicodeStringOrId(&strMenuName, pcls->lpszMenuName); 00734 pMenu = xxxClientLoadMenu(pcls->hModule, &strMenuName); 00735 csex.cs.hMenu = PtoH(pMenu); 00736 00737 /* 00738 * This load fails if the caller does not have DESKTOP_CREATEMENU 00739 * permission but that's ok they will just get a window without a menu 00740 */ 00741 } 00742 00743 /* 00744 * Store the menu handle. 00745 */ 00746 if (TestwndChild(pwnd)) { 00747 00748 /* 00749 * It's an id in this case. 00750 */ 00751 pwnd->spmenu = pMenu; 00752 } else { 00753 00754 /* 00755 * It's a real handle in this case. 00756 */ 00757 LockWndMenu(pwnd, &pwnd->spmenu, pMenu); 00758 } 00759 00760 // LATER does this work? 00761 /* 00762 * Delete the Close menu item if directed. 00763 */ 00764 if (TestCF(pwnd, CFNOCLOSE)) { 00765 00766 /* 00767 * Do this by position since the separator does not have an ID. 00768 */ 00769 // LATER mikeke why is xxxGetSystemMenu() returning NULL? 00770 pMenu = xxxGetSystemMenu(pwnd, FALSE); 00771 if (pMenu != NULL) { 00772 TL tlpMenu; 00773 00774 ThreadLock(pMenu, &tlpMenu); 00775 xxxDeleteMenu(pMenu, 5, MF_BYPOSITION); 00776 xxxDeleteMenu(pMenu, 5, MF_BYPOSITION); 00777 ThreadUnlock(&tlpMenu); 00778 } 00779 } 00780 00781 /* 00782 * Parent/Owner Stuff 00783 */ 00784 00785 /* 00786 * If this isn't a child window, reset the Owner/Parent info. 00787 */ 00788 if (!fChild) { 00789 Lock(&(pwnd->spwndLastActive), pwnd); 00790 if ((pwndParent != NULL) && 00791 (pwndParent != pwndParent->head.rpdesk->spwndMessage) && 00792 (pwndParent != pwndParent->head.rpdesk->pDeskInfo->spwnd)) { 00793 00794 PWND pwndOwner = GetTopLevelWindow(pwndParent); 00795 00796 if (!ValidateOwnerDepth(pwnd, pwndOwner)) { 00797 RIPERR1(ERROR_INVALID_PARAMETER, 00798 RIP_WARNING, 00799 "Exceeded nested owner limit for pwnd %#p", 00800 pwnd); 00801 goto MemError; 00802 } 00803 00804 #if DBG 00805 if (pwnd->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME]) { 00806 UserAssert(!TestCF(pwndOwner, CFIME)); 00807 } 00808 #endif 00809 Lock(&(pwnd->spwndOwner), pwndOwner); 00810 if (pwnd->spwndOwner && TestWF(pwnd->spwndOwner, WEFTOPMOST)) { 00811 00812 /* 00813 * If this window's owner is a topmost window, then it has to 00814 * be one also since a window must be above its owner. 00815 */ 00816 SetWF(pwnd, WEFTOPMOST); 00817 } 00818 00819 /* 00820 * If this is a owner window on another thread, share input 00821 * state so this window gets z-ordered correctly. 00822 */ 00823 if (atomT != gpsi->atomSysClass[ICLS_IME] && 00824 pwnd->spwndOwner != NULL && 00825 GETPTI(pwnd->spwndOwner) != ptiCurrent) { 00826 /* 00827 * No need to DeferWinEventNotify() here: pwnd and pwndParent 00828 * are locked and because we called ReferenceClass(pcls, pwnd), 00829 * pcls is safe until xxxFreeWindow(pwnd). (IanJa) 00830 */ 00831 zzzAttachThreadInput(ptiCurrent, GETPTI(pwnd->spwndOwner), TRUE); 00832 } 00833 00834 } else { 00835 pwnd->spwndOwner = NULL; 00836 } 00837 00838 #if DBG 00839 if (ptiCurrent->rpdesk != NULL) { 00840 UserAssert(!(ptiCurrent->rpdesk->dwDTFlags & (DF_DESTROYED | DF_DESKWNDDESTROYED | DF_DYING))); 00841 } 00842 #endif 00843 if ((pwndParent == NULL) || 00844 (pwndParent != pwndParent->head.rpdesk->spwndMessage)) { 00845 pwndParent = _GetDesktopWindow(); 00846 00847 ThreadLockWithPti(ptiCurrent, pwndParent, &tlpwndParent); 00848 fLockParent = TRUE; 00849 } 00850 } 00851 00852 /* 00853 * Store backpointer to parent. 00854 */ 00855 Lock(&(pwnd->spwndParent), pwndParent); 00856 00857 /* 00858 * Final Window Positioning 00859 */ 00860 00861 if (!TestWF(pwnd, WFWIN31COMPAT)) { 00862 /* 00863 * BACKWARD COMPATIBILITY HACK 00864 * 00865 * In 3.0, CS_PARENTDC overrides WS_CLIPCHILDREN and WS_CLIPSIBLINGS, 00866 * but only if the parent is not WS_CLIPCHILDREN. 00867 * This behavior is required by PowerPoint and Charisma, among others. 00868 */ 00869 if ((pcls->style & CS_PARENTDC) && 00870 !TestWF(pwndParent, WFCLIPCHILDREN)) { 00871 #if DBG 00872 if (TestWF(pwnd, WFCLIPCHILDREN)) 00873 RIPMSG0(RIP_WARNING, "WS_CLIPCHILDREN overridden by CS_PARENTDC"); 00874 if (TestWF(pwnd, WFCLIPSIBLINGS)) 00875 RIPMSG0(RIP_WARNING, "WS_CLIPSIBLINGS overridden by CS_PARENTDC"); 00876 #endif 00877 ClrWF(pwnd, (WFCLIPCHILDREN | WFCLIPSIBLINGS)); 00878 } 00879 } 00880 00881 /* 00882 * If this is a child window being created in a parent window 00883 * of a different thread, but not on the desktop, attach their 00884 * input streams together. [windows with WS_CHILD can be created 00885 * on the desktop, that's why we check both the style bits 00886 * and the parent window.] 00887 */ 00888 if (TestwndChild(pwnd) && (pwndParent != PWNDDESKTOP(pwnd)) && 00889 (ptiCurrent != GETPTI(pwndParent))) { 00890 /* 00891 * No need to DeferWinEventNotify() - there is an xxx call just below 00892 */ 00893 zzzAttachThreadInput(ptiCurrent, GETPTI(pwndParent), TRUE); 00894 } 00895 00896 /* 00897 * Make sure the window is between the minimum and maximum sizes. 00898 */ 00899 00900 /* 00901 * HACK ALERT! 00902 * This sends WM_GETMINMAXINFO to a (tiled or sizable) window before 00903 * it has been created (before it is sent WM_NCCREATE). 00904 * Maybe some app expects this, so we nustn't reorder the messages. 00905 */ 00906 xxxAdjustSize(pwnd, &src.cx, &src.cy); 00907 00908 /* 00909 * check for a window being created full screen 00910 * 00911 * Note the check for a non-NULL pdeskParent -- this is important for CreateWindowStation 00912 */ 00913 if ( pwnd->head.rpdesk != NULL && 00914 !TestWF(pwnd, WFCHILD) && 00915 !TestWF(pwnd, WEFTOOLWINDOW)) { 00916 00917 xxxCheckFullScreen(pwnd, &src); 00918 } 00919 00920 if (src.cx < 0) { 00921 RIPMSG1(RIP_WARNING, "xxxCreateWindowEx: adjusted cx in pwnd %#p", pwnd); 00922 src.cx = 0; 00923 } 00924 00925 if (src.cy < 0) { 00926 RIPMSG1(RIP_WARNING, "xxxCreateWindowEx: adjusted cy in pwnd %#p", pwnd); 00927 src.cy = 0; 00928 } 00929 00930 /* 00931 * Calculate final window dimensions... 00932 */ 00933 RECTFromSIZERECT(&pwnd->rcWindow, &src); 00934 00935 if (dwExStyle & WS_EX_LAYERED) { 00936 if (!xxxSetLayeredWindow(pwnd, FALSE)) { 00937 goto MemError; 00938 } 00939 } 00940 00941 #ifdef REDIRECTION 00942 if (dwExStyle & WS_EX_REDIRECTED) { 00943 if (!SetRedirectedWindow(pwnd)) { 00944 goto MemError; 00945 } 00946 } 00947 #endif // REDIRECTION 00948 00949 if (TestCF2(pcls, CFOWNDC) || 00950 (TestCF2(pcls, CFCLASSDC) && pcls->pdce == NULL)) { 00951 if (NULL == CreateCacheDC(pwnd, DCX_OWNDC, NULL)) { 00952 00953 RIPMSG1(RIP_WARNING, "xxxCreateWindowEx: pwnd %#p failed to create cached DC", 00954 pwnd); 00955 00956 goto MemError; 00957 } 00958 } 00959 00960 /* 00961 * Update the create struct now that we've modified some passed in 00962 * parameters. 00963 */ 00964 csex.cs.x = x; 00965 csex.cs.y = y; 00966 csex.cs.cx = cx; 00967 csex.cs.cy = cy; 00968 00969 /* 00970 * Send a NCCREATE message to the window. 00971 */ 00972 if (!xxxSendMessage(pwnd, WM_NCCREATE, 0L, (LPARAM)&csex)) { 00973 00974 MemError: 00975 00976 #if DBG 00977 if (!IS_PTR(cczpstrClass)) { 00978 RIPMSG2(RIP_WARNING, 00979 (pwndParent) ? 00980 "xxxCreateWindowEx failed, Class=%#.4x, ID=%d" : 00981 "xxxCreateWindowEx failed, Class=%#.4x", 00982 PTR_TO_ID(cczpstrClass), 00983 (LONG_PTR) pMenu); 00984 } else { 00985 RIPMSG2(RIP_WARNING, 00986 (pwndParent) ? 00987 "xxxCreateWindowEx failed, Class=\"%s\", ID=%d" : 00988 "xxxCreateWindowEx failed, Class=\"%s\"", 00989 pcls->lpszAnsiClassName, 00990 (LONG_PTR) pMenu); 00991 } 00992 #endif 00993 00994 if (fLockParent) 00995 ThreadUnlock(&tlpwndParent); 00996 00997 /* 00998 * Set the state as destroyed so any z-ordering events will be ignored. 00999 * We cannot NULL out the owner field until WM_NCDESTROY is send or 01000 * apps like Rumba fault (they call GetParent after every message) 01001 */ 01002 SetWF(pwnd, WFDESTROYED); 01003 01004 /* 01005 * Unset the visible flag so we don't think in xxxDestroyWindow that 01006 * this window is visible 01007 */ 01008 if (TestWF(pwnd, WFVISIBLE)) { 01009 SetVisible(pwnd, SV_UNSET); 01010 } 01011 01012 /* 01013 * FreeWindow performs a ThreadUnlock. 01014 */ 01015 xxxFreeWindow(pwnd, &tlpwnd); 01016 01017 return NULL; 01018 } 01019 01020 /* 01021 * WM_NCCREATE processing may have changed the window text. Change 01022 * the CREATESTRUCT to point to the real window text. 01023 * 01024 * MSMoney needs this because it clears the window and we need to 01025 * reflect the new name back into the cs structure. 01026 * A better thing to do would be to have a pointer to the CREATESTRUCT 01027 * within the window itself so that DefWindowProc can change the 01028 * the window name in the CREATESTRUCT to point to the real name and 01029 * this funky check is no longer needed. 01030 * 01031 * DefSetText converts a pointer to NULL to a NULL title so 01032 * we don't want to over-write cs.lpszName if it was a pointer to 01033 * a NULL string and pName is NULL. Approach Database for Windows creates 01034 * windows with a pointer to NULL and then accesses the pointer later 01035 * during WM_CREATE 01036 */ 01037 if (TestWF(pwnd, WFTITLESET)) 01038 if (!(csex.strName.Buffer != NULL && csex.strName.Length == 0 && 01039 pwnd->strName.Buffer == NULL)) { 01040 csex.cs.lpszName = pwnd->strName.Buffer; 01041 RtlCopyMemory(&csex.strName, &pwnd->strName, sizeof(LARGE_STRING)); 01042 } 01043 01044 /* 01045 * The Window is now officially "created." Change the relevant global 01046 * stuff. 01047 */ 01048 01049 01050 /* 01051 * Create per thread default IME window. 01052 */ 01053 if (IS_IME_ENABLED() && ptiCurrent->spwndDefaultIme == NULL) { 01054 /* 01055 * Avoid creating the default IME window to any of message only windows 01056 * or windows on no I/O desktop. 01057 */ 01058 if (WantImeWindow(pwndParent, pwnd)) { 01059 // 01060 // Make sure we are not creating a window for Ole, 01061 // for it does not pump messages even though 01062 // they creates a window. 01063 // 01064 UserAssert(gaOleMainThreadWndClass != atomT); 01065 01066 Lock(&(ptiCurrent->spwndDefaultIme), 01067 xxxCreateDefaultImeWindow(pwnd, atomT, hInstance)); 01068 01069 01070 /* 01071 * If keybaord layout is switched but Imm activation was skipped 01072 * while spwndDefaultIme was gone, do the activation now. 01073 */ 01074 #if _DBG 01075 if (ptiCurrent->spDefaultImc == NULL) { 01076 RIPMSG1(RIP_WARNING, "xxxCreateWindowEx: ptiCurrent(%08p)->spDefaultImc is NULL.", ptiCurrent); 01077 } 01078 ASSERT(ptiCurrent->pClientInfo); 01079 #endif 01080 01081 if (ptiCurrent->spwndDefaultIme && (ptiCurrent->pClientInfo->CI_flags & CI_INPUTCONTEXT_REINIT)) { 01082 01083 TL tlpwndIme; 01084 01085 TAGMSG1(DBGTAG_IMM, "xxxCreateDefaultImeWindow: ptiCurrent(%08p)->spDefaultImc->fNeedClientImcActivate is set.", ptiCurrent); 01086 /* 01087 * Make this client side callback to force the input context 01088 * is re-initialized appropriately. 01089 * (keyboard layout has been changed since this thread was taking 01090 * a nap while with no window but still was GUI thread) 01091 * see raid #294964 01092 */ 01093 ThreadLock(ptiCurrent->spwndDefaultIme, &tlpwndIme); 01094 xxxSendMessage(ptiCurrent->spwndDefaultIme, WM_IME_SYSTEM, (WPARAM)IMS_ACTIVATETHREADLAYOUT, (LPARAM)ptiCurrent->spklActive->hkl); 01095 01096 // Reset the flag. 01097 ptiCurrent->pClientInfo->CI_flags &= ~CI_INPUTCONTEXT_REINIT; 01098 01099 ThreadUnlock(&tlpwndIme); 01100 } 01101 } 01102 else { 01103 RIPMSG0(RIP_VERBOSE, "xxxCreateWindowEx: default IME window is not created."); 01104 } 01105 } 01106 01107 01108 /* 01109 * Update the Parent/Child linked list. 01110 */ 01111 if (pwndParent != NULL) { 01112 if (!fChild && (pwndParent != pwndParent->head.rpdesk->spwndMessage)) { 01113 01114 /* 01115 * If this is a top-level window, and it's not part of the 01116 * topmost pile of windows, then we have to make sure it 01117 * doesn't go on top of any of the topmost windows. 01118 * 01119 * If he's trying to put the window on the top, or trying 01120 * to insert it after one of the topmost windows, insert 01121 * it after the last topmost window in the pile. 01122 */ 01123 if (!TestWF(pwnd, WEFTOPMOST)) { 01124 if (pwndZOrder == PWND_TOP || 01125 TestWF(pwndZOrder, WEFTOPMOST)) { 01126 pwndZOrder = CalcForegroundInsertAfter(pwnd); 01127 } 01128 } else { 01129 pwndHardError = GETTOPMOSTINSERTAFTER(pwnd); 01130 if (pwndHardError != NULL) { 01131 pwndZOrder = pwndHardError; 01132 } 01133 } 01134 } 01135 01136 LinkWindow(pwnd, pwndZOrder, pwndParent); 01137 } 01138 01139 /* 01140 * Message Sending 01141 */ 01142 01143 /* 01144 * Send a NCCALCSIZE message to the window and have it return the official 01145 * size of its client area. 01146 */ 01147 01148 #ifdef USE_MIRRORING 01149 if (fChild && TestWF(pwndParent, WEFLAYOUTRTL)) { 01150 cx = pwnd->rcWindow.right - pwnd->rcWindow.left; 01151 pwnd->rcWindow.right = pwndParent->rcClient.right - (pwnd->rcWindow.left - pwndParent->rcClient.left); 01152 pwnd->rcWindow.left = pwnd->rcWindow.right - cx; 01153 } 01154 #endif 01155 01156 CopyRect(&rc, &pwnd->rcWindow); 01157 xxxSendMessage(pwnd, WM_NCCALCSIZE, 0L, (LPARAM)&rc); 01158 pwnd->rcClient = rc; 01159 01160 /* 01161 * Send a CREATE message to the window. 01162 */ 01163 if (xxxSendMessage(pwnd, WM_CREATE, 0L, (LPARAM)&csex) == -1L) { 01164 #if DBG 01165 if (!IS_PTR(cczpstrClass)) { 01166 RIPMSG1(RIP_WARNING, 01167 "CreateWindow() send of WM_CREATE failed, Class = 0x%x", 01168 PTR_TO_ID(cczpstrClass)); 01169 } else { 01170 RIPMSG1(RIP_WARNING, 01171 "CreateWindow() send of WM_CREATE failed, Class = \"%s\"", 01172 pcls->lpszAnsiClassName); 01173 } 01174 #endif 01175 if (fLockParent) 01176 ThreadUnlock(&tlpwndParent); 01177 01178 if (ThreadUnlock(&tlpwnd)) 01179 xxxDestroyWindow(pwnd); 01180 01181 return NULL; 01182 } 01183 01184 SetWF(pwnd, WFISINITIALIZED); /* Flag that the window is created. 01185 WoW uses this bit to determine that 01186 an fnid of 0 really means 0. */ 01187 01188 /* 01189 * Notify anyone who is listening that the window is created. Do this 01190 * before we size/move/max/min/show it so that event observers can count 01191 * on getting notifications for those things also. 01192 * 01193 * But do this AFTER WM_CREATE is sent. The window and its data will not 01194 * be fully initialized until then. Since the purpose of an event is to 01195 * let watchers turn around and do querying, we want their queries to 01196 * succeed and not fault. 01197 */ 01198 if (FWINABLE()) { 01199 xxxWindowEvent(EVENT_OBJECT_CREATE, pwnd, OBJID_WINDOW, INDEXID_OBJECT, 0); 01200 } 01201 01202 /* 01203 * If this is a Tiled/Overlapped window, don't send size or move msgs yet. 01204 */ 01205 if (!TestWF(pwnd, WFSENDSIZEMOVE)) { 01206 xxxSendSizeMessage(pwnd, SIZENORMAL); 01207 01208 if (pwndParent != NULL && PWNDDESKTOP(pwnd) != pwndParent) { 01209 rc.left -= pwndParent->rcClient.left; 01210 rc.top -= pwndParent->rcClient.top; 01211 } 01212 01213 xxxSendMessage(pwnd, WM_MOVE, 0L, MAKELONG(rc.left, rc.top)); 01214 } 01215 01216 /* 01217 * Min/Max Stuff 01218 */ 01219 01220 /* 01221 * If app specified either min/max style, then we must call our minmax 01222 * code to get it all set up correctly so that when the show is done, 01223 * the window is displayed right. 01224 */ 01225 dwMinMax = MINMAX_KEEPHIDDEN | TEST_PUDF(PUDF_ANIMATE); 01226 if (TestWF(pwnd, WFMINIMIZED)) { 01227 SetMinimize(pwnd, SMIN_CLEAR); 01228 xxxMinMaximize(pwnd, SW_SHOWMINNOACTIVE, dwMinMax); 01229 } else if (TestWF(pwnd, WFMAXIMIZED)) { 01230 ClrWF(pwnd, WFMAXIMIZED); 01231 xxxMinMaximize(pwnd, SW_SHOWMAXIMIZED, dwMinMax); 01232 } 01233 01234 /* 01235 * Send notification if child 01236 */ 01237 01238 // LATER 15-Aug-1991 mikeke 01239 // pointer passed as a word here 01240 01241 if (fChild && !TestWF(pwnd, WEFNOPARENTNOTIFY) && 01242 (pwnd->spwndParent != NULL)) { 01243 ThreadLockAlwaysWithPti(ptiCurrent, pwnd->spwndParent, &tlpwndParentT); 01244 xxxSendMessage(pwnd->spwndParent, WM_PARENTNOTIFY, 01245 MAKELONG(WM_CREATE, PTR_TO_ID(pwnd->spmenu)), (LPARAM)HWq(pwnd)); 01246 ThreadUnlock(&tlpwndParentT); 01247 } 01248 01249 /* 01250 * Show the Window 01251 */ 01252 if (style & WS_VISIBLE) { 01253 xxxShowWindow(pwnd, sw | TEST_PUDF(PUDF_ANIMATE)); 01254 } 01255 01256 /* 01257 * Try and set the application's hot key. Use the Win95 logic of 01258 * looking for the first tiled and/or APPWINDOW to be created by 01259 * this process. 01260 */ 01261 if (TestwndTiled(pwnd) || TestWF(pwnd, WEFAPPWINDOW)) { 01262 if (ptiCurrent->ppi->dwHotkey) { 01263 /* 01264 * Ignore hot keys for WowExe the first thread of a wow process. 01265 */ 01266 if (!(ptiCurrent->TIF_flags & TIF_16BIT) || (ptiCurrent->ppi->cThreads > 1)) { 01267 #ifdef LATER 01268 /* 01269 * Win95 sets the hot key directly, we on the other hand send 01270 * a WM_SETHOTKEY message to the app. Which is right? 01271 */ 01272 DWP_SetHotKey(pwnd, ptiCurrent->ppi->dwHotkey); 01273 #else 01274 xxxSendMessage(pwnd, WM_SETHOTKEY, ptiCurrent->ppi->dwHotkey, 0); 01275 #endif 01276 ptiCurrent->ppi->dwHotkey = 0; 01277 } 01278 } 01279 } 01280 01281 if (fLockParent) 01282 ThreadUnlock(&tlpwndParent); 01283 01284 return ThreadUnlock(&tlpwnd); 01285 }

HICON xxxCreateWindowSmIcon PWND  pwnd,
HICON  hIconBig,
BOOL  fCopyFromRes
 

Definition at line 1223 of file dwp.c.

References tagSERVERINFO::atomIconSmProp, CheckLock, CURSORF_SECRET, gpsi, HMValidateHandleNoRip(), InternalSetProp(), MAKEINTATOM, NULL, PROPF_INTERNAL, PROPF_NOPOOL, PtoHq, PTR_TO_ID, SetWF, SYSMET, TYPE_CURSOR, WFSMQUERYDRAGICON, and xxxClientCopyImage().

Referenced by xxxDWP_SetIcon(), xxxGetWindowSmIcon(), and xxxRecreateSmallIcons().

01227 { 01228 HICON hIconSm = NULL; 01229 PCURSOR pcurs = NULL,pcursBig; 01230 01231 CheckLock(pwnd); 01232 UserAssert(hIconBig); 01233 01234 pcursBig = (PCURSOR)HMValidateHandleNoRip(hIconBig, TYPE_CURSOR); 01235 01236 if (pcursBig) { 01237 pcurs = xxxClientCopyImage(PtoHq(pcursBig), 01238 pcursBig->rt == PTR_TO_ID(RT_ICON) ? IMAGE_ICON : IMAGE_CURSOR, 01239 SYSMET(CXSMICON), 01240 SYSMET(CYSMICON), 01241 LR_DEFAULTCOLOR | (fNotQueryDrag ? LR_COPYFROMRESOURCE : 0)); 01242 if (pcurs != NULL) 01243 hIconSm = PtoHq(pcurs); 01244 } 01245 if (hIconSm) { 01246 pcurs->CURSORF_flags |= CURSORF_SECRET; 01247 InternalSetProp(pwnd, MAKEINTATOM(gpsi->atomIconSmProp), (HANDLE)hIconSm, PROPF_INTERNAL | PROPF_NOPOOL); 01248 if (!fNotQueryDrag) 01249 SetWF(pwnd, WFSMQUERYDRAGICON); 01250 } 01251 01252 return(hIconSm); 01253 }

HWINSTA xxxCreateWindowStation POBJECT_ATTRIBUTES  ObjA,
KPROCESSOR_MODE  OwnershipMode,
DWORD  amRequest,
HANDLE  hKbdLayoutFile,
DWORD  offTable,
PCWSTR  pwszKLID,
UINT  uKbdInputLocale
 

Definition at line 243 of file winsta.c.

References BEGINATOMICCHECK, _HANDLEENTRY::bFlags, CreateGlobalAtomTable(), CreateSecurityDescriptor(), DeferWinEventNotify, DESKTOPCLASS, DWORD, tagWINDOWSTATION::dwSessionId, tagTERMINAL::dwTERMF_Flags, tagWINDOWSTATION::dwWSF_Flags, ENDATOMICCHECK, ExEventObjectType, EXITATOMICCHECK, ExWindowStationObjectType, FALSE, gbRemoteSession, ghEventSwitchDesktop, gpepCSRSS, gpEventSwitchDesktop, gpidLogon, grpWinStaList, gSessionId, gTermIO, gTermNOIO, HANDLEF_POOL, tagTHREADINFO::hdesk, HMChangeOwnerThread(), hModuleWin, HMPheFromObject, IsWinEventNotifyDeferredOK, KeAttachProcess(), KeDetachProcess(), KernelMode, L, Lock, LockWinSta, LogDesktop, MAX_SESSION_PATH, NT_SUCCESS, NTSTATUS(), NULL, ObCreateObject(), ObDereferenceObject, ObInsertObject(), OBJECT_HEADER_TO_NAME_INFO, OBJECT_TO_OBJECT_HEADER, ObjectAttributes, ObOpenObjectByPointer(), ObReferenceObject, ObReferenceObjectByHandle(), ObSetSecurityDescriptorInfo(), PagedPool, _EPROCESS::Pcb, tagWINDOWSTATION::pGlobalAtomTable, tagTHREADINFO::ppi, PsGetCurrentProcess, tagWINDOWSTATION::pTerm, PtiCurrent, tagTERMINAL::ptiDesktop, tagTHREADINFO::rpdesk, tagWINDOWSTATION::rpwinstaNext, RtlCopySid(), RtlInitUnicodeString(), RtlLengthSid(), SeAssignSecurity(), SeCaptureSubjectContext(), SeDeassignSecurity(), SeExports, SeLockSubjectContext(), SeReleaseSubjectContext(), SetVisible(), SeUnlockSubjectContext(), _SE_EXPORTS::SeWorldSid, tagTERMINAL::spwndDesktopOwner, Status, SV_SET, TERMF_INITIALIZED, TERMF_NOIO, TIF_DISABLEHOOKS, tagTHREADINFO::TIF_flags, TRUE, USHORT, VER31, WINDOWSTATION, WinStaMapping, WSF_NOIO, xxxCreateWindowEx(), xxxInitTerminal(), xxxInitWindowStation(), xxxLoadKeyboardLayoutEx(), zzzEndDeferWinEventNotify, and zzzSetDesktop().

Referenced by NtUserCreateWindowStation(), and xxxConnectService().

00251 { 00252 PWINDOWSTATION pwinsta; 00253 PTHREADINFO ptiCurrent; 00254 PDESKTOP pdeskTemp; 00255 HDESK hdeskTemp; 00256 PSECURITY_DESCRIPTOR psd; 00257 PSECURITY_DESCRIPTOR psdCapture; 00258 PPROCESSINFO ppiSave; 00259 NTSTATUS Status; 00260 PACCESS_ALLOWED_ACE paceList = NULL, pace; 00261 ULONG ulLength, ulLengthSid; 00262 HANDLE hEvent; 00263 HWINSTA hwinsta; 00264 DWORD dwDisableHooks; 00265 PTERMINAL pTerm = NULL; 00266 PWND pwnd; 00267 WCHAR szBaseNamedObjectDirectory[MAX_SESSION_PATH]; 00268 00269 UserAssert(IsWinEventNotifyDeferredOK()); 00270 00271 /* 00272 * Get the pointer to the security descriptor so we can 00273 * assign it to the new object later. 00274 */ 00275 psdCapture = ObjectAttributes->SecurityDescriptor; 00276 00277 /* 00278 * The first windowstation that gets created is Winsta0 and 00279 * it's the only interactive one. 00280 */ 00281 if (grpWinStaList == NULL) { 00282 00283 /* 00284 * Assert that winlogon is the first to call CreateWindowStation 00285 */ 00286 UserAssert(PsGetCurrentProcess()->UniqueProcessId == gpidLogon); 00287 00288 pTerm = &gTermIO; 00289 } else { 00290 pTerm = &gTermNOIO; 00291 00292 UserAssert(grpWinStaList->rpwinstaNext == NULL || 00293 pTerm->dwTERMF_Flags & TERMF_NOIO); 00294 00295 pTerm->dwTERMF_Flags |= TERMF_NOIO; 00296 } 00297 00298 /* 00299 * Create the WindowStation object 00300 */ 00301 Status = ObCreateObject(KernelMode, *ExWindowStationObjectType, 00302 ObjectAttributes, OwnershipMode, NULL, sizeof(WINDOWSTATION), 00303 0, 0, &pwinsta); 00304 00305 if (!NT_SUCCESS(Status)) { 00306 RIPNTERR0(Status, RIP_WARNING, "Failed to create windowstation"); 00307 return NULL; 00308 } 00309 00310 /* 00311 * Initialize everything 00312 */ 00313 RtlZeroMemory(pwinsta, sizeof(WINDOWSTATION)); 00314 00315 /* 00316 * Store the session id of the session who created the windowstation 00317 */ 00318 pwinsta->dwSessionId = gSessionId; 00319 00320 pwinsta->pTerm = pTerm; 00321 00322 /* 00323 * All the windowstations in the system terminal are non-interactive. 00324 */ 00325 if (pTerm->dwTERMF_Flags & TERMF_NOIO) { 00326 pwinsta->dwWSF_Flags = WSF_NOIO; 00327 } 00328 00329 /* 00330 * Create the global atom table and populate it with the default OLE atoms 00331 * Pin each atom so they can't be deleted by bogus applications like Winword 00332 */ 00333 Status = CreateGlobalAtomTable(&pwinsta->pGlobalAtomTable); 00334 00335 if (pwinsta->pGlobalAtomTable == NULL) { 00336 UserAssert(!NT_SUCCESS(Status)); 00337 RIPNTERR0(Status, RIP_WARNING, "CreateGlobalAtomTable failed"); 00338 goto create_error; 00339 } 00340 00341 /* 00342 * create the desktop thread 00343 * and the RIT (only for the IO terminal) 00344 */ 00345 if (!(pTerm->dwTERMF_Flags & TERMF_INITIALIZED)) { 00346 00347 Status = xxxInitTerminal(pTerm); 00348 00349 if (!NT_SUCCESS(Status)) { 00350 RIPNTERR0(Status, RIP_WARNING, "xxxInitTerminal failed"); 00351 goto create_error; 00352 } 00353 } 00354 00355 if (!(pwinsta->dwWSF_Flags & WSF_NOIO)) { 00356 if (!xxxInitWindowStation(pwinsta)) { 00357 RIPNTERR0(STATUS_NO_MEMORY, RIP_WARNING, "xxxInitWindowStation failed"); 00358 goto create_error; 00359 } 00360 } 00361 00362 /* 00363 * Create only one desktop owner window per terminal. 00364 */ 00365 if (pTerm->spwndDesktopOwner == NULL) { 00366 00367 /* 00368 * Switch ppi values so window will be created using the 00369 * system's desktop window class. 00370 */ 00371 ptiCurrent = PtiCurrent(); 00372 ppiSave = ptiCurrent->ppi; 00373 ptiCurrent->ppi = pTerm->ptiDesktop->ppi; 00374 00375 UserAssert(pTerm->ptiDesktop->ppi->W32PF_Flags & W32PF_CLASSESREGISTERED); 00376 00377 pdeskTemp = ptiCurrent->rpdesk; /* save current desktop */ 00378 hdeskTemp = ptiCurrent->hdesk; 00379 if (pdeskTemp) { 00380 ObReferenceObject(pdeskTemp); 00381 LogDesktop(pdeskTemp, LD_REF_FN_CREATEWINDOWSTATION, TRUE, (ULONG_PTR)PtiCurrent()); 00382 } 00383 00384 /* 00385 * The following code is not supposed to leave the critical section because 00386 * CreateWindowStation is an API so the current thread can be on any state 00387 * setting its pdesk to NULL it's kind of bogus 00388 */ 00389 DeferWinEventNotify(); 00390 BEGINATOMICCHECK(); 00391 zzzSetDesktop(ptiCurrent, NULL, NULL); 00392 00393 00394 /* 00395 * HACK HACK HACK!!! (adams) In order to create the desktop window 00396 * with the correct desktop, we set the desktop of the current thread 00397 * to the new desktop. But in so doing we allow hooks on the current 00398 * thread to also hook this new desktop. This is bad, because we don't 00399 * want the desktop window to be hooked while it is created. So we 00400 * temporarily disable hooks of the current thread and desktop, and 00401 * reenable them after switching back to the original desktop. 00402 */ 00403 00404 dwDisableHooks = ptiCurrent->TIF_flags & TIF_DISABLEHOOKS; 00405 ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS; 00406 00407 /* 00408 * Create the desktop owner window 00409 * 00410 * CONSIDER (adams): Do we want to limit the desktop size so that the 00411 * width and height of a rect will fit in 16bit coordinates? 00412 * 00413 * SHRT_MIN / 2, SHRT_MIN / 2, SHRT_MAX, SHRT_MAX, 00414 * 00415 * Or do we want to limit it so just any point has 16bit coordinates? 00416 * 00417 * -SHRT_MIN, -SHRT_MIN, SHRT_MAX * 2, SHRT_MAX * 2 00418 */ 00419 00420 pwnd = xxxCreateWindowEx( 00421 (DWORD)0, 00422 (PLARGE_STRING)DESKTOPCLASS, 00423 NULL, 00424 (WS_POPUP | WS_CLIPCHILDREN), 00425 SHRT_MIN / 2, 00426 SHRT_MIN / 2, 00427 SHRT_MAX, 00428 SHRT_MAX, 00429 NULL, 00430 NULL, 00431 hModuleWin, 00432 (LPWSTR)NULL, 00433 VER31 00434 ); 00435 00436 if (pwnd == NULL) { 00437 RIPMSG0(RIP_WARNING, "xxxCreateWindowStation: Failed to create mother desktop window"); 00438 Status = STATUS_NO_MEMORY; 00439 EXITATOMICCHECK(); 00440 zzzEndDeferWinEventNotify(); 00441 /* 00442 * Restore caller's ppi 00443 */ 00444 ptiCurrent->ppi = ppiSave; 00445 00446 /* 00447 * Restore the previous desktop 00448 */ 00449 zzzSetDesktop(ptiCurrent, pdeskTemp, hdeskTemp); 00450 00451 goto create_error; 00452 } 00453 00454 /* 00455 * Mark this handle entry that is allocated out of pool 00456 */ 00457 { 00458 PHE phe; 00459 00460 UserAssert(ptiCurrent->rpdesk == NULL); 00461 00462 phe = HMPheFromObject(pwnd); 00463 phe->bFlags |= HANDLEF_POOL; 00464 } 00465 00466 Lock(&(pTerm->spwndDesktopOwner), pwnd); 00467 00468 UserAssert(ptiCurrent->TIF_flags & TIF_DISABLEHOOKS); 00469 ptiCurrent->TIF_flags = (ptiCurrent->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 00470 00471 SetVisible(pTerm->spwndDesktopOwner, SV_SET); 00472 HMChangeOwnerThread(pTerm->spwndDesktopOwner, pTerm->ptiDesktop); 00473 00474 /* 00475 * Restore caller's ppi 00476 */ 00477 ptiCurrent->ppi = ppiSave; 00478 00479 /* 00480 * Restore the previous desktop 00481 */ 00482 zzzSetDesktop(ptiCurrent, pdeskTemp, hdeskTemp); 00483 00484 ENDATOMICCHECK(); 00485 zzzEndDeferWinEventNotify(); 00486 00487 if (pdeskTemp) { 00488 LogDesktop(pdeskTemp, LD_DEREF_FN_CREATEWINDOWSTATION, FALSE, (ULONG_PTR)PtiCurrent()); 00489 ObDereferenceObject(pdeskTemp); 00490 } 00491 } 00492 00493 /* 00494 * If this is the visible windowstation, assign it to 00495 * the server and create the desktop switch notification 00496 * event. 00497 */ 00498 if (!(pwinsta->dwWSF_Flags & WSF_NOIO)) { 00499 UNICODE_STRING strName; 00500 HANDLE hRootDir; 00501 OBJECT_ATTRIBUTES obja; 00502 00503 /* 00504 * Create desktop switch notification event. 00505 */ 00506 ulLengthSid = RtlLengthSid(SeExports->SeWorldSid); 00507 ulLength = ulLengthSid + sizeof(ACE_HEADER) + sizeof(ACCESS_MASK); 00508 00509 /* 00510 * Allocate the ACE list 00511 */ 00512 paceList = (PACCESS_ALLOWED_ACE)UserAllocPoolWithQuota(ulLength, TAG_SECURITY); 00513 00514 if (paceList == NULL) { 00515 Status = STATUS_NO_MEMORY; 00516 goto create_error; 00517 } 00518 00519 /* 00520 * Initialize ACE 0 00521 */ 00522 pace = paceList; 00523 pace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE; 00524 pace->Header.AceSize = (USHORT)ulLength; 00525 pace->Header.AceFlags = 0; 00526 pace->Mask = SYNCHRONIZE; 00527 RtlCopySid(ulLengthSid, &pace->SidStart, SeExports->SeWorldSid); 00528 00529 /* 00530 * Create the SD 00531 */ 00532 psd = CreateSecurityDescriptor(paceList, ulLength, FALSE); 00533 00534 UserFreePool(paceList); 00535 00536 if (psd == NULL) { 00537 Status = STATUS_NO_MEMORY; 00538 goto create_error; 00539 } 00540 00541 /* 00542 * Create the named event. 00543 */ 00544 UserAssert(ghEventSwitchDesktop == NULL); 00545 00546 if (gbRemoteSession) { 00547 swprintf(szBaseNamedObjectDirectory, L"\\Sessions\\%ld\\BaseNamedObjects", 00548 gSessionId); 00549 RtlInitUnicodeString(&strName, szBaseNamedObjectDirectory); 00550 } else { 00551 RtlInitUnicodeString(&strName, L"\\BaseNamedObjects"); 00552 } 00553 00554 InitializeObjectAttributes( &obja, 00555 &strName, 00556 OBJ_CASE_INSENSITIVE, 00557 NULL, 00558 NULL 00559 ); 00560 Status = ZwOpenDirectoryObject( &hRootDir, 00561 DIRECTORY_ALL_ACCESS & 00562 ~(DELETE | WRITE_DAC | WRITE_OWNER), 00563 &obja 00564 ); 00565 if (NT_SUCCESS(Status)) { 00566 RtlInitUnicodeString(&strName, L"WinSta0_DesktopSwitch"); 00567 InitializeObjectAttributes(&obja, &strName, OBJ_OPENIF, hRootDir, psd); 00568 Status = ZwCreateEvent(&hEvent, EVENT_ALL_ACCESS, &obja, 00569 NotificationEvent, FALSE); 00570 ZwClose(hRootDir); 00571 00572 if (NT_SUCCESS(Status)) { 00573 Status = ObReferenceObjectByHandle(hEvent, EVENT_ALL_ACCESS, *ExEventObjectType, 00574 KernelMode, &gpEventSwitchDesktop, NULL); 00575 if (NT_SUCCESS(Status)) { 00576 00577 /* 00578 * Attach to the system process and create a handle to the 00579 * object. This will ensure that the object name is retained 00580 * when hEvent is closed. This is simpler than creating a 00581 * permanent object, which takes the 00582 * SeCreatePermanentPrivilege. 00583 */ 00584 KeAttachProcess(&gpepCSRSS->Pcb); 00585 00586 Status = ObOpenObjectByPointer( 00587 gpEventSwitchDesktop, 00588 0, 00589 NULL, 00590 EVENT_ALL_ACCESS, 00591 NULL, 00592 KernelMode, 00593 &ghEventSwitchDesktop); 00594 KeDetachProcess(); 00595 } 00596 ZwClose(hEvent); 00597 } 00598 } 00599 if (!NT_SUCCESS(Status)) 00600 goto create_error; 00601 00602 UserFreePool(psd); 00603 } 00604 00605 /* 00606 * Create a handle to the windowstation 00607 */ 00608 Status = ObInsertObject(pwinsta, NULL, dwDesiredAccess, 1, 00609 &pwinsta, &hwinsta); 00610 00611 if (Status == STATUS_OBJECT_NAME_EXISTS) { 00612 00613 /* 00614 * The windowstation already exists, so deref and leave. 00615 */ 00616 ObDereferenceObject(pwinsta); 00617 00618 } else if (NT_SUCCESS(Status)) { 00619 PSECURITY_DESCRIPTOR psdParent, psdNew; 00620 SECURITY_SUBJECT_CONTEXT Context; 00621 POBJECT_DIRECTORY pParentDirectory; 00622 SECURITY_INFORMATION siNew; 00623 00624 /* 00625 * Create security descriptor for the windowstation. 00626 * ObInsertObject only supports non-container 00627 * objects, so we must assign our own security descriptor. 00628 */ 00629 SeCaptureSubjectContext(&Context); 00630 SeLockSubjectContext(&Context); 00631 00632 pParentDirectory = OBJECT_HEADER_TO_NAME_INFO( 00633 OBJECT_TO_OBJECT_HEADER(pwinsta))->Directory; 00634 if (pParentDirectory != NULL) 00635 psdParent = OBJECT_TO_OBJECT_HEADER(pParentDirectory)->SecurityDescriptor; 00636 else 00637 psdParent = NULL; 00638 00639 Status = SeAssignSecurity( 00640 psdParent, 00641 psdCapture, 00642 &psdNew, 00643 TRUE, 00644 &Context, 00645 (PGENERIC_MAPPING)&WinStaMapping, 00646 PagedPool); 00647 00648 SeUnlockSubjectContext(&Context); 00649 SeReleaseSubjectContext(&Context); 00650 00651 if (!NT_SUCCESS(Status)) { 00652 #if DBG 00653 if (Status == STATUS_ACCESS_DENIED) { 00654 RIPNTERR0(Status, RIP_WARNING, "Access denied during object creation"); 00655 } else { 00656 RIPNTERR1(Status, RIP_ERROR, 00657 "Can't create security descriptor! Status = %#lx", 00658 Status); 00659 } 00660 #endif 00661 } else { 00662 00663 /* 00664 * Call the security method to copy the security descriptor 00665 */ 00666 siNew = (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | 00667 DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION); 00668 Status = ObSetSecurityDescriptorInfo( 00669 pwinsta, 00670 &siNew, 00671 psdNew, 00672 &OBJECT_TO_OBJECT_HEADER(pwinsta)->SecurityDescriptor, 00673 PagedPool, 00674 (PGENERIC_MAPPING)&WinStaMapping); 00675 SeDeassignSecurity(&psdNew); 00676 00677 if (NT_SUCCESS(Status)) { 00678 00679 PWINDOWSTATION* ppwinsta; 00680 00681 /* 00682 * Put it on the tail of the global windowstation list 00683 */ 00684 ppwinsta = &grpWinStaList; 00685 while (*ppwinsta != NULL) 00686 ppwinsta = &(*ppwinsta)->rpwinstaNext; 00687 LockWinSta(ppwinsta, pwinsta); 00688 00689 /* 00690 * For interactive window stations load the keyboard 00691 * layout. !!! 00692 */ 00693 if (!(pwinsta->dwWSF_Flags & WSF_NOIO) && pwszKLID != NULL) { 00694 if (xxxLoadKeyboardLayoutEx( 00695 pwinsta, 00696 hKbdLayoutFile, 00697 (HKL)NULL, 00698 offTable, 00699 pwszKLID, 00700 uKbdInputLocale, 00701 KLF_ACTIVATE | KLF_INITTIME) == NULL) { 00702 Status = STATUS_UNSUCCESSFUL; 00703 } 00704 } 00705 } 00706 } 00707 ObDereferenceObject(pwinsta); 00708 } 00709 00710 if (!NT_SUCCESS(Status)) { 00711 RIPNTERR1(Status, 00712 RIP_WARNING, 00713 "CreateWindowStation: Failed with Status 0x%x", 00714 Status); 00715 return NULL; 00716 } 00717 00718 return hwinsta; 00719 00720 /* 00721 * Goto here if an error occurs so things can be cleaned up 00722 */ 00723 create_error: 00724 00725 RIPNTERR1(Status, 00726 RIP_WARNING, 00727 "CreateWindowStation: Failed with Status 0x%x", 00728 Status); 00729 00730 ObDereferenceObject(pwinsta); 00731 00732 return NULL; 00733 }

VOID xxxDDETrackGetMessageHook PMSG  pmsg  ) 
 

Definition at line 618 of file kernel/ddetrack.c.

References BOOL, CXF_IS_SERVER, CXF_TERMINATE_POSTED, DWORD, FALSE, FindDdeConv(), tagXSTATE::flags, tagDDECONV::flags, FreeDdeConv(), FreeDdeXact(), GetAppCompatFlags2(), tagXSTATE::hClient, HMValidateHandleNoRip(), tagXSTATE::hServer, NULL, tagDDECONV::pfl, tagXSTATE::pIntDdeInfo, RevalidateCatHwnd, tagDDECONV::spartnerConv, ThreadLockAlways, ThreadUnlock, TRACE_DDE, TRACE_DDE1, TRACE_DDE2, TraceDdeMsg, TRUE, TYPE_DDEXACT, ValidateHwnd, VOID(), XS_FREEPXS, xxxCleanupDdeConv(), xxxCopyDDEOut(), and xxxFreeListFree().

Referenced by xxxReadPostMessage().

00620 { 00621 PXSTATE pxs; 00622 HANDLE hDirect; 00623 DWORD flags; 00624 BOOL fUnlockDdeConv; 00625 TL tlpDdeConv, tlpxs; 00626 00627 TraceDdeMsg(pmsg->message, (HWND)pmsg->wParam, pmsg->hwnd, MSG_RECV); 00628 00629 if (pmsg->message == WM_DDE_TERMINATE) { 00630 PWND pwndFrom, pwndTo; 00631 PDDECONV pDdeConv; 00632 00633 pwndTo = ValidateHwnd(pmsg->hwnd); 00634 00635 /* 00636 * We should get the pwnd even if the partner is destroyed in order 00637 * to clean up the DDE objects now. Exiting now would work, but would 00638 * leave the conversation objects locked and present until the To window 00639 * gets destroyed, which seems excessive. 00640 */ 00641 pwndFrom = RevalidateCatHwnd((HWND)pmsg->wParam); 00642 00643 if (pwndTo == NULL) { 00644 TRACE_DDE("TERMINATE ignored, invalid window(s)."); 00645 return; 00646 00647 } else if (pwndFrom == NULL) { 00648 00649 CleanupAndExit: 00650 /* 00651 * Do this only for appcompat 00652 */ 00653 if (GetAppCompatFlags2(VERMAX) & GACF2_DDE) { 00654 xxxCleanupDdeConv(pwndTo); 00655 } else { 00656 TRACE_DDE("TERMINATE ignored, invalid window(s)."); 00657 } 00658 return; 00659 } 00660 00661 /* 00662 * locate conversation info. 00663 */ 00664 pDdeConv = FindDdeConv(pwndTo, pwndFrom); 00665 if (pDdeConv == NULL) { 00666 /* 00667 * Must be a harmless extra terminate. 00668 */ 00669 TRACE_DDE("TERMINATE ignored, conversation not found."); 00670 return; 00671 } 00672 00673 if (pDdeConv->flags & CXF_TERMINATE_POSTED && 00674 pDdeConv->spartnerConv->flags & CXF_TERMINATE_POSTED) { 00675 00676 /* 00677 * clean up client side objects on this side 00678 */ 00679 fUnlockDdeConv = FALSE; 00680 if (pDdeConv->pfl != NULL) { 00681 PFREELIST pfl; 00682 00683 fUnlockDdeConv = TRUE; 00684 ThreadLockAlways(pDdeConv, &tlpDdeConv); 00685 pfl = pDdeConv->pfl; 00686 pDdeConv->pfl = NULL; 00687 xxxFreeListFree(pfl); 00688 } 00689 00690 TRACE_DDE2("DDE conversation (%#p:%#p) closed", 00691 (pDdeConv->flags & CXF_IS_SERVER) ? pmsg->wParam : (ULONG_PTR)pmsg->hwnd, 00692 (pDdeConv->flags & CXF_IS_SERVER) ? (ULONG_PTR)pmsg->hwnd : pmsg->wParam); 00693 00694 FreeDdeConv(pDdeConv->spartnerConv); 00695 FreeDdeConv(pDdeConv); 00696 00697 if (fUnlockDdeConv) { 00698 ThreadUnlock(&tlpDdeConv); 00699 } 00700 } 00701 00702 goto CleanupAndExit; 00703 } 00704 00705 pxs = (PXSTATE)HMValidateHandleNoRip((HANDLE)pmsg->lParam, TYPE_DDEXACT); 00706 if (pxs == NULL) { 00707 /* 00708 * The posting window has died and the pxs was freed so this 00709 * message shouldn't be bothered with...map to WM_NULL. 00710 */ 00711 pmsg->lParam = 0; 00712 pmsg->message = WM_NULL; 00713 return; 00714 } 00715 flags = pxs->flags; 00716 00717 ThreadLockAlways(pxs, &tlpxs); 00718 pmsg->lParam = (LPARAM)xxxCopyDDEOut(pxs->pIntDdeInfo, &hDirect); 00719 if (pmsg->lParam == (LPARAM)NULL) { 00720 /* 00721 * Turn this message into a terminate - we failed to copy the 00722 * message data out which implies we are too low on memory 00723 * to continue the conversation. Shut it down now before 00724 * other problems pop up that this failure will cause. 00725 */ 00726 pmsg->message = WM_DDE_TERMINATE; 00727 RIPMSG0(RIP_WARNING, "DDETrack: couldn't copy data out, terminate faked."); 00728 } 00729 if (ThreadUnlock(&tlpxs) == NULL) { 00730 return; 00731 } 00732 00733 if (flags & XS_FREEPXS) { 00734 FreeDdeXact(pxs); 00735 return; 00736 } 00737 00738 /* 00739 * The only reason XS_FREEPXS isn't set is because we don't know which 00740 * side frees the data till an ACK comes back, thus one of the client 00741 * handles in pxs is already set via xxxDDETrackPostHook(). The one thats 00742 * not yet set gets set here. 00743 */ 00744 00745 if (pxs->hClient == NULL) { 00746 TRACE_DDE1("Saving %#p into hClient", hDirect); 00747 pxs->hClient = hDirect; 00748 } else { 00749 TRACE_DDE1("Saving %#p into hServer.", hDirect); 00750 pxs->hServer = hDirect; 00751 } 00752 return; 00753 }

DWORD xxxDDETrackPostHook PUINT  pmessage,
PWND  pwndTo,
WPARAM  wParam,
LPARAM *  plParam,
BOOL  fSent
 

Definition at line 320 of file kernel/ddetrack.c.

References CheckLock, ClientGetDDEHookData(), CXF_IS_SERVER, CXF_PARTNER_WINDOW_DIED, CXF_TERMINATE_POSTED, DO_POST, DWORD, FAIL_POST, FAILNOFREE_POST, FAKE_POST, FindDdeConv(), tagDDECONV::flags, tagXSTATE::fnResponse, FreeDDEHandle(), GETPTI, GETPWNDPPI, tagWND::head, MonitorFlags, NewConversation(), tagFREELIST::next, NULL, tagDDECONV::pfl, PtiCurrent, PtoH, tagDDECONV::spartnerConv, tagDDECONV::spxsOut, ThreadLockAlways, ThreadUnlock, TIF_16BIT, TIF_INCLEANUP, TRACE_DDE, TraceDdeMsg, ValidateHwnd, VER40, XS_DATA, XS_DUMPMSG, XS_EXECUTE, XS_HIHANDLE, XS_LOHANDLE, XS_PACKED, xxxFreeListFree(), xxxMessageEvent(), xxxUnexpectedClientPost(), and xxxUnexpectedServerPost().

Referenced by _PostMessage(), and MESSAGECALL().

00326 { 00327 PWND pwndFrom; 00328 PDDECONV pDdeConv = NULL; 00329 DWORD dwRet; 00330 TL tlpDdeConv; 00331 PFREELIST pfl, *ppfl; 00332 DWORD MFlag; 00333 00334 CheckLock(pwndTo); 00335 00336 MFlag = fSent ? MF_SENDMSGS : MF_POSTMSGS; 00337 if (MonitorFlags & MFlag) { 00338 DDEML_MSG_HOOK_DATA dmhd; 00339 00340 switch (*pmessage ) { 00341 case WM_DDE_DATA: 00342 case WM_DDE_POKE: 00343 case WM_DDE_ADVISE: 00344 case WM_DDE_EXECUTE: 00345 case WM_DDE_ACK: 00346 ClientGetDDEHookData(*pmessage, *plParam, &dmhd); 00347 break; 00348 00349 default: 00350 // WM_DDE_REQUEST 00351 // WM_DDE_TERMINATE 00352 // WM_DDE_UNADVISE 00353 dmhd.cbData = 0; 00354 dmhd.uiLo = LOWORD(*plParam); 00355 dmhd.uiHi = HIWORD(*plParam); 00356 } 00357 xxxMessageEvent(pwndTo, *pmessage, wParam, *plParam, MFlag, 00358 &dmhd); 00359 } 00360 00361 if (PtiCurrent()->ppi == GETPWNDPPI(pwndTo)) { 00362 /* 00363 * skip all intra-process conversation tracking. 00364 */ 00365 dwRet = DO_POST; 00366 goto Exit; 00367 } 00368 00369 if (*pmessage == WM_DDE_INITIATE) { 00370 RIPMSG2(RIP_WARNING, 00371 "DDE Post failed (%#p:%#p) - WM_DDE_INITIATE posted", 00372 wParam, PtoH(pwndTo)); 00373 dwRet = FAIL_POST; 00374 goto Exit; 00375 } 00376 00377 pwndFrom = ValidateHwnd((HWND)wParam); 00378 if (pwndFrom == NULL) { 00379 /* 00380 * This is a post AFTER a window has been destroyed. This is not 00381 * expected except in the case where xxxDdeTrackWindowDying() 00382 * is posting a cleanup terminate. 00383 */ 00384 dwRet = *pmessage == WM_DDE_TERMINATE ? DO_POST : FAKE_POST; 00385 goto Exit; 00386 } 00387 00388 /* 00389 * locate conversation info. 00390 */ 00391 pDdeConv = FindDdeConv(pwndFrom, pwndTo); 00392 if (pDdeConv == NULL) { 00393 if (*pmessage != WM_DDE_TERMINATE && 00394 (GETPTI(pwndFrom)->TIF_flags & TIF_16BIT) && 00395 (pwndTo->head.rpdesk == pwndFrom->head.rpdesk)) { 00396 /* 00397 * If a WOW app bypasses initiates and posts directly to 00398 * a window on the same desktop, let it sneak by here. 00399 * 00400 * This allows some evil apps such as OpenEngine and CA-Cricket 00401 * to get away with murder. 00402 * 00403 * TERMINATES out of the blue however may be due to an app 00404 * posting its WM_DDE_TERMINATE after it has destroyed its 00405 * window. Since window destruction would have generated the 00406 * TERMINATE already, don't let it through here. 00407 */ 00408 NewConversation(&pDdeConv, NULL, pwndFrom, pwndTo); 00409 } 00410 if (pDdeConv == NULL) { 00411 RIPMSG2(RIP_VERBOSE, "Can't find DDE conversation for (%#p:%#p).", 00412 wParam, PtoH(pwndTo)); 00413 dwRet = *pmessage == WM_DDE_TERMINATE ? FAKE_POST : FAIL_POST; 00414 goto Exit; 00415 } 00416 } 00417 00418 if (fSent && pDdeConv->spartnerConv->spxsOut != NULL) { 00419 /* 00420 * Sent DDE messages will not work if any posted DDE messages are 00421 * in the queue because this will violate the message ordering rule. 00422 */ 00423 RIPMSG0(RIP_VERBOSE, 00424 "Sent DDE message failed - queue contains a previous post."); 00425 dwRet = FAIL_POST; 00426 goto Exit; 00427 } 00428 00429 /* 00430 * The tracking layer never did allow multiple threads to handle 00431 * the same DDE conversation but win95 shipped and some apps 00432 * got out there that did just this. We will let it slide for 00433 * 4.0 apps only so that when they rev their app, they will see 00434 * that they were wrong. 00435 */ 00436 if (PtiCurrent() != GETPTI(pDdeConv) && 00437 PtiCurrent()->dwExpWinVer != VER40) { 00438 RIPERR0(ERROR_WINDOW_OF_OTHER_THREAD, 00439 RIP_ERROR, 00440 "Posting DDE message from wrong thread!"); 00441 00442 dwRet = FAIL_POST; 00443 goto Exit; 00444 } 00445 00446 ThreadLockAlways(pDdeConv, &tlpDdeConv); 00447 00448 /* 00449 * If the handle we're using is in the free list, remove it 00450 */ 00451 ppfl = &pDdeConv->pfl; 00452 while (*ppfl != NULL) { 00453 if ((*ppfl)->h == (HANDLE)*plParam) { 00454 /* Let's stop to check this out */ 00455 UserAssert((*ppfl)->h == (HANDLE)*plParam); 00456 *ppfl = (*ppfl)->next; 00457 } else { 00458 ppfl = &(*ppfl)->next; 00459 } 00460 } 00461 pfl = pDdeConv->pfl; 00462 pDdeConv->pfl = NULL; 00463 xxxFreeListFree(pfl); 00464 00465 if (*pmessage != WM_DDE_TERMINATE && 00466 (pDdeConv->flags & (CXF_TERMINATE_POSTED | CXF_PARTNER_WINDOW_DIED))) { 00467 dwRet = FAKE_POST; 00468 goto UnlockExit; 00469 } 00470 00471 if (pDdeConv->spxsOut == NULL) { 00472 if (pDdeConv->flags & CXF_IS_SERVER) { 00473 dwRet = xxxUnexpectedServerPost((PDWORD)pmessage, plParam, pDdeConv); 00474 } else { 00475 dwRet = xxxUnexpectedClientPost((PDWORD)pmessage, plParam, pDdeConv); 00476 } 00477 } else { 00478 dwRet = (pDdeConv->spxsOut->fnResponse)(pmessage, plParam, pDdeConv); 00479 } 00480 00481 UnlockExit: 00482 00483 ThreadUnlock(&tlpDdeConv); 00484 00485 Exit: 00486 00487 if (dwRet == FAKE_POST && !((PtiCurrent())->TIF_flags & TIF_INCLEANUP)) { 00488 /* 00489 * We faked the post so do a client side cleanup here so that we 00490 * don't make it appear there is a leak in the client app. 00491 */ 00492 DWORD flags = XS_DUMPMSG; 00493 /* 00494 * The XS_DUMPMSG tells FreeDDEHandle to also free the atoms 00495 * associated with the data - since a faked post would make the app 00496 * think that the receiver was going to cleanup the atoms. 00497 * It also tells FreeDDEHandle to pay attention to the 00498 * fRelease bit when freeing the data - this way, loaned data 00499 * won't be destroyed. 00500 */ 00501 00502 switch (*pmessage & 0xFFFF) { 00503 case WM_DDE_UNADVISE: 00504 case WM_DDE_REQUEST: 00505 goto DumpMsg; 00506 00507 case WM_DDE_ACK: 00508 flags |= XS_PACKED; 00509 goto DumpMsg; 00510 00511 case WM_DDE_ADVISE: 00512 flags |= XS_PACKED | XS_HIHANDLE; 00513 goto DumpMsg; 00514 00515 case WM_DDE_DATA: 00516 case WM_DDE_POKE: 00517 flags |= XS_DATA | XS_LOHANDLE | XS_PACKED; 00518 goto DumpMsg; 00519 00520 case WM_DDE_EXECUTE: 00521 flags |= XS_EXECUTE; 00522 // fall through 00523 DumpMsg: 00524 if (pDdeConv != NULL) { 00525 TRACE_DDE("xxxDdeTrackPostHook: dumping message..."); 00526 FreeDDEHandle(pDdeConv, (HANDLE)*plParam, flags); 00527 dwRet = FAILNOFREE_POST; 00528 } 00529 } 00530 } 00531 #if DBG 00532 if (fSent) { 00533 TraceDdeMsg(*pmessage, (HWND)wParam, PtoH(pwndTo), MSG_SENT); 00534 } else { 00535 TraceDdeMsg(*pmessage, (HWND)wParam, PtoH(pwndTo), MSG_POST); 00536 } 00537 if (dwRet == FAKE_POST) { 00538 TRACE_DDE("...FAKED!"); 00539 } else if (dwRet == FAIL_POST) { 00540 TRACE_DDE("...FAILED!"); 00541 } else if (dwRet == FAILNOFREE_POST) { 00542 TRACE_DDE("...FAILED, DATA FREED!"); 00543 } 00544 #endif // DBG 00545 return(dwRet); 00546 }

BOOL xxxDDETrackSendHook PWND  pwndTo,
DWORD  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 147 of file kernel/ddetrack.c.

References _PostMessage(), AnticipatePost(), BOOL, DupConvTerminate, FALSE, FindDdeConv(), GETPWNDPPI, MonitorFlags, NewConversation(), NULL, PtiCurrent, PtoH, TRACE_DDE2, TRUE, ValidateHwnd, and xxxMessageEvent().

Referenced by xxxSendMessageTimeout().

00152 { 00153 PWND pwndServer; 00154 PDDECONV pdcNewClient, pdcNewServer; 00155 00156 if (MonitorFlags & MF_SENDMSGS) { 00157 DDEML_MSG_HOOK_DATA dmhd; 00158 00159 dmhd.cbData = 0; // Initiate and Ack sent messages have no data. 00160 dmhd.uiLo = LOWORD(lParam); // they arn't packed either. 00161 dmhd.uiHi = HIWORD(lParam); 00162 xxxMessageEvent(pwndTo, message, wParam, lParam, MF_SENDMSGS, &dmhd); 00163 } 00164 00165 if (PtiCurrent()->ppi == GETPWNDPPI(pwndTo)) { 00166 /* 00167 * Skip monitoring of all intra-process conversations. 00168 */ 00169 return(TRUE); 00170 } 00171 00172 if (message != WM_DDE_ACK) { 00173 if (message == WM_DDE_INITIATE) { 00174 return TRUE; // this is cool 00175 } 00176 return(FALSE); 00177 } 00178 00179 pwndServer = ValidateHwnd((HWND)wParam); 00180 if (pwndServer == NULL) { 00181 return(FALSE); 00182 } 00183 00184 pdcNewServer = FindDdeConv(pwndServer, pwndTo); 00185 if (pdcNewServer != NULL) { 00186 RIPMSG2(RIP_WARNING, 00187 "DDE protocol violation - non-unique window pair (%#p:%#p)", 00188 PtoH(pwndTo), PtoH(pwndServer)); 00189 /* 00190 * Duplicate Conversation case: 00191 * Don't allow the ACK to pass, post a terminate to the server 00192 * to shut down the duplicate on his end. 00193 */ 00194 AnticipatePost(pdcNewServer, DupConvTerminate, NULL, NULL, NULL, 0); 00195 _PostMessage(pwndServer, WM_DDE_TERMINATE, (WPARAM)PtoH(pwndTo), 0); 00196 return(FALSE); 00197 } 00198 00199 if (!NewConversation(&pdcNewClient, &pdcNewServer, pwndTo, pwndServer)) { 00200 return(FALSE); 00201 } 00202 00203 TRACE_DDE2("%#p->%#p DDE Conversation started", PtoH(pwndTo), wParam); 00204 return(TRUE); 00205 }

VOID xxxDDETrackWindowDying PWND  pwnd,
PDDECONV  pDdeConv
 

Definition at line 768 of file kernel/ddetrack.c.

References _PostMessage(), CheckLock, CXF_PARTNER_WINDOW_DIED, CXF_TERMINATE_POSTED, tagDDECONV::flags, FreeDdeConv(), GetAppCompatFlags2(), GetAppCompatFlags2ForPti(), GETPTI, NULL, tagDDECONV::pfl, PtoH, tagDDECONV::snext, tagDDECONV::spartnerConv, tagDDECONV::spwnd, tagDDECONV::spwndPartner, ThreadLock, ThreadLockAlways, ThreadUnlock, TRACE_DDE2, UnlinkConv(), VER40, VOID(), and xxxFreeListFree().

Referenced by xxxFreeWindow().

00771 { 00772 TL tlpDdeConv, tlpDdeConvNext; 00773 00774 UNREFERENCED_PARAMETER(pwnd); 00775 00776 CheckLock(pwnd); 00777 CheckLock(pDdeConv); 00778 00779 TRACE_DDE2("xxxDDETrackWindowDying(%#p, %#p)", PtoH(pwnd), pDdeConv); 00780 00781 while (pDdeConv != NULL) { 00782 00783 PFREELIST pfl; 00784 00785 /* 00786 * If there are any active conversations for this window 00787 * start termination if not already started. 00788 */ 00789 if (!(pDdeConv->flags & CXF_TERMINATE_POSTED)) { 00790 /* 00791 * Win9x doesn't do any tracking. This breaks some apps that 00792 * destroy the window first and then post the terminate. The 00793 * other side gets two terminates. 00794 */ 00795 if (!(GACF2_NODDETRKDYING & GetAppCompatFlags2(VER40)) 00796 || (pDdeConv->spwndPartner == NULL) 00797 || !(GACF2_NODDETRKDYING 00798 & GetAppCompatFlags2ForPti(GETPTI(pDdeConv->spwndPartner), VER40))) { 00799 00800 /* 00801 * CXF_TERMINATE_POSTED would have been set if the window had died. 00802 */ 00803 _PostMessage(pDdeConv->spwndPartner, WM_DDE_TERMINATE, 00804 (WPARAM)PtoH(pDdeConv->spwnd), 0); 00805 // pDdeConv->flags |= CXF_TERMINATE_POSTED; set by PostHookProc 00806 } else { 00807 RIPMSG2(RIP_WARNING, "xxxDDETrackWindowDying(GACF2_NODDETRKDYING) not posting terminate from %#p to %#p\r\n", 00808 pwnd, pDdeConv->spwndPartner); 00809 } 00810 } 00811 00812 /* 00813 * now fake that the other side already posted a terminate since 00814 * we will be gone. 00815 */ 00816 pDdeConv->spartnerConv->flags |= 00817 CXF_TERMINATE_POSTED | CXF_PARTNER_WINDOW_DIED; 00818 00819 ThreadLock(pDdeConv->snext, &tlpDdeConvNext); 00820 ThreadLockAlways(pDdeConv, &tlpDdeConv); 00821 00822 pfl = pDdeConv->pfl; 00823 pDdeConv->pfl = NULL; 00824 00825 if (pDdeConv->flags & CXF_PARTNER_WINDOW_DIED) { 00826 00827 ThreadUnlock(&tlpDdeConv); 00828 /* 00829 * he's already gone, free up conversation tracking data 00830 */ 00831 FreeDdeConv(pDdeConv->spartnerConv); 00832 FreeDdeConv(pDdeConv); 00833 } else { 00834 UnlinkConv(pDdeConv); 00835 ThreadUnlock(&tlpDdeConv); 00836 } 00837 xxxFreeListFree(pfl); 00838 00839 pDdeConv = ThreadUnlock(&tlpDdeConvNext); 00840 } 00841 }

VOID xxxDeactivate PTHREADINFO  pti,
DWORD  tidSetForeground
 

Definition at line 34 of file focusact.c.

References AAS, BOOL, BWL_ENUMLIST, ClrWF, tagAAS::fActivating, FALSE, tagAAS::fQueueNotify, GETPTI, IS_IME_ENABLED, Lock, NULL, tagDESKTOP::pDeskInfo, tagTHREADINFO::pq, PtiCurrent, tagAAS::ptiNotify, tagTHREADINFO::rpdesk, SetWakeBit(), tagDESKTOPINFO::spwnd, tagQ::spwndActive, tagQ::spwndActivePrev, tagQ::spwndCapture, tagWND::spwndChild, tagQ::spwndFocus, TestWF, ThreadLockAlwaysWithPti, ThreadLockPti, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPti, tagAAS::tidActDeact, tagTHREADINFO::TIF_flags, TIF_INACTIVATEAPPMSG, TIF_INCLEANUP, TRUE, Unlock, WFFRAMEON, WFMINIMIZED, WNDENUMPROC_PWND, xxxActivateApp(), xxxFocusSetInputContext(), xxxInternalEnumWindow(), and xxxSendMessage().

Referenced by xxxProcessEventMessage(), and xxxSetForegroundWindow2().

00037 { 00038 PWND pwndLose; 00039 AAS aas; 00040 TL tlpwndCapture; 00041 TL tlpwndChild; 00042 TL tlpwndLose; 00043 TL tlpti; 00044 TL tlptiLose; 00045 WPARAM wParam; 00046 PTHREADINFO ptiLose; 00047 PTHREADINFO ptiCurrent = PtiCurrent(); 00048 BOOL fSetActivateAppBit = FALSE; 00049 00050 /* 00051 * If we're not active, we have nothing to deactivate, so just return. 00052 * If we don't return, we'll send redundant WM_ACTIVATEAPP messages. 00053 * Micrografx Draw, for example, calls FreeProcInstance() twice when 00054 * this occurs, thereby crashing. 00055 */ 00056 if (pti->pq->spwndActive == NULL) 00057 return; 00058 00059 /* 00060 * If pti != ptiCurrent, thread lock pti because we may leave 00061 * the critical section. 00062 */ 00063 if (pti != ptiCurrent) 00064 ThreadLockPti(ptiCurrent, pti, &tlpti); 00065 00066 /* 00067 * Prevent an activating WM_ACTIVATEAPP from being sent 00068 * while we're processing this event. 00069 */ 00070 if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG)) { 00071 pti->TIF_flags |= TIF_INACTIVATEAPPMSG; 00072 fSetActivateAppBit = TRUE; 00073 } 00074 00075 /* 00076 * Cancel any modes like move/size and menu tracking. 00077 */ 00078 if (pti->pq->spwndCapture != NULL) { 00079 ThreadLockAlwaysWithPti(ptiCurrent, pti->pq->spwndCapture, &tlpwndCapture); 00080 xxxSendMessage(pti->pq->spwndCapture, WM_CANCELMODE, 0, 0); 00081 ThreadUnlock(&tlpwndCapture); 00082 00083 /* 00084 * Set QS_MOUSEMOVE so any sleeping modal loops, 00085 * like the move/size code, will wake up and figure 00086 * out that it should abort. 00087 */ 00088 SetWakeBit(pti, QS_MOUSEMOVE); 00089 } 00090 00091 /* 00092 * See the comments in xxxActivateThisWindow about Harvard Graphics. 00093 * WinWord's Equation editor does some games when it gets the WM_ACTIVATE 00094 * so we have to remember to send the WM_ACTIVATEAPP to ptiLose. 22510 00095 */ 00096 if (pti->pq->spwndActive != NULL) { 00097 pwndLose = pti->pq->spwndActive; 00098 ptiLose = GETPTI(pwndLose); 00099 00100 ThreadLockPti(ptiCurrent, ptiLose, &tlptiLose); 00101 ThreadLockAlwaysWithPti(ptiCurrent, pwndLose, &tlpwndLose); 00102 wParam = MAKELONG(WA_INACTIVE, TestWF(pwndLose, WFMINIMIZED)); 00103 if (!xxxSendMessage(pwndLose, WM_NCACTIVATE, WA_INACTIVE, 0)) { 00104 ThreadUnlock(&tlpwndLose); 00105 ThreadUnlockPti(ptiCurrent, &tlptiLose); 00106 goto Exit; 00107 } 00108 xxxSendMessage(pwndLose, WM_ACTIVATE, wParam, 0); 00109 00110 /* 00111 * Only update the queue's active windows if they weren't 00112 * changed while we were off calling SendMessage. 00113 */ 00114 if (pti->pq->spwndActive == pwndLose) { 00115 Lock(&pti->pq->spwndActivePrev, pti->pq->spwndActive); 00116 Unlock(&pti->pq->spwndActive); 00117 } 00118 00119 /* 00120 * The flag WFFRAMEON is cleared in the default processing of 00121 * WM_NCACTIVATE message. 00122 * We want to clear this flag again here since it might of been 00123 * set in xxxSendNCPaint. 00124 * Pbrush calls DrawMenuBar when it gets the WM_ACTIVATE message 00125 * sent above and this causes xxxSendNCPaint to get called and the 00126 * WFFRAMEON flag gets reset. 00127 */ 00128 ClrWF(pwndLose, WFFRAMEON); 00129 ThreadUnlock(&tlpwndLose); 00130 00131 /* 00132 * Revalidate ptiLose because the thread may have gone away 00133 * when the activation messages were sent above. 00134 */ 00135 aas.ptiNotify = (ptiLose->TIF_flags & TIF_INCLEANUP) ? NULL : ptiLose; 00136 ThreadUnlockPti(ptiCurrent, &tlptiLose); 00137 } else { 00138 00139 /* 00140 * Use a non-NULL special value for the test after 00141 * the xxxActivateApp calls. 00142 */ 00143 pwndLose = (PWND)-1; 00144 aas.ptiNotify = pti; 00145 } 00146 00147 if (aas.ptiNotify) { 00148 aas.tidActDeact = tidSetForeground; 00149 aas.fActivating = FALSE; 00150 aas.fQueueNotify = FALSE; 00151 00152 ThreadLockWithPti(ptiCurrent, 00153 pti->rpdesk->pDeskInfo->spwnd->spwndChild, &tlpwndChild); 00154 xxxInternalEnumWindow(pti->rpdesk->pDeskInfo->spwnd->spwndChild, 00155 (WNDENUMPROC_PWND)xxxActivateApp, (LPARAM)&aas, BWL_ENUMLIST); 00156 ThreadUnlock(&tlpwndChild); 00157 } 00158 00159 /* 00160 * If an app (i.e. Harvard Graphics/Windows Install) tries to 00161 * reactivate itself during a deactivating WM_ACTIVATEAPP 00162 * message, force deactivation. 00163 */ 00164 if (pti->pq->spwndActive == pwndLose) { 00165 00166 ThreadLockWithPti(ptiCurrent, pwndLose, &tlpwndLose); 00167 if (!xxxSendMessage(pwndLose, WM_NCACTIVATE, WA_INACTIVE, 0)) { 00168 ThreadUnlock(&tlpwndLose); 00169 goto Exit; 00170 } 00171 xxxSendMessage(pwndLose, WM_ACTIVATE, WA_INACTIVE, 0); 00172 ThreadUnlock(&tlpwndLose); 00173 00174 /* 00175 * Only update the queue's active windows if they weren't 00176 * changed while we were off calling SendMessage. 00177 */ 00178 if (pti->pq->spwndActive == pwndLose) { 00179 Lock(&pti->pq->spwndActivePrev, pti->pq->spwndActive); 00180 Unlock(&pti->pq->spwndActive); 00181 } 00182 } 00183 00184 if (pti->pq->spwndFocus != NULL) { 00185 pwndLose = Unlock(&pti->pq->spwndFocus); 00186 if (pwndLose != NULL) { 00187 ThreadLockAlwaysWithPti(ptiCurrent, pwndLose, &tlpwndLose); 00188 xxxSendMessage(pwndLose, WM_KILLFOCUS, 0, 0); 00189 #ifdef FE_IME 00190 if (IS_IME_ENABLED()) { 00191 xxxFocusSetInputContext(pwndLose, FALSE, FALSE); 00192 } 00193 #endif 00194 ThreadUnlock(&tlpwndLose); 00195 } 00196 } 00197 00198 Exit: 00199 if (fSetActivateAppBit) { 00200 pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG; 00201 } 00202 if (pti != ptiCurrent) 00203 ThreadUnlockPti(ptiCurrent, &tlpti); 00204 }

LRESULT xxxDefWindowProc PWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1264 of file dwp.c.

References _GetDCEx(), _GetDesktopWindow(), _GetKeyState(), _GetProcessWindowStation(), _InitPwSB(), _IsDescendant(), _PostMessage(), _ReleaseDC(), _SetMenuDefaultItem(), tagCLS::atomClassName, tagSERVERINFO::atomSysClass, _LARGE_STRING::bAnsi, BOOL, _LARGE_UNICODE_STRING::Buffer, _LARGE_STRING::Buffer, BuildHwndList(), BWL_ENUMLIST, BYTE, CheckLock, ClrWF, DefSetText(), DO_DROPFILE, DWORD, DWP_DrawItem(), DWP_GetHotKey(), DWP_GetIcon(), DWP_SetHotKey(), FALSE, FDoTray, FindNCHit(), FreeHwndList(), FWINABLE, GET_X_LPARAM, GET_Y_LPARAM, GetChildParent, GetContextHelpId(), GetMouseKeyFlags(), GETPTI, GetTopLevelWindow(), gpqForeground, gpsi, gspwndFullScreen, tagWND::head, HWq, ICLS_DIALOG, IsHooked, KEYBOARD_MENU, L, _LARGE_STRING::Length, _LARGE_UNICODE_STRING::Length, _LARGE_STRING::MaximumLength, MENUSYSMENU, msg, NCA_ACTIVE, NULL, PBYTE, tagWND::pcls, PCREATESTRUCTEX, PostShellHookMessages(), ppos, tagTHREADINFO::pq, PtiCurrent, PTR_TO_ID, PUDF_ANIMATE, PWNDDESKTOP, QF_FF10STATUS, tagQ::QF_flags, QF_FMENUSTATUS, QF_FMENUSTATUSBREAK, QF_TABSWITCHING, tagWND::rcClient, RevalidateHwnd, tagBWL::rghwnd, RtlUnicodeToMultiByteSize(), SetWF, SHORT, tagQ::spwndActive, tagQ::spwndCapture, tagWND::strName, SYS_ALTERNATE, SYS_PREVKEYSTATE, SYSHBRUSH, SYSMET, SYSRGB, TEST_KbdCuesPUSIF, TEST_PUDF, TestWF, TestwndChild, TestwndPopup, TextCopy(), ThreadLockAlways, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TRUE, UINT, ValidateHwnd, WEFACCEPTFILES, WEFPUIACCELHIDDEN, WEFPUIFOCUSHIDDEN, WFANSICREATOR, WFDISABLED, WFFRAMEON, WFHIDDENPOPUP, WFHSCROLL, WFMAXIMIZED, WFMENUDRAW, WFMINIMIZED, WFSYNCPAINTPENDING, WFTITLESET, WFVISIBLE, WFVSCROLL, WFWIN40COMPAT, WHF_SHELL, WINDOW, xxxActivateKeyboardLayout(), xxxAdjustSize(), xxxCalcClientRect(), xxxCallHook(), xxxClientShutdown(), xxxDestroyWindow(), xxxDoScrollMenu(), xxxDrawMenuBarUnderlines(), xxxDrawWindowFrame(), xxxDWP_DoCancelMode(), xxxDWP_DoNCActivate(), xxxDWP_EraseBkgnd(), xxxDWP_NCMouse(), xxxDWP_Paint(), xxxDWP_ProcessVirtKey(), xxxDWP_SetCursor(), xxxDWP_SetIcon(), xxxDWP_SetRedraw(), xxxDWPPrint(), xxxGetSysMenu(), xxxHandleWindowPosChanged(), xxxInternalDoSyncPaint(), xxxMessageBeep(), xxxPeekMessage, xxxRedrawTitle(), xxxReleaseCapture(), xxxSendHelpMessage(), xxxSendMessage(), xxxSendMinRectMessages(), xxxSetCapture(), xxxSetFocus(), xxxSetForegroundWindow(), xxxShowWindow(), xxxSimulateShiftF10(), xxxSleepThread(), xxxSysCommand(), xxxTrackPopupMenuEx(), and xxxWindowEvent().

Referenced by InitFunctionTables(), LW_RegisterWindows(), PatchThreadWindows(), xxxDesktopWndProc(), xxxDoSend(), xxxEventWndProc(), xxxFreeWindow(), xxxGetColorObjects(), xxxGetControlColor(), xxxMenuWindowProc(), xxxSBWndProc(), xxxSendMessageTimeout(), xxxSetWindowData(), xxxSwitchWndProc(), and xxxTooltipWndProc().

01269 { 01270 LRESULT lt; 01271 PWND pwndT; 01272 TL tlpwndParent; 01273 TL tlpwndT; 01274 int icolBack; 01275 int icolFore; 01276 int i; 01277 01278 CheckLock(pwnd); 01279 01280 if (pwnd == (PWND)-1) { 01281 return 0; 01282 } 01283 01284 if (message > WM_USER) { 01285 return 0; 01286 } 01287 01288 /* 01289 * Important: If you add cases to the switch statement below, 01290 * and those messages can originate on the client 01291 * side, add the messages to server.c's gawDefWindowMsgs 01292 * array or else the client will short-circuit the call 01293 * and return 0. 01294 */ 01295 01296 switch (message) { 01297 case WM_CLIENTSHUTDOWN: 01298 return xxxClientShutdown(pwnd, wParam); 01299 01300 case WM_NCACTIVATE: 01301 xxxDWP_DoNCActivate(pwnd, (LOWORD(wParam) ? NCA_ACTIVE : 0), (HRGN)lParam); 01302 return (LONG)TRUE; 01303 01304 case WM_NCHITTEST: 01305 return FindNCHit(pwnd, (LONG)lParam); 01306 01307 case WM_NCCALCSIZE: 01308 01309 /* 01310 * wParam = fCalcValidRects 01311 * lParam = LPRECT rgrc[3]: 01312 * lprc[0] = rcWindowNew = New window rectangle 01313 * if fCalcValidRects: 01314 * lprc[1] = rcWindowOld = Old window rectangle 01315 * lprc[2] = rcClientOld = Old client rectangle 01316 * 01317 * On return: 01318 * rgrc[0] = rcClientNew = New client rect 01319 * if fCalcValidRects: 01320 * rgrc[1] = rcValidDst = Destination valid rectangle 01321 * rgrc[2] = rcValidSrc = Source valid rectangle 01322 */ 01323 xxxCalcClientRect(pwnd, (LPRECT)lParam, FALSE); 01324 break; 01325 01326 case WM_NCLBUTTONDOWN: 01327 case WM_NCLBUTTONUP: 01328 case WM_NCLBUTTONDBLCLK: 01329 xxxDWP_NCMouse(pwnd, message, (UINT)wParam, lParam); 01330 break; 01331 01332 case WM_CANCELMODE: 01333 { 01334 /* 01335 * Terminate any modes the system might 01336 * be in, such as scrollbar tracking, menu mode, 01337 * button capture, etc. 01338 */ 01339 xxxDWP_DoCancelMode(pwnd); 01340 } 01341 break; 01342 01343 case WM_NCCREATE: 01344 if (TestWF(pwnd, (WFHSCROLL | WFVSCROLL))) { 01345 if (_InitPwSB(pwnd) == NULL) 01346 return (LONG)FALSE; 01347 } 01348 01349 #ifdef FE_SB // xxxDefWindowProc() 01350 /* 01351 * If CREATESTRUCTEX.strName contains resource id, we don't 01352 * need to call DefSetText(). because it is a numeric number, 01353 * it does not need Ansi <-> Unicode translation. 01354 */ 01355 if (lParam) { 01356 PLARGE_STRING pstr = &((PCREATESTRUCTEX)lParam)->strName; 01357 01358 if (pwnd->head.rpdesk == NULL || pstr == NULL || pstr->Buffer == NULL) { 01359 pwnd->strName.Length = 0; 01360 return TRUE; 01361 } 01362 01363 if ((pstr->bAnsi && (pstr->Length >= sizeof(BYTE)) && 01364 (*(PBYTE)(pstr->Buffer) == 0xff)) || 01365 (!pstr->bAnsi && (pstr->Length >= sizeof(WCHAR)) && 01366 (*(PWCHAR)(pstr->Buffer) == 0xffff))) { 01367 /* 01368 * This is Resource ID, we just return here with TRUE. 01369 */ 01370 return (LONG)TRUE; 01371 } 01372 } 01373 #endif // FE_SB 01374 01375 SetWF(pwnd, WFTITLESET); 01376 01377 return (LONG)DefSetText(pwnd, &((PCREATESTRUCTEX)lParam)->strName); 01378 01379 case WM_PRINT: 01380 return((LRESULT)xxxDWPPrint(pwnd, (HDC) wParam, lParam)); 01381 01382 case WM_NCPAINT: 01383 { 01384 HDC hdc; 01385 /* 01386 * Force the drawing of the menu. 01387 */ 01388 SetWF(pwnd, WFMENUDRAW); 01389 01390 /* 01391 * Get a window DC intersected with hrgnClip, 01392 * but make sure that hrgnClip doesn't get deleted. 01393 */ 01394 hdc = _GetDCEx(pwnd, 01395 (HRGN)wParam, 01396 DCX_USESTYLE | 01397 DCX_WINDOW | 01398 DCX_INTERSECTRGN | 01399 DCX_NODELETERGN | 01400 DCX_LOCKWINDOWUPDATE); 01401 01402 xxxDrawWindowFrame(pwnd, 01403 hdc, 01404 FALSE, 01405 (TestWF(pwnd, WFFRAMEON) && 01406 (GETPTI(pwnd)->pq == gpqForeground))); 01407 01408 _ReleaseDC(hdc); 01409 ClrWF(pwnd, WFMENUDRAW); 01410 } 01411 break; 01412 01413 case WM_ISACTIVEICON: 01414 return TestWF(pwnd, WFFRAMEON) != 0; 01415 01416 case WM_SETTEXT: 01417 /* 01418 * At one time we added an optimization to do nothing if the new 01419 * text was the same as the old text but found that QCcase does not work 01420 * because it calls SetWindowText not to change the text but 01421 * cause the title bar to redraw after it had added the sysmenu 01422 * through SetWindowLong 01423 */ 01424 if (lt = DefSetText(pwnd, (PLARGE_STRING)lParam)) { 01425 /* 01426 * Text was set, so redraw title bar 01427 */ 01428 xxxRedrawTitle(pwnd, DC_TEXT); 01429 if (FWINABLE()) { 01430 xxxWindowEvent(EVENT_OBJECT_NAMECHANGE, pwnd, OBJID_WINDOW, INDEXID_CONTAINER, 0); 01431 } 01432 } 01433 return lt; 01434 01435 case WM_GETTEXT: 01436 if (wParam != 0) { 01437 PLARGE_STRING pstr = (PLARGE_STRING)lParam; 01438 01439 if (pwnd->strName.Length) { 01440 if (pstr->bAnsi) { 01441 i = WCSToMB(pwnd->strName.Buffer, 01442 pwnd->strName.Length / sizeof(WCHAR), 01443 (LPSTR *)&pstr->Buffer, pstr->MaximumLength - 1, FALSE); 01444 ((LPSTR)pstr->Buffer)[i] = 0; 01445 pstr->Length = i; 01446 } else { 01447 i = TextCopy(&pwnd->strName, pstr->Buffer, (UINT)wParam); 01448 pstr->Length = i * sizeof(WCHAR); 01449 } 01450 return i; 01451 } 01452 01453 /* 01454 * else Null terminate the text buffer since there is no text. 01455 */ 01456 if (pstr->bAnsi) { 01457 *(LPSTR)pstr->Buffer = 0; 01458 } else { 01459 *(LPWSTR)pstr->Buffer = 0; 01460 } 01461 } 01462 return 0L; 01463 01464 case WM_GETTEXTLENGTH: 01465 if (pwnd->strName.Length) { 01466 UINT cch; 01467 if (lParam) { 01468 RtlUnicodeToMultiByteSize(&cch, 01469 pwnd->strName.Buffer, 01470 pwnd->strName.Length); 01471 } else { 01472 cch = pwnd->strName.Length / sizeof(WCHAR); 01473 } 01474 return cch; 01475 } 01476 return 0L; 01477 01478 case WM_CLOSE: 01479 xxxDestroyWindow(pwnd); 01480 break; 01481 01482 case WM_PAINT: 01483 case WM_PAINTICON: 01484 xxxDWP_Paint(pwnd); 01485 break; 01486 01487 case WM_ERASEBKGND: 01488 case WM_ICONERASEBKGND: 01489 return (LONG)xxxDWP_EraseBkgnd(pwnd, message, (HDC)wParam); 01490 01491 case WM_SYNCPAINT: 01492 01493 /* 01494 * Clear our sync-paint pending flag. 01495 */ 01496 ClrWF(pwnd, WFSYNCPAINTPENDING); 01497 01498 /* 01499 * This message is sent when SetWindowPos() is trying 01500 * to get the screen looking nice after window rearrangement, 01501 * and one of the windows involved is of another task. 01502 * This message avoids lots of inter-app message traffic 01503 * by switching to the other task and continuing the 01504 * recursion there. 01505 * 01506 * wParam = flags 01507 * LOWORD(lParam) = hrgnClip 01508 * HIWORD(lParam) = pwndSkip (not used; always NULL) 01509 * 01510 * pwndSkip is now always NULL. 01511 * 01512 * NOTE: THIS MESSAGE IS FOR INTERNAL USE ONLY! ITS BEHAVIOR 01513 * IS DIFFERENT IN 3.1 THAN IN 3.0!! 01514 */ 01515 xxxInternalDoSyncPaint(pwnd, (DWORD)wParam); 01516 break; 01517 01518 case WM_QUERYOPEN: 01519 case WM_QUERYENDSESSION: 01520 case WM_DEVICECHANGE: 01521 case WM_POWERBROADCAST: 01522 return (LONG)TRUE; 01523 01524 // Default handling for WM_CONTEXTMENU support 01525 case WM_RBUTTONUP: 01526 #ifdef USE_MIRRORING 01527 if (TestWF(pwnd, WEFLAYOUTRTL)) { 01528 lParam = MAKELPARAM(pwnd->rcClient.right - GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) + pwnd->rcClient.top); 01529 } else 01530 #endif 01531 { 01532 lParam = MAKELONG(GET_X_LPARAM(lParam) + pwnd->rcClient.left, GET_Y_LPARAM(lParam) + pwnd->rcClient.top); 01533 } 01534 xxxSendMessage(pwnd, WM_CONTEXTMENU, (WPARAM) HWq(pwnd), lParam); 01535 break; 01536 01537 case WM_NCRBUTTONDOWN: 01538 { 01539 int nHit; 01540 MSG msg; 01541 LONG spt; 01542 PTHREADINFO pti = PtiCurrent(); 01543 01544 nHit = FindNCHit(pwnd, (LONG)lParam); 01545 if (nHit == HTVSCROLL || nHit == HTHSCROLL) { 01546 if (!_IsDescendant(pti->pq->spwndActive, pwnd)) { 01547 break; 01548 } 01549 } else if (nHit == HTCAPTION || nHit == HTSYSMENU) { 01550 if (pwnd != pti->pq->spwndActive) { 01551 break; 01552 } 01553 } else { 01554 break; 01555 } 01556 01557 xxxSetCapture(pwnd); 01558 01559 while (TRUE) 01560 { 01561 if (xxxPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) 01562 { 01563 if (msg.message == WM_RBUTTONUP) 01564 { 01565 xxxReleaseCapture(); 01566 spt = POINTTOPOINTS(msg.pt); 01567 nHit = FindNCHit(pwnd, spt); 01568 if ((nHit == HTCAPTION) || (nHit == HTSYSMENU) || 01569 (nHit == HTVSCROLL) || (nHit == HTHSCROLL)) { 01570 xxxSendMessage(pwnd, WM_CONTEXTMENU, (WPARAM) HWq(pwnd), spt); 01571 } 01572 break; 01573 } 01574 } 01575 if (pwnd != pti->pq->spwndCapture) 01576 // Someone else grabbed the capture. Bail out. 01577 break; 01578 // xxxWaitMessage(); 01579 if (!xxxSleepThread(QS_MOUSE, 0, TRUE)) 01580 break; 01581 } 01582 } 01583 break; 01584 01585 /* 01586 * Default handling for WM_APPCOMMAND support 01587 */ 01588 case WM_NCXBUTTONUP: 01589 case WM_XBUTTONUP: 01590 { 01591 WORD cmd; 01592 WORD keystate; 01593 LPARAM lParamAppCommand; 01594 01595 cmd = 0; 01596 switch (GET_XBUTTON_WPARAM(wParam)) { 01597 case XBUTTON1: 01598 cmd = APPCOMMAND_BROWSER_BACKWARD; 01599 break; 01600 01601 case XBUTTON2: 01602 cmd = APPCOMMAND_BROWSER_FORWARD; 01603 break; 01604 01605 default: 01606 break; 01607 } 01608 01609 if (cmd == 0) { 01610 break; 01611 } 01612 01613 cmd |= FAPPCOMMAND_MOUSE; 01614 if (message == WM_XBUTTONUP) { 01615 keystate = GET_KEYSTATE_WPARAM(wParam); 01616 } else { 01617 keystate = (WORD)GetMouseKeyFlags(PtiCurrent()->pq); 01618 } 01619 01620 lParamAppCommand = MAKELPARAM(keystate, cmd); 01621 xxxSendMessage(pwnd, WM_APPCOMMAND, (WPARAM) HWq(pwnd), lParamAppCommand); 01622 break; 01623 } 01624 01625 case WM_MOUSEWHEEL: 01626 if (TestwndChild(pwnd)) { 01627 ThreadLockAlways(pwnd->spwndParent, &tlpwndParent); 01628 xxxSendMessage(pwnd->spwndParent, WM_MOUSEWHEEL, wParam, lParam); 01629 ThreadUnlock(&tlpwndParent); 01630 } 01631 break; 01632 01633 case WM_CONTEXTMENU: 01634 { 01635 int nHit; 01636 01637 nHit = FindNCHit(pwnd, (LONG)lParam); 01638 01639 /* 01640 * Put up a context menu if we clicked on a scroll bar 01641 */ 01642 if ((nHit == HTVSCROLL) || (nHit == HTHSCROLL)) { 01643 if (_IsDescendant(PtiCurrent()->pq->spwndActive, pwnd)) { 01644 xxxDoScrollMenu(pwnd, NULL, nHit - HTHSCROLL, lParam); 01645 } 01646 break; 01647 } 01648 01649 if (TestwndChild(pwnd)) { 01650 ThreadLockAlways(pwnd->spwndParent, &tlpwndParent); 01651 xxxSendMessage(pwnd->spwndParent, WM_CONTEXTMENU, (WPARAM) HWq(pwnd), lParam); 01652 ThreadUnlock(&tlpwndParent); 01653 } else { 01654 /* 01655 * Do default context menu if right clicked on caption 01656 */ 01657 if (pwnd == PtiCurrent()->pq->spwndActive) 01658 { 01659 if (nHit == HTCAPTION) 01660 goto DoTheDefaultThang; 01661 else if (nHit == HTSYSMENU) 01662 { 01663 i = SC_CLOSE; 01664 goto DoTheSysMenuThang; 01665 } 01666 01667 /* 01668 * If this was generated by the keyboard (apps key), then simulate a shift-f10 01669 * for old apps so they get a crack at putting up their context menu. 01670 */ 01671 if (lParam == KEYBOARD_MENU && !TestWF(pwnd, WFWIN40COMPAT)) 01672 xxxSimulateShiftF10(); 01673 } 01674 } 01675 } 01676 break; 01677 01678 case WM_APPCOMMAND: 01679 /* 01680 * Bubble the message to the parent 01681 */ 01682 if (TestwndChild(pwnd)) { 01683 ThreadLockAlways(pwnd->spwndParent, &tlpwndParent); 01684 lt = xxxSendMessage(pwnd->spwndParent, WM_APPCOMMAND, wParam, lParam); 01685 ThreadUnlock(&tlpwndParent); 01686 return lt; 01687 } else if (pwnd != PWNDDESKTOP(pwnd) ) { 01688 /* 01689 * Notify listeners on the SHELLHOOK that a WM_APPCOMMAND message was not handled 01690 * We also post this message to the shell queue so they don't need to load themselves 01691 * into every process with a hook. 01692 * We don't bother about the desktop since csrss services it and it doesn't accept 01693 * shell hooks so there is no point. 01694 */ 01695 if (IsHooked(PtiCurrent(), WHF_SHELL)) 01696 xxxCallHook(HSHELL_APPCOMMAND, wParam, lParam, WH_SHELL); 01697 01698 /* 01699 * Still post messages to the shell window even if there isn't a hook installed 01700 */ 01701 PostShellHookMessages(HSHELL_APPCOMMAND, lParam); 01702 } 01703 break; 01704 01705 case WM_KEYF1: 01706 xxxSendHelpMessage(pwnd, HELPINFO_WINDOW, 01707 (int) (TestwndChild(pwnd) ? PTR_TO_ID(pwnd->spmenu) : 0), 01708 HWq(pwnd), GetContextHelpId(pwnd)); 01709 break; 01710 01711 case WM_SYSCOMMAND: 01712 xxxSysCommand(pwnd, (UINT)wParam, lParam); 01713 break; 01714 01715 case WM_KEYDOWN: 01716 if (wParam == VK_F10) { 01717 PtiCurrent()->pq->QF_flags |= QF_FF10STATUS; 01718 HandleF10: 01719 /* 01720 * Generate a WM_CONTEXTMENU for new apps for shift-f10. 01721 */ 01722 if (_GetKeyState(VK_SHIFT) < 0 && TestWF(pwnd, WFWIN40COMPAT)) { 01723 xxxSendMessage(pwnd, WM_CONTEXTMENU, (WPARAM)HWq(pwnd), KEYBOARD_MENU); 01724 } 01725 } 01726 break; 01727 01728 case WM_HELP: 01729 // If this window is a child window, Help message must be passed on 01730 // to it's parent; Else, this must be passed on to the owner window. 01731 pwndT = (TestwndChild(pwnd)? pwnd->spwndParent : pwnd->spwndOwner); 01732 if (pwndT && (pwndT != _GetDesktopWindow())) { 01733 ThreadLockAlways(pwndT, &tlpwndT); 01734 lt = xxxSendMessage(pwndT, WM_HELP, wParam, lParam); 01735 ThreadUnlock(&tlpwndT); 01736 return lt; 01737 } 01738 return 0L; 01739 01740 case WM_SYSKEYDOWN: 01741 { 01742 PTHREADINFO pti = PtiCurrent(); 01743 01744 /* 01745 * Is the ALT key down? 01746 */ 01747 if (HIWORD(lParam) & SYS_ALTERNATE) { 01748 /* 01749 * Toggle QF_FMENUSTATUS iff this is NOT a repeat KEYDOWN 01750 * message; Only if the prev key state was 0, then this is the 01751 * first KEYDOWN message and then we consider toggling menu 01752 * status; Fix for Bugs #4531 & #4566 --SANKAR-- 10-02-89. 01753 */ 01754 if ((HIWORD(lParam) & SYS_PREVKEYSTATE) == 0) { 01755 01756 /* 01757 * Don't have to lock pwndActive because it's 01758 * processing this key. 01759 */ 01760 if ((wParam == VK_MENU) && 01761 !(pti->pq->QF_flags & QF_FMENUSTATUS)) { 01762 pti->pq->QF_flags |= QF_FMENUSTATUS; 01763 xxxDrawMenuBarUnderlines(pwnd, TRUE); 01764 } else { 01765 pti->pq->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); 01766 } 01767 } 01768 01769 pti->pq->QF_flags &= ~QF_FF10STATUS; 01770 01771 xxxDWP_ProcessVirtKey((UINT)wParam); 01772 01773 } else { 01774 if (wParam == VK_F10) { 01775 pti->pq->QF_flags |= QF_FF10STATUS; 01776 goto HandleF10; 01777 } 01778 } 01779 } 01780 break; 01781 01782 case WM_SYSKEYUP: 01783 case WM_KEYUP: 01784 { 01785 PTHREADINFO pti = PtiCurrent(); 01786 01787 /* 01788 * press and release F10 or ALT. Send this only to top-level windows, 01789 * otherwise MDI gets confused. The fix in which DefMDIChildProc() 01790 * passed up the message was insufficient in the case a child window 01791 * of the MDI child had the focus. 01792 * Also make sure the sys-menu activation wasn't broken by a mouse 01793 * up or down when the Alt was down (QF_MENUSTATUSBREAK). 01794 */ 01795 if ((wParam == VK_MENU && !(pti->pq->QF_flags & QF_TABSWITCHING) && ((pti->pq->QF_flags & 01796 (QF_FMENUSTATUS | QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS)) || 01797 (wParam == VK_F10 && (pti->pq->QF_flags & QF_FF10STATUS ))) { 01798 pwndT = GetTopLevelWindow(pwnd); 01799 if (gspwndFullScreen != pwndT) { 01800 01801 ThreadLockWithPti(pti, pwndT, &tlpwndT); 01802 /* 01803 * Draw the underlines for F10. This was already down for ALT 01804 * when the key went down. 01805 */ 01806 if (wParam == VK_F10) { 01807 xxxDrawMenuBarUnderlines(pwnd, TRUE); 01808 } 01809 xxxSendMessage(pwndT, WM_SYSCOMMAND, SC_KEYMENU, 0); 01810 ThreadUnlock(&tlpwndT); 01811 } 01812 } 01813 01814 /* 01815 * Turn off bit for tab-switching. This is set in the _KeyEvent() 01816 * routine when it's been determined we're doing switching. This 01817 * is necessary for cases where the ALT-KEY is release before the 01818 * TAB-KEY. In which case, the FMENUSTATUS bit would be cleared 01819 * by the ALT-KEY-UP and would have forced us into a syscommand 01820 * loop. This guarentees that we don't enter that condition. 01821 */ 01822 if (wParam == VK_MENU) { 01823 pti->pq->QF_flags &= ~QF_TABSWITCHING; 01824 xxxDrawMenuBarUnderlines(pwnd, FALSE); 01825 } 01826 01827 pti->pq->QF_flags &= ~(QF_FMENUSTATUS | QF_FMENUSTATUSBREAK | QF_FF10STATUS); 01828 } 01829 break; 01830 01831 case WM_SYSCHAR: 01832 { 01833 PTHREADINFO pti = PtiCurrent(); 01834 01835 /* 01836 * If syskey is down and we have a char... 01837 */ 01838 pti->pq->QF_flags &= ~(QF_FMENUSTATUS | QF_FMENUSTATUSBREAK); 01839 01840 if (wParam == VK_RETURN && TestWF(pwnd, WFMINIMIZED)) { 01841 01842 /* 01843 * If the window is iconic and user hits RETURN, we want to 01844 * restore this window. 01845 */ 01846 _PostMessage(pwnd, WM_SYSCOMMAND, SC_RESTORE, 0L); 01847 break; 01848 } 01849 01850 if ((HIWORD(lParam) & SYS_ALTERNATE) && wParam) { 01851 if (wParam == VK_TAB || wParam == VK_ESCAPE) 01852 break; 01853 01854 /* 01855 * Send ALT-SPACE only to top-level windows. 01856 */ 01857 if ((wParam == MENUSYSMENU) && (TestwndChild(pwnd))) { 01858 ThreadLockAlwaysWithPti(pti, pwnd->spwndParent, &tlpwndParent); 01859 xxxSendMessage(pwnd->spwndParent, message, wParam, lParam); 01860 ThreadUnlock(&tlpwndParent); 01861 } else { 01862 xxxSendMessage(pwnd, WM_SYSCOMMAND, SC_KEYMENU, (DWORD)wParam); 01863 } 01864 } else { 01865 01866 /* 01867 * Ctrl-Esc produces a WM_SYSCHAR, But should not beep; 01868 */ 01869 if (wParam != VK_ESCAPE) 01870 xxxMessageBeep(0); 01871 } 01872 } 01873 break; 01874 01875 case WM_CHARTOITEM: 01876 case WM_VKEYTOITEM: 01877 01878 /* 01879 * Do default processing for keystrokes into owner draw listboxes. 01880 */ 01881 return -1L; 01882 01883 case WM_ACTIVATE: 01884 if (wParam) 01885 xxxSetFocus(pwnd); 01886 break; 01887 01888 case WM_INPUTLANGCHANGEREQUEST: 01889 { 01890 PWND pwndFocus = PtiCurrent()->pq->spwndFocus; 01891 01892 /* 01893 * #115190 01894 * Dialog does not forward I.L.Reqest to the focused window. 01895 * (Memphis compatible issue) 01896 */ 01897 if (pwndFocus && (pwndFocus != pwnd) && 01898 pwnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_DIALOG]) { 01899 /* 01900 * pass message to focus'ed window. Old app, pass on to 01901 * focus'ed window which may be ML aware. (edit class 01902 * for example). 01903 */ 01904 ThreadLockAlways(pwndFocus, &tlpwndT); 01905 xxxSendMessage(pwndFocus, message, wParam, lParam); 01906 ThreadUnlock(&tlpwndT); 01907 } else if (!xxxActivateKeyboardLayout(_GetProcessWindowStation(NULL), 01908 (HKL)lParam, KLF_SETFORPROCESS, pwnd)) { 01909 RIPERR1(ERROR_INVALID_KEYBOARD_HANDLE, RIP_WARNING, "WM_INPUTLANGCHANGEREQUEST: Invalid keyboard handle (0x%08lx)", lParam); 01910 } 01911 break; 01912 } 01913 01914 case WM_INPUTLANGCHANGE: 01915 { 01916 PBWL pbwl; 01917 HWND *phwnd; 01918 TL tlpwnd; 01919 01920 pbwl = BuildHwndList(pwnd->spwndChild, BWL_ENUMLIST, NULL); 01921 if (pbwl == NULL) 01922 return 0; 01923 01924 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 01925 /* 01926 * Make sure this hwnd is still around. 01927 */ 01928 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 01929 continue; 01930 01931 ThreadLockAlways(pwnd, &tlpwnd); 01932 RIPMSG1(RIP_VERBOSE, "WM_INPUTLANGCHANGE: Sending message to pwnd %#p", pwnd); 01933 xxxSendMessage(pwnd, message, wParam, lParam); 01934 ThreadUnlock(&tlpwnd); 01935 } 01936 FreeHwndList(pbwl); 01937 01938 break; 01939 } 01940 01941 case WM_SETREDRAW: 01942 xxxDWP_SetRedraw(pwnd, wParam != 0); 01943 break; 01944 01945 case WM_WINDOWPOSCHANGING: 01946 { 01947 /* 01948 * If the window's size is changing, adjust the passed-in size 01949 */ 01950 WINDOWPOS *ppos = ((WINDOWPOS *)lParam); 01951 if (!(ppos->flags & SWP_NOSIZE)) { 01952 xxxAdjustSize(pwnd, &ppos->cx, &ppos->cy); 01953 } 01954 } 01955 break; 01956 01957 case WM_WINDOWPOSCHANGED: 01958 xxxHandleWindowPosChanged(pwnd, (PWINDOWPOS)lParam); 01959 break; 01960 01961 case WM_CTLCOLORSCROLLBAR: 01962 if (gpsi->BitCount < 8 || 01963 SYSRGB(3DHILIGHT) != SYSRGB(SCROLLBAR) || 01964 SYSRGB(3DHILIGHT) == SYSRGB(WINDOW)) 01965 { 01966 /* 01967 * Remove call to UnrealizeObject. GDI handles this 01968 * for brushes on NT. 01969 * 01970 * GreUnrealizeObject(ghbrGray); 01971 */ 01972 01973 GreSetBkColor((HDC)wParam, SYSRGB(3DHILIGHT)); 01974 GreSetTextColor((HDC)wParam, SYSRGB(3DFACE)); 01975 return((LRESULT)gpsi->hbrGray); 01976 } 01977 01978 icolBack = COLOR_3DHILIGHT; 01979 icolFore = COLOR_BTNTEXT; 01980 goto SetColor; 01981 01982 case WM_CTLCOLORBTN: 01983 if (TestWF(pwnd, WFWIN40COMPAT)) { 01984 icolBack = COLOR_3DFACE; 01985 icolFore = COLOR_BTNTEXT; 01986 } else { 01987 goto ColorDefault; 01988 } 01989 goto SetColor; 01990 01991 case WM_CTLCOLORSTATIC: 01992 case WM_CTLCOLORDLG: 01993 case WM_CTLCOLORMSGBOX: 01994 // We want static controls in dialogs to have the 3D 01995 // background color, but statics in windows to inherit 01996 // their parents' background. 01997 if (TestWF(pwnd, WFWIN40COMPAT) 01998 ) { 01999 icolBack = COLOR_3DFACE; 02000 icolFore = COLOR_WINDOWTEXT; 02001 goto SetColor; 02002 } 02003 // ELSE FALL THRU... 02004 02005 case WM_CTLCOLOR: // here for WOW only 02006 case WM_CTLCOLORLISTBOX: 02007 case WM_CTLCOLOREDIT: 02008 ColorDefault: 02009 icolBack = COLOR_WINDOW; 02010 icolFore = COLOR_WINDOWTEXT; 02011 02012 SetColor: 02013 GreSetBkColor((HDC)wParam, gpsi->argbSystem[icolBack]); 02014 GreSetTextColor((HDC)wParam, gpsi->argbSystem[icolFore]); 02015 return (LRESULT)(SYSHBRUSH(icolBack)); 02016 02017 case WM_SETCURSOR: 02018 02019 /* 02020 * wParam == pwndHit == pwnd that cursor is over 02021 * lParamL == ht == Hit test area code (result of WM_NCHITTEST) 02022 * lParamH == msg == Mouse message number 02023 */ 02024 return (LONG)xxxDWP_SetCursor(pwnd, (HWND)wParam, (int)(SHORT)lParam, 02025 HIWORD(lParam)); 02026 02027 case WM_MOUSEACTIVATE: 02028 pwndT = GetChildParent(pwnd); 02029 if (pwndT != NULL) { 02030 ThreadLockAlways(pwndT, &tlpwndT); 02031 lt = xxxSendMessage(pwndT, WM_MOUSEACTIVATE, wParam, lParam); 02032 ThreadUnlock(&tlpwndT); 02033 if (lt != 0) 02034 return lt; 02035 } 02036 02037 /* 02038 * Moving, sizing or minimizing? Activate AFTER we take action. 02039 * If the user LEFT clicked in the title bar, don't activate now: 02040 */ 02041 return ( (LOWORD(lParam) == HTCAPTION) 02042 && (HIWORD(lParam) == WM_LBUTTONDOWN) 02043 ) 02044 ? (LONG)MA_NOACTIVATE 02045 : (LONG)MA_ACTIVATE; 02046 02047 case WM_SHOWWINDOW: 02048 02049 /* 02050 * If we are being called because our owner window is being shown, 02051 * hidden, minimized, or un-minimized, then we must hide or show 02052 * show ourself as appropriate. 02053 * 02054 * This behavior occurs for popup windows or owned windows only. 02055 * It's not designed for use with child windows. 02056 */ 02057 if (LOWORD(lParam) != 0 && (TestwndPopup(pwnd) || pwnd->spwndOwner)) { 02058 02059 /* 02060 * The WFHIDDENPOPUP flag is an internal flag that indicates 02061 * that the window was hidden because its owner was hidden. 02062 * This way we only show windows that were hidden by this code, 02063 * not intentionally by the application. 02064 * 02065 * Go ahead and hide or show this window, but only if: 02066 * 02067 * a) we need to be hidden, or 02068 * b) we need to be shown, and we were hidden by 02069 * an earlier WM_SHOWWINDOW message 02070 */ 02071 if ((!wParam && TestWF(pwnd, WFVISIBLE)) || 02072 (wParam && !TestWF(pwnd, WFVISIBLE) && 02073 TestWF(pwnd, WFHIDDENPOPUP))) { 02074 02075 /* 02076 * Remember that we were hidden by WM_SHOWWINDOW processing 02077 */ 02078 ClrWF(pwnd, WFHIDDENPOPUP); 02079 if (!wParam) 02080 SetWF(pwnd, WFHIDDENPOPUP); 02081 02082 xxxShowWindow( 02083 pwnd, 02084 (wParam ? SW_SHOWNOACTIVATE : SW_HIDE) | TEST_PUDF(PUDF_ANIMATE)); 02085 } 02086 } 02087 break; 02088 02089 case WM_SYSMENU: 02090 if ( !TestWF(pwnd, WFDISABLED) 02091 && ( (GETPTI(pwnd)->pq == gpqForeground) 02092 || xxxSetForegroundWindow(pwnd, FALSE)) 02093 ) 02094 { 02095 PMENU pMenu; 02096 TL tpmenu; 02097 DoTheDefaultThang: 02098 if (TestWF(pwnd, WFMAXIMIZED) || TestWF(pwnd, WFMINIMIZED)) 02099 i = SC_RESTORE; 02100 else 02101 i = SC_MAXIMIZE; 02102 02103 DoTheSysMenuThang: 02104 if ((pMenu = xxxGetSysMenu(pwnd, TRUE)) != NULL) 02105 { 02106 _SetMenuDefaultItem(pMenu, i, MF_BYCOMMAND); 02107 02108 // Tell the shell we are bringing it up the system menu 02109 PostShellHookMessages(HSHELL_SYSMENU, (LPARAM)HWq(pwnd)); 02110 02111 ThreadLockAlways(pMenu, &tpmenu); 02112 if (lParam == 0xFFFFFFFF) 02113 { 02114 // this is a keyboard generated WM_SYSMENU 02115 if (FDoTray()) 02116 { 02117 TPMPARAMS tpm; 02118 02119 tpm.cbSize = sizeof(TPMPARAMS); 02120 02121 if (xxxSendMinRectMessages(pwnd, &tpm.rcExclude)) { 02122 xxxTrackPopupMenuEx(pMenu, TPM_SYSMENU | TPM_VERTICAL, 02123 tpm.rcExclude.left, tpm.rcExclude.top, pwnd, &tpm); 02124 } 02125 } 02126 } 02127 else 02128 { 02129 xxxTrackPopupMenuEx(pMenu, TPM_RIGHTBUTTON | TPM_SYSMENU, 02130 GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pwnd, NULL); 02131 } 02132 ThreadUnlock(&tpmenu); 02133 } 02134 } 02135 break; 02136 02137 case WM_DRAWITEM: 02138 DWP_DrawItem((LPDRAWITEMSTRUCT)lParam); 02139 break; 02140 02141 case WM_GETHOTKEY: 02142 return (LONG)DWP_GetHotKey(pwnd); 02143 break; 02144 02145 case WM_SETHOTKEY: 02146 return (LONG)DWP_SetHotKey(pwnd, (DWORD)wParam); 02147 break; 02148 02149 case WM_GETICON: 02150 return (LRESULT)DWP_GetIcon(pwnd, (BOOL)wParam); 02151 02152 case WM_SETICON: 02153 return (LRESULT)xxxDWP_SetIcon(pwnd, wParam, (HICON)lParam); 02154 02155 case WM_COPYGLOBALDATA: 02156 /* 02157 * This message is used to thunk WM_DROPFILES messages along 02158 * with other things. If we end up here with it, directly 02159 * call the client back to finish processing of this message. 02160 * This assumes that the ultimate destination of the 02161 * WM_DROPFILES message is in the client side's process context. 02162 */ 02163 return(SfnCOPYGLOBALDATA(NULL, 0, wParam, lParam, 0, 0, 0, NULL)); 02164 02165 case WM_QUERYDROPOBJECT: 02166 /* 02167 * if the app has registered interest in drops, return TRUE 02168 */ 02169 return (LRESULT)(TestWF(pwnd, WEFACCEPTFILES) ? TRUE : FALSE); 02170 02171 case WM_DROPOBJECT: 02172 return DO_DROPFILE; 02173 02174 case WM_ACCESS_WINDOW: 02175 if (ValidateHwnd((HWND)wParam)) { 02176 // SECURITY: set ACL for this window to no-access 02177 return TRUE; 02178 } 02179 return FALSE; 02180 02181 case WM_NOTIFYFORMAT: 02182 if(lParam == NF_QUERY) 02183 return(TestWF(pwnd, WFANSICREATOR) ? NFR_ANSI : NFR_UNICODE); 02184 break; 02185 02186 case WM_CHANGEUISTATE: 02187 { 02188 WORD wAction = LOWORD(wParam); 02189 WORD wFlags = HIWORD(wParam); 02190 BOOL bRealChange = FALSE; 02191 02192 if (wFlags & ~UISF_VALID || wAction > UIS_LASTVALID || 02193 lParam || !TEST_KbdCuesPUSIF) { 02194 return 0; 02195 } 02196 02197 if (wAction == UIS_INITIALIZE) { 02198 if (gpsi->bLastRITWasKeyboard) { 02199 wAction = UIS_CLEAR; 02200 } else { 02201 wAction = UIS_SET; 02202 } 02203 wFlags = UISF_HIDEFOCUS | UISF_HIDEACCEL; 02204 wParam = MAKEWPARAM(wAction, wFlags); 02205 } 02206 02207 UserAssert(wAction == UIS_SET || wAction == UIS_CLEAR); 02208 /* 02209 * If the state is not going to change, there's nothing to do here 02210 */ 02211 if (wFlags & UISF_HIDEFOCUS) { 02212 bRealChange = (!!TestWF(pwnd, WEFPUIFOCUSHIDDEN)) ^ (wAction == UIS_SET); 02213 } 02214 if (wFlags & UISF_HIDEACCEL) { 02215 bRealChange |= (!!TestWF(pwnd, WEFPUIACCELHIDDEN)) ^ (wAction == UIS_SET); 02216 } 02217 02218 if (!bRealChange) { 02219 break; 02220 } 02221 02222 /* 02223 * Children pass this message up 02224 * Top level windows update their children's state and 02225 * send down to their imediate children WM_UPDATEUISTATE. 02226 */ 02227 if (TestwndChild(pwnd)) { 02228 ThreadLockAlways(pwnd->spwndParent, &tlpwndParent); 02229 lt = xxxSendMessage(pwnd->spwndParent, WM_CHANGEUISTATE, wParam, lParam); 02230 ThreadUnlock(&tlpwndParent); 02231 return lt; 02232 } else { 02233 return xxxSendMessage(pwnd, WM_UPDATEUISTATE, wParam, lParam); 02234 } 02235 02236 } 02237 break; 02238 02239 case WM_QUERYUISTATE: 02240 return (TestWF(pwnd, WEFPUIFOCUSHIDDEN) ? UISF_HIDEFOCUS : 0) | 02241 (TestWF(pwnd, WEFPUIACCELHIDDEN) ? UISF_HIDEACCEL : 0); 02242 break; 02243 02244 case WM_UPDATEUISTATE: 02245 { 02246 WORD wAction = LOWORD(wParam); 02247 WORD wFlags = HIWORD(wParam); 02248 02249 if (wFlags & ~UISF_VALID || wAction > UIS_LASTVALID || 02250 lParam || !TEST_KbdCuesPUSIF) { 02251 return 0; 02252 } 02253 02254 switch (wAction) { 02255 case UIS_INITIALIZE: 02256 /* 02257 * UISTATE: UIS_INITIALIZE sets the UIState bits 02258 * based on the last input type 02259 */ 02260 if (!gpsi->bLastRITWasKeyboard) { 02261 SetWF(pwnd, WEFPUIFOCUSHIDDEN); 02262 SetWF(pwnd, WEFPUIACCELHIDDEN); 02263 wParam = MAKEWPARAM(UIS_SET, UISF_HIDEACCEL | UISF_HIDEFOCUS); 02264 } else { 02265 ClrWF(pwnd, WEFPUIFOCUSHIDDEN); 02266 ClrWF(pwnd, WEFPUIACCELHIDDEN); 02267 wParam = MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL | UISF_HIDEFOCUS); 02268 } 02269 break; 02270 02271 case UIS_SET: 02272 if (wFlags & UISF_HIDEACCEL) { 02273 SetWF(pwnd, WEFPUIACCELHIDDEN); 02274 } 02275 if (wFlags & UISF_HIDEFOCUS) { 02276 SetWF(pwnd, WEFPUIFOCUSHIDDEN); 02277 } 02278 break; 02279 02280 case UIS_CLEAR: 02281 if (wFlags & UISF_HIDEACCEL) { 02282 ClrWF(pwnd, WEFPUIACCELHIDDEN); 02283 } 02284 if (wFlags & UISF_HIDEFOCUS) { 02285 ClrWF(pwnd, WEFPUIFOCUSHIDDEN); 02286 } 02287 break; 02288 02289 default: 02290 break; 02291 } 02292 02293 /* 02294 * Send it down to its immediate children if any 02295 */ 02296 if (pwnd->spwndChild) { 02297 02298 PBWL pbwl; 02299 HWND *phwnd; 02300 TL tlpwnd; 02301 02302 pbwl = BuildHwndList(pwnd->spwndChild, BWL_ENUMLIST, NULL); 02303 if (pbwl == NULL) 02304 return 0; 02305 02306 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 02307 /* 02308 * Make sure this hwnd is still around. 02309 */ 02310 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 02311 continue; 02312 02313 ThreadLockAlways(pwnd, &tlpwnd); 02314 xxxSendMessage(pwnd, message, wParam, lParam); 02315 ThreadUnlock(&tlpwnd); 02316 } 02317 FreeHwndList(pbwl); 02318 } 02319 } 02320 break; 02321 02322 #ifdef PENWIN20 02323 // LATER mikeke 02324 default: 02325 // BOGUS 02326 // 32-bit ize DefPenWindowProc 02327 // 02328 // call DefPenWindowProc if penwin is loaded 02329 if ( (message >= WM_HANDHELDFIRST) 02330 && (message <= WM_HANDHELDLAST) 02331 ) { 02332 if (lpfnHandHeld != NULL) 02333 return (*lpfnHandHeld)(HW16(pwnd), message, wParamLo, lParam); 02334 } else if ( (message >= WM_PENWINFIRST) 02335 && (message <= WM_PENWINLAST) 02336 ) { 02337 if (SYSMET(PENWINDOWS)) 02338 return DefPenWindowProc(pwnd, message, wParamLo, lParam); 02339 } 02340 02341 #endif // PENWIN20 02342 } 02343 02344 return 0; 02345 }

BOOL xxxDeleteMenu PMENU  pMenu,
UINT  nPos,
UINT  dwFlags
 

Definition at line 782 of file mnchange.c.

References BOOL, TRUE, and xxxRemoveDeleteMenuHelper().

Referenced by NtUserDeleteMenu(), and xxxCreateWindowEx().

00786 { 00787 return xxxRemoveDeleteMenuHelper(pMenu, nPosition, wFlags, TRUE); 00788 }

void xxxDesktopRecalc PMONITORRECTS  pmrOld  ) 
 

Definition at line 605 of file rare.c.

References _DeferWindowPos(), _GetDesktopWindow(), _GetProp(), tagMONITORRECTS::amp, BuildHwndList(), BWL_ENUMLIST, FALSE, FindOldMonitor(), tagCHECKPOINT::fMinInitialized, FreeHwndList(), tagWND::hrgnClip, tagMONITOR::hrgnMonitor, InternalBeginDeferWindowPos(), NormalizeRect(), NORMALIZERECT_FULLSCREEN, NORMALIZERECT_MAXIMIZED, NORMALIZERECT_NORMAL, NULL, PHWND, PROP_CHECKPOINT, PROPF_INTERNAL, tagCHECKPOINT::rcNormal, tagWND::rcWindow, tagMONITORPOS::rcWork, RevalidateHwnd, tagBWL::rghwnd, tagWND::spwndChild, TestWF, TRUE, UINT, WEFTOOLWINDOW, WFFULLSCREEN, WFMAXFAKEREGIONAL, WFMAXIMIZED, and xxxEndDeferWindowPosEx().

Referenced by xxxResetDisplayDevice(), and xxxSystemParametersInfo().

00606 { 00607 PWND pwndDesktop; 00608 PSMWP psmwp; 00609 PHWND phwnd; 00610 PBWL pbwl; 00611 PWND pwnd; 00612 CHECKPOINT * pcp; 00613 int iOldMonitor; 00614 int codeFullScreen; 00615 00616 UserVerify(pwndDesktop = _GetDesktopWindow()); 00617 if ((pbwl = BuildHwndList(pwndDesktop->spwndChild, BWL_ENUMLIST, NULL)) == NULL) 00618 return; 00619 00620 if ((psmwp = InternalBeginDeferWindowPos(4)) != NULL) { 00621 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1 && psmwp; phwnd++) { 00622 /* 00623 * Make sure this hwnd is still around. 00624 */ 00625 if ( (pwnd = RevalidateHwnd(*phwnd)) == NULL || 00626 TestWF(pwnd, WEFTOOLWINDOW)) { 00627 00628 continue; 00629 } 00630 00631 codeFullScreen = TestWF(pwnd, WFFULLSCREEN) ? 00632 NORMALIZERECT_FULLSCREEN : NORMALIZERECT_NORMAL; 00633 00634 pcp = (CHECKPOINT *)_GetProp(pwnd, PROP_CHECKPOINT, PROPF_INTERNAL); 00635 if (pcp) { 00636 00637 /* 00638 * We don't need to blow away saved maximized positions 00639 * anymore, since the max position is always (for top level 00640 * windows) relative to the origin of the monitor's working 00641 * area. And for child windows, we shouldn't do it period 00642 * anyway. 00643 */ 00644 pcp->fMinInitialized = FALSE; 00645 00646 /* 00647 * Figure out which monitor the position was on before things 00648 * got shuffled around and try to keep it on that monitor. If 00649 * it was never visible on a monitor then leave it alone. 00650 */ 00651 iOldMonitor = FindOldMonitor(&pcp->rcNormal, pmrOld); 00652 if (iOldMonitor != (UINT)-1) { 00653 NormalizeRect( 00654 &pcp->rcNormal, 00655 &pcp->rcNormal, 00656 pmrOld, 00657 iOldMonitor, 00658 codeFullScreen, 00659 pwnd->style); 00660 } 00661 } 00662 00663 /* 00664 * Figure out which monitor the position was on before things got 00665 * shuffled around and try to keep it on that monitor. If it 00666 * was never visible on a monitor then leave it alone. 00667 */ 00668 00669 iOldMonitor = FindOldMonitor(&pwnd->rcWindow, pmrOld); 00670 if (iOldMonitor != -1) { 00671 00672 PMONITOR pMonitorDst; 00673 RECT rc; 00674 00675 /* 00676 * Check for maximized apps that are truly maximized. 00677 * (As opposed to apps that manage their owm maximized rect.) 00678 */ 00679 if (TestWF(pwnd, WFMAXIMIZED)) { 00680 LPRECT lprcOldWork = &pmrOld->amp[iOldMonitor].rcWork; 00681 00682 if ( (pwnd->rcWindow.right - pwnd->rcWindow.left >= 00683 lprcOldWork->right - lprcOldWork->left) 00684 && 00685 (pwnd->rcWindow.bottom - pwnd->rcWindow.top >= 00686 lprcOldWork->bottom - lprcOldWork->top)) { 00687 00688 codeFullScreen = NORMALIZERECT_MAXIMIZED; 00689 } 00690 } 00691 00692 pMonitorDst = NormalizeRect( 00693 &rc, 00694 &pwnd->rcWindow, 00695 pmrOld, 00696 iOldMonitor, 00697 codeFullScreen, 00698 pwnd->style); 00699 00700 if (TestWF(pwnd, WFMAXFAKEREGIONAL)) { 00701 UserAssert(pMonitorDst->hrgnMonitor); 00702 pwnd->hrgnClip = pMonitorDst->hrgnMonitor; 00703 } 00704 00705 psmwp = _DeferWindowPos( 00706 psmwp, 00707 pwnd, 00708 (PWND)HWND_TOP, 00709 rc.left, 00710 rc.top, 00711 rc.right - rc.left, 00712 rc.bottom - rc.top, 00713 SWP_NOACTIVATE | SWP_NOZORDER); 00714 } 00715 } 00716 00717 if (psmwp) { 00718 xxxEndDeferWindowPosEx(psmwp, TRUE); 00719 } 00720 } 00721 00722 FreeHwndList(pbwl); 00723 }

VOID xxxDesktopThread PTERMINAL  pTerm  ) 
 

Definition at line 114 of file desktop.c.

References _DestroyMenu(), aDeviceTemplate, CheckCritIn, ClearWakeBit(), tagQ::cLockCount, CMSHUNGAPPTIMEOUT, CreateKernelEvent(), tagTHREADINFO::cWindows, DEVICE_TYPE_MOUSE, DF_DESKWNDDESTROYED, DF_DYING, DF_MOUSEMOVETRK, DF_TOOLTIPSHOWING, diStatic, tagDESKTOP::dwDTFlags, DWORD, tagTERMINAL::dwTERMF_Flags, tagWINDOWSTATION::dwWSF_Flags, EnterCrit, EVENT_INCREMENT, ExEventObjectType, FALSE, FHungApp(), FindNCHit(), FreeKernelEvent(), gbRemoteSession, GETPTI, glinp, gpDispInfo, gpEventHungThread, gpevtDesktopDestroyed, grpdeskLogon, grpdeskRitInput, grpWinStaList, gspdeskDisconnect, gspwndFullScreen, gspwndMouseOwner, gspwndShouldBeForeground, tagTHREADINFO::hdesk, tagDISPLAYINFO::hDev, HWq, InitSystemThread(), ISTS, IsWinEventNotifyDeferredOK, KernelMode, KeSetEvent(), KeWaitForSingleObject(), L, LeaveCrit, LockDesktop, msg, MSGWAITCALLBACK, NT_SUCCESS, NULL, ObDereferenceObject, OBJECTS_COUNT, ObReferenceObjectByPointer(), tagDESKTOP::pDeskInfo, tagTHREADINFO::pDeskInfo, tagDESKTOP::pDispInfo, tagTERMINAL::pEventDestroyDesktop, tagTERMINAL::pEventInputReady, tagTERMINAL::pEventTermInit, tagDEVICE_TEMPLATE::pkeHidChange, tagDISPLAYINFO::pmdev, PMENUWND, tagDISPLAYINFO::pMonitorFirst, PostShellHookMessages(), tagTHREADINFO::pq, tagTERMINAL::pqDesktop, ProcessDeviceChanges(), PsTerminateSystemThread(), PtiCurrentShared, tagTERMINAL::ptiDesktop, tagLASTINPUT::ptLastClick, tagTHREADINFO::pwinsta, RemoteDisableScreen(), tagTHREADINFO::rpdesk, tagTERMINAL::rpdeskDestroy, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, tagWINDOWSTATION::rpwinstaNext, tagDESKTOP::rpwinstaParent, RtlInitUnicodeString(), SetVisible(), tagDESKTOP::spmenuDialogSys, tagDESKTOP::spmenuHScroll, tagDESKTOP::spmenuSys, tagDESKTOP::spmenuVScroll, tagDESKTOPINFO::spwnd, tagDESKTOPINFO::spwndBkGnd, tagDESKTOP::spwndForeground, tagDESKTOP::spwndMenu, tagDESKTOP::spwndMessage, tagDESKTOPINFO::spwndProgman, tagDESKTOPINFO::spwndShell, tagDESKTOPINFO::spwndTaskman, tagDESKTOP::spwndTooltip, tagDESKTOP::spwndTrack, tagDESKTOP::spwndTray, SV_UNSET, TERMF_DTDESTROYED, TERMF_DTINITFAILED, TERMF_DTINITSUCCESS, TERMF_NOIO, TestWF, ThreadLockAlways, ThreadLockAlwaysWithPti, ThreadLockDesktop, ThreadLockWinSta, ThreadUnlock, ThreadUnlockDesktop, ThreadUnlockWinSta, TRACE_DESKTOP, TRUE, UINT, Unlock, UnlockDesktop, UnlockDesktopMenu(), UnlockDesktopSysMenu(), VOID(), WFVISIBLE, WrUserRequest, WSF_NOIO, WSF_SWITCHLOCK, xxxDestroyWindow(), xxxDispatchMessage(), xxxMinimizeHungWindow(), xxxMsgWaitForMultipleObjects(), xxxPeekMessage, xxxSetThreadDesktop(), xxxSetWindowPos(), xxxSwitchDesktop(), and zzzDestroyQueue().

Referenced by xxxInitTerminal().

00116 { 00117 KPRIORITY Priority; 00118 PTHREADINFO ptiCurrent; 00119 PQ pqOriginal; 00120 UNICODE_STRING strThreadName; 00121 PKEVENT *apRITEvents; 00122 PKEVENT pEvent; 00123 MSGWAITCALLBACK pfnHidChangeRoutine = NULL; 00124 DWORD nEvents = 0; 00125 UINT idMouseInput; 00126 UINT idDesktopDestroy; 00127 UINT idPumpMessages; 00128 UINT idHungThread; 00129 PKWAIT_BLOCK WaitBlockArray; 00130 00131 UserAssert(pTerm != NULL); 00132 00133 /* 00134 * Set the desktop thread's priority to low realtime. 00135 */ 00136 Priority = LOW_REALTIME_PRIORITY; 00137 ZwSetInformationThread(NtCurrentThread(), 00138 ThreadPriority, 00139 &Priority, 00140 sizeof(KPRIORITY)); 00141 00142 /* 00143 * There are just two TERMINAL structures. One is for the 00144 * interactive windowstation and the other is for all the 00145 * non-interactive windowstations. 00146 */ 00147 if (pTerm->dwTERMF_Flags & TERMF_NOIO) { 00148 RtlInitUnicodeString(&strThreadName, L"NOIO_DT"); 00149 } else { 00150 RtlInitUnicodeString(&strThreadName, L"IO_DT"); 00151 } 00152 00153 if (!NT_SUCCESS(InitSystemThread(&strThreadName))) { 00154 pTerm->dwTERMF_Flags |= TERMF_DTINITFAILED; 00155 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00156 RIPMSG0(RIP_ERROR, "Fail to create the desktop thread"); 00157 return; 00158 } 00159 00160 ptiCurrent = PtiCurrentShared(); 00161 00162 pTerm->ptiDesktop = ptiCurrent; 00163 pTerm->pqDesktop = pqOriginal = ptiCurrent->pq; 00164 00165 (pqOriginal->cLockCount)++; 00166 ptiCurrent->pDeskInfo = &diStatic; 00167 00168 /* 00169 * Set the winsta to NULL. It will be set to the right 00170 * windowstation in xxxCreateDesktop before pEventInputReady 00171 * is set. 00172 */ 00173 ptiCurrent->pwinsta = NULL; 00174 00175 /* 00176 * Allocate non-paged array. Include an extra entry for 00177 * the thread's input event. 00178 */ 00179 apRITEvents = UserAllocPoolNonPaged((OBJECTS_COUNT * sizeof(PKEVENT)), 00180 TAG_SYSTEM); 00181 00182 if (apRITEvents == NULL) { 00183 pTerm->dwTERMF_Flags |= TERMF_DTINITFAILED; 00184 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00185 return; 00186 } 00187 00188 WaitBlockArray = UserAllocPoolNonPaged((OBJECTS_COUNT * sizeof(KWAIT_BLOCK)), 00189 TAG_SYSTEM); 00190 if (WaitBlockArray == NULL) { 00191 pTerm->dwTERMF_Flags |= TERMF_DTINITFAILED; 00192 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00193 UserFreePool(apRITEvents); 00194 return; 00195 } 00196 00197 idMouseInput = 0xFFFF; 00198 idDesktopDestroy = 0xFFFF; 00199 idHungThread = 0xFFFF; 00200 00201 /* 00202 * Reference the mouse input event. The system terminal doesn't 00203 * wait for any mouse input. 00204 */ 00205 if (!(pTerm->dwTERMF_Flags & TERMF_NOIO)) { 00206 pfnHidChangeRoutine = (MSGWAITCALLBACK)ProcessDeviceChanges; 00207 idMouseInput = nEvents++; 00208 UserAssert(aDeviceTemplate[DEVICE_TYPE_MOUSE].pkeHidChange); 00209 apRITEvents[idMouseInput] = aDeviceTemplate[DEVICE_TYPE_MOUSE].pkeHidChange; 00210 } 00211 00212 /* 00213 * Create the desktop destruction event. 00214 */ 00215 idDesktopDestroy = nEvents++; 00216 apRITEvents[idDesktopDestroy] = CreateKernelEvent(SynchronizationEvent, FALSE); 00217 if (apRITEvents[idDesktopDestroy] == NULL) { 00218 pTerm->dwTERMF_Flags |= TERMF_DTINITFAILED; 00219 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00220 UserFreePool(apRITEvents); 00221 UserFreePool(WaitBlockArray); 00222 return; 00223 } 00224 pTerm->pEventDestroyDesktop = apRITEvents[idDesktopDestroy]; 00225 00226 /* 00227 * Hung thread not needed for noninteractive windowstations. 00228 */ 00229 if (!(pTerm->dwTERMF_Flags & TERMF_NOIO)) { 00230 idHungThread = nEvents++; 00231 apRITEvents[idHungThread] = CreateKernelEvent(SynchronizationEvent, FALSE); 00232 if (apRITEvents[idHungThread] == NULL) { 00233 pTerm->dwTERMF_Flags |= TERMF_DTINITFAILED; 00234 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00235 FreeKernelEvent(&apRITEvents[idDesktopDestroy]); 00236 UserFreePool(apRITEvents); 00237 UserFreePool(WaitBlockArray); 00238 return; 00239 } 00240 00241 gpEventHungThread = apRITEvents[idHungThread]; 00242 } 00243 00244 EnterCrit(); 00245 UserAssert(IsWinEventNotifyDeferredOK()); 00246 00247 /* 00248 * Set the event that tells the initialization of desktop 00249 * thread is done. 00250 */ 00251 pTerm->dwTERMF_Flags |= TERMF_DTINITSUCCESS; 00252 KeSetEvent(pTerm->pEventTermInit, EVENT_INCREMENT, FALSE); 00253 00254 /* 00255 * Prepare to wait on input ready event. 00256 */ 00257 pEvent = pTerm->pEventInputReady; 00258 ObReferenceObjectByPointer(pEvent, 00259 EVENT_ALL_ACCESS, 00260 *ExEventObjectType, 00261 KernelMode); 00262 00263 LeaveCrit(); 00264 00265 KeWaitForSingleObject(pEvent, WrUserRequest, KernelMode, FALSE, NULL); 00266 ObDereferenceObject(pEvent); 00267 00268 EnterCrit(); 00269 00270 /* 00271 * Adjust the event ids 00272 */ 00273 idMouseInput += WAIT_OBJECT_0; 00274 idDesktopDestroy += WAIT_OBJECT_0; 00275 idHungThread += WAIT_OBJECT_0; 00276 idPumpMessages = WAIT_OBJECT_0 + nEvents; 00277 00278 /* 00279 * message loop lasts until we get a WM_QUIT message 00280 * upon which we shall return from the function 00281 */ 00282 while (TRUE) { 00283 DWORD result; 00284 00285 /* 00286 * Wait for any message sent or posted to this queue, while calling 00287 * ProcessDeviceChanges whenever the mouse change event (pkeHidChange) 00288 * is set. 00289 */ 00290 result = xxxMsgWaitForMultipleObjects(nEvents, 00291 apRITEvents, 00292 pfnHidChangeRoutine, 00293 WaitBlockArray); 00294 00295 #if DBG 00296 gDesktopsBusy++; // diagnostic 00297 if (gDesktopsBusy >= 2) { 00298 RIPMSG0(RIP_WARNING, "2 or more desktop threads busy"); 00299 } 00300 #endif 00301 00302 /* 00303 * result tells us the type of event we have: 00304 * a message or a signalled handle 00305 * 00306 * if there are one or more messages in the queue ... 00307 */ 00308 if (result == (DWORD)idPumpMessages) { 00309 00310 /* 00311 * block-local variable 00312 */ 00313 MSG msg ; 00314 00315 CheckCritIn(); 00316 00317 /* 00318 * read all of the messages in this next loop 00319 * removing each message as we read it 00320 */ 00321 while (xxxPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { 00322 00323 /* 00324 * if it's a quit message we're out of here 00325 */ 00326 if (msg.message == WM_QUIT && ptiCurrent->cWindows == 1) { 00327 00328 TRACE_DESKTOP(("WM_QUIT: Destroying the desktop thread. cWindows %d\n", 00329 ptiCurrent->cWindows)); 00330 00331 /* 00332 * The window station is gone, so 00333 * 00334 * DON'T USE PWINSTA ANYMORE 00335 */ 00336 00337 /* 00338 * We could have received a mouse message in between the 00339 * desktop destroy event and the WM_QUIT message in which 00340 * case we may need to clear spwndTrack again to make sure 00341 * that a window (gotta be the desktop) isn't locked in. 00342 */ 00343 Unlock(&ptiCurrent->rpdesk->spwndTrack); 00344 00345 /* 00346 * If we're running on the last interactive desktop, 00347 * then we never unlocked pdesk->pDeskInfo->spwnd. 00348 * However, it seems to me that the system stops 00349 * running before we make it here; otherwise, (or 00350 * for a Hydra-like thing) we need to unlock that 00351 * window here..... 00352 */ 00353 UserAssert(ptiCurrent->rpdesk != NULL && 00354 ptiCurrent->rpdesk->pDeskInfo != NULL && 00355 ptiCurrent->rpdesk->pDeskInfo->spwnd != NULL); 00356 00357 Unlock(&ptiCurrent->rpdesk->pDeskInfo->spwnd); 00358 00359 /* 00360 * Because there is no desktop, we need to fake a 00361 * desktop info structure so that the IsHooked() 00362 * macro can test a "valid" fsHooks value. 00363 */ 00364 ptiCurrent->pDeskInfo = &diStatic; 00365 00366 /* 00367 * The desktop window is all that's left, so 00368 * let's exit. The thread cleanup code will 00369 * handle destruction of the window. 00370 */ 00371 00372 /* 00373 * If the thread is not using the original queue, 00374 * destroy it. 00375 */ 00376 UserAssert(pqOriginal->cLockCount); 00377 (pqOriginal->cLockCount)--; 00378 if (ptiCurrent->pq != pqOriginal) { 00379 zzzDestroyQueue(pqOriginal, ptiCurrent); // DeferWinEventNotify() ?? IANJA ?? 00380 } 00381 00382 #if DBG 00383 gDesktopsBusy--; // diagnostic 00384 #endif 00385 00386 LeaveCrit(); 00387 00388 /* 00389 * Deref the events now that we're done with them. 00390 * Also free the wait array. 00391 */ 00392 if (!(pTerm->dwTERMF_Flags & TERMF_NOIO)) { 00393 FreeKernelEvent(&gpEventHungThread); 00394 } 00395 FreeKernelEvent(&apRITEvents[idDesktopDestroy]); 00396 UserFreePool(apRITEvents); 00397 UserFreePool(WaitBlockArray); 00398 00399 /* 00400 * Terminate the thread. This will call the 00401 * Win32k thread cleanup code. 00402 */ 00403 TRACE_DESKTOP(("call PsTerminateSystemThread\n")); 00404 00405 pTerm->ptiDesktop = NULL; 00406 pTerm->pqDesktop = NULL; 00407 00408 pTerm->dwTERMF_Flags &= TERMF_DTDESTROYED; 00409 00410 PsTerminateSystemThread(0); 00411 } 00412 00413 UserAssert(msg.message != WM_QUIT); 00414 00415 /* 00416 * otherwise dispatch it 00417 */ 00418 xxxDispatchMessage(&msg); 00419 00420 } // end of PeekMessage while loop 00421 00422 } else if (result == idDesktopDestroy) { 00423 00424 PDESKTOP *ppdesk; 00425 PDESKTOP pdesk; 00426 PWND pwnd; 00427 PMENU pmenu; 00428 TL tlpwinsta; 00429 PWINDOWSTATION pwinsta; 00430 TL tlpdesk; 00431 TL tlpwnd; 00432 PDESKTOP pdeskTemp; 00433 HDESK hdeskTemp; 00434 TL tlpdeskTemp; 00435 00436 /* 00437 * Destroy desktops on the destruction list. 00438 */ 00439 for (ppdesk = &pTerm->rpdeskDestroy; *ppdesk != NULL; ) { 00440 /* 00441 * Unlink from the list. 00442 */ 00443 pdesk = *ppdesk; 00444 00445 TRACE_DESKTOP(("Destroying desktop '%ws' %#p ...\n", 00446 GetDesktopName(pdesk), pdesk)); 00447 00448 UserAssert(!(pdesk->dwDTFlags & DF_DYING)); 00449 00450 ThreadLockDesktop(ptiCurrent, pdesk, &tlpdesk, LDLT_FN_DESKTOPTHREAD_DESK); 00451 pwinsta = pdesk->rpwinstaParent; 00452 ThreadLockWinSta(ptiCurrent, pdesk->rpwinstaParent, &tlpwinsta); 00453 00454 LockDesktop(ppdesk, pdesk->rpdeskNext, LDL_TERM_DESKDESTROY1, (ULONG_PTR)pTerm); 00455 UnlockDesktop(&pdesk->rpdeskNext, LDU_DESK_DESKNEXT, 0); 00456 00457 /* 00458 * !!! If this is the current desktop, switch to another one. 00459 */ 00460 if (pdesk == grpdeskRitInput) { 00461 PDESKTOP pdeskNew; 00462 00463 TRACE_DESKTOP(("Destroying the current active desktop\n")); 00464 00465 if (pwinsta->dwWSF_Flags & WSF_SWITCHLOCK) { 00466 00467 TRACE_DESKTOP(("The windowstation is locked\n")); 00468 00469 /* 00470 * this should be the interactive windowstation 00471 */ 00472 UserAssert(!(pwinsta->dwWSF_Flags & WSF_NOIO)); 00473 00474 /* 00475 * Switch to the disconnected desktop if the logon desktop 00476 * is being destroyed, or there is no logon desktop, or 00477 * if the logon desktop has already been destroyed. 00478 */ 00479 if (gbRemoteSession && gspdeskDisconnect && 00480 (pdesk == grpdeskLogon || 00481 grpdeskLogon == NULL || 00482 (grpdeskLogon->dwDTFlags & DF_DESKWNDDESTROYED))) { 00483 TRACE_DESKTOP(("disable the screen and switch to the disconnect desktop\n")); 00484 RemoteDisableScreen(); 00485 goto skip; 00486 00487 } else { 00488 TRACE_DESKTOP(("Switch to the logon desktop '%ws' %#p ...\n", 00489 GetDesktopName(grpdeskLogon), grpdeskLogon)); 00490 00491 pdeskNew = grpdeskLogon; 00492 } 00493 } else { 00494 pdeskNew = pwinsta->rpdeskList; 00495 if (pdeskNew == pdesk) 00496 pdeskNew = pdesk->rpdeskNext; 00497 00498 /* 00499 * You can hit this assert if you exit winlogon before 00500 * logging in. I.E. all desktop's close so there is 00501 * no "next" one to switch to. I'm assuming that there 00502 * is a check for a NULL desktop in xxxSwitchDesktop(). 00503 * 00504 * You can't switch to a NULL desktop. But this means 00505 * there isn't any input desktop so clear it manually. 00506 */ 00507 if (gbRemoteSession) { 00508 if (pdeskNew == NULL) { 00509 00510 TRACE_DESKTOP(("NO INPUT FOR DT FROM THIS POINT ON ...\n")); 00511 00512 ClearWakeBit(ptiCurrent, QS_INPUT | QS_EVENT | QS_MOUSEMOVE, FALSE); 00513 } 00514 } else { 00515 UserAssert(pdeskNew); 00516 } 00517 } 00518 00519 TRACE_DESKTOP(("Switch to desktop '%ws' %#p\n", 00520 GetDesktopName(pdeskNew), pdeskNew)); 00521 00522 xxxSwitchDesktop(pwinsta, pdeskNew, FALSE); 00523 } 00524 skip: 00525 00526 /* 00527 * Close the display if this desktop did not use 00528 * the global display. 00529 */ 00530 if ((pdesk->pDispInfo->hDev != NULL) && 00531 (pdesk->pDispInfo->hDev != gpDispInfo->hDev)) { 00532 00533 TRACE_DESKTOP(("Destroy MDEV\n")); 00534 00535 DrvDestroyMDEV(pdesk->pDispInfo->pmdev); 00536 GreFreePool(pdesk->pDispInfo->pmdev); 00537 pdesk->pDispInfo->pmdev = NULL; 00538 } 00539 00540 if (pdesk->pDispInfo != gpDispInfo) { 00541 UserAssert(pdesk->pDispInfo->pMonitorFirst == NULL); 00542 UserFreePool(pdesk->pDispInfo); 00543 pdesk->pDispInfo = NULL; 00544 } 00545 00546 /* 00547 * Destroy desktop and menu windows. 00548 */ 00549 pdeskTemp = ptiCurrent->rpdesk; // save current desktop 00550 hdeskTemp = ptiCurrent->hdesk; 00551 ThreadLockDesktop(ptiCurrent, pdeskTemp, &tlpdeskTemp, LDLT_FN_DESKTOPTHREAD_DESKTEMP); 00552 xxxSetThreadDesktop(NULL, pdesk); 00553 Unlock(&pdesk->spwndForeground); 00554 Unlock(&pdesk->spwndTray); 00555 00556 Unlock(&pdesk->spwndTrack); 00557 pdesk->dwDTFlags &= ~DF_MOUSEMOVETRK; 00558 00559 if (pdesk->spmenuSys != NULL) { 00560 pmenu = pdesk->spmenuSys; 00561 if (UnlockDesktopSysMenu(&pdesk->spmenuSys)) 00562 _DestroyMenu(pmenu); 00563 } 00564 00565 if (pdesk->spmenuDialogSys != NULL) { 00566 pmenu = pdesk->spmenuDialogSys; 00567 if (UnlockDesktopSysMenu(&pdesk->spmenuDialogSys)) 00568 _DestroyMenu(pmenu); 00569 } 00570 00571 if (pdesk->spmenuHScroll != NULL) { 00572 pmenu = pdesk->spmenuHScroll; 00573 if (UnlockDesktopMenu(&pdesk->spmenuHScroll)) 00574 _DestroyMenu(pmenu); 00575 } 00576 00577 if (pdesk->spmenuVScroll != NULL) { 00578 pmenu = pdesk->spmenuVScroll; 00579 if (UnlockDesktopMenu(&pdesk->spmenuVScroll)) 00580 _DestroyMenu(pmenu); 00581 } 00582 00583 /* 00584 * If this desktop doesn't have a pDeskInfo, then 00585 * something is wrong. All desktops should have 00586 * this until the object is freed. 00587 */ 00588 if (pdesk->pDeskInfo == NULL) { 00589 RIPMSG0(RIP_ERROR, 00590 "xxxDesktopThread: There is no pDeskInfo for this desktop"); 00591 } 00592 00593 if (pdesk->pDeskInfo) { 00594 if (pdesk->pDeskInfo->spwnd == gspwndFullScreen) 00595 Unlock(&gspwndFullScreen); 00596 00597 if (pdesk->pDeskInfo->spwndShell) 00598 Unlock(&pdesk->pDeskInfo->spwndShell); 00599 00600 if (pdesk->pDeskInfo->spwndBkGnd) 00601 Unlock(&pdesk->pDeskInfo->spwndBkGnd); 00602 00603 if (pdesk->pDeskInfo->spwndTaskman) 00604 Unlock(&pdesk->pDeskInfo->spwndTaskman); 00605 00606 if (pdesk->pDeskInfo->spwndProgman) 00607 Unlock(&pdesk->pDeskInfo->spwndProgman); 00608 } 00609 00610 UserAssert(!(pdesk->dwDTFlags & DF_DYING)); 00611 00612 if (pdesk->spwndMenu != NULL) { 00613 00614 pwnd = pdesk->spwndMenu; 00615 00616 /* 00617 * Hide this window without activating anyone else. 00618 */ 00619 if (TestWF(pwnd, WFVISIBLE)) { 00620 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 00621 xxxSetWindowPos(pwnd, 00622 NULL, 00623 0, 00624 0, 00625 0, 00626 0, 00627 SWP_HIDEWINDOW | SWP_NOACTIVATE | 00628 SWP_NOMOVE | SWP_NOSIZE | 00629 SWP_NOZORDER | SWP_NOREDRAW | 00630 SWP_NOSENDCHANGING); 00631 00632 ThreadUnlock(&tlpwnd); 00633 } 00634 00635 /* 00636 * Reset the flag in the popupmenu structure that tells this 00637 * popup menu belongs to the pdesk->spwndMenu so it can go away. 00638 */ 00639 ((PMENUWND)pwnd)->ppopupmenu->fDesktopMenu = FALSE; 00640 ((PMENUWND)pwnd)->ppopupmenu->fDelayedFree = FALSE; 00641 #if DBG 00642 /* We used to zero out this popup when closing the menu. 00643 * now we zero it out when about to re-use it. 00644 * So make ValidatepPopupMenu happy by clearing the 00645 * leftover ppopupmenuRoot, if any. 00646 */ 00647 ((PMENUWND)pwnd)->ppopupmenu->ppopupmenuRoot = NULL; 00648 #endif 00649 00650 if (Unlock(&pdesk->spwndMenu)) { 00651 xxxDestroyWindow(pwnd); 00652 } 00653 } 00654 00655 if (pdesk->spwndMessage != NULL) { 00656 00657 pwnd = pdesk->spwndMessage; 00658 00659 if (Unlock(&pdesk->spwndMessage)) { 00660 xxxDestroyWindow(pwnd); 00661 } 00662 } 00663 00664 if (pdesk->spwndTooltip != NULL) { 00665 00666 pwnd = pdesk->spwndTooltip; 00667 00668 if (Unlock(&pdesk->spwndTooltip)) { 00669 xxxDestroyWindow(pwnd); 00670 } 00671 UserAssert(!(pdesk->dwDTFlags & DF_TOOLTIPSHOWING)); 00672 } 00673 00674 UserAssert(!(pdesk->dwDTFlags & DF_DYING)); 00675 00676 /* 00677 * If the dying desktop is the owner of the desktop 00678 * owner window, reassign it to the first available 00679 * desktop. This is needed to ensure that 00680 * xxxSetWindowPos will work on desktop windows. 00681 */ 00682 if (pTerm->spwndDesktopOwner != NULL && 00683 pTerm->spwndDesktopOwner->head.rpdesk == pdesk) { 00684 00685 PDESKTOP pdeskR; 00686 00687 /* 00688 * Find out to what desktop the mother desktop window 00689 * should go. Careful with the NOIO case where there 00690 * might be several windowstations using the same 00691 * mother desktop window 00692 */ 00693 if (pTerm->dwTERMF_Flags & TERMF_NOIO) { 00694 00695 PWINDOWSTATION pwinstaW; 00696 00697 UserAssert(grpWinStaList != NULL); 00698 00699 pwinstaW = grpWinStaList->rpwinstaNext; 00700 00701 pdeskR = NULL; 00702 00703 while (pwinstaW != NULL) { 00704 if (pwinstaW->rpdeskList != NULL) { 00705 pdeskR = pwinstaW->rpdeskList; 00706 break; 00707 } 00708 pwinstaW = pwinstaW->rpwinstaNext; 00709 } 00710 } else { 00711 pdeskR = pwinsta->rpdeskList; 00712 } 00713 00714 if (pdeskR == NULL) { 00715 00716 PWND pwnd; 00717 00718 TRACE_DESKTOP(("DESTROYING THE MOTHER DESKTOP WINDOW %#p\n", 00719 pTerm->spwndDesktopOwner)); 00720 00721 pwnd = pTerm->spwndDesktopOwner; 00722 00723 /* 00724 * Hide it first 00725 */ 00726 SetVisible(pwnd, SV_UNSET); 00727 00728 Unlock(&(pTerm->spwndDesktopOwner)); 00729 00730 xxxDestroyWindow(pwnd); 00731 00732 } else { 00733 TRACE_DESKTOP(("MOVING THE MOTHER DESKTOP WINDOW %#p to pdesk %#p '%ws'\n", 00734 pTerm->spwndDesktopOwner, pdeskR, GetDesktopName(pdeskR))); 00735 00736 LockDesktop(&(pTerm->spwndDesktopOwner->head.rpdesk), 00737 pdeskR, LDL_MOTHERDESK_DESK1, (ULONG_PTR)(pTerm->spwndDesktopOwner)); 00738 } 00739 } 00740 00741 if (pdesk->pDeskInfo && (pdesk->pDeskInfo->spwnd != NULL)) { 00742 00743 UserAssert(!(pdesk->dwDTFlags & DF_DESKWNDDESTROYED)); 00744 00745 pwnd = pdesk->pDeskInfo->spwnd; 00746 00747 /* 00748 * Hide this window without activating anyone else. 00749 */ 00750 if (TestWF(pwnd, WFVISIBLE)) { 00751 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 00752 xxxSetWindowPos(pwnd, 00753 NULL, 00754 0, 00755 0, 00756 0, 00757 0, 00758 SWP_HIDEWINDOW | SWP_NOACTIVATE | 00759 SWP_NOMOVE | SWP_NOSIZE | 00760 SWP_NOZORDER | SWP_NOREDRAW | 00761 SWP_NOSENDCHANGING); 00762 00763 ThreadUnlock(&tlpwnd); 00764 } 00765 00766 /* 00767 * A lot of pwnd related code assumes that we 00768 * always have a valid desktop window. So we call 00769 * xxxDestroyWindow first to clean up and then 00770 * we unlock it to free it (now or eventually). 00771 * However, if we're destroying the last destkop, then 00772 * we don't unlock the window since we're are forced 00773 * to continue running on that desktop. 00774 */ 00775 00776 TRACE_DESKTOP(("Destroying the desktop window\n")); 00777 00778 xxxDestroyWindow(pdesk->pDeskInfo->spwnd); 00779 if (pdesk != grpdeskRitInput) { 00780 Unlock(&pdesk->pDeskInfo->spwnd); 00781 } else { 00782 00783 /* 00784 * unlock the gspwndShouldBeForeground window 00785 */ 00786 if (ISTS() && gspwndShouldBeForeground != NULL) { 00787 Unlock(&gspwndShouldBeForeground); 00788 } 00789 00790 /* 00791 * This is hit in HYDRA when the last desktop does away 00792 */ 00793 RIPMSG1(RIP_WARNING, "xxxDesktopThread: Running on zombie desk:%#p", pdesk); 00794 } 00795 pdesk->dwDTFlags |= DF_DESKWNDDESTROYED; 00796 } 00797 00798 /* 00799 * Restore the previous desktop 00800 */ 00801 xxxSetThreadDesktop(hdeskTemp, pdeskTemp); 00802 00803 00804 ThreadUnlockDesktop(ptiCurrent, &tlpdeskTemp, LDUT_FN_DESKTOPTHREAD_DESKTEMP); 00805 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00806 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_DESKTOPTHREAD_DESK); 00807 } 00808 00809 if (gbRemoteSession) { 00810 /* 00811 * Wakeup ntinput thread for exit processing 00812 */ 00813 TRACE_DESKTOP(("Wakeup ntinput thread for exit processing\n")); 00814 00815 UserAssert(gpevtDesktopDestroyed != NULL); 00816 00817 KeSetEvent(gpevtDesktopDestroyed, EVENT_INCREMENT, FALSE); 00818 } 00819 00820 } else if (result == idHungThread) { 00821 /* 00822 * By using gspwndMouseOwner this code relies on this event being 00823 * received before another click may occur. In the worst case we 00824 * may "lose" a click and only react to the latest one. 00825 */ 00826 PWND pwnd = gspwndMouseOwner; 00827 if (pwnd != NULL && FHungApp(GETPTI(pwnd), CMSHUNGAPPTIMEOUT)) { 00828 00829 int ht = FindNCHit(pwnd, POINTTOPOINTS(glinp.ptLastClick)); 00830 00831 if (ht == HTCLOSE) { 00832 /* 00833 * Note -- this is private, and does not go to the hook, 00834 * only the posted ones from the shell. 00835 */ 00836 00837 PostShellHookMessages(HSHELL_ENDTASK, (LPARAM)HWq(pwnd)); 00838 } else if (ht == HTMINBUTTON) { 00839 TL tlpwnd; 00840 00841 ThreadLockAlways(pwnd, &tlpwnd); 00842 xxxMinimizeHungWindow(pwnd); 00843 ThreadUnlock(&tlpwnd); 00844 } 00845 } 00846 00847 } else { 00848 RIPMSG0(RIP_WARNING, "Desktop woke up for what?"); 00849 } 00850 00851 #if DBG 00852 gDesktopsBusy--; // diagnostic 00853 #endif 00854 } 00855 }

LRESULT xxxDesktopWndProc PWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 883 of file desktop.c.

References _GetDC(), _ReleaseDC(), CheckLock, CMSHUNGAPPTIMEOUT, CreateProfileUserName(), DTF_NEEDSPALETTECHANGED, tagDESKTOP::dwDTFlags, FALSE, FHungApp(), FNID_DESKTOP, FreeProfileUserName(), GETPTI, GetTopLevelWindow(), gpDispInfo, grpdeskRitInput, gspwndAltTab, tagDISPLAYINFO::hdcScreen, HWq, IsWinEventNotifyDeferredOK, L, NULL, tagDESKTOP::pDeskInfo, PsGetCurrentThread, PtiCurrent, PWND_BROADCAST, RevalidateHwnd, tagDESKTOPINFO::spwnd, tagWND::spwndParent, ThreadLockAlways, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TRUE, VALIDATECLASSANDSIZE, xxxBeginPaint(), xxxDefWindowProc(), xxxEndPaint(), xxxInternalPaintDesktop(), xxxMakeWindowForegroundWithState(), xxxRealizeDesktop(), xxxRedrawWindow(), xxxSendMessage(), xxxSendNotifyMessage(), xxxSetDeskPattern(), xxxSetThreadDesktop(), and xxxSetWindowLong().

Referenced by InitFunctionTables(), InitializeClientPfnArrays(), and LW_RegisterWindows().

00888 { 00889 PTHREADINFO ptiCurrent = PtiCurrent(); 00890 HDC hdcT; 00891 PAINTSTRUCT ps; 00892 PWINDOWPOS pwp; 00893 00894 00895 CheckLock(pwnd); 00896 UserAssert(IsWinEventNotifyDeferredOK()); 00897 00898 VALIDATECLASSANDSIZE(pwnd, message, wParam, lParam, FNID_DESKTOP, WM_CREATE); 00899 00900 00901 if (pwnd->spwndParent == NULL) { 00902 switch (message) { 00903 00904 case WM_SETICON: 00905 /* 00906 * cannot allow this as it will cause a callback to user mode from the 00907 * desktop system thread. 00908 */ 00909 RIPMSG0(RIP_WARNING, "WM_ICON sent to desktop window was discarded.\n") ; 00910 return 0L ; 00911 00912 default: 00913 break; 00914 } /* switch */ 00915 00916 return xxxDefWindowProc(pwnd, message, wParam, lParam); 00917 } 00918 00919 switch (message) { 00920 00921 case WM_WINDOWPOSCHANGING: 00922 00923 /* 00924 * We receive this when switch desktop is called. Just 00925 * to be consistent, set the rit desktop as this 00926 * thread's desktop. 00927 */ 00928 pwp = (PWINDOWPOS)lParam; 00929 if (!(pwp->flags & SWP_NOZORDER) && pwp->hwndInsertAfter == HWND_TOP) { 00930 00931 xxxSetThreadDesktop(NULL, grpdeskRitInput); 00932 00933 /* 00934 * If some app has taken over the system-palette, we should make 00935 * sure the system is restored. Otherwise, if this is the logon 00936 * desktop, we might not be able to view the dialog correctly. 00937 */ 00938 if (GreGetSystemPaletteUse(gpDispInfo->hdcScreen) != SYSPAL_STATIC) 00939 GreRealizeDefaultPalette(gpDispInfo->hdcScreen, TRUE); 00940 00941 /* 00942 * Let everyone know if the palette has changed 00943 */ 00944 if (grpdeskRitInput->dwDTFlags & DTF_NEEDSPALETTECHANGED) { 00945 xxxSendNotifyMessage(PWND_BROADCAST, 00946 WM_PALETTECHANGED, 00947 (WPARAM)HWq(pwnd), 00948 0); 00949 grpdeskRitInput->dwDTFlags &= ~DTF_NEEDSPALETTECHANGED; 00950 } 00951 } 00952 break; 00953 00954 case WM_FULLSCREEN: { 00955 TL tlpwndT; 00956 00957 ThreadLockWithPti(ptiCurrent, grpdeskRitInput->pDeskInfo->spwnd, &tlpwndT); 00958 xxxMakeWindowForegroundWithState( 00959 grpdeskRitInput->pDeskInfo->spwnd, GDIFULLSCREEN); 00960 ThreadUnlock(&tlpwndT); 00961 00962 /* 00963 * We have to tell the switch window to repaint if we switched 00964 * modes 00965 */ 00966 if (gspwndAltTab != NULL) { 00967 ThreadLockAlwaysWithPti(ptiCurrent, gspwndAltTab, &tlpwndT); 00968 xxxSendMessage(gspwndAltTab, WM_FULLSCREEN, 0, 0); 00969 ThreadUnlock(&tlpwndT); 00970 } 00971 00972 break; 00973 } 00974 00975 case WM_CLOSE: 00976 00977 /* 00978 * Make sure nobody sends this window a WM_CLOSE and causes it to 00979 * destroy itself. 00980 */ 00981 break; 00982 00983 case WM_SETICON: 00984 /* 00985 * cannot allow this as it will cause a callback to user mode from the 00986 * desktop system thread. 00987 */ 00988 RIPMSG0(RIP_WARNING, "WM_ICON sent to desktop window was discarded.\n") ; 00989 break; 00990 00991 case WM_CREATE: { 00992 TL tlName; 00993 PUNICODE_STRING pProfileUserName = CreateProfileUserName(&tlName); 00994 /* 00995 * Is there a desktop pattern, or bitmap name in WIN.INI? 00996 */ 00997 xxxSetDeskPattern(pProfileUserName, (LPWSTR)-1, TRUE); 00998 00999 FreeProfileUserName(pProfileUserName, &tlName); 01000 /* 01001 * Initialize the system colors before we show the desktop window. 01002 */ 01003 xxxSendNotifyMessage(pwnd, WM_SYSCOLORCHANGE, 0, 0L); 01004 01005 hdcT = _GetDC(pwnd); 01006 xxxInternalPaintDesktop(pwnd, hdcT, FALSE); // use "normal" HDC so SelectPalette() will work 01007 _ReleaseDC(hdcT); 01008 01009 /* 01010 * Save process and thread ids. 01011 */ 01012 xxxSetWindowLong(pwnd, 01013 0, 01014 HandleToUlong(PsGetCurrentThread()->Cid.UniqueProcess), 01015 FALSE); 01016 01017 xxxSetWindowLong(pwnd, 01018 4, 01019 HandleToUlong(PsGetCurrentThread()->Cid.UniqueThread), 01020 FALSE); 01021 break; 01022 } 01023 case WM_PALETTECHANGED: 01024 if (HWq(pwnd) == (HWND)wParam) 01025 break; 01026 01027 // FALL THROUGH 01028 01029 case WM_QUERYNEWPALETTE: 01030 xxxRealizeDesktop(pwnd); 01031 break; 01032 01033 case WM_SYSCOLORCHANGE: 01034 01035 /* 01036 * We do the redrawing if someone has changed the sys-colors from 01037 * another desktop and we need to redraw. This is appearent with 01038 * the MATROX card which requires OGL applications to take over 01039 * the entire sys-colors for drawing. When switching desktops, we 01040 * never broadcast the WM_SYSCOLORCHANGE event to tell us to redraw 01041 * This is only a DAYTONA related fix, and should be removed once 01042 * we move the SYSMETS to a per-desktop state. 01043 * 01044 * 05-03-95 : ChrisWil. 01045 */ 01046 xxxRedrawWindow(pwnd, 01047 NULL, 01048 NULL, 01049 RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE); 01050 break; 01051 01052 case WM_ERASEBKGND: 01053 hdcT = (HDC)wParam; 01054 xxxInternalPaintDesktop(pwnd, hdcT, TRUE); 01055 return TRUE; 01056 01057 case WM_PAINT: 01058 xxxBeginPaint(pwnd, (LPPAINTSTRUCT)&ps); 01059 xxxEndPaint(pwnd, (LPPAINTSTRUCT)&ps); 01060 break; 01061 01062 #ifdef HUNGAPP_GHOSTING 01063 case WM_HUNGTHREAD: 01064 { 01065 PWND pwnd = RevalidateHwnd((HWND)lParam); 01066 01067 if (pwnd != NULL && FHungApp(GETPTI(pwnd), CMSHUNGAPPTIMEOUT)) { 01068 TL tlpwnd; 01069 01070 pwnd = GetTopLevelWindow(pwnd); 01071 01072 ThreadLockAlways(pwnd, &tlpwnd); 01073 xxxCreateGhost(pwnd); 01074 ThreadUnlock(&tlpwnd); 01075 } 01076 break; 01077 } 01078 #endif // HUNGAPP_GHOSTING 01079 01080 case WM_LBUTTONDBLCLK: 01081 message = WM_SYSCOMMAND; 01082 wParam = SC_TASKLIST; 01083 01084 /* 01085 *** FALL THRU ** 01086 */ 01087 01088 default: 01089 return xxxDefWindowProc(pwnd, message, wParam, lParam); 01090 } 01091 01092 return 0L; 01093 }

VOID xxxDestroyThreadInfo VOID   ) 
 

Definition at line 2552 of file queue.c.

References _GetProcessWindowStation(), _PostMessage(), _WOWCleanup(), tagTHREADINFO::cEnterCount, CleanupResources(), tagQ::cLockCount, tagPROCESSINFO::cThreads, tagQ::cThreads, tagTHREADINFO::cti, DesktopFree, DestroyProcessesClasses(), DestroyProcessesObjects(), DestroyTask(), DestroyThreadsHotKeys(), DestroyThreadsMessages(), DestroyThreadsObjects(), DestroyThreadsTimers(), DTM_SETUPAPPRAN, tagMENUSTATE::dwLockCount, FALSE, tagPOPUPMENU::fDestroyed, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, FLastGuiThread(), tagMENUSTATE::fModelessMenu, FreeHwndList(), FreeMessageList(), FreeThreadsWindowHooks(), FreeThreadsWinEvents(), FWINABLE, gbExitInProgress, gdwGuiThreads, GETDESKINFO, GETPTI, gHardErrorHandler, glinp, gpai, gpbwlList, gpdeskRecalcQueueAttach, gppiFullscreen, gptiBlockInput, gptiForeground, gptiShutdownNotify, gptiTasklist, gspwndInternalCapture, guiActivateShellWindow, tagTHREADINFO::hEventQueueClient, tagTDB::hTaskWow, tagTHREADINFO::iCursorLevel, tagQ::iCursorLevel, IsWinEventNotifyDeferredOK, KernelMode, KeSetKernelStackSwapEnable(), LockDesktop, MarkThreadsObjects(), tagTHREADINFO::mlPost, NULL, tagATTACHINFO::paiNext, PatchThreadWindows(), tagBWL::pbwlNext, tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, tagDESKTOP::pDeskInfo, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagMENUSTATE::pmnsPrev, tagTHREADINFO::pmsd, tagTHREADINFO::ppi, PpiCurrent, tagTHREADINFO::pq, tagTHREADINFO::pqAttach, ProtectHandle(), tagTHREADINFO::pSBTrack, tagTHREADINFO::psiiList, tagTHREADINFO::ptdb, tagHARDERRORHANDLER::pti, tagWINDOWSTATION::ptiClipLock, PtiCurrent, tagWINDOWSTATION::ptiDrawingClipboard, tagLASTINPUT::ptiLastWoken, tagTHREADINFO::PtiLink, tagPROCESSINFO::ptiList, tagPROCESSINFO::ptiMainThread, tagMENUSTATE::ptiMenuStateOwner, tagBWL::ptiOwner, tagTHREADINFO::ptiSibling, QF_CAPTURELOCKED, tagQ::QF_flags, tagTHREADINFO::rpdesk, SendMsgCleanup(), SetForegroundThread(), tagTHREADINFO::spDefaultImc, tagTHREADINFO::spklActive, tagDESKTOPINFO::spwnd, _MOVESIZEDATA::spwnd, tagDESKTOP::spwndMenu, tagPOPUPMENU::spwndNotify, tagDESKTOPINFO::spwndProgman, tagSBTRACK::spwndSB, tagSBTRACK::spwndSBNotify, tagDESKTOPINFO::spwndShell, tagSBTRACK::spwndTrack, ThreadLock, ThreadUnlock, TIF_16BIT, TIF_DONTATTACHQUEUE, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TIF_PALETTEAWARE, TIF_SYSTEMTHREAD, TRUE, Unlock, UnlockDesktop, VOID(), WEF_ASYNC, xxxCancelTrackingForThread(), xxxCloseClipboard(), xxxDestroyThreadDDEObject(), xxxEndMenuLoop(), xxxFlushPalette(), xxxMNCloseHierarchy(), xxxMNEndMenuState(), xxxUserChangeDisplaySettings(), xxxWindowEvent(), zzzDestroyQueue(), and zzzSetFMouseMoved().

Referenced by UserThreadCallout(), and xxxCreateThreadInfo().

02553 { 02554 PTHREADINFO ptiCurrent; 02555 PTHREADINFO *ppti; 02556 02557 ptiCurrent = PtiCurrent(); 02558 UserAssert (ptiCurrent != NULL); 02559 UserAssert(IsWinEventNotifyDeferredOK()); 02560 02561 /* 02562 * If this thread is blocking input, stop it 02563 */ 02564 if (gptiBlockInput == ptiCurrent) { 02565 gptiBlockInput = NULL; 02566 } 02567 02568 /* 02569 * Don't mess with this ptiCurrent anymore. 02570 */ 02571 ptiCurrent->TIF_flags |= (TIF_DONTATTACHQUEUE | TIF_INCLEANUP); 02572 02573 /* 02574 * First do any preparation work: windows need to be "patched" so that 02575 * their window procs point to server only windowprocs, for example. 02576 */ 02577 PatchThreadWindows(ptiCurrent); 02578 02579 /* 02580 * If this thread terminated abnormally and was tracking tell 02581 * GDI to hide the trackrect. 02582 */ 02583 if (ptiCurrent->pmsd != NULL) { 02584 xxxCancelTrackingForThread(ptiCurrent); 02585 } 02586 02587 /* 02588 * Unlock the pmsd window. 02589 */ 02590 if (ptiCurrent->pmsd != NULL) { 02591 Unlock(&ptiCurrent->pmsd->spwnd); 02592 UserFreePool(ptiCurrent->pmsd); 02593 ptiCurrent->pmsd = NULL; 02594 } 02595 02596 /* 02597 * Free the clipboard if owned by this thread 02598 */ 02599 { 02600 PWINDOWSTATION pwinsta; 02601 pwinsta = _GetProcessWindowStation(NULL); 02602 if (pwinsta != NULL) { 02603 if (pwinsta->ptiClipLock == ptiCurrent) { 02604 xxxCloseClipboard(pwinsta); 02605 } 02606 if (pwinsta->ptiDrawingClipboard == ptiCurrent) { 02607 pwinsta->ptiDrawingClipboard = NULL; 02608 } 02609 } 02610 } 02611 02612 /* 02613 * Unlock all the objects stored in the menustate structure 02614 */ 02615 while (ptiCurrent->pMenuState != NULL) { 02616 PMENUSTATE pMenuState; 02617 PPOPUPMENU ppopupmenuRoot; 02618 02619 pMenuState = ptiCurrent->pMenuState; 02620 ppopupmenuRoot = pMenuState->pGlobalPopupMenu; 02621 02622 /* 02623 * If menu mode was running on this thread 02624 */ 02625 if (ptiCurrent == pMenuState->ptiMenuStateOwner) { 02626 /* 02627 * The menu's going away, so anyone who's locked it 02628 * is SOL anyway. Bug #375467. 02629 */ 02630 pMenuState->dwLockCount = 0; 02631 02632 /* 02633 * Close this menu. 02634 */ 02635 if (pMenuState->fModelessMenu) { 02636 xxxEndMenuLoop(pMenuState, ppopupmenuRoot); 02637 xxxMNEndMenuState(TRUE); 02638 } else { 02639 pMenuState->fInsideMenuLoop = FALSE; 02640 ptiCurrent->pq->QF_flags &= ~QF_CAPTURELOCKED; 02641 xxxMNCloseHierarchy(ppopupmenuRoot, pMenuState); 02642 xxxMNEndMenuState(ppopupmenuRoot->fIsMenuBar || ppopupmenuRoot->fDestroyed); 02643 } 02644 } else { 02645 /* 02646 * Menu mode is running on another thread. This thread 02647 * must own spwndNotify which is going away soon. 02648 * When spwndNotify is destroyed, we will clean up pMenuState 02649 * from this pti. So do nothing now as we'll need this 02650 * pMenuState at that time. 02651 */ 02652 UserAssert((ppopupmenuRoot->spwndNotify != NULL) 02653 && (GETPTI(ppopupmenuRoot->spwndNotify) == ptiCurrent)); 02654 02655 /* 02656 * Nested menus are not supposed to involve multiple threads 02657 */ 02658 UserAssert(pMenuState->pmnsPrev == NULL); 02659 break; 02660 } 02661 02662 } /* while (ptiCurrent->pMenuState != NULL) */ 02663 02664 #if DBG 02665 /* 02666 * This thread must not be using the desktop menu 02667 */ 02668 if ((ptiCurrent->rpdesk != NULL) && (ptiCurrent->rpdesk->spwndMenu != NULL)) { 02669 UserAssert(ptiCurrent != GETPTI(ptiCurrent->rpdesk->spwndMenu)); 02670 } 02671 #endif 02672 02673 /* 02674 * Unlock all the objects stored in the sbstate structure. 02675 */ 02676 if (ptiCurrent->pSBTrack) { 02677 Unlock(&ptiCurrent->pSBTrack->spwndSB); 02678 Unlock(&ptiCurrent->pSBTrack->spwndSBNotify); 02679 Unlock(&ptiCurrent->pSBTrack->spwndTrack); 02680 UserFreePool(ptiCurrent->pSBTrack); 02681 ptiCurrent->pSBTrack = NULL; 02682 } 02683 02684 /* 02685 * If this is the main input thread of this application, zero out 02686 * that field. 02687 */ 02688 if (ptiCurrent->ppi != NULL && ptiCurrent->ppi->ptiMainThread == ptiCurrent) 02689 ptiCurrent->ppi->ptiMainThread = NULL; 02690 02691 while (ptiCurrent->psiiList != NULL) { 02692 xxxDestroyThreadDDEObject(ptiCurrent, ptiCurrent->psiiList); 02693 } 02694 02695 if (ptiCurrent->TIF_flags & TIF_PALETTEAWARE) { 02696 PWND pwnd; 02697 TL tlpwnd; 02698 02699 UserAssert(ptiCurrent->rpdesk != NULL); 02700 02701 pwnd = ptiCurrent->rpdesk->pDeskInfo->spwnd; 02702 02703 ThreadLock(pwnd, &tlpwnd); 02704 xxxFlushPalette(pwnd); 02705 ThreadUnlock(&tlpwnd); 02706 } 02707 02708 /* 02709 * If this is the last GUI thread for the process that made a temporary 02710 * (fullscreen) mode change, restore the mode to what's in the registry. 02711 */ 02712 if (FLastGuiThread(ptiCurrent) && (gppiFullscreen == ptiCurrent->ppi)) { 02713 xxxUserChangeDisplaySettings(NULL, NULL, NULL, NULL, 0, 0, KernelMode); 02714 02715 UserAssert(gppiFullscreen != ptiCurrent->ppi); 02716 } 02717 02718 /*******************************************************************************************\ 02719 * * 02720 * CLEANING THREAD OBJECTS. AVOID CALLING BACK AFTER THIS POINT * 02721 * New objects might be created while calling back and won't be cleaned up * 02722 * * 02723 \*******************************************************************************************/ 02724 02725 /* 02726 * This thread might have some outstanding timers. Destroy them 02727 */ 02728 DestroyThreadsTimers(ptiCurrent); 02729 02730 /* 02731 * Free any windows hooks this thread has created. 02732 */ 02733 FreeThreadsWindowHooks(); 02734 02735 /* 02736 * Free any hwnd lists the thread was using 02737 */ 02738 { 02739 PBWL pbwl, pbwlNext; 02740 for (pbwl = gpbwlList; pbwl != NULL; ) { 02741 pbwlNext = pbwl->pbwlNext; 02742 if (pbwl->ptiOwner == ptiCurrent) { 02743 FreeHwndList(pbwl); 02744 } 02745 pbwl = pbwlNext; 02746 } 02747 } 02748 02749 /* 02750 * Destroy all the public objects created by this thread. 02751 */ 02752 DestroyThreadsHotKeys(); 02753 02754 DestroyThreadsObjects(); 02755 02756 /* 02757 * Free any synchronous Notifies pending for this thread and 02758 * free any Win Event Hooks this thread created. 02759 */ 02760 FreeThreadsWinEvents(ptiCurrent); 02761 02762 /* 02763 * Unlock the keyboard layouts here 02764 */ 02765 Unlock(&ptiCurrent->spklActive); 02766 02767 /* 02768 * Cleanup the global resources if this is the last GUI 02769 * thread for this session 02770 */ 02771 if (gdwGuiThreads == 1) { 02772 CleanupResources(); 02773 } 02774 02775 02776 if (FLastGuiThread(ptiCurrent)) { 02777 02778 /* 02779 * Check if this was a setup app. 02780 */ 02781 if (ptiCurrent->ppi->W32PF_Flags & W32PF_SETUPAPP) { 02782 PDESKTOPINFO pdeskinfo = GETDESKINFO(ptiCurrent); 02783 if (pdeskinfo->spwndShell) { 02784 _PostMessage(pdeskinfo->spwndShell, DTM_SETUPAPPRAN, 0, 0); 02785 } 02786 } 02787 02788 DestroyProcessesClasses(ptiCurrent->ppi); 02789 ptiCurrent->ppi->W32PF_Flags &= ~(W32PF_CLASSESREGISTERED); 02790 02791 02792 DestroyProcessesObjects(ptiCurrent->ppi); 02793 } 02794 02795 #ifdef FE_IME 02796 /* 02797 * Unlock default input context. 02798 */ 02799 Unlock(&ptiCurrent->spDefaultImc); 02800 #endif 02801 02802 if (ptiCurrent->pq != NULL) { 02803 /* 02804 * Remove this thread's cursor count from the queue. 02805 */ 02806 ptiCurrent->pq->iCursorLevel -= ptiCurrent->iCursorLevel; 02807 02808 /* 02809 * Have to recalc queue ownership after this thread 02810 * leaves if it is a member of a shared input queue. 02811 */ 02812 if (ptiCurrent->pq->cThreads != 1) 02813 { 02814 gpdeskRecalcQueueAttach = ptiCurrent->rpdesk; 02815 /* 02816 * Because we are in thread cleanup, we won't callback due 02817 * to WinEvents (zzzSetFMouseMoved calls zzzUpdateCursorImage) 02818 */ 02819 UserAssert(ptiCurrent->TIF_flags & TIF_INCLEANUP); 02820 UserAssert(gbExitInProgress == FALSE); 02821 zzzSetFMouseMoved(); 02822 } 02823 } 02824 02825 /* 02826 * Remove from the process' list, also. 02827 */ 02828 ppti = &PpiCurrent()->ptiList; 02829 if (*ppti != NULL) { 02830 while (*ppti != ptiCurrent && (*ppti)->ptiSibling != NULL) { 02831 ppti = &((*ppti)->ptiSibling); 02832 } 02833 if (*ppti == ptiCurrent) { 02834 *ppti = ptiCurrent->ptiSibling; 02835 ptiCurrent->ptiSibling = NULL; 02836 } 02837 } 02838 02839 { 02840 PDESKTOP rpdesk; 02841 PATTACHINFO *ppai; 02842 02843 /* 02844 * Temporarily lock the desktop until the THREADINFO structure is 02845 * freed. Note that locking a NULL ptiCurrent->rpdesk is OK. Use a 02846 * normal lock instead of a thread lock because the lock must 02847 * exist past the freeing of the ptiCurrent. 02848 */ 02849 rpdesk = NULL; 02850 LockDesktop(&rpdesk, ptiCurrent->rpdesk, LDL_FN_DESTROYTHREADINFO, (ULONG_PTR)PtiCurrent()); 02851 02852 /* 02853 * Cleanup SMS structures attached to this thread. Handles both 02854 * pending send and receive messages. MUST make sure we do SendMsgCleanup 02855 * AFTER window cleanup. 02856 */ 02857 SendMsgCleanup(ptiCurrent); 02858 02859 02860 /* 02861 * Allow this thread to be swapped 02862 */ 02863 if (ptiCurrent->cEnterCount) { 02864 BOOLEAN bool; 02865 02866 RIPMSG1(RIP_WARNING, "Thread exiting with stack locked. pti:%#p\n", ptiCurrent); 02867 bool = KeSetKernelStackSwapEnable(TRUE); 02868 ptiCurrent->cEnterCount = 0; 02869 UserAssert(!bool); 02870 } 02871 02872 if (ptiCurrent->ppi != NULL) { 02873 ptiCurrent->ppi->cThreads--; 02874 UserAssert(ptiCurrent->ppi->cThreads >= 0); 02875 } 02876 02877 /* 02878 * If this thread is a win16 task, remove it from the scheduler. 02879 */ 02880 if (ptiCurrent->TIF_flags & TIF_16BIT) { 02881 if ((ptiCurrent->ptdb) && (ptiCurrent->ptdb->hTaskWow != 0)) { 02882 _WOWCleanup(NULL, ptiCurrent->ptdb->hTaskWow); 02883 } 02884 DestroyTask(ptiCurrent->ppi, ptiCurrent); 02885 } 02886 02887 if (ptiCurrent->hEventQueueClient != NULL) { 02888 ProtectHandle(ptiCurrent->hEventQueueClient, FALSE); 02889 ZwClose(ptiCurrent->hEventQueueClient); 02890 ptiCurrent->hEventQueueClient = NULL; 02891 } 02892 02893 02894 if (gspwndInternalCapture != NULL) { 02895 if (GETPTI(gspwndInternalCapture) == ptiCurrent) { 02896 Unlock(&gspwndInternalCapture); 02897 } 02898 } 02899 02900 /* 02901 * Set gptiForeground to NULL if equal to this pti before exiting 02902 * this routine. 02903 */ 02904 if (gptiForeground == ptiCurrent) { 02905 if (FWINABLE()) { 02906 /* 02907 * Post these (WEF_ASYNC), since we can't make callbacks from here. 02908 */ 02909 xxxWindowEvent(EVENT_OBJECT_FOCUS, NULL, OBJID_CLIENT, INDEXID_CONTAINER, WEF_ASYNC); 02910 xxxWindowEvent(EVENT_SYSTEM_FOREGROUND, NULL, OBJID_WINDOW, INDEXID_CONTAINER, WEF_ASYNC); 02911 } 02912 02913 /* 02914 * Call the Shell to ask it to activate its main window. 02915 * This will be accomplished with a PostMessage() to itself, 02916 * so the actual activation will take place later. 02917 */ 02918 UserAssert(rpdesk != NULL); 02919 02920 if (rpdesk->pDeskInfo->spwndProgman) 02921 _PostMessage(rpdesk->pDeskInfo->spwndProgman, guiActivateShellWindow, 0, 0); 02922 02923 /* 02924 * Set gptiForeground to NULL because we're destroying it. 02925 */ 02926 SetForegroundThread(NULL); 02927 02928 /* 02929 * If this thread is attached to gpqForeground AND it's the 02930 * last thread in the queue, then zzzDestroyQueue will NULL out 02931 * qpqForeground. Due to journalling attaching, gptiForegrouund 02932 * is not always attached to gpqForeground. This is one reason 02933 * why we no longer NULL out gpqForeground as stated in the old 02934 * comment. The other reason is that there might be other threads 02935 * in the foreground queue so there is no need to zap it. This was 02936 * messing up MsTest (now called VisualTest) 02937 * This is the old comment: 02938 * "Since gpqForeground is derived from the foreground thread 02939 * structure, set it to NULL as well, since there now is no 02940 * foreground thread structure" 02941 * 02942 * qpqForeground = NULL; 02943 */ 02944 } 02945 02946 02947 /* 02948 * If this thread got the last input event, pass ownership to another 02949 * thread in this process or to the foreground thread. 02950 */ 02951 if (ptiCurrent == glinp.ptiLastWoken) { 02952 UserAssert(PpiCurrent() == ptiCurrent->ppi); 02953 if (ptiCurrent->ppi->ptiList != NULL) { 02954 UserAssert (ptiCurrent != ptiCurrent->ppi->ptiList); 02955 glinp.ptiLastWoken = ptiCurrent->ppi->ptiList; 02956 } else { 02957 glinp.ptiLastWoken = gptiForeground; 02958 } 02959 } 02960 02961 /* 02962 * Make sure none of the other global thread pointers are pointing to us. 02963 */ 02964 if (gptiShutdownNotify == ptiCurrent) { 02965 gptiShutdownNotify = NULL; 02966 } 02967 if (gptiTasklist == ptiCurrent) { 02968 gptiTasklist = NULL; 02969 } 02970 if (gHardErrorHandler.pti == ptiCurrent) { 02971 gHardErrorHandler.pti = NULL; 02972 } 02973 02974 /* 02975 * May be called from xxxCreateThreadInfo before the queue is created 02976 * so check for NULL queue. 02977 * Lock the queues since this pti might be locked. They will be unlocked 02978 * in UserDeleteW32Thread 02979 */ 02980 if (ptiCurrent->pq != NULL) { 02981 UserAssert(ptiCurrent->pq != ptiCurrent->pqAttach); 02982 DestroyThreadsMessages(ptiCurrent->pq, ptiCurrent); 02983 (ptiCurrent->pq->cLockCount)++; 02984 zzzDestroyQueue(ptiCurrent->pq, ptiCurrent); 02985 } 02986 02987 /* 02988 * zzzReattachThreads shouldn't call back while using pqAttach 02989 */ 02990 UserAssert(ptiCurrent->pqAttach == NULL); 02991 #if 0 02992 if (ptiCurrent->pqAttach != NULL) { 02993 DestroyThreadsMessages(ptiCurrent->pqAttach, ptiCurrent); 02994 (ptiCurrent->pqAttach->cLockCount)++; 02995 zzzDestroyQueue(ptiCurrent->pqAttach, ptiCurrent); 02996 } 02997 #endif 02998 02999 /* 03000 * Remove the pti from its pti list and reset the pointers. 03001 */ 03002 if (ptiCurrent->rpdesk != NULL) { 03003 RemoveEntryList(&ptiCurrent->PtiLink); 03004 InitializeListHead(&ptiCurrent->PtiLink); 03005 } 03006 03007 FreeMessageList(&ptiCurrent->mlPost); 03008 03009 /* 03010 * Free any attachinfo structures pointing to this thread 03011 */ 03012 ppai = &gpai; 03013 while ((*ppai) != NULL) { 03014 if ((*ppai)->pti1 == ptiCurrent || (*ppai)->pti2 == ptiCurrent) { 03015 PATTACHINFO paiKill = *ppai; 03016 *ppai = (*ppai)->paiNext; 03017 UserFreePool((HLOCAL)paiKill); 03018 } else { 03019 ppai = &(*ppai)->paiNext; 03020 } 03021 } 03022 03023 /* 03024 * Change ownership of any objects that didn't get freed (because they 03025 * are locked or we have a bug and the object didn't get destroyed). 03026 */ 03027 MarkThreadsObjects(ptiCurrent); 03028 03029 /* 03030 * Free thread information visible from client 03031 */ 03032 if (rpdesk && ptiCurrent->pcti != NULL && ptiCurrent->pcti != &(ptiCurrent->cti)) { 03033 DesktopFree(rpdesk, ptiCurrent->pcti); 03034 ptiCurrent->pcti = &(ptiCurrent->cti); 03035 } 03036 03037 /* 03038 * Free the client info for system threads 03039 */ 03040 if (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD && ptiCurrent->pClientInfo != NULL) { 03041 UserFreePool(ptiCurrent->pClientInfo); 03042 ptiCurrent->pClientInfo = NULL; 03043 } 03044 03045 /* 03046 * Unlock the temporary desktop lock. ptiCurrent->rpdesk is still locked 03047 * and will be unlocked in UserDeleteW32Thread. 03048 */ 03049 UnlockDesktop(&rpdesk, LDU_FN_DESTROYTHREADINFO, (ULONG_PTR)PtiCurrent()); 03050 } 03051 03052 /* 03053 * One more thread died. 03054 */ 03055 gdwGuiThreads--; 03056 }

BOOL xxxDestroyWindow PWND  pwnd  ) 
 

Definition at line 1591 of file createw.c.

References tagCLS::atomClassName, tagSERVERINFO::atomSysClass, AW_SKIP, AW_TRY, BOOL, CFIME, CheckLock, DWORD, DWP_SetHotKey(), FALSE, tagMENUSTATE::fModelessMenu, FWINABLE, GetpMenuState(), GETPTI, ghwndSwitch, gpqForeground, gpsi, tagWND::head, HMChangeOwnerThread(), HMIsMarkDestroy, HMPheFromObject, HWq, ICLS_IME, ImeCanDestroyDefIME(), ImeCanDestroyDefIMEforChild(), IS_IME_ENABLED, IsHooked, IsTrayWindow(), Lock, MNEndMenuStateNotify(), NULL, tagWND::pcls, tagMENUSTATE::pGlobalPopupMenu, PostShellHookMessages(), tagTHREADINFO::pq, PsGetCurrentThread, PtiCurrent, PtoHq, PTR_TO_ID, PUDF_ANIMATE, PWNDDESKTOP, tagWND::rcWindow, SetVisible(), SetWF, tagWND::spmenu, tagQ::spwndActive, tagTHREADINFO::spwndDefaultIme, tagQ::spwndFocus, tagWND::spwndLastActive, tagPOPUPMENU::spwndNotify, tagWND::spwndOwner, tagWND::spwndParent, SV_UNSET, TEST_PUDF, TestCF, TestWF, TestwndChild, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TIF_DISABLEHOOKS, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, UINT, UnlinkWindow(), Unlock, WEF_USEPWNDTHREAD, WEFNOPARENTNOTIFY, WFCHILD, WFDESTROYED, WFHASPALETTE, WFINDESTROY, WFPOPUP, WFVISIBLE, WHF_CBT, xxxActivateWindow(), xxxCallHook(), xxxDW_DestroyOwnedWindows(), xxxDW_SendDestroyMessages(), xxxEndMenu(), xxxFlushPalette(), xxxFocusSetInputContext(), xxxFreeWindow(), xxxRedrawWindow(), xxxSendMessage(), xxxSetWindowPos(), xxxShowWindow(), xxxWindowEvent(), zzzAttachThreadInput(), and zzzInternalDestroyCaret().

Referenced by NtUserDestroyWindow(), NtUserDisableThreadIme(), xxxCancelCoolSwitch(), xxxCreateDesktop(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDesktopThread(), xxxDestroyThreadDDEObject(), xxxDW_DestroyOwnedWindows(), xxxEndMenu(), xxxMNCancel(), xxxMNCloseHierarchy(), xxxMNOpenHierarchy(), xxxProcessEventMessage(), and xxxTrackPopupMenuEx().

01593 { 01594 PMENUSTATE pMenuState, pmnsEnd; 01595 PTHREADINFO pti = PtiCurrent(); 01596 TL tlpwnd; 01597 PWND pwndFocus; 01598 TL tlpwndFocus; 01599 TL tlpwndParent; 01600 BOOL fAlreadyDestroyed; 01601 DWORD dwDisableHooks; 01602 01603 dwDisableHooks = 0; 01604 ThreadLockWithPti(pti, pwnd, &tlpwnd); 01605 01606 /* 01607 * First, if this handle has been marked for destruction, that means it 01608 * is possible that the current thread is not its owner! (meaning we're 01609 * being called from a handle unlock call). In this case, set the owner 01610 * to be the current thread so inter-thread send messages occur. 01611 */ 01612 fAlreadyDestroyed = HMIsMarkDestroy(pwnd); 01613 if (fAlreadyDestroyed) { 01614 /* 01615 * UserAssert(dwInAtomicOperation > 0); 01616 * This Assert ensures that we are here only because of an unlock 01617 * on a previously destroyed window. We BEGIN/ENDATOMICHCHECK in 01618 * HMDestroyUnlockedObject to ensure we don't leave the crit sect 01619 * unexpectedly, which gives us dwInAtomicCheck > 0. We set 01620 * TIF_DISABLEHOOKS to prevent a callback in Unlock 01621 * However, it is currently possible destroy the same window handle 01622 * twice, since we don't (yet) fail to revalidate zombie handles: 01623 * GerardoB may change this, at which time we should probably restore 01624 * this Assert, and test #76902 (close winmsd.exe) again. (preventing 01625 * hooks in a second destroy of a zombie window should be OK) - IanJa 01626 */ 01627 // UserAssert(dwInAtomicOperation > 0); 01628 01629 if (HMPheFromObject(pwnd)->pOwner != pti) { 01630 UserAssert(PsGetCurrentThread()->Tcb.Win32Thread); 01631 HMChangeOwnerThread(pwnd, pti); 01632 } 01633 dwDisableHooks = pti->TIF_flags & TIF_DISABLEHOOKS; 01634 pti->TIF_flags |= TIF_DISABLEHOOKS; 01635 } else { 01636 /* 01637 * Ensure that we can destroy the window. JIMA: no other process or thread 01638 * should be able to destroy any other process or thread's window. 01639 */ 01640 if (pti != GETPTI(pwnd)) { 01641 RIPERR0(ERROR_ACCESS_DENIED, 01642 RIP_WARNING, 01643 "Access denied in xxxDestroyWindow"); 01644 01645 goto FalseReturn; 01646 } 01647 } 01648 01649 /* 01650 * First ask the CBT hook if we can destroy this window. 01651 * If this object has already been destroyed OR this thread is currently 01652 * in cleanup mode, *do not* make any callbacks via hooks to the client 01653 * process. 01654 */ 01655 if (!fAlreadyDestroyed && !(pti->TIF_flags & TIF_INCLEANUP) && 01656 IsHooked(pti, WHF_CBT)) { 01657 if (xxxCallHook(HCBT_DESTROYWND, (WPARAM)HWq(pwnd), 0, WH_CBT)) { 01658 goto FalseReturn; 01659 } 01660 } 01661 01662 /* 01663 * If the window we are destroying is in menu mode, end the menu 01664 */ 01665 pMenuState = GetpMenuState(pwnd); 01666 if ((pMenuState != NULL) 01667 && (pwnd == pMenuState->pGlobalPopupMenu->spwndNotify)) { 01668 01669 MNEndMenuStateNotify(pMenuState); 01670 /* 01671 * Signal all states to end. The window(s) will be unlocked when 01672 * the menu exits; we cannot unlock it now because the menu 01673 * code could fault. 01674 */ 01675 pmnsEnd = pMenuState; 01676 do { 01677 UserAssert(pwnd == pMenuState->pGlobalPopupMenu->spwndNotify); 01678 pMenuState->fInsideMenuLoop = FALSE; 01679 pMenuState = pMenuState->pmnsPrev; 01680 } while (pMenuState != NULL) ; 01681 01682 /* 01683 * All states have been signaled to exit, so once we callback 01684 * we cannot count on pmnsEnd->pmnsPrev to be valid. Thus 01685 * we simply end the current menu here and let the others go 01686 * on their own. No state points to pwnd anymore so that 01687 * should be OK. 01688 */ 01689 if (!pmnsEnd->fModelessMenu) { 01690 xxxEndMenu(pmnsEnd); 01691 } 01692 } 01693 01694 if (ghwndSwitch == HWq(pwnd)) 01695 ghwndSwitch = NULL; 01696 01697 if (!TestWF(pwnd, WFCHILD) && (pwnd->spwndOwner == NULL)) { 01698 01699 if (TestWF(pwnd, WFHASPALETTE)) { 01700 xxxFlushPalette(pwnd); 01701 } 01702 } 01703 01704 /* 01705 * Disassociate thread state if this is top level and owned by a different 01706 * thread. This is done to begin with so these windows z-order together. 01707 */ 01708 if (pwnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME] && 01709 !TestwndChild(pwnd) && pwnd->spwndOwner != NULL && 01710 GETPTI(pwnd->spwndOwner) != GETPTI(pwnd)) { 01711 /* 01712 * No need to zzzDeferWinEventNotify() - there is an xxx call just below 01713 */ 01714 zzzAttachThreadInput(GETPTI(pwnd), GETPTI(pwnd->spwndOwner), FALSE); 01715 } 01716 01717 /* 01718 * If we are a child window without the WS_NOPARENTNOTIFY style, send 01719 * the appropriate notification message. 01720 * 01721 * NOTE: Although it would appear that we are illegally cramming a 01722 * a WORD (WM_DESTROY) and a DWORD (pwnd->spmenu) into a single LONG 01723 * (wParam) this isn't really the case because we first test if this 01724 * is a child window. The pMenu field in a child window is really 01725 * the window's id and only the LOWORD is significant. 01726 */ 01727 if (TestWF(pwnd, WFCHILD) && !TestWF(pwnd, WEFNOPARENTNOTIFY) && 01728 pwnd->spwndParent != NULL) { 01729 01730 ThreadLockAlwaysWithPti(pti, pwnd->spwndParent, &tlpwndParent); 01731 xxxSendMessage(pwnd->spwndParent, WM_PARENTNOTIFY, 01732 MAKELONG(WM_DESTROY, PTR_TO_ID(pwnd->spmenu)), (LPARAM)HWq(pwnd)); 01733 ThreadUnlock(&tlpwndParent); 01734 } 01735 01736 /* 01737 * Mark this window as beginning the destroy process. This is necessary 01738 * to prevent window-management calls such as ShowWindow or SetWindowPos 01739 * from coming in and changing the visible-state of the window 01740 * once we hide it. Otherwise, if the app attempts to make it 01741 * visible, then we can get our vis-rgns screwed up once we truely 01742 * destroy the window. 01743 * 01744 * Don't mark the mother desktop with this bit. The xxxSetWindowPos() 01745 * will fail for this window, and thus possibly cause an assertion 01746 * in the xxxFreeWindow() call when we check for the visible-bit. 01747 */ 01748 if (pwnd->spwndParent && (pwnd->spwndParent->head.rpdesk != NULL)) 01749 SetWF(pwnd, WFINDESTROY); 01750 01751 /* 01752 * Hide the window. 01753 */ 01754 if (TestWF(pwnd, WFVISIBLE)) { 01755 if (TestWF(pwnd, WFCHILD)) { 01756 xxxShowWindow(pwnd, SW_HIDE | TEST_PUDF(PUDF_ANIMATE)); 01757 } else { 01758 01759 /* 01760 * Hide this window without activating anyone else. 01761 */ 01762 xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | 01763 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | 01764 (fAlreadyDestroyed ? SWP_DEFERDRAWING : 0)); 01765 } 01766 01767 /* 01768 * Under low memory conditions, the above attempt to hide could fail. 01769 */ 01770 if (TestWF(pwnd, WFVISIBLE)) { 01771 RIPMSG0(RIP_WARNING, "xxxDestroyWindow: normal hide failed"); 01772 SetVisible(pwnd, SV_UNSET); 01773 01774 /* 01775 * Invalidate windows below so they redraw properly. 01776 */ 01777 xxxRedrawWindow(NULL, &pwnd->rcWindow, NULL, RDW_INVALIDATE | 01778 RDW_ERASE | RDW_ALLCHILDREN); 01779 01780 } 01781 } else if (IsTrayWindow(pwnd)) { 01782 PostShellHookMessages(HSHELL_WINDOWDESTROYED, 01783 (LPARAM)PtoHq( pwnd )); 01784 } 01785 01786 /* 01787 * Destroy any owned windows. 01788 */ 01789 if (!TestWF(pwnd, WFCHILD)) { 01790 xxxDW_DestroyOwnedWindows(pwnd); 01791 01792 /* 01793 * And remove the window hot-key, if it has one 01794 */ 01795 DWP_SetHotKey(pwnd, 0); 01796 } 01797 01798 /* 01799 * If the window has already been destroyed, don't muck with 01800 * activation because we may already be in the middle of 01801 * an activation event. Changing activation now may cause us 01802 * to leave our critical section while holding the display lock. 01803 * This will result in a deadlock if another thread gets the 01804 * critical section before we do and attempts to lock the 01805 * display. 01806 */ 01807 if (!fAlreadyDestroyed) { 01808 PWND pwndActivate = NULL; 01809 TL tlpwndActivate; 01810 UINT cmdActivate; 01811 01812 /* 01813 * If hiding the active window, activate someone else. 01814 * This call is strategically located after DestroyOwnedWindows() so we 01815 * don't end up activating our owner window. 01816 * 01817 * If the window is a popup, try to activate his creator not the top 01818 * window in the Z list. 01819 */ 01820 if (pwnd == pti->pq->spwndActive) { 01821 if (TestWF(pwnd, WFPOPUP) && pwnd->spwndOwner) { 01822 pwndActivate = pwnd->spwndOwner; 01823 cmdActivate = AW_TRY; 01824 01825 } else { 01826 pwndActivate = pwnd; 01827 cmdActivate = AW_SKIP; 01828 } 01829 } else if ((pti->pq->spwndActive == NULL) && (gpqForeground == pti->pq)) { 01830 pwndActivate = pwnd; 01831 cmdActivate = AW_SKIP; 01832 } 01833 01834 if (pwndActivate) { 01835 ThreadLockAlwaysWithPti(pti, pwndActivate, &tlpwndActivate); 01836 01837 if (!xxxActivateWindow(pwndActivate, cmdActivate) || 01838 ((cmdActivate == AW_SKIP) && (pwnd == pti->pq->spwndActive))) { 01839 if ((cmdActivate == AW_SKIP) || (pwnd == pti->pq->spwndActive)) { 01840 Unlock(&pti->pq->spwndActive); 01841 pwndFocus = Unlock(&pti->pq->spwndFocus); 01842 if (IS_IME_ENABLED() && pwndFocus != NULL) { 01843 ThreadLockAlwaysWithPti(pti, pwndFocus, &tlpwndFocus); 01844 xxxFocusSetInputContext(pwndFocus, FALSE, FALSE); 01845 ThreadUnlock(&tlpwndFocus); 01846 } 01847 if (FWINABLE() && (pti->pq == gpqForeground)) { 01848 xxxWindowEvent(EVENT_OBJECT_FOCUS, NULL, OBJID_CLIENT, 01849 INDEXID_CONTAINER, 0); 01850 xxxWindowEvent(EVENT_SYSTEM_FOREGROUND, NULL, OBJID_WINDOW, 01851 INDEXID_CONTAINER, WEF_USEPWNDTHREAD); 01852 } 01853 zzzInternalDestroyCaret(); 01854 } 01855 } 01856 01857 ThreadUnlock(&tlpwndActivate); 01858 } 01859 } 01860 01861 /* 01862 * fix last active popup 01863 */ 01864 { 01865 PWND pwndOwner = pwnd->spwndOwner; 01866 01867 if (pwndOwner != NULL) { 01868 while (pwndOwner->spwndOwner != NULL) { 01869 pwndOwner = pwndOwner->spwndOwner; 01870 } 01871 01872 if (pwnd == pwndOwner->spwndLastActive) { 01873 Lock(&(pwndOwner->spwndLastActive), pwnd->spwndOwner); 01874 } 01875 } 01876 } 01877 01878 if (!fAlreadyDestroyed) { 01879 /* 01880 * Note we do this BEFORE telling the app the window is dying. Note also 01881 * that we do NOT loop through the children generating DESTROY events. 01882 * DESTROY of a parent implies DESTROY of all children (see #71846 - IanJa) 01883 */ 01884 if (FWINABLE() && !TestWF(pwnd, WFDESTROYED)) { 01885 xxxWindowEvent(EVENT_OBJECT_DESTROY, pwnd, OBJID_WINDOW, INDEXID_CONTAINER, 0); 01886 } 01887 01888 /* 01889 * Send destroy messages before the WindowLockStart in case 01890 * he tries to destroy windows as a result. 01891 */ 01892 xxxDW_SendDestroyMessages(pwnd); 01893 } 01894 01895 /* 01896 * Check the owner of IME window again. 01897 * If thread is destroying, don't bother to check. 01898 */ 01899 if (IS_IME_ENABLED() && !(pti->TIF_flags & TIF_INCLEANUP) && 01900 pti->spwndDefaultIme != NULL && 01901 !TestCF(pwnd, CFIME) && 01902 pwnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME]) { 01903 01904 if (fAlreadyDestroyed) { 01905 RIPMSG2(RIP_VERBOSE, "xxxDestroyWindow: in final destruction of %#p, ime=%#p", 01906 pwnd, pti->spwndDefaultIme); 01907 } else { 01908 if (!TestWF(pwnd, WFCHILD)) { 01909 if (ImeCanDestroyDefIME(pti->spwndDefaultIme, pwnd)) { 01910 TAGMSG1(DBGTAG_IMM, "xxxDestroyWindow: destroying (1) the default IME window=%p", pti->spwndDefaultIme); 01911 xxxDestroyWindow(pti->spwndDefaultIme); 01912 } 01913 } 01914 else if (pwnd->spwndParent != NULL) { 01915 if (ImeCanDestroyDefIMEforChild(pti->spwndDefaultIme, pwnd)) { 01916 TAGMSG1(DBGTAG_IMM, "xxxDestroyWindow: destroying (2) the default IME window=%p", pti->spwndDefaultIme); 01917 xxxDestroyWindow(pti->spwndDefaultIme); 01918 } 01919 } 01920 } 01921 } 01922 01923 if ((pwnd->spwndParent != NULL) && !fAlreadyDestroyed) { 01924 01925 /* 01926 * TestwndChild() on checks to WFCHILD bit. Make sure this 01927 * window wasn't SetParent()'ed to the desktop as well. 01928 */ 01929 if (TestwndChild(pwnd) && (pwnd->spwndParent != PWNDDESKTOP(pwnd)) && 01930 (GETPTI(pwnd) != GETPTI(pwnd->spwndParent))) { 01931 /* 01932 * pwnd is threadlocked, so no need to DeferWinEventNotify() 01933 */ 01934 CheckLock(pwnd); 01935 zzzAttachThreadInput(GETPTI(pwnd), GETPTI(pwnd->spwndParent), FALSE); 01936 } 01937 01938 UnlinkWindow(pwnd, pwnd->spwndParent); 01939 } 01940 01941 /* 01942 * This in intended to check for a case where we destroy the window, 01943 * but it's still listed as the active-window in the queue. This 01944 * could cause problems in window-activation (see xxxActivateThisWindow) 01945 * where we attempt to activate another window and in the process, try 01946 * to deactivate this window (bad). 01947 */ 01948 #if DBG 01949 if (pwnd == pti->pq->spwndActive) { 01950 RIPMSG1(RIP_WARNING, "xxxDestroyWindow: pwnd == pti->pq->spwndActive (%#p)", pwnd); 01951 } 01952 #endif 01953 01954 /* 01955 * Set the state as destroyed so any z-ordering events will be ignored. 01956 * We cannot NULL out the owner field until WM_NCDESTROY is send or 01957 * apps like Rumba fault (they call GetParent after every message) 01958 */ 01959 SetWF(pwnd, WFDESTROYED); 01960 01961 /* 01962 * FreeWindow performs a ThreadUnlock. 01963 */ 01964 01965 xxxFreeWindow(pwnd, &tlpwnd); 01966 01967 if (fAlreadyDestroyed) { 01968 pti->TIF_flags = (pti->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 01969 } 01970 return TRUE; 01971 01972 FalseReturn: 01973 if (fAlreadyDestroyed) { 01974 pti->TIF_flags = (pti->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 01975 } 01976 ThreadUnlock(&tlpwnd); 01977 return FALSE; 01978 }

VOID xxxDirectedYield DWORD  dwThreadId  ) 
 

Definition at line 691 of file taskman.c.

References CheckCritIn, gpsi, InsertTask(), tagTDB::nEvents, tagTDB::nPriority, NULL, tagTHREADINFO::ppi, tagTHREADINFO::ptdb, PtiCurrent, PtiFromThreadId(), tagPROCESSINFO::pwpi, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, and xxxSleepTask().

Referenced by xxxInternalGetMessage(), and xxxPollAndWaitForSingleObject().

00693 { 00694 PTHREADINFO ptiOld; 00695 PTHREADINFO ptiNew; 00696 00697 CheckCritIn(); 00698 00699 ptiOld = PtiCurrent(); 00700 if (!(ptiOld->TIF_flags & TIF_16BIT) || !ptiOld->ppi->pwpi) { 00701 RIPMSG0(RIP_ERROR, "DirectedYield called from 32 bit thread!"); 00702 return; 00703 } 00704 00705 /* 00706 * If the old task is 16 bit, reinsert the task in its wow 00707 * scheduler list so that it is lowest in priority. 00708 */ 00709 ptiOld->ptdb->nEvents++; 00710 gpsi->nEvents++; 00711 InsertTask(ptiOld->ppi, ptiOld->ptdb); 00712 00713 /* 00714 * -1 supports Win 3.1 OldYield mechanics 00715 */ 00716 if (dwThreadId != DY_OLDYIELD) { 00717 00718 ptiNew = PtiFromThreadId(dwThreadId); 00719 if (ptiNew == NULL) 00720 return; 00721 00722 if (ptiNew->TIF_flags & TIF_16BIT) { 00723 ptiNew->ptdb->nEvents++; 00724 gpsi->nEvents++; 00725 ptiNew->ptdb->nPriority--; 00726 InsertTask(ptiNew->ppi, ptiNew->ptdb); 00727 ptiNew->ptdb->nPriority++; 00728 } 00729 } 00730 00731 xxxSleepTask(TRUE, NULL); 00732 }

LRESULT xxxDispatchMessage LPMSG  lpmsg  ) 
 

Definition at line 762 of file ntuser/kernel/input.c.

References CallClientProcA, CallClientProcW, ClrWF, tagTIMER::flags, gapfnScSendMessage, GETPTI, gptmrFirst, tagMSG_TABLE_ENTRY::iFunction, tagWND::lpfnWndProc, MessageTable, MSGFLAG_WOW_RESERVED, NtGetTickCount(), NULL, tagTIMER::pfn, PtiCurrent, tagTIMER::ptmrNext, RevalidateHwnd, RtlMBMessageWParamCharToWCS(), RtlWCSMessageWParamCharToMB(), SetWF, TESTSYNCONLYMESSAGE, TestWF, ThreadLock, ThreadUnlock, TIF_16BIT, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, UINT, ValidateHwnd, WFANSIPROC, WFPAINTNOTPROCESSED, WFSERVERSIDEPROC, WFWMPAINTSENT, WM_SYSTIMER, WNDPROC_PWND, and xxxSimpleDoSyncPaint().

Referenced by NtUserDispatchMessage(), xxxDesktopThread(), xxxHelpLoop(), xxxMNLoop(), xxxMoveSize(), xxxOldNextWindow(), xxxRestoreCsrssThreadDesktop(), xxxSBTrackLoop(), and xxxSetCsrssThreadDesktop().

00764 { 00765 LRESULT lRet; 00766 PWND pwnd; 00767 WNDPROC_PWND lpfnWndProc; 00768 TL tlpwnd; 00769 00770 pwnd = NULL; 00771 if (pmsg->hwnd != NULL) { 00772 if ((pwnd = ValidateHwnd(pmsg->hwnd)) == NULL) 00773 return 0; 00774 } 00775 00776 /* 00777 * If this is a synchronous-only message (takes a pointer in wParam or 00778 * lParam), then don't allow this message to go through since those 00779 * parameters have not been thunked, and are pointing into outer-space 00780 * (which would case exceptions to occur). 00781 * 00782 * (This api is only called in the context of a message loop, and you 00783 * don't get synchronous-only messages in a message loop). 00784 */ 00785 if (TESTSYNCONLYMESSAGE(pmsg->message, pmsg->wParam)) { 00786 /* 00787 * Fail if 32 bit app is calling. 00788 */ 00789 if (!(PtiCurrent()->TIF_flags & TIF_16BIT)) { 00790 RIPERR1(ERROR_MESSAGE_SYNC_ONLY, RIP_WARNING, "xxxDispatchMessage: Sync only message 0x%lX", 00791 pmsg->message); 00792 return 0; 00793 } 00794 00795 /* 00796 * For wow apps, allow it to go through (for compatibility). Change 00797 * the message id so our code doesn't understand the message - wow 00798 * will get the message and strip out this bit before dispatching 00799 * the message to the application. 00800 */ 00801 pmsg->message |= MSGFLAG_WOW_RESERVED; 00802 } 00803 00804 ThreadLock(pwnd, &tlpwnd); 00805 00806 /* 00807 * Is this a timer? If there's a proc address, call it, 00808 * otherwise send it to the wndproc. 00809 */ 00810 if ((pmsg->message == WM_TIMER) || (pmsg->message == WM_SYSTIMER)) { 00811 if (pmsg->lParam != 0) { 00812 00813 /* 00814 * System timers must be executed on the server's context. 00815 */ 00816 if (pmsg->message == WM_SYSTIMER) { 00817 00818 /* 00819 * Verify that it's a valid timer proc. If so, 00820 * don't leave the critsect to call server-side procs 00821 * and pass a PWND, not HWND. 00822 */ 00823 PTIMER ptmr; 00824 lRet = 0; 00825 for (ptmr = gptmrFirst; ptmr != NULL; ptmr = ptmr->ptmrNext) { 00826 if ((pmsg->lParam == (LPARAM)ptmr->pfn) && (ptmr->flags & TMRF_SYSTEM)) { 00827 ptmr->pfn(pwnd, WM_SYSTIMER, (UINT)pmsg->wParam, 00828 NtGetTickCount()); 00829 break; 00830 } 00831 } 00832 goto Exit; 00833 } else { 00834 /* 00835 * WM_TIMER is the same for Unicode/ANSI. 00836 */ 00837 PTHREADINFO ptiCurrent = PtiCurrent(); 00838 00839 if (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD) { 00840 lRet = 0; 00841 goto Exit; 00842 } 00843 00844 lRet = CallClientProcA(pwnd, WM_TIMER, 00845 pmsg->wParam, NtGetTickCount(), pmsg->lParam); 00846 00847 goto Exit; 00848 } 00849 } 00850 } 00851 00852 /* 00853 * Check to see if pwnd is NULL AFTER the timer check. Apps can set 00854 * timers with NULL hwnd's, that's totally legal. But NULL hwnd messages 00855 * don't get dispatched, so check here after the timer case but before 00856 * dispatching - if it's NULL, just return 0. 00857 */ 00858 if (pwnd == NULL) { 00859 lRet = 0; 00860 goto Exit; 00861 } 00862 00863 /* 00864 * If we're dispatching a WM_PAINT message, set a flag to be used to 00865 * determine whether it was processed properly. 00866 */ 00867 if (pmsg->message == WM_PAINT) 00868 SetWF(pwnd, WFPAINTNOTPROCESSED); 00869 00870 /* 00871 * If this window's proc is meant to be executed from the server side 00872 * we'll just stay inside the semaphore and call it directly. Note 00873 * how we don't convert the pwnd into an hwnd before calling the proc. 00874 */ 00875 if (TestWF(pwnd, WFSERVERSIDEPROC)) { 00876 ULONG_PTR fnMessageType; 00877 00878 fnMessageType = pmsg->message >= WM_USER ? (ULONG_PTR)SfnDWORD : 00879 (ULONG_PTR)gapfnScSendMessage[MessageTable[pmsg->message].iFunction]; 00880 00881 /* 00882 * Convert the WM_CHAR from ANSI to UNICODE if the source was ANSI 00883 */ 00884 if (fnMessageType == (ULONG_PTR)SfnINWPARAMCHAR && TestWF(pwnd, WFANSIPROC)) { 00885 UserAssert(PtiCurrent() == GETPTI(pwnd)); // use receiver's codepage 00886 RtlMBMessageWParamCharToWCS(pmsg->message, &pmsg->wParam); 00887 } 00888 00889 lRet = pwnd->lpfnWndProc(pwnd, pmsg->message, pmsg->wParam, 00890 pmsg->lParam); 00891 goto Exit; 00892 } 00893 00894 /* 00895 * Cool people dereference any window structure members before they 00896 * leave the critsect. 00897 */ 00898 lpfnWndProc = pwnd->lpfnWndProc; 00899 00900 { 00901 /* 00902 * If we're dispatching the message to an ANSI wndproc we need to 00903 * convert the character messages from Unicode to Ansi. 00904 */ 00905 if (TestWF(pwnd, WFANSIPROC)) { 00906 UserAssert(PtiCurrent() == GETPTI(pwnd)); // use receiver's codepage 00907 RtlWCSMessageWParamCharToMB(pmsg->message, &pmsg->wParam); 00908 lRet = CallClientProcA(pwnd, pmsg->message, 00909 pmsg->wParam, pmsg->lParam, (ULONG_PTR)lpfnWndProc); 00910 } else { 00911 lRet = CallClientProcW(pwnd, pmsg->message, 00912 pmsg->wParam, pmsg->lParam, (ULONG_PTR)lpfnWndProc); 00913 } 00914 } 00915 00916 /* 00917 * If we dispatched a WM_PAINT message and it wasn't properly 00918 * processed, do the drawing here. 00919 */ 00920 if (pmsg->message == WM_PAINT && RevalidateHwnd(pmsg->hwnd) && 00921 TestWF(pwnd, WFPAINTNOTPROCESSED)) { 00922 //RIPMSG0(RIP_WARNING, 00923 // "Missing BeginPaint or GetUpdateRect/Rgn(fErase == TRUE) in WM_PAINT"); 00924 ClrWF(pwnd, WFWMPAINTSENT); 00925 xxxSimpleDoSyncPaint(pwnd); 00926 } 00927 00928 Exit: 00929 ThreadUnlock(&tlpwnd); 00930 return lRet; 00931 }

BOOL xxxDoHotKeyStuff UINT  vk,
BOOL  fBreak,
DWORD  fsReserveKeys
 

Definition at line 434 of file hotkeys.c.

References _PostMessage(), _PostThreadMessage(), BOOL, BYTE, CheckCritIn, tagWINDOWSTATION::dwWSF_Flags, FALSE, tagHOTKEY::fsModifiers, GETDESKINFO, GETPTI, gfInNumpadHexInput, ghwndSwitch, glinp, gpidLogon, gpqForeground, grpdeskRitInput, tagWND::head, tagHOTKEY::id, IDHOT_DEBUG, IDHOT_DEBUGSERVER, IDHOT_WINDOWS, IsHotKey(), IsSAS(), IsWinEventNotifyDeferredOK, NULL, NUMPAD_HEXMODE_LL, tagHOTKEY::pti, PtiCurrent, tagLASTINPUT::ptiLastWoken, PW, PWND_INPUTOWNER, tagDESKTOP::rpwinstaParent, tagHOTKEY::spwnd, tagQ::spwndFocus, ThreadLock, ThreadUnlock, TRUE, UINT, tagHOTKEY::wFlags, WSF_SWITCHLOCK, xxxActivateDebugger(), xxxSetForegroundWindow2(), and zzzCancelJournalling().

Referenced by xxxKeyEvent().

00438 { 00439 static UINT fsModifiers = 0; 00440 static UINT fsModOnlyCandidate = 0; 00441 UINT fsModOnlyHotkey; 00442 UINT fs; 00443 PHOTKEY phk; 00444 BOOL fCancel; 00445 BOOL fEatDebugKeyBreak = FALSE; 00446 PWND pwnd; 00447 BOOL bSAS; 00448 00449 CheckCritIn(); 00450 UserAssert(IsWinEventNotifyDeferredOK()); 00451 00452 if (gfInNumpadHexInput & NUMPAD_HEXMODE_LL) { 00453 RIPMSG0(RIP_VERBOSE, "xxxDoHotKeyStuff: Since we're in gfInNumpadHexInput, just bail out."); 00454 return FALSE; 00455 } 00456 00457 /* 00458 * Update fsModifiers. 00459 */ 00460 fs = 0; 00461 fsModOnlyHotkey = 0; 00462 00463 switch (vk) { 00464 case VK_SHIFT: 00465 fs = MOD_SHIFT; 00466 break; 00467 00468 case VK_CONTROL: 00469 fs = MOD_CONTROL; 00470 break; 00471 00472 case VK_MENU: 00473 fs = MOD_ALT; 00474 break; 00475 00476 case VK_LWIN: 00477 case VK_RWIN: 00478 fs = MOD_WIN; 00479 break; 00480 00481 default: 00482 /* 00483 * A non-modifier key rules out Modifier-Only hotkeys 00484 */ 00485 fsModOnlyCandidate = 0; 00486 break; 00487 } 00488 00489 if (fBreak) { 00490 fsModifiers &= ~fs; 00491 /* 00492 * If a modifier key is coming up, the current modifier only hotkey 00493 * candidate must be tested to see if it is a hotkey. Store this 00494 * in fsModOnlyHotkey, and prevent the next key release from 00495 * being a candidate by clearing fsModOnlyCandidate. 00496 */ 00497 if (fs != 0) { 00498 fsModOnlyHotkey = fsModOnlyCandidate; 00499 fsModOnlyCandidate = 0; 00500 } 00501 } else { 00502 fsModifiers |= fs; 00503 /* 00504 * If a modifier key is going down, we have a modifier-only hotkey 00505 * candidate. Save current modifier state until the following break. 00506 */ 00507 if (fs != 0) { 00508 fsModOnlyCandidate = fsModifiers; 00509 } 00510 } 00511 00512 /* 00513 * We look at the physical state for the modifiers because they can not be 00514 * manipulated and this prevents someone from writing a trojan winlogon look alike. 00515 * (See comment in AreModifiersIndicatingSAS) 00516 */ 00517 bSAS = IsSAS((BYTE)vk, &fsModifiers); 00518 00519 /* 00520 * If the key is not a hotkey then we're done but first check if the 00521 * key is an Alt-Escape if so we need to cancel journalling. 00522 * 00523 * NOTE: Support for Alt+Esc to cancel journalling dropped in NT 4.0 00524 */ 00525 if (fsModOnlyHotkey && fBreak) { 00526 /* 00527 * A hotkey involving only VK_SHIFT, VK_CONTROL, VK_MENU or VK_WINDOWS 00528 * must only operate on a key release. 00529 */ 00530 if ((phk = IsHotKey(fsModOnlyHotkey, VK_NONE)) == NULL) { 00531 return FALSE; 00532 } 00533 } else if ((phk = IsHotKey(fsModifiers, vk)) == NULL) { 00534 return FALSE; 00535 } 00536 00537 /* 00538 * If we tripped a SAS hotkey, but it's not really the SAS, don't do it. 00539 */ 00540 if ((phk->wFlags & MOD_SAS) && !bSAS) { 00541 return FALSE; 00542 00543 } 00544 if (phk->id == IDHOT_WINDOWS) { 00545 pwnd = GETDESKINFO(PtiCurrent())->spwndShell; 00546 if (pwnd != NULL) { 00547 fsModOnlyCandidate = 0; /* Make it return TRUE */ 00548 goto PostTaskListSysCmd; 00549 } 00550 } 00551 00552 if ((phk->id == IDHOT_DEBUG) || (phk->id == IDHOT_DEBUGSERVER)) { 00553 00554 if (!fBreak) { 00555 /* 00556 * The DEBUG key has been pressed. Break the appropriate 00557 * thread into the debugger. Won't need phk after this callback 00558 * because we return immediately. 00559 */ 00560 fEatDebugKeyBreak = xxxActivateDebugger(phk->fsModifiers); 00561 } 00562 00563 /* 00564 * This'll eat the debug key down and break if we broke into 00565 * the debugger on the server only on the down. 00566 */ 00567 return fEatDebugKeyBreak; 00568 } 00569 00570 /* 00571 * don't allow hotkeys(except for ones owned by the logon process) 00572 * if the window station is locked. 00573 */ 00574 00575 if (((grpdeskRitInput->rpwinstaParent->dwWSF_Flags & WSF_SWITCHLOCK) != 0) && 00576 (phk->pti->pEThread->Cid.UniqueProcess != gpidLogon)) { 00577 RIPMSG0(RIP_WARNING, "Ignoring hotkey because Workstation locked"); 00578 return FALSE; 00579 } 00580 00581 if ((fsModOnlyHotkey == 0) && fBreak) { 00582 /* 00583 * Do Modifier-Only hotkeys on break events, else return here. 00584 */ 00585 return FALSE; 00586 } 00587 00588 /* 00589 * Unhook hooks if a control-escape, alt-escape, or control-alt-del 00590 * comes through, so the user can cancel if the system seems hung. 00591 * 00592 * Note the hook may be locked so even if the unhook succeeds it 00593 * won't remove the hook from the global asphkStart array. So 00594 * we have to walk the list manually. This code works because 00595 * we are in the critical section and we know other hooks won't 00596 * be deleted. 00597 * 00598 * Once we've unhooked, post a WM_CANCELJOURNAL message to the app 00599 * that set the hook so it knows we did this. 00600 * 00601 * NOTE: Support for Alt+Esc to cancel journalling dropped in NT 4.0 00602 */ 00603 fCancel = FALSE; 00604 if (vk == VK_ESCAPE && (fsModifiers == MOD_CONTROL)) { 00605 fCancel = TRUE; 00606 } 00607 00608 if (bSAS) { 00609 fCancel = TRUE; 00610 } 00611 00612 if (fCancel) 00613 zzzCancelJournalling(); // BUG BUG phk might go away IANJA 00614 00615 /* 00616 * See if the key is reserved by a console window. If it is, 00617 * return FALSE so the key will be passed to the console. 00618 */ 00619 if (fsReserveKeys != 0) { 00620 switch (vk) { 00621 case VK_TAB: 00622 if ((fsReserveKeys & CONSOLE_ALTTAB) && 00623 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_ALT)) { 00624 return FALSE; 00625 } 00626 break; 00627 case VK_ESCAPE: 00628 if ((fsReserveKeys & CONSOLE_ALTESC) && 00629 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_ALT)) { 00630 return FALSE; 00631 } 00632 if ((fsReserveKeys & CONSOLE_CTRLESC) && 00633 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_CONTROL)) { 00634 return FALSE; 00635 } 00636 break; 00637 case VK_RETURN: 00638 if ((fsReserveKeys & CONSOLE_ALTENTER) && 00639 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_ALT)) { 00640 return FALSE; 00641 } 00642 break; 00643 case VK_SNAPSHOT: 00644 if ((fsReserveKeys & CONSOLE_PRTSC) && 00645 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == 0)) { 00646 return FALSE; 00647 } 00648 if ((fsReserveKeys & CONSOLE_ALTPRTSC) && 00649 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_ALT)) { 00650 return FALSE; 00651 } 00652 break; 00653 case VK_SPACE: 00654 if ((fsReserveKeys & CONSOLE_ALTSPACE) && 00655 ((fsModifiers & (MOD_CONTROL | MOD_ALT)) == MOD_ALT)) { 00656 return FALSE; 00657 } 00658 break; 00659 } 00660 } 00661 00662 /* 00663 * If this is the task-list hotkey, go ahead and set foreground 00664 * status to the task-list queue right now. This prevents problems 00665 * where the user hits ctrl-esc and types-ahead before the task-list 00666 * processes the hotkey and brings up the task-list window. 00667 */ 00668 if ((fsModifiers == MOD_CONTROL) && (vk == VK_ESCAPE) && !fBreak) { 00669 PWND pwndSwitch; 00670 TL tlpwndSwitch; 00671 00672 if (ghwndSwitch != NULL) { 00673 pwndSwitch = PW(ghwndSwitch); 00674 ThreadLock(pwndSwitch, &tlpwndSwitch); 00675 xxxSetForegroundWindow2(pwndSwitch, NULL, 0); // BUG BUG phk might go away IANJA 00676 ThreadUnlock(&tlpwndSwitch); 00677 } 00678 } 00679 00680 /* 00681 * Get the hot key contents. 00682 */ 00683 if (phk->spwnd == NULL) { 00684 _PostThreadMessage( 00685 phk->pti, WM_HOTKEY, phk->id, 00686 MAKELONG(fsModifiers, vk)); 00687 /* 00688 * Since this hotkey is for this guy, he owns the last input. 00689 */ 00690 glinp.ptiLastWoken = phk->pti; 00691 00692 } else { 00693 if (phk->spwnd == PWND_INPUTOWNER) { 00694 if (gpqForeground != NULL) { 00695 pwnd = gpqForeground->spwndFocus; 00696 } else { 00697 return FALSE; 00698 } 00699 } else { 00700 pwnd = phk->spwnd; 00701 } 00702 00703 if (pwnd) { 00704 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndShell && phk->id == SC_TASKLIST) { 00705 PostTaskListSysCmd: 00706 _PostMessage(pwnd, WM_SYSCOMMAND, SC_TASKLIST, 0); 00707 } else { 00708 _PostMessage(pwnd, WM_HOTKEY, phk->id, MAKELONG(fsModifiers, vk)); 00709 } 00710 00711 /* 00712 * Since this hotkey is for this guy, he owns the last input. 00713 */ 00714 glinp.ptiLastWoken = GETPTI(pwnd); 00715 } 00716 } 00717 00718 /* 00719 * If this is a Modifier-Only hotkey, let the modifier break through 00720 * by returning FALSE, otherwise we will have modifier keys stuck down. 00721 */ 00722 return (fsModOnlyHotkey == 0); 00723 00724 }

void xxxDoScrollMenu PWND  pwndNotify,
PWND  pwndSB,
BOOL  fVert,
LPARAM  lParam
 

Definition at line 2489 of file sbctl.c.

References CalcSBStuff(), GET_X_LPARAM, GET_Y_LPARAM, GetAppCompatFlags(), GetWndSBDisableFlags(), NULL, tagWND::rcWindow, SBCtlSetup(), SCROLL_MENU, ThreadLockAlways, ThreadUnlock, UINT, xxxDoScroll(), xxxGetScrollMenu(), xxxSBTrackInit(), and xxxTrackPopupMenuEx().

Referenced by xxxDefWindowProc(), and xxxSBWndProc().

02494 { 02495 PMENU pMenu; 02496 SBCALC SBCalc, *pSBCalc; 02497 UINT cmd; 02498 POINT pt; 02499 TL tlpmenu; 02500 UINT wDisable; 02501 02502 /* 02503 * Check the compatibility flag. Word 6.0 AV's when selecting an item 02504 * in this menu. 02505 * NOTE: If this hack is to be extended for other apps we should use 02506 * another bit for GACF_NOSCROLLBARCTXMENU as the current one is re-used 02507 * MCostea #119380 02508 */ 02509 if (GetAppCompatFlags(NULL) & GACF_NOSCROLLBARCTXMENU) { 02510 return; 02511 } 02512 02513 /* 02514 * Initialize some stuff. 02515 */ 02516 POINTSTOPOINT(pt, lParam); 02517 if (pwndSB) { 02518 SBCtlSetup((PSBWND)pwndSB); 02519 pSBCalc = &(((PSBWND)pwndSB)->SBCalc); 02520 wDisable = ((PSBWND)pwndSB)->wDisableFlags; 02521 pt.x -= pwndSB->rcWindow.left; 02522 pt.y -= pwndSB->rcWindow.top; 02523 } else { 02524 pSBCalc = &SBCalc; 02525 CalcSBStuff(pwndNotify, pSBCalc, fVert); 02526 wDisable = GetWndSBDisableFlags(pwndNotify, fVert); 02527 pt.x -= pwndNotify->rcWindow.left; 02528 pt.y -= pwndNotify->rcWindow.top; 02529 } 02530 02531 /* 02532 * Make sure the scrollbar isn't disabled. 02533 */ 02534 if ((wDisable & SB_DISABLE_MASK) == SB_DISABLE_MASK) { 02535 return; 02536 } 02537 02538 /* 02539 * Put up a menu and scroll accordingly. 02540 */ 02541 if ((pMenu = xxxGetScrollMenu(pwndNotify, fVert)) != NULL) { 02542 ThreadLockAlways(pMenu, &tlpmenu); 02543 cmd = xxxTrackPopupMenuEx(pMenu, 02544 TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, 02545 GET_X_LPARAM(lParam), 02546 GET_Y_LPARAM(lParam), 02547 pwndNotify, 02548 NULL); 02549 ThreadUnlock(&tlpmenu); 02550 if (cmd) { 02551 if ((cmd & 0x00FF) == SB_THUMBPOSITION) { 02552 if (pwndSB) { 02553 xxxSBTrackInit(pwndSB, MAKELPARAM(pt.x, pt.y), 0, SCROLL_MENU); 02554 } else { 02555 xxxSBTrackInit(pwndNotify, lParam, fVert ? HTVSCROLL : HTHSCROLL, SCROLL_MENU); 02556 } 02557 } else { 02558 xxxDoScroll(pwndSB, 02559 pwndNotify, 02560 cmd & 0x00FF, 02561 0, 02562 fVert 02563 ); 02564 xxxDoScroll(pwndSB, 02565 pwndNotify, 02566 SB_ENDSCROLL, 02567 0, 02568 fVert 02569 ); 02570 } 02571 } 02572 } 02573 }

VOID xxxDoSyncPaint PWND  pwnd,
DWORD  flags
 

Definition at line 1084 of file paint.c.

References CheckLock, DoQueuedSyncPaint(), ParentNeedsPaint(), PtiCurrent, VOID(), and xxxInternalDoSyncPaint().

Referenced by xxxEndDeferWindowPosEx(), and xxxInternalInvalidate().

01087 { 01088 CheckLock(pwnd); 01089 01090 /* 01091 * If any of our non-clipchildren parents have an update region, don't 01092 * do anything. This way we won't redraw our background or frame out 01093 * of order, only to have it get obliterated when our parent erases his 01094 * background. 01095 */ 01096 if (ParentNeedsPaint(pwnd)) 01097 return; 01098 01099 /* 01100 * First of all if we are going to be queueing any WM_SYNCPAINT messages 01101 * to windows of another thread do it first while the window's update 01102 * regions are still in sync. This way there is no chance the update 01103 * region will be incorrect (through window movement during callbacks of 01104 * the WM_ERASEBKGND|WM_NCPAINT messages). 01105 */ 01106 DoQueuedSyncPaint(pwnd, flags, PtiCurrent()); 01107 xxxInternalDoSyncPaint(pwnd, flags); 01108 }

VOID xxxDoSysExpunge PTHREADINFO  pti  ) 
 

Definition at line 253 of file libmgmt.c.

References aatomSysLoaded, acatomSysDepends, acatomSysUse, tagPROCESSINFO::ahmodLibLoaded, catomSysTableEntries, CLEARHMODLOADED, ClientFreeLibrary(), tagPROCESSINFO::cSysExpunge, gcSysExpunge, gdwSysExpungeMask, tagTHREADINFO::ppi, TESTHMODLOADED, UserDeleteAtom(), and VOID().

Referenced by xxxInternalGetMessage(), and xxxSleepThread().

00255 { 00256 int i; 00257 00258 /* 00259 * Clear this first before we potentially leave the critical section. 00260 */ 00261 pti->ppi->cSysExpunge = gcSysExpunge; 00262 00263 /* 00264 * Scan for libraries that have been freed 00265 */ 00266 for (i = 0; i < catomSysTableEntries; i++) { 00267 if ((acatomSysDepends[i] == 0) && (aatomSysLoaded[i] != 0) && 00268 TESTHMODLOADED(pti, i)) { 00269 00270 HANDLE hmodFree = pti->ppi->ahmodLibLoaded[i]; 00271 00272 /* 00273 * Clear this hmod for this process before we leave the 00274 * critical section. 00275 */ 00276 CLEARHMODLOADED(pti, i); 00277 00278 /* 00279 * Decrement the count of processes that have loaded this 00280 * .dll. If there are no more, then destroy the reference 00281 * to this .dll. 00282 */ 00283 if (--acatomSysUse[i] == 0) { 00284 UserDeleteAtom(aatomSysLoaded[i]); 00285 aatomSysLoaded[i] = 0; 00286 gdwSysExpungeMask &= ~(1 << i); 00287 } 00288 00289 /* 00290 * Call back the client to free the library... 00291 */ 00292 ClientFreeLibrary(hmodFree); 00293 } 00294 } 00295 }

BOOL xxxDragDetect PWND  pwnd,
POINT  pt
 

Definition at line 338 of file dragdrop.c.

References BOOL, and xxxIsDragging().

Referenced by NtUserDragDetect().

00341 { 00342 return xxxIsDragging(pwnd, pt, WM_LBUTTONUP); 00343 }

DWORD xxxDragObject PWND  pwndParent,
PWND  xhwndFrom,
UINT  wFmt,
ULONG_PTR  dwData,
PCURSOR  xpcur
 

Definition at line 26 of file dragdrop.c.

References BOOL, CheckLock, DWORD, FALSE, FWINABLE, GETPTI, HW, IsWinEventNotifyDeferredOK, msg, NULL, tagTHREADINFO::pq, PtiCurrent, RevalidateHwnd, tagQ::spcurCurrent, tagQ::spwndCapture, tagWND::spwndParent, SYSCUR, TestwndChild, ThreadLockAlwaysWithPti, ThreadLockPool, ThreadLockWithPti, ThreadUnlock, ThreadUnlockAndFreePool, TIF_ALLOWFOREGROUNDACTIVATE, TRUE, ValidateHwnd, xxxPeekMessage, xxxQueryDropObject(), xxxReleaseCapture(), xxxSendMessage(), xxxSetCapture(), xxxSleepThread(), xxxUpdateWindow(), xxxWindowEvent(), zzzSetCursor(), and zzzShowCursor().

Referenced by NtUserDragObject().

00032 { 00033 MSG msg, msgKey; 00034 DWORD result = 0; 00035 BOOL fDrag = TRUE; 00036 LPDROPSTRUCT lpds; 00037 PWND pwndDragging = NULL; 00038 PWND pwndTop; 00039 PCURSOR pcurOld, pcurT; 00040 PWND pwndT; 00041 TL tlpwndT; 00042 TL tlpwndTop; 00043 TL tlpwndDragging; 00044 TL tlPool; 00045 PTHREADINFO pti = PtiCurrent(); 00046 00047 CheckLock(pwndParent); 00048 CheckLock(pwndFrom); 00049 CheckLock(pcur); 00050 UserAssert(IsWinEventNotifyDeferredOK()); 00051 00052 lpds = (LPDROPSTRUCT)UserAllocPoolWithQuota(2 * sizeof(DROPSTRUCT), TAG_DRAGDROP); 00053 if (lpds == NULL) 00054 return 0; 00055 00056 ThreadLockPool(pti, lpds, &tlPool); 00057 lpds->hwndSource = HW(pwndFrom); 00058 lpds->wFmt = wFmt; 00059 lpds->dwData = dwData; 00060 00061 if (pcur != NULL) { 00062 /* 00063 * No need to DeferWinEventNotify() - pwndFrom is locked 00064 */ 00065 pcurOld = zzzSetCursor(pcur); 00066 } else { 00067 pcurOld = pti->pq->spcurCurrent; 00068 } 00069 00070 if (pwndFrom) { 00071 for (pwndTop = pwndFrom; TestwndChild(pwndTop); 00072 pwndTop = pwndTop->spwndParent) ; 00073 00074 ThreadLockWithPti(pti, pwndTop, &tlpwndTop); 00075 xxxUpdateWindow(pwndTop); 00076 ThreadUnlock(&tlpwndTop); 00077 } 00078 00079 if (FWINABLE()) { 00080 xxxWindowEvent(EVENT_SYSTEM_DRAGDROPSTART, pwndFrom, OBJID_WINDOW, INDEXID_CONTAINER, 0); 00081 } 00082 00083 xxxSetCapture(pwndFrom); 00084 zzzShowCursor(TRUE); 00085 00086 ThreadLockWithPti(pti, pwndDragging, &tlpwndDragging); 00087 00088 while (fDrag && pti->pq->spwndCapture == pwndFrom) { 00089 while (!(xxxPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || 00090 xxxPeekMessage(&msg, NULL, WM_QUEUESYNC, WM_QUEUESYNC, PM_REMOVE) || 00091 xxxPeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))) { 00092 if (!xxxSleepThread(QS_MOUSE | QS_KEY, 0, TRUE)) { 00093 ThreadUnlock(&tlpwndDragging); 00094 ThreadUnlockAndFreePool(pti, &tlPool); 00095 return 0; 00096 } 00097 } 00098 00099 /* 00100 * Be sure to eliminate any extra keydown messages that are 00101 * being queued up by MOUSE message processing. 00102 */ 00103 00104 while (xxxPeekMessage(&msgKey, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)) 00105 ; 00106 00107 if ( (pti->pq->spwndCapture != pwndFrom) || 00108 (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) ) 00109 { 00110 if (pcurT = SYSCUR(NO)) 00111 zzzSetCursor(pcurT); 00112 break; 00113 } 00114 00115 RtlCopyMemory(lpds + 1, lpds, sizeof(DROPSTRUCT)); 00116 00117 /* 00118 * in screen coordinates 00119 */ 00120 lpds->ptDrop = msg.pt; 00121 00122 pcurT = xxxQueryDropObject(pwndParent, lpds); 00123 00124 /* 00125 * Returning FALSE to a WM_QUERYDROPOBJECT message means drops 00126 * aren't supported and the 'illegal drop target' cursor should be 00127 * displayed. Returning TRUE means the target is valid and the 00128 * regular drag cursor should be displayed. Also, through a bit 00129 * of polymorphic magic one can return a cursor handle to override 00130 * the normal drag cursor. 00131 */ 00132 if (pcurT == (PCURSOR)FALSE) { 00133 pcurT = SYSCUR(NO); 00134 lpds->hwndSink = NULL; 00135 } else if (pcurT == (PCURSOR)TRUE) { 00136 pcurT = pcur; 00137 } 00138 00139 if (pcurT != NULL) 00140 zzzSetCursor(pcurT); 00141 00142 /* 00143 * send the WM_DRAGLOOP after the above zzzSetCursor() to allow the 00144 * receiver to change the cursor at WM_DRAGLOOP time with a zzzSetCursor() 00145 */ 00146 if (pwndFrom) { 00147 xxxSendMessage(pwndFrom, WM_DRAGLOOP, (pcurT != SYSCUR(NO)), 00148 (LPARAM)lpds); 00149 } 00150 00151 /* 00152 * send these messages internally only 00153 */ 00154 if (pwndDragging != RevalidateHwnd(lpds->hwndSink)) { 00155 if (pwndDragging != NULL) { 00156 xxxSendMessage(pwndDragging, WM_DRAGSELECT, FALSE, 00157 (LPARAM)(lpds + 1)); 00158 } 00159 pwndDragging = RevalidateHwnd(lpds->hwndSink); 00160 ThreadUnlock(&tlpwndDragging); 00161 ThreadLockWithPti(pti, pwndDragging, &tlpwndDragging); 00162 00163 if (pwndDragging != NULL) { 00164 xxxSendMessage(pwndDragging, WM_DRAGSELECT, TRUE, (LPARAM)lpds); 00165 } 00166 } else { 00167 if (pwndDragging != NULL) { 00168 xxxSendMessage(pwndDragging, WM_DRAGMOVE, 0, (LPARAM)lpds); 00169 } 00170 } 00171 00172 switch (msg.message) { 00173 case WM_LBUTTONUP: 00174 case WM_NCLBUTTONUP: 00175 fDrag = FALSE; 00176 break; 00177 } 00178 } 00179 00180 ThreadUnlock(&tlpwndDragging); 00181 00182 /* 00183 * If the capture has been lost (i.e. fDrag == TRUE), don't do the drop. 00184 */ 00185 if (fDrag) 00186 pcurT = SYSCUR(NO); 00187 00188 /* 00189 * before the actual drop, clean up the cursor, as the app may do 00190 * stuff here... 00191 */ 00192 xxxReleaseCapture(); 00193 zzzShowCursor(FALSE); 00194 00195 zzzSetCursor(pcurOld); 00196 00197 /* 00198 * we either got lbuttonup or enter 00199 */ 00200 if (pcurT != SYSCUR(NO)) { 00201 00202 /* 00203 * object allows drop... send drop message 00204 */ 00205 pwndT = ValidateHwnd(lpds->hwndSink); 00206 if (pwndT != NULL) { 00207 00208 ThreadLockAlwaysWithPti(pti, pwndT, &tlpwndT); 00209 00210 /* 00211 * Allow this guy to activate. 00212 */ 00213 GETPTI(pwndT)->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 00214 TAGMSG1(DBGTAG_FOREGROUND, "xxxDragObject set TIF %#p", GETPTI(pwndT)); 00215 result = (DWORD)xxxSendMessage(pwndT, WM_DROPOBJECT, 00216 (WPARAM)HW(pwndFrom), (LPARAM)lpds); 00217 00218 ThreadUnlock(&tlpwndT); 00219 } 00220 } 00221 00222 if (FWINABLE()) { 00223 xxxWindowEvent(EVENT_SYSTEM_DRAGDROPEND, pwndFrom, OBJID_WINDOW, INDEXID_CONTAINER, 0); 00224 } 00225 00226 ThreadUnlockAndFreePool(pti, &tlPool); 00227 return result; 00228 }

BOOL xxxDrawAnimatedRects PWND  pwndClip,
int  idAnimation,
LPRECT  lprcStart,
LPRECT  lprcEnd
 

Definition at line 1042 of file minmax.c.

References _GetDCEx(), _GetDesktopWindow(), _ReleaseDC(), BOOL, CheckLock, CopyRect, FALSE, HRGN_FULL, NULL, PWNDDESKTOP, TRUE, and xxxAnimateCaption().

Referenced by NtUserDrawAnimatedRects(), xxxMinimizeHungWindow(), and xxxMinMaximize().

01047 { 01048 HDC hdc; 01049 POINT rgPt[4]; 01050 RECT rcClip; 01051 HRGN hrgn; 01052 PWND pwndAnimate = NULL; 01053 int iPt; 01054 01055 CheckLock(pwndClip); 01056 01057 /* 01058 * Get rects into variables 01059 */ 01060 CopyRect((LPRECT)&rgPt[0], lprcStart); 01061 CopyRect((LPRECT)&rgPt[2], lprcEnd); 01062 01063 /* 01064 * DISABLE OLD ANIMATION FOR M7 01065 */ 01066 if (idAnimation != IDANI_CAPTION) 01067 return TRUE; 01068 01069 pwndAnimate = pwndClip; 01070 if (!pwndAnimate || pwndAnimate == PWNDDESKTOP(pwndAnimate)) 01071 return FALSE; 01072 01073 pwndClip = pwndClip->spwndParent; 01074 if (!pwndClip) { 01075 RIPMSG0(RIP_WARNING, "xxxDrawAnimatedRects: pwndClip->spwndParent is NULL"); 01076 } else if (pwndClip == PWNDDESKTOP(pwndClip)) { 01077 pwndClip = NULL; 01078 } 01079 01080 /* 01081 * NOTE: 01082 * We do NOT need to do LockWindowUpdate(). We never yield within this 01083 * function! Anything that was invalid will stay invalid, etc. So our 01084 * XOR drawing won't leave remnants around. 01085 * 01086 * WIN32NT may need to take display critical section or do LWU(). 01087 * 01088 * Get clipping area 01089 * Neat feature: 01090 * NULL window means whole screen, don't clip out children 01091 * hwndDesktop means working area, don't clip out children 01092 */ 01093 if (pwndClip == NULL) { 01094 pwndClip = _GetDesktopWindow(); 01095 CopyRect(&rcClip, &pwndClip->rcClient); 01096 if ((hrgn = GreCreateRectRgnIndirect(&rcClip)) == NULL) { 01097 hrgn = HRGN_FULL; 01098 } 01099 01100 /* 01101 * Get drawing DC 01102 */ 01103 hdc = _GetDCEx(pwndClip, 01104 hrgn, 01105 DCX_WINDOW | 01106 DCX_CACHE | 01107 DCX_INTERSECTRGN | 01108 DCX_LOCKWINDOWUPDATE); 01109 } else { 01110 01111 hdc = _GetDCEx(pwndClip, 01112 HRGN_FULL, 01113 DCX_WINDOW | DCX_USESTYLE | DCX_INTERSECTRGN); 01114 01115 /* 01116 * We now have a window DC. We need to convert client coords 01117 * to window coords. 01118 */ 01119 for (iPt = 0; iPt < 4; iPt++) { 01120 01121 rgPt[iPt].x += (pwndClip->rcClient.left - pwndClip->rcWindow.left); 01122 rgPt[iPt].y += (pwndClip->rcClient.top - pwndClip->rcWindow.top); 01123 } 01124 } 01125 01126 /* 01127 * Get drawing DC: 01128 * Unclipped if desktop, clipped otherwise. 01129 * Note that ReleaseDC() will free the region if needed. 01130 */ 01131 if (idAnimation == IDANI_CAPTION) { 01132 CheckLock(pwndAnimate); 01133 xxxAnimateCaption(pwndAnimate, hdc, (LPRECT)&rgPt[0], (LPRECT)&rgPt[2]); 01134 } 01135 01136 /* 01137 * DISABLE OLD ANIMATION FOR M7 01138 */ 01139 #if 0 01140 else { 01141 AnimateFrame(hdc, 01142 (LPRECT)&rgPt[0], 01143 (LPRECT)&rgPt[2], 01144 (idAnimation == IDANI_OPEN)); 01145 } 01146 #endif 01147 /* 01148 * END DISABLE OLD ANIMATION FOR M7 01149 */ 01150 01151 /* 01152 * Clean up 01153 */ 01154 _ReleaseDC(hdc); 01155 01156 return TRUE; 01157 }

VOID xxxDrawCaptionBar PWND  pwnd,
HDC  hdc,
UINT  fFlags
 

Definition at line 986 of file caption.c.

References BitBltSysBmp(), CheckLock, ClearHungFlag(), ClrWF, tagOEMBITMAPINFO::cx, tagOEMBITMAPINFO::cy, DF_3DFACE, DF_ACTIVEBORDER, DF_INACTIVEBORDER, DOBI_CAPOFF, DOBI_INACTIVE, DrawEdge(), DrawFrame(), FALSE, GetRect(), GetWindowBorders(), gpsi, GRECT_WINDOW, GRECT_WINDOWCOORDS, HDCBITS, HEBREW_UI_LANGID, InflateRect(), IsVisible(), MAX, MIN, NOCLOSE, NOMAX, NOMIN, NOSIZE, NULL, OBI_CAPBTNS, OBI_CLOSE, OBI_CLOSE_PAL, OBI_HELP, OBI_REDUCE, OBI_REDUCE_I, OBI_RESTORE, OBI_ZOOM, OBI_ZOOM_I, SetWF, SMCAP, SYSHBR, SYSHBRUSH, SYSMET, TestALPHA, TestWF, TRUE, UINT, VOID(), WEFCONTEXTHELP, WEFDLGMODALFRAME, WEFEDGEMASK, WEFSTATICEDGE, WEFTOOLWINDOW, WEFTRUNCATEDCAPTION, WEFWINDOWEDGE, WFBORDERMASK, WFCPRESENT, WFMAXBOX, WFMAXIMIZED, WFMINBOX, WFMINIMIZED, WFOLDUI, WFREDRAWFRAMEIFHUNG, WFSIZEBOX, WFSYSMENU, WFWIN40COMPAT, tagOEMBITMAPINFO::x, xxxDrawCaptionTemp(), xxxMNCanClose(), and tagOEMBITMAPINFO::y.

Referenced by xxxDrawWindowFrame(), xxxDWP_DoNCActivate(), xxxRedrawHungWindowFrame(), and xxxRedrawTitle().

00990 { 00991 UINT bm = OBI_CLOSE; 00992 RECT rcWindow; 00993 HBRUSH hBrush = NULL; 00994 HBRUSH hCapBrush; 00995 int colorBorder; 00996 UINT wBtns; 00997 UINT wCode; 00998 00999 CheckLock(pwnd); 01000 01001 /* 01002 * If we're not currently showing on the screen, return. 01003 * NOTE 01004 * If you remove the IsVisible() check from DrawWindowFrame(), then 01005 * be careful to remove the NC_NOVISIBLE flag too. This is a smallish 01006 * speed thing, so that we don't have to call IsVisible() twice on a 01007 * window. DrawWindowFrame() already checks. 01008 */ 01009 if (!(wFlags & DC_NOVISIBLE) && !IsVisible(pwnd)) 01010 return; 01011 01012 /* 01013 * Clear this flag so we know the frame has been drawn. 01014 */ 01015 ClearHungFlag(pwnd, WFREDRAWFRAMEIFHUNG); 01016 01017 GetRect(pwnd, &rcWindow, GRECT_WINDOW | GRECT_WINDOWCOORDS); 01018 if (TestALPHA(GRADIENTCAPTIONS)) { 01019 hCapBrush = (wFlags & DC_ACTIVE) ? SYSHBR(GRADIENTACTIVECAPTION) : SYSHBR(GRADIENTINACTIVECAPTION); 01020 } else { 01021 hCapBrush = (wFlags & DC_ACTIVE) ? SYSHBR(ACTIVECAPTION) : SYSHBR(INACTIVECAPTION); 01022 } 01023 01024 wCode = 0; 01025 01026 if (!xxxMNCanClose(pwnd)) 01027 wCode |= NOCLOSE; 01028 01029 if (!TestWF(pwnd, WFMAXBOX)) 01030 wCode |= NOMAX; 01031 else if (TestWF(pwnd, WFMAXIMIZED)) 01032 wCode |= MAX; 01033 01034 if (!TestWF(pwnd, WFMINBOX)) 01035 wCode |= NOMIN; 01036 else if(TestWF(pwnd, WFMINIMIZED)) 01037 wCode |= MIN; 01038 01039 if (TestWF(pwnd, WFMINIMIZED)) { 01040 01041 if (wFlags & DC_FRAME) { 01042 01043 /* 01044 * Raised outer edge + border 01045 */ 01046 DrawEdge(hdc, &rcWindow, EDGE_RAISED, (BF_RECT | BF_ADJUST)); 01047 DrawFrame(hdc, &rcWindow, 1, DF_3DFACE); 01048 InflateRect(&rcWindow, -SYSMET(CXBORDER), -SYSMET(CYBORDER)); 01049 01050 } else { 01051 InflateRect(&rcWindow, -SYSMET(CXFIXEDFRAME), -SYSMET(CYFIXEDFRAME)); 01052 } 01053 01054 rcWindow.bottom = rcWindow.top + SYSMET(CYSIZE); 01055 01056 hBrush = GreSelectBrush(hdc, hCapBrush); 01057 01058 } else { 01059 /* 01060 * BOGUS 01061 * What color should we draw borders in? The check is NOT simple. 01062 * At create time, we set the 3D bits. NCCREATE will also 01063 * set them for listboxes, edit fields,e tc. 01064 */ 01065 colorBorder = (TestWF(pwnd, WEFEDGEMASK) && !TestWF(pwnd, WFOLDUI)) ? COLOR_3DFACE : COLOR_WINDOWFRAME; 01066 01067 /* 01068 * Draw the window frame. 01069 */ 01070 if (wFlags & DC_FRAME) { 01071 /* 01072 * Window edge 01073 */ 01074 if (TestWF(pwnd, WEFWINDOWEDGE)) 01075 DrawEdge(hdc, &rcWindow, EDGE_RAISED, BF_RECT | BF_ADJUST); 01076 else if (TestWF(pwnd, WEFSTATICEDGE)) 01077 DrawEdge(hdc, &rcWindow, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 01078 01079 /* 01080 * Size border 01081 */ 01082 if (TestWF(pwnd, WFSIZEBOX)) { 01083 01084 DrawFrame(hdc, 01085 &rcWindow, 01086 gpsi->gclBorder, 01087 ((wFlags & DC_ACTIVE) ? DF_ACTIVEBORDER : DF_INACTIVEBORDER)); 01088 01089 InflateRect(&rcWindow, 01090 -gpsi->gclBorder * SYSMET(CXBORDER), 01091 -gpsi->gclBorder * SYSMET(CYBORDER)); 01092 } 01093 01094 /* 01095 * Normal border 01096 */ 01097 if (TestWF(pwnd, WFBORDERMASK) || TestWF(pwnd, WEFDLGMODALFRAME)) { 01098 DrawFrame(hdc, &rcWindow, 1, (colorBorder << 3)); 01099 InflateRect(&rcWindow, -SYSMET(CXBORDER), -SYSMET(CYBORDER)); 01100 } 01101 } else { 01102 01103 int cBorders; 01104 01105 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 01106 01107 InflateRect(&rcWindow, 01108 -cBorders * SYSMET(CXBORDER), 01109 -cBorders * SYSMET(CYBORDER)); 01110 } 01111 01112 /* 01113 * Punt if the window doesn't have a caption currently showing on screen. 01114 */ 01115 if (!TestWF(pwnd, WFCPRESENT)) 01116 return; 01117 01118 if (TestWF(pwnd, WEFTOOLWINDOW)) { 01119 wCode |= SMCAP; 01120 rcWindow.bottom = rcWindow.top + SYSMET(CYSMSIZE); 01121 bm = OBI_CLOSE_PAL; 01122 } else 01123 rcWindow.bottom = rcWindow.top + SYSMET(CYSIZE); 01124 01125 #if 0 01126 /* Draw the border beneath the caption. 01127 * 01128 * 01129 * hBrush = GreSelectBrush(hdc, gpsi->ahbrSystem[colorBorder]); 01130 *GrePatBlt(hdc, rcWindow.left, rcWindow.bottom, 01131 * rcWindow.right - rcWindow.left, 01132 * SYSMET(CYBORDER), PATCOPY); 01133 */ 01134 #endif 01135 01136 { 01137 POLYPATBLT PolyData; 01138 01139 PolyData.x = rcWindow.left; 01140 PolyData.y = rcWindow.bottom; 01141 PolyData.cx = rcWindow.right - rcWindow.left; 01142 PolyData.cy = SYSMET(CYBORDER); 01143 PolyData.BrClr.hbr = SYSHBRUSH(colorBorder); 01144 01145 GrePolyPatBlt(hdc,PATCOPY,&PolyData,1,PPB_BRUSH); 01146 } 01147 01148 GreSelectBrush(hdc, hCapBrush); 01149 } 01150 01151 if (!TestWF(pwnd, WFSYSMENU) && TestWF(pwnd, WFWIN40COMPAT)) 01152 goto JustDrawIt; 01153 01154 /* 01155 * New Rules: 01156 * (1) The caption has a horz border beneath it separating it from the 01157 * menu or client. 01158 * (2) The caption text area has an edge of space on the left and right 01159 * before the characters. 01160 * (3) We account for the descent below the baseline of the caption char 01161 */ 01162 wBtns = 1; 01163 01164 if (!(wFlags & DC_BUTTONS)) { 01165 01166 if ((!wCode) || (!(wCode & SMCAP) && ((wCode & NOSIZE) != NOSIZE))) { 01167 01168 wBtns += 2; 01169 01170 } else { 01171 01172 rcWindow.right -= SYSMET(CXEDGE); 01173 01174 if ((wCode == NOSIZE) && (wCode && TestWF(pwnd, WEFCONTEXTHELP))) 01175 wBtns++; 01176 } 01177 01178 rcWindow.right -= wBtns * ((wCode & SMCAP) ? SYSMET(CXSMSIZE) : SYSMET(CXSIZE)); 01179 01180 goto JustDrawIt; 01181 } 01182 01183 if (!wCode || (wCode == NOSIZE)) { 01184 POEMBITMAPINFO pOem = gpsi->oembmi + OBI_CAPBTNS; 01185 int cx; 01186 01187 cx = (wCode ? SYSMET(CXSIZE) + SYSMET(CXEDGE) : SYSMET(CXSIZE) * 3); 01188 01189 if (!(wFlags & DC_ACTIVE)) 01190 pOem += DOBI_CAPOFF; 01191 01192 rcWindow.right -= cx; 01193 01194 GreBitBlt(hdc, 01195 rcWindow.right, 01196 rcWindow.top, 01197 cx, 01198 pOem->cy, 01199 HDCBITS(), 01200 pOem->x + pOem->cx - SYSMET(CXSIZE) - cx, 01201 pOem->y, 01202 SRCCOPY, 01203 0); 01204 01205 if (wCode && TestWF(pwnd, WEFCONTEXTHELP)) { 01206 01207 rcWindow.right -= SYSMET(CXSIZE) - SYSMET(CXEDGE); 01208 01209 GreBitBlt(hdc, 01210 rcWindow.right, 01211 rcWindow.top, 01212 SYSMET(CXSIZE), 01213 pOem->cy, 01214 HDCBITS(), 01215 pOem->x + pOem->cx - SYSMET(CXSIZE), 01216 pOem->y, 01217 SRCCOPY, 01218 0); 01219 #ifdef USE_MIRRORING 01220 /* 01221 * If the UI language is Hebrew we do not want to mirror the ? mark only 01222 * Then redraw ? with out the button frame. 01223 */ 01224 if (HEBREW_UI_LANGID() && TestWF(pwnd, WEFLAYOUTRTL)) { 01225 GreBitBlt(hdc, 01226 rcWindow.right-SYSMET(CXEDGE), 01227 rcWindow.top+2, 01228 SYSMET(CXSIZE)-SYSMET(CXEDGE)*2, 01229 pOem->cy-4, 01230 HDCBITS(), 01231 pOem->x + pOem->cx - SYSMET(CXSIZE) + SYSMET(CXEDGE), 01232 pOem->y + SYSMET(CXEDGE), 01233 SRCCOPY|NOMIRRORBITMAP, 01234 0); 01235 } 01236 #endif 01237 } 01238 goto JustDrawIt; 01239 } 01240 01241 /* 01242 * Draw the caption buttons 01243 */ 01244 rcWindow.top += SYSMET(CYEDGE); 01245 rcWindow.bottom -= SYSMET(CYEDGE); 01246 01247 rcWindow.right -= SYSMET(CXEDGE); 01248 01249 GrePatBlt(hdc, 01250 rcWindow.right, 01251 rcWindow.top, 01252 SYSMET(CXEDGE), 01253 rcWindow.bottom - rcWindow.top, 01254 PATCOPY); 01255 01256 if (wCode & NOCLOSE) { 01257 bm += DOBI_INACTIVE; 01258 } 01259 01260 rcWindow.right -= gpsi->oembmi[bm].cx; 01261 BitBltSysBmp(hdc, rcWindow.right, rcWindow.top, bm); 01262 01263 if (!(wCode & SMCAP) && ((wCode & NOSIZE) != NOSIZE)) { 01264 01265 rcWindow.right -= SYSMET(CXEDGE); 01266 01267 GrePatBlt(hdc, 01268 rcWindow.right, 01269 rcWindow.top, 01270 SYSMET(CXEDGE), 01271 rcWindow.bottom - rcWindow.top, 01272 PATCOPY); 01273 01274 /* 01275 * Max Box 01276 * If window is maximized use the restore bitmap; 01277 * otherwise use the regular zoom bitmap 01278 */ 01279 bm = (wCode & MAX) ? OBI_RESTORE : ((wCode & NOMAX) ? OBI_ZOOM_I : OBI_ZOOM); 01280 rcWindow.right -= gpsi->oembmi[bm].cx; 01281 BitBltSysBmp(hdc, rcWindow.right, rcWindow.top, bm); 01282 01283 /* 01284 * Min Box 01285 */ 01286 bm = (wCode & MIN) ? OBI_RESTORE : ((wCode & NOMIN) ? OBI_REDUCE_I : OBI_REDUCE); 01287 rcWindow.right -= gpsi->oembmi[bm].cx; 01288 BitBltSysBmp(hdc, rcWindow.right, rcWindow.top, bm); 01289 rcWindow.right -= SYSMET(CXEDGE); 01290 GrePatBlt(hdc, 01291 rcWindow.right, 01292 rcWindow.top, 01293 SYSMET(CXEDGE), 01294 rcWindow.bottom - rcWindow.top, 01295 PATCOPY); 01296 01297 wBtns += 2; 01298 } 01299 01300 if ((wCode & (NOCLOSE | NOSIZE)) && 01301 (!(wCode & SMCAP)) && TestWF(pwnd, WEFCONTEXTHELP)) { 01302 01303 rcWindow.right -= SYSMET(CXEDGE); 01304 01305 GrePatBlt(hdc, 01306 rcWindow.right, 01307 rcWindow.top, 01308 SYSMET(CXEDGE), 01309 rcWindow.bottom - rcWindow.top, 01310 PATCOPY); 01311 01312 01313 bm = OBI_HELP; 01314 rcWindow.right -= gpsi->oembmi[bm].cx; 01315 BitBltSysBmp(hdc, rcWindow.right, rcWindow.top, bm); 01316 01317 wBtns++; 01318 } 01319 01320 rcWindow.top -= SYSMET(CYEDGE); 01321 rcWindow.bottom += SYSMET(CYEDGE); 01322 01323 wBtns *= (wCode & SMCAP) ? SYSMET(CXSMSIZE) : SYSMET(CXSIZE); 01324 01325 { 01326 POLYPATBLT PolyData[2]; 01327 01328 PolyData[0].x = rcWindow.right; 01329 PolyData[0].y = rcWindow.top; 01330 PolyData[0].cx = wBtns; 01331 PolyData[0].cy = SYSMET(CYEDGE); 01332 PolyData[0].BrClr.hbr = NULL; 01333 01334 PolyData[1].x = rcWindow.right; 01335 PolyData[1].y = rcWindow.bottom - SYSMET(CYEDGE); 01336 PolyData[1].cx = wBtns; 01337 PolyData[1].cy = SYSMET(CYEDGE); 01338 PolyData[1].BrClr.hbr = NULL; 01339 01340 GrePolyPatBlt(hdc,PATCOPY,&PolyData[0],2,PPB_BRUSH); 01341 } 01342 01343 #if 0 01344 GrePatBlt(hdc, rcWindow.right, rcWindow.top, wBtns, SYSMET(CYEDGE), PATCOPY); 01345 GrePatBlt(hdc, rcWindow.right, rcWindow.bottom - SYSMET(CYEDGE), wBtns, SYSMET(CYEDGE), PATCOPY); 01346 #endif 01347 01348 /* 01349 * We're going to release this DC--we don't need to bother reselecting 01350 * in the old brush 01351 */ 01352 if (hBrush) 01353 GreSelectBrush(hdc, hBrush); 01354 01355 JustDrawIt: 01356 01357 /* 01358 * Call DrawCaption only if we need to draw the icon or the text 01359 * If the text gets truncated, set the window flag for 01360 * the caption tooltip 01361 */ 01362 if (wFlags & (DC_TEXT | DC_ICON)) { 01363 if (!xxxDrawCaptionTemp(pwnd, 01364 hdc, 01365 &rcWindow, 01366 NULL, 01367 NULL, 01368 NULL, 01369 wFlags | ((wCode & SMCAP) ? DC_SMALLCAP : 0) | 01370 (TestALPHA(GRADIENTCAPTIONS) ? DC_GRADIENT : 0))) { 01371 SetWF(pwnd, WEFTRUNCATEDCAPTION); 01372 } else { 01373 ClrWF(pwnd, WEFTRUNCATEDCAPTION); 01374 } 01375 } 01376 }

BOOL xxxDrawCaptionTemp PWND  pwnd,
HDC  hdc,
LPRECT  lprc,
HFONT  hFont,
PCURSOR  pcursor,
PUNICODE_STRING pstrText  OPTIONAL,
UINT  flags
 

Definition at line 688 of file caption.c.

References _GetTextMetricsW(), _HasCaptionIcon(), BOOL, CALL_LPK, CCHTITLEMAX, CheckLock, DrawCaptionIcon(), DWORD, FALSE, FillCaptionGradient(), FillRect(), gcyCaptionFontChar, gcySmCaptionFontChar, ghSmCaptionFont, gpsi, GreGetTextAlign(), GreSetTextAlign(), L, _LARGE_UNICODE_STRING::Length, NULL, PtiCurrentShared, tagWND::strName, SYSHBR, SYSMET, SYSRGB, TestWF, TextCopy(), TRUE, UINT, USHORT, WEFRIGHT, WEFRTLREADING, WFSYSMENU, WINDOW, xxxClientExtTextOutW(), xxxClientGetTextExtentPointW(), xxxGetWindowSmIcon(), and xxxGetWindowText().

Referenced by NtUserDrawCaption(), NtUserDrawCaptionTemp(), xxxAnimateCaption(), and xxxDrawCaptionBar().

00696 { 00697 int iOldMode; 00698 HBRUSH hbrFill; 00699 LONG clrOldText; 00700 LONG clrOldBk; 00701 BOOL fItFit = TRUE; 00702 BOOL fGradient = FALSE; 00703 SIZE size; 00704 UINT oldAlign; 00705 00706 CheckLock(pwnd); 00707 00708 if (lprc->right <= lprc->left) 00709 return FALSE; 00710 00711 if (pwnd != NULL) { 00712 00713 if (!pcursor && 00714 _HasCaptionIcon(pwnd) && 00715 !(flags & DC_SMALLCAP) && 00716 TestWF(pwnd, WFSYSMENU)) { 00717 00718 /* 00719 * Only get the icon if we can send messages AND the window has 00720 * a system menu. 00721 */ 00722 pcursor = xxxGetWindowSmIcon(pwnd, (flags & DC_NOSENDMSG)); 00723 } 00724 } 00725 00726 /* 00727 * Set up the colors 00728 */ 00729 if (flags & DC_ACTIVE) { 00730 00731 if (flags & DC_INBUTTON) { 00732 if (gpsi->BitCount < 8 || 00733 SYSRGB(3DHILIGHT) != SYSRGB(SCROLLBAR) || 00734 SYSRGB(3DHILIGHT) == SYSRGB(WINDOW)) { 00735 clrOldText = SYSRGB(3DFACE); 00736 clrOldBk = SYSRGB(3DHILIGHT); 00737 hbrFill = gpsi->hbrGray; 00738 iOldMode = GreSetBkMode(hdc, TRANSPARENT); 00739 } else { 00740 clrOldText = SYSRGB(BTNTEXT); 00741 clrOldBk = SYSRGB(3DHILIGHT); 00742 hbrFill = SYSHBR(3DHILIGHT); 00743 } 00744 00745 } else { 00746 clrOldText = SYSRGB(CAPTIONTEXT); 00747 clrOldBk = SYSRGB(ACTIVECAPTION); 00748 hbrFill = SYSHBR(ACTIVECAPTION); 00749 00750 if (flags & DC_GRADIENT) { 00751 fGradient = TRUE; 00752 iOldMode = GreSetBkMode(hdc, TRANSPARENT); 00753 } 00754 } 00755 00756 } else { 00757 00758 if (flags & DC_INBUTTON) { 00759 clrOldText = SYSRGB(BTNTEXT); 00760 clrOldBk = SYSRGB(3DFACE); 00761 hbrFill = SYSHBR(3DFACE); 00762 } else { 00763 clrOldText = SYSRGB(INACTIVECAPTIONTEXT); 00764 clrOldBk = SYSRGB(INACTIVECAPTION); 00765 hbrFill = SYSHBR(INACTIVECAPTION); 00766 00767 if (flags & DC_GRADIENT) { 00768 fGradient = TRUE; 00769 iOldMode = GreSetBkMode(hdc, TRANSPARENT); 00770 } 00771 } 00772 } 00773 00774 00775 /* 00776 * Set up drawing colors. 00777 */ 00778 clrOldText = GreSetTextColor(hdc, clrOldText); 00779 clrOldBk = GreSetBkColor(hdc, clrOldBk); 00780 00781 if (pcursor && !(flags & DC_SMALLCAP)) { 00782 00783 if (flags & DC_ICON) { 00784 #ifdef USE_MIRRORING 00785 /* 00786 * Preserve icon shape when BitBlitting it to a 00787 * mirrored DC. This way we don't violate copyright 00788 * issues on icons. [samera] 00789 */ 00790 DWORD dwLayout=0L; 00791 if ((dwLayout=GreGetLayout(hdc)) & LAYOUT_RTL) 00792 GreSetLayout(hdc, -1, dwLayout|LAYOUT_BITMAPORIENTATIONPRESERVED); 00793 #endif 00794 DrawCaptionIcon(hdc, lprc, pcursor, hbrFill, flags); 00795 00796 #ifdef USE_MIRRORING 00797 /* 00798 * Restore the DC to its previous layout state. 00799 */ 00800 if (dwLayout & LAYOUT_RTL) 00801 GreSetLayout(hdc, -1, dwLayout); 00802 #endif 00803 00804 } else { 00805 lprc->left += lprc->bottom - lprc->top; 00806 } 00807 } 00808 00809 if (flags & DC_TEXT) { 00810 int cch; 00811 HFONT hfnOld; 00812 int yCentered; 00813 WCHAR szText[CCHTITLEMAX]; 00814 UNICODE_STRING strTmp; 00815 PTHREADINFO ptiCurrent = PtiCurrentShared(); 00816 00817 /* 00818 * Note -- the DC_NOSENDMSG check is not in Chicago. It needs to be, 00819 * since GetWindowText calls back to the window. FritzS 00820 */ 00821 00822 /* 00823 * Get the text for the caption. 00824 */ 00825 if (pstrText == NULL) { 00826 00827 if ((pwnd == NULL) || (flags & DC_NOSENDMSG)) { 00828 00829 if (pwnd && pwnd->strName.Length) { 00830 cch = TextCopy(&pwnd->strName, szText, CCHTITLEMAX - 1); 00831 strTmp.Length = (USHORT)(cch * sizeof(WCHAR)); 00832 } else { 00833 szText[0] = TEXT('\0'); 00834 cch = strTmp.Length = 0; 00835 } 00836 00837 } else { 00838 cch = xxxGetWindowText(pwnd, szText, CCHTITLEMAX - 1); 00839 strTmp.Length = (USHORT)(cch * sizeof(WCHAR)); 00840 } 00841 00842 /* 00843 * We don't use RtlInitUnicodeString() to initialize the string 00844 * because it does a wstrlen() on the string, which is a waste 00845 * since we already know its length. 00846 */ 00847 strTmp.Buffer = szText; 00848 strTmp.MaximumLength = strTmp.Length + sizeof(UNICODE_NULL); 00849 pstrText = &strTmp; 00850 00851 } else { 00852 cch = pstrText->Length / sizeof(WCHAR); 00853 UserAssert(pstrText->Length < pstrText->MaximumLength); 00854 UserAssert(pstrText->Buffer[cch] == 0); 00855 } 00856 00857 /* 00858 * We need to set up font first, in case we're centering caption. 00859 * Fortunately, no text at all is uncommon... 00860 */ 00861 if (hFont == NULL) { 00862 00863 if (flags & DC_SMALLCAP) { 00864 hFont = ghSmCaptionFont; 00865 yCentered = gcySmCaptionFontChar; 00866 } else { 00867 hFont = gpsi->hCaptionFont; 00868 yCentered = gcyCaptionFontChar; 00869 } 00870 00871 yCentered = (lprc->top + lprc->bottom - yCentered) / 2; 00872 00873 hfnOld = GreSelectFont(hdc, hFont); 00874 00875 } else { 00876 00877 TEXTMETRICW tm; 00878 00879 /* 00880 * UNCOMMON case: only for control panel 00881 */ 00882 hfnOld = GreSelectFont(hdc, hFont); 00883 00884 if (!_GetTextMetricsW(hdc, &tm)) { 00885 RIPMSG0(RIP_WARNING, "xxxDrawCaptionTemp: _GetTextMetricsW Failed"); 00886 tm.tmHeight = gpsi->tmSysFont.tmHeight; 00887 } 00888 yCentered = (lprc->top + lprc->bottom - tm.tmHeight) / 2; 00889 } 00890 00891 /* 00892 * Draw text 00893 */ 00894 if (fGradient) { 00895 FillCaptionGradient(hdc, lprc, flags & DC_ACTIVE); 00896 } else { 00897 FillRect(hdc, lprc, hbrFill); 00898 } 00899 00900 if (hbrFill == gpsi->hbrGray) { 00901 GreSetTextColor(hdc, SYSRGB(BTNTEXT)); 00902 GreSetBkColor(hdc, SYSRGB(GRAYTEXT)); 00903 } 00904 00905 /* 00906 * GDI doesn't do callbacks to the LPK. If an LPK is installed 00907 * and we're not in thread cleanup mode, call the appropriate 00908 * client side GDI routines. 00909 */ 00910 if (CALL_LPK(ptiCurrent)) { 00911 xxxClientGetTextExtentPointW(hdc, pstrText->Buffer, cch, &size); 00912 } else { 00913 GreGetTextExtentW(hdc, pstrText->Buffer, cch, &size, GGTE_WIN3_EXTENT); 00914 } 00915 00916 if (pwnd && TestWF(pwnd, WEFRTLREADING)) { 00917 oldAlign = GreSetTextAlign(hdc, TA_RTLREADING | GreGetTextAlign(hdc)); 00918 } 00919 if (!(flags & DC_CENTER) && (!cch || (size.cx <= (lprc->right - lprc->left - SYSMET(CXEDGE))))) { 00920 if (pwnd && TestWF(pwnd, WEFRIGHT)) { 00921 if (CALL_LPK(ptiCurrent)) { 00922 xxxClientExtTextOutW(hdc, lprc->right - (size.cx + SYSMET(CXEDGE)), yCentered, 00923 ETO_CLIPPED, lprc, pstrText->Buffer, cch, NULL); 00924 } 00925 else { 00926 GreExtTextOutW(hdc, lprc->right - (size.cx + SYSMET(CXEDGE)), yCentered, 00927 ETO_CLIPPED, lprc, pstrText->Buffer, cch, NULL); 00928 } 00929 } else { 00930 if (CALL_LPK(ptiCurrent)) { 00931 xxxClientExtTextOutW(hdc, lprc->left + SYSMET(CXEDGE), yCentered, 00932 ETO_CLIPPED, lprc, pstrText->Buffer, cch, NULL); 00933 } 00934 else { 00935 GreExtTextOutW(hdc, lprc->left + SYSMET(CXEDGE), yCentered, 00936 ETO_CLIPPED, lprc, pstrText->Buffer, cch, NULL); 00937 } 00938 } 00939 } else { 00940 00941 DRAWTEXTPARAMS dtp; 00942 UINT wSide; 00943 00944 dtp.cbSize = sizeof(DRAWTEXTPARAMS); 00945 dtp.iLeftMargin = SYSMET(CXEDGE); 00946 dtp.iRightMargin = 0; 00947 00948 wSide = (flags & DC_CENTER) ? DT_CENTER 00949 : ((pwnd && TestWF(pwnd, WEFRIGHT)) ? DT_RIGHT : 0); 00950 00951 DrawTextEx(hdc, 00952 pstrText->Buffer, 00953 cch, 00954 lprc, 00955 DT_NOPREFIX | DT_END_ELLIPSIS | DT_SINGLELINE | DT_VCENTER | 00956 wSide, &dtp); 00957 00958 fItFit = FALSE; 00959 } 00960 00961 if (pwnd && TestWF(pwnd, WEFRTLREADING)) 00962 GreSetTextAlign(hdc, oldAlign); 00963 00964 if (hfnOld) 00965 GreSelectFont(hdc, hfnOld); 00966 } 00967 00968 /* 00969 * Restore colors 00970 */ 00971 GreSetTextColor(hdc, clrOldText); 00972 GreSetBkColor(hdc, clrOldBk); 00973 00974 if (hbrFill == gpsi->hbrGray) 00975 GreSetBkMode(hdc, iOldMode); 00976 00977 return fItFit; 00978 }

void xxxDrawDragRect PMOVESIZEDATA  pmsd,
LPRECT  lprc,
UINT  flags
 

Definition at line 1562 of file movesize.c.

References _GetDCEx(), _ReleaseDC(), _ScreenToClient(), CheckLock, CopyRect, DDR_START, EqualRect, _MOVESIZEDATA::fDragFullWindows, _MOVESIZEDATA::fForeground, FindSpb(), FreeSpb(), FTopLevel, GETPTI, gpDispInfo, gpsi, tagDISPLAYINFO::hDev, HRGN_FULL, tagWND::hrgnClip, IntersectRect(), IntersectRgn, NULL, tagTHREADINFO::pmsd, PtiCurrent, PWNDDESKTOP, _MOVESIZEDATA::rcDrag, _MOVESIZEDATA::rcParent, tagWND::rcWindow, _MOVESIZEDATA::spwnd, tagWND::spwndParent, SubtractRgn, TestWF, ThreadLock, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_MOVESIZETRACKING, type, VOID(), WFHASSPB, WFMINIMIZED, WFSIZEBOX, xxxSetWindowPos(), and xxxUpdateThreadsWindows().

Referenced by xxxCancelTrackingForThread(), xxxMoveSize(), xxxMS_TrackMove(), xxxReleaseCapture(), xxxTM_MoveDragRect(), and xxxTrackInitSize().

01566 { 01567 HDC hdc; 01568 int lvBorder; 01569 HRGN hrgnClip; 01570 01571 /* 01572 * If we're dragging an icon, or we're not foreground, don't draw 01573 * the dragging rect. 01574 */ 01575 if (!pmsd->fForeground) { 01576 01577 if (lprc != NULL) 01578 CopyRect(&pmsd->rcDrag, lprc); 01579 01580 return; 01581 } 01582 01583 /* 01584 * If it already equals, just return. 01585 */ 01586 if ((lprc != NULL) && EqualRect(&pmsd->rcDrag, lprc)) 01587 return; 01588 01589 if (!(pmsd->fDragFullWindows)) { 01590 01591 /* 01592 * If we were not able to lock the screen (because some other process 01593 * or thread had the screen locked), then get a dc but make sure 01594 * it is totally clipped to nothing. 01595 * NO longer a posibility 01596 */ 01597 01598 /* 01599 * Clip to client rect of parent. (Client given in screen coords.) 01600 */ 01601 hrgnClip = GreCreateRectRgnIndirect(&pmsd->rcParent); 01602 01603 /* 01604 * Clip to the parent's window clipping rgn if it has one. 01605 */ 01606 if (hrgnClip != NULL && pmsd->spwnd->spwndParent->hrgnClip != NULL) 01607 IntersectRgn(hrgnClip, 01608 hrgnClip, 01609 pmsd->spwnd->spwndParent->hrgnClip); 01610 01611 if (hrgnClip == NULL) 01612 hrgnClip = HRGN_FULL; 01613 01614 /* 01615 * If lprc == NULL, just draw rcDrag once. If lprc != NULL, 01616 * undraw *lprc, draw rcDrag, copy in *lprc. 01617 */ 01618 01619 /* 01620 * Use size 1 for minimized or non-sizeable windows. Otherwise 01621 * use the # of borders (2 for outer edge, 1 for border, clBorder for 01622 * size border. 01623 */ 01624 if (TestWF(pmsd->spwnd, WFMINIMIZED) || !TestWF(pmsd->spwnd, WFSIZEBOX)) 01625 lvBorder = 1; 01626 else 01627 lvBorder = 3 + gpsi->gclBorder; 01628 01629 /* 01630 * Get a screen DC clipped to the parent, select in a gray brush. 01631 */ 01632 hdc = _GetDCEx( 01633 PWNDDESKTOP(pmsd->spwnd), 01634 hrgnClip, 01635 DCX_WINDOW | DCX_CACHE | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE); 01636 01637 if (lprc != NULL) { 01638 01639 /* 01640 * Move the frame to a new location by delta drawing 01641 */ 01642 GreLockDisplay(gpDispInfo->hDev); 01643 bMoveDevDragRect(gpDispInfo->hDev, (PRECTL) lprc); 01644 CopyRect(&pmsd->rcDrag, lprc); 01645 GreUnlockDisplay(gpDispInfo->hDev); 01646 01647 } else { 01648 01649 if (type == DDR_START) { 01650 bSetDevDragRect(gpDispInfo->hDev, 01651 (PRECTL)&pmsd->rcDrag, 01652 (PRECTL)&pmsd->rcParent); 01653 } 01654 } 01655 01656 /* 01657 * Release the DC & delete hrgnClip 01658 */ 01659 _ReleaseDC(hdc); 01660 01661 } else { 01662 01663 RECT rcSWP; 01664 HRGN hrgnFullDragNew; 01665 HRGN hrgnFullDragOld; 01666 PTHREADINFO ptiCancel = GETPTI(pmsd->spwnd); 01667 PTHREADINFO ptiCurrent = PtiCurrent(); 01668 PWND pwnd; 01669 TL tlpwnd; 01670 01671 #if DBG 01672 /* 01673 * If ptiCancel != ptiCurrent, we must have come from xxxCancelTracking, 01674 * which has already locked ptiCancel. 01675 */ 01676 if (ptiCancel != ptiCurrent) { 01677 CheckLock(ptiCancel); 01678 } 01679 #endif 01680 01681 /* 01682 * To prevent applications (like Micrografx Draw) from doing 01683 * a PeekMessage loop and getting the mouse move messages that 01684 * are destined for the xxxMoveSize PeekMessage loop, we OR in 01685 * this flag. See comments in input.c for xxxInternalGetMessage. 01686 */ 01687 ptiCancel->TIF_flags |= TIF_MOVESIZETRACKING; 01688 01689 if (lprc != NULL) 01690 CopyRect(&(pmsd->rcDrag), lprc); 01691 01692 CopyRect(&rcSWP, &(pmsd->rcDrag)); 01693 01694 /* 01695 * Convert coordinates to client if the window is a child window or 01696 * if it's a popup-with parent. The test for the popup is necessary 01697 * to solve a problem where a popup was assigned a parent of a MDI- 01698 * CLIENT window. 01699 */ 01700 if (pmsd->spwnd->spwndParent != NULL && !FTopLevel(pmsd->spwnd)) { 01701 _ScreenToClient(pmsd->spwnd->spwndParent, (LPPOINT)&rcSWP); 01702 _ScreenToClient(pmsd->spwnd->spwndParent, ((LPPOINT)&rcSWP)+1); 01703 01704 #if defined(USE_MIRRORING) 01705 // 01706 // If the parent of this window is mirrored, then mirror the 01707 // rectangle coordinates so that child MDI windows work 01708 // properly 01709 // 01710 if( TestWF(pmsd->spwnd->spwndParent,WEFLAYOUTRTL) ) 01711 { 01712 int iLeft = rcSWP.left; 01713 rcSWP.left = rcSWP.right; 01714 rcSWP.right = iLeft; 01715 } 01716 #endif 01717 } 01718 01719 /* 01720 * Don't bother being optimal here. There's one case where we 01721 * really shouldn't blow away the SPB--the window is being sized 01722 * bigger. We do want to do this when moving or sizing the window 01723 * smaller. Why bother detecting the first case? 01724 */ 01725 if (TestWF(pmsd->spwnd, WFHASSPB)){ 01726 01727 PSPB pspb; 01728 RECT rc; 01729 01730 /* 01731 * If we're intersecting the original window rect and the window 01732 * has an SPB saved onboard, then just free it. Otherwise the 01733 * window will move, the entire SPB will blt over it, we'll 01734 * invalidate the intersection, and the window will repaint, 01735 * causing mad flicker. 01736 */ 01737 pspb = FindSpb(pmsd->spwnd); 01738 01739 CopyRect(&rc, &pmsd->spwnd->rcWindow); 01740 if (lprc && IntersectRect(&rc, &rc, lprc)){ 01741 FreeSpb(pspb); 01742 } 01743 } 01744 01745 hrgnFullDragOld = GreCreateRectRgnIndirect(&pmsd->spwnd->rcWindow); 01746 01747 if (pmsd->spwnd->hrgnClip != NULL) 01748 IntersectRgn(hrgnFullDragOld, 01749 hrgnFullDragOld, 01750 pmsd->spwnd->hrgnClip); 01751 01752 xxxSetWindowPos(pmsd->spwnd, 01753 NULL, 01754 rcSWP.left, rcSWP.top, 01755 rcSWP.right-rcSWP.left, rcSWP.bottom-rcSWP.top, 01756 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOOWNERZORDER); 01757 01758 /* 01759 * We locked ptiCancel, so ptiCancel->pmsd has not been unexpectedly 01760 * freed in DeleteThreadInfo(), but xxxMoveSize() may have terminated 01761 * during our callback to xxxSetWindowPos and freed the pmsd there. 01762 */ 01763 if (ptiCancel->pmsd != pmsd) { 01764 RIPMSG3(RIP_ERROR, 01765 "xxxDrawDragRect: ptiCancel(%#p)->pmsd(%#p) != pmsd(%#p)\n", 01766 ptiCancel, ptiCancel->pmsd, pmsd); 01767 goto CleanupAfterPmsdDisappearance; 01768 } 01769 hrgnFullDragNew = GreCreateRectRgnIndirect(&pmsd->spwnd->rcWindow); 01770 01771 if (pmsd->spwnd->hrgnClip != NULL) { 01772 IntersectRgn(hrgnFullDragNew, 01773 hrgnFullDragNew, 01774 pmsd->spwnd->hrgnClip); 01775 } 01776 01777 /* 01778 * Set the full drag update region that is used in xxxRedrawHungWindow. 01779 */ 01780 if (hrgnFullDragNew == NULL) { 01781 01782 /* 01783 * We couldn't create the new full drag region so don't 01784 * use the full drag region to xxxRedrawHungWindow. Using 01785 * NULL with force a redraw of the entire window's hrgnUpdate. 01786 * (which is what we used to do, overdrawing but at least 01787 * covering the invalidated areas). 01788 */ 01789 if (hrgnFullDragOld != NULL) { 01790 GreDeleteObject(hrgnFullDragOld); 01791 hrgnFullDragOld = NULL; 01792 } 01793 01794 } else { 01795 01796 if (hrgnFullDragOld != NULL) { 01797 01798 /* 01799 * Subtract the new window rect from the old window rect 01800 * to create the update region caused by the drag. 01801 */ 01802 SubtractRgn(hrgnFullDragOld, hrgnFullDragOld, hrgnFullDragNew); 01803 } 01804 } 01805 01806 pwnd = PWNDDESKTOP(pmsd->spwnd)->spwndChild; 01807 ThreadLock(pwnd, &tlpwnd); 01808 xxxUpdateThreadsWindows(ptiCurrent, pwnd, hrgnFullDragOld); 01809 ThreadUnlock(&tlpwnd); 01810 01811 GreDeleteObject(hrgnFullDragNew); 01812 01813 CleanupAfterPmsdDisappearance: 01814 GreDeleteObject(hrgnFullDragOld); 01815 01816 ptiCancel->TIF_flags &= ~TIF_MOVESIZETRACKING; 01817 } 01818 }

BOOL xxxDrawMenuBar PWND  pwnd  ) 
 

Definition at line 1670 of file mndraw.c.

References BOOL, CheckLock, TestwndChild, TRUE, and xxxRedrawFrame().

01672 { 01673 CheckLock(pwnd); 01674 01675 if (!TestwndChild(pwnd)) { 01676 xxxRedrawFrame(pwnd); 01677 } 01678 01679 return TRUE; 01680 }

int xxxDrawMenuBarTemp PWND  pwnd,
HDC  hdc,
LPRECT  lprc,
PMENU  pMenu,
HFONT  hFont
 

Definition at line 1972 of file mndraw.c.

References CheckLock, tagMENU::cyMenu, FillRect(), gcxMenuFontChar, gcxMenuFontOverhang, gcyMenuFontAscent, gcyMenuFontChar, gcyMenuFontExternLeading, GetCharDimensions(), ghMenuFont, gSystemCPCharSet, HDCBITS, Lock, max, tagMENU::spwndNotify, SYSHBR, SYSMET, ThreadLock, ThreadUnlock, xxxMenuBarCompute(), and xxxMenuDraw().

Referenced by NtUserDrawMenuBarTemp().

01978 { 01979 int cyMenu; 01980 HFONT hOldFont; 01981 HFONT hFontSave; 01982 int cxCharSave; 01983 int cxOverhangSave; 01984 int cyCharSave; 01985 int cyLeadingSave; 01986 int cyAscentSave; 01987 int cySizeSave; 01988 PWND pwndNotify; 01989 TL tlpwndNotify; 01990 01991 hFontSave = ghMenuFont; 01992 cxCharSave = gcxMenuFontChar; 01993 cxOverhangSave = gcxMenuFontOverhang; 01994 cyCharSave = gcyMenuFontChar; 01995 cyLeadingSave = gcyMenuFontExternLeading; 01996 cyAscentSave = gcyMenuFontAscent; 01997 cySizeSave = SYSMET(CYMENUSIZE); 01998 01999 CheckLock(pwnd); 02000 CheckLock(pMenu); 02001 02002 ThreadLock(pMenu->spwndNotify, &tlpwndNotify); 02003 pwndNotify = pMenu->spwndNotify; 02004 02005 cyMenu = lprc->bottom - lprc->top; 02006 02007 if (hfont) { 02008 TEXTMETRIC textMetrics; 02009 02010 /* 02011 * Compute the new menu font info if needed 02012 */ 02013 ghMenuFont = hfont; 02014 hOldFont = GreSelectFont(HDCBITS(), ghMenuFont); 02015 gcxMenuFontChar = GetCharDimensions( 02016 HDCBITS(), &textMetrics, &gcyMenuFontChar); 02017 02018 gcxMenuFontOverhang = textMetrics.tmOverhang; 02019 GreSelectFont(HDCBITS(), hOldFont); 02020 02021 #if 0 // FYI: #254237 removing KOR hack 02022 if (gSystemCPCharSet == HANGUL_CHARSET) { 02023 gcyMenuFontChar -= textMetrics.tmInternalLeading - 2; 02024 } 02025 #endif 02026 02027 gcyMenuFontExternLeading = textMetrics.tmExternalLeading; 02028 02029 gcyMenuFontAscent = textMetrics.tmAscent + SYSMET(CYBORDER); 02030 } 02031 02032 cyMenu -= SYSMET(CYBORDER); 02033 cyMenu = max(cyMenu, (gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYEDGE))); 02034 SYSMET(CYMENUSIZE) = cyMenu; 02035 SYSMET(CYMENU) = cyMenu + SYSMET(CYBORDER); 02036 02037 /* 02038 * Compute the dimensons of the menu (hope that we don't leave the 02039 * USER critical section) 02040 */ 02041 xxxMenuBarCompute(pMenu, pwnd, lprc->top, lprc->left, lprc->right); 02042 02043 /* 02044 * Draw menu border in menu color 02045 */ 02046 lprc->bottom = lprc->top + pMenu->cyMenu; 02047 FillRect(hdc, lprc, SYSHBR(MENU)); 02048 02049 /* 02050 * Finally, draw the menu itself. 02051 */ 02052 xxxMenuDraw(hdc, pMenu); 02053 02054 /* 02055 * Restore the old state 02056 */ 02057 ghMenuFont = hFontSave; 02058 gcxMenuFontChar = cxCharSave; 02059 gcxMenuFontOverhang = cxOverhangSave; 02060 gcyMenuFontChar = cyCharSave; 02061 gcyMenuFontExternLeading = cyLeadingSave; 02062 gcyMenuFontAscent = cyAscentSave; 02063 SYSMET(CYMENUSIZE) = cySizeSave; 02064 02065 cyMenu = SYSMET(CYMENU); 02066 SYSMET(CYMENU) = cySizeSave + SYSMET(CYBORDER); 02067 02068 Lock(&pMenu->spwndNotify, pwndNotify); 02069 ThreadUnlock(&tlpwndNotify); 02070 02071 return cyMenu; 02072 }

void xxxDrawMenuBarUnderlines PWND  pwnd,
BOOL  fShow
 

Definition at line 2082 of file mndraw.c.

References _GetDCEx(), _ReleaseDC(), ACCF_KEYBOARDPREF, CALL_LPK, tagITEM::cch, CheckLock, tagMENU::cItems, ClearMF, tagITEM::cxItem, tagITEM::cyItem, FALSE, gcxMenuFontChar, gcyMenuFontChar, gcyMenuFontExternLeading, GetAppCompatFlags2(), GetPrefixCount(), GetTopLevelWindow(), ghMenuFont, gpsi, tagMENU::hbrBack, tagITEM::lpstr, MENU_STRLEN, MFUNDERLINE, MNXSPACE, NULL, OBI_MENUCHECK, PtiCurrentShared, tagMENU::rgItems, SetMF, tagWND::spmenu, SYSHBR, SYSMET, SYSRGB, TEST_BOOL_ACCF, TestEffectInvertUP, TestMF, TestMFS, TestMFT, TestWF, TextPointer, ThreadLock, ThreadLockPool, ThreadUnlock, ThreadUnlockAndFreePool, VER40, WFMPRESENT, tagITEM::xItem, xxxDrawItemUnderline(), xxxPSMGetTextExtent(), xxxPSMTextOut(), xxxSendMenuDrawItemMessage(), and tagITEM::yItem.

Referenced by xxxDefWindowProc(), and xxxEndMenuLoop().

02083 { 02084 HDC hdc; 02085 PMENU pmenu; 02086 PITEM pitem; 02087 ULONG i, yTop, cyTemp; 02088 LPWSTR psz; 02089 WCHAR szMenu[MENU_STRLEN], *pchOut; 02090 LONG result; 02091 HBRUSH hbr; 02092 TL tlmenu; 02093 PTHREADINFO ptiCurrent = PtiCurrentShared(); 02094 int xLeft; 02095 LPWSTR lpsz; 02096 SIZE extent; 02097 02098 CheckLock(pwnd); 02099 02100 /* 02101 * Bail if menu underlines are always on. 02102 */ 02103 if (TEST_BOOL_ACCF(ACCF_KEYBOARDPREF) || TestEffectInvertUP(KEYBOARDCUES) 02104 || (GetAppCompatFlags2(VER40) & GACF2_KCOFF)) { 02105 return; 02106 } 02107 02108 // if there is no menu, bail out right away 02109 02110 pwnd = GetTopLevelWindow(pwnd); 02111 if (pwnd == NULL || !TestWF(pwnd, WFMPRESENT)) 02112 return; 02113 /* 02114 * We don't clear WFMPRESENT when the menu is unlocked so make sure we have one 02115 */ 02116 pmenu = pwnd->spmenu; 02117 if (pmenu == NULL) { 02118 return; 02119 } 02120 02121 /* 02122 * set/clear the underline state. There are cases when the 02123 * menu loop doesn't remove the keys from the queue; so after 02124 * exiting we might get here but nothing needs to be drawn 02125 */ 02126 if (fShow) { 02127 if (TestMF(pmenu, MFUNDERLINE)) { 02128 return; 02129 } 02130 hbr = SYSHBR(MENUTEXT); 02131 SetMF(pmenu, MFUNDERLINE); 02132 } else { 02133 if (!TestMF(pmenu, MFUNDERLINE)) { 02134 return; 02135 } 02136 if (pmenu->hbrBack != NULL) { 02137 hbr = pmenu->hbrBack; 02138 } else { 02139 hbr = SYSHBR(MENU); 02140 } 02141 ClearMF(pmenu, MFUNDERLINE); 02142 } 02143 02144 pitem = (PITEM)pmenu->rgItems; 02145 02146 hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE | DCX_CACHE); 02147 02148 // select in the correct brush and font 02149 02150 GreSelectFont(hdc, ghMenuFont); 02151 02152 ThreadLock(pmenu, &tlmenu); 02153 for (i = 0; i < pmenu->cItems; i++, pitem++) { 02154 if (((psz = TextPointer(pitem->lpstr)) == NULL) 02155 && !TestMFT(pitem, MFT_OWNERDRAW)) { 02156 continue; 02157 } 02158 02159 if (TestMFT(pitem, MFT_OWNERDRAW)) { 02160 GreSetViewportOrg(hdc, 0, 0, NULL); 02161 } else { 02162 GreSetViewportOrg(hdc, pitem->xItem, pitem->yItem, NULL); 02163 } 02164 02165 // this funky xLeft and yTop calculation stolen from RealDrawMenuItem 02166 02167 yTop = gcyMenuFontExternLeading; 02168 cyTemp = pitem->cyItem - (gcyMenuFontChar + gcyMenuFontExternLeading + 02169 SYSMET(CYBORDER)); 02170 if (cyTemp > 0) { 02171 yTop += (cyTemp / 2); 02172 } 02173 02174 if (fShow && TestMFS(pitem, MFS_HOTTRACK)) { 02175 GreSelectBrush(hdc, SYSHBR(HOTLIGHT)); 02176 } else { 02177 GreSelectBrush(hdc, hbr); 02178 } 02179 02180 if (TestMFT(pitem, MFT_OWNERDRAW)) { 02181 xxxSendMenuDrawItemMessage(hdc, ODA_DRAWENTIRE, pmenu, pitem, FALSE, 0); 02182 } else { 02183 TL tl; 02184 02185 if (pitem->cch > MENU_STRLEN) { 02186 pchOut = (WCHAR*)UserAllocPool((pitem->cch+1) * sizeof(WCHAR), TAG_RTL); 02187 if (pchOut == NULL) 02188 return; 02189 ThreadLockPool(ptiCurrent, pchOut, &tl); 02190 } else { 02191 pchOut = szMenu; 02192 } 02193 02194 xLeft = gcxMenuFontChar; 02195 02196 if ( TestMFT(pitem, MFT_RIGHTORDER) && 02197 ((lpsz = TextPointer(pitem->lpstr)) != NULL)) 02198 { 02199 xxxPSMGetTextExtent(hdc, lpsz, pitem->cch, &extent); 02200 xLeft += (pitem->cxItem - (gpsi->oembmi[OBI_MENUCHECK].cx + MNXSPACE) - extent.cx); 02201 } 02202 02203 if (CALL_LPK(ptiCurrent)) { 02204 if (!fShow) { 02205 //Becuase PSMTextOut does not use PatBlt it uses ExtTextOut. 02206 GreSetTextColor(hdc, SYSRGB(MENU)); 02207 } 02208 xxxPSMTextOut(hdc, xLeft, yTop, psz, pitem->cch, DT_PREFIXONLY); 02209 02210 } else { 02211 result = GetPrefixCount(psz, pitem->cch, pchOut, pitem->cch); 02212 xxxDrawItemUnderline(pitem, hdc, xLeft, yTop, pchOut, 02213 LOWORD(result)); 02214 } 02215 if (pchOut != szMenu) { 02216 ThreadUnlockAndFreePool(ptiCurrent, &tl); 02217 } 02218 } 02219 } 02220 ThreadUnlock(&tlmenu); 02221 02222 _ReleaseDC(hdc); 02223 }

void xxxDrawMenuItem HDC  hdc,
PMENU  pMenu,
PITEM  pItem,
DWORD  dwFlags
 

Definition at line 750 of file mndraw.c.

References BC_INVERT, BltColor(), BOOL, CheckLock, tagOEMBITMAPINFO::cx, tagITEM::cxItem, tagOEMBITMAPINFO::cy, tagITEM::cyItem, DMI_INVERT, dwFlags, FALSE, gcxMenuFontChar, ghMenuFontDef, gpsi, tagMENU::hbrBack, HDCBITS, INT, max, MFINACTIVE, MFISPOPUP, mnDrawHilite(), MNDrawInsertionBar(), MNDrawMenu3DHotTracking(), MNIsCachedBmpOnly(), NULL, OBI_MENUARROW, OBI_MENUARROW_L, PGRAYMENU, GRAYMENU::pItem, GRAYMENU::pMenu, tagITEM::spSubMenu, SYSHBR, SYSHBRUSH, SYSMET, SYSRGB, TestMF, TestMFS, TestMFT, UINT, tagOEMBITMAPINFO::x, tagITEM::xItem, xxxDrawState(), xxxSendMenuDrawItemMessage(), tagOEMBITMAPINFO::y, and tagITEM::yItem.

Referenced by xxxHotTrackMenu(), xxxMenuDraw(), and xxxMNInvertItem().

00755 { 00756 BOOL fHilite; 00757 HFONT hfnOld; 00758 int tcExtra; 00759 UINT uFlags; 00760 int iBkSave; 00761 hfnOld = NULL; 00762 uFlags = DST_COMPLEX; 00763 00764 00765 CheckLock(pMenu); 00766 00767 /* 00768 * If the insertion bar is on (MFS_GAPDROP), don't draw the item hilited 00769 */ 00770 fHilite = mnDrawHilite(pItem); 00771 00772 00773 if (TestMFS(pItem, MFS_DEFAULT)) 00774 { 00775 if (ghMenuFontDef != NULL) 00776 hfnOld = GreSelectFont(hdc, ghMenuFontDef); 00777 else 00778 { 00779 uFlags |= DSS_DEFAULT; 00780 tcExtra = GreGetTextCharacterExtra(hdc); 00781 GreSetTextCharacterExtra(hdc, tcExtra + 1 + (gcxMenuFontChar / gpsi->cxSysFontChar)); 00782 } 00783 } 00784 00785 if (TestMFT(pItem, MFT_OWNERDRAW)) { 00786 00787 /* 00788 * If ownerdraw, just set the default menu colors since the app is 00789 * responsible for handling the rest. 00790 */ 00791 GreSetTextColor(hdc, SYSRGB(MENUTEXT)); 00792 GreSetBkColor(hdc, SYSRGB(MENU)); 00793 00794 /* 00795 * Send drawitem message since this is an ownerdraw item. 00796 */ 00797 xxxSendMenuDrawItemMessage(hdc, 00798 (UINT)((dwFlags & DMI_INVERT) ? ODA_SELECT : ODA_DRAWENTIRE), 00799 pMenu, pItem,FALSE,0); 00800 00801 // Draw the hierarchical arrow for the cascade menu. 00802 if (TestMF(pMenu, MFISPOPUP) && (pItem->spSubMenu != NULL)) 00803 { 00804 POEMBITMAPINFO pOem; 00805 HBRUSH hbr = fHilite ? SYSHBR(HIGHLIGHTTEXT) : SYSHBR(MENUTEXT); 00806 00807 pOem = gpsi->oembmi + (TestMFT(pItem, MFT_RIGHTORDER) 00808 ? OBI_MENUARROW_L : OBI_MENUARROW); 00809 00810 // This item has a hierarchical popup associated with it. Draw the 00811 // bitmap dealy to signify its presence. Note we check if fPopup is set 00812 // so that this isn't drawn for toplevel menus that have popups. 00813 00814 BltColor(hdc, 00815 hbr, 00816 HDCBITS(), 00817 TestMFT(pItem, MFT_RIGHTORDER) 00818 ? pItem->xItem + pOem->cx : 00819 pItem->xItem + pItem->cxItem - pOem->cx, 00820 pItem->yItem + max((INT)(pItem->cyItem - 2 - pOem->cy) / 2, 00821 0), 00822 pOem->cx, 00823 pOem->cy, 00824 pOem->x, 00825 pOem->y, 00826 BC_INVERT); 00827 } 00828 } else { 00829 int icolBack; 00830 int icolFore; 00831 GRAYMENU gm; 00832 00833 // 00834 // Setup colors and state 00835 // 00836 if (fHilite && TestMF(pMenu, MFISPOPUP)) { 00837 icolBack = COLOR_HIGHLIGHT; 00838 icolFore = COLOR_HIGHLIGHTTEXT; 00839 } else { 00840 icolBack = COLOR_MENU; 00841 icolFore = COLOR_MENUTEXT; 00842 } 00843 00844 // B#4157 - Lotus doesn't like it if we draw 00845 // its disabled menu items in GRAY, t-arthb 00846 // MAKE SURE MF_GRAYED stays 0x0001 NOT 0x0003 for this to fix 00847 00848 /* 00849 * System bitmaps are already grayed so don't draw them disabled 00850 * if the menu is inactive 00851 */ 00852 if (!MNIsCachedBmpOnly(pItem) 00853 && (TestMFS(pItem, MF_GRAYED) || TestMF(pMenu, MFINACTIVE))) { 00854 // 00855 // Only do embossing if menu color is same as 3D color. The 00856 // emboss uses 3D hilight & 3D shadow, which doesn't look cool 00857 // on a different background. 00858 // 00859 if ((icolBack == COLOR_HIGHLIGHT) || 00860 (SYSRGB(MENU) != SYSRGB(3DFACE)) || SYSMET(SLOWMACHINE)) { 00861 // 00862 // If gray text won't show up on background, then dither. 00863 // 00864 if (SYSRGB(GRAYTEXT) == gpsi->argbSystem[icolBack]) 00865 uFlags |= DSS_UNION; 00866 else 00867 icolFore = COLOR_GRAYTEXT; 00868 } else 00869 { 00870 if ((SYSRGB(3DSHADOW) == SYSRGB(MENU)) && (SYSRGB(3DHILIGHT) == SYSRGB(MENU))) 00871 uFlags |= DSS_UNION; 00872 else 00873 uFlags |= TestMF(pMenu, MFINACTIVE) ? DSS_INACTIVE : DSS_DISABLED; 00874 } 00875 } 00876 00877 GreSetBkColor(hdc, gpsi->argbSystem[icolBack]); 00878 GreSetTextColor(hdc, gpsi->argbSystem[icolFore]); 00879 if (((dwFlags & DMI_INVERT) && (pMenu->hbrBack == NULL)) 00880 || fHilite) { 00881 00882 POLYPATBLT PolyData; 00883 00884 /* 00885 * Only fill the background if we're being called on behalf of 00886 * MNInvertItem. This is so that we don't waste time filling 00887 * the unselected rect when the menu is first pulled down. 00888 * If the menu has a background brush and we were called by 00889 * MNInvertItem, that function will have already taken care of 00890 * filling the background 00891 */ 00892 00893 PolyData.x = pItem->xItem; 00894 PolyData.y = pItem->yItem; 00895 PolyData.cx = pItem->cxItem; 00896 PolyData.cy = pItem->cyItem; 00897 PolyData.BrClr.hbr = SYSHBRUSH(icolBack); 00898 00899 GrePolyPatBlt(hdc, PATCOPY, &PolyData, 1, PPB_BRUSH); 00900 } 00901 00902 if (pMenu->hbrBack != NULL) { 00903 iBkSave = GreSetBkMode(hdc, TRANSPARENT); 00904 } 00905 GreSelectBrush(hdc, SYSHBRUSH(icolFore)); 00906 00907 // 00908 // Draw the image 00909 // 00910 gm.pItem = pItem; 00911 gm.pMenu = pMenu; 00912 00913 xxxDrawState(hdc, 00914 SYSHBRUSH(icolFore), 00915 (LPARAM)(PGRAYMENU)&gm, 00916 pItem->xItem, 00917 pItem->yItem, 00918 pItem->cxItem, 00919 pItem->cyItem, 00920 uFlags); 00921 00922 MNDrawMenu3DHotTracking(hdc, pMenu, pItem); 00923 } 00924 00925 /* 00926 * Draw the drop insertion bar, if any 00927 */ 00928 MNDrawInsertionBar (hdc, pItem); 00929 00930 00931 if (pMenu->hbrBack != NULL) 00932 GreSetBkMode(hdc, iBkSave); 00933 00934 if (TestMFS(pItem, MFS_DEFAULT)) 00935 { 00936 if (hfnOld) 00937 GreSelectFont(hdc, hfnOld); 00938 else 00939 GreSetTextCharacterExtra(hdc, tcExtra); 00940 } 00941 }

VOID xxxDrawScrollBar PWND  pwnd,
HDC  hdc,
BOOL  fVert
 

Definition at line 1464 of file sbctl.c.

References BOOL, CalcSBStuff(), CheckLock, FALSE, tagSBTRACK::fCtlSB, tagSBTRACK::fTrackVert, GetWndSBDisableFlags(), tagSBTRACK::pSBCalc, PWNDTOPSBTRACK, tagSBTRACK::spwndTrack, and xxxDrawSB2().

Referenced by xxxDrawWindowFrame(), and xxxEnableWndSBArrows().

01468 { 01469 SBCALC SBCalc; 01470 PSBCALC pSBCalc; 01471 PSBTRACK pSBTrack = PWNDTOPSBTRACK(pwnd); 01472 01473 CheckLock(pwnd); 01474 if (pSBTrack && (pwnd == pSBTrack->spwndTrack) && (pSBTrack->fCtlSB == FALSE) 01475 && (fVert == (BOOL)pSBTrack->fTrackVert)) { 01476 pSBCalc = pSBTrack->pSBCalc; 01477 } else { 01478 pSBCalc = &SBCalc; 01479 } 01480 CalcSBStuff(pwnd, pSBCalc, fVert); 01481 01482 xxxDrawSB2(pwnd, pSBCalc, hdc, fVert, GetWndSBDisableFlags(pwnd, fVert)); 01483 }

BOOL xxxDrawState HDC  hdcDraw,
HBRUSH  hbrFore,
LPARAM  lData,
int  x,
int  y,
int  cx,
int  cy,
UINT  uFlags
 

Definition at line 169 of file mngray.c.

References BC_INVERT, BltColor(), BOOL, tagDISPLAYINFO::cxGray, cy, tagDISPLAYINFO::cyGray, DWORD, FALSE, ghbrBlack, ghFontSys, gpDispInfo, gpsi, GreGetTextAlign(), GreSetTextAlign(), tagDISPLAYINFO::hdcGray, L, max, NULL, PATOR, SYSHBR, SYSMET, TRUE, and xxxRealDrawMenuItem().

Referenced by xxxDrawMenuItem().

00178 { 00179 HFONT hFont; 00180 HFONT hFontSave = NULL; 00181 HDC hdcT; 00182 HBITMAP hbmpT; 00183 POINT ptOrg; 00184 BOOL fResult; 00185 int oldAlign; 00186 #ifdef USE_MIRRORING 00187 DWORD dwOldLayout=0; 00188 #endif 00189 00190 /* 00191 * These require monochrome conversion 00192 * 00193 * Enforce monochrome: embossed doesn't look great with 2 color displays 00194 */ 00195 if ((uFlags & DSS_DISABLED) && 00196 ((gpsi->BitCount == 1) || SYSMET(SLOWMACHINE))) { 00197 00198 uFlags &= ~DSS_DISABLED; 00199 uFlags |= DSS_UNION; 00200 } 00201 00202 if (uFlags & (DSS_INACTIVE | DSS_DISABLED | DSS_DEFAULT | DSS_UNION)) 00203 uFlags |= DSS_MONO; 00204 00205 /* 00206 * Validate flags - we only support DST_COMPLEX in kernel 00207 */ 00208 if ((uFlags & DST_TYPEMASK) != DST_COMPLEX) { 00209 RIPMSG1(RIP_ERROR, "xxxDrawState: invalid DST_ type %x", (uFlags & DST_TYPEMASK)); 00210 return FALSE; 00211 } 00212 00213 /* 00214 * Optimize: nothing to draw 00215 */ 00216 if (!cx || !cy) { 00217 return TRUE; 00218 } 00219 00220 /* 00221 * Setup drawing dc 00222 */ 00223 if (uFlags & DSS_MONO) { 00224 00225 hdcT = gpDispInfo->hdcGray; 00226 #ifdef USE_MIRRORING 00227 /* 00228 * First turn off mirroring on hdcGray if any. 00229 */ 00230 GreSetLayout(hdcT, -1, 0); 00231 /* 00232 * Set the hdcGray layout to be equal to the screen hdcDraw layout. 00233 */ 00234 dwOldLayout = GreGetLayout(hdcDraw); 00235 if (dwOldLayout != GDI_ERROR) { 00236 GreSetLayout(hdcT, cx, dwOldLayout); 00237 } 00238 #endif 00239 00240 /* 00241 * Is our scratch bitmap big enough? We need potentially 00242 * cx+1 by cy pixels for default etc. 00243 */ 00244 if ((gpDispInfo->cxGray < cx + 1) || (gpDispInfo->cyGray < cy)) { 00245 00246 if (hbmpT = GreCreateBitmap(max(gpDispInfo->cxGray, cx + 1), max(gpDispInfo->cyGray, cy), 1, 1, 0L)) { 00247 00248 HBITMAP hbmGray; 00249 00250 hbmGray = GreSelectBitmap(gpDispInfo->hdcGray, hbmpT); 00251 GreDeleteObject(hbmGray); 00252 00253 GreSetBitmapOwner(hbmpT, OBJECT_OWNER_PUBLIC); 00254 00255 gpDispInfo->cxGray = max(gpDispInfo->cxGray, cx + 1); 00256 gpDispInfo->cyGray = max(gpDispInfo->cyGray, cy); 00257 00258 } else { 00259 cx = gpDispInfo->cxGray - 1; 00260 cy = gpDispInfo->cyGray; 00261 } 00262 } 00263 00264 GrePatBlt(gpDispInfo->hdcGray, 00265 0, 00266 0, 00267 gpDispInfo->cxGray, 00268 gpDispInfo->cyGray, 00269 WHITENESS); 00270 00271 GreSetTextCharacterExtra(gpDispInfo->hdcGray, 00272 GreGetTextCharacterExtra(hdcDraw)); 00273 00274 oldAlign = GreGetTextAlign(hdcT); 00275 GreSetTextAlign(hdcT, (oldAlign & ~(TA_RTLREADING |TA_CENTER |TA_RIGHT)) 00276 | (GreGetTextAlign(hdcDraw) & (TA_RTLREADING |TA_CENTER |TA_RIGHT))); 00277 /* 00278 * Setup font 00279 */ 00280 if (GreGetHFONT(hdcDraw) != ghFontSys) { 00281 hFont = GreSelectFont(hdcDraw, ghFontSys); 00282 GreSelectFont(hdcDraw, hFont); 00283 hFontSave = GreSelectFont(gpDispInfo->hdcGray, hFont); 00284 } 00285 } else { 00286 hdcT = hdcDraw; 00287 /* 00288 * Adjust viewport 00289 */ 00290 GreGetViewportOrg(hdcT, &ptOrg); 00291 GreSetViewportOrg(hdcT, ptOrg.x+x, ptOrg.y+y, NULL); 00292 00293 } 00294 00295 /* 00296 * Now, draw original image 00297 */ 00298 fResult = xxxRealDrawMenuItem(hdcT, (PGRAYMENU)lData, cx, cy); 00299 00300 /* 00301 * The callbacks could have altered the attributes of hdcGray 00302 */ 00303 if (hdcT == gpDispInfo->hdcGray) { 00304 GreSetBkColor(gpDispInfo->hdcGray, RGB(255, 255, 255)); 00305 GreSetTextColor(gpDispInfo->hdcGray, RGB(0, 0, 0)); 00306 GreSelectBrush(gpDispInfo->hdcGray, ghbrBlack); 00307 GreSetBkMode(gpDispInfo->hdcGray, OPAQUE); 00308 } 00309 00310 /* 00311 * Clean up 00312 */ 00313 if (uFlags & DSS_MONO) { 00314 00315 /* 00316 * Reset font 00317 */ 00318 if (hFontSave) 00319 GreSelectFont(hdcT, hFontSave); 00320 GreSetTextAlign(hdcT, oldAlign); 00321 } else { 00322 /* 00323 * Reset DC. 00324 */ 00325 GreSetViewportOrg(hdcT, ptOrg.x, ptOrg.y, NULL); 00326 return TRUE; 00327 } 00328 00329 /* 00330 * UNION state 00331 * Dither over image 00332 * We want white pixels to stay white, in either dest or pattern. 00333 */ 00334 if (uFlags & DSS_UNION) { 00335 00336 POLYPATBLT PolyData; 00337 00338 PolyData.x = 0; 00339 PolyData.y = 0; 00340 PolyData.cx = cx; 00341 PolyData.cy = cy; 00342 PolyData.BrClr.hbr = gpsi->hbrGray; 00343 00344 GrePolyPatBlt(gpDispInfo->hdcGray, PATOR, &PolyData, 1, PPB_BRUSH); 00345 } 00346 00347 if (uFlags & DSS_INACTIVE) { 00348 00349 BltColor(hdcDraw, 00350 SYSHBR(3DSHADOW), 00351 gpDispInfo->hdcGray, 00352 x, 00353 y, 00354 cx, 00355 cy, 00356 0, 00357 0, 00358 BC_INVERT); 00359 00360 } else if (uFlags & DSS_DISABLED) { 00361 00362 /* 00363 * Emboss 00364 * Draw over-1/down-1 in hilight color, and in same position in shadow. 00365 */ 00366 00367 BltColor(hdcDraw, 00368 SYSHBR(3DHILIGHT), 00369 gpDispInfo->hdcGray, 00370 x+1, 00371 y+1, 00372 cx, 00373 cy, 00374 0, 00375 0, 00376 BC_INVERT); 00377 00378 BltColor(hdcDraw, 00379 SYSHBR(3DSHADOW), 00380 gpDispInfo->hdcGray, 00381 x, 00382 y, 00383 cx, 00384 cy, 00385 0, 00386 0, 00387 BC_INVERT); 00388 00389 } else if (uFlags & DSS_DEFAULT) { 00390 00391 BltColor(hdcDraw, 00392 hbrFore, 00393 gpDispInfo->hdcGray, 00394 x, 00395 y, 00396 cx, 00397 cy, 00398 0, 00399 0, 00400 BC_INVERT); 00401 00402 BltColor(hdcDraw, 00403 hbrFore, 00404 gpDispInfo->hdcGray, 00405 x+1, 00406 y, 00407 cx, 00408 cy, 00409 0, 00410 0, 00411 BC_INVERT); 00412 00413 } else { 00414 00415 BltColor(hdcDraw, 00416 hbrFore, 00417 gpDispInfo->hdcGray, 00418 x, 00419 y, 00420 cx, 00421 cy, 00422 0, 00423 0, 00424 BC_INVERT); 00425 } 00426 00427 00428 #ifdef USE_MIRRORING 00429 if ((uFlags & DSS_MONO)){ 00430 /* 00431 * Set the hdcGray layout to 0, it is a public DC. 00432 */ 00433 GreSetLayout(hdcT, -1, 0); 00434 } 00435 #endif 00436 return fResult; 00437 }

VOID xxxDrawWindowFrame PWND  pwnd,
HDC  hdc,
BOOL  fHungRedraw,
BOOL  fActive
 

Definition at line 76 of file drawfrm.c.

References CheckLock, DrawEdge(), DrawSize(), EqualRect, FALSE, GetCaptionHeight(), GetRect(), GetWindowBorders(), GRECT_WINDOW, GRECT_WINDOWCOORDS, tagWND::hrgnUpdate, InflateRect(), IsVisible(), NULL, tagWND::rcClient, tagWND::rcWindow, SYSMET, TestWF, TRUE, UINT, WEFDLGMODALFRAME, WEFSTATICEDGE, WEFWINDOWEDGE, WFBORDERMASK, WFCEPRESENT, WFFRAMEON, WFHPRESENT, WFMENUDRAW, WFMINIMIZED, WFMPRESENT, WFNONCPAINT, WFSIZEBOX, WFVPRESENT, xxxDrawCaptionBar(), xxxDrawScrollBar(), and xxxMenuBarDraw().

Referenced by xxxDefWindowProc(), xxxDWPPrint(), and xxxRedrawHungWindow().

00081 { 00082 RECT rcClip; 00083 int cxFrame, cyFrame; 00084 UINT wFlags = DC_NC; 00085 00086 CheckLock(pwnd); 00087 00088 /* 00089 * If we are minimized, or if a parent is minimized or invisible, 00090 * we've got nothing to draw. 00091 */ 00092 if (!IsVisible(pwnd) || 00093 (TestWF(pwnd, WFNONCPAINT) && !TestWF(pwnd, WFMENUDRAW)) || 00094 EqualRect(&pwnd->rcWindow, &pwnd->rcClient)) { 00095 return; 00096 } 00097 00098 /* 00099 * If the update rgn is not NULL, we may have to invalidate the bits saved. 00100 */ 00101 // if (TRUE) { 00102 if (pwnd->hrgnUpdate > NULL || GreGetClipBox(hdc, &rcClip, TRUE) != NULLREGION) { 00103 RECT rcWindow; 00104 int cBorders; 00105 00106 if (TestWF(pwnd, WFMINIMIZED) && !TestWF(pwnd, WFNONCPAINT)) { 00107 if (TestWF(pwnd, WFFRAMEON)) 00108 wFlags |= DC_ACTIVE; 00109 if (fHungRedraw) 00110 wFlags |= DC_NOSENDMSG; 00111 xxxDrawCaptionBar(pwnd, hdc, wFlags); 00112 return; 00113 } 00114 00115 cxFrame = cyFrame = cBorders = 00116 GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00117 cxFrame *= SYSMET(CXBORDER); 00118 cyFrame *= SYSMET(CYBORDER); 00119 00120 GetRect(pwnd, &rcWindow, GRECT_WINDOW | GRECT_WINDOWCOORDS); 00121 InflateRect(&rcWindow, -cxFrame, -cyFrame); 00122 00123 /* 00124 * If the menu style is present, draw it. 00125 */ 00126 if (TestWF(pwnd, WFMPRESENT) && !fHungRedraw) { 00127 rcWindow.top += xxxMenuBarDraw(pwnd, hdc, cxFrame, cyFrame); 00128 } 00129 00130 /* 00131 * Draw the title bar if the window has a caption or any window 00132 * borders. Punt if the NONCPAINT bit is set, because that means 00133 * we're going to draw the frame a little bit later. 00134 */ 00135 00136 if ((TestWF(pwnd, WFBORDERMASK) != 0 00137 || TestWF(pwnd, WEFDLGMODALFRAME)) 00138 || TestWF(pwnd, WFSIZEBOX) 00139 || TestWF(pwnd, WEFWINDOWEDGE) 00140 || TestWF(pwnd, WEFSTATICEDGE) 00141 && !TestWF(pwnd, WFNONCPAINT)) 00142 { 00143 if (fHungRedraw) 00144 wFlags |= DC_NOSENDMSG; 00145 if (fActive) 00146 wFlags |= DC_ACTIVE; 00147 xxxDrawCaptionBar(pwnd, hdc, wFlags | DC_NOVISIBLE); 00148 } 00149 00150 // 00151 // Subtract out caption if present. 00152 // 00153 rcWindow.top += GetCaptionHeight(pwnd); 00154 00155 // 00156 // Draw client edge 00157 // 00158 if (TestWF(pwnd, WFCEPRESENT)) { 00159 cxFrame += SYSMET(CXEDGE); 00160 cyFrame += SYSMET(CYEDGE); 00161 DrawEdge(hdc, &rcWindow, EDGE_SUNKEN, BF_RECT | BF_ADJUST); 00162 } 00163 00164 // 00165 // Since scrolls don't have to use tricks to overlap the window 00166 // border anymore, we don't have to worry about borders. 00167 // 00168 if (TestWF(pwnd, WFVPRESENT) && !fHungRedraw) { 00169 if (TestWF(pwnd, WFHPRESENT)) { 00170 // This accounts for client borders. 00171 DrawSize(pwnd, hdc, cxFrame, cyFrame); 00172 } 00173 00174 xxxDrawScrollBar(pwnd, hdc, TRUE); 00175 } 00176 00177 if (TestWF(pwnd, WFHPRESENT) && !fHungRedraw) 00178 xxxDrawScrollBar(pwnd, hdc, FALSE); 00179 } 00180 }

VOID xxxDW_DestroyOwnedWindows PWND  pwndParent  ) 
 

Definition at line 1989 of file createw.c.

References CheckLock, GETPTI, tagWND::head, IS_IME_ENABLED, NULL, tagDESKTOP::pDeskInfo, tagDESKTOPINFO::spwnd, tagWND::spwndChild, tagWND::spwndNext, tagWND::spwndOwner, TIF_INCLEANUP, Unlock, and xxxDestroyWindow().

Referenced by xxxDestroyWindow().

01991 { 01992 PWND pwnd, pwndDesktop; 01993 PDESKTOP pdeskParent; 01994 PWND pwndDefaultIme = GETPTI(pwndParent)->spwndDefaultIme; 01995 01996 CheckLock(pwndParent); 01997 01998 if ((pdeskParent = pwndParent->head.rpdesk) == NULL) 01999 return; 02000 pwndDesktop = pdeskParent->pDeskInfo->spwnd; 02001 02002 /* 02003 * During shutdown, the desktop owner window will be 02004 * destroyed. In this case, pwndDesktop will be NULL. 02005 */ 02006 if (pwndDesktop == NULL) 02007 return; 02008 02009 pwnd = pwndDesktop->spwndChild; 02010 02011 while (pwnd != NULL) { 02012 if (pwnd->spwndOwner == pwndParent) { 02013 /* 02014 * We don't destroy the IME window here 02015 * unless the thread is doing cleanup. 02016 */ 02017 if (IS_IME_ENABLED() && !(GETPTI(pwndParent)->TIF_flags & TIF_INCLEANUP) && 02018 pwnd == pwndDefaultIme) { 02019 Unlock(&pwnd->spwndOwner); 02020 pwnd = pwnd->spwndNext; 02021 continue; 02022 } 02023 02024 /* 02025 * If the window doesn't get destroyed, set its owner to NULL. 02026 * A good example of this is trying to destroy a window created 02027 * by another thread or process, but there are other cases. 02028 */ 02029 if (!xxxDestroyWindow(pwnd)) { 02030 Unlock(&pwnd->spwndOwner); 02031 } 02032 02033 /* 02034 * Start the search over from the beginning since the app could 02035 * have caused other windows to be created or activation/z-order 02036 * changes. 02037 */ 02038 pwnd = pwndDesktop->spwndChild; 02039 } else { 02040 pwnd = pwnd->spwndNext; 02041 } 02042 } 02043 }

VOID xxxDW_SendDestroyMessages PWND  pwnd  ) 
 

Definition at line 2053 of file createw.c.

References _GetProcessWindowStation(), CheckLock, DisownClipboard(), L, NULL, PtiCurrent, tagWND::spwndChild, tagWINDOWSTATION::spwndClipOwner, tagWND::spwndNext, ThreadLock, ThreadLockAlways, ThreadUnlock, xxxCheckFocus(), and xxxSendMessage().

Referenced by xxxDestroyWindow().

02055 { 02056 PWND pwndChild; 02057 PWND pwndNext; 02058 TL tlpwndNext; 02059 TL tlpwndChild; 02060 PWINDOWSTATION pwinsta; 02061 02062 CheckLock(pwnd); 02063 02064 /* 02065 * Be sure the window gets any resulting messages before being destroyed. 02066 */ 02067 xxxCheckFocus(pwnd); 02068 02069 pwinsta = _GetProcessWindowStation(NULL); 02070 if (pwinsta != NULL && pwnd == pwinsta->spwndClipOwner) { 02071 /* 02072 * Pass along the pwnd which is the reason we are dis'ing the clipboard. 02073 * We want to later make sure the owner is still this window after we make callbacks 02074 * and clear the owner 02075 */ 02076 DisownClipboard(pwnd); 02077 } 02078 02079 /* 02080 * Send the WM_DESTROY message. 02081 */ 02082 #if _DBG 02083 if (pwnd == PtiCurrent()->spwndDefaultIme) { 02084 TAGMSG2(DBGTAG_IMM, "xxxDW_SendDestroyMessages: sending WM_DESTROY message to def IME=%p, pti=%p", pwnd, PtiCurrent()); 02085 } 02086 #endif 02087 xxxSendMessage(pwnd, WM_DESTROY, 0L, 0L); 02088 02089 /* 02090 * Now send destroy message to all children of pwnd. 02091 * Enumerate down (pwnd->spwndChild) and sideways (pwnd->spwndNext). 02092 * We do it this way because parents often assume that child windows still 02093 * exist during WM_DESTROY message processing. 02094 */ 02095 pwndChild = pwnd->spwndChild; 02096 02097 while (pwndChild != NULL) { 02098 02099 pwndNext = pwndChild->spwndNext; 02100 02101 ThreadLock(pwndNext, &tlpwndNext); 02102 02103 ThreadLockAlways(pwndChild, &tlpwndChild); 02104 xxxDW_SendDestroyMessages(pwndChild); 02105 ThreadUnlock(&tlpwndChild); 02106 pwndChild = pwndNext; 02107 02108 /* 02109 * The unlock may nuke the next window. If so, get out. 02110 */ 02111 if (!ThreadUnlock(&tlpwndNext)) 02112 break; 02113 } 02114 02115 xxxCheckFocus(pwnd); 02116 }

VOID xxxDWP_DoNCActivate PWND  pwnd,
DWORD  dwFlags,
HRGN  hrgnClip
 

Definition at line 696 of file dwp.c.

References _GetDCEx(), _ReleaseDC(), AreNonClientAreasToBePainted(), CheckLock, ClrWF, dwFlags, FALSE, GetWindowBorders(), IsModelessMenuNotificationWindow(), NCA_ACTIVE, NCA_FORCEFRAMEOFF, SetWF, SYSMET, TestWF, TRUE, UINT, UserValidateCopyRgn(), VOID(), WFFRAMEON, WFMPRESENT, WFNONCPAINT, WFVISIBLE, xxxDrawCaptionBar(), and xxxMenuBarDraw().

Referenced by xxxDefWindowProc(), xxxEndMenuLoop(), and xxxMenuWindowProc().

00700 { 00701 UINT wFlags = DC_CAPTION; 00702 00703 CheckLock(pwnd); 00704 00705 /* 00706 * Later5.0 Gerardob. Since activation must follow focus, modeless 00707 * menu windows are activated so they can receive keyboard input; 00708 * however, we want the notification frame on, even when inactive. 00709 * (so it looks just like regular menus). 00710 * There are other scenarios when we want focus and activation on 00711 * different parent-child chains so we should consider allowing this. 00712 */ 00713 if ((dwFlags & NCA_ACTIVE) 00714 || (!(dwFlags & NCA_FORCEFRAMEOFF) 00715 && IsModelessMenuNotificationWindow(pwnd))) { 00716 00717 SetWF(pwnd, WFFRAMEON); 00718 wFlags |= DC_ACTIVE; 00719 } else { 00720 00721 ClrWF(pwnd, WFFRAMEON); 00722 } 00723 00724 if (TestWF(pwnd, WFVISIBLE) && !TestWF(pwnd, WFNONCPAINT)) { 00725 00726 HDC hdc; 00727 WORD wBorderOrCap = (WORD)AreNonClientAreasToBePainted(pwnd); 00728 00729 if (wBorderOrCap) { 00730 00731 /* 00732 * Validate and Copy the region for our use. Since we 00733 * hand this off to GetWindowDC() we won't have to delete 00734 * the region (done in ReleaseDC()). Regardless, the region 00735 * passed in from the user is its responsibility to delete. 00736 */ 00737 hrgnClip = UserValidateCopyRgn(hrgnClip); 00738 00739 if (hdc = _GetDCEx(pwnd, hrgnClip, DCX_WINDOW | DCX_USESTYLE)) { 00740 /* 00741 * Draw the menu for grayout and underlines 00742 */ 00743 if (TestWF(pwnd, WFMPRESENT)) { 00744 int cxFrame, cyFrame; 00745 cxFrame = cyFrame = GetWindowBorders(pwnd->style, 00746 pwnd->ExStyle, TRUE, FALSE); 00747 cxFrame *= SYSMET(CXBORDER); 00748 cyFrame *= SYSMET(CYBORDER); 00749 xxxMenuBarDraw(pwnd, hdc, cxFrame, cyFrame); 00750 } 00751 xxxDrawCaptionBar(pwnd, hdc, wBorderOrCap | wFlags); 00752 _ReleaseDC(hdc); 00753 } else { 00754 GreDeleteObject(hrgnClip); 00755 } 00756 } 00757 } 00758 }

BOOL xxxDWP_EraseBkgnd PWND  pwnd,
UINT  msg,
HDC  hdc
 

Definition at line 340 of file dwp.c.

References BOOL, CheckLock, FALSE, msg, tagWND::pcls, SYSHBRUSH, TestWF, TRUE, WFCHILD, xxxFillWindow(), and xxxInternalPaintDesktop().

Referenced by xxxDefWindowProc().

00344 { 00345 HBRUSH hbr; 00346 00347 CheckLock(pwnd); 00348 00349 switch (msg) { 00350 case WM_ICONERASEBKGND: 00351 // 00352 // Old compatibility: Many hack apps use this to paint the 00353 // desktop wallpaper. We never send WM_ICONERASEBKGND anymore 00354 // because we don't have client areas in our minimized windows. 00355 // 00356 if (!TestWF(pwnd, WFCHILD)) { 00357 xxxInternalPaintDesktop(pwnd, hdc, TRUE); 00358 } else { 00359 return FALSE; 00360 } 00361 break; 00362 00363 case WM_ERASEBKGND: 00364 if (hbr = pwnd->pcls->hbrBackground) { 00365 // Convert sys colors to proper brush 00366 if (hbr <= (HBRUSH)COLOR_MAX) 00367 hbr = SYSHBRUSH((ULONG_PTR)hbr - 1); 00368 00369 /* 00370 * Remove call to UnrealizeObject. GDI handles this 00371 * for brushes on NT. 00372 * 00373 * if (hbr != SYSHBR(DESKTOP)) 00374 * GreUnrealizeObject(hbr); 00375 */ 00376 00377 xxxFillWindow(pwnd, pwnd, hdc, hbr); 00378 } else { 00379 return FALSE; 00380 } 00381 } 00382 return TRUE; 00383 }

VOID xxxDWP_ProcessVirtKey UINT  key  ) 
 

Definition at line 228 of file dwp.c.

References _GetKeyState(), _PostMessage(), CFNOCLOSE, DWORD, GETPTI, GetTopLevelWindow(), L, NULL, tagTHREADINFO::pq, PtiCurrent, tagQ::spwndActive, tagQ::spwndFocus, TestCF, ThreadLockAlwaysWithPti, ThreadUnlock, UINT, xxxSendMessage(), and xxxSetFocus().

Referenced by xxxDefWindowProc().

00230 { 00231 PTHREADINFO pti; 00232 TL tlpwndActive; 00233 00234 pti = PtiCurrent(); 00235 if (pti->pq->spwndActive == NULL) 00236 return; 00237 00238 switch (wKey) { 00239 00240 case VK_F4: 00241 if (TestCF(pti->pq->spwndActive, CFNOCLOSE)) 00242 break; 00243 00244 /* 00245 * Don't change the focus if the child window has it. 00246 */ 00247 if (pti->pq->spwndFocus == NULL || 00248 GetTopLevelWindow(pti->pq->spwndFocus) != 00249 pti->pq->spwndActive) { 00250 ThreadLockAlwaysWithPti(pti, pti->pq->spwndActive, &tlpwndActive); 00251 xxxSetFocus(pti->pq->spwndActive); 00252 ThreadUnlock(&tlpwndActive); 00253 } 00254 _PostMessage(pti->pq->spwndActive, WM_SYSCOMMAND, SC_CLOSE, 0L); 00255 break; 00256 00257 case VK_TAB: 00258 /* 00259 * If alt-tab is reserved by console, don't bring up the alt-tab 00260 * window. 00261 */ 00262 if (GETPTI(pti->pq->spwndActive)->fsReserveKeys & CONSOLE_ALTTAB) 00263 break; 00264 00265 case VK_ESCAPE: 00266 case VK_F6: 00267 ThreadLockAlwaysWithPti(pti, pti->pq->spwndActive, &tlpwndActive); 00268 xxxSendMessage(pti->pq->spwndActive, WM_SYSCOMMAND, 00269 (UINT)(_GetKeyState(VK_SHIFT) < 0 ? SC_NEXTWINDOW : SC_PREVWINDOW), 00270 (LONG)(DWORD)(WORD)wKey); 00271 ThreadUnlock(&tlpwndActive); 00272 break; 00273 } 00274 }

BOOL xxxEmptyClipboard PWINDOWSTATION  pwinsta  ) 
 

Definition at line 851 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), tagWINDOWSTATION::cNumClipFormats, tagWINDOWSTATION::dwWSF_Flags, FALSE, tagWINDOWSTATION::fClipboardChanged, tagWINDOWSTATION::fInDelayedRendering, tagCLIP::fmt, tagWINDOWSTATION::iClipSequenceNumber, tagWINDOWSTATION::iClipSerialNumber, Lock, NULL, tagWINDOWSTATION::pClipBase, tagWINDOWSTATION::ptiClipLock, tagWINDOWSTATION::spwndClipOpen, tagWINDOWSTATION::spwndClipOwner, ThreadLockWinSta, ThreadUnlockWinSta, TRUE, UserDeleteAtom(), UT_FreeCBFormat(), WSF_DYING, and xxxSendClipboardMessage().

Referenced by ForceEmptyClipboard(), NtUserEmptyClipboard(), and xxxSnapWindow().

00853 { 00854 TL tlpwinsta; 00855 PCLIP pClip; 00856 int cFmts; 00857 BOOL fDying; 00858 PTHREADINFO ptiCurrent = (PTHREADINFO)(W32GetCurrentThread()); 00859 BOOL bInternal = !(pwinsta == NULL); 00860 00861 /* 00862 * Check access. 00863 */ 00864 if ((pwinsta == NULL) && ((pwinsta = CheckClipboardAccess()) == NULL)) 00865 return FALSE; 00866 00867 /* 00868 * If the current thread doesn't have the clipboard open, it can't be 00869 * be emptied! 00870 */ 00871 00872 if (ptiCurrent == NULL) { 00873 UserAssert(bInternal); 00874 } 00875 00876 if (!bInternal) { 00877 if (pwinsta->ptiClipLock != ptiCurrent) { 00878 RIPERR0(ERROR_CLIPBOARD_NOT_OPEN, RIP_WARNING, "xxxEmptyClipboard: clipboard not open"); 00879 return FALSE; 00880 } 00881 } 00882 00883 /* 00884 * Only send messages at logoff. 00885 */ 00886 fDying = pwinsta->dwWSF_Flags & WSF_DYING; 00887 00888 if (!fDying && ptiCurrent) { 00889 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 00890 00891 /* 00892 * Let the clipboard owner know that the clipboard is 00893 * being destroyed. 00894 */ 00895 xxxSendClipboardMessage(pwinsta, WM_DESTROYCLIPBOARD); 00896 } 00897 00898 if ((pClip = pwinsta->pClipBase) != NULL) { 00899 00900 /* 00901 * Loop through all the clipboard entries and free their data 00902 * objects. Only call DeleteAtom for real atoms. 00903 */ 00904 for (cFmts = pwinsta->cNumClipFormats; cFmts-- != 0;) { 00905 00906 if ((ATOM)pClip->fmt >= MAXINTATOM) 00907 UserDeleteAtom((ATOM)pClip->fmt); 00908 00909 UT_FreeCBFormat(pClip++); 00910 } 00911 00912 /* 00913 * Free the clipboard itself. 00914 */ 00915 UserFreePool((HANDLE)pwinsta->pClipBase); 00916 pwinsta->pClipBase = NULL; 00917 pwinsta->cNumClipFormats = 0; 00918 } 00919 00920 /* 00921 * The "empty" succeeds. The owner is now the thread that has the 00922 * clipboard open. Remember the clipboard has changed; this will 00923 * cause the viewer to redraw at CloseClipboard time. 00924 */ 00925 pwinsta->fClipboardChanged = TRUE; 00926 Lock(&pwinsta->spwndClipOwner, pwinsta->spwndClipOpen); 00927 00928 /* 00929 * Change the clipboard serial number so that the client-side 00930 * clipboard caches of all the processes will get 00931 * flushed on the next OpenClipboard. 00932 */ 00933 pwinsta->iClipSerialNumber++; 00934 pwinsta->iClipSequenceNumber++; 00935 pwinsta->fInDelayedRendering = FALSE; 00936 00937 if (!fDying && ptiCurrent) 00938 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00939 00940 return TRUE; 00941 }

DWORD xxxEnableMenuItem PMENU  pMenu,
UINT  wIDEnableItem,
UINT  wEnable
 

Definition at line 494 of file mnsys.c.

References CheckLock, DWORD, MenuItemState(), MFAPPSYSMENU, MNGetPopupFromMenu(), MNUS_DEFAULT, NULL, tagMENU::spwndNotify, TestMF, ThreadLock, ThreadUnlock, xxxMNUpdateShownMenu(), and xxxRedrawTitle().

Referenced by NtUserEnableMenuItem(), and xxxSetSysMenu().

00498 { 00499 DWORD dres; 00500 PMENU pRealMenu; 00501 PPOPUPMENU ppopup; 00502 00503 CheckLock(pMenu); 00504 00505 dres = MenuItemState(pMenu, wIDEnableItem, wEnable, 00506 MFS_GRAYED, &pRealMenu); 00507 00508 /* 00509 * If enabling/disabling a system menu item, redraw the caption buttons 00510 */ 00511 if (TestMF(pMenu, MFAPPSYSMENU) && (pMenu->spwndNotify != NULL)) { 00512 00513 TL tlpwnd; 00514 00515 switch (wIDEnableItem) { 00516 case SC_SIZE: 00517 case SC_MOVE: 00518 case SC_MINIMIZE: 00519 case SC_MAXIMIZE: 00520 case SC_CLOSE: 00521 case SC_RESTORE: 00522 ThreadLock(pMenu->spwndNotify, &tlpwnd); 00523 xxxRedrawTitle(pMenu->spwndNotify, DC_BUTTONS); 00524 ThreadUnlock(&tlpwnd); 00525 } 00526 } 00527 00528 /* 367162: If the menu is already being displayed we need to redraw it */ 00529 if(pRealMenu && (ppopup = MNGetPopupFromMenu(pRealMenu, NULL))){ 00530 xxxMNUpdateShownMenu(ppopup, NULL, MNUS_DEFAULT); 00531 } 00532 00533 return dres; 00534 }

BOOL xxxEnableScrollBar PWND  pwnd,
UINT  wSBflags,
UINT  wArrows
 

Definition at line 392 of file sbctl.c.

References BOOL, CheckLock, DWORD, ES_DISABLE, ES_ENABLE, ES_NOTHING, FALSE, TestWF, UINT, WFDISABLED, xxxEnableWindow(), xxxEnableWndSBArrows(), and xxxSendMessage().

Referenced by NtUserEnableScrollBar(), and xxxSBWndProc().

00396 : 00397 // ESB_ENABLE_BOTH = > Enable both arrows. 00398 // ESB_DISABLE_LTUP = > Disable Left/Up arrow; 00399 // ESB_DISABLE_RTDN = > DIsable Right/Down arrow; 00400 // ESB_DISABLE_BOTH = > Disable both the arrows; 00401 { 00402 #define ES_NOTHING 0 00403 #define ES_DISABLE 1 00404 #define ES_ENABLE 2 00405 UINT wOldFlags; 00406 UINT wEnableWindow; 00407 00408 CheckLock(pwnd); 00409 00410 if(wSBflags != SB_CTL) { 00411 return xxxEnableWndSBArrows(pwnd, wSBflags, wArrows); 00412 } 00413 00414 /* 00415 * Let us assume that we don't have to call EnableWindow 00416 */ 00417 wEnableWindow = ES_NOTHING; 00418 00419 wOldFlags = ((PSBWND)pwnd)->wDisableFlags & (UINT)SB_DISABLE_MASK; 00420 00421 /* 00422 * Check if the present state of the arrows is exactly the same 00423 * as what the caller wants: 00424 */ 00425 if (wOldFlags == wArrows) 00426 return FALSE ; // If so, nothing needs to be done; 00427 00428 /* 00429 * Check if the caller wants to disable both the arrows 00430 */ 00431 if (wArrows == ESB_DISABLE_BOTH) { 00432 wEnableWindow = ES_DISABLE; // Yes! So, disable the whole SB Ctl. 00433 } else { 00434 00435 /* 00436 * Check if the caller wants to enable both the arrows 00437 */ 00438 if(wArrows == ESB_ENABLE_BOTH) { 00439 00440 /* 00441 * We need to enable the SB Ctl only if it was already disabled. 00442 */ 00443 if(wOldFlags == ESB_DISABLE_BOTH) 00444 wEnableWindow = ES_ENABLE;// EnableWindow(.., TRUE); 00445 } else { 00446 00447 /* 00448 * Now, Caller wants to disable only one arrow; 00449 * Check if one of the arrows was already disabled and we want 00450 * to disable the other;If so, the whole SB Ctl will have to be 00451 * disabled; Check if this is the case: 00452 */ 00453 if((wOldFlags | wArrows) == ESB_DISABLE_BOTH) 00454 wEnableWindow = ES_DISABLE; // EnableWindow(, FALSE); 00455 } 00456 } 00457 if(wEnableWindow != ES_NOTHING) { 00458 00459 /* 00460 * EnableWindow returns old state of the window; We must return 00461 * TRUE only if the Old state is different from new state. 00462 */ 00463 if(xxxEnableWindow(pwnd, (BOOL)(wEnableWindow == ES_ENABLE))) { 00464 return !(TestWF(pwnd, WFDISABLED)); 00465 } else { 00466 return TestWF(pwnd, WFDISABLED); 00467 } 00468 } 00469 00470 return (BOOL)xxxSendMessage(pwnd, SBM_ENABLE_ARROWS, (DWORD)wArrows, 0); 00471 #undef ES_NOTHING 00472 #undef ES_DISABLE 00473 #undef ES_ENABLE 00474 }

BOOL xxxEnableWindow PWND  pwnd,
BOOL  fEnable
 

Definition at line 184 of file kernel/winmgr.c.

References BOOL, CheckLock, ClrWF, FWINABLE, IsWinEventNotifyDeferredOK, L, NULL, PtiCurrent, SetWF, TestWF, WFDISABLED, xxxSendMessage(), xxxSetFocus(), and xxxWindowEvent().

Referenced by xxxEnableScrollBar().

00187 { 00188 BOOL fOldState, fChange; 00189 00190 CheckLock(pwnd); 00191 UserAssert(IsWinEventNotifyDeferredOK()); 00192 00193 fOldState = TestWF(pwnd, WFDISABLED); 00194 00195 if (!fEnable) { 00196 fChange = !TestWF(pwnd, WFDISABLED); 00197 00198 xxxSendMessage(pwnd, WM_CANCELMODE, 0, 0); 00199 00200 if (pwnd == PtiCurrent()->pq->spwndFocus) { 00201 xxxSetFocus(NULL); 00202 } 00203 SetWF(pwnd, WFDISABLED); 00204 00205 } else { 00206 fChange = TestWF(pwnd, WFDISABLED); 00207 ClrWF(pwnd, WFDISABLED); 00208 } 00209 00210 if (fChange) { 00211 if (FWINABLE()) { 00212 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_WINDOW, 00213 INDEXID_CONTAINER, 0); 00214 } 00215 xxxSendMessage(pwnd, WM_ENABLE, fEnable, 0L); 00216 } 00217 00218 return fOldState; 00219 }

BOOL xxxEndDeferWindowPosEx PSMWP  psmwp,
BOOL  fAsync
 

Definition at line 4773 of file swp.c.

References tagSMWP::acvr, AsyncWindowPos(), tagSMWP::bHandle, BOOL, tagSMWP::bShellNotify, tagSMWP::ccvr, CheckLock, ClrWF, tagTHREADINFO::cVisWindows, DBGCheskSMWP, DestroySMWP(), DSP_ENUMCLIPPEDCHILDREN, FALSE, FindValidWindowPos(), gptiForeground, tagWND::head, IsWinEventNotifyDeferredOK, NULL, tagCVR::pos, PostShellHookMessages(), PtiCurrent, PW, PWNDDESKTOP, RestoreForegroundActivate(), RevalidateHwnd, STW_SAME, ThreadLockAlwaysWithPti, ThreadLockPoolCleanup, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPoolCleanup, TIF_ALLOWFOREGROUNDACTIVATE, TRUE, UINT, ValidateSmwp(), WFNONCPAINT, xxxCalcValidRects(), xxxCallHook(), xxxDoSyncPaint(), xxxSendChangedMsgs(), xxxSetTrayWindow(), xxxSwpActivate(), ZOrderByOwner(), and zzzBltValidBits().

Referenced by NtUserEndDeferWindowPosEx(), xxxArrangeIconicWindows(), xxxDesktopRecalc(), xxxMinMaximize(), xxxProcessSetWindowPosEvent(), xxxSetWindowPos(), and xxxSetWindowRgn().

04776 { 04777 PWND pwndNewActive; 04778 PWND pwndParent; 04779 PWND pwndActive; 04780 PWND pwndActivePrev; 04781 HWND hwndNewActive; 04782 PWINDOWPOS pwp; 04783 BOOL fClearBits; 04784 BOOL fSyncPaint; 04785 UINT cVisWindowsPrev; 04786 PTHREADINFO ptiCurrent = PtiCurrent(); 04787 TL tlpwndNewActive; 04788 TL tlpwndParent; 04789 TL tlcuSMWP; 04790 BOOL fForegroundPrev; 04791 04792 UserAssert(IsWinEventNotifyDeferredOK()); 04793 04794 DBGCheskSMWP(psmwp); 04795 if (psmwp->bHandle) { 04796 CheckLock(psmwp); 04797 } 04798 04799 /* 04800 * Validate the window pos structures and find a window to activate. 04801 */ 04802 if ((psmwp->ccvr != 0) && ValidateSmwp(psmwp, &fSyncPaint)) { 04803 04804 if ((pwp = FindValidWindowPos(psmwp)) == NULL) 04805 goto lbFinished; 04806 04807 /* 04808 * Make sure to stop at the mother desktop window. In Win95 04809 * a SetWindowPos() on a desktop window will have a NULL parent 04810 * window. This is not true in NT, but our mother desktop 04811 * window does have a NULL rpdesk, so check it too. 04812 */ 04813 UserAssert(PW(pwp->hwnd)); 04814 pwndParent = PW(pwp->hwnd)->spwndParent; 04815 if (pwndParent == NULL || pwndParent->head.rpdesk == NULL) 04816 goto lbFinished; 04817 04818 /* 04819 * Usually all window positioning happens synchronously across threads. 04820 * This is because apps expect that behavior now - if it was async, 04821 * callers could not expect the state to be set once the api returned. 04822 * This is not the semantics of SetWindowPos(). The downside of this 04823 * synchronicity is that a SetWindowPos() on an hwnd created by another 04824 * thread will cause the caller to wait for that thread - even if that 04825 * thread is hung. That's what you get. 04826 * 04827 * We don't want task manager to hang though, no matter who else is 04828 * hung, so when taskman calls, it calls a special entry point for 04829 * tiling / cascading, which does SetWindowPos() asynchronously - 04830 * by posting an event in each thread's queue that makes it set its 04831 * own window position - that way if the thread is hung, who cares - 04832 * it doesn't effect taskman. 04833 * 04834 * Do async window pos positioning before zorder by owner so that 04835 * we retain any cross thread ownership relationships synchronously. 04836 */ 04837 if (fAsync) { 04838 AsyncWindowPos(psmwp); 04839 } 04840 04841 /* 04842 * If needed, Z order the windows by owner. 04843 * This may grow the SMWP, if new CVRs are added. 04844 */ 04845 if (pwndParent == PWNDDESKTOP(pwndParent)) { 04846 04847 if ((psmwp = ZOrderByOwner(psmwp)) == NULL) { 04848 return FALSE; 04849 } 04850 } 04851 04852 ThreadLockAlwaysWithPti(ptiCurrent, pwndParent, &tlpwndParent); 04853 ThreadLockPoolCleanup(ptiCurrent, psmwp, &tlcuSMWP, DestroySMWP); 04854 04855 /* 04856 * Calc new window positions. 04857 */ 04858 if (xxxCalcValidRects(psmwp, &hwndNewActive)) { 04859 04860 int i; 04861 04862 pwndNewActive = RevalidateHwnd(hwndNewActive); 04863 04864 ThreadLockWithPti(ptiCurrent, pwndNewActive, &tlpwndNewActive); 04865 04866 cVisWindowsPrev = ptiCurrent->cVisWindows; 04867 fForegroundPrev = (ptiCurrent == gptiForeground); 04868 04869 /* 04870 * The call to zzzBltValidBits will leave the critical section 04871 * if there are any notifications to make. 04872 */ 04873 UserAssert(IsWinEventNotifyDeferredOK()); 04874 if (!zzzBltValidBits(psmwp)) 04875 fSyncPaint = FALSE; 04876 UserAssert(IsWinEventNotifyDeferredOK()); 04877 04878 if (psmwp->bShellNotify) { 04879 for (i = psmwp->ccvr; i-- != 0; ) { 04880 /* 04881 * Loop through the windows, looking for notifications. 04882 */ 04883 04884 if (0 == (psmwp->acvr[i].pos.flags & SWP_NOTIFYALL)) 04885 continue; 04886 04887 if (psmwp->acvr[i].pos.flags & SWP_NOTIFYCREATE) { 04888 PostShellHookMessages(HSHELL_WINDOWCREATED, 04889 (LPARAM)psmwp->acvr[i].pos.hwnd); 04890 04891 xxxCallHook(HSHELL_WINDOWCREATED, 04892 (WPARAM)psmwp->acvr[i].pos.hwnd, 04893 (LPARAM)0, 04894 WH_SHELL); 04895 } 04896 04897 if (psmwp->acvr[i].pos.flags & SWP_NOTIFYDESTROY) { 04898 PostShellHookMessages(HSHELL_WINDOWDESTROYED, 04899 (LPARAM)psmwp->acvr[i].pos.hwnd); 04900 04901 xxxCallHook(HSHELL_WINDOWDESTROYED, 04902 (WPARAM)psmwp->acvr[i].pos.hwnd, 04903 (LPARAM)0, 04904 WH_SHELL); 04905 } 04906 04907 if (psmwp->acvr[i].pos.flags & SWP_NOTIFYACTIVATE) { 04908 PWND pwnd = RevalidateHwnd(psmwp->acvr[i].pos.hwnd); 04909 if (pwnd != NULL){ 04910 TL tlpwnd; 04911 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 04912 xxxSetTrayWindow(pwnd->head.rpdesk, pwnd, NULL); 04913 ThreadUnlock(&tlpwnd); 04914 } 04915 } 04916 04917 if (psmwp->acvr[i].pos.flags & SWP_NOTIFYFS) { 04918 xxxSetTrayWindow(ptiCurrent->rpdesk, STW_SAME, NULL); 04919 } 04920 } 04921 } 04922 04923 04924 /* 04925 * If this process went from some windows to no windows visible 04926 * and it was in the foreground, then let its next activate 04927 * come to the foreground. 04928 */ 04929 if (fForegroundPrev && cVisWindowsPrev && !ptiCurrent->cVisWindows) { 04930 04931 ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 04932 TAGMSG1(DBGTAG_FOREGROUND, "xxxEndDeferWindowPosEx set TIF %#p", ptiCurrent); 04933 04934 /* 04935 * Also if any apps were in the middle of starting when 04936 * this happened, allow them to foreground activate again. 04937 */ 04938 RestoreForegroundActivate(); 04939 } 04940 04941 /* 04942 * Deal with any activation... 04943 */ 04944 fClearBits = FALSE; 04945 if (pwndNewActive != NULL) 04946 fClearBits = xxxSwpActivate(pwndNewActive); 04947 04948 /* 04949 * Now draw frames and erase backgrounds of all the windows 04950 * involved. 04951 */ 04952 UserAssert(pwndParent); 04953 if (fSyncPaint) 04954 xxxDoSyncPaint(pwndParent, DSP_ENUMCLIPPEDCHILDREN); 04955 04956 ThreadUnlock(&tlpwndNewActive); 04957 04958 /* 04959 * If SwpActivate() set the NONCPAINT bits, clear them now. 04960 */ 04961 if (fClearBits) { 04962 04963 if (pwndActive = ptiCurrent->pq->spwndActive) 04964 ClrWF(pwndActive, WFNONCPAINT); 04965 04966 if (pwndActivePrev = ptiCurrent->pq->spwndActivePrev) 04967 ClrWF(pwndActivePrev, WFNONCPAINT); 04968 } 04969 04970 /* 04971 * Send WM_WINDOWPOSCHANGED messages 04972 */ 04973 xxxSendChangedMsgs(psmwp); 04974 } 04975 04976 ThreadUnlockPoolCleanup(ptiCurrent, &tlcuSMWP); 04977 ThreadUnlock(&tlpwndParent); 04978 } 04979 04980 lbFinished: 04981 04982 /* 04983 * All done. Free everything up and return. 04984 */ 04985 DestroySMWP(psmwp); 04986 return TRUE; 04987 }

VOID xxxEndMenu PMENUSTATE  pMenuState  ) 
 

Definition at line 124 of file mnapi.c.

References BOOL, FALSE, tagPOPUPMENU::fDestroyed, tagPOPUPMENU::fInCancel, tagMENUSTATE::fInEndMenu, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fMenuStarted, NULL, tagMENUSTATE::pGlobalPopupMenu, PtiCurrent, tagMENUSTATE::ptiMenuStateOwner, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TRUE, xxxDestroyWindow(), xxxMNCloseHierarchy(), xxxMNDismiss(), and xxxMNReleaseCapture().

Referenced by xxxDestroyWindow(), xxxDWP_DoCancelMode(), and xxxEndMenuLoop().

00126 { 00127 BOOL fMenuStateOwner; 00128 PPOPUPMENU ppopup; 00129 PTHREADINFO ptiCurrent; 00130 00131 if ((ppopup = pMenuState->pGlobalPopupMenu) == NULL) { 00132 00133 /* 00134 * We're not really in menu mode. This can happen 00135 * if we are forced out of menu loop too soon; i.e, from 00136 * inside xxxMNGetPopup or xxxTrackPopupMenuEx. 00137 */ 00138 UserAssert(!pMenuState->fInsideMenuLoop && !pMenuState->fMenuStarted); 00139 return; 00140 } 00141 00142 00143 00144 pMenuState->fInsideMenuLoop = FALSE; 00145 pMenuState->fMenuStarted = FALSE; 00146 /* 00147 * Mark the popup as destroyed so people will not use it anymore. 00148 * This means that root popups can be marked as destroyed before 00149 * actually being destroyed (nice and confusing). 00150 */ 00151 ppopup->fDestroyed = TRUE; 00152 00153 /* 00154 * Determine if this is the menu loop owner before calling back. 00155 * Only the owner can destroy the menu windows 00156 */ 00157 ptiCurrent = PtiCurrent(); 00158 fMenuStateOwner = (ptiCurrent == pMenuState->ptiMenuStateOwner); 00159 00160 /* 00161 * Release mouse capture if we got it in xxxStartMenuState 00162 */ 00163 if (ptiCurrent->pq->spwndCapture == pMenuState->pGlobalPopupMenu->spwndNotify) { 00164 xxxMNReleaseCapture(); 00165 } 00166 00167 /* 00168 * Bail if this is not the menu loop owner 00169 */ 00170 if (!fMenuStateOwner) { 00171 RIPMSG1(RIP_WARNING, "xxxEndMenu: Thread %#p doesn't own the menu loop", ptiCurrent); 00172 return; 00173 } 00174 /* 00175 * If the menu loop is running on a thread different than the thread 00176 * that owns spwndNotify, we can have two threads trying to end 00177 * this menu at the same time. 00178 */ 00179 if (pMenuState->fInEndMenu) { 00180 RIPMSG1(RIP_WARNING, "xxxEndMenu: already in EndMenu. pMenuState:%#p", pMenuState); 00181 return; 00182 } 00183 pMenuState->fInEndMenu = TRUE; 00184 00185 if (pMenuState->pGlobalPopupMenu->spwndNotify != NULL) { 00186 if (!pMenuState->pGlobalPopupMenu->fInCancel) { 00187 xxxMNDismiss(pMenuState); 00188 } 00189 } else { 00190 BOOL fTrackedPopup = ppopup->fIsTrackPopup; 00191 00192 /* 00193 * This should do the same stuff as MenuCancelMenus but not send any 00194 * messages... 00195 */ 00196 xxxMNCloseHierarchy(ppopup, pMenuState); 00197 00198 if (fTrackedPopup) { 00199 xxxDestroyWindow(ppopup->spwndPopupMenu); 00200 } 00201 00202 } 00203 00204 }

void xxxEndMenuLoop PMENUSTATE  pMenuState,
PPOPUPMENU  ppopupmenu
 

Definition at line 584 of file mnloop.c.

References BOOL, FALSE, tagPOPUPMENU::fInCancel, tagMENUSTATE::fInEndMenu, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fModelessMenu, tagMENUSTATE::fUnderline, GETPTI, gpqForeground, HRGN_FULL, IsRootPopupMenu(), NCA_ACTIVE, NCA_FORCEFRAMEOFF, NULL, tagTHREADINFO::pq, tagQ::spwndActive, tagPOPUPMENU::spwndNotify, TestWF, ThreadLock, ThreadLockAlways, ThreadUnlock, WFFRAMEON, xxxDrawMenuBarUnderlines(), xxxDWP_DoNCActivate(), xxxEndMenu(), and xxxMNDismiss().

Referenced by xxxCallHandleMenuMessages(), xxxDestroyThreadInfo(), xxxMenuWindowProc(), and xxxMNLoop().

00585 { 00586 00587 UserAssert(IsRootPopupMenu(ppopupmenu)); 00588 00589 if (ppopupmenu->fIsTrackPopup) { 00590 if (!ppopupmenu->fInCancel) { 00591 xxxMNDismiss(pMenuState); 00592 } 00593 } else { 00594 if (pMenuState->fUnderline) { 00595 TL tlpwnd; 00596 ThreadLock(ppopupmenu->spwndNotify, &tlpwnd); 00597 xxxDrawMenuBarUnderlines(ppopupmenu->spwndNotify, FALSE); 00598 ThreadUnlock(&tlpwnd); 00599 } 00600 if (!pMenuState->fInEndMenu) { 00601 xxxEndMenu(pMenuState); 00602 } 00603 } 00604 /* 00605 * If this is a modeless menu, make sure that the notification 00606 * window caption is drawn in the proper state 00607 */ 00608 if (pMenuState->fModelessMenu && (ppopupmenu->spwndNotify != NULL)) { 00609 PWND pwndNotify = ppopupmenu->spwndNotify; 00610 PTHREADINFO pti = GETPTI(pwndNotify); 00611 BOOL fFrameOn = (pti->pq == gpqForeground) 00612 && (pti->pq->spwndActive == pwndNotify); 00613 TL tlpwndNotify; 00614 00615 if (fFrameOn ^ !!TestWF(pwndNotify, WFFRAMEON)) { 00616 ThreadLockAlways(pwndNotify, &tlpwndNotify); 00617 xxxDWP_DoNCActivate(pwndNotify, 00618 (fFrameOn ? NCA_ACTIVE : NCA_FORCEFRAMEOFF), 00619 HRGN_FULL); 00620 ThreadUnlock(&tlpwndNotify); 00621 00622 } 00623 } 00624 }

BOOL xxxEndPaint PWND  pwnd,
PAINTSTRUCT *  lpps
 

Referenced by NtUserBeginPaint(), NtUserEndPaint(), xxxDesktopWndProc(), xxxDWP_Paint(), xxxMenuWindowProc(), xxxSBWndProc(), and xxxTooltipWndProc().

VOID xxxEndScroll PWND  pwnd,
BOOL  fCancel
 

Definition at line 1782 of file sbctl.c.

References _GetMessagePos(), _KillSystemTimer(), CheckLock, ClrWF, tagSBTRACK::cmdSB, DrawCtlThumb(), DWORD, FALSE, tagSBTRACK::fCtlSB, tagSBTRACK::fTrackVert, FWINABLE, GET_X_LPARAM, GET_Y_LPARAM, tagSBTRACK::hTimerSB, IDSYS_SCROLL, IsWinEventNotifyDeferred, NULL, tagSBTRACK::posOld, tagSBTRACK::pSBCalc, PtiCurrent, PtInRect(), PWNDTOPSBTRACK, tagSBTRACK::rcTrack, tagWND::rcWindow, RETURN_IF_PSBTRACK_INVALID, tagSBTRACK::spwndSB, tagSBTRACK::spwndSBNotify, tagSBTRACK::spwndTrack, TestWF, UINT, Unlock, WFSCROLLBUTTONDOWN, WFVERTSCROLLTRACK, xxxDoScroll(), xxxDrawThumb(), tagSBTRACK::xxxpfnSB, xxxReleaseCapture(), xxxTrackBox(), xxxTrackThumb(), xxxWindowEvent(), zzzDrawInvertScrollArea(), and zzzShowCaret().

Referenced by xxxDWP_DoCancelMode(), xxxTrackBox(), and xxxTrackThumb().

01785 { 01786 UINT oldcmd; 01787 PSBTRACK pSBTrack; 01788 CheckLock(pwnd); 01789 UserAssert(!IsWinEventNotifyDeferred()); 01790 01791 pSBTrack = PWNDTOPSBTRACK(pwnd); 01792 if (pSBTrack && PtiCurrent()->pq->spwndCapture == pwnd && pSBTrack->xxxpfnSB != NULL) { 01793 01794 oldcmd = pSBTrack->cmdSB; 01795 pSBTrack->cmdSB = 0; 01796 xxxReleaseCapture(); 01797 01798 // After xxxReleaseCapture, revalidate pSBTrack 01799 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01800 01801 if (pSBTrack->xxxpfnSB == xxxTrackThumb) { 01802 01803 if (fCancel) { 01804 pSBTrack->posOld = pSBTrack->pSBCalc->pos; 01805 } 01806 01807 /* 01808 * DoScroll does thread locking on these two pwnds - 01809 * this is ok since they are not used after this 01810 * call. 01811 */ 01812 if (pSBTrack->spwndSBNotify != NULL) { 01813 xxxDoScroll(pSBTrack->spwndSB, pSBTrack->spwndSBNotify, 01814 SB_THUMBPOSITION, pSBTrack->posOld, pSBTrack->fTrackVert 01815 ); 01816 // After xxxDoScroll, revalidate pSBTrack 01817 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01818 } 01819 01820 if (pSBTrack->fCtlSB) { 01821 DrawCtlThumb((PSBWND) pwnd); 01822 } else { 01823 xxxDrawThumb(pwnd, pSBTrack->pSBCalc, pSBTrack->fTrackVert); 01824 // Note: after xxx, pSBTrack may no longer be valid 01825 } 01826 01827 } else if (pSBTrack->xxxpfnSB == xxxTrackBox) { 01828 DWORD lParam; 01829 POINT ptMsg; 01830 01831 if (pSBTrack->hTimerSB != 0) { 01832 _KillSystemTimer(pwnd, IDSYS_SCROLL); 01833 pSBTrack->hTimerSB = 0; 01834 } 01835 lParam = _GetMessagePos(); 01836 #ifdef USE_MIRRORING 01837 if (TestWF(pwnd, WEFLAYOUTRTL)) { 01838 ptMsg.x = pwnd->rcWindow.right - GET_X_LPARAM(lParam); 01839 } else 01840 #endif 01841 { 01842 ptMsg.x = GET_X_LPARAM(lParam) - pwnd->rcWindow.left; 01843 } 01844 ptMsg.y = GET_Y_LPARAM(lParam) - pwnd->rcWindow.top; 01845 if (PtInRect(&pSBTrack->rcTrack, ptMsg)) { 01846 zzzDrawInvertScrollArea(pwnd, pSBTrack, FALSE, oldcmd); 01847 // Note: after zzz, pSBTrack may no longer be valid 01848 } 01849 } 01850 01851 /* 01852 * Always send SB_ENDSCROLL message. 01853 * 01854 * DoScroll does thread locking on these two pwnds - 01855 * this is ok since they are not used after this 01856 * call. 01857 */ 01858 01859 // After xxxDrawThumb or zzzDrawInvertScrollArea, revalidate pSBTrack 01860 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01861 01862 if (pSBTrack->spwndSBNotify != NULL) { 01863 xxxDoScroll(pSBTrack->spwndSB, pSBTrack->spwndSBNotify, 01864 SB_ENDSCROLL, 0, pSBTrack->fTrackVert); 01865 // After xxxDoScroll, revalidate pSBTrack 01866 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01867 } 01868 01869 ClrWF(pwnd, WFSCROLLBUTTONDOWN); 01870 ClrWF(pwnd, WFVERTSCROLLTRACK); 01871 01872 if (FWINABLE()) { 01873 xxxWindowEvent(EVENT_SYSTEM_SCROLLINGEND, pwnd, 01874 (pSBTrack->fCtlSB ? OBJID_CLIENT : 01875 (pSBTrack->fTrackVert ? OBJID_VSCROLL : OBJID_HSCROLL)), 01876 INDEXID_CONTAINER, 0); 01877 // After xxxWindowEvent, revalidate pSBTrack 01878 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01879 } 01880 01881 /* 01882 * If this is a Scroll Bar Control, turn the caret back on. 01883 */ 01884 if (pSBTrack->spwndSB != NULL) { 01885 zzzShowCaret(pSBTrack->spwndSB); 01886 // After zzz, revalidate pSBTrack 01887 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 01888 } 01889 01890 01891 pSBTrack->xxxpfnSB = NULL; 01892 01893 /* 01894 * Unlock structure members so they are no longer holding down windows. 01895 */ 01896 Unlock(&pSBTrack->spwndSB); 01897 Unlock(&pSBTrack->spwndSBNotify); 01898 Unlock(&pSBTrack->spwndTrack); 01899 UserFreePool(pSBTrack); 01900 PWNDTOPSBTRACK(pwnd) = NULL; 01901 } 01902 }

BOOL xxxEnumDesktops FARPROC  ,
LONG  ,
BOOL 
 

BOOL xxxEnumDisplayMonitors HDC  hdc,
LPRECT  lprcClip,
MONITORENUMPROC  lpfnEnum,
LPARAM  dwData,
BOOL  fInternal
 

Definition at line 99 of file multimon.c.

References BOOL, CopyRect, FALSE, GetMonitorDC(), gpDispInfo, IntersectRect(), LookupDC(), NULL, OffsetRect(), tagDISPLAYINFO::pMonitorFirst, tagMONITOR::pMonitorNext, PtiCurrent, PtoH, tagDCE::pwndOrg, tagMONITOR::rcMonitor, tagDISPLAYINFO::rcScreen, ReleaseCacheDC(), ThreadLockAlwaysWithPti, ThreadUnlock, TRUE, and xxxClientMonitorEnumProc().

Referenced by NtUserEnumDisplayMonitors(), and xxxInternalPaintDesktop().

00105 { 00106 RECT rcPaint; 00107 POINT ptOrg; 00108 RECT rcMonitorPaint; 00109 BOOL fReturn; 00110 PMONITOR pMonitor; 00111 TL tlpMonitor; 00112 PTHREADINFO ptiCurrent = PtiCurrent(); 00113 PDCE pdcePaint; 00114 HDC hdcMonitor; 00115 PWND pwndOrg; 00116 00117 /* 00118 * Validate the DC passed in. 00119 */ 00120 if (hdcPaint) { 00121 00122 if ((pdcePaint = LookupDC(hdcPaint)) == NULL) { 00123 RIPMSG0(RIP_WARNING, "EnumDisplayMonitors: LookupDC failed"); 00124 return FALSE; 00125 } 00126 00127 pwndOrg = pdcePaint->pwndOrg; 00128 00129 /* 00130 * Intersect the painting area with the clipbox. If there 00131 * isn't anything, bail out now. 00132 */ 00133 if (GreGetClipBox(hdcPaint, &rcPaint, FALSE) == NULLREGION) 00134 return TRUE; 00135 00136 if (lprcPaint && !IntersectRect(&rcPaint, &rcPaint, lprcPaint)) 00137 return TRUE; 00138 00139 /* 00140 * rcPaint is in dc coordinates. We must convert to screen 00141 * coords so we can intersect with monitors. 00142 */ 00143 GreGetDCOrg(hdcPaint, &ptOrg); 00144 OffsetRect(&rcPaint, ptOrg.x, ptOrg.y); 00145 } else { 00146 CopyRect(&rcPaint, &gpDispInfo->rcScreen); 00147 if (lprcPaint && !IntersectRect(&rcPaint, &rcPaint, lprcPaint)) 00148 return TRUE; 00149 } 00150 00151 fReturn = TRUE; 00152 00153 for (pMonitor = gpDispInfo->pMonitorFirst; pMonitor != NULL; 00154 pMonitor = pMonitor->pMonitorNext) { 00155 00156 /* 00157 * Note: the check for MONF_VISIBLE was removed to allow mirror drivers 00158 * to see monitor specific updates. 00159 */ 00160 if (!IntersectRect(&rcMonitorPaint, &rcPaint, &pMonitor->rcMonitor)) { 00161 continue; 00162 } 00163 00164 if (hdcPaint) { 00165 00166 if ((hdcMonitor = GetMonitorDC(pdcePaint, pMonitor)) == NULL) { 00167 RIPMSG0(RIP_WARNING, "EnumDisplayMonitors: GetMonitorDC failed"); 00168 return FALSE; 00169 } 00170 00171 OffsetRect(&rcMonitorPaint, -ptOrg.x, -ptOrg.y); 00172 GreIntersectClipRect( 00173 hdcMonitor, 00174 rcMonitorPaint.left, 00175 rcMonitorPaint.top, 00176 rcMonitorPaint.right, 00177 rcMonitorPaint.bottom); 00178 } else { 00179 00180 hdcMonitor = NULL; 00181 } 00182 00183 ThreadLockAlwaysWithPti(ptiCurrent, pMonitor, &tlpMonitor); 00184 00185 if (fInternal) { 00186 fReturn = (*lpfnEnum) ( 00187 (HMONITOR) pMonitor, 00188 hdcMonitor, 00189 &rcMonitorPaint, 00190 lData); 00191 00192 } else { 00193 fReturn = xxxClientMonitorEnumProc( 00194 PtoH(pMonitor), 00195 hdcMonitor, 00196 &rcMonitorPaint, 00197 lData, 00198 lpfnEnum); 00199 } 00200 00201 /* 00202 * We just called back and the monitor has been freed if 00203 * ThreadUnlock returns NULL. The entire monitor configuration may 00204 * have changed, the monitors may have been rearranged, so just stop 00205 * enumerating at this point. 00206 */ 00207 if (ThreadUnlock(&tlpMonitor) == NULL) { 00208 fReturn = FALSE; 00209 } 00210 00211 if (hdcMonitor) 00212 ReleaseCacheDC(hdcMonitor, FALSE); 00213 00214 if (!fReturn) 00215 break; 00216 00217 /* 00218 * Revalidate hdcPaint, since it could have been messed with 00219 * in the callback. 00220 */ 00221 if (hdcPaint) { 00222 if ((pdcePaint = LookupDC(hdcPaint)) == NULL) { 00223 RIPMSG0(RIP_WARNING, "EnumDisplayMonitors: LookupDC failed"); 00224 return FALSE; 00225 } 00226 00227 if (pdcePaint->pwndOrg != pwndOrg) { 00228 RIPMSG0(RIP_WARNING, "EnumDisplayMonitors: wrong window"); 00229 return FALSE; 00230 } 00231 } 00232 } 00233 00234 return fReturn; 00235 }

BOOL xxxFillWindow PWND  pwndBrush,
PWND  pwndPaint,
HDC  hdc,
HBRUSH  hbr
 

Definition at line 33 of file paint.c.

References BOOL, CheckLock, NULL, TRUE, UT_GetParentDCClipBox(), and xxxPaintRect().

Referenced by NtUserFillWindow(), and xxxDWP_EraseBkgnd().

00038 { 00039 RECT rc; 00040 00041 CheckLock(pwndBrush); 00042 CheckLock(pwndPaint); 00043 00044 /* 00045 * If there is no pwndBrush (sometimes the parent), use pwndPaint. 00046 */ 00047 if (pwndBrush == NULL) 00048 pwndBrush = pwndPaint; 00049 00050 if (UT_GetParentDCClipBox(pwndPaint, hdc, &rc)) 00051 return xxxPaintRect(pwndBrush, pwndPaint, hdc, hbr, &rc); 00052 00053 return TRUE; 00054 }

BOOL xxxFlashWindow PWND  pwnd,
DWORD  dwFlags,
DWORD  dwTimeout
 

Definition at line 27 of file kernel/winmgr.c.

References _KillSystemTimer(), _PostMessage(), BOOL, CheckLock, COPY_FLAG, dwFlags, DWORD, FALSE, gbFullScreen, GetFlashWindowState(), GETPTI, gpqForeground, gpsi, gspwndAltTab, gspwndFullScreen, HWq, IDSYS_FLASHWND, InternalSetTimer(), IsTrayWindow(), L, NULL, PostShellHookMessages(), RemoveFlashWindowState(), SET_OR_CLEAR_FLAG, SetFlashWindowState(), tagQ::spwndActive, TestWF, WFFRAMEON, xxxCallHook(), xxxSendMessage(), and xxxSystemTimerProc().

Referenced by _UserSoundSentryWorker(), NtUserFlashWindowEx(), SoundSentryTimer(), xxxDWP_SetCursor(), xxxSetForegroundWindow(), and xxxSystemTimerProc().

00031 { 00032 00033 BOOL fStatePrev = FALSE; 00034 BOOL fFlashOn; 00035 DWORD dwState; 00036 00037 CheckLock(pwnd); 00038 /* 00039 * Get the previous state. If not available (FLASHW_STOP) then 00040 * initialize on/off based on frame 00041 */ 00042 dwState = GetFlashWindowState(pwnd); 00043 if (dwState == FLASHW_DONE) { 00044 /* 00045 * We just need to clean up and to set the activation correctly 00046 */ 00047 dwState |= FLASHW_KILLTIMER; 00048 dwFlags = FLASHW_STOP; 00049 goto flash; 00050 } 00051 if (dwState == FLASHW_STOP) { 00052 #if defined(_X86_) 00053 /* 00054 * If there is a fullscreen cmd window, switch it to window mode 00055 * so that the user gets a chance to see the flashing one 00056 */ 00057 if (gbFullScreen == FULLSCREEN) { 00058 _PostMessage(gspwndFullScreen, WM_USER + 6, (WPARAM)WINDOWED, (LPARAM)0); 00059 } 00060 #endif // _X86_ 00061 if (TestWF(pwnd, WFFRAMEON)) { 00062 dwState = FLASHW_ON | FLASHW_STARTON; 00063 } 00064 } else if (dwFlags == FLASHW_TIMERCALL) { 00065 dwFlags = dwState; 00066 } 00067 dwFlags &= FLASHW_CALLERBITS; 00068 fStatePrev = (dwState & FLASHW_ON); 00069 /* 00070 * Later5.0 Gerardob 00071 * Not sure why we do this check but it used to be here. 00072 */ 00073 if (pwnd == gspwndAltTab) { 00074 return fStatePrev; 00075 } 00076 /* 00077 * Check if we're waiting to come to the foreground to stop. 00078 */ 00079 if (dwState & FLASHW_FLASHNOFG) { 00080 if (gpqForeground == GETPTI(pwnd)->pq) 00081 dwFlags = FLASHW_STOP; 00082 } 00083 00084 flash: 00085 /* 00086 * Figure out new state 00087 */ 00088 if (dwFlags != FLASHW_STOP) { 00089 fFlashOn = !fStatePrev; 00090 } else { 00091 fFlashOn = (gpqForeground != NULL) && (gpqForeground->spwndActive == pwnd); 00092 } 00093 /* 00094 * Flash'em 00095 */ 00096 if ((dwFlags == FLASHW_STOP) || (dwFlags & FLASHW_CAPTION)) { 00097 xxxSendMessage(pwnd, WM_NCACTIVATE, fFlashOn, 0L); 00098 } 00099 if ((dwFlags == FLASHW_STOP) || (dwFlags & FLASHW_TRAY)) { 00100 if (IsTrayWindow(pwnd)) { 00101 HWND hw = HWq(pwnd); 00102 BOOL fShellFlash; 00103 if (dwState & FLASHW_DONE) { 00104 /* 00105 * If the window is not the active one when we're done flashing, 00106 * let the tray icon remain activated. The Shell is going to 00107 * take care to restore it at the when the window gets activated 00108 */ 00109 fShellFlash = !fFlashOn; 00110 } else { 00111 fShellFlash = (dwFlags == FLASHW_STOP ? FALSE : fFlashOn); 00112 } 00113 xxxCallHook(HSHELL_REDRAW, (WPARAM) hw, (LPARAM) fShellFlash, WH_SHELL); 00114 PostShellHookMessages(fShellFlash? HSHELL_FLASH:HSHELL_REDRAW, (LPARAM)hw); 00115 } 00116 } 00117 /* 00118 * If we're to continue, check count, set timer and store 00119 * state as appropriate. Otherwise, kill timer and remove 00120 * state 00121 */ 00122 if (dwFlags != FLASHW_STOP) { 00123 /* 00124 * If counting, decrement count when we complete a cycle 00125 */ 00126 if (HIWORD(dwFlags) != 0) { 00127 dwState |= FLASHW_COUNTING; 00128 if (!(fFlashOn ^ !!(dwState & FLASHW_STARTON))) { 00129 dwFlags -= MAKELONG(0,1); 00130 } 00131 /* 00132 * Make sure we have a timer going. 00133 */ 00134 if (!(dwState & FLASHW_KILLTIMER)) { 00135 dwFlags |= FLASHW_TIMER; 00136 } 00137 } 00138 /* 00139 * Set a timer if needed. 00140 */ 00141 if (dwFlags & FLASHW_TIMER) { 00142 dwState |= FLASHW_KILLTIMER; 00143 InternalSetTimer(pwnd, 00144 IDSYS_FLASHWND, 00145 dwTimeout ? dwTimeout : gpsi->dtCaretBlink, 00146 xxxSystemTimerProc, 00147 TMRF_SYSTEM); 00148 } 00149 /* 00150 * Remember on/off state, propagate public flags 00151 * and count then save the state 00152 */ 00153 if (dwState & FLASHW_COUNTING && 00154 HIWORD(dwFlags) == 0) { 00155 dwState = FLASHW_DONE; 00156 } 00157 else { 00158 SET_OR_CLEAR_FLAG(dwState, FLASHW_ON, fFlashOn); 00159 COPY_FLAG(dwState, dwFlags, FLASHW_CALLERBITS & ~FLASHW_TIMER); 00160 } 00161 SetFlashWindowState(pwnd, dwState); 00162 00163 } else { 00164 /* 00165 * We're done. 00166 */ 00167 if (dwState & FLASHW_KILLTIMER) { 00168 _KillSystemTimer(pwnd, IDSYS_FLASHWND); 00169 } 00170 RemoveFlashWindowState(pwnd); 00171 } 00172 00173 return fStatePrev; 00174 }

VOID xxxFlushDeferredWindowEvents  ) 
 

Definition at line 217 of file kernel/winable.c.

References DWORD, tagNOTIFY::dwWEFlags, gpPendingNotifies, tagNOTIFY::idSenderThread, IsWinEventNotifyDeferredOK, tagNOTIFY::pNotifyNext, WEF_ASYNC, WEF_DEFERNOTIFY, and xxxProcessNotifyWinEvent().

Referenced by xxxWindowEvent().

00218 { 00219 PNOTIFY pNotify; 00220 DWORD idCurrentThread = W32GetCurrentTID(); 00221 00222 if (idCurrentThread == 0) { 00223 RIPMSG0(RIP_ERROR, "processing deferred notifications before we have a pti!"); 00224 // return; 00225 } 00226 00227 UserAssert(IsWinEventNotifyDeferredOK()); 00228 00229 pNotify = gpPendingNotifies; 00230 while (pNotify) { 00231 if (((pNotify->dwWEFlags & WEF_DEFERNOTIFY) == 0) || 00232 (pNotify->idSenderThread != idCurrentThread)) { 00233 // UserAssert(pNotify->idSenderThread == idCurrentThread); // just testing! 00234 pNotify = pNotify->pNotifyNext; 00235 } else { 00236 /* 00237 * Clear WEF_DEFERNOTIFY so that if we recurse in the callback 00238 * we won't try to send this notification again. 00239 */ 00240 pNotify->dwWEFlags &= ~WEF_DEFERNOTIFY; 00241 #if DBG 00242 gnDeferredWinEvents--; 00243 #endif 00244 /* 00245 * We shouldn't have deferred ASYNC notifications: we should have 00246 * posted them immediately. 00247 */ 00248 UserAssert((pNotify->dwWEFlags & WEF_ASYNC) == 0); 00249 xxxProcessNotifyWinEvent(pNotify); 00250 /* 00251 * Start again at the head of the list, in case it munged during 00252 * the callback. 00253 */ 00254 pNotify = gpPendingNotifies; 00255 } 00256 } 00257 }

VOID xxxFlushPalette PWND  pwnd  ) 
 

Definition at line 220 of file palette.c.

References CheckLock, gpDispInfo, tagDISPLAYINFO::hdcScreen, TRUE, VOID(), and xxxBroadcastPaletteChanged().

Referenced by xxxDestroyThreadInfo(), xxxDestroyWindow(), and xxxMinMaximize().

00222 { 00223 CheckLock(pwnd); 00224 /* 00225 * Broadcast the palette changed messages. 00226 */ 00227 GreRealizeDefaultPalette(gpDispInfo->hdcScreen, TRUE); 00228 xxxBroadcastPaletteChanged(pwnd, TRUE); 00229 }

VOID xxxFocusSetInputContext IN PWND  pwnd,
IN BOOL  fActivate,
IN BOOL  fQueueMsg
 

Definition at line 405 of file ntimm.c.

References tagSERVERINFO::atomSysClass, CFIME, CheckLock, GETPTI, gpsi, HWq, ICLS_IME, L, NULL, tagTHREADINFO::spwndDefaultIme, TestCF, TestWF, ThreadLockAlways, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, VOID(), WFDESTROYED, xxxSendMessage(), and xxxSendMessageCallback().

Referenced by CancelInputState(), xxxDeactivate(), xxxDestroyWindow(), and xxxSendFocusMessages().

00409 { 00410 PTHREADINFO pti; 00411 PWND pwndDefaultIme; 00412 TL tlpwndDefaultIme; 00413 00414 CheckLock(pWnd); 00415 00416 pti = GETPTI(pWnd); 00417 00418 /* 00419 * CS_IME class or "IME" class windows can not be SetActivated to hImc. 00420 * WinWord 6.0 US Help calls ShowWindow with the default IME window. 00421 * HELPMACROS get the default IME window by calling GetNextWindow(). 00422 */ 00423 if (TestCF(pWnd, CFIME) || 00424 (pWnd->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME])) 00425 return; 00426 00427 /* 00428 * Do nothing if the thread does not have default IME window. 00429 */ 00430 if ((pwndDefaultIme = pti->spwndDefaultIme) == NULL) 00431 return; 00432 00433 /* 00434 * If the thread is going away or the default IME window is being vanished, 00435 * then do nothing. 00436 */ 00437 if (pti->TIF_flags & TIF_INCLEANUP) 00438 return; 00439 00440 UserAssert(!TestWF(pwndDefaultIme, WFDESTROYED)); 00441 00442 ThreadLockAlways(pwndDefaultIme, &tlpwndDefaultIme); 00443 00444 if (fQueueMsg) { 00445 xxxSendMessageCallback(pwndDefaultIme, WM_IME_SYSTEM, 00446 fActivate ? IMS_ACTIVATECONTEXT : IMS_DEACTIVATECONTEXT, 00447 (LPARAM)HWq(pWnd), NULL, 1L, 0); 00448 } else { 00449 xxxSendMessage(pwndDefaultIme, WM_IME_SYSTEM, 00450 fActivate ? IMS_ACTIVATECONTEXT : IMS_DEACTIVATECONTEXT, 00451 (LPARAM)HWq(pWnd)); 00452 } 00453 00454 #if _DBG 00455 if (pti->spwndDefaultIme != pwndDefaultIme) { 00456 RIPMSG1(RIP_WARNING, "pti(%#p)->spwndDefaultIme got freed during the callback.", pti); 00457 } 00458 #endif 00459 00460 ThreadUnlock(&tlpwndDefaultIme); 00461 00462 return; 00463 }

VOID xxxFreeKeyboardLayouts PWINDOWSTATION  ,
BOOL  bUnlock
 

Definition at line 1647 of file kbdlyout.c.

References HKLtoPKL(), NULL, PtiCurrent, tagWINDOWSTATION::spklList, Unlock, VOID(), and xxxInternalUnloadKeyboardLayout().

Referenced by xxxLoadKeyboardLayoutEx().

01649 { 01650 PKL pkl; 01651 01652 /* 01653 * Unload all of the windowstation's layouts. 01654 * They may still be locked by some threads (eg: console), so this 01655 * may not destroy them all, but it will mark them all KL_UNLOADED. 01656 * Set KLF_INITTIME to ensure that the default layout (gspklBaseLayout) 01657 * gets unloaded too. 01658 * Note: it's much faster to unload non-active layouts, so start with 01659 * the next loaded layout, leaving the active layout till last. 01660 */ 01661 while ((pkl = HKLtoPKL(PtiCurrent(), (HKL)HKL_NEXT)) != NULL) { 01662 xxxInternalUnloadKeyboardLayout(pwinsta, pkl, KLF_INITTIME); 01663 } 01664 01665 /* 01666 * The WindowStation is being destroyed, or one user's layouts are being 01667 * replaced by another user's, so it's OK to Unlock spklList. 01668 * Any layout still in the double-linked circular KL list will still be 01669 * pointed to by gspklBaseLayout: this is important, since we don't want 01670 * to leak any KL or KBDFILE objects by losing pointers to them. 01671 * There are no layouts when we first come here (during bootup). 01672 */ 01673 if (bUnlock) { 01674 Unlock(&pwinsta->spklList); 01675 } 01676 }

VOID xxxFreeWindow PWND  pwnd,
PTL  ptlpwndFree
 

Definition at line 2218 of file createw.c.

References _DeregisterShellHookWindow(), _DestroyMenu(), _GetProcessWindowStation(), _GetProp(), _MonitorFromWindow(), _PostQuitMessage(), tagSERVERINFO::atomIconProp, tagSERVERINFO::atomSysClass, _LARGE_UNICODE_STRING::Buffer, CallClientWorkerProc, CFCLASSDC, CFOWNDC, CheckLock, ClearHungFlag(), ClearSendMessages(), ClrWF, tagDDEIMP::cRefConv, tagDDEIMP::cRefInit, tagTHREADINFO::cWindows, tagCLS::cWndReferenceCount, DCE_FREED, DCE_NORELEASE, DCE_RELEASED, tagDCE::DCX_flags, DecPaintCount(), DeleteHrgnClip(), DeleteMaybeSpecialRgn(), DeleteProperties(), DereferenceClass(), DesktopFree, DestroyCacheDC(), DestroyWindowsHotKeys(), DestroyWindowSmIcon(), DestroyWindowsTimers(), DF_MOUSEMOVETRK, DF_TOOLTIPSHOWING, FALSE, FindQMsg(), FindSpb(), FNID, FNID_CLEANEDUP_BIT, FNID_CONTROLEND, FNID_DELETED_BIT, FNID_DESKTOP, FNID_TO_CLIENT_PFNWORKER, FNID_WNDPROCEND, FNID_WNDPROCSTART, FreeSpb(), gcountPWO, GetClassPtr(), GETFNID, GETPDESK, gpDispInfo, gpsi, gptiLockUpdate, gspwndActivate, gspwndCursor, gspwndLockUpdate, gspwndMouseOwner, HANDLEF_INDESTROY, tagDCE::hdc, tagDISPLAYINFO::hDev, tagWND::head, HMChangeOwnerThread(), HMFreeObject(), HMIsMarkDestroy, HMMarkObjectDestroy(), hModuleWin, HMPheFromObject, tagWND::hrgnClip, tagDCE::hrgnClip, tagWND::hrgnUpdate, ICLS_ICONTITLE, InternalRemoveProp(), IS_IME_ENABLED, L, _LARGE_UNICODE_STRING::Length, Lock, tagWND::lpfnWndProc, MAKEINTATOM, MarkDCEInvalid(), tagTHREADINFO::mlPost, tagQMSG::msg, NEEDSPAINT, NEEDSSYNCPAINT, NULL, tagWND::pcls, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PDDECONV, PDDEIMP, tagTHREADINFO::ppi, PpiCurrent, tagWND::ppropList, tagTHREADINFO::pq, tagMLIST::pqmsgRead, PROP_DDEIMP, PROP_DDETRACK, PROP_WNDOBJ, PROPF_INTERNAL, tagWND::pSBInfo, tagWINDOWSTATION::ptiClipLock, PtiCurrent, PTL, PTOOLTIPWND, tagDCE::pwndClip, tagDCE::pwndOrg, ReleaseCacheDC(), SetWF, tagWND::spmenu, tagWND::spmenuSys, tagQ::spwndActivePrev, tagQ::spwndCapture, tagWND::spwndChild, tagWINDOWSTATION::spwndClipOpen, tagWINDOWSTATION::spwndClipViewer, tagTHREADINFO::spwndDefaultIme, tagQ::spwndFocus, tagWND::spwndLastActive, tagWND::spwndOwner, tagWND::spwndParent, tagWND::strName, TestCF, TestWF, TestwndChild, ThreadLockAlways, ThreadLockAlwaysWithPti, ThreadLockDesktop, ThreadUnlock, ThreadUnlockDesktop, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, UINT, Unlock, UnlockNotifyWindow(), UnlockWndMenu(), UnsetLayeredWindow(), VOID(), WEFLAYERED, WFHASPALETTE, WFHASSPB, WFINDESTROY, WFINTERNALPAINT, WFMAXFAKEREGIONAL, WFMSGBOX, WFREDRAWFRAMEIFHUNG, WFREDRAWIFHUNG, WFSENDERASEBKGND, WFSENDNCPAINT, WFSERVERSIDEPROC, WFSHELLHOOKWND, WFTILED, WFTYPEMASK, WFVISIBLE, xxxDDETrackWindowDying(), xxxDefWindowProc(), xxxFW_DestroyAllChildren(), xxxReleaseCapture(), xxxRemoveFullScreen(), xxxResetTooltip(), and xxxSendMessage().

Referenced by xxxCreateWindowEx(), xxxDestroyWindow(), xxxFW_DestroyAllChildren(), and xxxProcessEventMessage().

02221 { 02222 PDCE *ppdce; 02223 PDCE pdce; 02224 UINT uDCERelease; 02225 PMENU pmenu; 02226 PQMSG pqmsg; 02227 PPCLS ppcls; 02228 WORD fnid; 02229 TL tlpdesk; 02230 PWINDOWSTATION pwinsta = _GetProcessWindowStation(NULL); 02231 PTHREADINFO pti = PtiCurrent(); 02232 PPROCESSINFO ppi; 02233 PMONITOR pMonitor; 02234 TL tlpMonitor; 02235 02236 UNREFERENCED_PARAMETER(ptlpwndFree); 02237 02238 CheckLock(pwnd); 02239 02240 /* 02241 * If the pwnd is any of the global shell-related windows, 02242 * then we need to unlock them from the deskinfo. 02243 */ 02244 if (pwnd->head.rpdesk != NULL) { 02245 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndShell) 02246 Unlock(&pwnd->head.rpdesk->pDeskInfo->spwndShell); 02247 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndBkGnd) 02248 Unlock(&pwnd->head.rpdesk->pDeskInfo->spwndBkGnd); 02249 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndTaskman) 02250 Unlock(&pwnd->head.rpdesk->pDeskInfo->spwndTaskman); 02251 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndProgman) 02252 Unlock(&pwnd->head.rpdesk->pDeskInfo->spwndProgman); 02253 if (TestWF(pwnd,WFSHELLHOOKWND)) { 02254 _DeregisterShellHookWindow(pwnd); 02255 } 02256 02257 if (TestWF(pwnd, WFMSGBOX)) { 02258 pwnd->head.rpdesk->pDeskInfo->cntMBox--; 02259 ClrWF(pwnd, WFMSGBOX); 02260 } 02261 } 02262 02263 /* 02264 * First, if this handle has been marked for destruction, that means it 02265 * is possible that the current thread is not its owner! (meaning we're 02266 * being called from a handle unlock call). In this case, set the owner 02267 * to be the current thread so inter-thread send messages don't occur. 02268 */ 02269 if (HMIsMarkDestroy(pwnd)) 02270 HMChangeOwnerThread(pwnd, pti); 02271 02272 /* 02273 * Blow away the children. 02274 * 02275 * DestroyAllChildren() will still destroy windows created by other 02276 * threads! This needs to be looked at more closely: the ultimate 02277 * "right" thing to do is not to destroy these windows but just 02278 * unlink them. 02279 */ 02280 xxxFW_DestroyAllChildren(pwnd); 02281 xxxSendMessage(pwnd, WM_NCDESTROY, 0, 0L); 02282 02283 pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 02284 ThreadLockAlwaysWithPti(pti, pMonitor, &tlpMonitor); 02285 xxxRemoveFullScreen(pwnd, pMonitor); 02286 ThreadUnlock(&tlpMonitor); 02287 02288 /* 02289 * If this is one of the built in controls which hasn't been cleaned 02290 * up yet, do it now. If it lives in the kernel, call the function 02291 * directly, otherwise call back to the client. Even if the control 02292 * is sub- or super-classed, use the window procs associated with 02293 * the function id. 02294 */ 02295 fnid = GETFNID(pwnd); 02296 if ((fnid >= FNID_WNDPROCSTART) && !(pwnd->fnid & FNID_CLEANEDUP_BIT)) { 02297 02298 if (fnid <= FNID_WNDPROCEND) { 02299 02300 FNID(fnid)(pwnd, WM_FINALDESTROY, 0, 0, 0); 02301 02302 } else if (fnid <= FNID_CONTROLEND && !(pti->TIF_flags & TIF_INCLEANUP)) { 02303 02304 CallClientWorkerProc(pwnd, 02305 WM_FINALDESTROY, 02306 0, 02307 0, 02308 (PROC)FNID_TO_CLIENT_PFNWORKER(fnid)); 02309 } 02310 02311 pwnd->fnid |= FNID_CLEANEDUP_BIT; 02312 } 02313 02314 pwnd->fnid |= FNID_DELETED_BIT; 02315 02316 /* 02317 * Check to clear the most recently active window in owned list. 02318 */ 02319 if (pwnd->spwndOwner && (pwnd->spwndOwner->spwndLastActive == pwnd)) { 02320 Lock(&(pwnd->spwndOwner->spwndLastActive), pwnd->spwndOwner); 02321 } 02322 02323 /* 02324 * The windowstation may be NULL if we are destroying a desktop 02325 * or windowstation. If this is the case, this thread will not 02326 * be using the clipboard. 02327 */ 02328 if (pwinsta != NULL) { 02329 02330 if (pwnd == pwinsta->spwndClipOpen) { 02331 Unlock(&pwinsta->spwndClipOpen); 02332 pwinsta->ptiClipLock = NULL; 02333 } 02334 02335 if (pwnd == pwinsta->spwndClipViewer) { 02336 Unlock(&pwinsta->spwndClipViewer); 02337 } 02338 } 02339 02340 if (IS_IME_ENABLED() && pwnd == pti->spwndDefaultIme) 02341 Unlock(&pti->spwndDefaultIme); 02342 02343 if (pwnd == pti->pq->spwndFocus) 02344 Unlock(&pti->pq->spwndFocus); 02345 02346 if (pwnd == pti->pq->spwndActivePrev) 02347 Unlock(&pti->pq->spwndActivePrev); 02348 02349 if (pwnd == gspwndActivate) 02350 Unlock(&gspwndActivate); 02351 02352 if (pwnd->head.rpdesk != NULL) { 02353 02354 if (pwnd == pwnd->head.rpdesk->spwndForeground) 02355 Unlock(&pwnd->head.rpdesk->spwndForeground); 02356 02357 if (pwnd == pwnd->head.rpdesk->spwndTray) 02358 Unlock(&pwnd->head.rpdesk->spwndTray); 02359 02360 if (pwnd == pwnd->head.rpdesk->spwndTrack) { 02361 /* 02362 * Remove tooltip, if any 02363 */ 02364 if (GETPDESK(pwnd)->dwDTFlags & DF_TOOLTIPSHOWING) { 02365 PWND pwndTooltip = GETPDESK(pwnd)->spwndTooltip; 02366 TL tlpwndTooltip; 02367 02368 ThreadLockAlways(pwndTooltip, &tlpwndTooltip); 02369 xxxResetTooltip((PTOOLTIPWND)pwndTooltip); 02370 ThreadUnlock(&tlpwndTooltip); 02371 } 02372 02373 Unlock(&pwnd->head.rpdesk->spwndTrack); 02374 pwnd->head.rpdesk->dwDTFlags &= ~DF_MOUSEMOVETRK; 02375 } 02376 } 02377 02378 if (pwnd == pti->pq->spwndCapture) 02379 xxxReleaseCapture(); 02380 02381 /* 02382 * This window won't be needing any more input. 02383 */ 02384 if (pwnd == gspwndMouseOwner) 02385 Unlock(&gspwndMouseOwner); 02386 02387 /* 02388 * It also won't have any mouse cursors over it. 02389 */ 02390 if (pwnd == gspwndCursor) 02391 Unlock(&gspwndCursor); 02392 02393 DestroyWindowsTimers(pwnd); 02394 DestroyWindowsHotKeys(pwnd); 02395 02396 /* 02397 * Make sure this window has no pending sent messages. 02398 */ 02399 ClearSendMessages(pwnd); 02400 02401 /* 02402 * Remove the associated GDI sprite. 02403 */ 02404 if (TestWF(pwnd, WEFLAYERED)) { 02405 UnsetLayeredWindow(pwnd); 02406 } 02407 02408 #ifdef REDIRECTION 02409 if (TestWF(pwnd, WEFREDIRECTED)) { 02410 UnsetRedirectedWindow(pwnd); 02411 } 02412 #endif // REDIRECTION 02413 02414 /* 02415 * Blow away any update region lying around. 02416 */ 02417 if (NEEDSPAINT(pwnd)) { 02418 02419 DecPaintCount(pwnd); 02420 02421 DeleteMaybeSpecialRgn(pwnd->hrgnUpdate); 02422 pwnd->hrgnUpdate = NULL; 02423 ClrWF(pwnd, WFINTERNALPAINT); 02424 } 02425 02426 /* 02427 * Decrememt queue's syncpaint count if necessary. 02428 */ 02429 if (NEEDSSYNCPAINT(pwnd)) { 02430 ClrWF(pwnd, WFSENDNCPAINT); 02431 ClrWF(pwnd, WFSENDERASEBKGND); 02432 } 02433 02434 /* 02435 * Clear both flags to ensure that the window is removed 02436 * from the hung redraw list. 02437 */ 02438 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 02439 ClearHungFlag(pwnd, WFREDRAWFRAMEIFHUNG); 02440 02441 /* 02442 * If there is a WM_QUIT message in this app's message queue, call 02443 * PostQuitMessage() (this happens if the app posts itself a quit message. 02444 * WinEdit2.0 posts a quit to a window while receiving the WM_DESTROY 02445 * for that window - it works because we need to do a PostQuitMessage() 02446 * automatically for this thread. 02447 */ 02448 if (pti->mlPost.pqmsgRead != NULL) { 02449 02450 /* 02451 * try to get rid of WM_DDE_ACK too. 02452 */ 02453 if ((pqmsg = FindQMsg(pti, 02454 &(pti->mlPost), 02455 pwnd, 02456 WM_QUIT, 02457 WM_QUIT, TRUE)) != NULL) { 02458 02459 _PostQuitMessage((int)pqmsg->msg.wParam); 02460 } 02461 } 02462 02463 if (!TestwndChild(pwnd) && pwnd->spmenu != NULL) { 02464 pmenu = (PMENU)pwnd->spmenu; 02465 if (UnlockWndMenu(pwnd, &pwnd->spmenu)) 02466 _DestroyMenu(pmenu); 02467 } 02468 02469 if (pwnd->spmenuSys != NULL) { 02470 pmenu = (PMENU)pwnd->spmenuSys; 02471 if (pmenu != pwnd->head.rpdesk->spmenuDialogSys) { 02472 if (UnlockWndMenu(pwnd, &pwnd->spmenuSys)) { 02473 _DestroyMenu(pmenu); 02474 } 02475 } else { 02476 UnlockWndMenu(pwnd, &pwnd->spmenuSys); 02477 } 02478 } 02479 02480 /* 02481 * If it was using either of the desktop system menus, unlock it 02482 */ 02483 if (pwnd->head.rpdesk != NULL) { 02484 if (pwnd->head.rpdesk->spmenuSys != NULL && 02485 pwnd == pwnd->head.rpdesk->spmenuSys->spwndNotify) { 02486 02487 UnlockNotifyWindow(pwnd->head.rpdesk->spmenuSys); 02488 } else if (pwnd->head.rpdesk->spmenuDialogSys != NULL && 02489 pwnd == pwnd->head.rpdesk->spmenuDialogSys->spwndNotify) { 02490 02491 UnlockNotifyWindow(pwnd->head.rpdesk->spmenuDialogSys); 02492 } 02493 02494 } 02495 02496 02497 /* 02498 * Tell Gdi that the window is going away. 02499 */ 02500 if (gcountPWO != 0) { 02501 PVOID pwo = InternalRemoveProp(pwnd, PROP_WNDOBJ, TRUE); 02502 if (pwo != NULL) { 02503 GreLockDisplay(gpDispInfo->hDev); 02504 GreDeleteWnd(pwo); 02505 gcountPWO--; 02506 GreUnlockDisplay(gpDispInfo->hDev); 02507 } 02508 } 02509 02510 #ifdef HUNGAPP_GHOSTING 02511 02512 /* 02513 * RemoveGhost handles the case when pwnd is the hung window that has a 02514 * corresponding ghost window and the case when pwnd is the ghost itself. 02515 */ 02516 RemoveGhost(pwnd); 02517 02518 #endif // HUNGAPP_GHOSTING 02519 02520 /* 02521 * Scan the DC cache to find any DC's for this window. If any are there, 02522 * then invalidate them. We don't need to worry about calling SpbCheckDC 02523 * because the window has been hidden by this time. 02524 */ 02525 for (ppdce = &gpDispInfo->pdceFirst; *ppdce != NULL; ) { 02526 02527 pdce = *ppdce; 02528 if (pdce->DCX_flags & DCX_INVALID) { 02529 goto NextEntry; 02530 } 02531 02532 if ((pdce->pwndOrg == pwnd) || (pdce->pwndClip == pwnd)) { 02533 02534 if (!(pdce->DCX_flags & DCX_CACHE)) { 02535 02536 if (TestCF(pwnd, CFCLASSDC)) { 02537 02538 GreLockDisplay(gpDispInfo->hDev); 02539 02540 if (pdce->DCX_flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) 02541 DeleteHrgnClip(pdce); 02542 02543 MarkDCEInvalid(pdce); 02544 pdce->pwndOrg = NULL; 02545 pdce->pwndClip = NULL; 02546 pdce->hrgnClip = NULL; 02547 02548 /* 02549 * Remove the vis rgn since it is still owned - if we did 02550 * not, gdi would not be able to clean up properly if the 02551 * app that owns this vis rgn exist while the vis rgn is 02552 * still selected. 02553 */ 02554 GreSelectVisRgn(pdce->hdc, NULL, SVR_DELETEOLD); 02555 GreUnlockDisplay(gpDispInfo->hDev); 02556 02557 } else if (TestCF(pwnd, CFOWNDC)) { 02558 DestroyCacheDC(ppdce, pdce->hdc); 02559 } else { 02560 UserAssert(FALSE); 02561 } 02562 02563 } else { 02564 02565 /* 02566 * If the DC is checked out, release it before 02567 * we invalidate. Note, that if this process is exiting 02568 * and it has a dc checked out, gdi is going to destroy that 02569 * dc. We need to similarly remove that dc from the dc cache. 02570 * This is not done here, but in the exiting code. 02571 * 02572 * The return for ReleaseDC() could fail, which would 02573 * indicate a delayed-free (DCE_NUKE). 02574 */ 02575 uDCERelease = DCE_RELEASED; 02576 02577 if (pdce->DCX_flags & DCX_INUSE) { 02578 uDCERelease = ReleaseCacheDC(pdce->hdc, FALSE); 02579 } else if (!GreSetDCOwner(pdce->hdc, OBJECT_OWNER_NONE)) { 02580 uDCERelease = DCE_NORELEASE; 02581 } 02582 02583 if (uDCERelease != DCE_FREED) { 02584 02585 if (uDCERelease == DCE_NORELEASE) { 02586 02587 /* 02588 * We either could not release this dc or could not set 02589 * its owner. In either case it means some other thread 02590 * is actively using it. Since it is not too useful if 02591 * the window it is calculated for is gone, mark it as 02592 * INUSE (so we don't give it out again) and as 02593 * DESTROYTHIS (so we just get rid of it since it is 02594 * easier to do this than to release it back into the 02595 * cache). The W32PF_OWNERDCCLEANUP bit means "look for 02596 * DESTROYTHIS flags and destroy that dc", and the bit 02597 * gets looked at in various strategic execution paths. 02598 */ 02599 pdce->DCX_flags = DCX_DESTROYTHIS | DCX_INUSE | DCX_CACHE; 02600 pti->ppi->W32PF_Flags |= W32PF_OWNDCCLEANUP; 02601 02602 } else { 02603 02604 /* 02605 * We either released the DC or changed its owner 02606 * successfully. Mark the entry as invalid so it can 02607 * be given out again. 02608 */ 02609 MarkDCEInvalid(pdce); 02610 pdce->hrgnClip = NULL; 02611 } 02612 02613 /* 02614 * We shouldn't reference this window anymore. Setting 02615 * these to NULL here will make sure that even if we were 02616 * not able to release the DC here, we won't return this 02617 * window from one of the DC matching functions. 02618 */ 02619 pdce->pwndOrg = NULL; 02620 pdce->pwndClip = NULL; 02621 02622 /* 02623 * Remove the visrgn since it is still owned - if we did 02624 * not, gdi would not be able to clean up properly if the 02625 * app that owns this visrgn exist while the visrgn is 02626 * still selected. 02627 */ 02628 GreLockDisplay(gpDispInfo->hDev); 02629 GreSelectVisRgn(pdce->hdc, NULL, SVR_DELETEOLD); 02630 GreUnlockDisplay(gpDispInfo->hDev); 02631 } 02632 } 02633 } 02634 02635 /* 02636 * Step to the next DC. If the DC was deleted, there 02637 * is no need to calculate address of the next entry. 02638 */ 02639 if (pdce == *ppdce) 02640 NextEntry: 02641 ppdce = &pdce->pdceNext; 02642 } 02643 02644 /* 02645 * Clean up the spb that may still exist - like child window spb's. 02646 */ 02647 if (pwnd == gspwndLockUpdate) { 02648 FreeSpb(FindSpb(pwnd)); 02649 Unlock(&gspwndLockUpdate); 02650 gptiLockUpdate = NULL; 02651 } 02652 02653 if (TestWF(pwnd, WFHASSPB)) { 02654 FreeSpb(FindSpb(pwnd)); 02655 } 02656 02657 /* 02658 * Blow away the window clipping region. If the window is maximized, don't 02659 * blow away the monitor region. If the window is the desktop, don't blow 02660 * away the screen region. 02661 */ 02662 if ( pwnd->hrgnClip != NULL && 02663 !TestWF(pwnd, WFMAXFAKEREGIONAL) && 02664 GETFNID(pwnd) != FNID_DESKTOP) { 02665 02666 GreDeleteObject(pwnd->hrgnClip); 02667 pwnd->hrgnClip = NULL; 02668 } 02669 02670 /* 02671 * Clean up any memory allocated for scroll bars... 02672 */ 02673 if (pwnd->pSBInfo) { 02674 DesktopFree(pwnd->head.rpdesk, (HANDLE)(pwnd->pSBInfo)); 02675 pwnd->pSBInfo = NULL; 02676 } 02677 02678 /* 02679 * Free any callback handles associated with this window. 02680 * This is done outside of DeleteProperties because of the special 02681 * nature of callback handles as opposed to normal memory handles 02682 * allocated for a thread. 02683 */ 02684 02685 /* 02686 * Blow away the title 02687 */ 02688 if (pwnd->strName.Buffer != NULL) { 02689 DesktopFree(pwnd->head.rpdesk, pwnd->strName.Buffer); 02690 pwnd->strName.Buffer = NULL; 02691 pwnd->strName.Length = 0; 02692 } 02693 02694 /* 02695 * Blow away any properties connected to the window. 02696 */ 02697 if (pwnd->ppropList != NULL) { 02698 TL tlpDdeConv; 02699 PDDECONV pDdeConv; 02700 PDDEIMP pddei; 02701 02702 /* 02703 * Get rid of any icon properties. 02704 */ 02705 DestroyWindowSmIcon(pwnd); 02706 InternalRemoveProp(pwnd, MAKEINTATOM(gpsi->atomIconProp), PROPF_INTERNAL); 02707 02708 pDdeConv = (PDDECONV)_GetProp(pwnd, PROP_DDETRACK, PROPF_INTERNAL); 02709 if (pDdeConv != NULL) { 02710 ThreadLockAlwaysWithPti(pti, pDdeConv, &tlpDdeConv); 02711 xxxDDETrackWindowDying(pwnd, pDdeConv); 02712 ThreadUnlock(&tlpDdeConv); 02713 } 02714 pddei = (PDDEIMP)InternalRemoveProp(pwnd, PROP_DDEIMP, PROPF_INTERNAL); 02715 if (pddei != NULL) { 02716 pddei->cRefInit = 0; 02717 if (pddei->cRefConv == 0) { 02718 /* 02719 * If this is not 0 it is referenced by one or more DdeConv 02720 * structures so DON'T free it yet! 02721 */ 02722 UserFreePool(pddei); 02723 } 02724 } 02725 } 02726 02727 /* 02728 * Unlock everything that the window references. 02729 * After we have sent the WM_DESTROY and WM_NCDESTROY message we 02730 * can unlock & NULL the owner field so no other windows get z-ordered 02731 * relative to this window. Rhumba faults if we NULL it before the 02732 * destroy. (It calls GetParent after every message). 02733 * 02734 * We special-case the spwndParent window. In this case, if the 02735 * window being destroyed is a desktop window, unlock the parent. 02736 * Otherwise, we lock in the desktop-window as the parent so that 02737 * if we aren't freed in this function, we will ensure that we 02738 * won't fault when doing things like clipping-calculations. We'll 02739 * unlock this once we know we're truly going to free this window. 02740 */ 02741 if (pwnd->head.rpdesk != NULL && 02742 pwnd != pwnd->head.rpdesk->pDeskInfo->spwnd) 02743 Lock(&pwnd->spwndParent, pwnd->head.rpdesk->pDeskInfo->spwnd); 02744 else 02745 Unlock(&pwnd->spwndParent); 02746 02747 Unlock(&pwnd->spwndChild); 02748 Unlock(&pwnd->spwndOwner); 02749 Unlock(&pwnd->spwndLastActive); 02750 02751 /* 02752 * Decrement the Window Reference Count in the Class structure. 02753 */ 02754 DereferenceClass(pwnd); 02755 02756 /* 02757 * Mark the object for destruction before this final unlock. This way 02758 * the WM_FINALDESTROY will get sent if this is the last thread lock. 02759 * We're currently destroying this window, so don't allow unlock recursion 02760 * at this point (this is what HANDLEF_INDESTROY will do for us). 02761 */ 02762 HMMarkObjectDestroy(pwnd); 02763 HMPheFromObject(pwnd)->bFlags |= HANDLEF_INDESTROY; 02764 02765 /* 02766 * Unlock the window... This shouldn't return FALSE because HANDLEF_DESTROY 02767 * is set, but just in case... if it isn't around anymore, return because 02768 * pwnd is invalid. 02769 */ 02770 if (!ThreadUnlock(ptlpwndFree)) 02771 return; 02772 02773 /* 02774 * Try to free the object. The object won't free if it is locked - but 02775 * it will be marked for destruction. If the window is locked, change 02776 * it's wndproc to xxxDefWindowProc(). 02777 * 02778 * HMMarkObjectDestroy() will clear the HANDLEF_INDESTROY flag if the 02779 * object isn't about to go away (so it can be destroyed again!) 02780 */ 02781 pwnd->pcls = NULL; 02782 if (HMMarkObjectDestroy(pwnd)) { 02783 02784 /* 02785 * Delete the window's property list. Wait until now in case some 02786 * thread keeps a property pointer around across a callback. 02787 */ 02788 if (pwnd->ppropList != NULL) { 02789 DeleteProperties(pwnd); 02790 } 02791 02792 #if DBG 02793 /* 02794 * If we find the window is visible at the time we free it, then 02795 * somehow the app was made visible on a callback (we hide it 02796 * during xxxDestroyWindow(). This screws up our vis-window 02797 * count for the thread, so we need to assert it. 02798 */ 02799 if (TestWF(pwnd, WFINDESTROY) && TestWF(pwnd, WFVISIBLE)) 02800 RIPMSG1(RIP_ERROR, "xxxFreeWindow: Window should not be visible (pwnd == %#p)", pwnd); 02801 #endif 02802 02803 pti->cWindows--; 02804 02805 /* 02806 * Since we're freeing the memory for this window, we need 02807 * to unlock the parent (which is the desktop for zombie windows). 02808 */ 02809 Unlock(&pwnd->spwndParent); 02810 02811 ThreadLockDesktop(pti, pwnd->head.rpdesk, &tlpdesk, LDLT_FN_FREEWINDOW); 02812 HMFreeObject(pwnd); 02813 ThreadUnlockDesktop(pti, &tlpdesk, LDUT_FN_FREEWINDOW); 02814 return; 02815 } 02816 02817 /* 02818 * Turn this into an object that the app won't see again - turn 02819 * it into an icon title window - the window is still totally 02820 * valid and useable by any structures that has this window locked. 02821 */ 02822 pwnd->lpfnWndProc = xxxDefWindowProc; 02823 if (pwnd->head.rpdesk) 02824 ppi = pwnd->head.rpdesk->rpwinstaParent->pTerm->ptiDesktop->ppi; 02825 else 02826 ppi = PpiCurrent(); 02827 ppcls = GetClassPtr(gpsi->atomSysClass[ICLS_ICONTITLE], ppi, hModuleWin); 02828 02829 UserAssert(ppcls); 02830 pwnd->pcls = *ppcls; 02831 02832 /* 02833 * Since pwnd is marked as destroyed, there should be no client-side 02834 * code which can validate it. So we do not need to search for a clone 02835 * class of the right desktop -- just use the base class and bump the 02836 * WndReferenceCount. This also helps if we are in a low-memory situation 02837 * and cannot alloc another clone. 02838 */ 02839 02840 pwnd->pcls->cWndReferenceCount++; 02841 02842 SetWF(pwnd, WFSERVERSIDEPROC); 02843 02844 /* 02845 * Clear the palette bit so that WM_PALETTECHANGED will not be sent 02846 * again when the window is finally destroyed. 02847 */ 02848 ClrWF(pwnd, WFHASPALETTE); 02849 02850 /* 02851 * Clear its child bits so no code assumes that if the child bit 02852 * is set, it has a parent. Change spmenu to NULL - it is only 02853 * non-zero if this was child. 02854 */ 02855 ClrWF(pwnd, WFTYPEMASK); 02856 SetWF(pwnd, WFTILED); 02857 pwnd->spmenu = NULL; 02858 }

VOID xxxFW_DestroyAllChildren PWND  pwnd  ) 
 

Definition at line 2126 of file createw.c.

References CheckLock, GETPTI, HWq, NULL, PostEventMessage(), tagTHREADINFO::pq, PtiCurrent, QEVENT_DESTROYWINDOW, SetVisible(), SetWF, tagWND::spwndChild, SV_UNSET, TestWF, ThreadLockAlwaysWithPti, ThreadUnlock, UnlinkWindow(), WFDESTROYED, WFVISIBLE, and xxxFreeWindow().

Referenced by xxxFreeWindow().

02128 { 02129 PWND pwndChild; 02130 TL tlpwndChild; 02131 PTHREADINFO pti; 02132 PTHREADINFO ptiCurrent = PtiCurrent(); 02133 02134 CheckLock(pwnd); 02135 02136 while (pwnd->spwndChild != NULL) { 02137 pwndChild = pwnd->spwndChild; 02138 02139 /* 02140 * ThreadLock prior to the unlink in case pwndChild 02141 * is already marked as destroyed. 02142 */ 02143 ThreadLockAlwaysWithPti(ptiCurrent, pwndChild, &tlpwndChild); 02144 02145 /* 02146 * Propagate the VISIBLE flag. We need to do this so that 02147 * when a child window gets destroyed we don't try to hide it 02148 * if the WFVISIBLE flag is set. 02149 */ 02150 if (TestWF(pwndChild, WFVISIBLE)) { 02151 SetVisible(pwndChild, SV_UNSET); 02152 } 02153 02154 UnlinkWindow(pwndChild, pwnd); 02155 02156 /* 02157 * Set the state as destroyed so any z-ordering events will be ignored. 02158 * We cannot NULL out the owner field until WM_NCDESTROY is send or 02159 * apps like Rumba fault (they call GetParent after every message) 02160 */ 02161 SetWF(pwndChild, WFDESTROYED); 02162 02163 /* 02164 * If the window belongs to another thread, post 02165 * an event to let it know it should be destroyed. 02166 * Otherwise, free the window. 02167 */ 02168 pti = GETPTI(pwndChild); 02169 if (pti != ptiCurrent) { 02170 PostEventMessage(pti, pti->pq, QEVENT_DESTROYWINDOW, 02171 NULL, 0, 02172 (WPARAM)HWq(pwndChild), 0); 02173 ThreadUnlock(&tlpwndChild); 02174 } else { 02175 /* 02176 * FreeWindow performs a ThreadUnlock. 02177 */ 02178 xxxFreeWindow(pwndChild, &tlpwndChild); 02179 } 02180 } 02181 }

HANDLE xxxGetClipboardData PWINDOWSTATION  pwinsta,
UINT  fmt,
PGETCLIPBDATA  gcd
 

Definition at line 2356 of file ntuser/kernel/clipbrd.c.

References DUMMY_DIB_HANDLE, DUMMY_METARENDER_HANDLE, DUMMY_TEXT_HANDLE, tagCLIP::fGlobalHandle, tagGETCLIPBDATA::fGlobalHandle, FindClipFormat(), tagCLIP::hData, IsMetaDummyHandle, NULL, tagWINDOWSTATION::ptiClipLock, PtiCurrent, xxxGetDummyBitmap(), xxxGetDummyDib(), xxxGetDummyDibV5(), xxxGetDummyPalette(), xxxGetDummyText(), and xxxGetRenderData().

Referenced by NtUserGetClipboardData(), xxxGetDummyBitmap(), xxxGetDummyDib(), xxxGetDummyDibV5(), xxxGetDummyPalette(), and xxxGetDummyText().

02360 { 02361 PCLIP pClip; 02362 HANDLE hData; 02363 02364 /* 02365 * Check the clipboard owner. 02366 */ 02367 if (pwinsta->ptiClipLock != PtiCurrent()) { 02368 RIPERR0(ERROR_CLIPBOARD_NOT_OPEN, RIP_VERBOSE, "GetClipboardData: clipboard not open"); 02369 return NULL; 02370 } 02371 02372 /* 02373 * Make sure the format is available. 02374 */ 02375 if ((pClip = FindClipFormat(pwinsta, fmt)) == NULL) { 02376 RIPMSG1(RIP_VERBOSE, "Clipboard: Requested format 0x%lX not available", fmt); 02377 return NULL; 02378 } 02379 02380 /* 02381 * If this is a DUMMY_META*_HANDLE it means that the other 02382 * metafile format was set in as a delay render format and we should 02383 * as for that format to get the metafile because the app has not told 02384 * us they now about this format. 02385 */ 02386 if (IsMetaDummyHandle(pClip->hData)) { 02387 02388 if (fmt == CF_ENHMETAFILE) { 02389 fmt = CF_METAFILEPICT; 02390 } else if (fmt == CF_METAFILEPICT) { 02391 fmt = CF_ENHMETAFILE; 02392 } else { 02393 RIPMSG0(RIP_WARNING, 02394 "Clipboard: Meta Render/Clone expects a metafile type"); 02395 } 02396 02397 if ((pClip = FindClipFormat(pwinsta, fmt)) == NULL) { 02398 RIPMSG1(RIP_WARNING, 02399 "Clipboard: Meta Render/Clone format 0x%lX not available", fmt); 02400 return NULL; 02401 } 02402 } 02403 02404 /* 02405 * This is the data we're returning, unless it's a dummy or 02406 * render handle. 02407 */ 02408 hData = pClip->hData; 02409 02410 /* 02411 * We are dealing with non-handles. Retrieve the real data 02412 * through these inline-routines. NOTE: these make recursive 02413 * calls to xxxGetClipboardData(). So care must be taken to 02414 * assure the pClip is pointing to what we think it's pointing 02415 * to. 02416 */ 02417 if ((hData == NULL) || (hData == DUMMY_METARENDER_HANDLE)) { 02418 02419 hData = xxxGetRenderData(pwinsta, fmt); 02420 02421 } else if (hData == DUMMY_DIB_HANDLE) { 02422 02423 switch (fmt) { 02424 case CF_DIB: 02425 hData = xxxGetDummyDib(pwinsta, pgcd); 02426 break; 02427 case CF_DIBV5: 02428 hData = xxxGetDummyDibV5(pwinsta, pgcd); 02429 break; 02430 case CF_BITMAP: 02431 hData = xxxGetDummyBitmap(pwinsta, pgcd); 02432 break; 02433 case CF_PALETTE: 02434 hData = xxxGetDummyPalette(pwinsta, pgcd); 02435 break; 02436 } 02437 02438 } else if (hData == DUMMY_TEXT_HANDLE) { 02439 02440 hData = xxxGetDummyText(pwinsta, fmt, pgcd); 02441 } else { 02442 /* 02443 * This path took no callbacks, so we know pClip is OK. 02444 */ 02445 if (pgcd) 02446 pgcd->fGlobalHandle = pClip->fGlobalHandle; 02447 02448 return hData; 02449 } 02450 02451 /* 02452 * The callbacks for dummy handle resolution have possibly 02453 * invalidated pClip -- recreate it. 02454 */ 02455 02456 if ((pClip = FindClipFormat(pwinsta, fmt)) == NULL) { 02457 RIPMSG1(RIP_VERBOSE, "Clipboard: Requested format 0x%lX not available", fmt); 02458 return NULL; 02459 } 02460 02461 /* 02462 * Return if this is a global-handle. 02463 */ 02464 if (pgcd) 02465 pgcd->fGlobalHandle = pClip->fGlobalHandle; 02466 02467 return hData; 02468 }

HBRUSH xxxGetControlBrush PWND  pwnd,
HDC  hdc,
UINT  msg
 

Definition at line 241 of file w32/ntuser/kernel/random.c.

References CheckLock, NULL, tagWND::spwndOwner, tagWND::spwndParent, TestwndPopup, ThreadLock, ThreadUnlock, and xxxGetControlColor().

Referenced by NtUserGetControlBrush(), and xxxGetColorObjects().

00245 { 00246 HBRUSH hbr; 00247 PWND pwndSend; 00248 TL tlpwndSend; 00249 00250 CheckLock(pwnd); 00251 00252 if ((pwndSend = (TestwndPopup(pwnd) ? pwnd->spwndOwner : pwnd->spwndParent)) 00253 == NULL) 00254 pwndSend = pwnd; 00255 00256 ThreadLock(pwndSend, &tlpwndSend); 00257 00258 /* 00259 * Last parameter changes the message into a ctlcolor id. 00260 */ 00261 hbr = xxxGetControlColor(pwndSend, pwnd, hdc, message); 00262 ThreadUnlock(&tlpwndSend); 00263 00264 return hbr; 00265 }

HBRUSH xxxGetControlColor PWND  pwndParent,
PWND  pwndCtl,
HDC  hdc,
UINT  message
 

Definition at line 193 of file w32/ntuser/kernel/random.c.

References GETPTI, HW, PpiCurrent, xxxDefWindowProc(), and xxxSendMessage().

Referenced by NtUserGetControlColor(), xxxGetControlBrush(), and xxxPaintRect().

00198 { 00199 HBRUSH hbrush; 00200 00201 /* 00202 * If we're sending to a window of another thread, don't send this message 00203 * but instead call DefWindowProc(). New rule about the CTLCOLOR messages. 00204 * Need to do this so that we don't send an hdc owned by one thread to 00205 * another thread. It is also a harmless change. 00206 */ 00207 if (PpiCurrent() != GETPTI(pwndParent)->ppi) { 00208 return (HBRUSH)xxxDefWindowProc(pwndParent, message, (WPARAM)hdc, (LPARAM)HW(pwndCtl)); 00209 } 00210 00211 hbrush = (HBRUSH)xxxSendMessage(pwndParent, message, (WPARAM)hdc, (LPARAM)HW(pwndCtl)); 00212 00213 /* 00214 * If the brush returned from the parent is invalid, get a valid brush from 00215 * xxxDefWindowProc. 00216 */ 00217 if ((hbrush == 0) || !GreValidateServerHandle(hbrush, BRUSH_TYPE)) { 00218 #if DBG 00219 if (hbrush != 0) 00220 RIPMSG2(RIP_WARNING, 00221 "Invalid HBRUSH from WM_CTLCOLOR*** msg %lX brush %lX", message, hbrush); 00222 #endif 00223 hbrush = (HBRUSH)xxxDefWindowProc(pwndParent, message, 00224 (WPARAM)hdc, (LPARAM)pwndCtl); 00225 } 00226 00227 return hbrush; 00228 }

HDESK xxxGetInputDesktop VOID   ) 
 

Definition at line 4309 of file desktop.c.

References grpdeskRitInput, HF_PROTECTED, NULL, PsGetCurrentProcess, SetHandleFlag(), TRUE, and xxxUserFindHandleForObject().

04310 { 04311 HDESK hdesk; 04312 04313 if (xxxUserFindHandleForObject(PsGetCurrentProcess(), grpdeskRitInput, NULL, NULL, &hdesk)) { 04314 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 04315 return hdesk; 04316 } else { 04317 return NULL; 04318 } 04319 }

HANDLE xxxGetInputEvent DWORD  dwWakeMask  ) 
 

Definition at line 5238 of file queue.c.

References CheckForClientDeath, CheckProcessForeground(), ClearQueueServerEvent(), _CLIENTINFO::cSpins, FALSE, tagCLIENTTHREADINFO::fsWakeMask, GetInputBits(), gptiForeground, tagTHREADINFO::hEventQueueClient, IsHooked, IsWinEventNotifyDeferredOK, KeSetEvent(), tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, tagTHREADINFO::pEventQueueServer, tagTHREADINFO::ppi, PtiCurrent, tagPROCESSINFO::ptiMainThread, tagTHREADINFO::TIF_flags, TIF_SPINNING, WHF_FOREGROUNDIDLE, xxxCallHook(), and zzzWakeInputIdle().

05240 { 05241 PTHREADINFO ptiCurrent; 05242 WORD wFlags = HIWORD(dwWakeMask); 05243 UserAssert(IsWinEventNotifyDeferredOK()); 05244 05245 ptiCurrent = PtiCurrent(); 05246 05247 /* 05248 * If our wait condition is satisfied, signal the event and return. 05249 * (Since the wake mask could have been anything at the time the input 05250 * arrived, the event might not be signaled) 05251 */ 05252 if (GetInputBits(ptiCurrent->pcti, LOWORD(dwWakeMask), (wFlags & MWMO_INPUTAVAILABLE))) { 05253 KeSetEvent(ptiCurrent->pEventQueueServer, 2, FALSE); 05254 return ptiCurrent->hEventQueueClient; 05255 } 05256 05257 /* 05258 * If an idle hook is set, call it. 05259 */ 05260 if (ptiCurrent == gptiForeground && 05261 IsHooked(ptiCurrent, WHF_FOREGROUNDIDLE)) { 05262 xxxCallHook(HC_ACTION, 0, 0, WH_FOREGROUNDIDLE); 05263 } 05264 05265 CheckForClientDeath(); 05266 05267 /* 05268 * What is the criteria for an "idle process"? 05269 * Answer: The first thread that calls zzzWakeInputIdle, or SleepInputIdle or... 05270 * Any thread that calls xxxGetInputEvent with any of the following 05271 * bits set in its wakemask: (sanfords) 05272 */ 05273 if (dwWakeMask & (QS_POSTMESSAGE | QS_INPUT)) { 05274 ptiCurrent->ppi->ptiMainThread = ptiCurrent; 05275 } 05276 05277 /* 05278 * When we return, this app is going to sleep. Since it is in its 05279 * idle mode when it goes to sleep, wake any apps waiting for this 05280 * app to go idle. 05281 */ 05282 zzzWakeInputIdle(ptiCurrent); 05283 /* 05284 * Setup the wake mask for this thread. Wait for QS_EVENT or the app won't 05285 * get event messages like deactivate. 05286 */ 05287 ClearQueueServerEvent((WORD)(dwWakeMask | QS_EVENT)); 05288 /* 05289 * This app is going idle. Clear the spin count check to see 05290 * if we need to make this process foreground again. 05291 */ 05292 ptiCurrent->pClientInfo->cSpins = 0; 05293 if (ptiCurrent->TIF_flags & TIF_SPINNING) { 05294 CheckProcessForeground(ptiCurrent); 05295 } 05296 05297 UserAssert(ptiCurrent->pcti->fsWakeMask != 0); 05298 return ptiCurrent->hEventQueueClient; 05299 }

BOOL xxxGetMenuBarInfo PWND  pwnd,
long  idObject,
long  idItem,
PMENUBARINFO  pmbi
 

Definition at line 580 of file winable2.c.

References _HasCaptionIcon(), CheckLock, tagMENU::cItems, tagITEM::cxItem, tagMENU::cxMenu, tagITEM::cyItem, tagMENU::cyMenu, FALSE, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fIsSysMenu, GetpGlobalPopupMenu(), GetWindowBorders(), HtoP, HW, NULL, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, PtoHq, tagWND::rcClient, tagWND::rcWindow, tagMENU::rgItems, SetRectEmpty, tagWND::spmenu, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, SYSMET, TestWF, TRUE, UINT, WEFTOOLWINDOW, WFCHILD, WFCPRESENT, WFSYSMENU, tagITEM::xItem, xxxGetSysMenu(), xxxSendMessage(), and tagITEM::yItem.

Referenced by NtUserGetMenuBarInfo().

00581 { 00582 PMENU pMenu; 00583 int cBorders; 00584 PITEM pItem; 00585 PPOPUPMENU ppopup; 00586 00587 CheckLock(pwnd); 00588 00589 /* 00590 * Validate menubarinfo structure 00591 */ 00592 if (pmbi->cbSize != sizeof(MENUBARINFO)) { 00593 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "MENUBARINFO.cbSize %d is wrong", pmbi->cbSize); 00594 return FALSE; 00595 } 00596 00597 /* 00598 * Initialize the fields 00599 */ 00600 SetRectEmpty(&pmbi->rcBar); 00601 pmbi->hMenu = NULL; 00602 pmbi->hwndMenu = NULL; 00603 pmbi->fBarFocused = FALSE; 00604 pmbi->fFocused = FALSE; 00605 00606 /* 00607 * Get the menu handle we will deal with. 00608 */ 00609 if (idObject == OBJID_MENU) { 00610 int cBorders; 00611 00612 if (TestWF(pwnd, WFCHILD) || !pwnd->spmenu) 00613 return FALSE; 00614 00615 pMenu = pwnd->spmenu; 00616 if (!pMenu) 00617 return FALSE; 00618 00619 // If we have an item, is it in the valid range? 00620 if ((idItem < 0) || ((DWORD)idItem > pMenu->cItems)) 00621 return FALSE; 00622 00623 /* 00624 * Menu handle 00625 */ 00626 pmbi->hMenu = PtoHq(pMenu); 00627 00628 /* 00629 * Menu rect 00630 */ 00631 if (pMenu->cxMenu && pMenu->cyMenu) { 00632 if (!idItem) { 00633 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00634 pmbi->rcBar.left = pwnd->rcWindow.left + cBorders * SYSMET(CXBORDER); 00635 pmbi->rcBar.top = pwnd->rcWindow.top + cBorders * SYSMET(CYBORDER); 00636 00637 if (TestWF(pwnd, WFCPRESENT)) { 00638 pmbi->rcBar.top += (TestWF(pwnd, WEFTOOLWINDOW) ? SYSMET(CYSMCAPTION) : SYSMET(CYCAPTION)); 00639 } 00640 00641 pmbi->rcBar.right = pmbi->rcBar.left + pMenu->cxMenu; 00642 pmbi->rcBar.bottom = pmbi->rcBar.top + pMenu->cyMenu; 00643 } else { 00644 pItem = pMenu->rgItems + idItem - 1; 00645 00646 pmbi->rcBar.left = pwnd->rcWindow.left + pItem->xItem; 00647 pmbi->rcBar.top = pwnd->rcWindow.top + pItem->yItem; 00648 pmbi->rcBar.right = pmbi->rcBar.left + pItem->cxItem; 00649 pmbi->rcBar.bottom = pmbi->rcBar.top + pItem->cyItem; 00650 } 00651 } 00652 00653 /* 00654 * Are we currently in app menu bar mode? 00655 */ 00656 ppopup = GetpGlobalPopupMenu(pwnd); 00657 if (ppopup && ppopup->fHasMenuBar && !ppopup->fIsSysMenu && 00658 (ppopup->spwndNotify == pwnd)) 00659 { 00660 // Yes, we are. 00661 pmbi->fBarFocused = TRUE; 00662 00663 if (!idItem) { 00664 pmbi->fFocused = TRUE; 00665 } else if (ppopup->ppopupmenuRoot->posSelectedItem == (UINT)idItem-1) { 00666 pmbi->fFocused = TRUE; 00667 UserAssert(ppopup->ppopupmenuRoot); 00668 pmbi->hwndMenu = HW(ppopup->ppopupmenuRoot->spwndNextPopup); 00669 } 00670 } 00671 00672 } else if (idObject == OBJID_SYSMENU) { 00673 if (!TestWF(pwnd, WFSYSMENU)) 00674 return FALSE; 00675 00676 pMenu = xxxGetSysMenu(pwnd, FALSE); 00677 if (!pMenu) 00678 return FALSE; 00679 00680 // If we have an item, is it in the valid range? 00681 if ((idItem < 0) || ((DWORD)idItem > pMenu->cItems)) 00682 return FALSE; 00683 00684 pmbi->hMenu = PtoHq(pMenu); 00685 00686 /* 00687 * Menu rect 00688 */ 00689 if (_HasCaptionIcon(pwnd)) { 00690 // The menu and single item take up the same space 00691 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00692 pmbi->rcBar.left = pwnd->rcWindow.left + cBorders * SYSMET(CXBORDER); 00693 pmbi->rcBar.top = pwnd->rcWindow.top + cBorders * SYSMET(CYBORDER); 00694 00695 pmbi->rcBar.right = pmbi->rcBar.left + 00696 (TestWF(pwnd, WEFTOOLWINDOW) ? SYSMET(CXSMSIZE) : SYSMET(CXSIZE)); 00697 00698 pmbi->rcBar.bottom = pmbi->rcBar.top + 00699 (TestWF(pwnd, WEFTOOLWINDOW) ? SYSMET(CYSMSIZE) : SYSMET(CYSIZE)); 00700 } 00701 00702 /* 00703 * Are we currently in system menu bar mode? 00704 */ 00705 ppopup = GetpGlobalPopupMenu(pwnd); 00706 if (ppopup && ppopup->fHasMenuBar && ppopup->fIsSysMenu && 00707 (ppopup->spwndNotify == pwnd)) 00708 { 00709 // Yes, we are. 00710 pmbi->fBarFocused = TRUE; 00711 00712 if (!idItem) { 00713 pmbi->fFocused = TRUE; 00714 } else if (ppopup->ppopupmenuRoot->posSelectedItem == (UINT)idItem - 1) { 00715 pmbi->fFocused = TRUE; 00716 UserAssert(ppopup->ppopupmenuRoot); 00717 pmbi->hwndMenu = HW(ppopup->ppopupmenuRoot->spwndNextPopup); 00718 } 00719 } 00720 } 00721 else if (idObject == OBJID_CLIENT) 00722 { 00723 HMENU hMenu; 00724 hMenu = (HMENU)xxxSendMessage(pwnd, MN_GETHMENU, 0, 0); 00725 pMenu = HtoP(hMenu); 00726 if (!pMenu) 00727 return FALSE; 00728 00729 // If we have an item, is it in the valid range? 00730 if ((idItem < 0) || ((DWORD)idItem > pMenu->cItems)) 00731 return FALSE; 00732 00733 pmbi->hMenu = hMenu; 00734 00735 if (!idItem) { 00736 pmbi->rcBar = pwnd->rcClient; 00737 } else { 00738 pItem = pMenu->rgItems + idItem - 1; 00739 00740 pmbi->rcBar.left = pwnd->rcClient.left + pItem->xItem; 00741 pmbi->rcBar.top = pwnd->rcClient.top + pItem->yItem; 00742 pmbi->rcBar.right = pmbi->rcBar.left + pItem->cxItem; 00743 pmbi->rcBar.bottom = pmbi->rcBar.top + pItem->cyItem; 00744 } 00745 00746 /* 00747 * Are we currently in popup mode with us as one of the popups 00748 * showing? 00749 */ 00750 ppopup = ((PMENUWND)pwnd)->ppopupmenu; 00751 if (ppopup && (ppopup->ppopupmenuRoot == GetpGlobalPopupMenu(pwnd))) { 00752 pmbi->fBarFocused = TRUE; 00753 00754 if (!idItem) { 00755 pmbi->fFocused = TRUE; 00756 } else if ((UINT)idItem == ppopup->posSelectedItem + 1) { 00757 pmbi->fFocused = TRUE; 00758 pmbi->hwndMenu = HW(ppopup->spwndNextPopup); 00759 } 00760 } 00761 } else { 00762 return FALSE; 00763 } 00764 00765 return TRUE; 00766 }

BOOL xxxGetMenuItemRect PWND  pwnd,
PMENU  pMenu,
UINT  uIndex,
LPRECT  lprcScreen
 

Definition at line 911 of file mncomput.c.

References BOOL, CheckLock, tagMENU::cItems, tagITEM::cxItem, tagITEM::cyItem, FALSE, GetMenuPwnd(), MFISPOPUP, NULL, OffsetRect(), tagWND::rcClient, tagWND::rcWindow, tagMENU::rgItems, SetRectEmpty, TestMF, TestWF, TRUE, WFWIN50COMPAT, tagITEM::xItem, xxxMNRecomputeBarIfNeeded(), and tagITEM::yItem.

Referenced by NtUserGetMenuItemRect().

00912 { 00913 PITEM pItem; 00914 int dx, dy; 00915 00916 CheckLock(pwnd); 00917 CheckLock(pMenu); 00918 00919 SetRectEmpty(lprcScreen); 00920 00921 if (uIndex >= pMenu->cItems) 00922 return(FALSE); 00923 00924 /* 00925 * Raid #315084: Compatiblity with NT4/Win95/98 00926 * 00927 * WordPerfect does a long complex way to calc the menu rect 00928 * by calling this API. It calls GetMenuItemRect() with the app's 00929 * window. 00930 */ 00931 if (pwnd == NULL || TestWF(pwnd, WFWIN50COMPAT)) { 00932 pwnd = GetMenuPwnd(pwnd, pMenu); 00933 } 00934 00935 /* 00936 * If no pwnd, no go. 00937 * IMPORTANT: for MFISPOPUP we might get a different pwnd but we don't lock 00938 * it because we won't call back 00939 */ 00940 if (pwnd == NULL) { 00941 return FALSE; 00942 } 00943 00944 if (TestMF(pMenu, MFISPOPUP)) { 00945 dx = pwnd->rcClient.left; 00946 dy = pwnd->rcClient.top; 00947 } else { 00948 xxxMNRecomputeBarIfNeeded(pwnd, pMenu); 00949 00950 dx = pwnd->rcWindow.left; 00951 dy = pwnd->rcWindow.top; 00952 } 00953 00954 if (uIndex >= pMenu->cItems) 00955 return(FALSE); 00956 00957 pItem = pMenu->rgItems + uIndex; 00958 00959 lprcScreen->right = pItem->cxItem; 00960 lprcScreen->bottom = pItem->cyItem; 00961 00962 OffsetRect(lprcScreen, dx + pItem->xItem, dy + pItem->yItem); 00963 return(TRUE); 00964 }

PMENU xxxGetSysMenu PWND  pwnd,
BOOL  fSubMenu
 

Definition at line 189 of file mnsys.c.

References _GetSubMenu(), CheckLock, NULL, xxxGetSysMenuHandle(), and xxxSetSysMenu().

Referenced by xxxDefWindowProc(), xxxDWP_NCMouse(), xxxDWP_SetCursor(), xxxGetInitMenuParam(), xxxGetMenuBarInfo(), and xxxMNStartMenu().

00190 { 00191 PMENU pMenu; 00192 00193 CheckLock(pwnd); 00194 xxxSetSysMenu(pwnd); 00195 if ((pMenu = xxxGetSysMenuHandle(pwnd)) != NULL) { 00196 if (fSubMenu) 00197 pMenu = _GetSubMenu(pMenu, 0); 00198 } 00199 00200 return(pMenu); 00201 }

PMENU xxxGetSysMenuHandle PWND  pwnd  ) 
 

Definition at line 270 of file menuc.c.

References CheckLock, tagWND::head, HWq, ID_SYSMENU, NtUserCallHwndLock(), NULL, PtiCurrent, tagWND::spmenuSys, TestWF, TIF_INCLEANUP, TIF_SYSTEMTHREAD, WFSYSMENU, and xxxLoadSysDesktopMenu().

Referenced by xxxGetSysMenu(), xxxHandleNCMouseGuys(), xxxMNCanClose(), xxxMNInvertItem(), xxxMNLoop(), and xxxSetSysMenu().

00272 { 00273 PMENU pMenu; 00274 00275 if (TestWF(pwnd, WFSYSMENU)) { 00276 pMenu = pwnd->spmenuSys; 00277 00278 /* 00279 * If the window doesn't have a System Menu, use the default one. 00280 */ 00281 if (pMenu == NULL) { 00282 00283 /* 00284 * Change owner so this app can access this menu. 00285 */ 00286 pMenu = (PMENU)NtUserCallHwndLock(HWq(pwnd), SFI_XXXGETSYSMENUHANDLE); 00287 } 00288 } else { 00289 pMenu = NULL; 00290 } 00291 00292 return pMenu; 00293 }

PMENU xxxGetSystemMenu PWND  pWnd,
BOOL  bRevert
 

Definition at line 368 of file mnsys.c.

References _DestroyMenu(), _GetSubMenu(), CheckLock, tagPOPUPMENU::fIsSysMenu, tagPOPUPMENU::fIsTrackPopup, GetpGlobalPopupMenu(), ID_DIALOGSYSMENU, ID_SYSMENU, Lock, LockWndMenu(), MFAPPSYSMENU, MFSYSMENU, NULL, SetMF, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagWND::spmenuSys, tagMENU::spwndNotify, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestMF, TestWF, UINT, UnlockWndMenu(), WFSYSMENU, and xxxLoadSysMenu().

Referenced by NtUserGetSystemMenu(), and xxxCreateWindowEx().

00371 { 00372 PMENU pmenu; 00373 CheckLock(pwnd); 00374 00375 /* 00376 * Should we start with a fresh copy? 00377 */ 00378 00379 pmenu = pwnd->spmenuSys; 00380 if (fRevert) { 00381 00382 /* 00383 * Destroy the old system menu. 00384 */ 00385 if ((pmenu != NULL) && !TestMF(pmenu, MFSYSMENU)) { 00386 00387 if (UnlockWndMenu(pwnd, &pwnd->spmenuSys)) { 00388 _DestroyMenu(pmenu); 00389 } 00390 } 00391 } else { 00392 00393 /* 00394 * Do we need to load a new system menu? 00395 */ 00396 if (((pmenu == NULL) || TestMF(pmenu, MFSYSMENU)) 00397 && TestWF(pwnd, WFSYSMENU)) { 00398 00399 PPOPUPMENU pGlobalPopupMenu; 00400 UINT uMenuId = (pwnd->spmenuSys == NULL ? ID_SYSMENU : ID_DIALOGSYSMENU); 00401 pmenu = xxxLoadSysMenu(uMenuId); 00402 if (pmenu == NULL) { 00403 RIPMSG1(RIP_WARNING, "_GetSystemMenu: xxxLoadSysMenu Failed. pwnd:%#p", pwnd); 00404 } 00405 LockWndMenu(pwnd, &pwnd->spmenuSys, pmenu); 00406 00407 pmenu = pwnd->spmenuSys; 00408 pGlobalPopupMenu = GetpGlobalPopupMenu(pwnd); 00409 if ((pGlobalPopupMenu != NULL) 00410 && !pGlobalPopupMenu->fIsTrackPopup 00411 && (pGlobalPopupMenu->spwndPopupMenu == pwnd)) { 00412 00413 UserAssert(pGlobalPopupMenu->spwndNotify == pwnd); 00414 if (pGlobalPopupMenu->fIsSysMenu) { 00415 Lock(&pGlobalPopupMenu->spmenu, pmenu); 00416 } else { 00417 Lock(&pGlobalPopupMenu->spmenuAlternate, pmenu); 00418 } 00419 } 00420 } 00421 } 00422 00423 /* 00424 * Return the handle to the system menu. 00425 */ 00426 if (pwnd->spmenuSys != NULL) { 00427 /* 00428 * The app is probably going to modify this menu and then we'll need to 00429 * redraw the caption buttons. Hence we need to store the window pointer 00430 * in this pmenu or we won't be able to know what window to repaint. 00431 * The bogus thing is that we cannot call LockWndMenu here because this is 00432 * not the actual pmenuSys. 00433 */ 00434 pmenu = _GetSubMenu(pwnd->spmenuSys, 0); 00435 if (pmenu) { 00436 SetMF(pmenu, MFAPPSYSMENU); 00437 Lock(&pmenu->spwndNotify, pwnd); 00438 } 00439 return pmenu; 00440 } 00441 00442 return NULL; 00443 }

HDESK xxxGetThreadDesktop DWORD  ,
HDESK  ,
KPROCESSOR_MODE 
 

Definition at line 4211 of file desktop.c.

References ExDesktopObjectType, FALSE, gpepCSRSS, tagTHREADINFO::hdesk, HF_PROTECTED, KeAttachProcess(), KeDetachProcess(), LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), tagTHREADINFO::ppi, PpiCurrent, PpiFromProcess, PsGetCurrentProcess, PsGetCurrentThread, PtiCurrent, PtiFromThreadId(), SetHandleFlag(), Status, TRUE, and xxxUserFindHandleForObject().

Referenced by NtUserGetThreadDesktop().

04215 { 04216 PTHREADINFO pti = PtiFromThreadId(dwThread); 04217 PPROCESSINFO ppiThread; 04218 HDESK hdesk; 04219 NTSTATUS Status; 04220 04221 if (pti == NULL) { 04222 04223 /* 04224 * If the thread has a console use that desktop. If 04225 * not, then the thread is either invalid or not 04226 * a Win32 thread. 04227 */ 04228 if (hdeskConsole == NULL) { 04229 RIPERR1(ERROR_INVALID_PARAMETER, RIP_VERBOSE, 04230 "xxxGetThreadDesktop: invalid threadId 0x%x", 04231 dwThread); 04232 return NULL; 04233 } 04234 04235 hdesk = hdeskConsole; 04236 ppiThread = PpiFromProcess(gpepCSRSS); 04237 } else { 04238 hdesk = pti->hdesk; 04239 ppiThread = pti->ppi; 04240 } 04241 04242 /* 04243 * If there is no desktop, return NULL with no error 04244 */ 04245 if (hdesk != NULL) { 04246 04247 /* 04248 * If the thread belongs to this process, return the 04249 * handle. Otherwise, enumerate the handle table of 04250 * this process to find a handle with the same 04251 * attributes. 04252 */ 04253 if (ppiThread != PpiCurrent()) { 04254 PVOID pobj; 04255 OBJECT_HANDLE_INFORMATION ohi; 04256 04257 RIPMSG4(RIP_VERBOSE, "[%x.%x] %s called xxxGetThreadDesktop for pti %#p\n", 04258 PsGetCurrentThread()->Cid.UniqueProcess, 04259 PsGetCurrentThread()->Cid.UniqueThread, 04260 PsGetCurrentProcess()->ImageFileName, 04261 pti); 04262 04263 KeAttachProcess(&ppiThread->Process->Pcb); 04264 Status = ObReferenceObjectByHandle(hdesk, 04265 0, 04266 *ExDesktopObjectType, 04267 AccessMode, 04268 &pobj, 04269 &ohi); 04270 KeDetachProcess(); 04271 if (!NT_SUCCESS(Status) || 04272 !xxxUserFindHandleForObject(PsGetCurrentProcess(), pobj, NULL, &ohi, &hdesk)) { 04273 04274 RIPMSG0(RIP_VERBOSE, "Cannot find hdesk for current process"); 04275 04276 hdesk = NULL; 04277 04278 } else { 04279 LogDesktop(pobj, LD_REF_FN_GETTHREADDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 04280 } 04281 if (NT_SUCCESS(Status)) { 04282 LogDesktop(pobj, LD_DEREF_FN_GETTHREADDESKTOP, FALSE, (ULONG_PTR)PtiCurrent()); 04283 ObDereferenceObject(pobj); 04284 } 04285 } 04286 04287 if (hdesk == NULL) { 04288 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, "xxxGetThreadDesktop: hdesk is null"); 04289 } else { 04290 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 04291 } 04292 } 04293 04294 return hdesk; 04295 }

BOOL xxxGetTitleBarInfo PWND  pwnd,
PTITLEBARINFO  ptbi
 

Definition at line 170 of file winable2.c.

References _HasCaptionIcon(), CheckLock, FALSE, GetWindowBorders(), InflateRect(), LOBYTE, tagWND::rcWindow, SetRectEmpty, SYSMET, TestWF, TRUE, WEFCONTEXTHELP, WEFTOOLWINDOW, WFBORDERMASK, WFCAPTION, WFCLOSEBUTTONDOWN, WFCPRESENT, WFHELPBUTTONDOWN, WFMAXBOX, WFMINBOX, WFMINIMIZED, WFREDUCEBUTTONDOWN, WFSYSMENU, WFWIN40COMPAT, WFZOOMBUTTONDOWN, and xxxMNCanClose().

Referenced by NtUserGetTitleBarInfo().

00171 { 00172 int cxB; 00173 00174 CheckLock(pwnd); 00175 00176 /* 00177 * Validate titlebarinfo structure 00178 */ 00179 if (ptbi->cbSize != sizeof(TITLEBARINFO)) { 00180 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "TITLEBARINFO.cbSize %d is wrong", ptbi->cbSize); 00181 return FALSE; 00182 } 00183 00184 RtlZeroMemory(&ptbi->rgstate, sizeof(ptbi->rgstate)); 00185 00186 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_FOCUSABLE; 00187 if (TestWF(pwnd, WFBORDERMASK) != LOBYTE(WFCAPTION)) 00188 { 00189 // No titlebar. 00190 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_INVISIBLE; 00191 return TRUE; 00192 } 00193 00194 if (!TestWF(pwnd, WFMINIMIZED) && !TestWF(pwnd, WFCPRESENT)) 00195 { 00196 // Off screen (didn't fit) 00197 ptbi->rgstate[INDEX_TITLEBAR_SELF] |= STATE_SYSTEM_OFFSCREEN; 00198 SetRectEmpty(&ptbi->rcTitleBar); 00199 return TRUE; 00200 } 00201 00202 /* 00203 * Get titlebar rect 00204 */ 00205 ptbi->rcTitleBar = pwnd->rcWindow; 00206 cxB = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00207 InflateRect(&ptbi->rcTitleBar, -cxB * SYSMET(CXBORDER), -cxB * SYSMET(CYBORDER)); 00208 if (TestWF(pwnd, WEFTOOLWINDOW)) { 00209 ptbi->rcTitleBar.bottom = ptbi->rcTitleBar.top + SYSMET(CYSMCAPTION); 00210 } else { 00211 ptbi->rcTitleBar.bottom = ptbi->rcTitleBar.top + SYSMET(CYCAPTION); 00212 } 00213 00214 /* 00215 * Don't include the system menu area! 00216 */ 00217 if (TestWF(pwnd, WFSYSMENU) && _HasCaptionIcon(pwnd)) 00218 ptbi->rcTitleBar.left += (ptbi->rcTitleBar.bottom - ptbi->rcTitleBar.top - SYSMET(CYBORDER)); 00219 00220 /* 00221 * Close button 00222 */ 00223 if (!TestWF(pwnd, WFSYSMENU) && TestWF(pwnd, WFWIN40COMPAT)) { 00224 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_INVISIBLE; 00225 } else { 00226 if (!xxxMNCanClose(pwnd)) 00227 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_UNAVAILABLE; 00228 00229 if (TestWF(pwnd, WFCLOSEBUTTONDOWN)) 00230 ptbi->rgstate[INDEX_TITLEBAR_CLOSEBUTTON] |= STATE_SYSTEM_PRESSED; 00231 } 00232 00233 00234 /* 00235 * Max button 00236 */ 00237 if (! TestWF(pwnd, WFSYSMENU) && TestWF(pwnd, WFWIN40COMPAT)) { 00238 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_INVISIBLE; 00239 } else { 00240 if (! TestWF(pwnd, WFMAXBOX)) { 00241 if (! TestWF(pwnd, WFMINBOX)) { 00242 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_INVISIBLE; 00243 } else { 00244 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_UNAVAILABLE; 00245 } 00246 } 00247 00248 if (TestWF(pwnd, WFZOOMBUTTONDOWN)) 00249 ptbi->rgstate[INDEX_TITLEBAR_MAXBUTTON] |= STATE_SYSTEM_PRESSED; 00250 } 00251 00252 00253 /* 00254 * Min button 00255 */ 00256 if (! TestWF(pwnd, WFSYSMENU) && TestWF(pwnd, WFWIN40COMPAT)) { 00257 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_INVISIBLE; 00258 } else { 00259 if (! TestWF(pwnd, WFMINBOX)) { 00260 if (! TestWF(pwnd, WFMAXBOX)) { 00261 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_INVISIBLE; 00262 } else { 00263 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_UNAVAILABLE; 00264 } 00265 } 00266 00267 if (TestWF(pwnd, WFREDUCEBUTTONDOWN)) 00268 ptbi->rgstate[INDEX_TITLEBAR_MINBUTTON] |= STATE_SYSTEM_PRESSED; 00269 } 00270 00271 00272 /* 00273 * Help button 00274 */ 00275 if (!TestWF(pwnd, WEFCONTEXTHELP) || TestWF(pwnd, WFMINBOX) || 00276 TestWF(pwnd, WFMAXBOX)) { 00277 ptbi->rgstate[INDEX_TITLEBAR_HELPBUTTON] |= STATE_SYSTEM_INVISIBLE; 00278 } else { 00279 if (TestWF(pwnd, WFHELPBUTTONDOWN)) 00280 ptbi->rgstate[INDEX_TITLEBAR_HELPBUTTON] |= STATE_SYSTEM_PRESSED; 00281 } 00282 00283 // IME button BOGUS! 00284 ptbi->rgstate[INDEX_TITLEBAR_IMEBUTTON] = STATE_SYSTEM_INVISIBLE; 00285 00286 #if 0 00287 /* 00288 * System menu 00289 */ 00290 if (!TestWF(pwnd, WFSYSMENU) || !_HasCaptionIcon(pwnd)) 00291 ptbi->stateSysMenu |= STATE_SYSTEM_INVISIBLE; 00292 #endif 00293 00294 return TRUE; 00295 }

BOOL xxxGetUpdateRect PWND  pwnd,
LPRECT  lprc,
BOOL  fErase
 

Definition at line 1525 of file update.c.

References BOOL, CFOWNDC, CheckLock, ClrWF, tagDCE::DCX_flags, FALSE, gpDispInfo, tagDCE::hdc, HRGN_FULL, tagWND::hrgnUpdate, IntersectRect(), IntersectWithParents(), NULL, OffsetRect(), tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PWNDDESKTOP, tagDCE::pwndOrg, tagWND::rcClient, SetRectEmpty, TestCF, TestWF, TRUE, WFUPDATEDIRTY, WFWIN31COMPAT, and xxxSimpleDoSyncPaint().

Referenced by NtUserGetUpdateRect().

01529 { 01530 RECT rc; 01531 01532 CheckLock(pwnd); 01533 01534 if (fErase) 01535 xxxSimpleDoSyncPaint(pwnd); 01536 01537 /* 01538 * The app is looking at the update region: okay to allow window 01539 * validation. 01540 */ 01541 ClrWF(pwnd, WFUPDATEDIRTY); 01542 01543 if (pwnd->hrgnUpdate == NULL) { 01544 01545 if (lprc) { 01546 SetRectEmpty(lprc); 01547 } 01548 01549 return FALSE; 01550 01551 } else { 01552 01553 /* 01554 * We must handle the case where a window has an update region, 01555 * but it is completely obscured by its parents. In this case, we 01556 * must validate the window and all its children, and return FALSE. 01557 * 01558 * An OffsetChildren() call resulting from SetWindowPos() or 01559 * ScrollWindowEx() will cause this to happen. Update regions are 01560 * just offset without checking their new positions to see if they 01561 * are obscured by the parent(s). This is too painful to check in 01562 * those cases, so we instead handle it here. 01563 * 01564 * BeginPaint() handles this case correctly by returning an empty 01565 * rectangle, so nothing special need be done there. 01566 */ 01567 if (pwnd->hrgnUpdate == HRGN_FULL) { 01568 01569 rc = pwnd->rcClient; 01570 01571 } else { 01572 01573 switch (GreGetRgnBox(pwnd->hrgnUpdate, &rc)) { 01574 case ERROR: 01575 case NULLREGION: 01576 SetRectEmpty(&rc); 01577 break; 01578 01579 case SIMPLEREGION: 01580 case COMPLEXREGION: 01581 break; 01582 } 01583 01584 IntersectRect(&rc, &rc, &pwnd->rcClient); 01585 } 01586 01587 if (IntersectWithParents(pwnd, &rc)) { 01588 01589 if (pwnd != PWNDDESKTOP(pwnd)) { 01590 OffsetRect(&rc, -pwnd->rcClient.left, -pwnd->rcClient.top); 01591 } 01592 01593 /* 01594 * If the window is CS_OWNDC, then we must map the returned 01595 * rectangle with DPtoLP, to ensure that the rectangle is 01596 * in the same coordinate system as the rectangle returned 01597 * by BeginPaint(). 01598 * 01599 * BUT ONLY IF hwnd->hrgnUpdate != HRGN_FULL! For true 01600 * compatibility with 3.0. 01601 */ 01602 if (TestCF(pwnd, CFOWNDC) && 01603 (TestWF(pwnd, WFWIN31COMPAT) || pwnd->hrgnUpdate != HRGN_FULL)) { 01604 01605 PDCE pdce; 01606 01607 /* 01608 * Look up this window's DC in the cache, and use it to 01609 * map the returned rectangle. 01610 */ 01611 for (pdce = gpDispInfo->pdceFirst; pdce; pdce = pdce->pdceNext) { 01612 01613 if (pdce->pwndOrg == pwnd && !(pdce->DCX_flags & DCX_CACHE)) { 01614 GreDPtoLP(pdce->hdc, (LPPOINT)&rc, 2); 01615 break; 01616 } 01617 } 01618 } 01619 01620 } else { 01621 SetRectEmpty(&rc); 01622 } 01623 } 01624 01625 if (lprc) { 01626 #ifdef USE_MIRRORING 01627 if (TestWF(pwnd, WEFLAYOUTRTL)) { 01628 MirrorRect(pwnd, &rc); 01629 } 01630 #endif 01631 *lprc = rc; 01632 } 01633 01634 /* 01635 * If we're in the process a dragging a full window, mark the start 01636 * of the application painting. This is to make sure that if the 01637 * application calls DefWindowProc on the WM_PAINT after painting, we 01638 * won't erase the newly painted areas. Visual Slick calls GetUpdateRect 01639 * and then DefWindowProc. 01640 * See other comments for xxxBeginPaint and xxxDWP_Paint. 01641 * 8/3/94 johannec 01642 * 01643 * NOTE: This causes other problems in vslick where some controls 01644 * won't paint. Since the app doesn't call BeginPaint/EndPaint 01645 * to truly set/clear the STARTPAINT flag, we do not clear this 01646 * bit. (6-27-1996 : ChrisWil). 01647 * 01648 * 01649 * if (TEST_PUDF(PUDF_DRAGGINGFULLWINDOW)) { 01650 * SetWF(pwnd, WFSTARTPAINT); 01651 * } 01652 */ 01653 01654 return TRUE; 01655 }

int xxxGetUpdateRgn PWND  pwnd,
HRGN  hrgn,
BOOL  fErase
 

Definition at line 1665 of file update.c.

References BOOL, CheckLock, ClrWF, ghrgnInv2, HRGN_FULL, tagWND::hrgnUpdate, IntersectRgn, IntersectWithParents(), NULL, OffsetRect(), PWNDDESKTOP, tagWND::rcClient, SetEmptyRgn(), SetRectRgnIndirect(), TRUE, WFUPDATEDIRTY, and xxxSimpleDoSyncPaint().

Referenced by NtUserGetUpdateRgn().

01669 { 01670 RECT rc; 01671 int code; 01672 BOOL fNotEmpty; 01673 01674 01675 CheckLock(pwnd); 01676 01677 if (fErase) 01678 xxxSimpleDoSyncPaint(pwnd); 01679 01680 /* 01681 * The application is looking at the update region: okay to 01682 * allow validation 01683 */ 01684 ClrWF(pwnd, WFUPDATEDIRTY); 01685 01686 if (pwnd->hrgnUpdate == NULL) 01687 goto ReturnEmpty; 01688 01689 rc = pwnd->rcClient; 01690 fNotEmpty = IntersectWithParents(pwnd, &rc); 01691 01692 if (pwnd->hrgnUpdate == HRGN_FULL) { 01693 01694 /* 01695 * Since the update region may be larger than the window 01696 * rectangle, intersect it with the window rectangle. 01697 */ 01698 if (!fNotEmpty) 01699 goto ReturnEmpty; 01700 01701 code = SIMPLEREGION; 01702 01703 /* 01704 * Normalize the rectangle\region relative to the unclipped window 01705 */ 01706 if (pwnd != PWNDDESKTOP(pwnd)) { 01707 OffsetRect(&rc, -pwnd->rcClient.left, -pwnd->rcClient.top); 01708 } 01709 01710 SetRectRgnIndirect(hrgn, &rc); 01711 01712 } else { 01713 01714 SetRectRgnIndirect(ghrgnInv2, &rc); 01715 code = IntersectRgn(hrgn, ghrgnInv2, pwnd->hrgnUpdate); 01716 01717 switch (code) { 01718 case NULLREGION: 01719 case ERROR: 01720 goto ReturnEmpty; 01721 01722 default: 01723 if (pwnd != PWNDDESKTOP(pwnd)) { 01724 GreOffsetRgn(hrgn, -pwnd->rcClient.left, -pwnd->rcClient.top); 01725 } 01726 break; 01727 } 01728 } 01729 01730 #ifdef USE_MIRRORING 01731 MirrorRegion(pwnd, hrgn, TRUE); 01732 #endif 01733 /* 01734 * If we're in the process a dragging a full window, mark the start 01735 * of the application painting. This is to make sure that if the 01736 * application calls DefWindowProc on the WM_PAINT after painting, we 01737 * won't erase the newly painted areas. 01738 * See other comments for xxxBeginPaint and xxxDWP_Paint. 01739 * 8/3/94 johannec 01740 * 01741 * NOTE: This causes other problems in vslick where some controls 01742 * won't paint. Since the app doesn't call BeginPaint/EndPaint 01743 * to truly set/clear the STARTPAINT flag, we do not clear this 01744 * bit. (6-27-1996 : ChrisWil). 01745 * 01746 * if (TEST(PUDF(PUDF_DRAGGINGFULLWINDOW)) { 01747 * SetWF(pwnd, WFSTARTPAINT); 01748 * } 01749 */ 01750 01751 return code; 01752 01753 ReturnEmpty: 01754 SetEmptyRgn(hrgn); 01755 return NULLREGION; 01756 }

PCURSOR xxxGetWindowSmIcon PWND  pwnd,
BOOL  fDontSendMsg
 

Definition at line 306 of file caption.c.

References _GetProp(), tagSERVERINFO::atomIconSmProp, CheckLock, DWORD, FALSE, gpsi, HMValidateHandleNoSecure(), MAKEINTATOM, NULL, tagWND::pcls, PROPF_INTERNAL, SYSICO, TestWF, TYPE_CURSOR, WEFMDICHILD, WFOLDUI, WFWIN40COMPAT, xxxCreateWindowSmIcon(), and xxxSendMessageTimeout().

Referenced by xxxDrawCaptionTemp(), and xxxRealDrawMenuItem().

00309 { 00310 PCURSOR pcursor = NULL; 00311 HICON hico = NULL; 00312 PCLS pcls = pwnd->pcls; 00313 DWORD dwResult = 0; 00314 00315 CheckLock(pwnd); 00316 00317 /* 00318 * We check per-window stuff first then per-class stuff, preferring a 00319 * real small icon over a stretched big one. 00320 * 00321 * Per-window small icon 00322 * Per-window big icon stretched small 00323 * Per-class small icon 00324 * Per-class big icon stretched small 00325 * WM_QUERYDRAGICON big icon stretched small (for 3.x dudes) 00326 * 00327 * Try window small icon first 00328 * NOTE: The WM_SETICON and WM_GETICON messags are for ISVs only. 00329 */ 00330 if ((hico = (HICON)_GetProp(pwnd, MAKEINTATOM(gpsi->atomIconSmProp), PROPF_INTERNAL)) != NULL) { 00331 00332 if (pcursor = (PCURSOR)HMValidateHandleNoSecure(hico, TYPE_CURSOR)) { 00333 return pcursor; 00334 } else { 00335 RIPMSG1(RIP_WARNING,"GetWindowSmIcon: Invalid small icon handle (0x%p)", hico); 00336 } 00337 } 00338 00339 /* 00340 * Try class small icon next 00341 */ 00342 pcursor = pcls->spicnSm; 00343 if (pcursor != NULL) 00344 return pcursor; 00345 00346 if (!TestWF(pwnd, WFWIN40COMPAT) && 00347 (!TestWF(pwnd, WFOLDUI) || 00348 !TestWF(pwnd, WEFMDICHILD)) && 00349 !fDontSendMsg) { 00350 00351 ULONG_PTR dwResult; 00352 00353 /* 00354 * A few old apps like Corel don't set their class icon and other 00355 * data until long after we need it. If we send them WM_QUERYDRAGICON, 00356 * they will fault because they don't check the return from GWL to 00357 * get their data. WFOLDUI apps won't ever get a WM_QUERYDRAGICON, 00358 * sorry. Currently the apps with this hack (not for this reason 00359 * necessarily) 00360 * Corel Photo-Paint 5.0 00361 * Myst 2.0 00362 * Visual Baler 3.0 00363 * Quicken 00364 */ 00365 if (xxxSendMessageTimeout(pwnd, 00366 WM_QUERYDRAGICON, 00367 0, 00368 0, 00369 SMTO_NORMAL, 00370 100, 00371 &dwResult)) { 00372 00373 hico = (HICON)dwResult; 00374 } 00375 00376 if (hico) { 00377 00378 hico = xxxCreateWindowSmIcon(pwnd, hico, FALSE); 00379 pcursor = (PCURSOR)HMValidateHandleNoSecure(hico, TYPE_CURSOR); 00380 00381 if (pcursor == NULL) 00382 hico = NULL; 00383 } 00384 } 00385 00386 if (pcursor == NULL) { 00387 pcursor = SYSICO(WINLOGO); 00388 } 00389 00390 return pcursor; 00391 }

int xxxGetWindowText PWND  pwnd,
LPWSTR  psz,
int  cchMax
 

BOOL xxxHandleMenuMessages LPMSG  lpmsg,
PMENUSTATE  pMenuState,
PPOPUPMENU  ppopupmenu
 

Definition at line 43 of file mnloop.c.

References _PostMessage(), BOOL, DWORD, ExitMenuLoop(), FALSE, tagMENUSTATE::fButtonAlwaysDown, tagMENUSTATE::fButtonDown, tagMENUSTATE::fDragAndDrop, tagMENUSTATE::fDragging, tagPOPUPMENU::fFirstClick, tagPOPUPMENU::fHasMenuBar, tagMENUSTATE::fIgnoreButtonUp, tagMENUSTATE::fInDoDragDrop, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fNoNotify, tagPOPUPMENU::fRightButton, tagPOPUPMENU::fToggle, GET_X_LPARAM, GET_Y_LPARAM, GetMenuStateWindow(), gwinOldAppHackoMaticFlags, InflateRect(), IsMFMWFPWindow(), KEYBDHOLD, L, LockMFMWFPWindow(), MFMWFP_ALTMENU, MFMWFP_NOITEM, MFMWFP_OFFMENU, tagMENUSTATE::mnFocus, MNIsItemSelected(), MOUSEHOLD, NULL, tagPOPUPMENU::posSelectedItem, tagMENUSTATE::ptButtonDown, PtiCurrent, PtInRect(), tagMENUSTATE::ptMouseLast, PtoH, QF_CAPTURELOCKED, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndActivePopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, SYSMET, ThreadLock, ThreadLockAlways, ThreadUnlock, TRUE, tagMENUSTATE::uButtonDownHitArea, tagMENUSTATE::uButtonDownIndex, UINT, Unlock, UnlockMFMWFPWindow(), tagMENUSTATE::vkButtonDown, WM_SYSTIMER, WOAHACK_CHECKALTKEYSTATE, WOAHACK_IGNOREALTKEYDOWN, xxxMNButtonDown(), xxxMNButtonUp(), xxxMNChar(), xxxMNDismiss(), xxxMNDoubleClick(), xxxMNFindWindowFromPoint(), xxxMNKeyDown(), xxxMNMouseMove(), xxxMNRemoveMessage(), xxxMNSwitchToAlternateMenu(), xxxSendMessage(), and xxxTranslateMessage().

Referenced by xxxCallHandleMenuMessages(), and xxxMNLoop().

00047 { 00048 DWORD ch; 00049 ULONG_PTR cmdHitArea; 00050 UINT cmdItem; 00051 LPARAM lParam; 00052 BOOL fThreadLock = FALSE; 00053 TL tlpwndHitArea; 00054 TL tlpwndT; 00055 POINT pt; 00056 PWND pwnd; 00057 RECT rc; 00058 00059 /* 00060 * Paranoia. Let's bail up front if we don't have a menu. 00061 * Some code checks for NULL spmenu, other parts assume it's always not NULL 00062 * Use RIP_ERROR for a while to make sure this is OK 00063 */ 00064 if (ppopupmenu->spmenu == NULL) { 00065 RIPMSG2(RIP_ERROR, "xxxHandleMenuMessages NULL spmenu. pMenuSate:%p ppopupmenu:%p", 00066 pMenuState, ppopupmenu); 00067 return FALSE; 00068 } 00069 /* 00070 * Get things out of the structure so that we can access them quicker. 00071 */ 00072 ch = (DWORD)lpmsg->wParam; 00073 lParam = lpmsg->lParam; 00074 00075 /* 00076 * In this switch statement, we only look at messages we want to handle and 00077 * swallow. Messages we don't understand will get translated and 00078 * dispatched. 00079 */ 00080 switch (lpmsg->message) { 00081 case WM_RBUTTONDOWN: 00082 case WM_NCRBUTTONDOWN: 00083 00084 if (ppopupmenu->fRightButton) { 00085 goto HandleButtonDown; 00086 } 00087 /* 00088 * Fall through 00089 */ 00090 case WM_RBUTTONDBLCLK: 00091 case WM_NCRBUTTONDBLCLK: 00092 /* 00093 * Right click outside the menu dismisses the menu 00094 * (we didn't use to do this for single right clicks on 4.0) 00095 */ 00096 pMenuState->mnFocus = MOUSEHOLD; 00097 cmdHitArea = xxxMNFindWindowFromPoint(ppopupmenu, &cmdItem, MAKEPOINTS(lParam)); 00098 if (cmdHitArea == MFMWFP_OFFMENU) { 00099 xxxMNDismiss(pMenuState); 00100 return TRUE; 00101 } 00102 /* 00103 * Do nothing on right clicks on the menu 00104 */ 00105 if (!pMenuState->fModelessMenu) { 00106 xxxMNRemoveMessage(lpmsg->message, 0); 00107 } 00108 return TRUE; 00109 00110 case WM_LBUTTONDOWN: 00111 case WM_NCLBUTTONDOWN: 00112 // Commented out due to TandyT whinings... 00113 // if ((ppopupmenu->trackPopupMenuFlags & TPM_RIGHTBUTTON)) 00114 // break; 00115 00116 HandleButtonDown: 00117 00118 /* 00119 * Find out where this mouse down occurred. 00120 */ 00121 pMenuState->mnFocus = MOUSEHOLD; 00122 pMenuState->ptMouseLast.x = GET_X_LPARAM(lParam); 00123 pMenuState->ptMouseLast.y = GET_Y_LPARAM(lParam); 00124 cmdHitArea = xxxMNFindWindowFromPoint(ppopupmenu, &cmdItem, MAKEPOINTS(lParam)); 00125 00126 00127 /* 00128 * Thread lock this if it is a pwnd. This certainly isn't the way 00129 * you'd implement this if you had locking to begin with. 00130 */ 00131 fThreadLock = IsMFMWFPWindow(cmdHitArea); 00132 if (fThreadLock) { 00133 ThreadLock((PWND)cmdHitArea, &tlpwndHitArea); 00134 } 00135 00136 /* 00137 * If this is a drag and drop menu, remember the mouse 00138 * position and the hit test results. 00139 */ 00140 if (pMenuState->fDragAndDrop) { 00141 pMenuState->ptButtonDown = pMenuState->ptMouseLast; 00142 pMenuState->uButtonDownIndex = cmdItem; 00143 LockMFMWFPWindow(&pMenuState->uButtonDownHitArea, cmdHitArea); 00144 } 00145 00146 /* 00147 * Modeless menus don't capture the mouse so we might not see 00148 * the button up. We also release capture when sending the 00149 * WM_MENUDODRAGDROP message. So we want to remember what 00150 * mouse button went down. 00151 */ 00152 if (pMenuState->fDragAndDrop || pMenuState->fModelessMenu) { 00153 if (ch & MK_RBUTTON) { 00154 pMenuState->vkButtonDown = VK_RBUTTON; 00155 } else { 00156 pMenuState->vkButtonDown = VK_LBUTTON; 00157 } 00158 } 00159 00160 00161 if ((cmdHitArea == MFMWFP_OFFMENU) && (cmdItem == 0)) { 00162 // 00163 // Clicked in middle of nowhere, so terminate menus, and 00164 // let button pass through. 00165 CancelOut: 00166 xxxMNDismiss(pMenuState); 00167 goto Unlock; 00168 } else if (ppopupmenu->fHasMenuBar && (cmdHitArea == MFMWFP_ALTMENU)) { 00169 // 00170 // Switching between menu bar & popup 00171 // 00172 xxxMNSwitchToAlternateMenu(ppopupmenu); 00173 cmdHitArea = MFMWFP_NOITEM; 00174 } 00175 00176 if (cmdHitArea == MFMWFP_NOITEM) { 00177 // 00178 // On menu bar (system or main) 00179 // 00180 xxxMNButtonDown(ppopupmenu, pMenuState, cmdItem, TRUE); 00181 } else { 00182 // On popup window menu 00183 UserAssert(cmdHitArea); 00184 xxxSendMessage((PWND)cmdHitArea, MN_BUTTONDOWN, cmdItem, 0L); 00185 } 00186 00187 /* 00188 * Swallow the message since we handled it. 00189 */ 00190 /* 00191 * The excel guys change a wm_rbuttondown to a wm_lbuttondown message 00192 * in their message filter hook. Remove the message here or we'll 00193 * get in a nasty loop. 00194 * 00195 * We need to swallow msg32.message ONLY. It is possible for 00196 * the LBUTTONDOWN to not be at the head of the input queue. 00197 * If not, we will swallow a WM_MOUSEMOVE or something else like 00198 * that. The reason Peek() doesn't need to check the range 00199 * is because we've already Peek(PM_NOYIELD'ed) before, which 00200 * locked the sys queue. 00201 */ 00202 if (!pMenuState->fModelessMenu) { 00203 xxxMNRemoveMessage(lpmsg->message, WM_RBUTTONDOWN); 00204 } 00205 goto Unlock; 00206 00207 case WM_MOUSEMOVE: 00208 case WM_NCMOUSEMOVE: 00209 00210 /* 00211 * Is the user starting to drag? 00212 */ 00213 if (pMenuState->fDragAndDrop 00214 && pMenuState->fButtonDown 00215 && !pMenuState->fDragging 00216 && !pMenuState->fButtonAlwaysDown 00217 && (pMenuState->uButtonDownHitArea != MFMWFP_OFFMENU)) { 00218 00219 /* 00220 * We expect the mouse to go down on a menu item before a drag can start 00221 */ 00222 UserAssert(!ppopupmenu->fFirstClick); 00223 00224 /* 00225 * Calculate drag detect rectangle using the position the mouse went 00226 * down on 00227 */ 00228 *(LPPOINT)&rc.left = pMenuState->ptButtonDown; 00229 *(LPPOINT)&rc.right = pMenuState->ptButtonDown; 00230 InflateRect(&rc, SYSMET(CXDRAG), SYSMET(CYDRAG)); 00231 00232 pt.x = GET_X_LPARAM(lParam); 00233 pt.y = GET_Y_LPARAM(lParam); 00234 00235 /* 00236 * If we've moved outside the drag rect, then the user is dragging 00237 */ 00238 if (!PtInRect(&rc, pt)) { 00239 /* 00240 * Post a message so we'll finish processing this message 00241 * and get out of here before telling the app that the user 00242 * is dragging 00243 */ 00244 pwnd = GetMenuStateWindow(pMenuState); 00245 if (pwnd != NULL) { 00246 pMenuState->fDragging = TRUE; 00247 _PostMessage(pwnd, MN_DODRAGDROP, 0, 0); 00248 } else { 00249 RIPMSG0(RIP_ERROR, "xxxMNMouseMove. Unble to post MN_DODGRAGDROP"); 00250 } 00251 } 00252 } /* if (pMenuState->fDragAndDrop */ 00253 00254 xxxMNMouseMove(ppopupmenu, pMenuState, MAKEPOINTS(lParam)); 00255 return TRUE; 00256 00257 case WM_RBUTTONUP: 00258 case WM_NCRBUTTONUP: 00259 if (ppopupmenu->fRightButton) { 00260 goto HandleButtonUp; 00261 } 00262 /* 00263 * If the button is down, simply swallow this message 00264 */ 00265 if (pMenuState->fButtonDown) { 00266 if (!pMenuState->fModelessMenu) { 00267 xxxMNRemoveMessage(lpmsg->message, 0); 00268 } 00269 return TRUE; 00270 } 00271 // New feature for shell start menu -- notify when a right click 00272 // occurs on a menu item, and open a window of opportunity for 00273 // menus to recurse, allowing them to popup a context-sensitive 00274 // menu for that item. (jeffbog 9/28/95) 00275 // 00276 // BUGBUG: need to add check for Nashville+ app 00277 if ((lpmsg->message == WM_RBUTTONUP) && !ppopupmenu->fNoNotify) { 00278 PPOPUPMENU ppopupActive; 00279 00280 if ((ppopupmenu->spwndActivePopup != NULL) 00281 && (ppopupActive = ((PMENUWND)(ppopupmenu->spwndActivePopup))->ppopupmenu) 00282 && MNIsItemSelected(ppopupActive)) 00283 { 00284 TL tlpwndNotify; 00285 ThreadLock( ppopupActive->spwndNotify, &tlpwndNotify ); 00286 xxxSendMessage(ppopupActive->spwndNotify, WM_MENURBUTTONUP, 00287 ppopupActive->posSelectedItem, (LPARAM)PtoH(ppopupActive->spmenu)); 00288 ThreadUnlock( &tlpwndNotify ); 00289 } 00290 } 00291 break; 00292 00293 case WM_LBUTTONUP: 00294 case WM_NCLBUTTONUP: 00295 // Commented out due to TandyT whinings... 00296 // if ((ppopupmenu->trackPopupMenuFlags & TPM_RIGHTBUTTON)) 00297 // break; 00298 00299 HandleButtonUp: 00300 if (!pMenuState->fButtonDown) { 00301 00302 /* 00303 * Don't care about this mouse up since we never saw the button 00304 * down for some reason. 00305 */ 00306 return TRUE; 00307 } 00308 00309 /* 00310 * Cancel the dragging state, if any. 00311 */ 00312 if (pMenuState->fDragAndDrop) { 00313 00314 UnlockMFMWFPWindow(&pMenuState->uButtonDownHitArea); 00315 pMenuState->fDragging = FALSE; 00316 00317 if (pMenuState->fIgnoreButtonUp) { 00318 pMenuState->fButtonDown = 00319 pMenuState->fIgnoreButtonUp = FALSE; 00320 return TRUE; 00321 } 00322 } 00323 00324 /* 00325 * Find out where this mouse up occurred. 00326 */ 00327 pMenuState->ptMouseLast.x = GET_X_LPARAM(lParam); 00328 pMenuState->ptMouseLast.y = GET_Y_LPARAM(lParam); 00329 cmdHitArea = xxxMNFindWindowFromPoint(ppopupmenu, &cmdItem, MAKEPOINTS(lParam)); 00330 00331 00332 /* 00333 * If this is not true, some the code below won't work right. 00334 */ 00335 UserAssert((cmdHitArea != MFMWFP_OFFMENU) || (cmdItem == 0)); 00336 UserAssert(cmdHitArea != 0x0000FFFF); 00337 00338 /* 00339 * Thread lock this if it is a pwnd. This certainly isn't the way 00340 * you'd implement this if you had locking to begin with. 00341 */ 00342 fThreadLock = IsMFMWFPWindow(cmdHitArea); 00343 if (fThreadLock) { 00344 ThreadLock((PWND)cmdHitArea, &tlpwndHitArea); 00345 } 00346 00347 00348 if (ppopupmenu->fHasMenuBar) { 00349 if (((cmdHitArea == MFMWFP_OFFMENU) && (cmdItem == 0)) || 00350 ((cmdHitArea == MFMWFP_NOITEM) && ppopupmenu->fIsSysMenu && ppopupmenu->fToggle)) 00351 // Button up occurred in some random spot. Terminate 00352 // menus and swallow the message. 00353 goto CancelOut; 00354 } else { 00355 if ((cmdHitArea == MFMWFP_OFFMENU) && (cmdItem == 0)) { 00356 if (!ppopupmenu->fFirstClick) { 00357 // 00358 // User upclicked in some random spot. Terminate 00359 // menus and don't swallow the message. 00360 // 00361 00362 // 00363 // Don't do anything with HWND here cuz the window is 00364 // destroyed after this SendMessage(). 00365 // 00366 // DONTREVALIDATE(); 00367 ThreadLock(ppopupmenu->spwndPopupMenu, &tlpwndT); 00368 xxxSendMessage(ppopupmenu->spwndPopupMenu, MN_CANCELMENUS, 0, 0); 00369 ThreadUnlock(&tlpwndT); 00370 goto Unlock; 00371 } 00372 } 00373 00374 ppopupmenu->fFirstClick = FALSE; 00375 } 00376 00377 if (cmdHitArea == MFMWFP_NOITEM) { 00378 // 00379 // This is a system menu or a menu bar and the button up 00380 // occurred on the system menu or on a menu bar item. 00381 // 00382 xxxMNButtonUp(ppopupmenu, pMenuState, cmdItem, 0); 00383 } else if ((cmdHitArea != MFMWFP_OFFMENU) && (cmdHitArea != MFMWFP_ALTMENU)) { 00384 // 00385 // Warning: It's common for the popup to go away during the 00386 // processing of this message, so don't add any code that 00387 // messes with hwnd after this call! 00388 // 00389 // DONTREVALIDATE(); 00390 00391 // 00392 // We send lParam (that has the mouse co-ords ) for the app 00393 // to get it in its SC_RESTORE/SC_MINIMIZE messages 3.0 00394 // compat 00395 // 00396 xxxSendMessage((PWND)cmdHitArea, MN_BUTTONUP, (DWORD)cmdItem, lParam); 00397 } else { 00398 pMenuState->fButtonDown = 00399 pMenuState->fButtonAlwaysDown = FALSE; 00400 } 00401 Unlock: 00402 if (fThreadLock) 00403 ThreadUnlock(&tlpwndHitArea); 00404 return TRUE; 00405 00406 00407 case WM_LBUTTONDBLCLK: 00408 case WM_NCLBUTTONDBLCLK: 00409 00410 // Commented out due to TandyT whinings... 00411 // if (ppopup->fRightButton) 00412 // break; 00413 pMenuState->mnFocus = MOUSEHOLD; 00414 cmdHitArea = xxxMNFindWindowFromPoint(ppopupmenu, &cmdItem, MAKEPOINTS(lParam)); 00415 if ((cmdHitArea == MFMWFP_OFFMENU) && (cmdItem == 0)) { 00416 // Dbl-clicked in middle of nowhere, so terminate menus, and 00417 // let button pass through. 00418 xxxMNDismiss(pMenuState); 00419 return TRUE; 00420 } else if (ppopupmenu->fHasMenuBar && (cmdHitArea == MFMWFP_ALTMENU)) { 00421 // 00422 // BOGUS 00423 // TREAT LIKE BUTTON DOWN since we didn't dblclk on same item. 00424 // 00425 xxxMNSwitchToAlternateMenu(ppopupmenu); 00426 cmdHitArea = MFMWFP_NOITEM; 00427 } 00428 00429 if (cmdHitArea == MFMWFP_NOITEM) 00430 xxxMNDoubleClick(pMenuState, ppopupmenu, cmdItem); 00431 else { 00432 UserAssert(cmdHitArea); 00433 00434 ThreadLock((PWND)cmdHitArea, &tlpwndHitArea); 00435 xxxSendMessage((PWND)cmdHitArea, MN_DBLCLK, 00436 (DWORD)cmdItem, 0L); 00437 ThreadUnlock(&tlpwndHitArea); 00438 } 00439 return TRUE; 00440 00441 case WM_KEYDOWN: 00442 case WM_SYSKEYDOWN: 00443 00444 /* 00445 * If mouse button is down, ignore keyboard input (fix #3899, IanJa) 00446 */ 00447 if (pMenuState->fButtonDown && (ch != VK_F1)) { 00448 00449 /* 00450 * Check if the user wants to cancel dragging. 00451 */ 00452 if (pMenuState->fDragging && (ch == VK_ESCAPE)) { 00453 RIPMSG0(RIP_WARNING, "xxxHandleMenuMessages: ESC while dragging"); 00454 pMenuState->fIgnoreButtonUp = TRUE; 00455 } 00456 00457 return TRUE; 00458 } 00459 pMenuState->mnFocus = KEYBDHOLD; 00460 switch (ch) { 00461 case VK_UP: 00462 case VK_DOWN: 00463 case VK_LEFT: 00464 case VK_RIGHT: 00465 case VK_RETURN: 00466 case VK_CANCEL: 00467 case VK_ESCAPE: 00468 case VK_MENU: 00469 case VK_F10: 00470 case VK_F1: 00471 if (ppopupmenu->spwndActivePopup) { 00472 ThreadLockAlways(ppopupmenu->spwndActivePopup, &tlpwndT); 00473 xxxSendMessage(ppopupmenu->spwndActivePopup, lpmsg->message, 00474 ch, 0L); 00475 ThreadUnlock(&tlpwndT); 00476 } else { 00477 xxxMNKeyDown(ppopupmenu, pMenuState, (UINT)ch); 00478 } 00479 break; 00480 00481 case VK_TAB: 00482 /* 00483 * People hit the ALT key now just to turn underlines ON in dialogs. 00484 * This throws them into "invisible menu mode". If they hit any char 00485 * at that point, we'll bail in xxxMNChar. But not so if they hit ctrl-tab, 00486 * which is used to navigate property sheets. So let's help them out. 00487 */ 00488 if (ppopupmenu->fIsMenuBar && (ppopupmenu->spwndActivePopup == NULL)) { 00489 xxxMNDismiss(pMenuState); 00490 return TRUE; 00491 } 00492 /* 00493 * Fall through 00494 */ 00495 00496 default: 00497 TranslateKey: 00498 if (!pMenuState->fModelessMenu) { 00499 xxxTranslateMessage(lpmsg, 0); 00500 } 00501 break; 00502 } 00503 return TRUE; 00504 00505 case WM_CHAR: 00506 case WM_SYSCHAR: 00507 if (ppopupmenu->spwndActivePopup) { 00508 ThreadLockAlways(ppopupmenu->spwndActivePopup, &tlpwndT); 00509 xxxSendMessage(ppopupmenu->spwndActivePopup, lpmsg->message, 00510 ch, 0L); 00511 ThreadUnlock(&tlpwndT); 00512 } else { 00513 xxxMNChar(ppopupmenu, pMenuState, (UINT)ch); 00514 } 00515 return TRUE; 00516 00517 case WM_SYSKEYUP: 00518 00519 /* 00520 * Ignore ALT and F10 keyup messages since they are handled on 00521 * the KEYDOWN message. 00522 */ 00523 if (ch == VK_MENU || ch == VK_F10) { 00524 if (gwinOldAppHackoMaticFlags & WOAHACK_CHECKALTKEYSTATE) { 00525 if (gwinOldAppHackoMaticFlags & WOAHACK_IGNOREALTKEYDOWN) { 00526 gwinOldAppHackoMaticFlags &= ~WOAHACK_IGNOREALTKEYDOWN; 00527 gwinOldAppHackoMaticFlags &= ~WOAHACK_CHECKALTKEYSTATE; 00528 } else 00529 gwinOldAppHackoMaticFlags |= WOAHACK_IGNOREALTKEYDOWN; 00530 } 00531 00532 return TRUE; 00533 } 00534 00535 /* 00536 ** fall thru ** 00537 */ 00538 00539 case WM_KEYUP: 00540 00541 /* 00542 * Do RETURNs on the up transition only 00543 */ 00544 goto TranslateKey; 00545 00546 case WM_SYSTIMER: 00547 00548 /* 00549 * Prevent the caret from flashing by eating all WM_SYSTIMER messages. 00550 */ 00551 return TRUE; 00552 00553 default: 00554 break; 00555 } 00556 00557 #if DBG 00558 /* 00559 * Nobody should be able to steal capture from modal menus. 00560 */ 00561 if (!pMenuState->fModelessMenu 00562 && !pMenuState->fInDoDragDrop 00563 && !ExitMenuLoop (pMenuState, ppopupmenu) ) { 00564 00565 UserAssert(PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED); 00566 UserAssert(PtiCurrent()->pq->spwndCapture == ppopupmenu->spwndNotify); 00567 } 00568 #endif 00569 00570 /* 00571 * We didn't handle this message 00572 */ 00573 return FALSE; 00574 }

VOID xxxHandleNCMouseGuys PWND  pwnd,
UINT  message,
int  htArea,
LPARAM  lParam
 

Definition at line 23 of file syscmd.c.

References _GetMenuState(), AW_USE2, CheckLock, GetTopLevelWindow(), TestWF, ThreadLock, ThreadUnlock, UINT, WFMAXBOX, WFMAXIMIZED, WFMINIMIZED, WFSYSMENU, xxxActivateWindow(), xxxGetSysMenuHandle(), xxxSendMessage(), and xxxSetSysMenu().

Referenced by xxxDWP_NCMouse().

00028 { 00029 UINT syscmd; 00030 PWND pwndT; 00031 TL tlpwndT; 00032 00033 CheckLock(pwnd); 00034 00035 syscmd = 0xFFFF; 00036 00037 switch (htArea) { 00038 00039 case HTCAPTION: 00040 switch (message) { 00041 00042 case WM_NCLBUTTONDBLCLK: 00043 if (TestWF(pwnd, WFMINIMIZED) || TestWF(pwnd, WFMAXIMIZED)) { 00044 syscmd = SC_RESTORE; 00045 } else if (TestWF(pwnd, WFMAXBOX)) { 00046 syscmd = SC_MAXIMIZE; 00047 } 00048 break; 00049 00050 case WM_NCLBUTTONDOWN: 00051 pwndT = GetTopLevelWindow(pwnd); 00052 ThreadLock(pwndT, &tlpwndT); 00053 xxxActivateWindow(pwndT, AW_USE2); 00054 ThreadUnlock(&tlpwndT); 00055 syscmd = SC_MOVE; 00056 break; 00057 } 00058 break; 00059 00060 case HTSYSMENU: 00061 case HTMENU: 00062 case HTHSCROLL: 00063 case HTVSCROLL: 00064 if (message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONDBLCLK) { 00065 switch (htArea) { 00066 case HTSYSMENU: 00067 if (message == WM_NCLBUTTONDBLCLK) { 00068 syscmd = SC_CLOSE; 00069 break; 00070 } 00071 00072 /* 00073 *** FALL THRU ** 00074 */ 00075 00076 case HTMENU: 00077 syscmd = SC_MOUSEMENU; 00078 break; 00079 00080 case HTHSCROLL: 00081 syscmd = SC_HSCROLL; 00082 break; 00083 00084 case HTVSCROLL: 00085 syscmd = SC_VSCROLL; 00086 break; 00087 } 00088 } 00089 break; 00090 } 00091 00092 switch (syscmd) { 00093 00094 case SC_MINIMIZE: 00095 case SC_MAXIMIZE: 00096 case SC_CLOSE: 00097 00098 /* 00099 * Only do double click commands on an upclick. 00100 * This code is very sensitive to changes from this state. 00101 * Eat any mouse messages. 00102 */ 00103 00104 /* 00105 * Bug #152: WM_NCLBUTTONUP message missing from double click. 00106 * This code was broken in Windows 3.x and the test for whether 00107 * the mouse button was down always failed, so no mouse messages 00108 * were ever eaten. We'll emulate this by not even doing the test. 00109 * 00110 * 00111 * { 00112 * PQ pqCurrent; 00113 * MSG msg; 00114 * 00115 * pqCurrent = PtiCurrent()->pq; 00116 * if (TestKeyStateDown(pqCurrent, VK_LBUTTON)) { 00117 * xxxCapture(PtiCurrent(), pwnd, WINDOW_CAPTURE); 00118 * 00119 * while (TestKeyStateDown(pqCurrent, VK_LBUTTON)) { 00120 * if (!xxxPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, 00121 * PM_REMOVE)) { 00122 * if (!xxxSleepThread(QS_MOUSE, 0, TRUE)) 00123 * break; 00124 * } 00125 * } 00126 * 00127 * xxxReleaseCapture(); 00128 * 00129 * } 00130 * } 00131 * 00132 */ 00133 00134 /* 00135 ** FALL THRU ** 00136 */ 00137 case SC_SIZE: 00138 case SC_MOVE: 00139 /* 00140 * For SysCommands on system menu, don't do if menu item is 00141 * disabled. 00142 */ 00143 if (TestWF(pwnd, WFSYSMENU)) { 00144 xxxSetSysMenu(pwnd); 00145 if (_GetMenuState(xxxGetSysMenuHandle(pwnd), (syscmd & 0xFFF0), 00146 MF_BYCOMMAND) & MFS_GRAYED) { 00147 return; 00148 } 00149 } 00150 break; 00151 } 00152 00153 if (syscmd != 0xFFFF) { 00154 xxxSendMessage(pwnd, WM_SYSCOMMAND, syscmd | htArea, lParam); 00155 } 00156 }

VOID xxxHandleWindowPosChanged PWND  pwnd,
PWINDOWPOS  ppos
 

Definition at line 3381 of file swp.c.

References CheckLock, FALSE, ppos, PWNDDESKTOP, tagWND::rcClient, tagWND::spwndParent, TestWF, VOID(), WFMAXIMIZED, WFMINIMIZED, xxxSendMessage(), and xxxSendSizeMessage().

Referenced by xxxDefWindowProc().

03384 { 03385 CheckLock(pwnd); 03386 03387 if (!(ppos->flags & SWP_NOCLIENTMOVE)) { 03388 POINT pt; 03389 PWND pwndParent; 03390 03391 pt.x = pwnd->rcClient.left; 03392 pt.y = pwnd->rcClient.top; 03393 03394 pwndParent = pwnd->spwndParent; 03395 UserAssert(pwndParent); 03396 03397 if (pwndParent != PWNDDESKTOP(pwnd)) { 03398 pt.x -= pwndParent->rcClient.left; 03399 pt.y -= pwndParent->rcClient.top; 03400 } 03401 03402 xxxSendMessage( 03403 pwnd, 03404 WM_MOVE, 03405 FALSE, 03406 MAKELONG(pt.x, pt.y)); 03407 } 03408 03409 if ((ppos->flags & SWP_STATECHANGE) || !(ppos->flags & SWP_NOCLIENTSIZE)) { 03410 03411 if (TestWF(pwnd, WFMINIMIZED)) 03412 xxxSendSizeMessage(pwnd, SIZEICONIC); 03413 else if (TestWF(pwnd, WFMAXIMIZED)) 03414 xxxSendSizeMessage(pwnd, SIZEFULLSCREEN); 03415 else 03416 xxxSendSizeMessage(pwnd, SIZENORMAL); 03417 } 03418 }

UINT xxxHardErrorControl DWORD  ,
HANDLE  ,
PDESKRESTOREDATA 
 

Definition at line 276 of file w32/ntuser/kernel/random.c.

References AllocQueue(), BEGINATOMICCHECK, BOOL, CanForceForeground(), tagQ::cLockCount, tagTHREADINFO::cQuit, tagQ::cThreads, DeferWinEventNotify, ENDATOMICCHECK, FALSE, gbDisconnectHardErrorAttach, gHardErrorHandler, gpqForeground, gptiBlockInput, grpdeskRitInput, gspdeskDisconnect, gspdeskShouldBeForeground, ISCSRSS, ISTS, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), POBJECT_NAME, tagTHREADINFO::ppi, tagTHREADINFO::pq, tagHARDERRORHANDLER::pqAttach, PsThreadType, tagHARDERRORHANDLER::pti, PtiCurrent, PtiFromThread, tagTHREADINFO::rpdesk, Status, TIF_ALLOWFOREGROUNDACTIVATE, tagTHREADINFO::TIF_flags, TRUE, UINT, UnlockThread, UserMode, xxxRestoreCsrssThreadDesktop(), xxxSetCsrssThreadDesktop(), zzzAttachToQueue(), and zzzEndDeferWinEventNotify.

Referenced by NtUserHardErrorControl().

00280 { 00281 PTHREADINFO ptiClient, ptiCurrent = PtiCurrent(); 00282 PDESKTOP pdesk; 00283 PUNICODE_STRING pstrName; 00284 NTSTATUS Status; 00285 PETHREAD Thread; 00286 BOOL fAllowForeground; 00287 00288 /* 00289 * turn off BlockInput so the user can respond to the hard error popup 00290 */ 00291 gptiBlockInput = NULL; 00292 00293 UserAssert(ISCSRSS()); 00294 switch (dwCmd) { 00295 case HardErrorSetup: 00296 00297 /* 00298 * Don't do it if the system has not been initialized. 00299 */ 00300 if (grpdeskRitInput == NULL) { 00301 RIPMSG0(RIP_WARNING, "HardErrorControl: System not initialized"); 00302 return HEC_ERROR; 00303 } 00304 00305 /* 00306 * Setup caller as the hard error handler. 00307 */ 00308 if (gHardErrorHandler.pti != NULL) { 00309 RIPMSG1(RIP_WARNING, "HardErrorControl: pti not NULL %#p", gHardErrorHandler.pti); 00310 return HEC_ERROR; 00311 } 00312 00313 /* 00314 * Mark the handler as active. 00315 */ 00316 gHardErrorHandler.pti = ptiCurrent; 00317 00318 /* 00319 * Clear any pending quits. 00320 */ 00321 ptiCurrent->cQuit = 0; 00322 00323 break; 00324 00325 case HardErrorCleanup: 00326 00327 /* 00328 * Remove caller as the hard error handler. 00329 */ 00330 if (gHardErrorHandler.pti != ptiCurrent) { 00331 return HEC_ERROR; 00332 } 00333 00334 gHardErrorHandler.pti = NULL; 00335 break; 00336 00337 case HardErrorAttachUser: 00338 case HardErrorInDefDesktop: 00339 /* 00340 * Check for exit conditions. We do not allow attaches to the 00341 * disconnect desktop. 00342 */ 00343 if (ISTS()) { 00344 if ((grpdeskRitInput == NULL) || 00345 00346 ((grpdeskRitInput == gspdeskDisconnect) && 00347 (gspdeskShouldBeForeground == NULL)) || 00348 00349 ((grpdeskRitInput == gspdeskDisconnect) && 00350 (gspdeskShouldBeForeground == gspdeskDisconnect))) { 00351 return HEC_ERROR; 00352 } 00353 } 00354 00355 /* 00356 * Only attach to a user desktop. 00357 */ 00358 if (ISTS() && grpdeskRitInput == gspdeskDisconnect) { 00359 pstrName = POBJECT_NAME(gspdeskShouldBeForeground); 00360 } else { 00361 pstrName = POBJECT_NAME(grpdeskRitInput); 00362 } 00363 00364 if (pstrName && (!_wcsicmp(TEXT("Winlogon"), pstrName->Buffer) || 00365 !_wcsicmp(TEXT("Disconnect"), pstrName->Buffer) || 00366 !_wcsicmp(TEXT("Screen-saver"), pstrName->Buffer))) { 00367 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, ""); 00368 return HEC_WRONGDESKTOP; 00369 } 00370 if (dwCmd == HardErrorInDefDesktop) { 00371 /* 00372 * Clear any pending quits. 00373 */ 00374 ptiCurrent->cQuit = 0; 00375 return HEC_SUCCESS; 00376 } 00377 00378 00379 /* 00380 * Fall through. 00381 */ 00382 00383 case HardErrorAttach: 00384 00385 /* 00386 * Save a pointer to and prevent destruction of the 00387 * current queue. This will give us a queue to return 00388 * to if journalling is occuring when we tear down the 00389 * hard error popup. 00390 */ 00391 gHardErrorHandler.pqAttach = ptiCurrent->pq; 00392 (ptiCurrent->pq->cLockCount)++; 00393 00394 /* 00395 * Fall through. 00396 */ 00397 00398 case HardErrorAttachNoQueue: 00399 00400 /* 00401 * Check for exit conditions. We do not allow attaches to the 00402 * disconnect desktop. 00403 */ 00404 if (ISTS()) { 00405 if ((grpdeskRitInput == NULL) || 00406 00407 ((grpdeskRitInput == gspdeskDisconnect) && 00408 (gspdeskShouldBeForeground == NULL)) || 00409 00410 ((grpdeskRitInput == gspdeskDisconnect) && 00411 (gspdeskShouldBeForeground == gspdeskDisconnect))) { 00412 return HEC_ERROR; 00413 } 00414 } 00415 00416 /* 00417 * Attach the handler to the current desktop. 00418 */ 00419 /* 00420 * Don't allow an attach to the disconnected desktop, but 00421 * remember this for later when we detach. 00422 */ 00423 gbDisconnectHardErrorAttach = FALSE; 00424 00425 if (ISTS() && grpdeskRitInput == gspdeskDisconnect) { 00426 pdesk = gspdeskShouldBeForeground; 00427 gbDisconnectHardErrorAttach = TRUE; 00428 } else { 00429 pdesk = grpdeskRitInput; 00430 } 00431 00432 UserAssert(pdesk != NULL); 00433 00434 Status = xxxSetCsrssThreadDesktop(pdesk, pdrdRestore); 00435 00436 if (!NT_SUCCESS(Status)) { 00437 RIPMSG1(RIP_WARNING, "HardErrorControl: HardErrorAttachNoQueue failed:%#lx", Status); 00438 if (dwCmd != HardErrorAttachNoQueue) { 00439 gHardErrorHandler.pqAttach = NULL; 00440 UserAssert(ptiCurrent->pq->cLockCount); 00441 (ptiCurrent->pq->cLockCount)--; 00442 } 00443 return HEC_ERROR; 00444 } 00445 00446 /* 00447 * Make sure we actually set the pdesk in the current thread 00448 */ 00449 UserAssert(ptiCurrent->rpdesk != NULL); 00450 00451 /* 00452 * Determine if this box can come to the foreground. 00453 * Let it come to the foreground if it doesn't have a pti 00454 * (it might have just failed to load). 00455 */ 00456 fAllowForeground = FALSE; 00457 if (handle != NULL) { 00458 Status = ObReferenceObjectByHandle(handle, 00459 THREAD_QUERY_INFORMATION, 00460 *PsThreadType, 00461 UserMode, 00462 &Thread, 00463 NULL); 00464 if (NT_SUCCESS(Status)) { 00465 ptiClient = PtiFromThread(Thread); 00466 if ((ptiClient == NULL) || CanForceForeground(ptiClient->ppi)) { 00467 fAllowForeground = TRUE; 00468 } 00469 00470 UnlockThread(Thread); 00471 00472 } else { 00473 RIPMSG2(RIP_WARNING, "HardErrorControl: HardErrorAttach failed to get thread (%#lx) pointer:%#lx", handle, Status); 00474 } 00475 } 00476 00477 if (fAllowForeground) { 00478 ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE; 00479 TAGMSG1(DBGTAG_FOREGROUND, "xxxHardErrorControl set TIF %#lx", ptiCurrent); 00480 } else { 00481 ptiCurrent->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE; 00482 TAGMSG1(DBGTAG_FOREGROUND, "xxxHardErrorControl clear TIF %#lx", ptiCurrent); 00483 } 00484 00485 break; 00486 00487 case HardErrorDetach: 00488 00489 /* 00490 * xxxSwitchDesktop may have sent WM_QUIT to the msgbox, so 00491 * ensure that the quit flag is reset. 00492 */ 00493 ptiCurrent->cQuit = 0; 00494 00495 /* 00496 * We will reset the hard-error queue to the pre-allocated 00497 * one so if we end up looping back (i.e. from a desktop 00498 * switch), we will have a valid queue in case the desktop 00499 * was deleted. 00500 */ 00501 UserAssert(gHardErrorHandler.pqAttach->cLockCount); 00502 (gHardErrorHandler.pqAttach->cLockCount)--; 00503 00504 DeferWinEventNotify(); 00505 00506 BEGINATOMICCHECK(); 00507 00508 if (ptiCurrent->pq != gHardErrorHandler.pqAttach) { 00509 UserAssert(gHardErrorHandler.pqAttach->cThreads == 0); 00510 AllocQueue(NULL, gHardErrorHandler.pqAttach); 00511 gHardErrorHandler.pqAttach->cThreads++; 00512 zzzAttachToQueue(ptiCurrent, gHardErrorHandler.pqAttach, NULL, FALSE); 00513 } 00514 00515 gHardErrorHandler.pqAttach = NULL; 00516 00517 ENDATOMICCHECK(); 00518 00519 zzzEndDeferWinEventNotify(); 00520 00521 /* 00522 * Fall through. 00523 */ 00524 00525 case HardErrorDetachNoQueue: 00526 /* 00527 * Detach the handler from the desktop and return 00528 * status to indicate if a switch has occured. 00529 */ 00530 pdesk = ptiCurrent->rpdesk; 00531 xxxRestoreCsrssThreadDesktop(pdrdRestore); 00532 00533 if (ISTS()) { 00534 /* 00535 * The hard error message box gets a desktop switch notification, 00536 * so remember that we lied to him and lie (or unlie) to him again. 00537 * A desktop switch did occur. 00538 */ 00539 if (gbDisconnectHardErrorAttach) { 00540 gbDisconnectHardErrorAttach = FALSE; 00541 return HEC_DESKTOPSWITCH; 00542 } 00543 #ifdef WAY_LATER 00544 /* 00545 * This happened once and caused a trap when a KeyEvent() came in and we 00546 * directed it to this queue. I think this is a MS window that we caught 00547 * since we use this so much for license popup's. 00548 */ 00549 if (gHardErrorHandler.pqAttach == gpqForeground) { 00550 gpqForeground = NULL; 00551 } 00552 #endif 00553 } 00554 00555 return (pdesk != grpdeskRitInput ? HEC_DESKTOPSWITCH : HEC_SUCCESS); 00556 } 00557 return HEC_SUCCESS; 00558 }

VOID xxxHelpLoop PWND  pwnd  ) 
 

Definition at line 73 of file kernel/help.c.

References _GetParent(), _GetProp(), tagSERVERINFO::atomContextHelpIdProp, BWL_ENUMCHILDREN, CheckLock, ClrWF, CopyInflateRect(), EnumPwndDlgChildProc(), FALSE, FIsParentDude(), FWINABLE, GetContextHelpId(), GetWindowBorders(), gpsi, HELP, HWq, IsWinEventNotifyDeferredOK, MAKEINTATOM, msg, NULL, tagTHREADINFO::pq, tagDLGENUMDATA::ptCurHelp, PtiCurrent, PtInRect(), PTR_TO_ID, tagDLGENUMDATA::pwndControl, tagDLGENUMDATA::pwndDialog, tagWND::rcWindow, SCREEN_CAPTURE, tagWND::spmenu, tagQ::spwndCapture, SYSCUR, SYSMET, TestWF, TestwndChild, ThreadLock, ThreadLockAlways, ThreadUnlock, TRUE, ValidateHwnd, VOID(), WFDISABLED, WFHELPBUTTONDOWN, xxxCapture(), xxxDispatchMessage(), xxxGetMessage, xxxInternalEnumWindow(), xxxPeekMessage, xxxRedrawTitle(), xxxReleaseCapture(), xxxSendHelpMessage(), xxxTranslateMessage(), xxxWaitMessage(), xxxWindowEvent(), xxxWindowHitTest(), and zzzSetCursor().

Referenced by xxxSysCommand().

00074 { 00075 HWND hwndChild; 00076 PWND pwndChild; 00077 PWND pwndControl; 00078 MSG msg; 00079 RECT rc; 00080 int cBorders; 00081 PTHREADINFO ptiCurrent = PtiCurrent(); 00082 DLGENUMDATA DlgEnumData; 00083 TL tlpwndChild; 00084 00085 CheckLock(pwnd); 00086 UserAssert(IsWinEventNotifyDeferredOK()); 00087 00088 if (FWINABLE()) { 00089 xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPSTART, pwnd, OBJID_WINDOW, 00090 INDEXID_CONTAINER, 0); 00091 } 00092 00093 zzzSetCursor(SYSCUR(HELP)); 00094 xxxCapture(ptiCurrent, pwnd, SCREEN_CAPTURE); 00095 00096 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00097 00098 CopyInflateRect(&rc, &pwnd->rcWindow, -cBorders * SYSMET(CXBORDER), -cBorders * SYSMET(CYBORDER)); 00099 00100 while (ptiCurrent->pq->spwndCapture == pwnd) { 00101 if (!xxxPeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_NOREMOVE)) { 00102 xxxWaitMessage(); 00103 continue; 00104 } 00105 00106 if (msg.message == WM_NCLBUTTONDOWN) { 00107 break; 00108 } else if (msg.message == WM_LBUTTONDOWN) { 00109 /* 00110 * If user clicked outside of window client, bail out now. 00111 */ 00112 if (!PtInRect(&rc, msg.pt)) 00113 break; 00114 00115 /* 00116 * WindowHitTest() won't return a static control's handle 00117 */ 00118 hwndChild = xxxWindowHitTest(pwnd, msg.pt, NULL, 0); 00119 pwndChild = ValidateHwnd( hwndChild ); 00120 ThreadLock(pwndChild, &tlpwndChild); 00121 00122 if (pwndChild && FIsParentDude(pwndChild)) 00123 { 00124 /* 00125 * If this is a dialog class, then one of three things has 00126 * happened: 00127 * 00128 * o This is a static text control 00129 * o This is the background of the dialog box. 00130 * 00131 * What we do is enumerate the child windows and see if 00132 * any of them contain the current cursor point. If they do, 00133 * change our window handle and continue on. Otherwise, 00134 * return doing nothing -- we don't want context-sensitive 00135 * help for a dialog background. 00136 * 00137 * If this is a group box, then we might have clicked on a 00138 * disabled control, so we enumerate child windows to see 00139 * if we get another control. 00140 */ 00141 00142 /* 00143 * We're enumerating a dialog's children. So, if we don't 00144 * find any matches, hwndChild will be NULL and the check 00145 * below will drop out. 00146 */ 00147 DlgEnumData.pwndDialog = pwndChild; 00148 DlgEnumData.pwndControl = NULL; 00149 DlgEnumData.ptCurHelp = msg.pt; 00150 xxxInternalEnumWindow(pwndChild, EnumPwndDlgChildProc, (LPARAM)&DlgEnumData, BWL_ENUMCHILDREN); 00151 pwndControl = DlgEnumData.pwndControl; 00152 } else { 00153 pwndControl = pwndChild; 00154 } 00155 00156 /* 00157 * If we click on nothing, just exit. 00158 */ 00159 if (pwndControl == pwnd) { 00160 pwndControl = NULL; 00161 } 00162 00163 /* 00164 * HACK ALERT (Visual Basic 4.0) - they have their own non-window 00165 * based controls that draw directly on the main dialog. In order 00166 * to provide help for these controls, we pass along the WM_HELP 00167 * message iff the main dialog has a context id assigned. 00168 * 00169 * If the top level window has its own context help ID, 00170 * then pass it in the context help message. 00171 */ 00172 if (!pwndControl) { 00173 if (_GetProp(pwnd, MAKEINTATOM(gpsi->atomContextHelpIdProp), TRUE)) 00174 pwndControl = pwnd; 00175 } 00176 00177 if (pwndControl) { 00178 PWND pwndSend; 00179 int id; 00180 TL tlpwndSend; 00181 TL tlpwndControl; 00182 00183 ThreadLockAlways(pwndControl, &tlpwndControl); 00184 00185 zzzSetCursor(SYSCUR(ARROW)); 00186 xxxReleaseCapture(); 00187 xxxRedrawTitle(pwnd, DC_BUTTONS); 00188 ClrWF(pwnd, WFHELPBUTTONDOWN); 00189 xxxGetMessage(&msg, NULL, 0, 0); 00190 00191 if (FWINABLE()) { 00192 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR, 00193 INDEX_TITLEBAR_HELPBUTTON, FALSE); 00194 00195 xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPEND, pwnd, OBJID_WINDOW, 00196 INDEXID_CONTAINER, FALSE); 00197 } 00198 00199 /* 00200 * Determine the ID of the control 00201 * We used to always sign extend, but Win98 doesn't do that 00202 * so we only sign extend 0xffff. MCostea #218711 00203 */ 00204 if (TestwndChild(pwndControl)) { 00205 id = PTR_TO_ID(pwndControl->spmenu); 00206 if (id == 0xffff) { 00207 id = -1; 00208 } 00209 } else { 00210 id = -1; 00211 } 00212 00213 /* 00214 * Disabled controls and static controls won't pass this 00215 * on to their parent, so instead, we send the message to 00216 * their parent. 00217 */ 00218 00219 if (TestWF(pwndControl, WFDISABLED)) { 00220 PWND pwndParent = _GetParent(pwndControl); 00221 if (!pwndParent) 00222 { 00223 ThreadUnlock( &tlpwndControl ); 00224 ThreadUnlock( &tlpwndChild ); 00225 return; 00226 } 00227 pwndSend = pwndParent; 00228 } else { 00229 pwndSend = pwndControl; 00230 } 00231 00232 ThreadLockAlways(pwndSend, &tlpwndSend); 00233 xxxSendHelpMessage( pwndSend, HELPINFO_WINDOW, id, 00234 (HANDLE)HWq(pwndControl), GetContextHelpId(pwndControl)); 00235 ThreadUnlock(&tlpwndSend); 00236 ThreadUnlock(&tlpwndControl); 00237 ThreadUnlock(&tlpwndChild); 00238 return; 00239 } 00240 ThreadUnlock(&tlpwndChild); 00241 break; 00242 00243 } 00244 else if ((msg.message == WM_RBUTTONDOWN) || 00245 (msg.message == WM_MBUTTONDOWN) || 00246 (msg.message == WM_XBUTTONDOWN)) { 00247 /* 00248 * fix bug 29852; break the loop for right and middle buttons 00249 * and pass along the messages to the control 00250 */ 00251 break; 00252 } 00253 else if (msg.message == WM_MOUSEMOVE) { 00254 if (PtInRect(&rc, msg.pt)) 00255 zzzSetCursor(SYSCUR(HELP)); 00256 else 00257 zzzSetCursor(SYSCUR(ARROW)); 00258 } 00259 else if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) 00260 { 00261 xxxGetMessage( &msg, NULL, 0, 0 ); 00262 break; 00263 } 00264 00265 xxxGetMessage(&msg, NULL, 0, 0); 00266 xxxTranslateMessage(&msg, 0); 00267 xxxDispatchMessage(&msg); 00268 } 00269 00270 xxxReleaseCapture(); 00271 zzzSetCursor(SYSCUR(ARROW)); 00272 xxxRedrawTitle(pwnd, DC_BUTTONS); 00273 00274 ClrWF(pwnd, WFHELPBUTTONDOWN); 00275 if (FWINABLE()) { 00276 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR, 00277 INDEX_TITLEBAR_HELPBUTTON, 0); 00278 00279 xxxWindowEvent(EVENT_SYSTEM_CONTEXTHELPEND, pwnd, OBJID_WINDOW, 00280 INDEXID_CONTAINER, 0); 00281 } 00282 }

BOOL xxxHiliteMenuItem PWND  pwnd,
PMENU  pmenu,
UINT  cmd,
UINT  flags
 

Definition at line 117 of file mnaccel.c.

References BOOL, MFISPOPUP, NULL, TestMF, TRUE, UINT, UT_FindTopLevelMenuIndex(), xxxMNInvertItem(), and xxxMNRecomputeBarIfNeeded().

Referenced by NtUserHiliteMenuItem().

00122 { 00123 00124 if (!(flags & MF_BYPOSITION)) 00125 cmd = (UINT)UT_FindTopLevelMenuIndex(pMenu, cmd); 00126 00127 if (!TestMF(pMenu, MFISPOPUP)) 00128 xxxMNRecomputeBarIfNeeded(pwnd, pMenu); 00129 00130 xxxMNInvertItem(NULL, pMenu, cmd, pwnd, (flags & MF_HILITE)); 00131 00132 return TRUE; 00133 }

LRESULT xxxHkCallHook PHOOK  phk,
int  nCode,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 28 of file srvhook.c.

References tagSERVERINFO::apfnClientA, tagSERVERINFO::apfnClientW, BOOL, _CLIENTINFO::CI_flags, CI_INTERTHREAD_HOOK, DbgValidateHooks, dwFlags, _CLIENTINFO::dwHookData, FALSE, tagHOOK::flags, fnHkINDWORD(), fnHkINLPCBTACTIVATESTRUCT(), fnHkINLPCBTCREATESTRUCT(), fnHkINLPDEBUGHOOKSTRUCT(), fnHkINLPKBDLLHOOKSTRUCT(), fnHkINLPMOUSEHOOKSTRUCTEX(), fnHkINLPMSG(), fnHkINLPMSLLHOOKSTRUCT(), fnHkINLPRECT(), fnHkOPTINLPEVENTMSG(), GetClientInfo, GETPTI, gpsi, gptiRit, HF_ANSI, HF_NEEDHC_SKIP, HF_WX86KNOWNDLL, tagHOOK::iHook, _CWPRETSTRUCTEX::lResult, NT_SUCCESS, NTSTATUS(), NULL, tagHOOK::offPfn, PCWPRETSTRUCTEX, PCWPSTRUCTEX, _PFNCLIENT::pfnDispatchHook, _PFNCLIENT::pfnHkINLPCWPRETSTRUCT, _PFNCLIENT::pfnHkINLPCWPSTRUCT, PFNHOOK, PPFNCLIENT, PpiCurrent, PsGetCurrentThread, _CWPRETSTRUCTEX::psmsSender, _CWPSTRUCTEX::psmsSender, PtiCurrent, PtoHq, PW, SCMS_FLAGS_ANSI, SCMS_FLAGS_INONLY, ScSendMessageSMS, SMF_REPLY, SMF_SENDERDIED, Status, ThreadLockSFWLockCount, ThreadUnlockSFWLockCount, TRUE, and UINT.

Referenced by xxxCallHook2().

00033 { 00034 LRESULT nRet; 00035 PROC pfnHk, pfnHookProc; 00036 PPFNCLIENT ppfnClient; 00037 PCWPSTRUCTEX pcwp; 00038 PCWPRETSTRUCTEX pcwpret; 00039 PCLIENTINFO pci; 00040 ULONG_PTR dwHookData; 00041 ULONG_PTR dwFlags; 00042 struct tagSMS *psms; 00043 TL tlSFWLock; 00044 BOOL fLockForeground; 00045 00046 DbgValidateHooks(phk, phk->iHook); 00047 /* 00048 * Only low level hooks are allowed in the RIT context. 00049 * Also asssert that the hook is not destroyed 00050 */ 00051 #ifdef REDIRECTION 00052 UserAssert((PtiCurrent() != gptiRit) 00053 || (phk->iHook == WH_MOUSE_LL) 00054 || (phk->iHook == WH_KEYBOARD_LL) 00055 || (phk->iHook == WH_HITTEST)); 00056 #else 00057 UserAssert((PtiCurrent() != gptiRit) 00058 || (phk->iHook == WH_MOUSE_LL) 00059 || (phk->iHook == WH_KEYBOARD_LL)); 00060 #endif // REDIRECTION 00061 00062 /* 00063 * While we're still inside the critical section make sure the 00064 * hook hasn't been 'freed'. If so just return 0. 00065 */ 00066 if (phk->offPfn != 0) { 00067 pfnHookProc = PFNHOOK(phk); 00068 } else { 00069 return 0; 00070 } 00071 00072 #ifdef WX86 00073 00074 00075 /* 00076 * If the HookProc is x86 image, signal the client 00077 * dispatch code to use a risc thunk. 00078 */ 00079 00080 if (phk->flags & HF_WX86KNOWNDLL) { 00081 (ULONG_PTR)pfnHookProc |= 0x80000000; 00082 } 00083 00084 00085 #endif 00086 00087 ppfnClient = (phk->flags & HF_ANSI) ? &gpsi->apfnClientA : 00088 &gpsi->apfnClientW; 00089 00090 /* 00091 * LATER5.0 GerardoB. This might generate some hate reactions but I'm 00092 * not sure we want people hooking just to steal the foreground. 00093 * Prevent hookprocs from other processes from switching the foreground 00094 */ 00095 fLockForeground = (GETPTI(phk)->ppi != PpiCurrent()); 00096 if (fLockForeground) { 00097 ThreadLockSFWLockCount(&tlSFWLock); 00098 } 00099 00100 00101 switch(phk->iHook) { 00102 case WH_CALLWNDPROC: 00103 case WH_CALLWNDPROCRET: 00104 if (phk->iHook == WH_CALLWNDPROC) { 00105 pcwp = (PCWPSTRUCTEX)lParam; 00106 psms = pcwp->psmsSender; 00107 } else { 00108 pcwpret = (PCWPRETSTRUCTEX)lParam; 00109 psms = pcwpret->psmsSender; 00110 } 00111 00112 /* 00113 * If the sender has died or timed out, don't call the 00114 * hook because any memory the message points to may be invalid. 00115 */ 00116 if (psms != NULL && (psms->flags & (SMF_SENDERDIED | SMF_REPLY))) { 00117 nRet = 0; 00118 break; 00119 } 00120 00121 /* 00122 * This is the hardest of the hooks because we need to thunk through 00123 * the message hooks in order to deal with synchronously sent messages 00124 * that point to structures - to get the structures passed across 00125 * alright, etc. 00126 * 00127 * This will call a special client-side routine that'll rebundle the 00128 * arguments and call the hook in the right format. 00129 * 00130 * Currently, the message thunk callbacks to the client-side don't take 00131 * enough parameters to pass wParam (which == fInterThread send msg). 00132 * To do this, call one of two functions. 00133 */ 00134 pci = GetClientInfo(); 00135 if (phk->iHook == WH_CALLWNDPROC) { 00136 pfnHk = ppfnClient->pfnHkINLPCWPSTRUCT; 00137 } else { 00138 pfnHk = ppfnClient->pfnHkINLPCWPRETSTRUCT; 00139 pci->dwHookData = pcwpret->lResult; 00140 } 00141 00142 /* 00143 * Save current hook state. 00144 */ 00145 dwFlags = pci->CI_flags & CI_INTERTHREAD_HOOK; 00146 dwHookData = pci->dwHookData; 00147 00148 if (wParam) { 00149 pci->CI_flags |= CI_INTERTHREAD_HOOK; 00150 } else { 00151 pci->CI_flags &= ~CI_INTERTHREAD_HOOK; 00152 } 00153 00154 if (phk->iHook == WH_CALLWNDPROC) { 00155 nRet = ScSendMessageSMS( 00156 PW(pcwp->hwnd), 00157 pcwp->message, 00158 pcwp->wParam, 00159 pcwp->lParam, 00160 (ULONG_PTR)pfnHookProc, pfnHk, 00161 (phk->flags & HF_ANSI) ? 00162 (SCMS_FLAGS_ANSI|SCMS_FLAGS_INONLY) : 00163 SCMS_FLAGS_INONLY, 00164 psms); 00165 } else { 00166 nRet = ScSendMessageSMS( 00167 PW(pcwpret->hwnd), 00168 pcwpret->message, 00169 pcwpret->wParam, 00170 pcwpret->lParam, 00171 (ULONG_PTR)pfnHookProc, pfnHk, 00172 (phk->flags & HF_ANSI) ? 00173 (SCMS_FLAGS_ANSI|SCMS_FLAGS_INONLY) : 00174 SCMS_FLAGS_INONLY, 00175 psms); 00176 } 00177 /* 00178 * Restore previous hook state. 00179 */ 00180 pci->CI_flags ^= ((pci->CI_flags ^ dwFlags) & CI_INTERTHREAD_HOOK); 00181 pci->dwHookData = dwHookData; 00182 break; 00183 case WH_CBT: 00184 /* 00185 * There are many different types of CBT hooks! 00186 */ 00187 switch(nCode) { 00188 case HCBT_CLICKSKIPPED: 00189 goto MouseHook; 00190 break; 00191 00192 case HCBT_CREATEWND: 00193 /* 00194 * This hook type points to a CREATESTRUCT, so we need to 00195 * be fancy with it's thunking, because a CREATESTRUCT contains 00196 * a pointer to CREATEPARAMS which can be anything... so 00197 * funnel this through our message thunks. 00198 */ 00199 nRet = fnHkINLPCBTCREATESTRUCT( 00200 MAKELONG((WORD)nCode, (WORD)phk->iHook), 00201 wParam, 00202 (LPCBT_CREATEWND)lParam, 00203 pfnHookProc, 00204 (phk->flags & HF_ANSI) ? TRUE : FALSE); 00205 break; 00206 00207 #ifdef REDIRECTION 00208 case HCBT_GETCURSORPOS: 00209 00210 /* 00211 * This hook type points to a POINT structure, so it's pretty 00212 * simple. 00213 */ 00214 nRet = fnHkINLPPOINT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00215 wParam, (LPPOINT)lParam, (ULONG_PTR)pfnHookProc, 00216 ppfnClient->pfnDispatchHook); 00217 break; 00218 #endif // REDIRECTION 00219 00220 case HCBT_MOVESIZE: 00221 00222 /* 00223 * This hook type points to a RECT structure, so it's pretty 00224 * simple. 00225 */ 00226 nRet = fnHkINLPRECT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00227 wParam, (LPRECT)lParam, (ULONG_PTR)pfnHookProc, 00228 ppfnClient->pfnDispatchHook); 00229 break; 00230 00231 case HCBT_ACTIVATE: 00232 /* 00233 * This hook type points to a CBTACTIVATESTRUCT 00234 */ 00235 nRet = fnHkINLPCBTACTIVATESTRUCT(MAKELONG((UINT)nCode, 00236 (UINT)phk->iHook), wParam, (LPCBTACTIVATESTRUCT)lParam, 00237 (ULONG_PTR)pfnHookProc, ppfnClient->pfnDispatchHook); 00238 break; 00239 00240 default: 00241 00242 /* 00243 * The rest of the cbt hooks are all dword parameters. 00244 */ 00245 nRet = fnHkINDWORD(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00246 wParam, lParam, (ULONG_PTR)pfnHookProc, 00247 ppfnClient->pfnDispatchHook, &phk->flags); 00248 break; 00249 } 00250 break; 00251 00252 case WH_FOREGROUNDIDLE: 00253 /* 00254 * These are dword parameters and are therefore real easy. 00255 * 00256 */ 00257 nRet = fnHkINDWORD(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00258 wParam, lParam, (ULONG_PTR)pfnHookProc, 00259 ppfnClient->pfnDispatchHook, &phk->flags); 00260 break; 00261 00262 case WH_SHELL: 00263 00264 if (nCode == HSHELL_GETMINRECT) { 00265 /* 00266 * This hook type points to a RECT structure, so it's pretty 00267 * simple. 00268 */ 00269 nRet = fnHkINLPRECT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00270 wParam, (LPRECT)lParam, (ULONG_PTR)pfnHookProc, 00271 ppfnClient->pfnDispatchHook); 00272 break; 00273 } 00274 00275 /* 00276 * Otherwise fall through to the simple case of DWORD below 00277 */ 00278 00279 case WH_KEYBOARD: 00280 /* 00281 * These are dword parameters and are therefore real easy. 00282 */ 00283 nRet = fnHkINDWORD(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00284 wParam, lParam, (ULONG_PTR)pfnHookProc, 00285 ppfnClient->pfnDispatchHook, &phk->flags); 00286 break; 00287 00288 case WH_MSGFILTER: 00289 case WH_SYSMSGFILTER: 00290 case WH_GETMESSAGE: 00291 /* 00292 * These take an lpMsg as their last parameter. Since these are 00293 * exclusively posted parameters, and since nowhere on the server 00294 * do we post a message with a pointer to some other structure in 00295 * it, the lpMsg structure contents can all be treated verbatim. 00296 */ 00297 nRet = fnHkINLPMSG(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00298 wParam, (LPMSG)lParam, (ULONG_PTR)pfnHookProc, 00299 ppfnClient->pfnDispatchHook, 00300 (phk->flags & HF_ANSI) ? TRUE : FALSE, &phk->flags); 00301 break; 00302 00303 case WH_JOURNALPLAYBACK: 00304 00305 #ifdef HOOKBATCH 00306 /* 00307 * If this hook has cached playback info then we need to grab 00308 * the info out of the cache. 00309 */ 00310 00311 if (phk->cEventMessages) { 00312 if (nCode == HC_GETNEXT) { 00313 LPEVENTMSG pEventMsg; 00314 pEventMsg = (LPEVENTMSG)lParam; 00315 00316 if (phk->flags & HF_NEEDHC_SKIP) 00317 phk->iCurrentEvent++; 00318 00319 if (phk->iCurrentEvent < phk->cEventMessages) { 00320 *pEventMsg = phk->aEventCache[phk->iCurrentEvent]; 00321 } else { 00322 00323 /* 00324 * Free the cache set if it is still around 00325 */ 00326 if (phk->aEventCache) { 00327 UserFreePool(phk->aEventCache); 00328 phk->aEventCache = NULL; 00329 } 00330 phk->cEventMessages = 0; 00331 phk->iCurrentEvent = 0; 00332 00333 goto MakeClientJournalPlaybackCall; 00334 } 00335 00336 /* 00337 * Return the time and zero the batched time so if we sleep 00338 * this time we won't sleep again next time 00339 */ 00340 nRet = pEventMsg->time; 00341 if (nRet) 00342 phk->aEventCache[phk->iCurrentEvent].time = 0; 00343 } else if (nCode == HC_SKIP) { 00344 phk->iCurrentEvent++; 00345 nRet = 0; 00346 } 00347 00348 } else { 00349 #endif // HOOKBATCH 00350 /* 00351 * In order to avoid a client/server transition for HC_SKIP we 00352 * piggy-back it on top of the next journal playback event and 00353 * send it from there. 00354 */ 00355 // MakeClientJournalPlaybackCall: 00356 nRet = fnHkOPTINLPEVENTMSG(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00357 (WPARAM)PtoHq(phk), (LPEVENTMSG)lParam, (ULONG_PTR)pfnHookProc, 00358 ppfnClient->pfnDispatchHook); 00359 #ifdef HOOKBATCH 00360 } 00361 00362 /* 00363 * Determine if we received a cached set of events if so then store 00364 * them away off of the hook. 00365 * paramL will be the number of events. 00366 * paramH will be the array of events. 00367 */ 00368 if ((nCode == HC_GETNEXT) && (((LPEVENTMSG)lParam)->message == 0x12341234)) { 00369 NTSTATUS Status; 00370 LPEVENTMSG pEventMsg = (LPEVENTMSG)lParam; 00371 00372 /* 00373 * We should not be getting another cached set if we aren't 00374 * done with the first set 00375 */ 00376 UserAssert((phk->cEventMessages == 0) || 00377 (phk->cEventMessages >= phk->iCurrentEvent)); 00378 UserAssert((pEventMsg->paramL < 500) && (pEventMsg->paramL > 1)); 00379 00380 /* 00381 * Free the last cache set if it is still around 00382 */ 00383 if (phk->aEventCache) { 00384 UserFreePool(phk->aEventCache); 00385 phk->aEventCache = NULL; 00386 } 00387 00388 if (phk->aEventCache = LocalAlloc(LPTR, 00389 pEventMsg->paramL*sizeof(EVENTMSG))) { 00390 PETHREAD Thread = PsGetCurrentThread(); 00391 00392 Status = ZwReadVirtualMemory(Thread->Process->ProcessHandle, 00393 (PVOID)pEventMsg->paramH, phk->aEventCache, 00394 pEventMsg->paramL*sizeof(EVENTMSG), NULL); 00395 00396 if (NT_SUCCESS(Status)) { 00397 phk->cEventMessages = pEventMsg->paramL; 00398 phk->iCurrentEvent = 0; 00399 00400 /* 00401 * Fill in the real EventMsg for this message 00402 */ 00403 *pEventMsg = phk->aEventCache[0]; 00404 phk->aEventCache[0].time = 0; 00405 } 00406 00407 } else { 00408 phk->cEventMessages = 0; 00409 phk->iCurrentEvent = 0; 00410 } 00411 } 00412 #endif // HOOKBATCH 00413 00414 phk->flags &= ~HF_NEEDHC_SKIP; 00415 break; 00416 00417 case WH_JOURNALRECORD: 00418 00419 nRet = fnHkOPTINLPEVENTMSG(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00420 wParam, (LPEVENTMSG)lParam, (ULONG_PTR)pfnHookProc, 00421 ppfnClient->pfnDispatchHook); 00422 break; 00423 00424 case WH_DEBUG: 00425 /* 00426 * This takes an lpDebugHookStruct. 00427 */ 00428 nRet = fnHkINLPDEBUGHOOKSTRUCT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00429 wParam, (LPDEBUGHOOKINFO)lParam, (ULONG_PTR)pfnHookProc, 00430 ppfnClient->pfnDispatchHook); 00431 break; 00432 00433 case WH_KEYBOARD_LL: 00434 /* 00435 * This takes an lpKbdHookStruct. 00436 */ 00437 nRet = fnHkINLPKBDLLHOOKSTRUCT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00438 wParam, (LPKBDLLHOOKSTRUCT)lParam, 00439 (ULONG_PTR)pfnHookProc, ppfnClient->pfnDispatchHook); 00440 break; 00441 00442 case WH_MOUSE_LL: 00443 /* 00444 * This takes an lpMsllHookStruct. 00445 */ 00446 nRet = fnHkINLPMSLLHOOKSTRUCT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00447 wParam, (LPMSLLHOOKSTRUCT)lParam, 00448 (ULONG_PTR)pfnHookProc, ppfnClient->pfnDispatchHook); 00449 break; 00450 00451 case WH_MOUSE: 00452 /* 00453 * This takes an lpMouseHookStructEx. 00454 */ 00455 MouseHook: 00456 nRet = fnHkINLPMOUSEHOOKSTRUCTEX(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00457 wParam, (LPMOUSEHOOKSTRUCTEX)lParam, 00458 (ULONG_PTR)pfnHookProc, ppfnClient->pfnDispatchHook, &phk->flags); 00459 break; 00460 00461 #ifdef REDIRECTION 00462 case WH_HITTEST: 00463 /* 00464 * This takes an lpHTHookStruct. 00465 */ 00466 nRet = fnHkINLPHTHOOKSTRUCT(MAKELONG((UINT)nCode, (UINT)phk->iHook), 00467 wParam, (LPHTHOOKSTRUCT)lParam, 00468 (ULONG_PTR)pfnHookProc, ppfnClient->pfnDispatchHook); 00469 break; 00470 #endif // REDIRECTION 00471 00472 } 00473 00474 if (fLockForeground) { 00475 ThreadUnlockSFWLockCount(&tlSFWLock); 00476 } 00477 00478 return nRet; 00479 }

BOOL xxxHotTrack PWND  pwnd,
int  htEx,
BOOL  fDraw
 

Definition at line 836 of file tooltips.c.

References BOOL, CheckLock, FALSE, HTMDICLOSE, HTMDIMAXBUTTON, HTMDIMINBUTTON, HTMENUITEM, HTSCROLLDOWN, HTSCROLLDOWNPAGE, HTSCROLLTHUMB, HTSCROLLUP, HTSCROLLUPPAGE, xxxHotTrackMenu(), and xxxHotTrackSB().

Referenced by xxxCancelMouseMoveTracking(), and xxxTrackMouseMove().

00837 { 00838 int ht = LOWORD(htEx); 00839 00840 CheckLock(pwnd); 00841 00842 switch(ht) { 00843 #ifdef COLOR_HOTTRACKING 00844 case HTMINBUTTON: 00845 case HTMAXBUTTON: 00846 case HTHELP: 00847 case HTCLOSE: 00848 return xxxHotTrackCaption(pwnd, ht, fDraw); 00849 00850 case HTSCROLLUP: 00851 case HTSCROLLDOWN: 00852 case HTSCROLLUPPAGE: 00853 case HTSCROLLDOWNPAGE: 00854 case HTSCROLLTHUMB: 00855 return xxxHotTrackSB(pwnd, htEx, fDraw); 00856 00857 case HTMDIMINBUTTON: 00858 case HTMDIMAXBUTTON: 00859 case HTMDICLOSE: 00860 #endif // COLOR_HOTTRACKING 00861 case HTMENUITEM: 00862 return xxxHotTrackMenu(pwnd, HIWORD(htEx), fDraw); 00863 00864 } 00865 00866 return FALSE; 00867 }

VOID xxxHungAppDemon PWND  pwnd,
UINT  message,
UINT_PTR  nID,
LPARAM  lParam
 

Definition at line 446 of file hungapp.c.

References CheckLock, ClearHungFlag(), CMSHUNGAPPTIMEOUT, DWORD, FHungApp(), GETPTI, gpvwplHungRedraw, grpdeskRitInput, gtimeStartCursorHide, IdleTimerProc(), NtGetTickCount(), NULL, tagDESKTOP::pDeskInfo, tagDESKTOPINFO::spwnd, TestWF, TestwndFrameOn, ThreadLock, ThreadUnlock, VOID(), VWPLNext(), WFREDRAWFRAMEIFHUNG, WFREDRAWIFHUNG, xxxRedrawHungWindow(), xxxRedrawHungWindowFrame(), and zzzCalcStartCursorHide().

Referenced by StartTimers().

00451 { 00452 TL tlpwnd; 00453 #if DBG 00454 PWND pwndT; 00455 #endif 00456 DWORD nPwndHungRedraw; 00457 PWND pwndHungRedraw; 00458 00459 00460 00461 UNREFERENCED_PARAMETER(message); 00462 UNREFERENCED_PARAMETER(nID); 00463 00464 UNREFERENCED_PARAMETER(lParam); 00465 UNREFERENCED_PARAMETER(pwnd); 00466 CheckLock(pwnd); 00467 00468 /* 00469 * See if we should start the screen saver. 00470 */ 00471 IdleTimerProc(); 00472 00473 /* 00474 * If it is time to hide the app starting cursor, do it. 00475 */ 00476 if (NtGetTickCount() >= gtimeStartCursorHide) { 00477 /* 00478 * No need to DeferWinEventNotify() 00479 */ 00480 zzzCalcStartCursorHide(NULL, 0); 00481 } 00482 00483 /* 00484 * Now check to see if there are any top-level 00485 * windows that need redrawing. 00486 */ 00487 if (grpdeskRitInput == NULL || grpdeskRitInput->pDeskInfo->spwnd == NULL) 00488 return; 00489 00490 /* 00491 * Walk down the list of redraw-if-hung windows. Loop 00492 * until we hit the end of the array or find a NULL. 00493 */ 00494 nPwndHungRedraw = 0; 00495 pwndHungRedraw = NULL; 00496 while (pwndHungRedraw = VWPLNext(gpvwplHungRedraw, pwndHungRedraw, &nPwndHungRedraw)) { 00497 /* 00498 * See if the app is hung. If so, do the appropriate 00499 * redrawing. 00500 */ 00501 if (FHungApp(GETPTI(pwndHungRedraw), CMSHUNGAPPTIMEOUT)) { 00502 ThreadLock(pwndHungRedraw, &tlpwnd); 00503 if (TestWF(pwndHungRedraw, WFREDRAWFRAMEIFHUNG)) { 00504 00505 /* 00506 * WFREDRAWFRAMEIFHUNG will be cleared in the process 00507 * of drawing the frame, no need to clear it here. 00508 */ 00509 xxxRedrawHungWindowFrame(pwndHungRedraw, TestwndFrameOn(pwndHungRedraw)); 00510 } 00511 00512 if (TestWF(pwndHungRedraw, WFREDRAWIFHUNG)) { 00513 ClearHungFlag(pwndHungRedraw, WFREDRAWIFHUNG); 00514 xxxRedrawHungWindow(pwndHungRedraw, NULL); 00515 } 00516 #if DBG 00517 pwndT = 00518 #endif 00519 00520 ThreadUnlock(&tlpwnd); 00521 } 00522 } 00523 00524 return; 00525 }

VOID xxxImmActivateAndUnloadThreadsLayout IN PTHREADINFO ptiList,
IN UINT  nEntries,
IN PTLBLOCK  ptlBlockPrev,
PKL  pklCurrent,
DWORD  dwHklReplace
 

Definition at line 749 of file ntimm.c.

References CheckLock, tagKL::CodePage, dwFlags, DWORD, FALSE, tagKL::hkl, IFL_DEACTIVATEIME, INT, IS_IME_KBDLAYOUT, KeAttachProcess(), KeDetachProcess(), tagTLBLOCK::list, Lock, NULL, tagTHREADINFO::pClientInfo, tagTHREADINFO::ppi, PtiCurrentShared, tagTLBLOCK::ptlBlockPrev, ThreadLockPti, THREADS_PER_TLBLOCK, ThreadUnlockPti, TIF_INCLEANUP, TRUE, VOID(), xxxImmActivateLayout(), and xxxImmUnloadLayout().

Referenced by xxxSetPKLinThreads().

00755 { 00756 TLBLOCK tlBlock; 00757 PTHREADINFO ptiCurrent; 00758 int i, cThreads; 00759 enum { RUN_ACTIVATE = 1, RUN_UNLOAD = 2, RUN_FLAGS_MASK = RUN_ACTIVATE | RUN_UNLOAD, RUN_INVALID = 0xffff0000 }; 00760 00761 CheckLock(pklCurrent); 00762 00763 ptiCurrent = PtiCurrentShared(); 00764 00765 tlBlock.ptlBlockPrev = ptlBlockPrev; 00766 00767 /* 00768 * Build a list of threads that we need to unload their IME DLL(s). 00769 * We can't just walk the ptiList while we're doing the work, because 00770 * for IME based keyboard layout, we will do callback to client side 00771 * and the pti could get deleted out while we leave the critical section. 00772 */ 00773 for (i = 0, cThreads = 0; i < (INT)nEntries; i++) { 00774 DWORD dwFlags = 0; 00775 00776 /* 00777 * Skip all the *do nothing* cases in xxxImmActivateLayout 00778 * so as to minimize the # of TLBLOCKs required. 00779 */ 00780 if (ptiList[i]->TIF_flags & TIF_INCLEANUP) { 00781 dwFlags = RUN_INVALID; 00782 } 00783 else if (ptiList[i]->spklActive != pklCurrent) { 00784 if (ptiList[i]->spwndDefaultIme == NULL) { 00785 BOOLEAN fAttached = FALSE; 00786 00787 Lock(&ptiList[i]->spklActive, pklCurrent); 00788 if (ptiList[i]->pClientInfo != ptiCurrent->pClientInfo && 00789 ptiList[i]->ppi != ptiCurrent->ppi) { 00790 /* 00791 * If the thread is in another process, attach 00792 * to that process so that we can access its ClientInfo. 00793 */ 00794 KeAttachProcess(&ptiList[i]->ppi->Process->Pcb); 00795 fAttached = TRUE; 00796 } 00797 00798 try { 00799 ptiList[i]->pClientInfo->CodePage = pklCurrent->CodePage; 00800 ptiList[i]->pClientInfo->hKL = pklCurrent->hkl; 00801 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00802 dwFlags = RUN_INVALID; 00803 } 00804 if (fAttached) { 00805 KeDetachProcess(); 00806 } 00807 } else { 00808 dwFlags = RUN_ACTIVATE; 00809 } 00810 } 00811 00812 /* 00813 * Skip all the *do nothing* cases in xxxImmUnloadLayout() 00814 * so as to minimize the # of TLBLOCK required. 00815 * (#99321) 00816 */ 00817 if (ptiList[i]->spwndDefaultIme != NULL && 00818 ptiList[i]->spklActive != NULL && 00819 (dwHklReplace != IFL_DEACTIVATEIME || IS_IME_KBDLAYOUT(ptiList[i]->spklActive->hkl)) && 00820 dwFlags != RUN_INVALID) { 00821 dwFlags |= RUN_UNLOAD; 00822 } 00823 00824 if (dwFlags && dwFlags != RUN_INVALID) { 00825 ThreadLockPti(ptiCurrent, ptiList[i], &tlBlock.list[cThreads].tlpti); 00826 #if DBG 00827 tlBlock.list[cThreads].dwUnlockedCount = 0; 00828 #endif 00829 tlBlock.list[cThreads].pti = ptiList[i]; 00830 tlBlock.list[cThreads++].dwFlags = dwFlags; 00831 00832 if (cThreads == THREADS_PER_TLBLOCK) { 00833 i++; // 1 more before exit the loop. 00834 break; 00835 } 00836 } 00837 } 00838 00839 /* 00840 * If we can't service all the threads in this run, 00841 * call xxxImmActivateAndUnloadThreadsLayout again for a new TLBLOCK. 00842 */ 00843 if (i < (INT)nEntries) { 00844 ptiList += i; 00845 nEntries -= i; 00846 xxxImmActivateAndUnloadThreadsLayout(ptiList, nEntries, &tlBlock, pklCurrent, dwHklReplace); 00847 return; 00848 } 00849 00850 /* 00851 * Finally, we can do the actual keyboard layout activation 00852 * starting from this run. Work on current TLBLOCK first. 00853 * We walk the list backwards so that the pti unlocks will 00854 * be done in the right order. 00855 */ 00856 i = cThreads - 1; 00857 for (ptlBlockPrev = &tlBlock; ptlBlockPrev != NULL; ptlBlockPrev = ptlBlockPrev->ptlBlockPrev) { 00858 for ( ; i >= 0; i--) { 00859 if ((ptlBlockPrev->list[i].dwFlags & RUN_ACTIVATE) && 00860 !(ptlBlockPrev->list[i].pti->TIF_flags & TIF_INCLEANUP)) { 00861 xxxImmActivateLayout(ptlBlockPrev->list[i].pti, pklCurrent); 00862 } 00863 00864 // unlock the thread if the thread is only locked for the first run 00865 if ((ptlBlockPrev->list[i].dwFlags & RUN_FLAGS_MASK) == RUN_ACTIVATE) { 00866 ThreadUnlockPti(ptiCurrent, &ptlBlockPrev->list[i].tlpti); 00867 #if DBG 00868 ptlBlockPrev->list[i].dwUnlockedCount++; 00869 #endif 00870 } 00871 } 00872 i = THREADS_PER_TLBLOCK - 1; 00873 } 00874 00875 i = cThreads - 1; 00876 for (ptlBlockPrev = &tlBlock; ptlBlockPrev != NULL; ptlBlockPrev = ptlBlockPrev->ptlBlockPrev) { 00877 for ( ; i >= 0; --i) { 00878 if (ptlBlockPrev->list[i].dwFlags & RUN_UNLOAD) { 00879 if (!(ptlBlockPrev->list[i].pti->TIF_flags & TIF_INCLEANUP)) { 00880 xxxImmUnloadLayout(ptlBlockPrev->list[i].pti, dwHklReplace); 00881 } 00882 else { 00883 RIPMSG1(RIP_WARNING, "xxxImmActivateAndUnloadThreadsLayout: thread %#p is cleaned up.", 00884 ptlBlockPrev->list[i].pti); 00885 } 00886 // unlock the thread 00887 UserAssert((ptlBlockPrev->list[i].dwFlags & RUN_FLAGS_MASK) != RUN_ACTIVATE); 00888 UserAssert(ptlBlockPrev->list[i].dwUnlockedCount == 0); 00889 ThreadUnlockPti(ptiCurrent, &ptlBlockPrev->list[i].tlpti); 00890 #if DBG 00891 ptlBlockPrev->list[i].dwUnlockedCount++; 00892 #endif 00893 } 00894 } 00895 i = THREADS_PER_TLBLOCK - 1; 00896 } 00897 00898 #if DBG 00899 // Check if all the locked thread is properly unlocked 00900 i = cThreads - 1; 00901 for (ptlBlockPrev = &tlBlock; ptlBlockPrev; ptlBlockPrev = ptlBlockPrev->ptlBlockPrev) { 00902 for ( ; i >= 0; --i) { 00903 UserAssert(ptlBlockPrev->list[i].dwUnlockedCount == 1); 00904 } 00905 i = THREADS_PER_TLBLOCK - 1; 00906 } 00907 #endif 00908 00909 return; 00910 }

VOID xxxImmActivateLayout IN PTHREADINFO  pti,
IN PKL  pkl
 

Definition at line 921 of file ntimm.c.

References CheckLock, Lock, NULL, PtiCurrentShared, tagTHREADINFO::spwndDefaultIme, ThreadLockAlwaysWithPti, ThreadUnlock, VOID(), and xxxSendMessage().

Referenced by xxxImmActivateAndUnloadThreadsLayout(), xxxImmActivateThreadsLayout(), and xxxInternalActivateKeyboardLayout().

00924 { 00925 TL tlpwndDefaultIme; 00926 PTHREADINFO ptiCurrent; 00927 00928 CheckLock(pkl); 00929 00930 /* 00931 * Do nothing if it's already been the current active layout. 00932 */ 00933 if (pti->spklActive == pkl) 00934 return; 00935 00936 if (pti->spwndDefaultIme == NULL) { 00937 /* 00938 * Only activate kernel side keyboard layout if this pti 00939 * doesn't have the default IME window. 00940 */ 00941 Lock(&pti->spklActive, pkl); 00942 return; 00943 } 00944 00945 ptiCurrent = PtiCurrentShared(); 00946 00947 /* 00948 * Activate client side IME based keyboard layout. 00949 */ 00950 ThreadLockAlwaysWithPti(ptiCurrent, pti->spwndDefaultIme, &tlpwndDefaultIme); 00951 xxxSendMessage(pti->spwndDefaultIme, WM_IME_SYSTEM, 00952 (WPARAM)IMS_ACTIVATETHREADLAYOUT, (LPARAM)pkl->hkl); 00953 ThreadUnlock(&tlpwndDefaultIme); 00954 00955 Lock(&pti->spklActive, pkl); 00956 00957 return; 00958 }

BOOL xxxImmActivateThreadsLayout PTHREADINFO  pti,
PTLBLOCK  ptlBlockPrev,
PKL  pkl
 

Definition at line 646 of file ntimm.c.

References BOOL, CheckLock, _CLIENTINFO::CI_flags, CI_INPUTCONTEXT_REINIT, tagKL::CodePage, _CLIENTINFO::CodePage, FALSE, _CLIENTINFO::hKL, tagKL::hkl, tagTHREADINFO::hklPrev, INT, tagTLBLOCK::list, Lock, NULL, tagTHREADINFO::pClientInfo, tagTHREADINFO::ppi, PpiCurrent, PtiCurrentShared, tagTHREADINFO::ptiSibling, PTLBLOCK, tagTLBLOCK::ptlBlockPrev, tagTHREADINFO::spDefaultImc, tagTHREADINFO::spklActive, tagTHREADINFO::spwndDefaultIme, ThreadLockPti, THREADS_PER_TLBLOCK, ThreadUnlockPti, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TLBLOCK, TRUE, UINT, and xxxImmActivateLayout().

Referenced by xxxInternalActivateKeyboardLayout().

00650 { 00651 TLBLOCK tlBlock; 00652 PTHREADINFO ptiCurrent, ptiT; 00653 UINT cThreads = 0; 00654 INT i; 00655 00656 CheckLock(pkl); 00657 00658 ptiCurrent = PtiCurrentShared(); 00659 00660 /* 00661 * Build a list of threads that we need to update their active layouts. 00662 * We can't just walk the ptiT list while we're doing the work, because 00663 * for IME based keyboard layout, we will do callback to client side 00664 * and the ptiT could get deleted out while we leave the critical section. 00665 */ 00666 for (ptiT = pti; ptiT != NULL; ptiT = ptiT->ptiSibling) { 00667 /* 00668 * Skip all the *do nothing* cases in xxxImmActivateLayout 00669 * so as to minimize the # of TLBLOCK required. 00670 */ 00671 if (ptiT->spklActive == pkl || (ptiT->TIF_flags & TIF_INCLEANUP)) 00672 continue; 00673 00674 UserAssert(ptiT->pClientInfo != NULL); 00675 UserAssert(ptiT->ppi == PpiCurrent()); // can't access pClientInfo of other process 00676 00677 if (ptiT->spwndDefaultIme == NULL) { 00678 /* 00679 * Keyboard layout is being switched but there's no way to callback 00680 * the client side to activate&initialize input context now. 00681 * Let's do hkl switching only in the kernel side for this thread 00682 * but remember the input context needs to be re-initialized 00683 * when this GUI thread recreates the default IME window later. 00684 */ 00685 ptiT->hklPrev = ptiT->spklActive->hkl; 00686 Lock(&ptiT->spklActive, pkl); 00687 if (ptiT->spDefaultImc) { 00688 ptiT->pClientInfo->CI_flags |= CI_INPUTCONTEXT_REINIT; 00689 RIPMSG1(RIP_VERBOSE, "xxxImmActivateThreadsLayout: ptiT(%08p) will be re-initialized.", ptiT); 00690 } 00691 UserAssert((ptiT->TIF_flags & TIF_INCLEANUP) == 0); 00692 ptiT->pClientInfo->hKL = pkl->hkl; 00693 ptiT->pClientInfo->CodePage = pkl->CodePage; 00694 continue; 00695 } 00696 00697 ThreadLockPti(ptiCurrent, ptiT, &tlBlock.list[cThreads].tlpti); 00698 tlBlock.list[cThreads++].pti = ptiT; 00699 00700 if (cThreads == THREADS_PER_TLBLOCK) 00701 break; 00702 } 00703 00704 /* 00705 * Return FALSE if all the threads already had the pkl active. 00706 */ 00707 if (ptlBlockPrev == NULL && ptiT == NULL && cThreads == 0) 00708 return FALSE; 00709 00710 /* 00711 * If we can't service all the threads in this run, 00712 * call ImmActivateThreadsLayout() again for a new TLBLOCK. 00713 */ 00714 if (ptiT != NULL && ptiT->ptiSibling != NULL) { 00715 tlBlock.ptlBlockPrev = ptlBlockPrev; 00716 return xxxImmActivateThreadsLayout(ptiT->ptiSibling, &tlBlock, pkl); 00717 } 00718 00719 /* 00720 * Finally, we can do the actual keyboard layout activation 00721 * starting from this run. Work on current TLBLOCK first. 00722 * We walk the list backwards so that the pti unlocks will 00723 * be done in the right order. 00724 */ 00725 00726 tlBlock.ptlBlockPrev = ptlBlockPrev; 00727 ptlBlockPrev = &tlBlock; 00728 00729 while (ptlBlockPrev != NULL) { 00730 for (i = cThreads - 1; i >= 0; --i) { 00731 if ((ptlBlockPrev->list[i].pti->TIF_flags & TIF_INCLEANUP) == 0) { 00732 ptiT = ptlBlockPrev->list[i].pti; 00733 UserAssert(ptiT); 00734 xxxImmActivateLayout(ptiT, pkl); 00735 if ((ptiT->TIF_flags & TIF_INCLEANUP) == 0) { 00736 ptiT->pClientInfo->hKL = pkl->hkl; 00737 ptiT->pClientInfo->CodePage = pkl->CodePage; 00738 } 00739 } 00740 ThreadUnlockPti(ptiCurrent, &ptlBlockPrev->list[i].tlpti); 00741 } 00742 ptlBlockPrev = ptlBlockPrev->ptlBlockPrev; 00743 cThreads = THREADS_PER_TLBLOCK; 00744 } 00745 00746 return TRUE; 00747 }

PIMEINFOEX xxxImmLoadLayout IN HKL  hKL  ) 
 

Definition at line 1118 of file ntimm.c.

References ClientImmLoadLayout(), IS_IME_KBDLAYOUT, NULL, PtiCurrent, ThreadLockPool, ThreadUnlockAndFreePool, and ThreadUnlockPool.

Referenced by xxxLoadKeyboardLayoutEx().

01120 { 01121 PIMEINFOEX piiex; 01122 PTHREADINFO ptiCurrent; 01123 TL tlPool; 01124 01125 /* 01126 * No IMEINFOEX for non-IME based keyboard layout. 01127 */ 01128 if (!IS_IME_KBDLAYOUT(hKL)) 01129 return (PIMEINFOEX)NULL; 01130 01131 piiex = (PIMEINFOEX)UserAllocPool(sizeof(IMEINFOEX), TAG_IME); 01132 01133 if (piiex == NULL) { 01134 RIPMSG1(RIP_WARNING, 01135 "xxxImmLoadLayout: failed to create piiex for hkl = %lx", hKL); 01136 return (PIMEINFOEX)NULL; 01137 } 01138 01139 ptiCurrent = PtiCurrent(); 01140 01141 /* 01142 * Lock this allocations since we are going to the client side 01143 */ 01144 ThreadLockPool(ptiCurrent, piiex, &tlPool); 01145 01146 if (!ClientImmLoadLayout(hKL, piiex)) { 01147 ThreadUnlockAndFreePool(ptiCurrent, &tlPool); 01148 return (PIMEINFOEX)NULL; 01149 } 01150 01151 ThreadUnlockPool(ptiCurrent, &tlPool); 01152 01153 return piiex; 01154 }

DWORD xxxImmProcessKey IN PQ  pq,
IN PWND  pwnd,
IN UINT  message,
IN WPARAM  wParam,
IN LPARAM  lParam
 

Definition at line 1286 of file ntimm.c.

References _PostMessage(), BOOL, CheckImeHotKey(), CheckLock, ClientImmProcessKey(), tagKL::dwFontSigs, _tagIMEHOTKEY::dwHotKeyID, DWORD, FALSE, GetAppImeCompatFlags(), GETPTI, gSystemFS, _tagIMEHOTKEYOBJ::hk, tagKL::hkl, _tagIMEHOTKEY::hKL, HtoP, tagIMEINFOEX::ImeInfo, IPHK_HOTKEY, IS_IME_ENABLED, NULL, tagKL::piiex, PtiCurrent, PtoH, and UINT.

Referenced by xxxScanSysQueue().

01292 { 01293 UINT uVKey; 01294 PKL pkl; 01295 DWORD dwHotKeyID; 01296 DWORD dwReturn = 0; 01297 PIMC pImc = NULL; 01298 BOOL fDBERoman = FALSE; 01299 PIMEHOTKEYOBJ pImeHotKeyObj; 01300 HKL hklTarget; 01301 01302 CheckLock(pwnd); 01303 01304 // 01305 // we're interested in only keyboard messages. 01306 // 01307 if ( message != WM_KEYDOWN && 01308 message != WM_SYSKEYDOWN && 01309 message != WM_KEYUP && 01310 message != WM_SYSKEYUP ) { 01311 01312 return dwReturn; 01313 } 01314 01315 // 01316 // Check if it's IME hotkey. This must be done before checking 01317 // the keyboard layout because IME hotkey handler should be 01318 // called even if current keyboard layout is non-IME layout. 01319 // 01320 pkl = GETPTI(pwnd)->spklActive; 01321 if ( pkl == NULL ) { 01322 return dwReturn; 01323 } 01324 01325 uVKey = (UINT)wParam & 0xff; 01326 01327 pImeHotKeyObj = CheckImeHotKey(pq, uVKey, lParam); 01328 if (pImeHotKeyObj) { 01329 dwHotKeyID = pImeHotKeyObj->hk.dwHotKeyID; 01330 hklTarget = pImeHotKeyObj->hk.hKL; 01331 } 01332 else { 01333 dwHotKeyID = IME_INVALID_HOTKEY; 01334 hklTarget = (HKL)NULL; 01335 } 01336 01337 // 01338 // Handle Direct KL switching here. 01339 // 01340 if (dwHotKeyID >= IME_HOTKEY_DSWITCH_FIRST && dwHotKeyID <= IME_HOTKEY_DSWITCH_LAST) { 01341 UserAssert(hklTarget != NULL); 01342 if (pkl->hkl != hklTarget) { 01343 // 01344 // Post the message only if the new Keyboard Layout is different from 01345 // the current Keyboard Layout. 01346 // 01347 _PostMessage(pwnd, WM_INPUTLANGCHANGEREQUEST, 01348 (pkl->dwFontSigs & gSystemFS) ? INPUTLANGCHANGE_SYSCHARSET : 0, 01349 (LPARAM)hklTarget); 01350 } 01351 if (GetAppImeCompatFlags(GETPTI(pwnd)) & IMECOMPAT_HYDRACLIENT) { 01352 return 0; 01353 } 01354 return IPHK_HOTKEY; 01355 } 01356 01357 if (!IS_IME_ENABLED()) { 01358 // 01359 // Since IMM is disabled, no need to process further. 01360 // Just bail out. 01361 // 01362 return 0; 01363 } 01364 01365 if ( dwHotKeyID != IME_INVALID_HOTKEY ) { 01366 // 01367 // if it's a valid hotkey, go straight and call back 01368 // the IME in the client side. 01369 // 01370 goto ProcessKeyCallClient; 01371 } 01372 01373 // 01374 // if it's not a hotkey, we may want to check something 01375 // before calling back. 01376 // 01377 if ( pkl->piiex == NULL ) { 01378 return dwReturn; 01379 } 01380 01381 // 01382 // Check input context 01383 // 01384 pImc = HtoP(pwnd->hImc); 01385 if ( pImc == NULL ) { 01386 return dwReturn; 01387 } 01388 01389 #ifdef LATER 01390 // 01391 // If there is an easy way to check the input context open/close status 01392 // from the kernel side, IME_PROP_NO_KEYS_ON_CLOSE checking should be 01393 // done here in kernel side. [ 3/10/96 takaok] 01394 // 01395 01396 // 01397 // Check IME_PROP_NO_KEYS_ON_CLOSE bit 01398 // 01399 // if the current imc is not open and IME doesn't need 01400 // keys when being closed, we don't pass any keyboard 01401 // input to ime except hotkey and keys that change 01402 // the keyboard status. 01403 // 01404 if ( (piix->ImeInfo.fdwProperty & IME_PROP_NO_KEYS_ON_CLOSE) && 01405 (!pimc->fdwState & IMC_OPEN) && 01406 uVKey != VK_SHIFT && // 0x10 01407 uVKey != VK_CONTROL && // 0x11 01408 uVKey != VK_CAPITAL && // 0x14 01409 uVKey != VK_KANA && // 0x15 01410 uVKey != VK_NUMLOCK && // 0x90 01411 uVKey != VK_SCROLL ) // 0x91 01412 { 01413 // Check if Korea Hanja conversion mode 01414 if( !(pimc->fdwConvMode & IME_CMODE_HANJACONVERT) ) { 01415 return dwReturn; 01416 } 01417 } 01418 #endif 01419 01420 // 01421 // if the IME doesn't need key up messages, we don't call ime. 01422 // 01423 if ( lParam & 0x80000000 && // set if key up, clear if key down 01424 pkl->piiex->ImeInfo.fdwProperty & IME_PROP_IGNORE_UPKEYS ) 01425 { 01426 return dwReturn; 01427 } 01428 01429 // 01430 // we don't want to handle sys keys since many functions for 01431 // acceelerators won't work without this 01432 // 01433 fDBERoman = (BOOL)( (uVKey == VK_DBE_ROMAN) || 01434 (uVKey == VK_DBE_NOROMAN) || 01435 (uVKey == VK_DBE_HIRAGANA) || 01436 (uVKey == VK_DBE_KATAKANA) || 01437 (uVKey == VK_DBE_CODEINPUT) || 01438 (uVKey == VK_DBE_NOCODEINPUT) || 01439 (uVKey == VK_DBE_IME_WORDREGISTER) || 01440 (uVKey == VK_DBE_IME_DIALOG) ); 01441 01442 if (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP ) { 01443 // 01444 // IME may be waiting for VK_MENU, VK_F10 or VK_DBE_xxx 01445 // 01446 if ( uVKey != VK_MENU && uVKey != VK_F10 && !fDBERoman ) { 01447 return dwReturn; 01448 } 01449 } 01450 01451 // 01452 // check if the IME doesn't need ALT key 01453 // 01454 if ( !(pkl->piiex->ImeInfo.fdwProperty & IME_PROP_NEED_ALTKEY) ) { 01455 // 01456 // IME doesn't need ALT key 01457 // 01458 // we don't pass the ALT and ALT+xxx except VK_DBE_xxx keys. 01459 // 01460 if ( ! fDBERoman && 01461 (uVKey == VK_MENU || (lParam & 0x20000000)) // KF_ALTDOWN 01462 ) 01463 { 01464 return dwReturn; 01465 } 01466 } 01467 01468 // 01469 // finaly call back the client 01470 // 01471 01472 ProcessKeyCallClient: 01473 01474 if ((uVKey & 0xff) == VK_PACKET) { 01475 // 01476 // need to retrieve UNICODE character from pti 01477 // 01478 uVKey = MAKELONG(wParam, PtiCurrent()->wchInjected); 01479 } 01480 dwReturn = ClientImmProcessKey( PtoH(pwnd), 01481 pkl->hkl, 01482 uVKey, 01483 lParam, 01484 dwHotKeyID); 01485 01486 // 01487 // Hydra server wants to see the IME hotkeys. 01488 // 01489 if (GetAppImeCompatFlags(GETPTI(pwnd)) & IMECOMPAT_HYDRACLIENT) { 01490 dwReturn &= ~IPHK_HOTKEY; 01491 } 01492 return dwReturn; 01493 }

VOID xxxImmUnloadLayout IN PTHREADINFO  pti,
IN DWORD  dwFlag
 

Definition at line 1070 of file ntimm.c.

References CMSHUNGAPPTIMEOUT, IFL_DEACTIVATEIME, IS_IME_KBDLAYOUT, NULL, PtiCurrentShared, tagTHREADINFO::spwndDefaultIme, ThreadLockAlwaysWithPti, ThreadUnlock, VOID(), and xxxSendMessageTimeout().

Referenced by xxxImmActivateAndUnloadThreadsLayout(), and xxxImmUnloadThreadsLayout().

01073 { 01074 TL tlpwndDefaultIme; 01075 PTHREADINFO ptiCurrent; 01076 ULONG_PTR dwResult; 01077 LRESULT r; 01078 01079 /* 01080 * Do nothing if the thread does not have default IME window. 01081 */ 01082 if (pti->spwndDefaultIme == NULL) 01083 return; 01084 01085 if (pti->spklActive == NULL) 01086 return; 01087 01088 if (dwFlag == IFL_DEACTIVATEIME && 01089 !IS_IME_KBDLAYOUT(pti->spklActive->hkl)) 01090 return; 01091 01092 ptiCurrent = PtiCurrentShared(); 01093 01094 ThreadLockAlwaysWithPti(ptiCurrent, pti->spwndDefaultIme, &tlpwndDefaultIme); 01095 r = xxxSendMessageTimeout(pti->spwndDefaultIme, WM_IME_SYSTEM, 01096 IMS_UNLOADTHREADLAYOUT, (LONG)dwFlag, 01097 SMTO_NOTIMEOUTIFNOTHUNG, CMSHUNGAPPTIMEOUT, &dwResult); 01098 01099 if (!r) { 01100 RIPMSG1(RIP_WARNING, "Timeout in xxxImmUnloadLayout: perhaps this thread (0x%x) is not pumping messages.", 01101 pti->pEThread->Cid.UniqueThread); 01102 } 01103 01104 ThreadUnlock(&tlpwndDefaultIme); 01105 01106 return; 01107 }

VOID xxxImmUnloadThreadsLayout IN PTHREADINFO ptiList,
IN UINT  nEntry,
IN PTLBLOCK  ptlBlockPrev,
IN DWORD  dwFlag
 

Definition at line 961 of file ntimm.c.

References FALSE, IFL_DEACTIVATEIME, IFL_UNLOADIME, INT, IS_IME_KBDLAYOUT, tagTLBLOCK::list, NULL, PtiCurrentShared, tagTLBLOCK::ptlBlockPrev, ThreadLockPti, THREADS_PER_TLBLOCK, ThreadUnlockPti, TIF_INCLEANUP, TRUE, VOID(), and xxxImmUnloadLayout().

Referenced by xxxFreeImeKeyboardLayouts().

00966 { 00967 TLBLOCK tlBlock; 00968 PTHREADINFO ptiCurrent; 00969 INT i, cThreads; 00970 BOOLEAN fPerformUnlock; 00971 00972 ptiCurrent = PtiCurrentShared(); 00973 tlBlock.ptlBlockPrev = ptlBlockPrev; 00974 00975 /* 00976 * Build a list of threads that we need to unload their IME DLL(s). 00977 * We can't just walk the ptiList while we're doing the work, because 00978 * for IME based keyboard layout, we will do callback to client side 00979 * and the pti could get deleted out while we leave the critical section. 00980 */ 00981 for (i = 0, cThreads = 0; i < (INT)nEntries; i++) { 00982 /* 00983 * Skip all the *do nothing* cases in xxxImmUnloadLayout() 00984 * so as to minimize the # of TLBLOCK required. 00985 */ 00986 if ((ptiList[i]->TIF_flags & TIF_INCLEANUP) || ptiList[i]->spwndDefaultIme == NULL) 00987 continue; 00988 00989 if (ptiList[i]->spklActive == NULL) 00990 continue; 00991 00992 if (dwFlag == IFL_DEACTIVATEIME && 00993 !IS_IME_KBDLAYOUT(ptiList[i]->spklActive->hkl)) // #99321 00994 continue; 00995 00996 #if DBG 00997 tlBlock.list[cThreads].dwUnlockedCount = 0; 00998 #endif 00999 ThreadLockPti(ptiCurrent, ptiList[i], &tlBlock.list[cThreads].tlpti); 01000 tlBlock.list[cThreads++].pti = ptiList[i]; 01001 if (cThreads == THREADS_PER_TLBLOCK) { 01002 i++; // 1 more before exit the loop. 01003 break; 01004 } 01005 } 01006 01007 if (i < (INT)nEntries) { 01008 ptiList += i; 01009 nEntries -= i; 01010 xxxImmUnloadThreadsLayout(ptiList, nEntries, &tlBlock, dwFlag); 01011 return; 01012 } 01013 01014 UserAssert(dwFlag == IFL_UNLOADIME || dwFlag == IFL_DEACTIVATEIME); 01015 if (dwFlag == IFL_UNLOADIME) { 01016 dwFlag = IFL_DEACTIVATEIME; 01017 fPerformUnlock = FALSE; 01018 } else { 01019 fPerformUnlock = TRUE; 01020 } 01021 RepeatForUnload: 01022 /* 01023 * Finally, we can unload the IME based keyboard layout 01024 * starting from this run. Work on current TLBLOCK first. 01025 * We walk the list backwards so that the pti unlocks will 01026 * be done in the right order. 01027 */ 01028 i = cThreads - 1; 01029 for (ptlBlockPrev = &tlBlock; ptlBlockPrev; ptlBlockPrev = ptlBlockPrev->ptlBlockPrev) { 01030 for ( ; i >= 0; --i) { 01031 if (!(ptlBlockPrev->list[i].pti->TIF_flags & TIF_INCLEANUP)) { 01032 xxxImmUnloadLayout(ptlBlockPrev->list[i].pti, dwFlag); 01033 } 01034 else { 01035 RIPMSG2(RIP_WARNING, "Thread %#p is cleaned during the loop for %x!", ptlBlockPrev->list[i].pti, dwFlag); 01036 } 01037 01038 if (fPerformUnlock) { 01039 #if DBG 01040 ptlBlockPrev->list[i].dwUnlockedCount++; 01041 #endif 01042 ThreadUnlockPti(ptiCurrent, &ptlBlockPrev->list[i].tlpti); 01043 } 01044 } 01045 i = THREADS_PER_TLBLOCK - 1; 01046 } 01047 01048 if (!fPerformUnlock) { 01049 fPerformUnlock = TRUE; 01050 dwFlag = IFL_UNLOADIME; 01051 goto RepeatForUnload; 01052 } 01053 01054 #if DBG 01055 // Check if all the locked thread is properly unlocked 01056 i = cThreads - 1; 01057 for (ptlBlockPrev = &tlBlock; ptlBlockPrev; ptlBlockPrev = ptlBlockPrev->ptlBlockPrev) { 01058 for ( ; i >= 0; --i) { 01059 UserAssert(ptlBlockPrev->list[i].dwUnlockedCount == 1); 01060 } 01061 i = THREADS_PER_TLBLOCK - 1; 01062 } 01063 #endif 01064 01065 return; 01066 }

BOOL xxxInitInput PTERMINAL   ) 
 

Definition at line 140 of file ntinput.c.

References BOOL, CreateKernelEvent(), CreateSystemThread(), EnterCrit, FALSE, FreeKernelEvent(), gptiRit, KernelMode, KeWaitForSingleObject(), LeaveCrit, NT_SUCCESS, NTSTATUS(), NULL, PKSTART_ROUTINE, _RIT_INIT::pRitReadyEvent, _RIT_INIT::pTerm, RawInputThread(), Status, and WrUserRequest.

Referenced by CreateTerminalInput().

00142 { 00143 NTSTATUS Status; 00144 HANDLE hThreadRawInput; 00145 RIT_INIT initData; 00146 UserAssert(pTerm != NULL); 00147 00148 #ifdef MOUSE_LOCK_CODE 00149 /* 00150 * Lock RIT pages into memory 00151 */ 00152 LockMouseInputCodePages(); 00153 #endif 00154 00155 initData.pTerm = pTerm; 00156 initData.pRitReadyEvent = CreateKernelEvent(SynchronizationEvent, FALSE); 00157 if (initData.pRitReadyEvent == NULL) { 00158 return FALSE; 00159 } 00160 /* 00161 * Create the RIT and let it run. 00162 */ 00163 LeaveCrit(); 00164 Status = CreateSystemThread((PKSTART_ROUTINE)RawInputThread, &initData, 00165 &hThreadRawInput); 00166 if (!NT_SUCCESS(Status)) { 00167 goto Exit; 00168 } 00169 ZwClose(hThreadRawInput); 00170 00171 KeWaitForSingleObject(initData.pRitReadyEvent, WrUserRequest, 00172 KernelMode, FALSE, NULL); 00173 Exit: 00174 FreeKernelEvent(&initData.pRitReadyEvent); 00175 EnterCrit(); 00176 00177 return (gptiRit != NULL); 00178 }

NTSTATUS xxxInitProcessInfo PW32PROCESS   ) 
 

Definition at line 4874 of file queue.c.

References CheckAllowForeground(), CheckCritIn, gcSysExpunge, GetProcessLuid(), gppiList, NT_SUCCESS, NTSTATUS(), NULL, tagPROCESSINFO::ppiNextRunning, PUDF_ALLOWFOREGROUNDACTIVATE, SetAppStarting(), Status, TEST_PUDF, and xxxSetProcessInitState().

Referenced by xxxUserProcessCallout().

04876 { 04877 PPROCESSINFO ppi = (PPROCESSINFO)pwp; 04878 NTSTATUS Status; 04879 04880 CheckCritIn(); 04881 04882 /* 04883 * Check if we need to initialize the process. 04884 */ 04885 if (pwp->W32PF_Flags & W32PF_PROCESSCONNECTED) { 04886 return STATUS_ALREADY_WIN32; 04887 } 04888 pwp->W32PF_Flags |= W32PF_PROCESSCONNECTED; 04889 04890 #if defined(_WIN64) 04891 /* Tag as emulated 32bit. Flag is copied to be consistent with 04892 * the way WOW16 apps are tagged for win32k. 04893 */ 04894 if (pwp->Process->Wow64Process) { 04895 pwp->W32PF_Flags |= W32PF_WOW64; 04896 } 04897 #endif 04898 04899 /* 04900 * Mark this app as "starting" - it will be starting until its first 04901 * window activates. 04902 */ 04903 UserVerify(xxxSetProcessInitState(pwp->Process, STARTF_FORCEOFFFEEDBACK)); 04904 04905 /* 04906 * link it into the starting processes list 04907 */ 04908 SetAppStarting(ppi); 04909 /* 04910 * link it into the global processes list 04911 */ 04912 ppi->ppiNextRunning = gppiList; 04913 gppiList = ppi; 04914 /* 04915 * If foreground activation has not been canceled and the parent process 04916 * (or an ancestor) can force a foreground change, then allow this process 04917 * to come to the foreground when it does its first activation. 04918 * 04919 * Bug 273518 - joejo 04920 * 04921 * This will allow console windows to set foreground correctly on new 04922 * process' it launches, as opposed it just forcing foreground. 04923 */ 04924 if (TEST_PUDF(PUDF_ALLOWFOREGROUNDACTIVATE) && CheckAllowForeground(pwp->Process)) { 04925 ppi->W32PF_Flags |= W32PF_ALLOWFOREGROUNDACTIVATE; 04926 } 04927 TAGMSG2(DBGTAG_FOREGROUND, "xxxInitProcessInfo %s W32PF %#p", 04928 ((ppi->W32PF_Flags & W32PF_ALLOWFOREGROUNDACTIVATE) ? "set" : "NOT"), 04929 ppi); 04930 04931 /* 04932 * Get the logon session id. This is used to determine which 04933 * windowstation to connect to and to identify attempts to 04934 * call hooks across security contexts. 04935 */ 04936 Status = GetProcessLuid(NULL, &ppi->luidSession); 04937 UserAssert(NT_SUCCESS(Status)); 04938 04939 /* 04940 * Ensure that we're in sync with the expunge count 04941 */ 04942 ppi->cSysExpunge = gcSysExpunge; 04943 04944 /* 04945 * Don't perform any LPK callbacks until GDI notifies 04946 * us that the LPK(s) are loaded and initialized. 04947 */ 04948 ppi->dwLpkEntryPoints = 0; 04949 04950 return STATUS_SUCCESS; 04951 }

VOID xxxInitSendValidateMinMaxInfo PWND  pwnd,
LPMINMAXINFO  lpmmi
 

Definition at line 32 of file minmax.c.

References _GetClientRect(), _GetProp(), _HasCaptionIcon(), _MonitorFromWindow(), CheckLock, ClrWF, FALSE, tagCHECKPOINT::fMaxInitialized, gcxCaptionFontChar, GetMonitorMaxArea(), GetPrimaryMonitor(), GetWindowBorders(), InflateRect(), max, NULL, PROP_CHECKPOINT, PROPF_INTERNAL, PtiCurrent, tagCHECKPOINT::ptMax, PWNDDESKTOP, tagMONITOR::rcMonitor, SetWF, tagWND::spwndParent, SYSMET, TestWF, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TRUE, WEFCONTEXTHELP, WEFTOOLWINDOW, WFCAPTION, WFCPRESENT, WFMAXBOX, WFMINBOX, WFREALLYMAXIMIZABLE, WFSIZEBOX, WFSYSMENU, and xxxSendMessage().

Referenced by xxxAdjustSize(), xxxMinMaximize(), and xxxMoveSize().

00033 { 00034 PTHREADINFO ptiCurrent; 00035 PMONITOR pMonitorReal; 00036 PMONITOR pMonitorPrimary; 00037 TL tlpMonitorReal; 00038 TL tlpMonitorPrimary; 00039 CHECKPOINT * pcp; 00040 RECT rcParent; 00041 int cBorders; 00042 int xMin, yMin; 00043 00044 CheckLock(pwnd); 00045 00046 ptiCurrent = PtiCurrent(); 00047 00048 /* 00049 * FILL IN THE MINMAXINFO WE THINK IS APPROPRIATE 00050 */ 00051 00052 /* 00053 * Minimized Size 00054 */ 00055 lpmmi->ptReserved.x = SYSMET(CXMINIMIZED); 00056 lpmmi->ptReserved.y = SYSMET(CYMINIMIZED); 00057 00058 /* 00059 * Maximized Position and Size 00060 * Figure out where the window would be maximized within its parent. 00061 */ 00062 pMonitorPrimary = GetPrimaryMonitor(); 00063 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00064 /* What monitor is the window really going to maximize to? */ 00065 pMonitorReal = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 00066 00067 /* Send dimensions based on the primary only. */ 00068 rcParent = pMonitorPrimary->rcMonitor; 00069 } else { 00070 pMonitorReal = NULL; 00071 _GetClientRect(pwnd->spwndParent, &rcParent); 00072 } 00073 00074 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00075 00076 InflateRect(&rcParent, 00077 cBorders * SYSMET(CXBORDER), 00078 cBorders * SYSMET(CYBORDER)); 00079 00080 rcParent.right -= rcParent.left; 00081 rcParent.bottom -= rcParent.top; 00082 00083 /* rcParent.right, bottom are width and height now. */ 00084 lpmmi->ptMaxSize.x = rcParent.right; 00085 lpmmi->ptMaxSize.y = rcParent.bottom; 00086 00087 pcp = (CHECKPOINT *)_GetProp(pwnd, PROP_CHECKPOINT, PROPF_INTERNAL); 00088 if (pcp && pcp->fMaxInitialized) { 00089 /* 00090 * Note: For top level windows, we will fix this point up after 00091 * the fact if it has gotten out of date because the size border 00092 * changed. 00093 */ 00094 lpmmi->ptMaxPosition = pcp->ptMax; 00095 } else { 00096 lpmmi->ptMaxPosition = *((LPPOINT)&rcParent.left); 00097 } 00098 00099 /* 00100 * Normal minimum tracking size 00101 * Only enforce min tracking size for windows with captions 00102 */ 00103 xMin = cBorders*SYSMET(CXEDGE); 00104 yMin = cBorders*SYSMET(CYEDGE); 00105 00106 if (TestWF(pwnd, WFCAPTION) && !TestWF(pwnd, WEFTOOLWINDOW)) { 00107 lpmmi->ptMinTrackSize.x = SYSMET(CXMINTRACK); 00108 lpmmi->ptMinTrackSize.y = SYSMET(CYMINTRACK); 00109 } else { 00110 lpmmi->ptMinTrackSize.x = max(SYSMET(CXEDGE), xMin); 00111 lpmmi->ptMinTrackSize.y = max(SYSMET(CYEDGE), yMin); 00112 } 00113 00114 /* 00115 * Normal maximum tracking size 00116 */ 00117 lpmmi->ptMaxTrackSize.x = SYSMET(CXMAXTRACK); 00118 lpmmi->ptMaxTrackSize.y = SYSMET(CYMAXTRACK); 00119 00120 /* 00121 * SEND THE WM_GETMINMAXINFO MESSAGE 00122 */ 00123 00124 ThreadLockWithPti(ptiCurrent, pMonitorReal, &tlpMonitorReal); 00125 ThreadLockAlwaysWithPti(ptiCurrent, pMonitorPrimary, &tlpMonitorPrimary); 00126 xxxSendMessage(pwnd, WM_GETMINMAXINFO, 0, (LPARAM)lpmmi); 00127 00128 /* 00129 * VALIDATE THE MINMAXINFO 00130 */ 00131 00132 /* 00133 * Minimized Size (this is read only) 00134 */ 00135 lpmmi->ptReserved.x = SYSMET(CXMINIMIZED); 00136 lpmmi->ptReserved.y = SYSMET(CYMINIMIZED); 00137 00138 /* 00139 * Maximized Postion and Size (only for top level windows) 00140 */ 00141 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00142 LPRECT lprcRealMax; 00143 00144 GetMonitorMaxArea(pwnd, pMonitorReal, &lprcRealMax); 00145 00146 /* 00147 * Is the window a TRUE maximized dude, or somebody like the DOS box 00148 * who can maximize but not take up the entire screen? 00149 * 00150 * Is the window really maximizeable? 00151 */ 00152 if ((lpmmi->ptMaxSize.x >= (pMonitorPrimary->rcMonitor.right - pMonitorPrimary->rcMonitor.left)) && 00153 (lpmmi->ptMaxSize.y >= (pMonitorPrimary->rcMonitor.bottom - pMonitorPrimary->rcMonitor.top))) { 00154 00155 SetWF(pwnd, WFREALLYMAXIMIZABLE); 00156 00157 /* 00158 * Need to reload the checkpoint here, since it might have gotten 00159 * blown away while we were in the xxxSendMessage call above. 00160 */ 00161 pcp = (CHECKPOINT *)_GetProp(pwnd, PROP_CHECKPOINT, PROPF_INTERNAL); 00162 00163 if ( pcp && 00164 pcp->fMaxInitialized && 00165 TestWF(pwnd, WFSIZEBOX) && 00166 (lpmmi->ptMaxPosition.x != rcParent.left) && 00167 (pcp->ptMax.x == lpmmi->ptMaxPosition.x)) { 00168 00169 /* 00170 * If this window has a weird maximize point that doesn't jibe 00171 * with what we'd expect and it has a checkpoint, fix up the 00172 * checkpoint. It means that somebody's WINDOWPLACEMENT 00173 * got out of date when the size border changed dimensions. 00174 */ 00175 pcp->fMaxInitialized = FALSE; 00176 00177 lpmmi->ptMaxPosition.y += (rcParent.left - lpmmi->ptMaxPosition.x); 00178 lpmmi->ptMaxPosition.x = rcParent.left; 00179 } 00180 00181 /* 00182 * Transfer the maximum size over to the monitor we are REALLY 00183 * moving to. And fix up guys going fullscreen. A whole bunch 00184 * of Consumer titles + Word '95 and XL '95 move their caption 00185 * above the top of the monitor when going fullscreen. Detect 00186 * these guys now, and let them take up the monitor. 00187 */ 00188 if ( lpmmi->ptMaxPosition.y + SYSMET(CYCAPTION) <= 00189 pMonitorPrimary->rcMonitor.top 00190 && 00191 lpmmi->ptMaxPosition.y + lpmmi->ptMaxSize.y >= 00192 pMonitorPrimary->rcMonitor.bottom) { 00193 00194 lprcRealMax = &pMonitorReal->rcMonitor; 00195 } 00196 00197 /* 00198 * Compensate for the difference between the primary monitor 00199 * and the monitor we are actually on. 00200 */ 00201 lpmmi->ptMaxSize.x = lpmmi->ptMaxSize.x - 00202 (pMonitorPrimary->rcMonitor.right - pMonitorPrimary->rcMonitor.left) + 00203 (lprcRealMax->right - lprcRealMax->left); 00204 00205 lpmmi->ptMaxSize.y = lpmmi->ptMaxSize.y - 00206 (pMonitorPrimary->rcMonitor.bottom - pMonitorPrimary->rcMonitor.top) + 00207 (lprcRealMax->bottom - lprcRealMax->top); 00208 } else { 00209 ClrWF(pwnd, WFREALLYMAXIMIZABLE); 00210 } 00211 00212 /* 00213 * Now transfer the max position over to the monitor we are REALLY 00214 * moving to. 00215 */ 00216 lpmmi->ptMaxPosition.x += lprcRealMax->left; 00217 lpmmi->ptMaxPosition.y += lprcRealMax->top; 00218 } 00219 00220 ThreadUnlock(&tlpMonitorPrimary); 00221 ThreadUnlock(&tlpMonitorReal); 00222 00223 /* 00224 * Normal minimum tracking size. 00225 */ 00226 00227 /* 00228 * WFCAPTION == WFBORDER | WFDLGFRAME; So, when we want to test for the 00229 * presence of CAPTION, we must test for both the bits. Otherwise we 00230 * might mistake WFBORDER or WFDLGFRAME to be a CAPTION. 00231 * 00232 * 00233 * We must not allow a window to be sized smaller than the border 00234 * thickness -- SANKAR -- 06/12/91 -- 00235 */ 00236 if (TestWF(pwnd, WFCPRESENT)) { 00237 00238 /* 00239 * NOTE THAT IF YOU CHANGE THE SPACING OF STUFF IN THE CAPTION, 00240 * YOU NEED TO KEEP THE FOLLOWING IN SSYNC: 00241 * (1) Default CXMINTRACK, CYMINTRACK in inctlpan.c 00242 * (2) The default minimum right below 00243 * (3) Hit testing 00244 * 00245 * The minimum size should be space for: 00246 * * The borders 00247 * * The buttons 00248 * * Margins 00249 * * 4 chars of text 00250 * * Caption icon 00251 */ 00252 yMin = SYSMET(CYMINTRACK); 00253 00254 /* 00255 * Min track size is determined by the number of buttons in 00256 * the caption. 00257 */ 00258 if (TestWF(pwnd, WEFTOOLWINDOW)) { 00259 00260 /* 00261 * Add in space for close button. 00262 */ 00263 if (TestWF(pwnd, WFSYSMENU)) 00264 xMin += SYSMET(CXSMSIZE); 00265 00266 /* 00267 * DON'T add in space for 2 characters--breaks 00268 * MFC toolbar stuff. They want to make vertical undocked 00269 * toolbars narrower than what that would produce. 00270 */ 00271 xMin += (2 * SYSMET(CXEDGE)); 00272 00273 } else { 00274 00275 if (TestWF(pwnd, WFSYSMENU)) { 00276 00277 /* 00278 * Add in space for min/max/close buttons. Otherwise, 00279 * if it's a contexthelp window, then add in space 00280 * for help/close buttons. 00281 */ 00282 if (TestWF(pwnd, (WFMINBOX | WFMAXBOX))) 00283 xMin += 3 * SYSMET(CXSIZE); 00284 else if (TestWF(pwnd, WEFCONTEXTHELP)) 00285 xMin += 2 * SYSMET(CXSIZE); 00286 00287 00288 /* 00289 * Add in space for system menu icon. 00290 */ 00291 if (_HasCaptionIcon(pwnd)) 00292 xMin += SYSMET(CYSIZE); 00293 } 00294 00295 /* 00296 * Add in space for 4 characters and margins. 00297 */ 00298 xMin += 4 * gcxCaptionFontChar + 2 * SYSMET(CXEDGE); 00299 } 00300 } 00301 00302 lpmmi->ptMinTrackSize.x = max(lpmmi->ptMinTrackSize.x, xMin); 00303 lpmmi->ptMinTrackSize.y = max(lpmmi->ptMinTrackSize.y, yMin); 00304 }

BOOL xxxInitWindowStation PWINDOWSTATION   ) 
 

Definition at line 1319 of file w32/ntuser/kernel/init.c.

References BOOL, CreateProfileUserName(), FinalUserInit(), FreeProfileUserName(), gpsi, LW_DriversInit(), LW_LoadProfileInitData(), NULL, SetIconMetrics(), SetMinMetrics(), TRUE, and xxxSetWindowNCMetrics().

Referenced by xxxCreateWindowStation().

01321 { 01322 TL tlName; 01323 PUNICODE_STRING pProfileUserName = CreateProfileUserName(&tlName); 01324 BOOL fRet; 01325 01326 /* 01327 * Load all profile data first 01328 */ 01329 LW_LoadProfileInitData(pProfileUserName); 01330 01331 /* 01332 * Initialize User in a specific order. 01333 */ 01334 LW_DriversInit(); 01335 01336 /* 01337 * This is the initialization from Chicago 01338 */ 01339 if (!(fRet = xxxSetWindowNCMetrics(pProfileUserName, NULL, TRUE, -1))) { 01340 RIPMSG0(RIP_WARNING, "xxxInitWindowStation failed in xxxSetWindowNCMetrics"); 01341 goto Exit; 01342 } 01343 01344 SetMinMetrics(pProfileUserName, NULL); 01345 01346 if (!(fRet = SetIconMetrics(pProfileUserName, NULL))) { 01347 RIPMSG0(RIP_WARNING, "xxxInitWindowStation failed in SetIconMetrics"); 01348 goto Exit; 01349 } 01350 01351 if (!(fRet = FinalUserInit())) { 01352 RIPMSG0(RIP_WARNING, "xxxInitWindowStation failed in FinalUserInit"); 01353 goto Exit; 01354 } 01355 01356 /* 01357 * Initialize the key cache index. 01358 */ 01359 gpsi->dwKeyCache = 1; 01360 01361 Exit: 01362 FreeProfileUserName(pProfileUserName, &tlName); 01363 01364 return fRet; 01365 UNREFERENCED_PARAMETER(pwinsta); 01366 }

BOOL xxxInsertMenuItem PMENU  pMenu,
UINT  wIndex,
BOOL  fByPosition,
LPMENUITEMINFOW  lpmii,
PUNICODE_STRING  pstrItem
 

Definition at line 323 of file mnchange.c.

References BOOL, tagMENU::cAlloced, tagITEM::cch, CheckLock, tagMENU::cItems, CMENUITEMALLOC, tagITEM::cxBmp, tagITEM::cxItem, tagITEM::cyItem, DesktopAlloc(), DesktopFree, DTAG_MENUITEM, tagITEM::dwItemData, FALSE, tagPOPUPMENU::fHierarchyDropped, tagITEM::fState, tagITEM::fType, tagITEM::hbmp, tagITEM::hbmpChecked, tagITEM::hbmpUnchecked, tagMENU::head, ITEM, tagITEM::lpstr, MakeMenuRtoL(), MFISPOPUP, MFMWFP_NOITEM, MFRTL, MNDeleteAdjustIndexes(), MNFreeItem(), MNGetpItemIndex, MNGetPopupFromMenu(), MNIS_MEASUREBMP, MNLookUpItem(), NULL, PBYTE, tagPOPUPMENU::posDropped, tagPOPUPMENU::posSelectedItem, tagMENU::rgItems, tagITEM::spSubMenu, tagPOPUPMENU::spwndPopupMenu, TestMF, TestMFT, ThreadLock, ThreadUnlock, TRUE, tagMENUSTATE::uButtonDownHitArea, tagMENUSTATE::uButtonDownIndex, tagMENUSTATE::uDraggingFlags, tagMENUSTATE::uDraggingHitArea, tagMENUSTATE::uDraggingIndex, UINT, tagITEM::wID, tagITEM::xItem, xxxMNSetGapState(), xxxSetLPITEMInfo(), and tagITEM::yItem.

Referenced by NtUserThunkedMenuItemInfo().

00329 { 00330 BOOL fRet = TRUE; 00331 PITEM pItem; 00332 PMENU pMenuItemIsOn; 00333 PMENUSTATE pMenuState; 00334 PITEM pNewItems; 00335 PPOPUPMENU ppopup = NULL; 00336 TL tlMenu; 00337 UINT uiPos; 00338 00339 CheckLock(pMenu); 00340 00341 // Find out where the item we are inserting should go. 00342 if (wIndex != MFMWFP_NOITEM) { 00343 pItem = MNLookUpItem(pMenu, wIndex, fByPosition, &pMenuItemIsOn); 00344 00345 if (pItem != NULL) { 00346 pMenu = pMenuItemIsOn; 00347 } else { 00348 wIndex = MFMWFP_NOITEM; 00349 } 00350 } else { 00351 pItem = NULL; 00352 } 00353 /* 00354 * keep normal menu items between the MDI system bitmap items 00355 */ 00356 if (!TestMF(pMenu, MFISPOPUP) 00357 && (pMenu->cItems != 0) 00358 && (!(lpmii->fMask & MIIM_BITMAP) 00359 || (lpmii->hbmpItem > HBMMENU_MBARLAST) 00360 || (lpmii->hbmpItem == 0) 00361 )) { 00362 00363 UINT wSave, w; 00364 PITEM pItemWalk; 00365 wSave = w = wIndex; 00366 00367 if (pItem && !fByPosition) { 00368 w = MNGetpItemIndex(pMenu, pItem); 00369 w = (UINT)((PBYTE)pItem - (PBYTE)(pMenu->rgItems)) / sizeof(ITEM); 00370 } 00371 00372 if (!w) { 00373 pItemWalk = pMenu->rgItems; 00374 if ((pItemWalk->hbmp == HBMMENU_SYSTEM)) { 00375 wIndex = 1; 00376 } 00377 } else { 00378 if (w == MFMWFP_NOITEM) { 00379 w = pMenu->cItems; 00380 } 00381 00382 w--; 00383 pItemWalk = pMenu->rgItems + w; 00384 while (w && (pItemWalk->hbmp) && (pItemWalk->hbmp < HBMMENU_MBARLAST)) { 00385 wIndex = w--; 00386 pItemWalk--; 00387 } 00388 } 00389 00390 if (wIndex != wSave) { 00391 pItem = pMenu->rgItems + wIndex; 00392 } 00393 } 00394 00395 // LATER -- we currently realloc every 10 items. investigate the 00396 // performance hit/gain we get from this and adjust accordingly. 00397 if (pMenu->cItems >= pMenu->cAlloced) { 00398 if (pMenu->rgItems) { 00399 pNewItems = (PITEM)DesktopAlloc(pMenu->head.rpdesk, 00400 (pMenu->cAlloced + CMENUITEMALLOC) * sizeof(ITEM), 00401 DTAG_MENUITEM); 00402 if (pNewItems) { 00403 RtlCopyMemory(pNewItems, pMenu->rgItems, 00404 pMenu->cAlloced * sizeof(ITEM)); 00405 #if DEBUGTAGS 00406 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 00407 RelocateMenuLockRecords(pNewItems, pMenu->cItems, 00408 ((PBYTE)pNewItems) - (PBYTE)(pMenu->rgItems)); 00409 } 00410 #endif 00411 DesktopFree(pMenu->head.rpdesk, pMenu->rgItems); 00412 } 00413 } else { 00414 pNewItems = (PITEM)DesktopAlloc(pMenu->head.rpdesk, 00415 sizeof(ITEM) * CMENUITEMALLOC, DTAG_MENUITEM); 00416 } 00417 00418 if (pNewItems == NULL) 00419 return(FALSE); 00420 00421 pMenu->cAlloced += CMENUITEMALLOC; 00422 pMenu->rgItems = pNewItems; 00423 00424 /* 00425 * Now look up the item again since it probably moved when we realloced the 00426 * memory. 00427 */ 00428 if (wIndex != MFMWFP_NOITEM) 00429 pItem = MNLookUpItem(pMenu, wIndex, fByPosition, &pMenuItemIsOn); 00430 00431 } 00432 00433 00434 /* 00435 * If this menu is being displayed right now and we're not appending 00436 * an item, then we need to adjust the positions we keep track of. 00437 * We want to do this before moving the items to accomodate the 00438 * new one, in case we need to clear the insertion bar 00439 */ 00440 if ((pItem != NULL) 00441 && (ppopup = MNGetPopupFromMenu(pMenu, &pMenuState))) { 00442 /* 00443 * This menu is active. Adjust the index the selected 00444 * item and the dropped popup, if needed 00445 */ 00446 uiPos = MNGetpItemIndex(pMenu, pItem); 00447 if (ppopup->posSelectedItem >= (int)uiPos) { 00448 ppopup->posSelectedItem++; 00449 } 00450 if (ppopup->fHierarchyDropped && (ppopup->posDropped >= (int)uiPos)) { 00451 ppopup->posDropped++; 00452 } 00453 00454 /* 00455 * Adjust uButtonDownIndex and uDraggingIndex if needed 00456 */ 00457 if (pMenuState->uButtonDownHitArea == (ULONG_PTR)ppopup->spwndPopupMenu) { 00458 if ((int)pMenuState->uButtonDownIndex >= (int)uiPos) { 00459 pMenuState->uButtonDownIndex++; 00460 } 00461 } 00462 if (pMenuState->uDraggingHitArea == (ULONG_PTR)ppopup->spwndPopupMenu) { 00463 /* 00464 * Check to see if an item is inserted right on the insertion 00465 * bar. If so, clean up any present insertion bar state 00466 */ 00467 if (((int)pMenuState->uDraggingIndex == (int)uiPos) 00468 && (pMenuState->uDraggingFlags & MNGOF_TOPGAP)) { 00469 00470 xxxMNSetGapState(pMenuState->uDraggingHitArea, 00471 pMenuState->uDraggingIndex, 00472 pMenuState->uDraggingFlags, 00473 FALSE); 00474 } 00475 00476 if ((int)pMenuState->uDraggingIndex >= (int)uiPos) { 00477 pMenuState->uDraggingIndex++; 00478 } 00479 } 00480 } 00481 00482 pMenu->cItems++; 00483 if (pItem != NULL) { 00484 // Move this item up to make room for the one we want to insert. 00485 RtlMoveMemory(pItem + 1, pItem, (pMenu->cItems - 1) * 00486 sizeof(ITEM) - ((char *)pItem - (char *)pMenu->rgItems)); 00487 #if DEBUGTAGS 00488 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 00489 RelocateMenuLockRecords(pItem + 1, 00490 (int)(&(pMenu->rgItems[pMenu->cItems]) - (pItem + 1)), 00491 sizeof(ITEM)); 00492 } 00493 #endif 00494 } else { 00495 00496 // If lpItem is null, we will be inserting the item at the end of the 00497 // menu. 00498 pItem = pMenu->rgItems + pMenu->cItems - 1; 00499 } 00500 00501 // Need to zero these fields in case we are inserting this item in the 00502 // middle of the item list. 00503 pItem->fType = 0; 00504 pItem->fState = 0; 00505 pItem->wID = 0; 00506 pItem->spSubMenu = NULL; 00507 pItem->hbmpChecked = NULL; 00508 pItem->hbmpUnchecked = NULL; 00509 pItem->cch = 0; 00510 pItem->dwItemData = 0; 00511 pItem->xItem = 0; 00512 pItem->yItem = 0; 00513 pItem->cxItem = 0; 00514 pItem->cyItem = 0; 00515 pItem->hbmp = NULL; 00516 pItem->cxBmp = MNIS_MEASUREBMP; 00517 pItem->lpstr = NULL; 00518 00519 /* 00520 * We might have reassigned pMenu above, so lock it 00521 */ 00522 ThreadLock(pMenu, &tlMenu); 00523 if (!xxxSetLPITEMInfo(pMenu, pItem, lpmii, pstrItem)) { 00524 00525 /* 00526 * Reset any of the indexes we might have adjusted above 00527 */ 00528 if (ppopup != NULL) { 00529 MNDeleteAdjustIndexes(pMenuState, ppopup, uiPos); 00530 } 00531 00532 MNFreeItem(pMenu, pItem, TRUE); 00533 00534 00535 // Move things up since we removed/deleted the item 00536 RtlMoveMemory(pItem, pItem + 1, pMenu->cItems * (UINT)sizeof(ITEM) + 00537 (UINT)((char *)&pMenu->rgItems[0] - (char *)(pItem + 1))); 00538 #if DEBUGTAGS 00539 if (IsDbgTagEnabled(DBGTAG_TrackLocks)) { 00540 RelocateMenuLockRecords(pItem, 00541 (int)(&(pMenu->rgItems[pMenu->cItems - 1]) - pItem), 00542 -(int)sizeof(ITEM)); 00543 } 00544 #endif 00545 pMenu->cItems--; 00546 fRet = FALSE; 00547 } else { 00548 /* 00549 * Like MFT_RIGHTJUSTIFY, this staggers down the menu, 00550 * (but we inherit, to make localisation etc MUCH easier). 00551 * 00552 * MFT_RIGHTORDER is the same value as MFT_SYSMENU. We distinguish 00553 * between the two by also looking for MFT_BITMAP. 00554 */ 00555 if (TestMF(pMenu, MFRTL) || 00556 (pItem && TestMFT(pItem, MFT_RIGHTORDER) && !TestMFT(pItem, MFT_BITMAP))) { 00557 pItem->fType |= (MFT_RIGHTORDER | MFT_RIGHTJUSTIFY); 00558 if (pItem->spSubMenu) { 00559 MakeMenuRtoL(pItem->spSubMenu, TRUE); 00560 } 00561 } 00562 } 00563 00564 ThreadUnlock(&tlMenu); 00565 return fRet; 00566 00567 }

HKL xxxInternalActivateKeyboardLayout PKL  pkl,
UINT  Flags,
PWND  pwnd
 

Definition at line 1203 of file kbdlyout.c.

References AdjustPushStateForKL(), tagQ::afKeyState, BOOL, BYTE, CBKEYSTATE, ChangeForegroundKeyboardTable(), CheckLock, tagKL::CodePage, _CLIENTINFO::CodePage, FALSE, gafAsyncKeyState, gafRawKeyState, gdwKeyboardAttributes, gLCIDSentToShell, gpepCSRSS, gptiForeground, gptiRit, grpdeskRitInput, _CLIENTINFO::hKL, tagKL::hkl, tagKL::iBaseCharset, IS_IME_ENABLED, IS_IME_KBDLAYOUT, IsHooked, Lock, NULL, tagTHREADINFO::pClientInfo, tagKBDFILE::pKbdTbl, tagTHREADINFO::ppi, tagTHREADINFO::pq, PsGetCurrentProcess, PtiCurrent, tagPROCESSINFO::ptiList, tagDESKTOP::PtiList, tagTHREADINFO::ptiSibling, ResetPushState(), tagKL::spkf, tagTHREADINFO::spklActive, tagQ::spwndActive, tagTHREADINFO::spwndDefaultIme, tagQ::spwndFocus, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TIF_16BIT, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, tagKL::wchDiacritic, WHF_SHELL, xxxCallHook(), xxxImmActivateLayout(), xxxImmActivateThreadsLayout(), and xxxSendMessage().

Referenced by xxxActivateKeyboardLayout(), xxxInternalUnloadKeyboardLayout(), and xxxLoadKeyboardLayoutEx().

01207 { 01208 HKL hklPrev; 01209 PKL pklPrev; 01210 TL tlpklPrev; 01211 PTHREADINFO ptiCurrent = PtiCurrent(); 01212 01213 CheckLock(pkl); 01214 CheckLock(pwnd); 01215 01216 /* 01217 * Remember what is about to become the "previously" active hkl 01218 * for the return value. 01219 */ 01220 if (ptiCurrent->spklActive != (PKL)NULL) { 01221 pklPrev = ptiCurrent->spklActive; 01222 hklPrev = ptiCurrent->spklActive->hkl; 01223 } else { 01224 pklPrev = NULL; 01225 hklPrev = (HKL)0; 01226 } 01227 01228 /* 01229 * ShiftLock/CapsLock is a global feature applying to all layouts 01230 * Only Winlogon and the Input Locales cpanel applet set KLF_RESET. 01231 */ 01232 if (Flags & KLF_RESET) { 01233 gdwKeyboardAttributes = KLL_GLOBAL_ATTR_FROM_KLF(Flags); 01234 } 01235 01236 /* 01237 * Early out 01238 */ 01239 if (!(Flags & KLF_SETFORPROCESS) && (pkl == ptiCurrent->spklActive)) { 01240 return hklPrev; 01241 } 01242 01243 /* 01244 * Clear out diacritics when switching kbd layouts #102838 01245 */ 01246 pkl->wchDiacritic = 0; 01247 01248 /* 01249 * Update the active layout in the pti. KLF_SETFORPROCESS will always be set 01250 * when the keyboard layout switch is initiated by the keyboard hotkey. 01251 */ 01252 01253 /* 01254 * Lock the previous keyboard layout for it's used later. 01255 */ 01256 ThreadLockWithPti(ptiCurrent, pklPrev, &tlpklPrev); 01257 01258 /* 01259 * Is this is a console thread, apply this change to any process in it's 01260 * window. This can really help character-mode apps! (#58025) 01261 */ 01262 if (ptiCurrent->TIF_flags & TIF_CSRSSTHREAD) { 01263 Lock(&ptiCurrent->spklActive, pkl); 01264 ptiCurrent->pClientInfo->CodePage = pkl->CodePage; 01265 #if 0 // see Raid #58025 and #78586 01266 ptiCurrent->pClientInfo->hKL = pkl->hkl; 01267 PLIST_ENTRY pHead; 01268 PLIST_ENTRY pEntry; 01269 PQ pqCurrent = ptiCurrent->pq; 01270 PTHREADINFO ptiT; 01271 01272 pHead = &(grpdeskRitInput->PtiList); 01273 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 01274 ptiT = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 01275 if (ptiT->pq == pqCurrent) { 01276 Lock(&ptiT->spklActive, pkl); 01277 UserAssert(ptiT->pClientInfo != NULL); 01278 ptiT->pClientInfo->CodePage = pkl->CodePage; 01279 ptiT->pClientInfo->hKL = pkl->hkl; 01280 } 01281 } 01282 #endif 01283 } else if ((Flags & KLF_SETFORPROCESS) && !(ptiCurrent->TIF_flags & TIF_16BIT)) { 01284 /* 01285 * For 16 bit app., only the calling thread will have its active layout updated. 01286 */ 01287 PTHREADINFO ptiT; 01288 01289 if (IS_IME_ENABLED()) { 01290 /* 01291 * Only allow *NOT* CSRSS to make this call 01292 */ 01293 UserAssert(PsGetCurrentProcess() != gpepCSRSS); 01294 // pti->pClientInfo is updated in xxxImmActivateThreadsLayout() 01295 if (!xxxImmActivateThreadsLayout(ptiCurrent->ppi->ptiList, NULL, pkl)) { 01296 RIPMSG1(RIP_WARNING, "no layout change necessary via xxxImmActivateThreadLayout() for process %lx", ptiCurrent->ppi); 01297 goto UnlockAndGo; 01298 } 01299 } else { 01300 BOOL fKLChanged = FALSE; 01301 01302 for (ptiT = ptiCurrent->ppi->ptiList; ptiT != NULL; ptiT = ptiT->ptiSibling) { 01303 if (ptiT->spklActive != pkl && (ptiT->TIF_flags & TIF_INCLEANUP) == 0) { 01304 Lock(&ptiT->spklActive, pkl); 01305 UserAssert(ptiT->pClientInfo != NULL); 01306 ptiT->pClientInfo->CodePage = pkl->CodePage; 01307 ptiT->pClientInfo->hKL = pkl->hkl; 01308 fKLChanged = TRUE; 01309 } 01310 } 01311 if (!fKLChanged) { 01312 RIPMSG1(RIP_WARNING, "no layout change necessary for process %lx ?", ptiCurrent->ppi); 01313 goto UnlockAndGo; 01314 } 01315 } 01316 01317 } else { 01318 if (IS_IME_ENABLED()) { 01319 xxxImmActivateLayout(ptiCurrent, pkl); 01320 } else { 01321 Lock(&ptiCurrent->spklActive, pkl); 01322 } 01323 UserAssert(ptiCurrent->pClientInfo != NULL); 01324 if ((ptiCurrent->TIF_flags & TIF_INCLEANUP) == 0) { 01325 ptiCurrent->pClientInfo->CodePage = pkl->CodePage; 01326 ptiCurrent->pClientInfo->hKL = pkl->hkl; 01327 } 01328 } 01329 01330 /* 01331 * Some keys (pressed to switch layout) may still be down. When these come 01332 * back up, they may have different VK values due to the new layout, so the 01333 * original key will be left stuck down. (eg: an ISV layout from Attachmate 01334 * and the CAN/CSA layout, both of which redefine the right-hand Ctrl key's 01335 * VK so switching to that layout with right Ctrl+Shift will leave the Ctrl 01336 * stuck down). 01337 * The solution is to clear all the keydown bits whenever we switch layouts 01338 * (leaving the toggle bits alone to preserve CapsLock, NumLock etc.). This 01339 * also solves the AltGr problem, where the simulated Ctrl key doesn't come 01340 * back up if we switch to a non-AltGr layout before releasing AltGr - IanJa 01341 * 01342 * Clear down bits only if necessary --- i.e. if the VK value differs between 01343 * old and new keyboard layout. We have to take complex path for some of the 01344 * keys, like Ctrl or Alt, may have left and right equivalents. - HiroYama 01345 */ 01346 if (ptiCurrent->pq) { 01347 if (pklPrev) { 01348 BYTE baDone[256 / 8]; 01349 01350 RtlZeroMemory(baDone, sizeof baDone); 01351 01352 /* 01353 * Clear the toggle state if needed. First check the modifier keys 01354 * of pklPrev. Next check the modifier keys of pklNew. 01355 */ 01356 TAGMSG2(DBGTAG_IMM, "Changing KL from %08lx to %08lx", pklPrev->hkl, pkl->hkl); 01357 AdjustPushStateForKL(ptiCurrent, baDone, pklPrev, pklPrev, pkl); 01358 AdjustPushStateForKL(ptiCurrent, baDone, pkl, pklPrev, pkl); 01359 01360 if (pklPrev->spkf && (pklPrev->spkf->pKbdTbl->fLocaleFlags & KLLF_ALTGR)) { 01361 /* 01362 * If the previous keyboard has AltGr, clear the left control anyway. 01363 * See xxxAltGr(). 01364 */ 01365 TAGMSG0(DBGTAG_IMM, "Clearing VK_LCONTROL for AltGr\n"); 01366 ResetPushState(ptiCurrent, VK_LCONTROL); 01367 } 01368 } 01369 else { 01370 /* 01371 * If the current keyboard is unkown, clear all the push state. 01372 */ 01373 int i; 01374 for (i = 0; i < CBKEYSTATE; i++) { 01375 ptiCurrent->pq->afKeyState[i] &= KEYSTATE_TOGGLE_BYTEMASK; 01376 gafAsyncKeyState[i] &= KEYSTATE_TOGGLE_BYTEMASK; 01377 gafRawKeyState[i] &= KEYSTATE_TOGGLE_BYTEMASK; 01378 } 01379 } 01380 } 01381 01382 /* 01383 * Call the Shell hook with the new language. 01384 */ 01385 if (gptiForeground && (gptiForeground->ppi == ptiCurrent->ppi)) { 01386 ChangeForegroundKeyboardTable(pklPrev, pkl); 01387 01388 /* 01389 * Only call the hook if we are the foreground process, to prevent 01390 * background apps from changing the indicator. (All console apps 01391 * are part of the same process, but I have never seen a cmd window 01392 * app change the layout, let alone in the background) 01393 */ 01394 if (gLCIDSentToShell != pkl->hkl && (ptiCurrent != gptiRit)) { 01395 if (IsHooked(ptiCurrent, WHF_SHELL)) { 01396 gLCIDSentToShell = pkl->hkl; 01397 xxxCallHook(HSHELL_LANGUAGE, (WPARAM)NULL, (LPARAM)pkl->hkl, WH_SHELL); 01398 } 01399 } 01400 } 01401 01402 /* 01403 * Tell the app what happened 01404 */ 01405 if (ptiCurrent->pq) { 01406 PWND pwndT; 01407 TL tlpwndT; 01408 01409 /* 01410 * If we have no Focus window, use the Active window. 01411 * eg: Console full-screen has NULL focus window. 01412 */ 01413 pwndT = ptiCurrent->pq->spwndFocus; 01414 if (pwndT == NULL) { 01415 pwndT = ptiCurrent->pq->spwndActive; 01416 if (pwndT == NULL) { 01417 pwndT = pwnd; 01418 } 01419 } 01420 01421 if (pwndT != NULL) { 01422 ThreadLockAlwaysWithPti( ptiCurrent, pwndT, &tlpwndT); 01423 xxxSendMessage(pwndT, WM_INPUTLANGCHANGE, (WPARAM)pkl->iBaseCharset, (LPARAM)pkl->hkl); 01424 ThreadUnlock(&tlpwndT); 01425 } 01426 } 01427 01428 /* 01429 * Tell IME to send mode update notification 01430 */ 01431 if (ptiCurrent && ptiCurrent->spwndDefaultIme && 01432 (ptiCurrent->TIF_flags & TIF_CSRSSTHREAD) == 0) { 01433 if (IS_IME_KBDLAYOUT(pkl->hkl)) { 01434 BOOL fForProcess = (ptiCurrent->TIF_flags & KLF_SETFORPROCESS) && !(ptiCurrent->TIF_flags & TIF_16BIT); 01435 TL tlpwndIme; 01436 01437 TAGMSG1(DBGTAG_IMM, "Sending IMS_SENDNOTIFICATION to pwnd=%p", ptiCurrent->spwndDefaultIme); 01438 01439 ThreadLockAlwaysWithPti(ptiCurrent, ptiCurrent->spwndDefaultIme, &tlpwndIme); 01440 xxxSendMessage(ptiCurrent->spwndDefaultIme, WM_IME_SYSTEM, IMS_SENDNOTIFICATION, fForProcess); 01441 ThreadUnlock(&tlpwndIme); 01442 } 01443 } 01444 01445 UnlockAndGo: 01446 ThreadUnlock(&tlpklPrev); 01447 01448 return hklPrev; 01449 }

void xxxInternalDoSyncPaint PWND  pwnd,
DWORD  flags
 

Definition at line 885 of file paint.c.

References BuildHwndList(), BWL_ENUMLIST, CheckLock, DSP_ALLCHILDREN, DSP_ENUMCLIPPEDCHILDREN, FreeHwndList(), GETPTI, NULL, PtiCurrent, RevalidateHwnd, tagBWL::rghwnd, tagWND::spwndChild, TestWF, ThreadLockAlwaysWithPti, ThreadUnlock, VOID(), WFCHILD, WFCLIPCHILDREN, and xxxSimpleDoSyncPaint().

Referenced by xxxDefWindowProc(), and xxxDoSyncPaint().

00888 { 00889 CheckLock(pwnd); 00890 00891 /* 00892 * Do the paint for this window. 00893 */ 00894 xxxSimpleDoSyncPaint(pwnd); 00895 00896 /* 00897 * Normally we like to enumerate all of this window's children and have 00898 * them erase their backgrounds synchronously. However, this is a bad 00899 * thing to do if the window is NOT CLIPCHLIDREN. Here's the scenario 00900 * we want to to avoid: 00901 * 00902 * 1) Window 'A' is invalidated 00903 * 2) 'A' erases itself (or not, doesn't matter) 00904 * 3) 'A's children are enumerated and they erase themselves. 00905 * 4) 'A' paints over its children (remember, 'A' isn't CLIPCHILDREN) 00906 * 5) 'A's children paint but their backgrounds aren't their ERASEBKND 00907 * color (because 'A' painted over them) and everything looks like 00908 * dirt. 00909 */ 00910 if ((flags & DSP_ALLCHILDREN) || 00911 ((flags & DSP_ENUMCLIPPEDCHILDREN) && TestWF(pwnd, WFCLIPCHILDREN))) { 00912 00913 TL tlpwnd; 00914 PBWL pbwl; 00915 HWND *phwnd; 00916 00917 if (pbwl = BuildHwndList(pwnd->spwndChild, BWL_ENUMLIST, NULL)) { 00918 00919 PTHREADINFO ptiCurrent = PtiCurrent(); 00920 HWND hwnd; 00921 00922 /* 00923 * If the client dies during a callback, the hwnd list 00924 * will be freed in xxxDestroyThreadInfo. 00925 */ 00926 for (phwnd = pbwl->rghwnd; (hwnd = *phwnd) != (HWND)1; phwnd++) { 00927 00928 if (hwnd == NULL) 00929 continue; 00930 00931 if ((pwnd = (PWND)RevalidateHwnd(hwnd)) == NULL) 00932 continue; 00933 00934 /* 00935 * Note: testing if a window is a child automatically 00936 * excludes the desktop window. 00937 */ 00938 if (TestWF(pwnd, WFCHILD) && (ptiCurrent != GETPTI(pwnd))) { 00939 00940 /* 00941 * Don't cause any more intertask sendmessages cause it 00942 * does bad things to cbt's windowproc hooks. (Due to 00943 * SetParent allowing child windows in the topwindow 00944 * hierarchy. 00945 */ 00946 continue; 00947 } 00948 00949 /* 00950 * Note that we pass only certain bits down as we recurse: 00951 * the other bits pertain to the current window only. 00952 */ 00953 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 00954 xxxInternalDoSyncPaint(pwnd, flags); 00955 ThreadUnlock(&tlpwnd); 00956 } 00957 00958 FreeHwndList(pbwl); 00959 } 00960 } 00961 }

BOOL xxxInternalEnumWindow PWND  pwndNext,
WNDENUMPROC_PWND  lpfn,
LPARAM  lParam,
UINT  fEnumChildren
 

Definition at line 40 of file enumwin.c.

References BOOL, BuildHwndList(), CheckLock, FALSE, FreeHwndList(), NULL, RevalidateHwnd, tagBWL::rghwnd, ThreadLockAlways, ThreadUnlock, TRUE, and WNDENUMPROC_PWND.

Referenced by CancelInputState(), xxxActivateThisWindow(), xxxDeactivate(), xxxHelpLoop(), and xxxSetClassIcon().

00045 { 00046 HWND *phwnd; 00047 PWND pwnd; 00048 PBWL pbwl; 00049 BOOL fSuccess; 00050 TL tlpwnd; 00051 00052 CheckLock(pwndNext); 00053 00054 if ((pbwl = BuildHwndList(pwndNext, flags, NULL)) == NULL) 00055 return FALSE; 00056 00057 fSuccess = TRUE; 00058 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00059 00060 /* 00061 * Lock the window before we pass it off to the app. 00062 */ 00063 if ((pwnd = RevalidateHwnd(*phwnd)) != NULL) { 00064 00065 /* 00066 * Call the application. 00067 */ 00068 ThreadLockAlways(pwnd, &tlpwnd); 00069 fSuccess = (*lpfn)(pwnd, lParam); 00070 ThreadUnlock(&tlpwnd); 00071 if (!fSuccess) 00072 break; 00073 } 00074 } 00075 00076 FreeHwndList(pbwl); 00077 00078 return fSuccess; 00079 }

BOOL xxxInternalGetMessage LPMSG  lpmsg,
HWND  hwnd,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax,
UINT  wRemoveMsg,
BOOL  fGetMessage
 

Definition at line 213 of file ntuser/kernel/input.c.

References BOOL, CalcWakeMask(), CheckCritIn, CheckForClientDeath, CheckSysLock, CSPINBACKGROUND, _CLIENTINFO::cSpins, tagPROCESSINFO::cSysExpunge, tagCLIENTTHREADINFO::CTIF_flags, CTIF_SYSQUEUELOCKED, tagTHREADINFO::cVisWindows, DoPaint(), DoTimer(), DUMPPATHTAKEN, tagPROCESSINFO::dwhmodLibLoadedMask, DWORD, _CLIENTINFO::dwTIFlags, EnterCrit, FALSE, FJOURNALPLAYBACK, FJOURNALRECORD, tagCLIENTTHREADINFO::fsChangeBits, tagTHREADINFO::fsChangeBitsRemoved, tagCLIENTTHREADINFO::fsWakeBits, tagCLIENTTHREADINFO::fsWakeBitsJournal, gbExitInProgress, gcSysExpunge, gdwSysExpungeMask, gpdeskRecalcQueueAttach, gppiWantForegroundPriority, HEVENT_REMOVEME, tagTHREADINFO::idLast, tagQ::idSysLock, IsHooked, IsWinEventNotifyDeferredOK, LeaveCrit, NULL, PATHTAKEN, tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, PhkFirstGlobalValid(), tagTHREADINFO::ppi, tagTHREADINFO::pq, tagTHREADINFO::psmsCurrent, PtiCurrent, tagQ::ptiSysLock, tagQ::QF_flags, QF_LOCKNOREMOVE, tagTHREADINFO::rpdesk, SET_TIME_LAST_READ, SetForegroundPriority(), ThreadLockAlwaysWithPti, ThreadUnlock, TIF_16BIT, TIF_DELAYEDEVENT, tagTHREADINFO::TIF_flags, TIF_SPINNING, TRUE, UINT, ValidateHwnd, WHF_GETMESSAGE, xxxCallHook(), xxxDirectedYield(), xxxDoSysExpunge(), xxxReadPostMessage(), xxxReceiveMessages, xxxScanSysQueue(), xxxSleepTask(), xxxSleepThread(), xxxUserYield(), zzzCalcStartCursorHide(), zzzReattachThreads(), and zzzWakeInputIdle().

00220 { 00221 UINT fsWakeBits; 00222 UINT fsWakeMask; 00223 UINT fsRemoveBits; 00224 PTHREADINFO ptiCurrent; 00225 PW32PROCESS W32Process; 00226 PWND pwndFilter; 00227 BOOL fLockPwndFilter; 00228 TL tlpwndFilter; 00229 BOOL fRemove; 00230 BOOL fExit; 00231 PQ pq; 00232 #ifdef MARKPATH 00233 DWORD pathTaken = 0; 00234 00235 #define PATHTAKEN(x) pathTaken |= x 00236 #define DUMPPATHTAKEN() if (gfMarkPath) DbgPrint("xxxInternalGetMessage path:%08x\n", pathTaken) 00237 #else 00238 #define PATHTAKEN(x) 00239 #define DUMPPATHTAKEN() 00240 #endif 00241 00242 CheckCritIn(); 00243 UserAssert(IsWinEventNotifyDeferredOK()); 00244 00245 ptiCurrent = PtiCurrent(); 00246 00247 /* 00248 * PeekMessage accepts NULL, 0x0000FFFF, and -1 as valid HWNDs. 00249 * If hwndFilter is invalid we can't just return FALSE because that will 00250 * hose existing badly behaved apps who might attempt to dispatch 00251 * the random contents of pmsg. 00252 */ 00253 if ((hwndFilter == (HWND)-1) || (hwndFilter == (HWND)0x0000FFFF)) { 00254 hwndFilter = (HWND)1; 00255 } 00256 00257 if ((hwndFilter != NULL) && (hwndFilter != (HWND)1)) { 00258 if ((pwndFilter = ValidateHwnd(hwndFilter)) == NULL) { 00259 lpMsg->hwnd = NULL; 00260 lpMsg->message = WM_NULL; 00261 PATHTAKEN(1); 00262 DUMPPATHTAKEN(); 00263 if (fGetMessage) 00264 return -1; 00265 else 00266 return 0; 00267 } 00268 00269 ThreadLockAlwaysWithPti(ptiCurrent, pwndFilter, &tlpwndFilter); 00270 fLockPwndFilter = TRUE; 00271 00272 } else { 00273 pwndFilter = (PWND)hwndFilter; 00274 fLockPwndFilter = FALSE; 00275 } 00276 00277 /* 00278 * Add one to our spin count. At this end of this routine we'll check 00279 * to see if the spin count gets >= CSPINBACKGROUND. If so we'll put this 00280 * process into the background. 00281 */ 00282 ptiCurrent->pClientInfo->cSpins++; 00283 00284 /* 00285 * Check to see if the startglass is on, and if so turn it off and update. 00286 */ 00287 W32Process = W32GetCurrentProcess(); 00288 if (W32Process->W32PF_Flags & W32PF_STARTGLASS) { 00289 00290 /* 00291 * This app is no longer in "starting" mode. Recalc when to hide 00292 * the app starting cursor. 00293 */ 00294 W32Process->W32PF_Flags &= ~W32PF_STARTGLASS; 00295 /* 00296 * Don't need DeferWinEventNotify() - xxxDoSysExpunge below doesn't 00297 */ 00298 zzzCalcStartCursorHide(NULL, 0); 00299 } 00300 00301 /* 00302 * Next check to see if any .dlls need freeing in 00303 * the context of this client (used for windows hooks). 00304 */ 00305 if (ptiCurrent->ppi->cSysExpunge != gcSysExpunge) { 00306 ptiCurrent->ppi->cSysExpunge = gcSysExpunge; 00307 if (ptiCurrent->ppi->dwhmodLibLoadedMask & gdwSysExpungeMask) 00308 xxxDoSysExpunge(ptiCurrent); 00309 } 00310 00311 /* 00312 * Set up BOOL fRemove local variable from for ReadMessage() 00313 */ 00314 fRemove = flags & PM_REMOVE; 00315 00316 /* 00317 * Unlock the system queue if it's owned by us. 00318 */ 00319 /* 00320 * If we're currently processing a message, unlock the input queue 00321 * because the sender, who is blocked, might be the owner, and in order 00322 * to reply, the receiver may need to read keyboard / mouse input. 00323 */ 00324 /* 00325 * If this thread has the input queue locked and the last message removed 00326 * is the last message we looked at, then unlock - we're ready for anyone 00327 * to get the next message. 00328 */ 00329 pq = ptiCurrent->pq; 00330 if ( (ptiCurrent->psmsCurrent != NULL) 00331 || (pq->ptiSysLock == ptiCurrent && pq->idSysLock == ptiCurrent->idLast) 00332 ) { 00333 CheckSysLock(1, pq, NULL); 00334 pq->ptiSysLock = NULL; 00335 PATHTAKEN(2); 00336 } else if (pq->ptiSysLock 00337 && (pq->ptiSysLock->cVisWindows == 0) 00338 && (PhkFirstGlobalValid(ptiCurrent, WH_JOURNALPLAYBACK) != NULL)) { 00339 /* 00340 * If the thread that has the system queue lock has no windows visible 00341 * (can happen if it just hid its last window), don't expect it to call 00342 * GetMessage() again! - unlock the system queue. --- ScottLu 00343 * This condition creates a hole by which a second thread attached to 00344 * the same queue as thread 1 can alter pq->idSysPeek during a callback 00345 * made by thread 1 so that thread 1 will delete the wrong message 00346 * (losing keystrokes - causing Shift to appear be stuck down editing a 00347 * Graph5 caption embedded in Word32 document #5032. However, MSTEST 00348 * requires this hole, so allow it if Journal Playback is occurring 00349 * #8850 (yes, a hack) Chicago also has this behavior. --- IanJa 00350 */ 00351 CheckSysLock(2, pq, NULL); 00352 pq->ptiSysLock = NULL; 00353 PATHTAKEN(3); 00354 } 00355 if (pq->ptiSysLock != ptiCurrent) { 00356 ptiCurrent->pcti->CTIF_flags &= ~CTIF_SYSQUEUELOCKED; 00357 } 00358 00359 /* 00360 * If msgMax == 0 then msgMax = -1: that makes our range checking only 00361 * have to deal with msgMin < msgMax. 00362 */ 00363 if (msgMax == 0) 00364 msgMax--; 00365 00366 /* 00367 * Compute the QS* mask that corresponds to the message range 00368 * and the wake mask filter (HIWORD(flags)) 00369 */ 00370 fsWakeMask = CalcWakeMask(msgMin, msgMax, HIWORD(flags)); 00371 ptiCurrent->fsChangeBitsRemoved = 0; 00372 00373 /* 00374 * If we can yield and one or more events were skipped, 00375 * set the wakebits for event 00376 */ 00377 if (!(flags & PM_NOYIELD) && ptiCurrent->TIF_flags & TIF_DELAYEDEVENT) { 00378 ptiCurrent->pcti->fsWakeBits |= QS_EVENT; 00379 ptiCurrent->pcti->fsChangeBits |= QS_EVENT; 00380 ptiCurrent->TIF_flags &= ~TIF_DELAYEDEVENT; 00381 ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags; 00382 } 00383 00384 while (TRUE) { 00385 00386 /* 00387 * Restore any wake bits saved while journalling 00388 */ 00389 ptiCurrent->pcti->fsWakeBits |= ptiCurrent->pcti->fsWakeBitsJournal; 00390 00391 /* 00392 * If we need to recalc queue attachments, do it here. Do it on the 00393 * right desktop or else the queues will get created in the wrong 00394 * heap. 00395 */ 00396 if (ptiCurrent->rpdesk == gpdeskRecalcQueueAttach) { 00397 gpdeskRecalcQueueAttach = NULL; 00398 00399 if (ptiCurrent->rpdesk != NULL && !FJOURNALRECORD() && !FJOURNALPLAYBACK()) { 00400 /* 00401 * No need to DeferWinEventNotify(): a call to 00402 * xxxReceiveMessages is made just below 00403 */ 00404 zzzReattachThreads(FALSE); 00405 PATHTAKEN(4); 00406 } 00407 } 00408 00409 /* 00410 * Remember what change bits we're clearing. This is important to 00411 * fix a bug in the input model: If an app receives a sent message 00412 * from within SleepThread(), then does PostMessage() (which sets 00413 * QS_POSTMESSAGE), then does a PeekMessage(...) for some different 00414 * posted message (clears QS_POSTMESSAGE in fsChangeBits), then returns 00415 * back into SleepThread(), it won't wake up to retrieve that newly 00416 * posted message because the change bits are cleared. 00417 * 00418 * What we do is remember the change bits that are being cleared. 00419 * Then, when we return to SleepThread(), we put these remembered 00420 * bits back into the change bits that also have corresponding 00421 * bits in the wakebits (so we don't set changebits that represent 00422 * input that isn't there anymore). This way, the app will retrieve 00423 * the newly posted message refered to earlier. 00424 * - scottlu 00425 * 00426 * New for NT5: Since QS_SENDMESSAGE was never set it fsWakeMask before (NT4), 00427 * it was never cleared from fsChangeBits. For compatibility, we won't clear 00428 * it now even if specified in fsWakeMask; hence we won't affect any one 00429 * checking for QS_SENDMESSAGE in pcti->fsChangeBits. 00430 */ 00431 fsRemoveBits = fsWakeMask & ~QS_SENDMESSAGE; 00432 ptiCurrent->fsChangeBitsRemoved |= ptiCurrent->pcti->fsChangeBits & fsRemoveBits; 00433 00434 /* 00435 * Clear the change bits that we're looking at, in order to detect 00436 * incoming events that may occur the last time we checked the wake 00437 * bits. 00438 */ 00439 ptiCurrent->pcti->fsChangeBits &= ~fsRemoveBits; 00440 00441 /* 00442 * Check for sent messages. Check the the actual wake bits (i.e, from pcti) 00443 * so we know for real. 00444 */ 00445 if (ptiCurrent->pcti->fsWakeBits & fsWakeMask & QS_SENDMESSAGE) { 00446 xxxReceiveMessages(ptiCurrent); 00447 } else if (ptiCurrent->pcti->fsWakeBits & QS_SENDMESSAGE) { 00448 RIPMSG2(RIP_WARNING, "xxxInternalGetMessage:(1st test) sendmsgs pending. Bits:%#lx Mask:%#lx", 00449 ptiCurrent->pcti->fsWakeBits, fsWakeMask); 00450 goto NoMessages; 00451 } 00452 00453 /* 00454 * Check to see if we have any input we want. 00455 */ 00456 if ((ptiCurrent->pcti->fsWakeBits & fsWakeMask) == 0) { 00457 PATHTAKEN(8); 00458 goto NoMessages; 00459 } 00460 fsWakeBits = ptiCurrent->pcti->fsWakeBits; 00461 00462 /* 00463 * If the queue lock is != NULL (ptiSysLock) and it is this thread that 00464 * locked it, then go get the message from the system queue. This is 00465 * to prevent messages posted after a PeekMessage/no-remove from being 00466 * seen before the original message from the system queue. (Aldus 00467 * Pagemaker requires this) (bobgu 8/5/87). 00468 */ 00469 if (ptiCurrent->pq->ptiSysLock == ptiCurrent && 00470 (ptiCurrent->pq->QF_flags & QF_LOCKNOREMOVE)) { 00471 /* 00472 * Does the caller want mouse / keyboard? 00473 */ 00474 if (fsWakeBits & fsWakeMask & (QS_INPUT | QS_EVENT)) { 00475 00476 /* 00477 * It should never get here during exit. 00478 */ 00479 UserAssert(gbExitInProgress == FALSE); 00480 00481 if (xxxScanSysQueue(ptiCurrent, lpMsg, pwndFilter, 00482 msgMin, msgMax, flags, 00483 fsWakeBits & fsWakeMask & (QS_INPUT | QS_EVENT))) { 00484 00485 PATHTAKEN(0x10); 00486 break; 00487 } 00488 } else if (fsWakeBits & QS_EVENT) { 00489 RIPMSG2(RIP_WARNING, 00490 "xxxInternalGetMessage:(1st test)events pending. Bits:%#lx Mask:%#lx", 00491 fsWakeBits, fsWakeMask); 00492 goto NoMessages; 00493 } 00494 } 00495 00496 /* 00497 * See if there's a message in the application queue. 00498 */ 00499 if (fsWakeBits & fsWakeMask & QS_POSTMESSAGE) { 00500 if (xxxReadPostMessage(ptiCurrent, lpMsg, pwndFilter, 00501 msgMin, msgMax, fRemove)) { 00502 PATHTAKEN(0x20); 00503 break; 00504 } 00505 } 00506 00507 /* 00508 * Time to scan the raw input queue for input. First check to see 00509 * if the caller wants mouse / keyboard input. 00510 */ 00511 if (fsWakeBits & fsWakeMask & (QS_INPUT | QS_EVENT)) { 00512 00513 /* 00514 * It should never get here during exit. 00515 */ 00516 UserAssert(gbExitInProgress == FALSE); 00517 00518 if (xxxScanSysQueue(ptiCurrent, lpMsg, pwndFilter, 00519 msgMin, msgMax, flags, 00520 fsWakeBits & fsWakeMask & (QS_INPUT | QS_EVENT))) { 00521 PATHTAKEN(0x40); 00522 break; 00523 } 00524 } else if (fsWakeBits & QS_EVENT) { 00525 RIPMSG2(RIP_WARNING, "xxxInternalGetMessage:(2nd test)events pending. Bits:%#lx Mask:%#lx", 00526 fsWakeBits, fsWakeMask); 00527 goto NoMessages; 00528 } 00529 00530 /* 00531 * Check for sent messages. Check the the actual wake bits (i.e, from pcti) 00532 * so we know for real. 00533 */ 00534 if (ptiCurrent->pcti->fsWakeBits & fsWakeMask & QS_SENDMESSAGE) { 00535 xxxReceiveMessages(ptiCurrent); 00536 } else if (ptiCurrent->pcti->fsWakeBits & QS_SENDMESSAGE) { 00537 RIPMSG2(RIP_WARNING, "xxxInternalGetMessage:(2nd test)sendmsgs pending. Bits:%#lx Mask:%#lx", 00538 ptiCurrent->pcti->fsWakeBits, fsWakeMask); 00539 goto NoMessages; 00540 } 00541 00542 /* 00543 * Get new input bits. 00544 */ 00545 if ((ptiCurrent->pcti->fsWakeBits & fsWakeMask) == 0) { 00546 PATHTAKEN(0x80); 00547 goto NoMessages; 00548 } 00549 fsWakeBits = ptiCurrent->pcti->fsWakeBits; 00550 00551 /* 00552 * Does the caller want paint messages? If so, try to find a paint. 00553 */ 00554 if (fsWakeBits & fsWakeMask & QS_PAINT) { 00555 if (DoPaint(pwndFilter, lpMsg)) { 00556 PATHTAKEN(0x100); 00557 break; 00558 } 00559 } 00560 00561 /* 00562 * We must yield for 16 bit apps before checking timers or an app 00563 * that has a fast timer could chew up all the time and never let 00564 * anyone else run. 00565 * 00566 * NOTE: This could cause PeekMessage() to yield TWICE, if the user 00567 * is filtering with a window handle. If the DoTimer() call fails 00568 * then we end up yielding again. 00569 */ 00570 if (!(flags & PM_NOYIELD)) { 00571 /* 00572 * This is the point where windows would yield. Here we wait to wake 00573 * up any threads waiting for this thread to hit "idle state". 00574 */ 00575 zzzWakeInputIdle(ptiCurrent); 00576 00577 /* 00578 * Yield and receive pending messages. 00579 */ 00580 xxxUserYield(ptiCurrent); 00581 00582 /* 00583 * Check new input buts and receive pending messages. 00584 */ 00585 if (ptiCurrent->pcti->fsWakeBits & fsWakeMask & QS_SENDMESSAGE) { 00586 xxxReceiveMessages(ptiCurrent); 00587 } else if (ptiCurrent->pcti->fsWakeBits & QS_SENDMESSAGE) { 00588 RIPMSG2(RIP_WARNING, "xxxInternalGetMessage:(3rd test) sendmsgs pending. Bits:%#lx Mask:%#lx", 00589 ptiCurrent->pcti->fsWakeBits, fsWakeMask); 00590 goto NoMessages; 00591 } 00592 00593 if ((ptiCurrent->pcti->fsWakeBits & fsWakeMask) == 0) { 00594 00595 PATHTAKEN(0x200); 00596 goto NoMessages; 00597 } 00598 fsWakeBits = ptiCurrent->pcti->fsWakeBits; 00599 } 00600 00601 /* 00602 * Does the app want timer messages, and if there one pending? 00603 */ 00604 if (fsWakeBits & fsWakeMask & QS_TIMER) { 00605 if (DoTimer(pwndFilter)) { 00606 /* 00607 * DoTimer() posted the message into the app's queue, 00608 * so start over and we'll grab it from there. 00609 */ 00610 PATHTAKEN(0x400); 00611 continue; 00612 } 00613 } 00614 00615 NoMessages: 00616 /* 00617 * Looks like we have no input. If we're being called from GetMessage() 00618 * then go to sleep until we find something. 00619 */ 00620 if (!fGetMessage) { 00621 /* 00622 * This is one last check for pending sent messages. It also 00623 * yields. Win3.1 does this. 00624 */ 00625 if (!(flags & PM_NOYIELD)) { 00626 /* 00627 * This is the point where windows yields. Here we wait to wake 00628 * up any threads waiting for this thread to hit "idle state". 00629 */ 00630 zzzWakeInputIdle(ptiCurrent); 00631 00632 /* 00633 * Yield and receive pending messages. 00634 */ 00635 xxxUserYield(ptiCurrent); 00636 } 00637 PATHTAKEN(0x800); 00638 goto FalseExit; 00639 } 00640 00641 /* 00642 * This is a getmessage not a peekmessage, so sleep. When we sleep, 00643 * zzzWakeInputIdle() is called to wake up any apps waiting on this 00644 * app to go idle. 00645 */ 00646 if (!xxxSleepThread(fsWakeMask, 0, TRUE)) 00647 goto FalseExit; 00648 } /* while (TRUE) */ 00649 00650 /* 00651 * If we're here then we have input for this queue. Call the 00652 * GetMessage() hook with this input. 00653 */ 00654 if (IsHooked(ptiCurrent, WHF_GETMESSAGE)) 00655 xxxCallHook(HC_ACTION, flags, (LPARAM)lpMsg, WH_GETMESSAGE); 00656 00657 /* 00658 * If called from PeekMessage(), return TRUE. 00659 */ 00660 if (!fGetMessage) { 00661 PATHTAKEN(0x1000); 00662 goto TrueExit; 00663 } 00664 00665 /* 00666 * Being called from GetMessage(): return FALSE if the message is WM_QUIT, 00667 * TRUE otherwise. 00668 */ 00669 if (lpMsg->message == WM_QUIT) { 00670 PATHTAKEN(0x2000); 00671 goto FalseExit; 00672 } 00673 00674 /* 00675 * Fall through to TrueExit... 00676 */ 00677 00678 TrueExit: 00679 /* 00680 * Update timeLastRead. We use this for hung app calculations. 00681 */ 00682 SET_TIME_LAST_READ(ptiCurrent); 00683 fExit = TRUE; 00684 PATHTAKEN(0x4000); 00685 goto Exit; 00686 00687 FalseExit: 00688 fExit = FALSE; 00689 00690 Exit: 00691 if (fLockPwndFilter) 00692 ThreadUnlock(&tlpwndFilter); 00693 00694 /* 00695 * see CheckProcessBackground() comment above 00696 * Check to see if we need to move this process into background 00697 * priority. 00698 */ 00699 if (ptiCurrent->pClientInfo->cSpins >= CSPINBACKGROUND) { 00700 00701 ptiCurrent->pClientInfo->cSpins = 0; 00702 00703 if (!(ptiCurrent->TIF_flags & TIF_SPINNING)) { 00704 00705 ptiCurrent->TIF_flags |= TIF_SPINNING; 00706 ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags; 00707 00708 if (!(ptiCurrent->ppi->W32PF_Flags & W32PF_FORCEBACKGROUNDPRIORITY)) { 00709 00710 ptiCurrent->ppi->W32PF_Flags |= W32PF_FORCEBACKGROUNDPRIORITY; 00711 00712 if (ptiCurrent->ppi == gppiWantForegroundPriority) { 00713 SetForegroundPriority(ptiCurrent, FALSE); 00714 } 00715 } 00716 } 00717 00718 /* 00719 * For spinning Message loops, we need to take the 16bit-thread out 00720 * of the scheduler temporarily so that other processes can get a chance 00721 * to run. This is appearent in OLE operations where a 16bit foreground 00722 * thread starts an OLE activation on a 32bit process. The 32bit process 00723 * gets starved of CPU while the 16bit thread spins. 00724 */ 00725 if (ptiCurrent->TIF_flags & TIF_16BIT) { 00726 00727 /* 00728 * Take the 16bit thread out of the scheduler. This wakes any 00729 * other 16bit thread needing time, and takes the current thread 00730 * out. We will do a brief sleep so that apps can respond in time. 00731 * When done, we will reschedule the thread. The zzzWakeInputIdle() 00732 * should have been called in the no-messages section, so we have 00733 * already set the Idle-Event. 00734 */ 00735 xxxSleepTask(FALSE, HEVENT_REMOVEME); 00736 00737 LeaveCrit(); 00738 ZwYieldExecution(); 00739 CheckForClientDeath(); 00740 EnterCrit(); 00741 00742 xxxDirectedYield(DY_OLDYIELD); 00743 } 00744 } 00745 00746 PATHTAKEN(0x8000); 00747 DUMPPATHTAKEN(); 00748 return fExit; 00749 }

VOID xxxInternalInvalidate PWND  pwnd,
HRGN  hrgnUpdate,
DWORD  flags
 

Definition at line 1302 of file update.c.

References AnySpbs, CalcWindowRgn(), CheckLock, DSP_ALLCHILDREN, DSP_ENUMCLIPPEDCHILDREN, FALSE, FLayeredOrRedirected(), ghrgnInv1, HRGN_FULL, InternalInvalidate2(), IntersectRect(), IntersectWithParents(), tagWND::rcClient, tagWND::rcWindow, SetEmptyRgn(), SpbCheckRect(), TRUE, UINT, UW_ENUMCHILDREN, VOID(), xxxDoSyncPaint(), and xxxInternalUpdateWindow().

Referenced by CreateRedirectionBitmap(), LockWindowUpdate2(), SpbTransfer(), UserRedrawDesktop(), xxxRedrawHungWindow(), xxxRedrawWindow(), xxxScrollWindowEx(), xxxSystemParametersInfo(), xxxUserChangeDisplaySettings(), and zzzBltValidBits().

01306 { 01307 RECT rcParents; 01308 HRGN hrgnSubtract; 01309 01310 #if DBG 01311 if (flags & (RDW_ERASENOW | RDW_UPDATENOW)) { 01312 CheckLock(pwnd); 01313 } 01314 #endif 01315 01316 /* 01317 * Allow invalidation of a layered window when someone specifically 01318 * invalidates it. This will also prevent invalidation of layered 01319 * windows during recursive desktop invalidations. 01320 */ 01321 if (FLayeredOrRedirected(pwnd)) { 01322 flags |= RDW_INVALIDATELAYERS; 01323 } 01324 01325 /* 01326 * Ensure that hrgnSubtract is a valid region: if it's NULLREGION, 01327 * use the client region. 01328 */ 01329 rcParents = (flags & RDW_FRAME ? pwnd->rcWindow : pwnd->rcClient); 01330 01331 if (flags & (RDW_VALIDATE | RDW_INVALIDATE)) { 01332 01333 hrgnSubtract = hrgnUpdate; 01334 01335 if (hrgnSubtract == HRGN_FULL) { 01336 01337 hrgnSubtract = ghrgnInv1; 01338 CalcWindowRgn(pwnd, 01339 hrgnSubtract, 01340 (flags & RDW_FRAME) ? FALSE : TRUE); 01341 } 01342 01343 /* 01344 * Calculate the bounding rectangle of our screen real estate, 01345 * by intersecting with our parent rectangles. While we're at 01346 * it, check the visibility of ourself and our parents. 01347 * 01348 * If we're validating we want to skip this, since there 01349 * are a number of cases where obscured windows may have 01350 * update regions to be validated -- in particular, after 01351 * a ScrollWindow() call where a child window was offset 01352 * by OffsetChildren() to a new, obscured position. Some of 01353 * the 3.0 compatibility hacks also can lead to this situation. 01354 */ 01355 if ((flags & RDW_INVALIDATE) && !IntersectWithParents(pwnd, &rcParents)) 01356 return; 01357 01358 } else { 01359 /* 01360 * hrgnsubtract needs to be a real region even if 01361 * we are not invalidating or validating. It really doesn't 01362 * matter what the region is, but we set it to null so the code 01363 * has less degrees of freedom. 01364 */ 01365 hrgnSubtract = ghrgnInv1; 01366 SetEmptyRgn(hrgnSubtract); 01367 } 01368 01369 /* 01370 * If we're invalidating, and we're being called by the app, 01371 * we need to invalidate any SPBs that might be affected by 01372 * drawing in the client area of this window. 01373 * We have to do this because there is no guarantee that the 01374 * application will draw in an area that is invalidated 01375 * (e.g., if the window is completely obscured by another). 01376 */ 01377 if ( (flags & (RDW_INVALIDATE | RDW_REDRAWWINDOW)) == (RDW_INVALIDATE | RDW_REDRAWWINDOW) && 01378 AnySpbs()) { 01379 01380 RECT rcInvalid; 01381 01382 /* 01383 * Intersect the parent's rect with the region bounds... 01384 */ 01385 GreGetRgnBox(hrgnSubtract, &rcInvalid); 01386 IntersectRect(&rcInvalid, &rcInvalid, &rcParents); 01387 SpbCheckRect(pwnd, &rcInvalid, 0); 01388 } 01389 01390 /* 01391 * Now go do the recursive update region calculations... 01392 */ 01393 InternalInvalidate2(pwnd, hrgnUpdate, hrgnSubtract, &rcParents, flags); 01394 01395 /* 01396 * Finally handle any needed drawing. 01397 * 01398 * (NOTE: RDW_UPDATENOW implies RDW_ERASENOW) 01399 */ 01400 if (flags & RDW_UPDATENOW) { 01401 01402 xxxInternalUpdateWindow(pwnd, 01403 flags & RDW_NOCHILDREN ? 0 : UW_ENUMCHILDREN); 01404 01405 } else if (flags & RDW_ERASENOW) { 01406 01407 UINT flagsDSP; 01408 01409 if (flags & RDW_NOCHILDREN) { 01410 flagsDSP = 0; 01411 } else if (flags & RDW_ALLCHILDREN) { 01412 flagsDSP = DSP_ALLCHILDREN; 01413 } else { 01414 flagsDSP = DSP_ENUMCLIPPEDCHILDREN; 01415 } 01416 01417 xxxDoSyncPaint(pwnd, flagsDSP); 01418 } 01419 }

VOID xxxInternalKeyEventDirect BYTE  bVk,
WORD  wScan,
DWORD  dwFlags,
DWORD  dwTime,
ULONG_PTR  dwExtraInfo
 

Definition at line 3403 of file ntinput.c.

References tagTHREADINFO::amdesk, ausNumPadCvt, BYTE, dwFlags, tagWINDOWSTATION::dwWSF_Flags, gafRawKeyState, gppiInputProvider, grpdeskRitInput, LOBYTE, tagTHREADINFO::ppi, PtiCurrent, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, RtlAreAllAccessesGranted(), TRUE, USHORT, VKFromVSC(), VOID(), WSF_NOIO, and xxxProcessKeyEvent().

Referenced by xxxSendInput().

03409 { 03410 PTHREADINFO pti = PtiCurrent(); 03411 KE KeyEvent; 03412 03413 /* 03414 * The calling thread must be on the active desktop 03415 * and have journal playback access to that desktop. 03416 */ 03417 if (pti->rpdesk != grpdeskRitInput || 03418 !RtlAreAllAccessesGranted(pti->amdesk, DESKTOP_JOURNALPLAYBACK)) { 03419 03420 RIPNTERR0(STATUS_ACCESS_DENIED, RIP_WARNING, 03421 "Injecting key failed: Non active desktop or access denied"); 03422 03423 return; 03424 } 03425 UserAssert(!(pti->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)); 03426 03427 KeyEvent.bScanCode = (BYTE)wScan; 03428 if (dwFlags & KEYEVENTF_SCANCODE) { 03429 bVk = VKFromVSC(&KeyEvent, 03430 (BYTE)(dwFlags & KEYEVENTF_EXTENDEDKEY ? 0xE0 : 0), 03431 gafRawKeyState); 03432 KeyEvent.usFlaggedVk = (USHORT)bVk; 03433 } else { 03434 KeyEvent.usFlaggedVk = bVk | KBDINJECTEDVK; 03435 } 03436 03437 if (dwFlags & KEYEVENTF_KEYUP) 03438 KeyEvent.usFlaggedVk |= KBDBREAK; 03439 03440 if (dwFlags & KEYEVENTF_UNICODE) { 03441 KeyEvent.usFlaggedVk |= KBDUNICODE; 03442 KeyEvent.wchInjected = wScan; 03443 } else if (dwFlags & KEYEVENTF_EXTENDEDKEY) { 03444 KeyEvent.usFlaggedVk |= KBDEXT; 03445 } else { 03446 // Is it from the numeric keypad? 03447 if (((bVk >= VK_NUMPAD0) && (bVk <= VK_NUMPAD9)) || (bVk == VK_DECIMAL)) { 03448 KeyEvent.usFlaggedVk |= KBDNUMPAD; 03449 } else { 03450 int i; 03451 for (i = 0; ausNumPadCvt[i] != 0; i++) { 03452 if (bVk == LOBYTE(ausNumPadCvt[i])) { 03453 KeyEvent.usFlaggedVk |= KBDNUMPAD; 03454 break; 03455 } 03456 } 03457 } 03458 } 03459 03460 /* 03461 * This process is providing input so it gets the right to 03462 * call SetForegroundWindow 03463 */ 03464 gppiInputProvider = pti->ppi; 03465 03466 KeyEvent.dwTime = dwTime; 03467 xxxProcessKeyEvent(&KeyEvent, dwExtraInfo, TRUE); 03468 }

BOOL xxxInternalPaintDesktop PWND  pwnd,
HDC  hdc,
BOOL  fPaint
 

Definition at line 1615 of file dtbitmap.c.

References _SelectPalette(), BOOL, CheckLock, CopyRect, tagMONITOR::dwMONFlags, FALSE, GetPrimaryMonitor(), ghpalWallpaper, MONF_PALETTEDISPLAY, NULL, OffsetRect(), TRUE, xxxDesktopPaintCallback(), xxxEnumDisplayMonitors(), xxxInvalidateDesktopOnPaletteChange(), and xxxRealizePalette().

Referenced by NtUserPaintDesktop(), xxxDesktopWndProc(), xxxDWP_EraseBkgnd(), xxxRealizeDesktop(), and xxxRedrawHungWindow().

01619 { 01620 BOOL fRet; 01621 01622 CheckLock(pwnd); 01623 01624 if (fPaint) { 01625 RECT rcOrg, rcT; 01626 POINT pt; 01627 01628 /* 01629 * For compatiblity purposes the DC origin of desktop windows 01630 * is set to the primary monitor, i.e. (0,0). Since we may get 01631 * either desktop or non-desktop DCs here, temporarily reset 01632 * the hdc origin to (0,0). 01633 */ 01634 GreGetDCOrgEx(hdc, &pt, &rcOrg); 01635 CopyRect(&rcT, &rcOrg); 01636 OffsetRect(&rcT, -rcT.left, -rcT.top); 01637 GreSetDCOrg(hdc, rcT.left, rcT.top, (PRECTL)&rcT); 01638 01639 fRet = xxxEnumDisplayMonitors( 01640 hdc, 01641 NULL, 01642 (MONITORENUMPROC) xxxDesktopPaintCallback, 01643 (LPARAM)pwnd, 01644 TRUE); 01645 01646 /* 01647 * Reset the DC origin back. 01648 */ 01649 GreSetDCOrg(hdc, rcOrg.left, rcOrg.top, (PRECTL)&rcOrg); 01650 01651 } else if ( ghpalWallpaper && 01652 GetPrimaryMonitor()->dwMONFlags & MONF_PALETTEDISPLAY) { 01653 /* 01654 * Select in the palette if one exists. 01655 */ 01656 HPALETTE hpalT; 01657 int i; 01658 01659 hpalT = _SelectPalette(hdc, ghpalWallpaper, FALSE); 01660 i = xxxRealizePalette(hdc); 01661 _SelectPalette(hdc, hpalT, FALSE); 01662 01663 if (i > 0) { 01664 xxxInvalidateDesktopOnPaletteChange(pwnd); 01665 } 01666 fRet = TRUE; 01667 } 01668 01669 return fRet; 01670 }

int xxxInternalToUnicode UINT  wVirtKey,
UINT  wScanCode,
CONST IN PBYTE  pfvk,
OUT PWCHAR  awchChars,
INT  cChar,
UINT  uiTMFlags,
OUT PDWORD  pdwFlags,
HKL  hkl
 

Referenced by xxxToUnicodeEx(), and xxxTranslateMessage().

LRESULT xxxInterSendMsgEx PWND  ,
UINT  ,
WPARAM  ,
LPARAM  ,
PTHREADINFO  ,
PTHREADINFO  ,
PINTRSENDMSGEX 
 

Definition at line 1296 of file kernel/sendmsg.c.

References AllocSMS(), _LARGE_STRING::bAnsi, BOOL, _LARGE_STRING::Buffer, tagTHREADINFO::cEnterCount, CheckCritIn, CMSHUNGAPPTIMEOUT, DirectedScheduleTask(), tagINTERSENDMSGEX::dwData, DWORD, EFPASSWORD, FALSE, FHungApp(), FNID_EDIT, FreeSMS(), tagCLIENTTHREADINFO::fsChangeBits, tagINTERSENDMSGEX::fuCall, tagINTERSENDMSGEX::fuSend, GETFNID, GETPTI, gpsmsList, INT, IS_SYSTEM_ADDRESS, IsAnsiString, ISM_CALLBACK, ISM_CB_CLIENT, ISM_REPLY, IsUnicodeString, KeSetKernelStackSwapEnable(), _LARGE_STRING::Length, Lock, tagINTERSENDMSGEX::lpdwResult, tagINTERSENDMSGEX::lpResultCallBack, LPVOID, tagINTERSENDMSGEX::lRet, _LARGE_STRING::MaximumLength, _MDICREATESTRUCTEX::mdics, NoString, NtGetTickCount(), NULL, PBYTE, tagTHREADINFO::pcti, PpiCurrent, PSMS, tagTHREADINFO::psmsCurrent, tagTHREADINFO::psmsReceiveList, tagTHREADINFO::psmsSent, PtiCurrent, SetWakeBit(), SMF_CB_CLIENT, SMF_CB_REPLY, SMF_CB_REQUEST, SMF_CB_SERVER, SMF_RECEIVEDMESSAGE, SMF_RECEIVERBUSY, SMF_RECEIVERFREE, SMF_REPLY, _MDICREATESTRUCTEX::strClass, strncpycch(), _MDICREATESTRUCTEX::strTitle, TestWF, TIF_16BIT, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, UINT, UnlinkSendListSms(), tagINTERSENDMSGEX::uTimeout, wcsncpycch(), and xxxSleepThread().

Referenced by _ReplyMessage(), ReceiverDied(), xxxCallHook2(), xxxReceiveMessage(), xxxSendMessageCallback(), and xxxSendMessageTimeout().

01301 : 01302 * 07-13-92 ChrisBl Created/extended from xxxInterSendMsg 01303 \***********************************************************************/ 01304 01305 #define NoString 0 01306 #define IsAnsiString 1 01307 #define IsUnicodeString 2 01308 01309 LRESULT xxxInterSendMsgEx( 01310 PWND pwnd, 01311 UINT message, 01312 WPARAM wParam, 01313 LPARAM lParam, 01314 PTHREADINFO ptiSender, 01315 PTHREADINFO ptiReceiver, 01316 PINTRSENDMSGEX pism) 01317 { 01318 PSMS psms, *ppsms; 01319 PSMS psmsSentSave; 01320 LRESULT lRet = 0; 01321 DWORD cbCapture, cbOutput; 01322 PBYTE lpCapture; 01323 PCOPYDATASTRUCT pcds; 01324 PMDICREATESTRUCTEX pmdics; 01325 LPHLP phlp; 01326 LPHELPINFO phelpinfo; 01327 LARGE_STRING str; 01328 LPARAM lParamSave; 01329 UINT fString = NoString; 01330 BOOLEAN bWasSwapEnabled; 01331 01332 CheckCritIn(); 01333 01334 01335 /* 01336 * If the sender is dying, fail the call 01337 */ 01338 if ((ptiSender != NULL) && (ptiSender->TIF_flags & TIF_INCLEANUP)) 01339 return 0; 01340 01341 /* 01342 * Some messages cannot be sent across process because we don't know how to thunk them 01343 * Fail attempts to read passwords across processes. 01344 */ 01345 if (pwnd && GETPTI(pwnd)->ppi != PpiCurrent()) { 01346 switch (message) { 01347 case WM_NOTIFY: 01348 RIPMSG0(RIP_WARNING | RIP_THERESMORE, "xxxInterSendMsgEx: message cannot be sent across processes"); 01349 RIPMSG4(RIP_WARNING | RIP_THERESMORE, " pwnd:%#p message:%#x wParam:%#p lParam:%#p", pwnd, message, wParam, lParam); 01350 return 0; 01351 01352 case WM_GETTEXT: 01353 case EM_GETLINE: 01354 case EM_SETPASSWORDCHAR: 01355 if ((GETFNID(pwnd) == FNID_EDIT) && TestWF(pwnd, EFPASSWORD)) { 01356 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, "Can't access protected edit control"); 01357 return 0; 01358 } 01359 break; 01360 } 01361 } 01362 01363 /* 01364 * Alloc SMS structure. 01365 */ 01366 psms = AllocSMS(); 01367 if (psms == NULL) { 01368 01369 /* 01370 * Set to zero so xxxSendNotifyMessage would return FALSE. 01371 */ 01372 return 0; 01373 } 01374 01375 /* 01376 * Prepare to capture variable length data from client 01377 * space. Addresses have already been probed. Fixed-length 01378 * data is probed and captured in the message thunk. 01379 */ 01380 psms->pvCapture = NULL; 01381 cbCapture = cbOutput = 0; 01382 lpCapture = (LPBYTE)lParam; 01383 01384 /* 01385 * For messages with indirect data, set cbCapture and lpCapture 01386 * (if not lParam) as approp. 01387 */ 01388 try { 01389 switch (message) { 01390 case WM_COPYGLOBALDATA: // fnCOPYGLOBALDATA 01391 cbCapture = (DWORD)wParam; 01392 break; 01393 01394 case WM_COPYDATA: // fnCOPYDATA 01395 pcds = (PCOPYDATASTRUCT)lParam; 01396 if (pcds->lpData) { 01397 cbCapture = sizeof(COPYDATASTRUCT) + pcds->cbData; 01398 } else { 01399 cbCapture = sizeof(COPYDATASTRUCT); 01400 } 01401 break; 01402 01403 case WM_CREATE: // fnINLPCREATESTRUCT 01404 case WM_NCCREATE: // fnINLPCREATESTRUCT 01405 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, "Can't Intersend WM_CREATE or WM_NCCREATE message"); 01406 FreeSMS(psms); 01407 return 0; 01408 01409 case WM_HELP: // fnINLPHELPINFOSTRUCT 01410 phelpinfo = (LPHELPINFO)lParam; 01411 cbCapture = phelpinfo->cbSize; 01412 break; 01413 01414 case WM_WINHELP: // fnINLPHLPSTRUCT 01415 phlp = (LPHLP)lParam; 01416 cbCapture = phlp->cbData; 01417 break; 01418 01419 case WM_MDICREATE: // fnINLPMDICREATESTRUCT 01420 pmdics = (PMDICREATESTRUCTEX)lParam; 01421 cbCapture = pmdics->strTitle.MaximumLength + 01422 pmdics->strClass.MaximumLength; 01423 UserAssert(pmdics->strClass.Buffer == NULL || pmdics->strClass.Buffer == pmdics->mdics.szClass); 01424 if (pmdics->strTitle.Buffer) 01425 UserAssert(pmdics->strTitle.Buffer == pmdics->mdics.szTitle); 01426 break; 01427 01428 case LB_ADDSTRING: // INLBOXSTRING calls fnINSTRING 01429 case LB_INSERTSTRING: // INLBOXSTRING calls fnINSTRING 01430 case LB_SELECTSTRING: // INLBOXSTRING calls fnINSTRING 01431 case LB_FINDSTRING: // INLBOXSTRING calls fnINSTRING 01432 case LB_FINDSTRINGEXACT: // INLBOXSTRING calls fnINSTRING 01433 /* 01434 * See if the control is ownerdraw and does not have the LBS_HASSTRINGS 01435 * style. If so, treat lParam as a DWORD. 01436 */ 01437 if (pwnd && !(pwnd->style & LBS_HASSTRINGS) && 01438 (pwnd->style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE))) { 01439 /* 01440 * Treat lParam as a dword. 01441 */ 01442 break; 01443 } else { 01444 goto fnINSTRINGThunk; 01445 } 01446 break; 01447 01448 case CB_ADDSTRING: // INCBOXSTRING calls fnINSTRING 01449 case CB_INSERTSTRING: // INCBOXSTRING calls fnINSTRING 01450 case CB_SELECTSTRING: // INCBOXSTRING calls fnINSTRING 01451 case CB_FINDSTRING: // INCBOXSTRING calls fnINSTRING 01452 case CB_FINDSTRINGEXACT: // INCBOXSTRING calls fnINSTRING 01453 /* 01454 * See if the control is ownerdraw and does not have the CBS_HASSTRINGS 01455 * style. If so, treat lParam as a DWORD. 01456 */ 01457 if (pwnd && !(pwnd->style & CBS_HASSTRINGS) && 01458 (pwnd->style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))) { 01459 01460 /* 01461 * Treat lParam as a dword. 01462 */ 01463 break; 01464 } else { 01465 goto fnINSTRINGThunk; 01466 } 01467 break; 01468 01469 case EM_REPLACESEL: // fnINSTRINGNULL 01470 case WM_SETTEXT: // fnINSTRINGNULL 01471 case WM_WININICHANGE: // fnINSTRINGNULL 01472 if (lParam == 0) 01473 break; 01474 01475 /* 01476 * Fall through 01477 */ 01478 01479 case CB_DIR: // fnINSTRING 01480 case LB_ADDFILE: // fnINSTRING 01481 case LB_DIR: // fnINSTRING 01482 case WM_DEVMODECHANGE: // fnINSTRING 01483 fnINSTRINGThunk: 01484 01485 /* 01486 * Only capture strings if they are not in system space 01487 */ 01488 str = *(PLARGE_STRING)lParam; 01489 lParam = (LPARAM)&str; 01490 01491 if (!IS_SYSTEM_ADDRESS(str.Buffer)) 01492 cbCapture = str.Length + sizeof(WCHAR); 01493 break; 01494 01495 case WM_DEVICECHANGE: 01496 if (lParam == 0) 01497 break; 01498 01499 /* 01500 * Only capture data if lParam is a pointer and 01501 * the data is not in system space 01502 */ 01503 if ((wParam & 0x8000) != 0x8000) 01504 break; 01505 01506 if (!IS_SYSTEM_ADDRESS((LPVOID)lParam)) { 01507 cbCapture = *((DWORD *)lpCapture); 01508 UserAssert(FALSE); 01509 } 01510 break; 01511 01512 case EM_SETTABSTOPS: // fnPOPTINLPUINT 01513 case LB_SETTABSTOPS: // fnPOPTINLPUINT 01514 case LB_GETSELITEMS: // fnPOUTLPINT 01515 cbCapture = (UINT)wParam * sizeof(INT); 01516 break; 01517 01518 case EM_GETLINE: // fnINCNTOUTSTRING 01519 case WM_ASKCBFORMATNAME: // fnINCNTOUTSTRINGNULL 01520 case WM_GETTEXT: // fnOUTSTRING 01521 case LB_GETTEXT: // fnOUTLBOXSTRING 01522 case CB_GETLBTEXT: // fnOUTCBOXSTRING 01523 01524 /* 01525 * Only allocate output buffer if the real one is not in system space 01526 */ 01527 str = *(PLARGE_STRING)lParam; 01528 /* 01529 * Bug 18108. For WM_GETTEXT only copy the actual string and not the 01530 * the maximum size into the output buffer 01531 */ 01532 if(str.bAnsi) { 01533 fString = IsAnsiString ; 01534 } else { 01535 fString = IsUnicodeString ; 01536 } 01537 lParam = (LPARAM)&str; 01538 if (!IS_SYSTEM_ADDRESS(str.Buffer)) 01539 cbCapture = str.MaximumLength; 01540 break; 01541 } 01542 if (cbCapture && 01543 (psms->pvCapture = UserAllocPoolWithQuota(cbCapture, TAG_SMS_CAPTURE)) != NULL) { 01544 01545 lParamSave = lParam; 01546 01547 /* 01548 * now actually copy memory from lpCapture to psms->pvCapture 01549 * and fixup any references to the indirect data to point to 01550 * psms->pvCapture. 01551 */ 01552 switch (message) { 01553 case WM_COPYDATA: // fnCOPYDATA 01554 { 01555 PCOPYDATASTRUCT pcdsNew = (PCOPYDATASTRUCT)psms->pvCapture; 01556 lParam = (LPARAM)pcdsNew; 01557 RtlCopyMemory(pcdsNew, pcds, sizeof(COPYDATASTRUCT)); 01558 if (pcds->lpData) { 01559 pcdsNew->lpData = (PVOID)((PBYTE)pcdsNew + sizeof(COPYDATASTRUCT)); 01560 RtlCopyMemory(pcdsNew->lpData, pcds->lpData, pcds->cbData); 01561 } 01562 } 01563 break; 01564 case WM_MDICREATE: // fnINLPMDICREATESTRUCT 01565 if (pmdics->strClass.Buffer) { 01566 RtlCopyMemory(psms->pvCapture, pmdics->strClass.Buffer, 01567 pmdics->strClass.MaximumLength); 01568 pmdics->mdics.szClass = (LPWSTR)psms->pvCapture; 01569 } 01570 if (pmdics->strTitle.Length) { 01571 lpCapture = (PBYTE)psms->pvCapture + pmdics->strClass.MaximumLength; 01572 RtlCopyMemory(lpCapture, pmdics->strTitle.Buffer, 01573 pmdics->strTitle.MaximumLength); 01574 pmdics->mdics.szTitle = (LPWSTR)lpCapture; 01575 } 01576 break; 01577 01578 case CB_DIR: // fnINSTRING 01579 case LB_FINDSTRING: // INLBOXSTRING calls fnINSTRING 01580 case LB_FINDSTRINGEXACT: // INLBOXSTRING calls fnINSTRING 01581 case CB_FINDSTRING: // INCBOXSTRING calls fnINSTRING 01582 case CB_FINDSTRINGEXACT: // INCBOXSTRING calls fnINSTRING 01583 case LB_ADDFILE: // fnINSTRING 01584 case LB_ADDSTRING: // INLBOXSTRING calls fnINSTRING 01585 case LB_INSERTSTRING: // INLBOXSTRING calls fnINSTRING 01586 case LB_SELECTSTRING: // INLBOXSTRING calls fnINSTRING 01587 case CB_ADDSTRING: // INCBOXSTRING calls fnINSTRING 01588 case CB_INSERTSTRING: // INCBOXSTRING calls fnINSTRING 01589 case CB_SELECTSTRING: // INCBOXSTRING calls fnINSTRING 01590 case LB_DIR: // fnINSTRING 01591 case WM_DEVMODECHANGE: // fnINSTRING 01592 case EM_REPLACESEL: // fnINSTRINGNULL 01593 case WM_SETTEXT: // fnINSTRINGNULL 01594 case WM_WININICHANGE: // fnINSTRINGNULL 01595 RtlCopyMemory(psms->pvCapture, str.Buffer, cbCapture); 01596 str.Buffer = psms->pvCapture; 01597 break; 01598 01599 case LB_GETSELITEMS: 01600 cbOutput = cbCapture; 01601 RtlCopyMemory(psms->pvCapture, lpCapture, cbCapture); 01602 lParam = (LPARAM)psms->pvCapture; 01603 break; 01604 01605 case EM_GETLINE: // fnINCNTOUTSTRING 01606 *(WORD *)psms->pvCapture = *(WORD *)str.Buffer; 01607 01608 /* 01609 * Fall through 01610 */ 01611 case WM_ASKCBFORMATNAME: // fnINCNTOUTSTRINGNULL 01612 case WM_GETTEXT: // fnOUTSTRING 01613 case LB_GETTEXT: // fnOUTLBOXSTRING 01614 case CB_GETLBTEXT: // fnOUTCBOXSTRING 01615 cbOutput = cbCapture; 01616 lParamSave = (LPARAM)str.Buffer; 01617 str.Buffer = psms->pvCapture; 01618 break; 01619 01620 default: 01621 RtlCopyMemory(psms->pvCapture, lpCapture, cbCapture); 01622 lParam = (LPARAM)psms->pvCapture; 01623 break; 01624 } 01625 } 01626 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01627 if (psms->pvCapture != NULL) 01628 UserFreePool(psms->pvCapture); 01629 FreeSMS(psms); 01630 return 0; 01631 } 01632 01633 if (cbCapture && psms->pvCapture == NULL) { 01634 FreeSMS(psms); 01635 return 0; 01636 } 01637 01638 /* 01639 * Copy message parms 01640 */ 01641 psms->spwnd = NULL; 01642 psms->psmsReceiveNext = NULL; 01643 #if DBG 01644 psms->psmsSendList = NULL; 01645 psms->psmsSendNext = NULL; 01646 #endif 01647 Lock(&(psms->spwnd), pwnd); 01648 psms->message = message; 01649 psms->wParam = wParam; 01650 psms->lParam = lParam; 01651 psms->flags = 0; 01652 01653 /* 01654 * Link into gpsmsList 01655 */ 01656 psms->psmsNext = gpsmsList; 01657 gpsmsList = psms; 01658 01659 /* 01660 * Time stamp message 01661 */ 01662 psms->tSent = NtGetTickCount(); 01663 01664 /* 01665 * Set queue fields 01666 */ 01667 psms->ptiReceiver = ptiReceiver; 01668 psms->ptiSender = ptiSender; 01669 psms->ptiCallBackSender = NULL; 01670 01671 if ((pism != NULL) && (pism->fuCall & ISM_CALLBACK)) { 01672 /* 01673 * Setup for a SendMessageCallback 01674 */ 01675 psms->flags |= (pism->fuCall & ISM_CB_CLIENT) ? SMF_CB_CLIENT : SMF_CB_SERVER; 01676 psms->lpResultCallBack = pism->lpResultCallBack; 01677 psms->dwData = pism->dwData; 01678 01679 if (pism->fuCall & ISM_REPLY) { 01680 psms->flags |= SMF_CB_REPLY; 01681 psms->lRet = pism->lRet; 01682 } else { /* REQUEST */ 01683 psms->flags |= SMF_CB_REQUEST; 01684 psms->ptiCallBackSender = PtiCurrent(); 01685 } 01686 } 01687 01688 /* 01689 * Add SMS to the end of the ptiReceiver's receive list 01690 */ 01691 ppsms = &ptiReceiver->psmsReceiveList; 01692 while (*ppsms != NULL) { 01693 ppsms = &((*ppsms)->psmsReceiveNext); 01694 } 01695 *ppsms = psms; 01696 01697 /* 01698 * Link this SMS into the SendMsg chain. Of course only do this if 01699 * it's not from a xxxSendNotifyMessage() call. 01700 * 01701 * The psmsSendNext field implements a chain of messages being 01702 * processed because of an initial SendMsg call. For example, if 01703 * thread A sends message M1 to thread B, which causes B to send 01704 * message M2 to thread C, the SendMsg chain is M1->M2. If the 01705 * system hangs in this situation, the chain is traversed to find 01706 * the offending thread (C). 01707 * 01708 * psms->psmsSendList always points to the head of this list so 01709 * we can tell where to begin a list traversal. 01710 * 01711 * ptiSender->psmsCurrent is the last SMS in the chain. 01712 */ 01713 #if DBG 01714 if (ptiSender != NULL && ptiSender->psmsCurrent != NULL) { 01715 /* 01716 * sending queue is currently processing a message sent to it, 01717 * so append SMS to the chain. Link in the new sms because 01718 * psmsSendNext may be pointing to a replied-to message. 01719 */ 01720 psms->psmsSendNext = ptiSender->psmsCurrent->psmsSendNext; 01721 ptiSender->psmsCurrent->psmsSendNext = psms; 01722 psms->psmsSendList = ptiSender->psmsCurrent->psmsSendList; 01723 01724 } else { 01725 /* 01726 * sending queue is initiating a send sequence, so put sms at 01727 * the head of the chain 01728 */ 01729 psms->psmsSendList = psms; 01730 } 01731 #endif 01732 01733 if (ptiSender != NULL) { 01734 /* 01735 * ptiSender->psmsSent marks the most recent message sent from this 01736 * thread that has not yet been replied to. Save the previous value 01737 * on the stack so it can be restored when we get the reply. 01738 * 01739 * This way when an "older" SMS for this thread gets a reply before 01740 * the "current" one does, the thread does get woken up. 01741 */ 01742 psmsSentSave = ptiSender->psmsSent; 01743 ptiSender->psmsSent = psms; 01744 } else { 01745 01746 /* 01747 * Set SMF_RECEIVERFREE since we'll be returning to 01748 * xxxSendNotifyMessage() right away and won't get a 01749 * chance to free it. 01750 */ 01751 psms->flags |= SMF_RECEIVERFREE; 01752 } 01753 01754 #ifdef DEBUG_SMS 01755 ValidateSmsSendLists(psms); 01756 #endif 01757 01758 /* 01759 * If we're not being called from xxxSendNotifyMessage() or 01760 * SendMessageCallback(), then sleep while we wait for the reply. 01761 */ 01762 if (ptiSender == NULL) { 01763 /* 01764 * Wake receiver for the sent message 01765 */ 01766 SetWakeBit(ptiReceiver, QS_SENDMESSAGE); 01767 01768 return (LONG)TRUE; 01769 } else { 01770 BOOL fTimeOut = FALSE; 01771 UINT uTimeout = 0; 01772 UINT uWakeMask = QS_SMSREPLY; 01773 01774 /* 01775 * Wake up the receiver thread. 01776 */ 01777 SetWakeBit(ptiReceiver, QS_SENDMESSAGE); 01778 01779 /* 01780 * We have 4 sending cases: 01781 * 01782 * 16 - 16 : yield to the 16 bit receiver 01783 * 32 - 16 : no yielding required 01784 * 16 - 32 : sender yields while receiver processes the message 01785 * 32 - 32 : no yielding required. 01786 */ 01787 if (ptiSender->TIF_flags & TIF_16BIT || ptiReceiver->TIF_flags & TIF_16BIT) { 01788 DirectedScheduleTask(ptiSender, ptiReceiver, TRUE, psms); 01789 } 01790 01791 /* 01792 * Put this thread to sleep until the reply arrives. First clear 01793 * the QS_SMSREPLY bit, then leave the semaphore and go to sleep. 01794 * 01795 * IMPORTANT: The QS_SMSREPLY bit is not cleared once we get a 01796 * reply because of the following case: 01797 * 01798 * We've recursed a second level into SendMessage() when the first level 01799 * receiver thread dies, causing exit list processing to simulate 01800 * a reply to the first message. When the second level send returns, 01801 * SleepThread() is called again to get the first reply. 01802 * 01803 * Keeping QS_SMSREPLY set causes this call to SleepThread() 01804 * to return without going to sleep to wait for the reply that has 01805 * already happened. 01806 */ 01807 if ( pism != NULL ) { 01808 if (pism->fuSend & SMTO_BLOCK) { 01809 /* 01810 * only wait for a return, all other events will 01811 * be ignored until timeout or return 01812 */ 01813 uWakeMask |= QS_EXCLUSIVE; 01814 } 01815 01816 uTimeout = pism->uTimeout; 01817 } 01818 01819 01820 /* 01821 * Don't swap this guys stack while sleeping during a sendmessage 01822 */ 01823 if (ptiSender->cEnterCount == 0) { 01824 bWasSwapEnabled = KeSetKernelStackSwapEnable(FALSE); 01825 } else { 01826 UserAssert(ptiSender->cEnterCount > 0); 01827 } 01828 ptiSender->cEnterCount++; 01829 01830 01831 while (!(psms->flags & SMF_REPLY) && !fTimeOut) { 01832 ptiSender->pcti->fsChangeBits &= ~QS_SMSREPLY; 01833 01834 /* 01835 * If SendMessageTimeout, sleep for timeout amount, else wait 01836 * forever. Since this is not technically a transition to an 01837 * idle condition, indicate that this sleep is not going "idle". 01838 */ 01839 fTimeOut = !xxxSleepThread(uWakeMask, uTimeout, FALSE); 01840 /* 01841 * If a timeout occurs, and the SMTO_NOTIMEOUTIFNOTHUNG bit is set, 01842 * and the app is still calling GetMessage(), then just try again. 01843 * This probably means that the receiver has put up some UI in 01844 * response to this message but the user hasn't completed the 01845 * interaction yet. 01846 */ 01847 if (fTimeOut && pism && (pism->fuSend & SMTO_NOTIMEOUTIFNOTHUNG) && 01848 !FHungApp(ptiReceiver, CMSHUNGAPPTIMEOUT)) { 01849 fTimeOut = FALSE; 01850 } 01851 } 01852 01853 UserAssert(ptiSender->cEnterCount > 0); 01854 if (--ptiSender->cEnterCount == 0) { 01855 KeSetKernelStackSwapEnable(bWasSwapEnabled); 01856 } 01857 01858 /* 01859 * The reply bit should always be set! (even if we timed out). That 01860 * is because if we're recursed into intersendmsg, we're going to 01861 * return to the first intersendmsg's call to SleepThread() - and 01862 * it needs to return back to intersendmsgex to see if its sms 01863 * has been replied to. 01864 */ 01865 SetWakeBit(ptiSender, QS_SMSREPLY); 01866 01867 /* 01868 * Copy out captured data. If cbOutput != 0 we know 01869 * that the output buffer is in user-mode address 01870 * space. 01871 */ 01872 if (!fTimeOut && cbOutput) { 01873 PBYTE pbOutput; 01874 INT len; 01875 01876 /* 01877 * Probe output buffer if it is in the user's address space 01878 */ 01879 01880 pbOutput = (PBYTE)lParamSave; 01881 try { 01882 if(fString == NoString) { 01883 RtlCopyMemory((PBYTE)pbOutput, psms->pvCapture, 01884 cbOutput); 01885 } else if(fString == IsAnsiString) { 01886 len = strncpycch((LPSTR)pbOutput,(LPCSTR)psms->pvCapture, 01887 cbOutput); 01888 #if DBG 01889 len--; //Length includes terminating NULL char 01890 if(len != psms->lRet) { 01891 RIPMSG0(RIP_WARNING, 01892 "Length of the copied string being returned is diffrent from the actual string length"); 01893 } 01894 #endif 01895 } else { //IsUnicodeString 01896 len = wcsncpycch((LPWSTR)pbOutput,(LPCWSTR)psms->pvCapture, 01897 cbOutput/sizeof(WCHAR)); 01898 #if DBG 01899 len--; 01900 if(len != psms->lRet) { 01901 RIPMSG0(RIP_WARNING, 01902 "Length of the copied string being returned is diffrent from the actual string length"); 01903 } 01904 #endif 01905 } 01906 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01907 01908 /* 01909 * Return 0 to indicate an error. 01910 */ 01911 psms->lRet = 0; 01912 } 01913 } 01914 01915 /* 01916 * we now have the reply -- restore psmsSent and save the return value 01917 */ 01918 ptiSender->psmsSent = psmsSentSave; 01919 01920 if (pism == NULL) { 01921 lRet = psms->lRet; 01922 } else { 01923 /* 01924 * save the values off for a SendMesssageTimeOut 01925 */ 01926 *pism->lpdwResult = psms->lRet; 01927 lRet = (!fTimeOut) ? TRUE : FALSE; /* do this to ensure ret is T or F... */ 01928 01929 /* 01930 * If we did timeout and no reply was received, rely on 01931 * the receiver to free the sms. 01932 */ 01933 if (!(psms->flags & SMF_REPLY)) 01934 psms->flags |= SMF_REPLY | SMF_RECEIVERFREE; 01935 } 01936 01937 /* 01938 * If the reply came while the receiver is still processing 01939 * the sms, force the receiver to free the sms. This can occur 01940 * via timeout, ReplyMessage or journal cancel. 01941 */ 01942 if ((psms->flags & (SMF_RECEIVERBUSY | SMF_RECEIVEDMESSAGE)) != 01943 SMF_RECEIVEDMESSAGE) { 01944 psms->flags |= SMF_RECEIVERFREE; 01945 } 01946 01947 /* 01948 * Unlink the SMS structure from both the SendMsg chain and gpsmsList * list and free it. This sms could be anywhere in the chain.

BOOL xxxInvalidateRect PWND  pwnd,
LPRECT  lprc,
BOOL  fErase
 

Definition at line 39 of file update.c.

References BOOL, CheckLock, NULL, and xxxRedrawWindow().

Referenced by NtUserInvalidateRect(), xxxEnableSBCtlArrows(), xxxMNSetGapState(), xxxMNSetTop(), and xxxMNUpdateShownMenu().

00043 { 00044 CheckLock(pwnd); 00045 00046 /* 00047 * BACKWARD COMPATIBILITY HACK 00048 * 00049 * In Windows 3.0 and less, ValidateRect/InvalidateRect() call with 00050 * hwnd == NULL always INVALIDATED and ERASED the entire desktop, and 00051 * synchronously sent WM_ERASEBKGND and WM_NCPAINT messages before 00052 * returning. The Rgn() calls did not have this behavior. 00053 */ 00054 if (pwnd == NULL) { 00055 return xxxRedrawWindow( 00056 pwnd, 00057 NULL, 00058 NULL, 00059 RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW); 00060 } else { 00061 return xxxRedrawWindow( 00062 pwnd, 00063 lprcInvalid, 00064 NULL, 00065 fErase ? RDW_INVALIDATE | RDW_ERASE : RDW_INVALIDATE); 00066 } 00067 }

BOOL xxxInvalidateRgn PWND  pwnd,
HRGN  hrgn,
BOOL  fErase
 

Definition at line 110 of file update.c.

References BOOL, CheckLock, NULL, and xxxRedrawWindow().

Referenced by NtUserInvalidateRgn().

00114 { 00115 CheckLock(pwnd); 00116 00117 return xxxRedrawWindow( 00118 pwnd, 00119 NULL, 00120 hrgnInvalid, 00121 fErase ? RDW_INVALIDATE | RDW_ERASE : RDW_INVALIDATE); 00122 }

BOOL xxxIsDragging PWND  pwnd,
POINT  ptScreen,
UINT  uMsg
 

Definition at line 354 of file dragdrop.c.

References _GetKeyState(), BOOL, FALSE, InflateRect(), msg, NULL, tagTHREADINFO::pq, PtiCurrent, PtInRect(), tagQ::spwndCapture, SYSMET, ThreadLockWithPti, ThreadUnlock, TRUE, xxxCallHook(), xxxPeekMessage, xxxReleaseCapture(), xxxSetCapture(), and xxxSleepThread().

Referenced by xxxDragDetect(), and xxxSysCommand().

00355 { 00356 RECT rc; 00357 MSG msg; 00358 BOOL fDragging; 00359 BOOL fCheck; 00360 TL tlpwndDragging; 00361 PTHREADINFO pti = PtiCurrent(); 00362 00363 /* 00364 * Check synchronous mouse state, and punt if the mouse isn't down 00365 * according to the queue. 00366 */ 00367 if (!(_GetKeyState((uMsg == WM_LBUTTONUP ? VK_LBUTTON : VK_RBUTTON)) & 0x8000)) 00368 return FALSE; 00369 00370 xxxSetCapture(pwnd); 00371 00372 *(LPPOINT)&rc.left = ptScreen; 00373 *(LPPOINT)&rc.right = ptScreen; 00374 InflateRect(&rc, SYSMET(CXDRAG), SYSMET(CYDRAG)); 00375 00376 fDragging = FALSE; 00377 fCheck = TRUE; 00378 00379 ThreadLockWithPti(pti, pwnd, &tlpwndDragging); 00380 while (fCheck) { 00381 while ( !( 00382 xxxPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST,PM_REMOVE) || 00383 xxxPeekMessage(&msg, NULL, WM_QUEUESYNC, WM_QUEUESYNC,PM_REMOVE) || 00384 xxxPeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST,PM_REMOVE) 00385 ) 00386 && (pti->pq->spwndCapture == pwnd)) { 00387 /* 00388 * If there is no input for half a second (500ms) consider that 00389 * we are dragging. If we don't specify a timeout value, the 00390 * thread may sleep here forever and wouldn't repaint, etc. 00391 */ 00392 if (!xxxSleepThread(QS_MOUSE | QS_KEY, 500, TRUE)) { 00393 fDragging = TRUE; 00394 goto Cleanup; 00395 } 00396 } 00397 00398 /* 00399 * Cancel if the button was released or we no longer have the capture. 00400 */ 00401 if ( pti->pq->spwndCapture != pwnd || msg.message == uMsg) { 00402 fCheck = FALSE; 00403 } else { 00404 switch (msg.message) { 00405 00406 case WM_MOUSEMOVE: 00407 if (!PtInRect(&rc, msg.pt)) { 00408 fDragging = TRUE; 00409 fCheck = FALSE; 00410 } 00411 break; 00412 00413 case WM_QUEUESYNC: 00414 /* 00415 * CBT Hook needs to know 00416 */ 00417 xxxCallHook(HCBT_QS, 0, 0, WH_CBT); 00418 break; 00419 00420 case WM_KEYDOWN: 00421 /* 00422 * <Esc> cancels drag detection 00423 */ 00424 if (msg.wParam == VK_ESCAPE) 00425 fCheck = FALSE; 00426 break; 00427 00428 } 00429 } 00430 } 00431 00432 Cleanup: 00433 if (pti->pq->spwndCapture == pwnd) 00434 xxxReleaseCapture(); 00435 00436 ThreadUnlock(&tlpwndDragging); 00437 return fDragging ; 00438 }

BOOL xxxKELocaleProcs PKE  pke  ) 
 

Definition at line 662 of file xlate.c.

References BOOL, CheckCritIn, FALSE, gbAltGrDown, gdwKeyboardAttributes, gpKbdTbl, TRUE, xxxAltGr(), and xxxShiftLock().

Referenced by xxxProcessKeyEvent().

00663 { 00664 CheckCritIn(); 00665 00666 /* 00667 * AltGr is a layout-specific behavior 00668 * Modifier keys are sent up as necessary in xxxInternalActivateKeyboardLayout 00669 * (#139178), so left-Ctrl won't be left stuck down if we switch from an 00670 * AltGr keyboard to a non-AltGr keybord while the AltGr is held down. 00671 */ 00672 if ((gpKbdTbl->fLocaleFlags & KLLF_ALTGR) || gbAltGrDown) { 00673 if (!xxxAltGr(pKe)) { 00674 return FALSE; 00675 } 00676 } 00677 00678 /* 00679 * ShiftLock/CapsLock is per-user (global) behavior as well as (for 00680 * backward compatibility) per-layout behavior. 00681 */ 00682 if ((gdwKeyboardAttributes & KLLF_SHIFTLOCK) || 00683 (gpKbdTbl->fLocaleFlags & KLLF_SHIFTLOCK)) { 00684 if (!xxxShiftLock(pKe)) { 00685 return FALSE; 00686 } 00687 } 00688 00689 /* 00690 * Other special Key Event processors 00691 */ 00692 00693 return TRUE; 00694 }

BOOL xxxKENLSProcs PKE  pke,
ULONG_PTR  dwExtraInformation
 

Definition at line 1004 of file fekbd.c.

References aNLSVKFProc, BOOL, CheckCritIn, gpKbdNlsTbl, LOBYTE, NULL, TRUE, and UINT.

Referenced by xxxProcessKeyEvent().

01005 { 01006 01007 CheckCritIn(); 01008 01009 if (gpKbdNlsTbl != NULL) { 01010 PVK_F pVkToF = gpKbdNlsTbl->pVkToF; 01011 UINT iNumVk = gpKbdNlsTbl->NumOfVkToF; 01012 01013 while(iNumVk) { 01014 if (pVkToF[iNumVk-1].Vk == LOBYTE(pKe->usFlaggedVk)) { 01015 return((aNLSVKFProc[pVkToF[iNumVk-1].NLSFEProcType]) 01016 (&(pVkToF[iNumVk-1]),pKe,dwExtraInfo)); 01017 } 01018 iNumVk--; 01019 } 01020 } 01021 /* 01022 * Other special Key Event processors 01023 */ 01024 return TRUE; 01025 }

VOID xxxKeyEvent USHORT  usVk,
WORD  wScanCode,
DWORD  time,
ULONG_PTR  ExtraInfo,
BOOL  bInjected
 

Definition at line 1338 of file ntinput.c.

References BOOL, BYTE, CheckCritIn, DWORD, FALSE, FJOURNALPLAYBACK, FJOURNALRECORD, tagTHREADINFO::fsReserveKeys, GetActiveHKL(), GETPTI, gfEnableHexNumpad, gfInNumpadHexInput, gfsSASModifiersDown, glinp, gppiLockSFW, gpqForeground, gpsi, gptiBlockInput, gptiForeground, gptiRit, gspwndActivate, gspwndAltTab, HIBYTE, IsHexNumpadKeys(), IsHotKey(), IsSAS(), tagQ::mlInput, MODIFIER_FOR_ALT_NUMPAD, tagQMSG::msg, msg, NULL, NUMPAD_HEXMODE_LL, PhkFirstValid(), PostEventMessage(), PostInputMessage(), PostMove(), tagTHREADINFO::pq, tagMLIST::pqmsgWriteLast, PtiCurrent, tagQ::ptiKeyboard, tagLASTINPUT::ptiLastWoken, QEVENT_APPCOMMAND, tagQ::QF_flags, QF_MOUSEMOVED, QF_TABSWITCHING, SCANCODE_NUMPAD_DOT, SCANCODE_NUMPAD_PLUS, SFW_ACTIVATERESTORE, SFW_SWITCH, TestAsyncKeyStateDown, TestRawKeyDown, TestWF, ThreadLockAlways, ThreadUnlock, TRUE, UINT, Unlock, UpdateAsyncKeyState(), UpdateKeyLights(), USHORT, VKTOMODIFIERS, VOID(), WakeSomeone(), WFCHILD, xxxCallHook2(), xxxCancelCoolSwitch(), xxxDoHotKeyStuff(), xxxNextWindow(), xxxSetForegroundWindow2(), and xxxSetWindowPos().

Referenced by NlsAlphanumericModeProc(), NlsCodeInputToggleProc(), NlsHiraganaModeProc(), NlsKatakanaModeProc(), NlsRomanToggleProc(), NlsSbcsDbcsToggleProc(), xxxAltGr(), xxxICO_00(), xxxNumpadCursor(), xxxProcessKeyEvent(), xxxPushKeyEvent(), xxxShiftLock(), and xxxSimulateShiftF10().

01344 { 01345 USHORT message, usExtraStuff; 01346 BOOL fBreak; 01347 BYTE VkHanded; 01348 BYTE Vk; 01349 TL tlpwndActivate; 01350 DWORD fsReserveKeys; 01351 static BOOL fMakeAltUpASysKey; 01352 PHOOK pHook; 01353 PTHREADINFO ptiCurrent = PtiCurrent(); 01354 01355 CheckCritIn(); 01356 01357 fBreak = usFlaggedVk & KBDBREAK; 01358 gpsi->bLastRITWasKeyboard = TRUE; 01359 01360 /* 01361 * Is this a keyup or keydown event? 01362 */ 01363 message = fBreak ? WM_KEYUP : WM_KEYDOWN; 01364 01365 VkHanded = (BYTE)usFlaggedVk; // get rid of state bits - no longer needed 01366 usExtraStuff = usFlaggedVk & KBDEXT; 01367 01368 /* 01369 * Convert Left/Right Ctrl/Shift/Alt key to "unhanded" key. 01370 * ie: if VK_LCONTROL or VK_RCONTROL, convert to VK_CONTROL etc. 01371 * Update this "unhanded" key's state if necessary. 01372 */ 01373 if ((VkHanded >= VK_LSHIFT) && (VkHanded <= VK_RMENU)) { 01374 BYTE VkOtherHand = VkHanded ^ 1; 01375 01376 Vk = (BYTE)((VkHanded - VK_LSHIFT) / 2 + VK_SHIFT); 01377 if (!fBreak || !TestAsyncKeyStateDown(VkOtherHand)) { 01378 if ((gptiBlockInput == NULL) || (gptiBlockInput != ptiCurrent)) { 01379 UpdateAsyncKeyState(gpqForeground, Vk, fBreak); 01380 } 01381 } 01382 } else { 01383 Vk = VkHanded; 01384 } 01385 01386 /* 01387 * Maintain gfsSASModifiersDown to indicate which of Ctrl/Shift/Alt 01388 * are really truly physically down 01389 */ 01390 if (!bInjected && ((wScanCode & SCANCODE_SIMULATED) == 0)) { 01391 if (fBreak) { 01392 gfsSASModifiersDown &= ~VKTOMODIFIERS(Vk); 01393 } else { 01394 gfsSASModifiersDown |= VKTOMODIFIERS(Vk); 01395 } 01396 } 01397 01398 /* 01399 * Call low level keyboard hook to see if it allows this 01400 * message to pass 01401 */ 01402 if ((pHook = PhkFirstValid(ptiCurrent, WH_KEYBOARD_LL)) != NULL) { 01403 KBDLLHOOKSTRUCT kbds; 01404 BOOL bAnsiHook; 01405 USHORT msg = message; 01406 01407 /* 01408 * Check if this is a WM_SYS* message 01409 */ 01410 if (TestRawKeyDown(VK_MENU) && 01411 !TestRawKeyDown(VK_CONTROL)) { 01412 01413 msg += (WM_SYSKEYDOWN - WM_KEYDOWN); 01414 usExtraStuff |= 0x2000; // ALT key down 01415 } 01416 kbds.vkCode = (DWORD)VkHanded; 01417 kbds.scanCode = (DWORD)wScanCode; 01418 kbds.flags = HIBYTE(usExtraStuff | (bInjected ? (LLKHF_INJECTED << 8) : 0)); 01419 kbds.flags |= (fBreak ? (KBDBREAK >> 8) : 0); 01420 kbds.time = time; 01421 kbds.dwExtraInfo = ExtraInfo; 01422 01423 if (xxxCallHook2(pHook, HC_ACTION, (DWORD)msg, (LPARAM)&kbds, &bAnsiHook)) { 01424 01425 UINT fsModifiers; 01426 01427 /* 01428 * We can't let low level hooks or BlockInput() eat SAS 01429 * or someone could write a trojan winlogon look alike. 01430 */ 01431 if (IsSAS(VkHanded, &fsModifiers)) { 01432 RIPMSG0(RIP_WARNING, "xxxKeyEvent: SAS ignore bad response from low level hook"); 01433 } else { 01434 return; 01435 } 01436 } 01437 } 01438 01439 /* 01440 * If someone is blocking input and it's not us, don't allow this input 01441 */ 01442 if (gptiBlockInput && (gptiBlockInput != ptiCurrent)) { 01443 UINT fsModifiers; 01444 if (IsSAS(VkHanded, &fsModifiers)) { 01445 RIPMSG0(RIP_WARNING, "xxxKeyEvent: SAS unblocks BlockInput"); 01446 gptiBlockInput = NULL; 01447 } else { 01448 return; 01449 } 01450 } 01451 01452 UpdateAsyncKeyState(gpqForeground, VkHanded, fBreak); 01453 01454 /* 01455 * Clear gfInNumpadHexInput if Menu key is up. 01456 */ 01457 if (gfEnableHexNumpad) { 01458 if (!TestAsyncKeyStateDown(VK_MENU)) { 01459 if (gfInNumpadHexInput & NUMPAD_HEXMODE_LL) { 01460 gfInNumpadHexInput &= ~NUMPAD_HEXMODE_LL; 01461 } 01462 } else { 01463 if (!fBreak) { // if it's key down 01464 if ((gfInNumpadHexInput & NUMPAD_HEXMODE_LL) || 01465 wScanCode == SCANCODE_NUMPAD_PLUS || wScanCode == SCANCODE_NUMPAD_DOT) { 01466 if ((usExtraStuff & KBDEXT) == 0) { 01467 /* 01468 * We need to check whether the input is escape character 01469 * of hex input mode. 01470 * This should be equivalent code as in xxxInternalToUnicode(). 01471 * If you change this code, you may need to change 01472 * xxxInternalToUnicode() as well. 01473 */ 01474 WORD wModBits = 0; 01475 01476 wModBits |= TestAsyncKeyStateDown(VK_MENU) ? KBDALT : 0; 01477 wModBits |= TestAsyncKeyStateDown(VK_SHIFT) ? KBDSHIFT : 0; 01478 wModBits |= TestAsyncKeyStateDown(VK_KANA) ? KBDKANA : 0; 01479 01480 if (MODIFIER_FOR_ALT_NUMPAD(wModBits)) { 01481 if ((gfInNumpadHexInput & NUMPAD_HEXMODE_LL) == 0) { 01482 /* 01483 * Only if it's not a hotkey, we enter hex Alt+Numpad mode. 01484 */ 01485 UINT wHotKeyMod = 0; 01486 01487 wHotKeyMod |= (wModBits & KBDSHIFT) ? MOD_SHIFT : 0; 01488 wHotKeyMod |= TestAsyncKeyStateDown(VK_CONTROL) ? MOD_CONTROL : 0; 01489 UserAssert(wModBits & KBDALT); 01490 wHotKeyMod |= MOD_ALT; 01491 wHotKeyMod |= TestAsyncKeyStateDown(VK_LWIN) || TestAsyncKeyStateDown(VK_RWIN) ? 01492 MOD_WIN : 0; 01493 01494 if (IsHotKey(wHotKeyMod, Vk) == NULL) { 01495 UserAssert(wScanCode == SCANCODE_NUMPAD_PLUS || wScanCode == SCANCODE_NUMPAD_DOT); 01496 gfInNumpadHexInput |= NUMPAD_HEXMODE_LL; 01497 } 01498 } else if (!IsHexNumpadKeys(Vk, wScanCode)) { 01499 gfInNumpadHexInput &= ~NUMPAD_HEXMODE_LL; 01500 } 01501 } else { 01502 gfInNumpadHexInput &= ~NUMPAD_HEXMODE_LL; 01503 } 01504 } else { 01505 gfInNumpadHexInput &= ~NUMPAD_HEXMODE_LL; 01506 } 01507 } else { 01508 UserAssert((gfInNumpadHexInput & NUMPAD_HEXMODE_LL) == 0); 01509 } 01510 } 01511 } 01512 } 01513 01514 /* 01515 * If this is a make and the key is one linked to the keyboard LEDs, 01516 * update their state. 01517 */ 01518 01519 if (!fBreak && 01520 ((Vk == VK_CAPITAL) || (Vk == VK_NUMLOCK) || (Vk == VK_SCROLL) || 01521 (Vk == VK_KANA && JAPANESE_KBD_LAYOUT(GetActiveHKL())))) { 01522 /* 01523 * Only Japanese keyboard layout could generate VK_KANA. 01524 * 01525 * [Comments for before] 01526 * Since NT 3.x, UpdatesKeyLisghts() had been called for VK_KANA 01527 * at both of 'make' and 'break' to support NEC PC-9800 Series 01528 * keyboard hardware, but for NT 4.0, thier keyboard driver emurate 01529 * PC/AT keyboard hardware, then this is changed to 01530 * "Call UpdateKeyLights() only at 'make' for VK_KANA" 01531 */ 01532 UpdateKeyLights(bInjected); 01533 } 01534 01535 /* 01536 * check for reserved keys 01537 */ 01538 fsReserveKeys = 0; 01539 if (gptiForeground != NULL) 01540 fsReserveKeys = gptiForeground->fsReserveKeys; 01541 01542 /* 01543 * Check the RIT's queue to see if it's doing the cool switch thing. 01544 * Cancel if the user presses any other key. 01545 */ 01546 if (gspwndAltTab != NULL && (!fBreak) && 01547 Vk != VK_TAB && Vk != VK_SHIFT && Vk != VK_MENU) { 01548 01549 /* 01550 * Remove the Alt-tab window 01551 */ 01552 xxxCancelCoolSwitch(); 01553 01554 /* 01555 * eat VK_ESCAPE if the app doesn't want it 01556 */ 01557 if ((Vk == VK_ESCAPE) && !(fsReserveKeys & CONSOLE_ALTESC)) { 01558 return; 01559 } 01560 } 01561 01562 /* 01563 * Check for hotkeys. 01564 */ 01565 if (xxxDoHotKeyStuff(Vk, fBreak, fsReserveKeys)) { 01566 01567 /* 01568 * The hotkey was processed so don't pass on the event. 01569 */ 01570 return; 01571 } 01572 01573 /* 01574 * If the ALT key is down and the CTRL key 01575 * isn't, this is a WM_SYS* message. 01576 */ 01577 if (TestAsyncKeyStateDown(VK_MENU) && !TestAsyncKeyStateDown(VK_CONTROL) && Vk != VK_JUNJA) { 01578 // VK_JUNJA is ALT+'+'. Since all KOR VKs are not converted to IME hotkey IDs and 01579 // should be passed directly to IME, KOR related VKs are not treated as SYSKEYDOWN. 01580 message += (WM_SYSKEYDOWN - WM_KEYDOWN); 01581 usExtraStuff |= 0x2000; 01582 01583 /* 01584 * If this is the ALT-down set this flag, otherwise 01585 * clear it since we got a key inbetween the ALT-down 01586 * and ALT-up. (see comment below) 01587 */ 01588 if (Vk == VK_MENU) { 01589 fMakeAltUpASysKey = TRUE; 01590 /* 01591 * Unlock SetForegroundWindow (if locked) when the ALT key went down. 01592 */ 01593 if (!fBreak) { 01594 gppiLockSFW = NULL; 01595 } 01596 } else { 01597 fMakeAltUpASysKey = FALSE; 01598 } 01599 01600 } else if (Vk == VK_MENU) { 01601 if (fBreak) { 01602 /* 01603 * End our switch if we are in the middle of one. 01604 */ 01605 if (fMakeAltUpASysKey) { 01606 01607 /* 01608 * We don't make the keyup of the ALT key a WM_SYSKEYUP if any 01609 * other key is typed while the ALT key was down. I don't know 01610 * why we do this, but it's been here since version 1 and any 01611 * app that uses SDM relies on it (eg - opus). 01612 * 01613 * The Alt bit is not set for the KEYUP message either. 01614 */ 01615 message += (WM_SYSKEYDOWN - WM_KEYDOWN); 01616 } 01617 01618 if (gspwndAltTab != NULL) { 01619 01620 /* 01621 * Send the alt up message before we change queues 01622 */ 01623 if (gpqForeground != NULL) { 01624 01625 /* 01626 * Set this flag so that we know we're doing a tab-switch. 01627 * This makes sure that both cases where the ALT-KEY is released 01628 * before or after the TAB-KEY is handled. It is checked in 01629 * xxxDefWindowProc(). 01630 */ 01631 gpqForeground->QF_flags |= QF_TABSWITCHING; 01632 01633 PostInputMessage(gpqForeground, NULL, message, (DWORD)Vk, 01634 MAKELONG(1, (wScanCode | usExtraStuff)), 01635 time, ExtraInfo); 01636 } 01637 01638 /* 01639 * Remove the Alt-tab window 01640 */ 01641 xxxCancelCoolSwitch(); 01642 01643 if (gspwndActivate != NULL) { 01644 /* 01645 * Make our selected window active and destroy our 01646 * switch window. If the new window is minmized, 01647 * restore it. If we are switching in the same 01648 * queue, we clear out gpqForeground to make 01649 * xxxSetForegroundWindow2 to change the pwnd 01650 * and make the switch. This case will happen 01651 * with WOW and Console apps. 01652 */ 01653 if (gpqForeground == GETPTI(gspwndActivate)->pq) { 01654 gpqForeground = NULL; 01655 } 01656 01657 /* 01658 * Make the selected window thread the owner of the last input; 01659 * since the user has selected him, he owns the ALT-TAB. 01660 */ 01661 glinp.ptiLastWoken = GETPTI(gspwndActivate); 01662 01663 01664 ThreadLockAlways(gspwndActivate, &tlpwndActivate); 01665 xxxSetForegroundWindow2(gspwndActivate, NULL, 01666 SFW_SWITCH | SFW_ACTIVATERESTORE); 01667 /* 01668 * Win3.1 calls SetWindowPos() with activate, which z-orders 01669 * first regardless, then activates. Our code relies on 01670 * xxxActivateThisWindow() to z-order, and it'll only do 01671 * it if the window does not have the child bit set (regardless 01672 * that the window is a child of the desktop). 01673 * 01674 * To be compatible, we'll just force z-order here if the 01675 * window has the child bit set. This z-order is asynchronous, 01676 * so this'll z-order after the activate event is processed. 01677 * That'll allow it to come on top because it'll be foreground 01678 * then. (Grammatik has a top level window with the child 01679 * bit set that wants to be come the active window). 01680 */ 01681 if (TestWF(gspwndActivate, WFCHILD)) { 01682 xxxSetWindowPos(gspwndActivate, (PWND)HWND_TOP, 0, 0, 0, 0, 01683 SWP_NOSIZE | SWP_NOMOVE | SWP_ASYNCWINDOWPOS); 01684 } 01685 ThreadUnlock(&tlpwndActivate); 01686 01687 Unlock(&gspwndActivate); 01688 } 01689 return; 01690 } 01691 } else { 01692 /* 01693 * The ALT key is down, unlock SetForegroundWindow (if locked) 01694 */ 01695 gppiLockSFW = NULL; 01696 } 01697 } 01698 01699 /* 01700 * Handle switching. Eat the Key if we are doing switching. 01701 */ 01702 if (!FJOURNALPLAYBACK() && !FJOURNALRECORD() && (!fBreak) && 01703 (TestAsyncKeyStateDown(VK_MENU)) && 01704 (!TestAsyncKeyStateDown(VK_CONTROL)) && //gpqForeground && 01705 (((Vk == VK_TAB) && !(fsReserveKeys & CONSOLE_ALTTAB)) || 01706 ((Vk == VK_ESCAPE) && !(fsReserveKeys & CONSOLE_ALTESC)))) { 01707 01708 xxxNextWindow(gpqForeground ? gpqForeground : gptiRit->pq, Vk); 01709 01710 } else if (gpqForeground != NULL) { 01711 PQMSG pqmsgPrev = gpqForeground->mlInput.pqmsgWriteLast; 01712 DWORD wParam = (DWORD)Vk; 01713 LONG lParam; 01714 01715 /* 01716 * We have a packet containing a Unicode character 01717 * This is injected by Pen via SendInput 01718 */ 01719 if ((Vk == VK_PACKET) && (usFlaggedVk & KBDUNICODE)) { 01720 wParam |= (wScanCode << 16); 01721 wScanCode = 0; 01722 } 01723 lParam = MAKELONG(1, (wScanCode | usExtraStuff)); 01724 01725 /* 01726 * WM_*KEYDOWN messages are left unchanged on the queue except the 01727 * repeat count field (LOWORD(lParam)) is incremented. 01728 */ 01729 if (pqmsgPrev != NULL && 01730 pqmsgPrev->msg.message == message && 01731 (message == WM_KEYDOWN || message == WM_SYSKEYDOWN) && 01732 pqmsgPrev->msg.wParam == wParam && 01733 HIWORD(pqmsgPrev->msg.lParam) == HIWORD(lParam)) { 01734 /* 01735 * Increment the queued message's repeat count. This could 01736 * conceivably overflow but Win 3.0 doesn't deal with it 01737 * and anyone who buffers up 65536 keystrokes is a chimp 01738 * and deserves to have it wrap anyway. 01739 */ 01740 pqmsgPrev->msg.lParam = MAKELONG(LOWORD(pqmsgPrev->msg.lParam) + 1, 01741 HIWORD(lParam)); 01742 01743 WakeSomeone(gpqForeground, message, pqmsgPrev); 01744 01745 } else { 01746 /* 01747 * check if these are speedracer keys - bug 339877 01748 * for the speedracer keys we want to post an event message and generate the 01749 * wm_appcommand in xxxprocesseventmessage 01750 * Since SpeedRacer software looks for the hotkeys we want to let those through 01751 * It is going in here since we don't want the ability to eat up tons of pool memory 01752 * so we post the event message here and then post the input message for the wm_keydown 01753 * below - that way if the key is repeated then there is coalescing done above and no more 01754 * qevent_appcommands are posted to the input queue. 01755 */ 01756 if (VK_APPCOMMAND_FIRST <= Vk && Vk <= VK_APPCOMMAND_LAST) { 01757 /* 01758 * Only send wm_appcommands for wm_keydown (& wm_syskeydown) messages - 01759 * essentially we ignore wm_keyup for those vk's defined for wm_appcommand messages 01760 */ 01761 if (!fBreak && gpqForeground) { 01762 /* 01763 * post an event message so we can syncronize with normal types of input 01764 * send through the vk - we will construct the message in xxxProcessEventMessage 01765 */ 01766 PostEventMessage(gpqForeground->ptiKeyboard, gpqForeground, QEVENT_APPCOMMAND, 01767 NULL, 0, (WPARAM)0, Vk); 01768 } 01769 } 01770 /* 01771 * We let the key go through since we want wm_keydowns/ups to get generated for these 01772 * SpeedRacer keys 01773 */ 01774 01775 if (gpqForeground->QF_flags & QF_MOUSEMOVED) { 01776 PostMove(gpqForeground); 01777 } 01778 01779 PostInputMessage(gpqForeground, NULL, message, wParam, 01780 lParam, time, ExtraInfo); 01781 } 01782 } 01783 }

HANDLE xxxLoadHmodIndex int  iatom,
BOOL  bWx86KnownDll
 

Definition at line 192 of file libmgmt.c.

References aatomSysLoaded, acatomSysUse, tagPROCESSINFO::ahmodLibLoaded, catomSysTableEntries, ClientFreeLibrary(), ClientLoadLibrary(), gptiRit, MAX_PATH, NULL, tagTHREADINFO::ppi, PtiCurrent, RtlInitUnicodeString(), SETHMODLOADED, TESTHMODLOADED, and UserGetAtomName().

Referenced by xxxCallHook2(), and xxxGetEventProc().

00195 { 00196 WCHAR pszLibName[MAX_PATH]; 00197 HANDLE hmod; 00198 UNICODE_STRING strLibrary; 00199 PTHREADINFO ptiCurrent = PtiCurrent(); 00200 00201 UserAssert((!gptiRit || gptiRit->ppi != PtiCurrent()->ppi) && 00202 "Shouldn't load global hooks on system process - gptiRit->ppi is the system process"); 00203 00204 if (iatom >= catomSysTableEntries) { 00205 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Index out of range"); 00206 return NULL; 00207 } 00208 00209 UserGetAtomName(aatomSysLoaded[iatom], pszLibName, sizeof(pszLibName)/sizeof(WCHAR)); 00210 00211 /* 00212 * Call back the client to load the library. 00213 */ 00214 RtlInitUnicodeString(&strLibrary, pszLibName); 00215 hmod = ClientLoadLibrary(&strLibrary, bWx86KnownDll); 00216 00217 if (hmod != NULL) { 00218 /* 00219 * Check to make sure another thread hasn't loaded this library 00220 * while we were outside the critical section. 00221 */ 00222 if (!TESTHMODLOADED(ptiCurrent, iatom)) { 00223 /* 00224 * Go ahead and bump the reference count. 00225 */ 00226 acatomSysUse[iatom]++; 00227 SETHMODLOADED(ptiCurrent, iatom, hmod); 00228 00229 } else { 00230 /* 00231 * Another thread loaded it while we were outside the 00232 * critical section. Unload it so the system's 00233 * reference count is correct. 00234 */ 00235 ClientFreeLibrary(ptiCurrent->ppi->ahmodLibLoaded[iatom]); 00236 } 00237 } 00238 00239 return hmod; 00240 }

HKL xxxLoadKeyboardLayoutEx PWINDOWSTATION  ,
HANDLE  ,
HKL  ,
UINT  ,
LPCWSTR  ,
UINT  ,
UINT 
 

Definition at line 654 of file kbdlyout.c.

References _HANDLEENTRY::bFlags, BOOL, BYTE, tagKL::CodePage, tagKL::dwFontSigs, tagKL::dwKL_Flags, tagWINDOWSTATION::dwWSF_Flags, FALSE, gLCIDSentToShell, gpidLogon, gspklBaseLayout, gSystemCPCharSet, gSystemFS, HANDLEF_DESTROY, HANDLEF_MARKED_OK, tagKBDFILE::hBase, tagKL::hkl, HKLtoPKL(), HMAllocObject(), HMMarkObjectDestroy(), HMPheFromObject, HMUnlockObject, tagKL::iBaseCharset, IS_IME_KBDLAYOUT, IsHooked, KL_UNLOADED, LoadKeyboardLayoutFile(), Lock, NULL, tagKL::piiex, tagKBDFILE::pKbdTbl, tagKL::pklNext, tagKL::pklPrev, PtiCurrent, ReorderKeyboardLayouts(), RtlInitUnicodeString(), RtlUnicodeStringToInteger(), tagKL::spkf, tagWINDOWSTATION::spklList, ThreadLockAlwaysWithPti, ThreadUnlock, TYPE_KBDLAYOUT, tagKL::wchDiacritic, WHF_SHELL, WSF_NOIO, xxxCallHook(), xxxClientGetCharsetInfo(), xxxFreeImeKeyboardLayouts(), xxxFreeKeyboardLayouts(), xxxImmLoadLayout(), xxxInternalActivateKeyboardLayout(), xxxInternalUnloadKeyboardLayout(), and xxxSetPKLinThreads().

Referenced by NtUserLoadKeyboardLayoutEx(), and xxxCreateWindowStation().

00662 { 00663 PKL pkl, pklFirst, pklToBeReplaced; 00664 PKBDFILE pkf; 00665 CHARSETINFO cs; 00666 TL tlpkl; 00667 PTHREADINFO ptiCurrent; 00668 UNICODE_STRING strLcidKF; 00669 LCID lcidKF; 00670 BOOL bCharSet; 00671 PIMEINFOEX piiex; 00672 00673 /* 00674 * If the windowstation does not do I/O, don't load the 00675 * layout. Also check KdbInputLocale for #307132 00676 */ 00677 if ((KbdInputLocale == 0) || (pwinsta->dwWSF_Flags & WSF_NOIO)) { 00678 return NULL; 00679 } 00680 00681 /* 00682 * If hklToBeReplaced is non-NULL make sure it's valid. 00683 * NOTE: may want to verify they're not passing HKL_NEXT or HKL_PREV. 00684 */ 00685 ptiCurrent = PtiCurrent(); 00686 if (hklToBeReplaced && !(pklToBeReplaced = HKLtoPKL(ptiCurrent, hklToBeReplaced))) { 00687 return NULL; 00688 } 00689 if (KbdInputLocale == HandleToUlong(hklToBeReplaced)) { 00690 /* 00691 * Replacing a layout/lang pair with itself. Nothing to do. 00692 */ 00693 return pklToBeReplaced->hkl; 00694 } 00695 00696 if (Flags & KLF_RESET) { 00697 /* 00698 * Only WinLogon can use this flag 00699 */ 00700 if (ptiCurrent->pEThread->Cid.UniqueProcess != gpidLogon) { 00701 RIPERR0(ERROR_INVALID_FLAGS, RIP_WARNING, 00702 "Invalid flag passed to LoadKeyboardLayout" ); 00703 return NULL; 00704 } 00705 xxxFreeImeKeyboardLayouts(pwinsta); 00706 /* 00707 * Make sure we don't lose track of the left-over layouts 00708 * They have been unloaded, but are still in use by some threads). 00709 * The FALSE will prevent xxxFreeKeyboardLayouts from unlocking the 00710 * unloaded layouts. 00711 */ 00712 xxxFreeKeyboardLayouts(pwinsta, FALSE); 00713 } 00714 00715 /* 00716 * Does this hkl already exist? 00717 */ 00718 pkl = pklFirst = pwinsta->spklList; 00719 00720 if (pkl) { 00721 do { 00722 if (pkl->hkl == (HKL)IntToPtr( KbdInputLocale )) { 00723 /* 00724 * The hkl already exists. 00725 */ 00726 00727 /* 00728 * If it is unloaded (but not yet destroyed because it is 00729 * still is use), recover it. 00730 */ 00731 if (pkl->dwKL_Flags & KL_UNLOADED) { 00732 // stop it from being destroyed if not is use. 00733 PHE phe = HMPheFromObject(pkl); 00734 // An unloaded layout must be marked for destroy. 00735 UserAssert(phe->bFlags & HANDLEF_DESTROY); 00736 phe->bFlags &= ~HANDLEF_DESTROY; 00737 #if DBG 00738 phe->bFlags &= ~HANDLEF_MARKED_OK; 00739 #endif 00740 pkl->dwKL_Flags &= ~KL_UNLOADED; 00741 } else if (!(Flags & KLF_RESET)) { 00742 /* 00743 * If it was already loaded and we didn't change all layouts 00744 * with KLF_RESET, there is nothing to tell the shell about 00745 */ 00746 Flags &= ~KLF_NOTELLSHELL; 00747 } 00748 00749 goto AllPresentAndCorrectSir; 00750 } 00751 pkl = pkl->pklNext; 00752 } while (pkl != pklFirst); 00753 } 00754 00755 if (IS_IME_KBDLAYOUT((HKL)IntToPtr( KbdInputLocale ))) { 00756 /* 00757 * This is an IME keyboard layout, do a callback 00758 * to read the extended IME information structure. 00759 * Note: We can't fail the call so easily if 00760 * KLF_RESET is specified. 00761 */ 00762 piiex = xxxImmLoadLayout((HKL)IntToPtr( KbdInputLocale )); 00763 if (piiex == NULL && !(Flags & KLF_RESET)) { 00764 RIPMSG1(RIP_WARNING, 00765 "Keyboard Layout: xxxImmLoadLayout(%lx) failed", KbdInputLocale); 00766 return NULL; 00767 } 00768 } else { 00769 piiex = NULL; 00770 } 00771 00772 /* 00773 * Get the system font's font signature. These are 64-bit FS_xxx values, 00774 * but we are only asking for an ANSI ones, so gSystemFS is just a DWORD. 00775 * gSystemFS is consulted when posting WM_INPUTLANGCHANGEREQUEST (input.c) 00776 */ 00777 if (gSystemFS == 0) { 00778 LCID lcid; 00779 00780 ZwQueryDefaultLocale(FALSE, &lcid); 00781 if (xxxClientGetCharsetInfo(lcid, &cs)) { 00782 gSystemFS = cs.fs.fsCsb[0]; 00783 gSystemCPCharSet = (BYTE)cs.ciCharset; 00784 } else { 00785 gSystemFS = 0xFFFF; 00786 gSystemCPCharSet = ANSI_CHARSET; 00787 } 00788 } 00789 00790 /* 00791 * Use the Keyboard Layout's LCID to calculate the charset, codepage etc, 00792 * so that characters from that layout don't just becomes ?s if the input 00793 * locale doesn't match. This allows "dumb" applications to display the 00794 * text if the user chooses the right font. 00795 * We can't just use the HIWORD of KbdInputLocale because if a variant 00796 * keyboard layout was chosen, this will be something like F008 - have to 00797 * look inside the KF to get the real LCID of the kbdfile: this will be 00798 * something like L"00010419", and we want the last 4 digits. 00799 */ 00800 RtlInitUnicodeString(&strLcidKF, pwszKLID + 4); 00801 RtlUnicodeStringToInteger(&strLcidKF, 16, (PULONG)&lcidKF); 00802 bCharSet = xxxClientGetCharsetInfo(lcidKF, &cs); 00803 00804 /* 00805 * Keyboard Layout Handle object does not exist. Load keyboard layout file, 00806 * if not already loaded. 00807 */ 00808 if (!(pkf = LoadKeyboardLayoutFile(hFile, offTable, pwszKLID))) { 00809 goto freePiiex; 00810 } 00811 /* 00812 * Allocate a new Keyboard Layout structure (hkl) 00813 */ 00814 pkl = (PKL)HMAllocObject(NULL, NULL, TYPE_KBDLAYOUT, sizeof(KL)); 00815 if (!pkl) { 00816 RIPMSG0(RIP_WARNING, "Keyboard Layout: out of memory"); 00817 UserFreePool(pkf->hBase); 00818 HMMarkObjectDestroy(pkf); 00819 HMUnlockObject(pkf); 00820 freePiiex: 00821 if (piiex) { 00822 UserFreePool(piiex); 00823 } 00824 return NULL; 00825 } 00826 00827 /* 00828 * Link to itself in case we have to DestroyKL 00829 */ 00830 pkl->pklNext = pkl; 00831 pkl->pklPrev = pkl; 00832 00833 /* 00834 * Init KL 00835 */ 00836 pkl->dwKL_Flags = 0; 00837 pkl->wchDiacritic = 0; 00838 pkl->hkl = (HKL)IntToPtr( KbdInputLocale ); 00839 Lock(&pkl->spkf, pkf); 00840 00841 pkl->spkf->pKbdTbl->fLocaleFlags |= KLL_LAYOUT_ATTR_FROM_KLF(Flags); 00842 00843 pkl->piiex = piiex; 00844 00845 if (bCharSet) { 00846 pkl->CodePage = (WORD)cs.ciACP; 00847 pkl->dwFontSigs = cs.fs.fsCsb[1]; // font signature mask (FS_xxx values) 00848 pkl->iBaseCharset = cs.ciCharset; // charset value 00849 } else { 00850 pkl->CodePage = CP_ACP; 00851 pkl->dwFontSigs = FS_LATIN1; 00852 pkl->iBaseCharset = ANSI_CHARSET; 00853 } 00854 00855 /* 00856 * Insert KL in the double-linked circular list, at the end. 00857 */ 00858 pklFirst = pwinsta->spklList; 00859 if (pklFirst == NULL) { 00860 Lock(&pwinsta->spklList, pkl); 00861 } else { 00862 pkl->pklNext = pklFirst; 00863 pkl->pklPrev = pklFirst->pklPrev; 00864 pklFirst->pklPrev->pklNext = pkl; 00865 pklFirst->pklPrev = pkl; 00866 } 00867 00868 AllPresentAndCorrectSir: 00869 00870 // FE_IME 00871 ThreadLockAlwaysWithPti(ptiCurrent, pkl, &tlpkl); 00872 00873 if (hklToBeReplaced) { 00874 TL tlPKLToBeReplaced; 00875 ThreadLockAlwaysWithPti(ptiCurrent, pklToBeReplaced, &tlPKLToBeReplaced); 00876 xxxSetPKLinThreads(pkl, pklToBeReplaced); 00877 xxxInternalUnloadKeyboardLayout(pwinsta, pklToBeReplaced, KLF_INITTIME); 00878 ThreadUnlock(&tlPKLToBeReplaced); 00879 } 00880 00881 if (Flags & KLF_REORDER) { 00882 ReorderKeyboardLayouts(pwinsta, pkl); 00883 } 00884 00885 if (!(Flags & KLF_NOTELLSHELL) && IsHooked(PtiCurrent(), WHF_SHELL)) { 00886 xxxCallHook(HSHELL_LANGUAGE, (WPARAM)NULL, (LPARAM)0, WH_SHELL); 00887 gLCIDSentToShell = 0; 00888 } 00889 00890 if (Flags & KLF_ACTIVATE) { 00891 TL tlPKL; 00892 ThreadLockAlwaysWithPti(ptiCurrent, pkl, &tlPKL); 00893 xxxInternalActivateKeyboardLayout(pkl, Flags, NULL); 00894 ThreadUnlock(&tlPKL); 00895 } 00896 00897 if (Flags & KLF_RESET) { 00898 RIPMSG2(RIP_VERBOSE, "Flag & KLF_RESET, locking gspklBaseLayout(%08x) with new kl(%08x)", 00899 gspklBaseLayout ? gspklBaseLayout->hkl : 0, 00900 pkl->hkl); 00901 Lock(&gspklBaseLayout, pkl); 00902 xxxSetPKLinThreads(pkl, NULL); 00903 } 00904 00905 /* 00906 * Use the hkl as the layout handle 00907 * If the KL is freed somehow, return NULL for safety. -- ianja -- 00908 */ 00909 pkl = ThreadUnlock(&tlpkl); 00910 if (pkl == NULL) { 00911 return NULL; 00912 } 00913 return pkl->hkl; 00914 }

PMENU xxxLoadSysDesktopMenu PMENU ppmenu,
UINT  uMenuId
 

Definition at line 30 of file mnsys.c.

References _DestroyMenu(), LockDesktopMenu(), MFSYSMENU, NULL, SetMF, TestMF, and xxxLoadSysMenu().

Referenced by xxxGetSysMenuHandle(), xxxSetDialogSystemMenu(), and xxxTranslateAccelerator().

00031 { 00032 PMENU pmenu; 00033 /* 00034 * This should only be called when the menu hasn't been loaded 00035 */ 00036 UserAssert(*ppmenu == NULL); 00037 00038 pmenu = xxxLoadSysMenu(uMenuId); 00039 if (pmenu == NULL) { 00040 return NULL; 00041 } 00042 /* 00043 * If someone beat us loading the menu, destroy this one 00044 * and return the one already loaded 00045 */ 00046 if (*ppmenu != NULL) { 00047 UserAssert(TestMF(*ppmenu, MFSYSMENU)); 00048 RIPMSG1(RIP_WARNING, 00049 "LoadSysDesktopMenu: Menu loaded during callback. ppmenu:%#p", 00050 ppmenu); 00051 _DestroyMenu(pmenu); 00052 return *ppmenu; 00053 } 00054 /* 00055 * Mark it, lock it and done 00056 */ 00057 SetMF(pmenu, MFSYSMENU); 00058 LockDesktopMenu(ppmenu, pmenu); 00059 return pmenu; 00060 }

VOID xxxLW_LoadFonts BOOL  bRemote  ) 
 

Definition at line 2184 of file w32/ntuser/kernel/init.c.

References bEnumerateRegistryFonts(), BOOL, bPermanentFontsLoaded, ClientLoadLocalT1Fonts(), ClientLoadRemoteT1Fonts(), CloseFNTCache(), CMSSLEEP, EnterCrit, FALSE, gbRemoteSession, KeDelayExecutionThread(), KernelMode, L, LeaveCrit, MAX_TIME_OUT, NULL, TRUE, VOID(), and xxxAddFontResourceW().

Referenced by CreateTerminalInput().

02186 { 02187 BOOL bTimeOut = FALSE; 02188 02189 if(bRemote) { 02190 02191 LARGE_INTEGER li; 02192 ULONG ulWaitCount = 0; 02193 02194 /* 02195 * Before we can proceed we must make sure that all the permanent 02196 * fonts have been loaded. 02197 */ 02198 02199 while (!bPermanentFontsLoaded) { 02200 02201 if (!gbRemoteSession || (ulWaitCount < MAX_TIME_OUT)) 02202 { 02203 LeaveCrit(); 02204 li.QuadPart = (LONGLONG)-10000 * CMSSLEEP; 02205 KeDelayExecutionThread(KernelMode, FALSE, &li); 02206 EnterCrit(); 02207 } 02208 else 02209 { 02210 bTimeOut = TRUE; 02211 break; 02212 } 02213 02214 ulWaitCount++; 02215 } 02216 02217 if (!bTimeOut) 02218 { 02219 if (!bEnumerateRegistryFonts(FALSE)) 02220 return; // nothing you can do 02221 02222 // add remote type 1 fonts. 02223 02224 ClientLoadRemoteT1Fonts(); 02225 } 02226 02227 } else { 02228 02229 xxxAddFontResourceW(L"marlett.ttf", AFRW_ADD_LOCAL_FONT,NULL); 02230 if (!bEnumerateRegistryFonts(TRUE)) 02231 return; // nothing you can do 02232 02233 // add local type 1 fonts. 02234 02235 // only want to be called once, the second time after ms sans serif was installed 02236 02237 if (bPermanentFontsLoaded) 02238 { 02239 ClientLoadLocalT1Fonts(); 02240 02241 // All the fonts loaded, we can close the FNTCache 02242 02243 CloseFNTCache(); 02244 } 02245 02246 } 02247 }

BOOL xxxMakeWindowForegroundWithState PWND  ,
BYTE 
 

Definition at line 166 of file fullscr.c.

References BOOL, BYTE, CheckLock, CLEAR_PUDF, FALSE, fGdiEnabled, fRedoFullScreenSwitch, FULLSCREEN_CAPTURE, gbFullScreen, gbRemoteSession, GetFullScreen, GETPTI, gpcurLogCurrent, gpcurPhysCurrent, gpDispInfo, gpqCursor, gpqForeground, gpsi, gptCursorFullScreen, gptSSCursor, grpdeskRitInput, gspwndFullScreen, gspwndShouldBeForeground, HMIsMarkDestroy, idSwitcher, ISTS, IsWinEventNotifyDeferredOK, Lock, LockWindowUpdate2(), NOSWITCHER, NULL, tagDESKTOP::pDeskInfo, tagDISPLAYINFO::pmdev, PsGetCurrentThread, PUDF_LOCKFULLSCREEN, PWNDDESKTOP, SET_PUDF, SetFullScreen, SetPointer(), SetVDMCursorBounds(), tagDESKTOPINFO::spwnd, tagQ::spwndActive, ThreadLock, ThreadUnlock, TRACE_SWITCH, TRUE, Unlock, xxxCapture(), xxxRedrawWindow(), xxxSendMessage(), and zzzInternalSetCursorPos().

Referenced by xxxActivateThisWindow(), xxxbFullscreenSwitch(), xxxDesktopWndProc(), xxxSetForegroundWindow2(), xxxShowWindow(), and xxxSysCommand().

00169 { 00170 PWND pwndNewFG; 00171 TL tlpwndNewFG; 00172 00173 TRACE_SWITCH(("Switching: xxxMakeWindowForeground: Enter\n")); 00174 TRACE_SWITCH(("\t \t pwnd = %08lx\n", pwnd)); 00175 TRACE_SWITCH(("\t \t NewState = %d\n", NewState)); 00176 00177 CheckLock(pwnd); 00178 UserAssert(IsWinEventNotifyDeferredOK()); 00179 00180 /* 00181 * If we should switch to a specific window save that window 00182 */ 00183 00184 if (pwnd != NULL) { 00185 00186 if (NewState == GDIFULLSCREEN) { 00187 Lock(&gspwndShouldBeForeground, pwnd); 00188 } 00189 00190 /* 00191 * Change to the new state 00192 */ 00193 00194 SetFullScreen(pwnd, NewState); 00195 00196 if (NewState == FULLSCREEN && 00197 (gpqForeground == NULL || 00198 gpqForeground->spwndActive != pwnd)) { 00199 00200 SetFullScreen(pwnd, FULLSCREENMIN); 00201 } 00202 } 00203 00204 // 00205 // Since we leave the critical section during the switch, some other 00206 // thread could come into this routine and request a switch. The global 00207 // will be reset, and we will use the loop to perform the next switch. 00208 // 00209 00210 if (idSwitcher != NOSWITCHER) { 00211 fRedoFullScreenSwitch = TRUE; 00212 TRACE_SWITCH(("Switching: xxxMakeWindowForeground was posted: Exit\n")); 00213 00214 return TRUE; 00215 } 00216 00217 UserAssert(!fRedoFullScreenSwitch); 00218 idSwitcher = PsGetCurrentThread()->Cid.UniqueThread; 00219 00220 /* 00221 * We loop, switching full screens until all states have stabilized 00222 */ 00223 00224 while (TRUE) { 00225 /* 00226 * figure out who should be foreground 00227 */ 00228 fRedoFullScreenSwitch = FALSE; 00229 00230 if (gspwndShouldBeForeground != NULL) { 00231 pwndNewFG = gspwndShouldBeForeground; 00232 Unlock(&gspwndShouldBeForeground); 00233 } else { 00234 if (gpqForeground != NULL && 00235 gpqForeground->spwndActive != NULL) { 00236 00237 pwndNewFG = gpqForeground->spwndActive; 00238 00239 if (GetFullScreen(pwndNewFG) == WINDOWED || 00240 GetFullScreen(pwndNewFG) == FULLSCREENMIN) { 00241 00242 pwndNewFG = PWNDDESKTOP(pwndNewFG); 00243 } 00244 } else { 00245 /* 00246 * No active window, switch to current desktop 00247 */ 00248 pwndNewFG = grpdeskRitInput->pDeskInfo->spwnd; 00249 } 00250 } 00251 00252 /* 00253 * We don't need to switch if the right window is already foreground 00254 */ 00255 if (pwndNewFG == gspwndFullScreen) { 00256 break; 00257 } 00258 00259 ThreadLock(pwndNewFG, &tlpwndNewFG); 00260 00261 { 00262 BYTE bStateNew = GetFullScreen(pwndNewFG); 00263 TL tlpwndOldFG; 00264 PWND pwndOldFG = gspwndFullScreen; 00265 BYTE bStateOld = gbFullScreen; 00266 00267 ThreadLock(pwndOldFG, &tlpwndOldFG); 00268 00269 Lock(&gspwndFullScreen, pwndNewFG); 00270 gbFullScreen = bStateNew; 00271 00272 UserAssert(!HMIsMarkDestroy(gspwndFullScreen)); 00273 00274 /* 00275 * If the old screen was GDIFULLSCREEN and we are switching to 00276 * GDIFULLSCREEN then just repaint 00277 */ 00278 00279 /* 00280 * BUG 231647: For remote sessions it can happen that 00281 * pwndOldFG is NULL but the display is enabled therefore a 00282 * call to DrvEnableMDEV would confuse the Drv* code. The way 00283 * this happens is when gspwndFullScreen was the desktop window 00284 * of a desktop that got destroyed after we switched away from it. 00285 */ 00286 00287 if ((pwndOldFG != NULL || gbRemoteSession) && 00288 bStateOld == GDIFULLSCREEN && 00289 bStateNew == GDIFULLSCREEN) { 00290 00291 xxxRedrawWindow(pwndNewFG, NULL, NULL, 00292 RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW); 00293 00294 ThreadUnlock(&tlpwndOldFG); 00295 00296 } else { 00297 00298 /* 00299 * tell old 'foreground' window it is losing control of the screen 00300 */ 00301 if (pwndOldFG != NULL) { 00302 switch (bStateOld) { 00303 case FULLSCREEN: 00304 if (GetFullScreen(pwndOldFG) == FULLSCREEN) { 00305 SetFullScreen(pwndOldFG, FULLSCREENMIN); 00306 } 00307 xxxSendMessage(pwndOldFG, WM_FULLSCREEN, FALSE, 0); 00308 xxxCapture(GETPTI(pwndOldFG), NULL, FULLSCREEN_CAPTURE); 00309 SetVDMCursorBounds(NULL); 00310 break; 00311 00312 case GDIFULLSCREEN: 00313 /* 00314 * Lock out other windows from drawing while we are fullscreen 00315 */ 00316 LockWindowUpdate2(pwndOldFG, TRUE); 00317 SET_PUDF(PUDF_LOCKFULLSCREEN); 00318 00319 UserAssert(fGdiEnabled == TRUE); 00320 00321 if (!DrvDisableMDEV(gpDispInfo->pmdev, TRUE)) { 00322 /* 00323 * Restore the previous state before bailing. 00324 */ 00325 CLEAR_PUDF(PUDF_LOCKFULLSCREEN); 00326 LockWindowUpdate2(NULL, TRUE); 00327 00328 Lock(&gspwndFullScreen, pwndOldFG); 00329 gbFullScreen = bStateOld; 00330 00331 ThreadUnlock(&tlpwndOldFG); 00332 ThreadUnlock(&tlpwndNewFG); 00333 00334 idSwitcher = NOSWITCHER; 00335 00336 return FALSE; 00337 } 00338 00339 gptCursorFullScreen = gpsi->ptCursor; 00340 fGdiEnabled = FALSE; 00341 break; 00342 00343 default: 00344 RIPMSG0(RIP_ERROR, "xxxDoFullScreenSwitch: bad screen state"); 00345 break; 00346 00347 } 00348 } 00349 00350 ThreadUnlock(&tlpwndOldFG); 00351 00352 switch (bStateNew) { 00353 case FULLSCREEN: 00354 xxxCapture(GETPTI(pwndNewFG), pwndNewFG, FULLSCREEN_CAPTURE); 00355 xxxSendMessage(pwndNewFG, WM_FULLSCREEN, TRUE, 0); 00356 break; 00357 00358 case GDIFULLSCREEN: 00359 if (ISTS() && pwndOldFG != NULL) { 00360 UserAssert(fGdiEnabled == FALSE); 00361 } 00362 00363 DrvEnableMDEV(gpDispInfo->pmdev, TRUE); 00364 fGdiEnabled = TRUE; 00365 00366 /* 00367 * Return the cursor to it's old state. Reset the screen saver mouse 00368 * position or it'll go away by accident. 00369 */ 00370 gpqCursor = NULL; 00371 gpcurPhysCurrent = NULL; 00372 gpcurLogCurrent = NULL; 00373 SetPointer(FALSE); 00374 gptSSCursor = gptCursorFullScreen; 00375 00376 /* 00377 * No need to DeferWinEventNotify() - we use only globals, 00378 * then make an xxx call below. 00379 */ 00380 zzzInternalSetCursorPos(gptCursorFullScreen.x, 00381 gptCursorFullScreen.y 00382 ); 00383 00384 CLEAR_PUDF(PUDF_LOCKFULLSCREEN); 00385 LockWindowUpdate2(NULL, TRUE); 00386 00387 xxxRedrawWindow(pwndNewFG, NULL, NULL, 00388 RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW); 00389 break; 00390 00391 default: 00392 RIPMSG0(RIP_ERROR, "xxxDoFullScreenSwitch: bad screen state\n"); 00393 break; 00394 } 00395 } 00396 } 00397 00398 ThreadUnlock(&tlpwndNewFG); 00399 00400 if (!fRedoFullScreenSwitch) { 00401 break; 00402 } 00403 } 00404 00405 TRACE_SWITCH(("Switching: xxxMakeWindowForeground: Exit\n")); 00406 00407 idSwitcher = NOSWITCHER; 00408 return TRUE; 00409 }

int xxxMenuBarCompute PMENU  pMenu,
PWND  pwndNotify,
DWORD  yMenuTop,
DWORD  xMenuLeft,
int  cxMax
 

Definition at line 706 of file mncomput.c.

References CheckLock, DWORD, MBC_RightJustifyMenu(), MFISPOPUP, SYSMET, TestMF, and xxxMNCompute().

Referenced by xxxCalcClientRect(), xxxDrawMenuBarTemp(), xxxMenuBarDraw(), and xxxMNRecomputeBarIfNeeded().

00712 { 00713 int size; 00714 /* menuHeight is set by MNCompute when dealing with a top level menu and 00715 * not all items in the menu bar have the same height. Thus, by setting 00716 * menuHeight, MNCompute is called a second time to set every item to the 00717 * same height. The actual value stored in menuHeight is the maximum 00718 * height of all the menu bar items 00719 */ 00720 DWORD menuHeight = 0; 00721 00722 CheckLock(pwndNotify); 00723 CheckLock(pMenu); 00724 00725 size = xxxMNCompute(pMenu, pwndNotify, yMenuTop, xMenuLeft, cxMax, &menuHeight); 00726 00727 if (!TestMF(pMenu, MFISPOPUP)) { 00728 if (menuHeight != 0) { 00729 00730 /* 00731 * Add a border for the multi-row case. 00732 */ 00733 size = xxxMNCompute(pMenu, pwndNotify, yMenuTop, xMenuLeft, 00734 cxMax, &menuHeight); 00735 } 00736 00737 /* 00738 * Right justification of HELP items is only needed on top level 00739 * menus. 00740 */ 00741 MBC_RightJustifyMenu(pMenu); 00742 } 00743 00744 /* 00745 * There's an extra border underneath the menu bar, if it's not empty! 00746 */ 00747 return(size ? size + SYSMET(CYBORDER) : size); 00748 }

int xxxMenuBarDraw PWND  pwnd,
HDC  hdc,
int  cxFrame,
int  cyFrame
 

Definition at line 1373 of file mndraw.c.

References BOOL, CheckLock, ClearMF, CreateEmptyRgn(), tagMENU::cxMenu, tagMENU::cyMenu, FALSE, GetAppCompatFlags2(), GetCaptionHeight(), gpDispInfo, tagMENU::hbrBack, tagDISPLAYINFO::hDev, MFINACTIVE, NULL, tagWND::rcWindow, SetMF, tagWND::spmenu, tagMENU::spwndNotify, SYSHBR, SYSMET, TestWF, TestwndFrameOn, ThreadLock, ThreadUnlock, TRUE, UINT, VER40, WEFEDGEMASK, WFOLDUI, xxxMenuBarCompute(), and xxxMenuDraw().

Referenced by xxxDrawWindowFrame(), and xxxDWP_DoNCActivate().

01378 { 01379 UINT cxMenuMax; 01380 int yTop; 01381 PMENU pMenu; 01382 BOOL fClipped = FALSE; 01383 TL tlpmenu; 01384 HRGN hrgnVisSave; 01385 HBRUSH hbrT; 01386 CheckLock(pwnd); 01387 01388 /* 01389 * Lock the menu so we can poke around 01390 */ 01391 pMenu = (PMENU)pwnd->spmenu; 01392 if (pMenu == NULL) 01393 return SYSMET(CYBORDER); 01394 01395 /* 01396 * NT5 menus are drawn inactive when the window is not active. 01397 */ 01398 if (TestwndFrameOn(pwnd) || (GetAppCompatFlags2(VER40) & GACF2_ACTIVEMENUS)) { 01399 ClearMF(pMenu, MFINACTIVE); 01400 } else { 01401 SetMF(pMenu, MFINACTIVE); 01402 } 01403 01404 ThreadLock(pMenu, &tlpmenu); 01405 01406 yTop = cyFrame; 01407 yTop += GetCaptionHeight(pwnd); 01408 01409 01410 /* 01411 * Calculate maximum available horizontal real estate 01412 */ 01413 cxMenuMax = (pwnd->rcWindow.right - pwnd->rcWindow.left) - cxFrame * 2; 01414 01415 /* 01416 * If the menu has switched windows, or if either count is 0, 01417 * then we need to recompute the menu width. 01418 */ 01419 if (pwnd != pMenu->spwndNotify || 01420 pMenu->cxMenu == 0 || 01421 pMenu->cyMenu == 0) { 01422 01423 xxxMenuBarCompute(pMenu, pwnd, yTop, cxFrame, cxMenuMax); 01424 } 01425 01426 /* 01427 * If the menu rectangle is wider than allowed, or the 01428 * bottom would overlap the size border, we need to clip. 01429 */ 01430 if (pMenu->cxMenu > cxMenuMax || 01431 (int)(yTop + pMenu->cyMenu) > (int)((pwnd->rcWindow.bottom - pwnd->rcWindow.top) 01432 - cyFrame)) { 01433 01434 /* 01435 * Lock the display while we're playing around with visrgns. Make 01436 * a local copy of the saved-visrgn so it can be restored in case 01437 * we make a callback (i.e. WM_DRAWITEM). 01438 */ 01439 GreLockDisplay(gpDispInfo->hDev); 01440 01441 fClipped = TRUE; 01442 01443 #ifdef LATER 01444 // mikeke don't use the visrgn here if possible 01445 hrgnVisSave = GreCreateRectRgn( 01446 pwnd->rcWindow.left + cxFrame, 01447 pwnd->rcWindow.top, 01448 pwnd->rcWindow.left + cxFrame + cxMenuMax, 01449 pwnd->rcWindow.bottom - cyFrame); 01450 GreExtSelectClipRgn(hdc, hrgnVisSave, RGN_COPY); 01451 GreSetMetaRgn(hdc); 01452 GreDeleteObject(hrgnVisSave); 01453 #else 01454 hrgnVisSave = CreateEmptyRgn(); 01455 GreCopyVisRgn(hdc,hrgnVisSave); 01456 GreIntersectVisRect(hdc, pwnd->rcWindow.left + cxFrame, 01457 pwnd->rcWindow.top, 01458 pwnd->rcWindow.left + cxFrame + cxMenuMax, 01459 pwnd->rcWindow.bottom - cyFrame); 01460 01461 #endif 01462 01463 GreUnlockDisplay(gpDispInfo->hDev); 01464 } 01465 01466 { 01467 POLYPATBLT PolyData[2]; 01468 01469 PolyData[0].x = cxFrame; 01470 PolyData[0].y = yTop; 01471 PolyData[0].cx = pMenu->cxMenu; 01472 PolyData[0].cy = pMenu->cyMenu; 01473 PolyData[0].BrClr.hbr = (pMenu->hbrBack) ? pMenu->hbrBack : SYSHBR(MENU); 01474 01475 PolyData[1].x = cxFrame; 01476 PolyData[1].y = yTop + pMenu->cyMenu; 01477 PolyData[1].cx = pMenu->cxMenu; 01478 PolyData[1].cy = SYSMET(CYBORDER); 01479 PolyData[1].BrClr.hbr = (TestWF(pwnd, WEFEDGEMASK) && !TestWF(pwnd, WFOLDUI))? SYSHBR(3DFACE) : SYSHBR(WINDOWFRAME); 01480 01481 GrePolyPatBlt(hdc,PATCOPY,&PolyData[0],2,PPB_BRUSH); 01482 01483 // 01484 // Draw menu background in MENU color 01485 // 01486 //hbrT = GreSelectBrush(hdc, SYSHBR(MENU)); 01487 //GrePatBlt(hdc, cxFrame, yTop, pMenu->cxMenu, pMenu->cyMenu, PATCOPY); 01488 01489 // 01490 // Draw border under menu in proper BORDER color 01491 // 01492 //GreSelectBrush(hdc, (TestWF(pwnd, WEFEDGEMASK) && !TestWF(pwnd, WFOLDUI))? SYSHBR(3DFACE) : SYSHBR(WINDOWFRAME)); 01493 //GrePatBlt(hdc, cxFrame, yTop + pMenu->cyMenu, pMenu->cxMenu, SYSMET(CYBORDER), PATCOPY); 01494 01495 01496 } 01497 01498 /* 01499 * Finally, draw the menu itself. 01500 */ 01501 01502 hbrT = GreSelectBrush(hdc, (TestWF(pwnd, WEFEDGEMASK) && !TestWF(pwnd, WFOLDUI))? SYSHBR(3DFACE) : SYSHBR(WINDOWFRAME)); 01503 xxxMenuDraw(hdc, pMenu); 01504 GreSelectBrush(hdc, hbrT); 01505 01506 if (fClipped) { 01507 #ifdef LATER 01508 // mikeke don't use the visrgn here if possible 01509 hrgnVisSave = CreateEmptyRgn(); 01510 GreExtSelectClipRgn(hdc, hrgnVisSave, RGN_COPY); 01511 GreSetMetaRgn(hdc); 01512 GreDeleteObject(hrgnVisSave); 01513 #else 01514 GreLockDisplay(gpDispInfo->hDev); 01515 GreSelectVisRgn(hdc, hrgnVisSave, SVR_DELETEOLD); 01516 GreUnlockDisplay(gpDispInfo->hDev); 01517 #endif 01518 } 01519 01520 ThreadUnlock(&tlpmenu); 01521 return(pMenu->cyMenu + SYSMET(CYBORDER)); 01522 }

VOID xxxMenuDraw HDC  hdc,
PMENU  pMenu
 

Definition at line 1534 of file mndraw.c.

References CalcbfExtra(), CheckLock, tagMENU::cItems, tagITEM::cxItem, cy, tagITEM::cyItem, tagMENU::cyMenu, DrawEdge(), tagMENU::dwArrowsOn, tagTHREADINFO::dwExpWinVer, ghMenuFont, GreGetTextAlign(), GreSetTextAlign(), tagMENU::hbrBack, tagMENU::iTop, MFISPOPUP, MNDrawInsertionBar(), MNGetToppItem(), MSA_OFF, NULL, PtiCurrent, tagMENU::rgItems, SYSMET, TestMF, TestMFT, UINT, VER40, tagITEM::xItem, xxxDrawMenuItem(), and tagITEM::yItem.

Referenced by xxxDrawMenuBarTemp(), xxxMenuBarDraw(), and xxxMenuWindowProc().

01537 { 01538 PITEM pItem; 01539 UINT i, cy; 01540 RECT rcItem; 01541 HFONT hFontOld; 01542 UINT bfExtra; 01543 PTHREADINFO ptiCurrent = PtiCurrent(); 01544 UINT oldAlign; 01545 int iBkSave; 01546 POINT ptOrg; 01547 CheckLock(pmenu); 01548 01549 if (pmenu == NULL) { 01550 RIPERR0(ERROR_INVALID_HANDLE, 01551 RIP_WARNING, 01552 "Invalid menu handle \"pmenu\" (NULL) to xxxMenuDraw"); 01553 01554 return; 01555 } 01556 01557 GreGetViewportOrg(hdc, &ptOrg); 01558 hFontOld = GreSelectFont(hdc, ghMenuFont); 01559 01560 oldAlign = GreGetTextAlign(hdc); 01561 if (pmenu->rgItems && TestMFT(pmenu->rgItems, MFT_RIGHTORDER)) 01562 GreSetTextAlign(hdc, oldAlign | TA_RTLREADING); 01563 01564 bfExtra = CalcbfExtra(); 01565 01566 if (pmenu->hbrBack != NULL) { 01567 iBkSave = GreSetBkMode(hdc, TRANSPARENT); 01568 } 01569 01570 if (pmenu->dwArrowsOn != MSA_OFF) { 01571 pItem = MNGetToppItem(pmenu); 01572 GreSetViewportOrg(hdc, ptOrg.x, ptOrg.y - ((int)pItem->yItem), NULL); 01573 i = pmenu->iTop; 01574 } else { 01575 pItem = (PITEM)pmenu->rgItems; 01576 i = 0; 01577 } 01578 01579 cy = 0; 01580 for (; i < pmenu->cItems; i++, pItem++) { 01581 if (TestMFT(pItem, MFT_MENUBARBREAK) && 01582 TestMF(pmenu, MFISPOPUP)) { 01583 01584 // 01585 // Draw a vertical etch. This is done by calling DrawEdge(), 01586 // sunken, with BF_LEFT | BF_RIGHT. 01587 // 01588 if(TestMFT(pItem, MFT_RIGHTORDER) && i) { 01589 // 01590 // going backwards, so the correct place is just before the 01591 // _previous_ item. 01592 // 01593 PITEM pi; 01594 01595 pi = pItem - 1; 01596 rcItem.left = pi->xItem - SYSMET(CXFIXEDFRAME); 01597 rcItem.top = 0; 01598 rcItem.right = pi->xItem - SYSMET(CXBORDER); 01599 rcItem.bottom = pmenu->cyMenu; 01600 } else { 01601 rcItem.left = pItem->xItem - SYSMET(CXFIXEDFRAME); 01602 rcItem.top = 0; 01603 rcItem.right = pItem->xItem - SYSMET(CXBORDER); 01604 rcItem.bottom = pmenu->cyMenu; 01605 } 01606 01607 DrawEdge(hdc, &rcItem, BDR_SUNKENOUTER, BF_LEFT | BF_RIGHT | bfExtra); 01608 } 01609 /* 01610 * If this is a separator, draw it and return. 01611 * If version is less than 4.0 don't test the MFT_OWNERDRAW 01612 * flag. Bug 21922; App MaxEda has both separator and Ownerdraw 01613 * flags on. In 3.51 we didn't test the OwnerDraw flag 01614 */ 01615 if (TestMFT(pItem, MFT_SEPARATOR) 01616 && (!TestMFT(pItem, MFT_OWNERDRAW) 01617 || (LOWORD(ptiCurrent->dwExpWinVer) < VER40))) { 01618 01619 /* 01620 * Draw a horizontal etch. 01621 */ 01622 int yT = pItem->yItem + (pItem->cyItem / 2) - SYSMET(CYBORDER); 01623 RECT rcItem; 01624 01625 rcItem.left = pItem->xItem + 1; 01626 rcItem.top = yT; 01627 rcItem.right = pItem->xItem + pItem->cxItem - 1; 01628 rcItem.bottom = yT + SYSMET(CYEDGE); 01629 01630 DrawEdge(hdc, &rcItem, BDR_SUNKENOUTER, BF_TOP | BF_BOTTOM | bfExtra); 01631 /* 01632 * Draw drop insertion bar, if any. 01633 */ 01634 MNDrawInsertionBar (hdc, pItem); 01635 01636 } else { 01637 xxxDrawMenuItem(hdc, pmenu, pItem, 0); 01638 } 01639 01640 if (pmenu->dwArrowsOn != MSA_OFF) { 01641 cy += pItem->cyItem; 01642 if (cy > pmenu->cyMenu) { 01643 /* 01644 * this is a scrollable menu and the item just drawn falls below 01645 * the bottom of the visible menu -- no need to draw any further 01646 */ 01647 break; 01648 } 01649 } 01650 } /* for (; i < pmenu->cItems; i++, pItem++) */ 01651 01652 if (pmenu->hbrBack != NULL) { 01653 GreSetBkMode(hdc, iBkSave); 01654 } 01655 GreSetViewportOrg(hdc, ptOrg.x, ptOrg.y, NULL); 01656 GreSetTextAlign(hdc, oldAlign); 01657 GreSelectFont(hdc, hFontOld); 01658 01659 }

int xxxMenuItemFromPoint PWND  pwnd,
PMENU  pMenu,
POINT  ptScreen
 

Definition at line 972 of file mncomput.c.

References CheckLock, GetMenuPwnd(), MFISPOPUP, MFMWFP_NOITEM, MNItemHitTest(), NULL, TestMF, and xxxMNRecomputeBarIfNeeded().

Referenced by NtUserMenuItemFromPoint().

00973 { 00974 CheckLock(pwnd); 00975 CheckLock(pMenu); 00976 00977 /* 00978 * If no pwnd, no go. 00979 * IMPORTANT: for MFISPOPUP we might get a different pwnd but we don't lock 00980 * it because we won't call back 00981 */ 00982 pwnd = GetMenuPwnd(pwnd, pMenu); 00983 if (pwnd == NULL) { 00984 return MFMWFP_NOITEM; 00985 } 00986 00987 if (!TestMF(pMenu, MFISPOPUP)) { 00988 xxxMNRecomputeBarIfNeeded(pwnd, pMenu); 00989 } 00990 00991 return(MNItemHitTest(pMenu, pwnd, ptScreen)); 00992 }

LRESULT xxxMenuWindowProc PWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 4022 of file ntuser/kernel/menu.c.

References _GetDCEx(), _KillTimer(), _MonitorFromWindow(), _PostMessage(), _ReleaseDC(), _SetTimer(), ATW_SETFOCUS, AW_SKIP2, BOOL, CheckLock, tagMENU::cItems, ClearMF, CMS_MENUFADE, CreateFade(), tagMENUSTATE::cxAni, tagMENU::cxMenu, cy, tagMENUSTATE::cyAni, tagMENUSTATE::dwAniStartTime, tagMENU::dwArrowsOn, dwFlags, DWORD, tagMENUSTATE::fAboutToAutoDismiss, tagMENUSTATE::fActiveNoForeground, FADE_MENU, FADE_SHOW, FALSE, FBadWindow(), tagMENUSTATE::fButtonDown, tagMENUSTATE::fDragAndDrop, tagMENUSTATE::fDragging, tagMENUSTATE::fIgnoreButtonUp, tagMENUSTATE::fInCallHandleMenuMessages, tagPOPUPMENU::fInCancel, FindBestPos(), tagMENUSTATE::fInDoDragDrop, tagMENUSTATE::fModelessMenu, tagMENUSTATE::fMouseOffMenu, FNID_MENU, tagITEM::fState, tagPOPUPMENU::fToggle, tagPOPUPMENU::fTrackMouseEvent, gcyMenuScrollArrow, GET_X_LPARAM, GET_Y_LPARAM, GetAppCompatFlags2(), GETFNID, GetpMenuState(), GETPTI, gpqForeground, gpqForegroundPrev, tagMENU::hbrBack, tagMENUSTATE::hdcWndAni, tagWND::head, HRGN_FULL, HW, tagMENUSTATE::iAniDropDir, tagPOPUPMENU::iDropDir, IDSYS_MNANIMATE, IDSYS_MNAUTODISMISS, IDSYS_MNDOWN, IDSYS_MNHIDE, IDSYS_MNSHOW, IDSYS_MNUP, InflateRect(), Is500Compat, ISAMENU, IsMFMWFPWindow(), IsRecursedMenuState(), tagMENUSTATE::ixAni, tagMENUSTATE::iyAni, L, Lock, LockMenuState(), LockPopupMenu(), MFMWFP_MINVALID, MFMWFP_NOITEM, MFWINDOWDC, MNAllocPopup(), MNAnimate(), MNCheckButtonDownState(), MNCheckScroll(), MNCreateAnimationBitmap(), MNDrawFullNC(), MNEraseBackground(), MNFindNextValidItem(), MNGetpItem(), MNSetTimerToAutoDismiss(), MNSetTimerToOpenHierarchy(), MNSW_DRAWFRAME, MNSW_RETURNSIZE, MNXBORDER, MNYBORDER, MSA_OFF, NCA_ACTIVE, NCA_FORCEFRAMEOFF, NextTopWindow(), NtGetTickCount(), NULL, PAS_HORZ, PAS_OUT, PAS_VERT, tagMENUSTATE::pGlobalPopupMenu, PlayEventSound(), pmenuNext, tagMENUSTATE::pmnsPrev, tagPOPUPMENU::posDropped, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, tagTHREADINFO::pq, PtiCurrent, PtInRect(), PtoH, PUINT, PWND_TOP, QF_CAPTURELOCKED, tagWND::rcClient, tagWND::rcWindow, RevalidateHwnd, SetMF, ShowFade(), tagPOPUPMENU::spmenu, tagITEM::spSubMenu, tagPOPUPMENU::spwndActivePopup, tagQ::spwndActivePrev, tagWND::spwndLastActive, tagPOPUPMENU::spwndNextPopup, tagMENU::spwndNotify, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, StartFade(), SYSMET, TestALPHA, TestEffectUP, TestFadeFlags(), TestWF, ThreadLock, ThreadLockAlways, ThreadLockAlwaysWithPti, ThreadUnlock, TRUE, tagMENUSTATE::uButtonDownHitArea, tagMENUSTATE::uButtonDownIndex, UINT, USER_SOUND_MENUPOPUP, VALIDATECLASSANDSIZE, ValidateHmenu(), Validateppopupmenu, VER40, WFVISIBLE, xxxActivateThisWindow(), xxxActivateWindow(), xxxBeginPaint(), xxxCallHandleMenuMessages(), xxxClientRevokeDragDrop(), xxxDefWindowProc(), xxxDWP_DoNCActivate(), xxxEndMenuLoop(), xxxEndPaint(), xxxMenuDraw(), xxxMNButtonDown(), xxxMNButtonUp(), xxxMNCancel(), xxxMNChar(), xxxMNCloseHierarchy(), xxxMNCompute(), xxxMNDestroyHandler(), xxxMNDoScroll(), xxxMNDoubleClick(), xxxMNEndMenuState(), xxxMNFindWindowFromPoint(), xxxMNKeyDown(), xxxMNMouseMove(), xxxMNOpenHierarchy(), xxxMNPositionHierarchy(), xxxMNSelectItem(), xxxMNSetCapture(), xxxSendMessage(), xxxSetForegroundWindow(), xxxSetWindowPos(), xxxShowWindow(), xxxUnlockMenuState(), and xxxValidateRect().

Referenced by InitFunctionTables(), InitializeClientPfnArrays(), and LW_RegisterWindows().

04027 { 04028 BOOL fIsRecursedMenu; 04029 LRESULT lRet; 04030 PAINTSTRUCT ps; 04031 PPOPUPMENU ppopupmenu; 04032 PMENUSTATE pMenuState; 04033 PMENU pmenu; 04034 PITEM pItem; 04035 TL tlpmenu; 04036 TL tlpwndNotify; 04037 PDESKTOP pdesk = pwnd->head.rpdesk; 04038 POINT ptOrg; 04039 HDC hdcAni; 04040 04041 CheckLock(pwnd); 04042 04043 VALIDATECLASSANDSIZE(pwnd, message, wParam, lParam, FNID_MENU, WM_NCCREATE); 04044 04045 /* 04046 * If we're not in menu mode or this window is just being created, 04047 * there are only few messages we care about. 04048 */ 04049 pMenuState = GetpMenuState(pwnd); 04050 ppopupmenu = ((PMENUWND)pwnd)->ppopupmenu; 04051 pmenu = (ppopupmenu != NULL ? ppopupmenu->spmenu : NULL); 04052 if ((pMenuState == NULL) || (pmenu == NULL)) { 04053 switch (message) { 04054 case WM_NCCREATE: 04055 case WM_FINALDESTROY: 04056 break; 04057 04058 case MN_SETHMENU: 04059 if (ppopupmenu != NULL) { 04060 break; 04061 } else { 04062 return 0; 04063 } 04064 04065 default: 04066 goto CallDWP; 04067 } 04068 } else { 04069 /* 04070 * TPM_RECURSE support: make sure we grab the proper pMenuState. 04071 */ 04072 fIsRecursedMenu = ((ppopupmenu->ppopupmenuRoot != NULL) 04073 && IsRecursedMenuState(pMenuState, ppopupmenu)); 04074 if (fIsRecursedMenu) { 04075 while (IsRecursedMenuState(pMenuState, ppopupmenu) 04076 && (pMenuState->pmnsPrev != NULL)) { 04077 pMenuState = pMenuState->pmnsPrev; 04078 } 04079 UserAssert(pMenuState->pGlobalPopupMenu == ppopupmenu->ppopupmenuRoot); 04080 } 04081 04082 Validateppopupmenu(ppopupmenu); 04083 04084 /* 04085 * If this is a modeless menu, give xxxHandleMenuMessages the first 04086 * shot at the message 04087 */ 04088 if (pMenuState->fModelessMenu && !pMenuState->fInCallHandleMenuMessages) { 04089 /* 04090 * If this is a recursed menu, we don't want to process any 04091 * input for it until the current menu goes away. 04092 */ 04093 if (fIsRecursedMenu) { 04094 if (((message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST)) 04095 || ((message >= WM_KEYFIRST) && (message <= WM_KEYLAST)) 04096 || ((message >= WM_NCMOUSEFIRST) && (message <= WM_NCMOUSELAST))) { 04097 04098 goto CallDWP; 04099 } 04100 } else { 04101 if (xxxCallHandleMenuMessages(pMenuState, pwnd, message, wParam, lParam)) { 04102 return 0; 04103 } 04104 } 04105 } 04106 } /* else of if ((pMenuState == NULL) || (ppopupmenu == NULL)) */ 04107 04108 switch (message) { 04109 case WM_NCCREATE: 04110 /* 04111 * Ignore evil messages to prevent leaks. 04112 * Use RIP_ERROR for a while to make sure to see if we're getting here 04113 */ 04114 if (((PMENUWND)pwnd)->ppopupmenu != NULL) { 04115 RIPMSG1(RIP_ERROR, "xxxMenuWindowProc: evil WM_NCCREATE. already initialized. pwnd:%p", pwnd); 04116 return FALSE; 04117 } 04118 ppopupmenu = MNAllocPopup(TRUE); 04119 if (ppopupmenu == NULL) { 04120 return FALSE; 04121 } 04122 04123 ((PMENUWND)pwnd)->ppopupmenu = ppopupmenu; 04124 ppopupmenu->posSelectedItem = MFMWFP_NOITEM; 04125 Lock(&(ppopupmenu->spwndPopupMenu), pwnd); 04126 return TRUE; 04127 04128 case WM_NCCALCSIZE: 04129 xxxDefWindowProc(pwnd, message, wParam, lParam); 04130 if (pmenu->dwArrowsOn != MSA_OFF) { 04131 InflateRect((PRECT)lParam, 0, -gcyMenuScrollArrow); 04132 } 04133 break; 04134 04135 case WM_ERASEBKGND: 04136 if (pmenu->hbrBack != NULL) { 04137 MNEraseBackground ((HDC) wParam, pmenu, 04138 0, 0, 04139 pwnd->rcClient.right - pwnd->rcClient.left, 04140 pwnd->rcClient.bottom - pwnd->rcClient.top); 04141 return TRUE; 04142 } else { 04143 goto CallDWP; 04144 } 04145 break; 04146 04147 case WM_PRINT: 04148 /* 04149 * default processing of WM_PRINT does not handle custom non- 04150 * client painting -- which scrollable menus have -- so take 04151 * care of drawing nonclient area and then let DefWindowProc 04152 * handle the rest 04153 */ 04154 if ((lParam & PRF_NONCLIENT) && (pmenu->dwArrowsOn != MSA_OFF)) { 04155 04156 MNDrawFullNC(pwnd, (HDC)wParam, ppopupmenu); 04157 GreGetWindowOrg((HDC)wParam, &ptOrg); 04158 GreSetWindowOrg((HDC)wParam, 04159 ptOrg.x - MNXBORDER, 04160 ptOrg.y - MNYBORDER - gcyMenuScrollArrow, 04161 NULL); 04162 xxxDefWindowProc(pwnd, message, wParam, lParam & ~PRF_NONCLIENT); 04163 GreSetWindowOrg((HDC)wParam, ptOrg.x, ptOrg.y, NULL); 04164 04165 } else { 04166 goto CallDWP; 04167 } 04168 break; 04169 04170 case WM_WINDOWPOSCHANGING: 04171 if (!(((LPWINDOWPOS)lParam)->flags & SWP_SHOWWINDOW)) 04172 goto CallDWP; 04173 04174 if (!TestEffectUP(MENUANIMATION) || !(ppopupmenu->iDropDir & PAS_OUT) 04175 || (GetAppCompatFlags2(VER40) & GACF2_ANIMATIONOFF)) { 04176 NoAnimation: 04177 ppopupmenu->iDropDir &= ~PAS_OUT; 04178 goto CallDWP; 04179 } 04180 04181 /* 04182 * Create the animation bitmap. 04183 */ 04184 pMenuState->cxAni = pwnd->rcWindow.right - pwnd->rcWindow.left; 04185 pMenuState->cyAni = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 04186 04187 if (TestALPHA(MENUFADE)) { 04188 if ((hdcAni = CreateFade(pwnd, NULL, CMS_MENUFADE, 04189 FADE_SHOW | FADE_MENU)) == NULL) { 04190 goto NoAnimation; 04191 } 04192 } else { 04193 04194 if (!MNCreateAnimationBitmap(pMenuState, pMenuState->cxAni, 04195 pMenuState->cyAni)) { 04196 goto NoAnimation; 04197 } 04198 04199 /* 04200 * We shouldn't be animating at this time. 04201 */ 04202 UserAssert(pMenuState->hdcWndAni == NULL); 04203 04204 /* 04205 * This window must be the active popup 04206 */ 04207 UserAssert(pMenuState->pGlobalPopupMenu->spwndActivePopup == pwnd); 04208 04209 /* 04210 * Initialize animation info 04211 */ 04212 pMenuState->hdcWndAni = _GetDCEx(pwnd, HRGN_FULL, DCX_WINDOW | DCX_USESTYLE | DCX_INTERSECTRGN); 04213 pMenuState->iAniDropDir = ppopupmenu->iDropDir; 04214 pMenuState->ixAni = (pMenuState->iAniDropDir & PAS_HORZ) ? 0 : pMenuState->cxAni; 04215 pMenuState->iyAni = (pMenuState->iAniDropDir & PAS_VERT) ? 0 : pMenuState->cyAni; 04216 hdcAni = pMenuState->hdcAni; 04217 } 04218 04219 /* 04220 * MFWINDOWDC is used by MNEraseBackground to determine where the 04221 * brush org should be set. 04222 */ 04223 SetMF(pmenu, MFWINDOWDC); 04224 04225 xxxSendMessage(pwnd, WM_PRINT, (WPARAM)hdcAni, PRF_CLIENT | PRF_NONCLIENT | PRF_ERASEBKGND); 04226 04227 ClearMF(pmenu, MFWINDOWDC); 04228 04229 /* 04230 *If owner draw, we just passed hdcAni to the client side. 04231 * The app might have deleted it (??); no blue screen seems to 04232 * happen but only painting on that DC will fail from 04233 * now on. I won't waste time handling this unless it turns 04234 * out to be a problem (it's unlikely an app would do so). 04235 */ 04236 UserAssert(GreValidateServerHandle(hdcAni, DC_TYPE)); 04237 04238 /* 04239 * While the window is still hidden, load the first fade animation 04240 * frame to avoid flicker when the window is actually shown. 04241 * 04242 * There would still be flicker with slide animations, though. It 04243 * could be fixed by using the window region, similar to 04244 * AnimateWindow. For now, too many functions would become xxx, so 04245 * let's not do it, unless it becomes a big issue. 04246 */ 04247 if (TestFadeFlags(FADE_MENU)) { 04248 ShowFade(); 04249 } 04250 goto CallDWP; 04251 04252 case WM_WINDOWPOSCHANGED: 04253 if (!(((LPWINDOWPOS)lParam)->flags & SWP_SHOWWINDOW)) 04254 goto CallDWP; 04255 04256 /* 04257 * If not animating, nothing else to do here. 04258 */ 04259 if (!(ppopupmenu->iDropDir & PAS_OUT)) 04260 goto CallDWP; 04261 04262 /* 04263 * Start the animation cycle now. 04264 */ 04265 if (TestFadeFlags(FADE_MENU)) { 04266 StartFade(); 04267 } else { 04268 pMenuState->dwAniStartTime = NtGetTickCount(); 04269 _SetTimer(pwnd, IDSYS_MNANIMATE, 1, NULL); 04270 } 04271 ppopupmenu->iDropDir &= ~PAS_OUT; 04272 goto CallDWP; 04273 04274 case WM_NCPAINT: 04275 04276 if (ppopupmenu->iDropDir & PAS_OUT) { 04277 04278 /* 04279 * When animating, validate itself to ensure no further drawing 04280 * that is not related to the animation. 04281 */ 04282 xxxValidateRect(pwnd, NULL); 04283 } else { 04284 04285 /* 04286 * If we have scroll bars, draw them 04287 */ 04288 if (pmenu->dwArrowsOn != MSA_OFF) { 04289 04290 HDC hdc = _GetDCEx(pwnd, (HRGN)wParam, 04291 DCX_USESTYLE | DCX_WINDOW | DCX_INTERSECTRGN | DCX_NODELETERGN | DCX_LOCKWINDOWUPDATE); 04292 MNDrawFullNC(pwnd, hdc, ppopupmenu); 04293 _ReleaseDC(hdc); 04294 } else { 04295 goto CallDWP; 04296 } 04297 } 04298 break; 04299 04300 case WM_PRINTCLIENT: 04301 ThreadLock(pmenu, &tlpmenu); 04302 xxxMenuDraw((HDC)wParam, pmenu); 04303 ThreadUnlock(&tlpmenu); 04304 break; 04305 04306 case WM_FINALDESTROY: 04307 /* 04308 * If we're animating, we must haved been killed in a rude way.... 04309 */ 04310 UserAssert((pMenuState == NULL) || (pMenuState->hdcWndAni == NULL)); 04311 04312 /* 04313 * If this is a drag and drop menu, then call RevokeDragDrop. 04314 */ 04315 if ((pMenuState != NULL) && pMenuState->fDragAndDrop) { 04316 if (!SUCCEEDED(xxxClientRevokeDragDrop(HW(pwnd)))) { 04317 RIPMSG1(RIP_ERROR, "xxxMenuWindowProc: xxxClientRevokeRegisterDragDrop failed:%#p", pwnd); 04318 } 04319 } 04320 04321 xxxMNDestroyHandler(ppopupmenu); 04322 return 0; 04323 04324 04325 case WM_PAINT: 04326 ThreadLock(pmenu, &tlpmenu); 04327 xxxBeginPaint(pwnd, &ps); 04328 xxxMenuDraw(ps.hdc, pmenu); 04329 xxxEndPaint(pwnd, &ps); 04330 ThreadUnlock(&tlpmenu); 04331 break; 04332 04333 case WM_CHAR: 04334 case WM_SYSCHAR: 04335 xxxMNChar(ppopupmenu, pMenuState, (UINT)wParam); 04336 break; 04337 04338 case WM_KEYDOWN: 04339 case WM_SYSKEYDOWN: 04340 xxxMNKeyDown(ppopupmenu, pMenuState, (UINT)wParam); 04341 break; 04342 04343 case WM_TIMER: 04344 switch (wParam) { 04345 case IDSYS_MNSHOW: 04346 /* 04347 * Open the window and kill the show timer. 04348 * 04349 * Cancel any toggle state we might have. We don't 04350 * want to dismiss this on button up if shown from 04351 * button down. 04352 */ 04353 ppopupmenu->fToggle = FALSE; 04354 xxxMNOpenHierarchy(ppopupmenu, pMenuState); 04355 break; 04356 04357 case IDSYS_MNHIDE: 04358 ppopupmenu->fToggle = FALSE; 04359 xxxMNCloseHierarchy(ppopupmenu,pMenuState); 04360 break; 04361 04362 case IDSYS_MNUP: 04363 case IDSYS_MNDOWN: 04364 if (pMenuState->fButtonDown) { 04365 xxxMNDoScroll(ppopupmenu, (UINT)wParam, FALSE); 04366 } else { 04367 _KillTimer(pwnd, (UINT)wParam); 04368 } 04369 break; 04370 04371 case IDSYS_MNANIMATE: 04372 if (pMenuState->hdcWndAni != NULL) { 04373 MNAnimate(pMenuState, TRUE); 04374 } else { 04375 /* 04376 * This timer shouldn't be set. Left over in msg queue? 04377 */ 04378 UserAssert(pMenuState->hdcWndAni != NULL); 04379 } 04380 break; 04381 04382 case IDSYS_MNAUTODISMISS: 04383 /* 04384 * This is a one shot timer, so kill it. 04385 * Dismiss the popup if the flag hasn't been reset. 04386 */ 04387 _KillTimer(pwnd, IDSYS_MNAUTODISMISS); 04388 if (pMenuState->fAboutToAutoDismiss) { 04389 goto EndMenu; 04390 } 04391 } 04392 break; 04393 04394 /* 04395 * Menu messages. 04396 */ 04397 case MN_SETHMENU: 04398 04399 /* 04400 * wParam - new hmenu to associate with this menu window 04401 * Don't let them set the spmenu to NULL of we have to deal with 04402 * that all over. Use RIP_ERROR for a while to make sure this is OK 04403 */ 04404 if (wParam != 0) { 04405 if ((wParam = (WPARAM)ValidateHmenu((HMENU)wParam)) == 0) { 04406 break; 04407 } 04408 LockPopupMenu(ppopupmenu, &(ppopupmenu->spmenu), (PMENU)wParam); 04409 } else { 04410 RIPMSG1(RIP_ERROR, "xxxMenuWindowProc: MN_SETHMENU ignoring NULL wParam. pwnd:%p", pwnd); 04411 } 04412 break; 04413 04414 case MN_GETHMENU: 04415 04416 /* 04417 * returns the hmenu associated with this menu window 04418 */ 04419 return (LRESULT)PtoH(pmenu); 04420 04421 case MN_SIZEWINDOW: 04422 { 04423 04424 /* 04425 * Computes the size of the menu associated with this window and resizes 04426 * it if needed. Size is returned x in loword, y in highword. wParam 04427 * is 0 to just return new size. wParam is non zero if we should also resize 04428 * window. 04429 * When called by xxxMNUpdateShownMenu, we might need to redraw the 04430 * frame (i.e, the scrollbars). So we check for MNSW_DRAWFRAME in wParam. 04431 * If some app is sending this message and that bit is set, then we'll 04432 * do some extra work, but I think everything should be cool. 04433 */ 04434 int cx, cy; 04435 PMONITOR pMonitor; 04436 04437 /* 04438 * Call menucomputeHelper directly since this is the entry point for 04439 * non toplevel menu bars. 04440 */ 04441 if (pmenu == NULL) 04442 break; 04443 04444 ThreadLockAlways(pmenu, &tlpmenu); 04445 ThreadLock(ppopupmenu->spwndNotify, &tlpwndNotify); 04446 UserAssert(pmenu->spwndNotify == ppopupmenu->spwndNotify); 04447 xxxMNCompute(pmenu, ppopupmenu->spwndNotify, 0, 0, 0, 0); 04448 ThreadUnlock(&tlpwndNotify); 04449 ThreadUnlock(&tlpmenu); 04450 04451 pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 04452 cx = pmenu->cxMenu; 04453 cy = MNCheckScroll(pmenu, pMonitor); 04454 04455 /* 04456 * Size the window? 04457 */ 04458 if (wParam != 0) { 04459 LONG lPos; 04460 int x, y; 04461 DWORD dwFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER; 04462 04463 /* 04464 * Need to redraw the frame? 04465 */ 04466 if (wParam & MNSW_DRAWFRAME) { 04467 dwFlags |= SWP_DRAWFRAME; 04468 } 04469 04470 /* 04471 * If the window is visible, it's being resized while 04472 * shown. So make sure that it still fits on the screen 04473 * (i.e, move it to the best pos). 04474 */ 04475 if (TestWF(pwnd, WFVISIBLE)) { 04476 lPos = FindBestPos( 04477 pwnd->rcWindow.left, 04478 pwnd->rcWindow.top, 04479 cx, 04480 cy, 04481 NULL, 04482 0, 04483 ppopupmenu, 04484 pMonitor); 04485 04486 x = GET_X_LPARAM(lPos); 04487 y = GET_Y_LPARAM(lPos); 04488 } else { 04489 dwFlags |= SWP_NOMOVE; 04490 } 04491 04492 xxxSetWindowPos( 04493 pwnd, 04494 PWND_TOP, 04495 x, 04496 y, 04497 cx + 2*SYSMET(CXFIXEDFRAME), /* For shadow */ 04498 cy + 2*SYSMET(CYFIXEDFRAME), /* For shadow */ 04499 dwFlags); 04500 04501 } 04502 04503 return MAKELONG(cx, cy); 04504 } 04505 04506 case MN_OPENHIERARCHY: 04507 { 04508 PWND pwndT; 04509 /* 04510 * Opens one level of the hierarchy at the selected item, if 04511 * present. Return 0 if error, else hwnd of opened hierarchy. 04512 */ 04513 pwndT = xxxMNOpenHierarchy(ppopupmenu, pMenuState); 04514 return (LRESULT)HW(pwndT); 04515 } 04516 04517 case MN_CLOSEHIERARCHY: 04518 xxxMNCloseHierarchy(ppopupmenu, pMenuState); 04519 break; 04520 04521 case MN_SELECTITEM: 04522 /* 04523 * wParam - the item to select. Must be a valid 04524 * Returns the item flags of the wParam (0 if failure) 04525 */ 04526 if ((wParam >= pmenu->cItems) && (wParam < MFMWFP_MINVALID)) { 04527 UserAssertMsg1(FALSE, "Bad wParam %x for MN_SELECTITEM", wParam); 04528 break; 04529 } 04530 04531 pItem = xxxMNSelectItem(ppopupmenu, pMenuState, (UINT)wParam); 04532 if (pItem != NULL) { 04533 return((LONG)(DWORD)(WORD)(pItem->fState | 04534 ((pItem->spSubMenu != NULL) ? MF_POPUP : 0))); 04535 } 04536 04537 break; 04538 04539 case MN_SELECTFIRSTVALIDITEM: { 04540 UINT item; 04541 04542 item = MNFindNextValidItem(pmenu, -1, 1, TRUE); 04543 xxxSendMessage(pwnd, MN_SELECTITEM, item, 0L); 04544 return (LONG)item; 04545 } 04546 04547 case MN_CANCELMENUS: 04548 04549 /* 04550 * Cancels all menus, unselects everything, destroys windows, and cleans 04551 * everything up for this hierarchy. wParam is the command to send and 04552 * lParam says if it is valid or not. 04553 */ 04554 xxxMNCancel(pMenuState, (UINT)wParam, (BOOL)LOWORD(lParam), 0); 04555 break; 04556 04557 case MN_FINDMENUWINDOWFROMPOINT: 04558 /* 04559 * lParam is point to search for from this hierarchy down. 04560 * returns MFMWFP_* value or a pwnd. 04561 */ 04562 lRet = xxxMNFindWindowFromPoint(ppopupmenu, (PUINT)wParam, MAKEPOINTS(lParam)); 04563 04564 /* 04565 * Convert return value to a handle. 04566 */ 04567 if (IsMFMWFPWindow(lRet)) { 04568 return (LRESULT)HW((PWND)lRet); 04569 } else { 04570 return lRet; 04571 } 04572 04573 04574 case MN_SHOWPOPUPWINDOW: 04575 /* 04576 * Forces the dropped down popup to be visible and if modeless, also active. 04577 */ 04578 PlayEventSound(USER_SOUND_MENUPOPUP); 04579 xxxShowWindow(pwnd, (pMenuState->fModelessMenu ? SW_SHOW : SW_SHOWNOACTIVATE)); 04580 break; 04581 04582 case MN_ACTIVATEPOPUP: 04583 /* 04584 * Activates a popup. This messages is posted in response to WM_ACTIVATEAPP 04585 * or WM_ACTIVATE 04586 */ 04587 UserAssert(pMenuState->fModelessMenu); 04588 xxxActivateThisWindow(pwnd, 0, 0); 04589 break; 04590 04591 case MN_ENDMENU: 04592 /* 04593 * End the menu. This message is posted to avoid ending the menu 04594 * at randmom moments. By posting the message, the request is 04595 * queued after any pending/current processing. 04596 */ 04597 EndMenu: 04598 xxxEndMenuLoop(pMenuState, pMenuState->pGlobalPopupMenu); 04599 if (pMenuState->fModelessMenu) { 04600 UserAssert(!pMenuState->fInCallHandleMenuMessages); 04601 xxxMNEndMenuState(TRUE); 04602 } 04603 return 0; 04604 04605 case MN_DODRAGDROP: 04606 /* 04607 * Let the app know that the user is dragging. 04608 */ 04609 if (pMenuState->fDragging 04610 && (ppopupmenu->spwndNotify != NULL) 04611 && IsMFMWFPWindow(pMenuState->uButtonDownHitArea)) { 04612 /* 04613 * Get the pmenu that contains the item being dragged 04614 */ 04615 pmenu = (((PMENUWND)pMenuState->uButtonDownHitArea)->ppopupmenu)->spmenu; 04616 /* 04617 * If this is a modal menu, release the capture lock so 04618 * DoDragDrop (if called) can get it. 04619 */ 04620 if (!pMenuState->fModelessMenu) { 04621 UserAssert(PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED); 04622 PtiCurrent()->pq->QF_flags &= ~QF_CAPTURELOCKED; 04623 } 04624 04625 LockMenuState(pMenuState); 04626 ThreadLockAlways(ppopupmenu->spwndNotify, &tlpwndNotify); 04627 04628 /* 04629 * Give them a chance to call DoDragDrop 04630 */ 04631 pMenuState->fInDoDragDrop = TRUE; 04632 lRet = xxxSendMessage(ppopupmenu->spwndNotify, WM_MENUDRAG, 04633 pMenuState->uButtonDownIndex, (LPARAM)PtoH(pmenu)); 04634 pMenuState->fInDoDragDrop = FALSE; 04635 04636 if (lRet == MND_ENDMENU) { 04637 /* 04638 * Go away. 04639 */ 04640 ThreadUnlock(&tlpwndNotify); 04641 if (!xxxUnlockMenuState(pMenuState)) { 04642 goto EndMenu; 04643 } else { 04644 return 0; 04645 } 04646 break; 04647 } else { 04648 /* 04649 * If the user starts dragging, we always 04650 * ignore the following button up 04651 */ 04652 pMenuState->fIgnoreButtonUp = TRUE; 04653 } 04654 04655 /* 04656 * Check the button state since we might have not seen the button up 04657 * If so, this will cancel the dragging state 04658 */ 04659 MNCheckButtonDownState(pMenuState); 04660 04661 /* 04662 * If this is a modal menu, make sure we recover capture 04663 */ 04664 if (!pMenuState->fModelessMenu) { 04665 xxxMNSetCapture(ppopupmenu); 04666 } 04667 04668 ThreadUnlock(&tlpwndNotify); 04669 xxxUnlockMenuState(pMenuState); 04670 } 04671 return 0; 04672 04673 case MN_BUTTONDOWN: 04674 04675 /* 04676 * wParam is position (index) of item the button was clicked on. 04677 * Must be a valid 04678 */ 04679 if ((wParam >= pmenu->cItems) && (wParam < MFMWFP_MINVALID)) { 04680 UserAssertMsg1(FALSE, "Bad wParam %x for MN_BUTTONDOWN", wParam); 04681 break; 04682 } 04683 xxxMNButtonDown(ppopupmenu, pMenuState, (UINT)wParam, TRUE); 04684 break; 04685 04686 case MN_MOUSEMOVE: 04687 04688 /* 04689 * lParam is mouse move coordinate wrt screen. 04690 */ 04691 xxxMNMouseMove(ppopupmenu, pMenuState, MAKEPOINTS(lParam)); 04692 break; 04693 04694 case MN_BUTTONUP: 04695 04696 /* 04697 * wParam is position (index) of item the button was up clicked on. 04698 */ 04699 if ((wParam >= pmenu->cItems) && (wParam < MFMWFP_MINVALID)) { 04700 UserAssertMsg1(FALSE, "Bad wParam %x for MN_BUTTONUP", wParam); 04701 break; 04702 } 04703 xxxMNButtonUp(ppopupmenu, pMenuState, (UINT)wParam, lParam); 04704 break; 04705 04706 case MN_SETTIMERTOOPENHIERARCHY: 04707 04708 /* 04709 * Given the current selection, set a timer to show this hierarchy if 04710 * valid else return 0. 04711 */ 04712 return (LONG)(WORD)MNSetTimerToOpenHierarchy(ppopupmenu); 04713 04714 case MN_DBLCLK: 04715 // 04716 // User double-clicked on item. wParamLo is the item. 04717 // 04718 xxxMNDoubleClick(pMenuState, ppopupmenu, (int)wParam); 04719 break; 04720 04721 case WM_MOUSELEAVE: 04722 UserAssert(pMenuState->fModelessMenu); 04723 /* 04724 * If we're in DoDragDrop loop, we don't track the mouse 04725 * when it goes off the menu window 04726 */ 04727 pMenuState->fMouseOffMenu = !pMenuState->fInDoDragDrop; 04728 ppopupmenu->fTrackMouseEvent = FALSE; 04729 /* 04730 * See if we need to set the timer to autodismiss 04731 */ 04732 MNSetTimerToAutoDismiss(pMenuState, pwnd); 04733 /* 04734 * If we left the active popup, remove the selection 04735 */ 04736 if (ppopupmenu->spwndPopupMenu == pMenuState->pGlobalPopupMenu->spwndActivePopup) { 04737 xxxMNSelectItem(ppopupmenu, pMenuState, MFMWFP_NOITEM); 04738 } 04739 break; 04740 04741 case WM_ACTIVATEAPP: 04742 if (pMenuState->fModelessMenu 04743 && (pwnd == pMenuState->pGlobalPopupMenu->spwndActivePopup)) { 04744 /* 04745 * If the application is getting activated, we post a message 04746 * to let the dust settle and then re-activate spwndPopupActive 04747 */ 04748 if (wParam) { 04749 _PostMessage(pwnd, MN_ACTIVATEPOPUP, 0, 0); 04750 /* 04751 * If we're not in the foregruond queue, we want to keep 04752 * the frame off. 04753 * This flag will also tell us that if we lose activation 04754 * while coming to the foregrund (later), we don't want 04755 * to dismiss the menu. 04756 */ 04757 pMenuState->fActiveNoForeground = (gpqForeground != PtiCurrent()->pq); 04758 } 04759 04760 /* 04761 * Make the notification window frame show that we're active/inactive. 04762 * If the application is inactive but the user moves the mouse 04763 * over the menu, then we can get this message when the first 04764 * window in the app gets activated (i.e., the move causes a popup to 04765 * be closed/opened). So turn on the frame only if we're in 04766 * the foreground. 04767 */ 04768 if (ppopupmenu->spwndNotify != NULL) { 04769 ThreadLockAlways(ppopupmenu->spwndNotify, &tlpwndNotify); 04770 xxxDWP_DoNCActivate(ppopupmenu->spwndNotify, 04771 ((wParam && !pMenuState->fActiveNoForeground) ? NCA_ACTIVE : NCA_FORCEFRAMEOFF), 04772 HRGN_FULL); 04773 ThreadUnlock(&tlpwndNotify); 04774 } 04775 } 04776 break; 04777 04778 case WM_ACTIVATE: 04779 if (pMenuState->fModelessMenu) { 04780 /* 04781 * If activation is NOT going to a menu window or 04782 * it's going to a recursed menu, bail 04783 */ 04784 if ((LOWORD(wParam) == WA_INACTIVE) 04785 && !pMenuState->fInCallHandleMenuMessages 04786 && !pMenuState->pGlobalPopupMenu->fInCancel) { 04787 04788 lParam = (LPARAM)RevalidateHwnd((HWND)lParam); 04789 if ((lParam != 0) 04790 && ((GETFNID((PWND)lParam) != FNID_MENU) 04791 || IsRecursedMenuState(pMenuState, ((PMENUWND)lParam)->ppopupmenu))) { 04792 /* 04793 * If we're just coming to the foreground, then 04794 * activate the popup later and stay up. 04795 */ 04796 if (pMenuState->fActiveNoForeground 04797 && (gpqForeground == PtiCurrent()->pq)) { 04798 04799 pMenuState->fActiveNoForeground = FALSE; 04800 _PostMessage(pwnd, MN_ACTIVATEPOPUP, 0, 0); 04801 } else { 04802 /* 04803 * Since the menu window is active, ending the menu 04804 * now would set a new active window, messing the 04805 * current activation that sent us this message. 04806 * so end the menu later. 04807 */ 04808 _PostMessage(pwnd, MN_ENDMENU, 0, 0); 04809 break; 04810 } 04811 } 04812 } 04813 goto CallDWP; 04814 } /* if (pMenuState->fModelessMenu) */ 04815 04816 /* 04817 * We must make sure that the menu window does not get activated. 04818 * Powerpoint 2.00e activates it deliberately and this causes problems. 04819 * We try to activate the previously active window in such a case. 04820 * Fix for Bug #13961 --SANKAR-- 09/26/91-- 04821 */ 04822 /* 04823 * In Win32, wParam has other information in the hi 16bits, so to 04824 * prevent infinite recursion, we need to mask off those bits 04825 * Fix for NT bug #13086 -- 23-Jun-1992 JonPa 04826 * 04827 */ 04828 04829 if (LOWORD(wParam)) { 04830 TL tlpwnd; 04831 /* 04832 * This is a super bogus hack. Let's start failing this for 5.0 apps. 04833 */ 04834 if (Is500Compat(PtiCurrent()->dwExpWinVer)) { 04835 RIPMSG1(RIP_ERROR, "xxxMenuWindowProc: Menu window activated:%#p", pwnd); 04836 _PostMessage(pwnd, MN_ENDMENU, 0, 0); 04837 break; 04838 } 04839 04840 #if 0 04841 /* 04842 * Activate the previously active wnd 04843 */ 04844 xxxActivateWindow(pwnd, AW_SKIP2); 04845 #else 04846 /* 04847 * Try the previously active window. 04848 */ 04849 if ((gpqForegroundPrev != NULL) && 04850 !FBadWindow(gpqForegroundPrev->spwndActivePrev) && 04851 !ISAMENU(gpqForegroundPrev->spwndActivePrev)) { 04852 pwnd = gpqForegroundPrev->spwndActivePrev; 04853 } else { 04854 04855 /* 04856 * Find a new active window from the top-level window list. 04857 * Bug 78131: Make sure we don't loop for ever. This is a pretty 04858 * unusual scenario (in addtion, normally we should not hit this code path) 04859 * So let's use a counter to rule out the possibility that another 04860 * weird window configuration is going to make us loop for ever 04861 */ 04862 PWND pwndMenu = pwnd; 04863 UINT uCounter = 0; 04864 do { 04865 pwnd = NextTopWindow(PtiCurrent(), pwnd, NULL, 0); 04866 if (pwnd && !FBadWindow(pwnd->spwndLastActive) && 04867 !ISAMENU(pwnd->spwndLastActive)) { 04868 pwnd = pwnd->spwndLastActive; 04869 uCounter = 0; 04870 break; 04871 } 04872 } while ((pwnd != NULL) && (uCounter++ < 255)); 04873 /* 04874 * If we couldn't find a window, just bail. 04875 */ 04876 if (uCounter != 0) { 04877 RIPMSG0(RIP_ERROR, "xxxMenuWindowProc: couldn't fix active window"); 04878 _PostMessage(pwndMenu, MN_ENDMENU, 0, 0); 04879 break; 04880 } 04881 } 04882 04883 if (pwnd != NULL) { 04884 PTHREADINFO pti = PtiCurrent(); 04885 ThreadLockAlwaysWithPti(pti, pwnd, &tlpwnd); 04886 04887 /* 04888 * If GETPTI(pwnd) isn't pqCurrent this is a AW_SKIP* activation 04889 * we'll want to a do a xxxSetForegroundWindow(). 04890 */ 04891 if (GETPTI(pwnd)->pq != pti->pq) { 04892 04893 /* 04894 * Only allow this if we're on the current foreground queue. 04895 */ 04896 if (gpqForeground == pti->pq) { 04897 xxxSetForegroundWindow(pwnd, FALSE); 04898 } 04899 } else { 04900 xxxActivateThisWindow(pwnd, 0, ATW_SETFOCUS); 04901 } 04902 04903 ThreadUnlock(&tlpwnd); 04904 } 04905 #endif 04906 } 04907 break; 04908 04909 case WM_SIZE: 04910 case WM_MOVE: 04911 /* 04912 * When a popup has been sized/moved, we need to make 04913 * sure any dropped hierarchy is moved accordingly. 04914 */ 04915 if (ppopupmenu->spwndNextPopup != NULL) { 04916 pItem = MNGetpItem(ppopupmenu, ppopupmenu->posDropped); 04917 if (pItem != NULL) { 04918 int x, y; 04919 PMONITOR pMonitorDummy; 04920 04921 /* 04922 * If the dropped hierarchy needs to be recomputed, do it 04923 */ 04924 #define pmenuNext (((PMENUWND)ppopupmenu->spwndNextPopup)->ppopupmenu->spmenu) 04925 if (pmenuNext->cxMenu == 0) { 04926 xxxSendMessage(ppopupmenu->spwndNextPopup, MN_SIZEWINDOW, MNSW_RETURNSIZE, 0L); 04927 } 04928 04929 /* 04930 * Find out the new position 04931 */ 04932 xxxMNPositionHierarchy(ppopupmenu, pItem, 04933 pmenuNext->cxMenu + (2 * SYSMET(CXFIXEDFRAME)), 04934 pmenuNext->cyMenu + (2 * SYSMET(CXFIXEDFRAME)), 04935 &x, &y, &pMonitorDummy); 04936 04937 /* 04938 * Move it 04939 */ 04940 ThreadLockAlways(ppopupmenu->spwndNextPopup, &tlpwndNotify); 04941 xxxSetWindowPos(ppopupmenu->spwndNextPopup, NULL, 04942 x, y, 0, 0, 04943 SWP_NOSIZE | SWP_NOZORDER | SWP_NOSENDCHANGING); 04944 ThreadUnlock(&tlpwndNotify); 04945 #undef pmenuNext 04946 } /* if (pItem != NULL) */ 04947 } /* if (ppopupmenu->spwndNextPopup != NULL) */ 04948 break; 04949 04950 case WM_NCHITTEST: 04951 /* 04952 * Since modeless menus don't capture the mouse, we 04953 * process this message to make sure that we always receive 04954 * a mouse move when the mouse in our window. 04955 * This also causes us to receive the WM_MOUSELEAVE only when 04956 * the mouse leaves the window and not just the client area. 04957 */ 04958 if (pMenuState->fModelessMenu) { 04959 ptOrg.x = GET_X_LPARAM(lParam); 04960 ptOrg.y = GET_Y_LPARAM(lParam); 04961 if (PtInRect(&pwnd->rcWindow, ptOrg)) { 04962 return HTCLIENT; 04963 } else { 04964 return HTNOWHERE; 04965 } 04966 } else { 04967 goto CallDWP; 04968 } 04969 04970 04971 default: 04972 CallDWP: 04973 return xxxDefWindowProc(pwnd, message, wParam, lParam); 04974 } 04975 04976 return 0; 04977 }

BOOL xxxMessageBeep UINT  wType  ) 
 

Definition at line 52 of file kernel/msgbeep.c.

References _PostMessage(), _UserSoundSentryWorker(), BOOL, gspwndLogonNotify, PtiCurrent, PUDF_BEEP, TEST_PUDF, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, TRUE, UINT, USER_SOUND_DEFAULT, USER_SOUND_SYSTEMASTERISK, USER_SOUND_SYSTEMEXCLAMATION, USER_SOUND_SYSTEMHAND, USER_SOUND_SYSTEMQUESTION, and xxxOldMessageBeep().

Referenced by xxxDefWindowProc(), xxxDWP_SetCursor(), xxxInternalToUnicode(), xxxMNChar(), and xxxMNKeyFilter().

00054 { 00055 UINT sndid; 00056 PTHREADINFO pti = PtiCurrent(); 00057 00058 if (pti->TIF_flags & TIF_SYSTEMTHREAD) { 00059 xxxOldMessageBeep(); 00060 return TRUE; 00061 } 00062 00063 if (!TEST_PUDF(PUDF_BEEP)) { 00064 _UserSoundSentryWorker(); 00065 return TRUE; 00066 } 00067 00068 switch(dwType & MB_ICONMASK) { 00069 case MB_ICONHAND: 00070 sndid = USER_SOUND_SYSTEMHAND; 00071 break; 00072 00073 case MB_ICONQUESTION: 00074 sndid = USER_SOUND_SYSTEMQUESTION; 00075 break; 00076 00077 case MB_ICONEXCLAMATION: 00078 sndid = USER_SOUND_SYSTEMEXCLAMATION; 00079 break; 00080 00081 case MB_ICONASTERISK: 00082 sndid = USER_SOUND_SYSTEMASTERISK; 00083 break; 00084 00085 default: 00086 sndid = USER_SOUND_DEFAULT; 00087 break; 00088 } 00089 00090 if (gspwndLogonNotify) { 00091 _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, sndid); 00092 } 00093 00094 _UserSoundSentryWorker(); 00095 00096 return TRUE; 00097 }

VOID xxxMetricsRecalc UINT  wFlags,
int  dx,
int  dy,
int  dyCaption,
int  dyMenu
 

Definition at line 362 of file rare.c.

References _GetProp(), BOOL, BuildHwndList(), BWL_ENUMCHILDREN, BWL_ENUMLIST, c, CALC_FRAME, CALC_MINIMIZE, CALC_RESIZE, CopyInflateRect(), CopyRect, FALSE, tagCHECKPOINT::fMaxInitialized, FNID_MDICLIENT, FreeHwndList(), GETDESKINFO, GETFNID, InflateRect(), NULL, OffsetRect(), PHWND, tagBWL::phwndNext, PROP_CHECKPOINT, PROPF_INTERNAL, PtiCurrent, tagCHECKPOINT::ptMax, PWND_TOP, PWNDDESKTOP, tagWND::rcClient, tagCHECKPOINT::rcNormal, tagWND::rcWindow, RevalidateHwnd, tagBWL::rghwnd, tagWND::spwndParent, TestWF, ThreadLockAlwaysWithPti, ThreadUnlock, TRUE, WFCHILD, WFCPRESENT, WFMAXIMIZED, WFMINIMIZED, WFMPRESENT, WFSIZEBOX, xxxSendMessage(), and xxxSetWindowPos().

Referenced by xxxSetAndDrawMinMetrics(), xxxSetAndDrawNCMetrics(), and xxxSystemParametersInfo().

00368 { 00369 PHWND phwnd; 00370 PWND pwnd; 00371 RECT rc; 00372 PCHECKPOINT pcp; 00373 TL tlpwnd; 00374 BOOL fResized; 00375 PBWL pbwl; 00376 PTHREADINFO ptiCurrent; 00377 int c; 00378 00379 ptiCurrent = PtiCurrent(); 00380 pbwl = BuildHwndList( 00381 GETDESKINFO(ptiCurrent)->spwnd->spwndChild, 00382 BWL_ENUMLIST | BWL_ENUMCHILDREN, 00383 NULL); 00384 00385 if (!pbwl) 00386 return; 00387 00388 UserAssert(*pbwl->phwndNext == (HWND) 1); 00389 for ( c = (int)(pbwl->phwndNext - pbwl->rghwnd), phwnd = pbwl->rghwnd; 00390 c > 0; 00391 c--, phwnd++) { 00392 00393 pwnd = RevalidateHwnd(*phwnd); 00394 if (!pwnd) 00395 continue; 00396 00397 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwnd); 00398 00399 fResized = FALSE; 00400 00401 if ((wFlags & CALC_MINIMIZE) && TestWF(pwnd, WFMINIMIZED)) { 00402 /* 00403 * We're changing the minimized window dimensions. We need to 00404 * resize. Note that we do NOT move. 00405 */ 00406 CopyRect(&rc, (&pwnd->rcWindow)); 00407 rc.right += dx; 00408 rc.bottom += dy; 00409 00410 goto PositionWnd; 00411 } 00412 00413 /* 00414 * We're changing the size of the window because the sizing border 00415 * changed. 00416 */ 00417 if ((wFlags & CALC_RESIZE) && TestWF(pwnd, WFSIZEBOX)) { 00418 00419 pcp = (CHECKPOINT *)_GetProp(pwnd, PROP_CHECKPOINT, PROPF_INTERNAL); 00420 00421 /* 00422 * Update maximized position to account for sizing border 00423 * We do this for DOS box also. This way client of max'ed windows 00424 * stays in same relative position. 00425 */ 00426 if (pcp && (pcp->fMaxInitialized)) { 00427 pcp->ptMax.x -= dx; 00428 pcp->ptMax.y -= dy; 00429 } 00430 00431 if (TestWF(pwnd, WFMINIMIZED)) { 00432 if (pcp) 00433 InflateRect(&pcp->rcNormal, dx, dy); 00434 } else { 00435 CopyInflateRect(&rc, (&pwnd->rcWindow), dx, dy); 00436 if (TestWF(pwnd, WFCPRESENT)) 00437 rc.bottom += dyCaption; 00438 if (TestWF(pwnd, WFMPRESENT)) 00439 rc.bottom += dyMenu; 00440 00441 PositionWnd: 00442 fResized = TRUE; 00443 00444 /* 00445 * Remember SWP expects values in PARENT CLIENT coordinates. 00446 */ 00447 if (pwnd->spwndParent != PWNDDESKTOP(pwnd)) { 00448 OffsetRect(&rc, 00449 -pwnd->spwndParent->rcClient.left, 00450 -pwnd->spwndParent->rcClient.top); 00451 } 00452 00453 xxxSetWindowPos(pwnd, 00454 PWND_TOP, 00455 rc.left, 00456 rc.top, 00457 rc.right-rc.left, 00458 rc.bottom-rc.top, 00459 00460 #if 0 // Win95 flags 00461 SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERDRAWING | SWP_FRAMECHANGED); 00462 #else 00463 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOREDRAW); 00464 #endif 00465 } 00466 } 00467 00468 /* 00469 * We're changing the nonclient widgets, so recalculate the 00470 * client. 00471 */ 00472 if (wFlags & CALC_FRAME) { 00473 00474 /* 00475 * Delete any cached small icons... 00476 */ 00477 if (dyCaption) 00478 xxxSendMessage(pwnd, WM_SETICON, ICON_RECREATE, 0); 00479 00480 if (!TestWF(pwnd, WFMINIMIZED) && !fResized) { 00481 00482 CopyRect(&rc, &(pwnd->rcWindow)); 00483 if (TestWF(pwnd, WFMPRESENT)) 00484 rc.bottom += dyMenu; 00485 00486 if (TestWF(pwnd, WFCPRESENT)) { 00487 rc.bottom += dyCaption; 00488 /* 00489 * Maximized MDI child windows position their caption 00490 * outside their parent's client area (negative y). 00491 * If the caption has changed, they need to be 00492 * repositioned. 00493 */ 00494 if (TestWF(pwnd, WFMAXIMIZED) 00495 && TestWF(pwnd, WFCHILD) 00496 && (GETFNID(pwnd->spwndParent) == FNID_MDICLIENT)) { 00497 00498 xxxSetWindowPos(pwnd, 00499 PWND_TOP, 00500 rc.left - pwnd->spwndParent->rcWindow.left, 00501 rc.top - pwnd->spwndParent->rcWindow.top - dyCaption, 00502 rc.right - rc.left, 00503 rc.bottom- rc.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOREDRAW); 00504 goto LoopCleanup; 00505 } 00506 } 00507 00508 xxxSetWindowPos(pwnd, 00509 PWND_TOP, 00510 0, 00511 0, 00512 rc.right-rc.left, 00513 rc.bottom-rc.top, 00514 #if 0 // Win95 flags 00515 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOREDRAW); 00516 #else 00517 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_NOREDRAW); 00518 #endif 00519 } 00520 } 00521 00522 LoopCleanup: 00523 ThreadUnlock(&tlpwnd); 00524 } 00525 00526 FreeHwndList(pbwl); 00527 }

void xxxMinimizeHungWindow PWND  pwnd  ) 
 

Definition at line 2005 of file minmax.c.

References CheckLock, GETPTI, IDC_DEFAULT, IsRectEmpty(), NULL, PostEventMessage(), PUDF_ANIMATE, PWNDDESKTOP, QEVENT_HUNGTHREAD, tagWND::rcWindow, SetRectEmpty, SetVisible(), tagWND::spwndParent, SV_UNSET, TEST_PUDF, TestWF, WFMINIMIZED, WFVISIBLE, xxxActivateOnMinimize(), xxxDrawAnimatedRects(), xxxRedrawWindow(), xxxSendMinRectMessages(), xxxShowOwnedWindows(), and zzzInvalidateDCCache().

Referenced by xxxDesktopThread(), and xxxShowWindow().

02006 { 02007 RECT rcMin; 02008 HRGN hrgnHung; 02009 02010 02011 CheckLock(pwnd); 02012 02013 /* 02014 * If the window is already minimized or not visible don't do anything. 02015 */ 02016 if (TestWF(pwnd, WFMINIMIZED) || !TestWF(pwnd, WFVISIBLE)) 02017 return; 02018 02019 /* 02020 * Animate the caption to the minimized state. 02021 */ 02022 if (TEST_PUDF(PUDF_ANIMATE)) { 02023 SetRectEmpty(&rcMin); 02024 xxxSendMinRectMessages(pwnd, &rcMin); 02025 if (!IsRectEmpty(&rcMin)) { 02026 xxxDrawAnimatedRects(pwnd, IDANI_CAPTION, &pwnd->rcWindow, &rcMin); 02027 } 02028 } 02029 02030 /* 02031 * Reset the visible bit on the window itself and ownees. At the same 02032 * time calculate how much needs to be repainted. We must invalidate 02033 * the DC cache to make sure that the visible regions get recalculated. 02034 */ 02035 SetVisible(pwnd, SV_UNSET); 02036 hrgnHung = GreCreateRectRgnIndirect(&pwnd->rcWindow); 02037 xxxShowOwnedWindows(pwnd, SW_PARENTCLOSING, hrgnHung); 02038 zzzInvalidateDCCache(pwnd, IDC_DEFAULT); 02039 xxxRedrawWindow(NULL, NULL, hrgnHung, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN); 02040 GreDeleteObject(hrgnHung); 02041 02042 /* 02043 * Deal with activating some other window for top-level windows. 02044 */ 02045 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 02046 xxxActivateOnMinimize(pwnd); 02047 } 02048 PostEventMessage(GETPTI(pwnd), GETPTI(pwnd)->pq, QEVENT_HUNGTHREAD, pwnd, 0, 0, 0); 02049 }

PWND xxxMinMaximize PWND  pwnd,
UINT  cmd,
DWORD  dwFlags
 

Definition at line 1329 of file minmax.c.

References _DeferWindowPos(), _PostMessage(), tagSMWP::acvr, AW_SKIP, BOOL, CalcMinZOrder(), CheckLock, CkptRestore(), ClrFTrueVis(), ClrWF, tagDISPLAYINFO::cMonitors, CopyRect, dwFlags, DWORD, FALSE, FCallHookTray, FDoTray, tagCHECKPOINT::fDragged, tagCHECKPOINT::fMinInitialized, FPostTray, tagCHECKPOINT::fWasMaximizedBeforeMinimized, tagCHECKPOINT::fWasMinimizedBeforeMaximized, FWINABLE, GETPTI, GetRect(), gpDispInfo, gpqForeground, gptiForeground, GRECT_PARENTCOORDS, GRECT_WINDOW, HIBYTE, HRGN_FULL, HRGN_MONITOR, tagCVR::hrgnClip, HWq, InternalBeginDeferWindowPos(), IsHooked, IsRectEmpty(), IsTrayWindow(), IsVisible(), KeAttachProcess(), KeDetachProcess(), L, MINMAX_ANIMATE, MINMAX_KEEPHIDDEN, MmAdjustWorkingSetSize(), NT_SUCCESS, NTSTATUS(), NULL, ParkIcon(), _EPROCESS::Pcb, PostShellHookMessages(), tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrent, tagCHECKPOINT::ptMin, PtoHq, PWNDDESKTOP, tagCHECKPOINT::rcNormal, tagWND::rcWindow, RestoreForegroundActivate(), RevalidateHwnd, SetMinimize(), SetRectEmpty, SetWF, SFW_STARTUP, SMIN_CLEAR, SMIN_SET, tagQ::spwndActive, tagWND::spwndChild, tagQ::spwndFocus, tagWND::spwndNext, tagWND::spwndParent, Status, SW_MDIRESTORE, SYSMET, TestWF, TestwndChild, THREAD_TO_PROCESS, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, TRUE, UINT, WEF_USEPWNDTHREAD, WFCHILD, WFHASPALETTE, WFMAXFAKEREGIONAL, WFMAXIMIZED, WFMINIMIZED, WFNOANIMATE, WFTOPLEVEL, WFVISIBLE, WFWIN40COMPAT, WHF_CBT, xxxActivateOnMinimize(), xxxActivateWindow(), xxxCallHook(), xxxDrawAnimatedRects(), xxxEndDeferWindowPosEx(), xxxFlushPalette(), xxxInitSendValidateMinMaxInfo(), xxxSendMessage(), xxxSendMinRectMessages(), xxxSetFocus(), xxxSetForegroundWindow2(), xxxShowOwnedWindows(), and xxxWindowEvent().

Referenced by NtUserMinMaximize(), xxxCreateWindowEx(), xxxProcessHungThreadEvent(), and xxxShowWindow().

01333 { 01334 RECT rc; 01335 RECT rcWindow; 01336 RECT rcRestore; 01337 BOOL fShow = FALSE; 01338 BOOL fSetFocus = FALSE; 01339 BOOL fShowOwned = FALSE; 01340 BOOL fSendActivate = FALSE; 01341 BOOL fMaxStateChanging = FALSE; 01342 int idAnimation = 0; 01343 BOOL fFlushPalette = FALSE; 01344 UINT swpFlags = 0; 01345 HWND hwndAfter = NULL; 01346 PWND pwndT; 01347 PCHECKPOINT pcp; 01348 PTHREADINFO ptiCurrent; 01349 TL tlpwndParent; 01350 TL tlpwndT; 01351 PSMWP psmwp; 01352 BOOL fIsTrayWindowNow = FALSE; 01353 NTSTATUS Status; 01354 MINMAXINFO mmi; 01355 UINT uEvent = 0; 01356 #if defined(USE_MIRRORING) 01357 PWND pwndParent = pwnd->spwndParent; 01358 BOOL bMirroredParent=FALSE; 01359 #endif 01360 01361 CheckLock(pwnd); 01362 01363 /* 01364 * Get window rect, in parent client coordinates. 01365 */ 01366 GetRect(pwnd, &rcWindow, GRECT_WINDOW | GRECT_PARENTCOORDS); 01367 01368 /* 01369 * If this is NULL, we're out of memory, so punt now. 01370 */ 01371 pcp = CkptRestore(pwnd, &rcWindow); 01372 if (!pcp) 01373 goto Exit; 01374 01375 #if defined(USE_MIRRORING) 01376 /* 01377 * If this top-level window is placed in a mirrored desktop, 01378 * its coordinates should be mirrored here so that xxxAnimateCaptions 01379 * works properly, however we shouldn't change the actual screen coordinates 01380 * of the window. This is why I do it after CkptRestore(...). [samera] 01381 */ 01382 if (TestWF(pwndParent,WEFLAYOUTRTL) && 01383 (!TestWF(pwnd,WFCHILD))) { 01384 int iLeft = rcWindow.left; 01385 rcWindow.left = pwndParent->rcWindow.right - rcWindow.right; 01386 rcWindow.right = pwndParent->rcWindow.right - iLeft; 01387 bMirroredParent = TRUE; 01388 } 01389 #endif 01390 01391 01392 /* 01393 * Save the previous restore size. 01394 */ 01395 CopyRect(&rcRestore, &pcp->rcNormal); 01396 01397 /* 01398 * First ask the CBT hook if we can do this operation. 01399 */ 01400 if ( IsHooked(PtiCurrent(), WHF_CBT) && 01401 xxxCallHook(HCBT_MINMAX, (WPARAM)HWq(pwnd), (DWORD)cmd, WH_CBT)) { 01402 01403 goto Exit; 01404 } 01405 01406 /* 01407 * If another MDI window is being maximized, and we want to restore this 01408 * one to its previous state, we can't change the zorder or the 01409 * activation. We'd screw things up that way. BTW, this SW_ value is 01410 * internal. 01411 */ 01412 if (cmd == SW_MDIRESTORE) { 01413 01414 swpFlags |= SWP_NOZORDER | SWP_NOACTIVATE; 01415 01416 cmd = (pcp->fWasMinimizedBeforeMaximized ? 01417 SW_SHOWMINIMIZED : SW_SHOWNORMAL); 01418 } 01419 01420 ptiCurrent = PtiCurrent(); 01421 01422 switch (cmd) { 01423 case SW_MINIMIZE: // Bottom of zorder, make top-level active 01424 case SW_SHOWMINNOACTIVE: // Bottom of zorder, don't change activation 01425 01426 if (gpqForeground && gpqForeground->spwndActive) 01427 swpFlags |= SWP_NOACTIVATE; 01428 01429 if ((pwndT = CalcMinZOrder(pwnd)) == NULL) { 01430 swpFlags |= SWP_NOZORDER; 01431 } else { 01432 hwndAfter = PtoHq(pwndT); 01433 } 01434 01435 01436 /* 01437 * FALL THRU 01438 */ 01439 01440 case SW_SHOWMINIMIZED: // Top of zorder, make active 01441 01442 /* 01443 * Force a show. 01444 */ 01445 fShow = TRUE; 01446 01447 /* 01448 * If already minimized, then don't change the existing 01449 * parking spot. 01450 */ 01451 if (TestWF(pwnd, WFMINIMIZED)) { 01452 01453 /* 01454 * If we're already minimized and we're properly visible 01455 * or not visible, don't do anything 01456 */ 01457 if (TestWF(pwnd, WFVISIBLE)) 01458 return NULL; 01459 01460 swpFlags |= SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE; 01461 01462 goto Showit; 01463 } 01464 01465 /* 01466 * We're becoming minimized although we currently are not. So 01467 * we want to draw the transition animation, and ALWAYS send 01468 * sizing messages. 01469 */ 01470 idAnimation = IDANI_CLOSE; 01471 01472 if (!pcp->fDragged) 01473 pcp->fMinInitialized = FALSE; 01474 01475 if (!pcp->fMinInitialized) 01476 ParkIcon(pwnd, pcp); 01477 01478 rc.left = pcp->ptMin.x; 01479 rc.top = pcp->ptMin.y; 01480 rc.right = pcp->ptMin.x + SYSMET(CXMINIMIZED); 01481 rc.bottom = pcp->ptMin.y + SYSMET(CYMINIMIZED); 01482 01483 xxxShowOwnedWindows(pwnd, SW_PARENTCLOSING, NULL); 01484 01485 pwndT = ptiCurrent->pq->spwndFocus; 01486 01487 while (pwndT) { 01488 01489 /* 01490 * if we or any child has the focus, punt it away 01491 */ 01492 if (pwndT != pwnd) { 01493 pwndT = pwndT->spwndParent; 01494 continue; 01495 } 01496 01497 ThreadLockAlwaysWithPti(ptiCurrent, pwndT, &tlpwndT); 01498 01499 if (TestwndChild(pwnd)) { 01500 01501 ThreadLockWithPti(ptiCurrent, pwnd->spwndParent, &tlpwndParent); 01502 xxxSetFocus(pwnd->spwndParent); 01503 ThreadUnlock(&tlpwndParent); 01504 01505 } else { 01506 xxxSetFocus(NULL); 01507 } 01508 01509 ThreadUnlock(&tlpwndT); 01510 break; 01511 } 01512 01513 /* 01514 * Save the maximized state so that we can restore the window maxed 01515 */ 01516 if (TestWF(pwnd, WFMAXIMIZED)) { 01517 pcp->fWasMaximizedBeforeMinimized = TRUE; 01518 fMaxStateChanging = TRUE; 01519 } else{ 01520 pcp->fWasMaximizedBeforeMinimized = FALSE; 01521 } 01522 01523 if (!TestWF(pwnd, WFWIN40COMPAT)) 01524 fIsTrayWindowNow = IsTrayWindow(pwnd); 01525 01526 /* 01527 * Decrement the visible-windows count only if the 01528 * window is visible. If the window is marked for 01529 * destruction, we will not decrement for that as 01530 * well. Let SetMinimize take care of this. 01531 */ 01532 SetMinimize(pwnd, SMIN_SET); 01533 ClrWF(pwnd, WFMAXIMIZED); 01534 01535 uEvent = EVENT_SYSTEM_MINIMIZESTART; 01536 01537 if (!TestWF(pwnd, WFWIN40COMPAT)) 01538 fIsTrayWindowNow = (fIsTrayWindowNow != IsTrayWindow(pwnd)); 01539 01540 /* 01541 * The children of this window are now no longer visible. 01542 * Ensure that they no longer have any update regions... 01543 */ 01544 for (pwndT = pwnd->spwndChild; pwndT; pwndT = pwndT->spwndNext) 01545 ClrFTrueVis(pwndT); 01546 01547 /* 01548 * B#2919 01549 * Ensure that the client area gets recomputed, and make 01550 * sure that no bits are copied when the size is changed. And 01551 * make sure that WM_SIZE messages get sent, even if our client 01552 * size is staying the same. 01553 */ 01554 swpFlags |= (SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_STATECHANGE); 01555 01556 /* 01557 * We are going minimized, so we want to give palette focus to 01558 * another app. 01559 */ 01560 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 01561 fFlushPalette = (BOOL)TestWF(pwnd, WFHASPALETTE); 01562 } 01563 01564 break; 01565 01566 case SW_SHOWNOACTIVATE: 01567 if (gpqForeground && gpqForeground->spwndActive) 01568 swpFlags |= SWP_NOACTIVATE; 01569 01570 /* 01571 * FALL THRU 01572 */ 01573 01574 case SW_RESTORE: 01575 01576 /* 01577 * If restoring a minimized window that was maximized before 01578 * being minimized, go back to being maximized. 01579 */ 01580 if (TestWF(pwnd, WFMINIMIZED) && pcp->fWasMaximizedBeforeMinimized) 01581 cmd = SW_SHOWMAXIMIZED; 01582 else 01583 cmd = SW_NORMAL; 01584 01585 /* 01586 * FALL THRU 01587 */ 01588 01589 case SW_NORMAL: 01590 case SW_SHOWMAXIMIZED: 01591 01592 if (cmd == SW_SHOWMAXIMIZED) { 01593 01594 /* 01595 * If already maximized and visible, we have nothing to do 01596 * Otherwise, for the DOSbox, still set fMaxStateChanging 01597 * to TRUE so we recalc the monitor region if need be. 01598 * That way WinOldAp can change its "changing from maxed to 01599 * maxed with new bigger font" code to work right. 01600 */ 01601 if (TestWF(pwnd, WFMAXIMIZED)) { 01602 if (TestWF(pwnd, WFVISIBLE)) { 01603 return NULL; 01604 } 01605 } else { 01606 /* 01607 * We're changing from normal to maximized, so always 01608 * send WM_SIZE. 01609 */ 01610 swpFlags |= SWP_STATECHANGE; 01611 } 01612 fMaxStateChanging = TRUE; 01613 01614 /* 01615 * If calling from CreateWindow, don't let the thing become 01616 * activated by the SWP call below. Acitvation will happen 01617 * on the ShowWindow done by CreateWindow or the app. 01618 */ 01619 if (dwFlags & MINMAX_KEEPHIDDEN) 01620 swpFlags |= SWP_NOACTIVATE; 01621 01622 /* 01623 * This is for MDI's auto-restore behaviour (craigc) 01624 */ 01625 if (TestWF(pwnd, WFMINIMIZED)) 01626 pcp->fWasMinimizedBeforeMaximized = TRUE; 01627 01628 xxxInitSendValidateMinMaxInfo(pwnd, &mmi); 01629 01630 } else { 01631 01632 /* 01633 * We're changing state from non-normal to normal. Make 01634 * sure WM_SIZE gets sents. 01635 */ 01636 UserAssert(HIBYTE(WFMINIMIZED) == HIBYTE(WFMAXIMIZED)); 01637 if (TestWF(pwnd, WFMINIMIZED | WFMAXIMIZED)) { 01638 swpFlags |= SWP_STATECHANGE; 01639 } 01640 if (TestWF(pwnd, WFMAXIMIZED)) { 01641 fMaxStateChanging = TRUE; 01642 } 01643 } 01644 01645 /* 01646 * If currently minimized, show windows' popups 01647 */ 01648 if (TestWF(pwnd, WFMINIMIZED)) { 01649 01650 /* 01651 * Send WM_QUERYOPEN to make sure this guy should unminimize 01652 */ 01653 if (!xxxSendMessage(pwnd, WM_QUERYOPEN, 0, 0L)) 01654 return NULL; 01655 01656 idAnimation = IDANI_OPEN; 01657 fShowOwned = TRUE; 01658 fSetFocus = TRUE; 01659 01660 /* 01661 * JEFFBOG B#2868 01662 * Condition added before setting fSendActivate prevents 01663 * WM_ACTIVATE message from reaching a child window. Might 01664 * be backwards compatibility problems if a pre 3.1 app 01665 * relies on WM_ACTIVATE reaching a child. 01666 */ 01667 if (!TestWF(pwnd, WFCHILD)) 01668 fSendActivate = TRUE; 01669 01670 swpFlags |= SWP_NOCOPYBITS; 01671 } else { 01672 idAnimation = IDANI_CAPTION; 01673 } 01674 01675 if (cmd == SW_SHOWMAXIMIZED) { 01676 rc.left = mmi.ptMaxPosition.x; 01677 rc.top = mmi.ptMaxPosition.y; 01678 rc.right = rc.left + mmi.ptMaxSize.x; 01679 rc.bottom = rc.top + mmi.ptMaxSize.y; 01680 01681 SetWF(pwnd, WFMAXIMIZED); 01682 01683 } else { 01684 CopyRect(&rc, &rcRestore); 01685 ClrWF(pwnd, WFMAXIMIZED); 01686 } 01687 01688 /* 01689 * We do this TestWF again since we left the critical section 01690 * above and someone might have already 'un-minimized us'. 01691 */ 01692 if (TestWF(pwnd, WFMINIMIZED)) { 01693 01694 if (!TestWF(pwnd, WFWIN40COMPAT)) 01695 fIsTrayWindowNow = IsTrayWindow(pwnd); 01696 01697 /* 01698 * Mark it as minimized and adjust cVisWindows. 01699 */ 01700 SetMinimize(pwnd, SMIN_CLEAR); 01701 01702 uEvent = EVENT_SYSTEM_MINIMIZEEND; 01703 01704 /* 01705 * if we're unminimizing a window that is now 01706 * not seen in maximized/restore mode then remove him 01707 * from the tray 01708 */ 01709 if (!TestWF(pwnd, WFWIN40COMPAT) && 01710 (fIsTrayWindowNow != IsTrayWindow(pwnd)) && 01711 FDoTray()) { 01712 01713 HWND hw = HWq(pwnd); 01714 01715 if (FCallHookTray()) { 01716 xxxCallHook(HSHELL_WINDOWDESTROYED, 01717 (WPARAM)hw, 01718 (LPARAM)0, 01719 WH_SHELL); 01720 } 01721 01722 /* 01723 * NT specific code. Post the window-destroyed message 01724 * to the shell. 01725 */ 01726 if (FPostTray(pwnd->head.rpdesk)) 01727 PostShellHookMessages(HSHELL_WINDOWDESTROYED, (LPARAM)hw); 01728 } 01729 01730 fIsTrayWindowNow = FALSE; 01731 01732 /* 01733 * If we're un-minimizing a visible top-level window, cVisWindows 01734 * was zero, and we're either activating a window or showing 01735 * the currently active window, set ourselves into the 01736 * foreground. If the window isn't currently visible 01737 * then we can rely on SetWindowPos() to do the right 01738 * thing for us. 01739 */ 01740 if (!TestwndChild(pwnd) && 01741 TestWF(pwnd, WFVISIBLE) && 01742 (GETPTI(pwnd)->cVisWindows == 1) && 01743 (GETPTI(pwnd)->pq != gpqForeground) && 01744 (!(swpFlags & SWP_NOACTIVATE) 01745 || (GETPTI(pwnd)->pq->spwndActive == pwnd))) { 01746 01747 xxxSetForegroundWindow2(pwnd, GETPTI(pwnd), SFW_STARTUP); 01748 } 01749 } 01750 01751 /* 01752 * Ensure that client area gets recomputed, and that 01753 * the frame gets redrawn to reflect the new state. 01754 */ 01755 swpFlags |= SWP_DRAWFRAME; 01756 break; 01757 } 01758 01759 /* 01760 * For the iconic case, we need to also show the window because it 01761 * might not be visible yet. 01762 */ 01763 01764 Showit: 01765 01766 if (!(dwFlags & MINMAX_KEEPHIDDEN)) { 01767 01768 if (TestWF(pwnd, WFVISIBLE)) { 01769 01770 if (fShow) 01771 swpFlags |= SWP_SHOWWINDOW; 01772 01773 /* if we're full screening a DOS BOX then don't draw 01774 * the animation 'cause it looks bad. 01775 * overloaded WFFULLSCREEN bit for MDI child windows -- 01776 * use it to indicate to not animate size change. 01777 */ 01778 if (IsVisible(pwnd) && 01779 (dwFlags & MINMAX_ANIMATE) && 01780 idAnimation && 01781 (!TestWF(pwnd, WFCHILD) || !TestWF(pwnd, WFNOANIMATE))) { 01782 01783 #if defined(USE_MIRRORING) 01784 /* 01785 * If this top-level window is placed in a mirrored desktop, 01786 * its coordinates should be mirrored here so that xxxAnimateCaptions 01787 * works properly, however we shouldn't change the actual screen coordinates 01788 * of the window. This is why I do it here and restore it afterwards before 01789 * doing the _DeferWindowPos(...). [samera] 01790 */ 01791 RECT rcT; 01792 if (bMirroredParent) { 01793 int iLeft = rc.left; 01794 rcT = rc; 01795 rc.left = pwndParent->rcWindow.right - rc.right; 01796 rc.right = pwndParent->rcWindow.right - iLeft; 01797 } 01798 #endif 01799 01800 if ((idAnimation != IDANI_CAPTION) && IsTrayWindow(pwnd)) { 01801 01802 RECT rcMin; 01803 01804 SetRectEmpty(&rcMin); 01805 #if 0 // Win95 call. 01806 CallHook(HSHELL_GETMINRECT, (WPARAM)HW16(hwnd), (LPARAM)(LPRECT)&rcMin, WH_SHELL); 01807 #else 01808 xxxSendMinRectMessages(pwnd, &rcMin); 01809 #endif 01810 01811 if (!IsRectEmpty(&rcMin)) { 01812 01813 if (idAnimation == IDANI_CLOSE) { 01814 01815 xxxDrawAnimatedRects(pwnd, 01816 IDANI_CAPTION, 01817 &rcWindow, 01818 &rcMin); 01819 01820 } else { 01821 01822 xxxDrawAnimatedRects(pwnd, 01823 IDANI_CAPTION, 01824 &rcMin, 01825 &rc); 01826 } 01827 } 01828 01829 } else { 01830 xxxDrawAnimatedRects(pwnd, IDANI_CAPTION, &rcWindow, &rc); 01831 } 01832 01833 #if defined(USE_MIRRORING) 01834 /* 01835 * Restore the original rect, after doing the animation 01836 */ 01837 if (bMirroredParent) { 01838 rc = rcT; 01839 } 01840 #endif 01841 } 01842 01843 } else { 01844 swpFlags |= SWP_SHOWWINDOW; 01845 } 01846 } 01847 01848 /* 01849 * hack for VB - we add their window in when their minimizing. 01850 */ 01851 if (!TestWF(pwnd, WFWIN40COMPAT) && fIsTrayWindowNow && FDoTray()) { 01852 01853 HWND hw = HWq(pwnd); 01854 01855 if (FCallHookTray()) { 01856 xxxCallHook(HSHELL_WINDOWCREATED, 01857 (WPARAM)hw, 01858 (LPARAM)0, 01859 WH_SHELL); 01860 } 01861 01862 /* 01863 * NT specific code. Post the window-created message 01864 * to the shell. 01865 */ 01866 if (FPostTray(pwnd->head.rpdesk)) 01867 PostShellHookMessages(HSHELL_WINDOWCREATED, (LPARAM)hw); 01868 } 01869 01870 /* 01871 * BACKWARD COMPATIBILITY HACK: 01872 * 01873 * Because SetWindowPos() won't honor sizing, moving and SWP_SHOWWINDOW 01874 * at the same time in version 3.0 or below, we call DeferWindowPos() 01875 * directly here. 01876 */ 01877 if (psmwp = InternalBeginDeferWindowPos(1)) { 01878 01879 psmwp = _DeferWindowPos(psmwp, 01880 pwnd, 01881 ((hwndAfter != NULL) ? RevalidateHwnd(hwndAfter) : NULL), 01882 rc.left, rc.top, 01883 rc.right - rc.left, 01884 rc.bottom - rc.top, 01885 swpFlags); 01886 01887 if (psmwp) { 01888 01889 /* 01890 * HACK FOR MULTIPLE MONITOR TRUE MAXIMIZATION CLIPPING 01891 * On a multiple monitor system, we would like the 01892 * borders not to spill over onto another monitor when a 01893 * window 'really' maximizes. The only way to get this 01894 * to work right is to set a rectangular region, namely 01895 * a copy of the monitor region, on the window. We can 01896 * only do this if the window isn't currently regional. 01897 * 01898 * Going to maximized: Add the monitor region 01899 * Coming from maximized: Remove the monitor region 01900 */ 01901 if (fMaxStateChanging && gpDispInfo->cMonitors > 1) { 01902 if ( TestWF(pwnd, WFMAXIMIZED) && 01903 pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 01904 01905 psmwp->acvr[0].hrgnClip = HRGN_MONITOR; 01906 01907 } else if (TestWF(pwnd, WFMAXFAKEREGIONAL)) { 01908 UserAssert(pwnd->hrgnClip); 01909 psmwp->acvr[0].hrgnClip = HRGN_FULL; 01910 } 01911 } 01912 01913 xxxEndDeferWindowPosEx(psmwp, FALSE); 01914 } 01915 } 01916 01917 if (FWINABLE() && uEvent) { 01918 xxxWindowEvent(uEvent, pwnd, OBJID_WINDOW, 0, WEF_USEPWNDTHREAD); 01919 } 01920 01921 /* 01922 * COMPATIBILITY HACK: 01923 * Borland's OBEX expects a WM_PAINT message when it starts running 01924 * minimized and initializes all it's data during that message. 01925 * So, we generate a bogus WM_PAINT message here. 01926 * Also, Visionware's XServer can not handle getting a WM_PAINT msg, as it 01927 * would always get a WM_PAINTICON msg in 3.1, so make sure the logic is here 01928 * to generate the correct message. 01929 */ 01930 if((cmd == SW_SHOWMINIMIZED) && 01931 (!TestWF(pwnd, WFWIN40COMPAT)) && 01932 TestWF(pwnd, WFVISIBLE) && 01933 TestWF(pwnd, WFTOPLEVEL)) { 01934 01935 if (pwnd->pcls->spicn) 01936 _PostMessage(pwnd, WM_PAINTICON, (WPARAM)TRUE, 0L); 01937 else 01938 _PostMessage(pwnd, WM_PAINT, 0, 0L); 01939 } 01940 01941 if (fShowOwned) 01942 xxxShowOwnedWindows(pwnd, SW_PARENTOPENING, NULL); 01943 01944 if ((cmd == SW_MINIMIZE) && (pwnd->spwndParent == PWNDDESKTOP(pwnd))) { 01945 if (!xxxActivateOnMinimize(pwnd)) { 01946 xxxActivateWindow(pwnd, AW_SKIP); 01947 } 01948 01949 { 01950 PEPROCESS p; 01951 01952 if (gptiForeground && ptiCurrent->ppi != gptiForeground->ppi && !(ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD)) { 01953 01954 p = THREAD_TO_PROCESS(ptiCurrent->pEThread); 01955 KeAttachProcess(&p->Pcb); 01956 Status = MmAdjustWorkingSetSize((SIZE_T)-1, (SIZE_T)-1, FALSE); 01957 KeDetachProcess(); 01958 01959 if (!NT_SUCCESS(Status)) { 01960 RIPMSG1(RIP_ERROR, "Error adjusting working set, status = %x\n", Status); 01961 } 01962 } 01963 } 01964 01965 /* 01966 * If any app is starting, restore its right to foreground activate 01967 * (activate and come on top of everything else) because we just 01968 * minimized what we were working on. 01969 */ 01970 RestoreForegroundActivate(); 01971 } 01972 01973 /* 01974 * If going from iconic, insure the focus is in the window. 01975 */ 01976 if (fSetFocus) 01977 xxxSetFocus(pwnd); 01978 01979 /* 01980 * This was added for 1.03 compatibility reasons. If apps watch 01981 * WM_ACTIVATE to set their focus, sending this message will appear 01982 * as if the window just got activated (like in 1.03). Before this 01983 * was added, opening an iconic window never sent this message since 01984 * it was already active (but HIWORD(lParam) != 0). 01985 */ 01986 if (fSendActivate) 01987 xxxSendMessage(pwnd, WM_ACTIVATE, WA_ACTIVE, 0); 01988 01989 /* 01990 * Flush the palette. We do this on a minimize of a palette app. 01991 */ 01992 if (fFlushPalette) 01993 xxxFlushPalette(pwnd); 01994 01995 Exit: 01996 return NULL; 01997 }

PMENUSTATE xxxMNAllocMenuState PTHREADINFO  ptiCurrent,
PTHREADINFO  ptiNotify,
PPOPUPMENU  ppopupmenuRoot
 

Definition at line 458 of file mnstate.c.

References BOOL, DBGIncModalMenuCount, gMenuState, IncSFWLockCount(), MENUANIDC, MENUSTATE, MNSetupAnimationDC(), NULL, PBYTE, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagMENUSTATE::pmnsPrev, PtiCurrent, tagMENUSTATE::ptiMenuStateOwner, PUDF_MENUSTATEINUSE, tagTHREADINFO::rpdesk, SET_PUDF, TEST_PUDF, TRUE, and xxxMNEndMenuState().

Referenced by xxxMNStartMenuState(), and xxxTrackPopupMenuEx().

00459 { 00460 BOOL fAllocate; 00461 PMENUSTATE pMenuState; 00462 00463 UserAssert(PtiCurrent() == ptiCurrent); 00464 UserAssert(ptiCurrent->rpdesk == ptiNotify->rpdesk); 00465 00466 /* 00467 * If gMenuState is already taken, allocate one. 00468 */ 00469 fAllocate = TEST_PUDF(PUDF_MENUSTATEINUSE); 00470 if (fAllocate) { 00471 pMenuState = (PMENUSTATE)UserAllocPoolWithQuota(sizeof(MENUSTATE), TAG_MENUSTATE); 00472 if (pMenuState == NULL) { 00473 return NULL; 00474 } 00475 } else { 00476 /* 00477 * Use chache global which already has the animation DC setup 00478 */ 00479 SET_PUDF(PUDF_MENUSTATEINUSE); 00480 pMenuState = &gMenuState; 00481 UserAssert(gMenuState.hdcAni != NULL); 00482 GreSetDCOwner(gMenuState.hdcAni, OBJECT_OWNER_CURRENT); 00483 } 00484 00485 /* 00486 * Prevent anyone from changing the foreground while this menu is active 00487 */ 00488 IncSFWLockCount(); 00489 DBGIncModalMenuCount(); 00490 00491 /* 00492 * Initialize pMenuState. 00493 * Animation DC stuff is already setup so don't zero init it. 00494 */ 00495 RtlZeroMemory(pMenuState, sizeof(MENUSTATE) - sizeof(MENUANIDC)); 00496 pMenuState->pGlobalPopupMenu = ppopupmenuRoot; 00497 pMenuState->ptiMenuStateOwner = ptiCurrent; 00498 00499 /* 00500 * Save previous state, if any. Then set new state 00501 */ 00502 pMenuState->pmnsPrev = ptiCurrent->pMenuState; 00503 ptiCurrent->pMenuState = pMenuState; 00504 00505 if (ptiNotify != ptiCurrent) { 00506 UserAssert(ptiNotify->pMenuState == NULL); 00507 ptiNotify->pMenuState = pMenuState; 00508 } 00509 00510 /* 00511 * If the menustate was allocated, set up animation stuff. 00512 * This is done here because in case of failure, MNEndMenuState 00513 * will find ptiCurrent->pMenuState properly. 00514 */ 00515 if (fAllocate) { 00516 RtlZeroMemory((PBYTE)pMenuState + sizeof(MENUSTATE) - 00517 sizeof(MENUANIDC), sizeof(MENUANIDC)); 00518 if (!MNSetupAnimationDC(pMenuState)) { 00519 xxxMNEndMenuState(TRUE); 00520 return NULL; 00521 } 00522 } 00523 00524 return pMenuState; 00525 }

VOID xxxMNButtonDown PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  posItemHit,
BOOL  fClick
 

Definition at line 3533 of file ntuser/kernel/menu.c.

References BOOL, FALSE, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fDropNextPopup, tagPOPUPMENU::fToggle, MNIsPopupItem(), tagPOPUPMENU::posSelectedItem, TRUE, xxxMNDoScroll(), xxxMNHideNextHierarchy(), xxxMNOpenHierarchy(), and xxxMNSelectItem().

Referenced by xxxHandleMenuMessages(), xxxMenuWindowProc(), and xxxMNMouseMove().

03537 { 03538 PITEM pItem; 03539 BOOL fOpenHierarchy; 03540 03541 /* 03542 * A different item was hit than is currently selected, so select it 03543 * and drop its menu if available. Make sure we toggle click state. 03544 */ 03545 if (ppopupmenu->posSelectedItem != posItemHit) { 03546 /* 03547 * We are clicking on a new item, not moving the mouse over to it. 03548 * So reset cancel toggle state. We don't want button up from 03549 * this button down to cancel. 03550 */ 03551 if (fClick) { 03552 fOpenHierarchy = TRUE; 03553 ppopupmenu->fToggle = FALSE; 03554 } 03555 else 03556 { 03557 fOpenHierarchy = (ppopupmenu->fDropNextPopup != 0); 03558 } 03559 03560 03561 /* 03562 * If the item has a popup and isn't disabled, open it. Note that 03563 * selecting this item will cancel any hierarchies associated with 03564 * the previously selected item. 03565 */ 03566 pItem = xxxMNSelectItem(ppopupmenu, pMenuState, posItemHit); 03567 if (MNIsPopupItem(pItem) && fOpenHierarchy) { 03568 /* Punt if menu was destroyed. */ 03569 if (xxxMNOpenHierarchy(ppopupmenu, pMenuState) == (PWND)-1) { 03570 return; 03571 } 03572 } 03573 } else { 03574 /* 03575 * We are moving over to the already-selected item. If we are 03576 * clicking for real, reset cancel toggle state. We want button 03577 * up to cancel if on same item. Otherwise, do nothing if just 03578 * moving... 03579 */ 03580 if (fClick) { 03581 ppopupmenu->fToggle = TRUE; 03582 } 03583 03584 if (!xxxMNHideNextHierarchy(ppopupmenu) && fClick && xxxMNOpenHierarchy(ppopupmenu, pMenuState)) 03585 ppopupmenu->fToggle = FALSE; 03586 } 03587 03588 if (fClick) { 03589 pMenuState->fButtonDown = TRUE; 03590 xxxMNDoScroll(ppopupmenu, posItemHit, TRUE); 03591 } 03592 }

VOID xxxMNButtonUp PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  posItemHit,
LPARAM  lParam
 

Definition at line 3772 of file ntuser/kernel/menu.c.

References tagMENU::cItems, FALSE, tagMENUSTATE::fButtonAlwaysDown, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fHierarchyDropped, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fShowTimer, tagITEM::fState, tagPOPUPMENU::fToggle, tagITEM::fType, MFMWFP_NOITEM, NULL, tagPOPUPMENU::posSelectedItem, tagMENU::rgItems, tagPOPUPMENU::spmenu, tagITEM::spSubMenu, xxxMNDismiss(), xxxMNDismissWithNotify(), and xxxMNOpenHierarchy().

Referenced by xxxHandleMenuMessages(), and xxxMenuWindowProc().

03777 { 03778 PITEM pItem; 03779 03780 if (!pMenuState->fButtonDown) { 03781 03782 /* 03783 * Ignore if button was never down... Really shouldn't happen... 03784 */ 03785 return; 03786 } 03787 03788 if (posItemHit == MFMWFP_NOITEM) { 03789 RIPMSG0(RIP_WARNING, "button up on no item"); 03790 goto ExitButtonUp; 03791 } 03792 03793 if (ppopup->posSelectedItem != posItemHit) { 03794 goto ExitButtonUp; 03795 } 03796 03797 if (ppopup->fIsMenuBar) { 03798 03799 /* 03800 * Handle button up in menubar specially. 03801 */ 03802 if (ppopup->fHierarchyDropped) { 03803 if (!ppopup->fToggle) { 03804 goto ExitButtonUp; 03805 } else { 03806 /* 03807 * Cancel menu now. 03808 */ 03809 ppopup->fToggle = FALSE; 03810 xxxMNDismiss(pMenuState); 03811 return; 03812 } 03813 } 03814 } else if (ppopup->fShowTimer) { 03815 ppopup->fToggle = FALSE; 03816 03817 /* 03818 * Open hierarchy on popup 03819 */ 03820 xxxMNOpenHierarchy(ppopup, pMenuState); 03821 03822 goto ExitButtonUp; 03823 } 03824 03825 /* 03826 * If nothing is selected, get out. This occurs mainly on unbalanced 03827 * multicolumn menus where one of the columns isn't completely full. 03828 */ 03829 if (ppopup->posSelectedItem == MFMWFP_NOITEM) 03830 goto ExitButtonUp; 03831 03832 if (ppopup->posSelectedItem >= ppopup->spmenu->cItems) 03833 goto ExitButtonUp; 03834 03835 /* 03836 * Get a pointer to the currently selected item in this menu. 03837 */ 03838 pItem = &(ppopup->spmenu->rgItems[ppopup->posSelectedItem]); 03839 03840 /* 03841 * Kick out of menu mode if user clicked on a non-separator, enabled, 03842 * non-hierarchical item. 03843 * 03844 * BOGUS 03845 * Why doesn't MFS_GRAYED check work for separators now? Find out later. 03846 */ 03847 if (!(pItem->fType & MFT_SEPARATOR) 03848 && !(pItem->fState & MFS_GRAYED) 03849 && (pItem->spSubMenu == NULL)) { 03850 03851 xxxMNDismissWithNotify(pMenuState, ppopup->spmenu, pItem, 03852 ppopup->posSelectedItem, lParam); 03853 return; 03854 } 03855 03856 ExitButtonUp: 03857 pMenuState->fButtonDown = 03858 pMenuState->fButtonAlwaysDown = FALSE; 03859 }

void xxxMNCancel PMENUSTATE  pMenuState,
UINT  uMsg,
UINT  cmd,
LPARAM  lParam
 

Definition at line 3395 of file ntuser/kernel/menu.c.

References _PostMessage(), BOOL, tagMENUSTATE::cmdLast, FALSE, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fDestroyed, tagPOPUPMENU::fInCancel, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fMenuStarted, tagPOPUPMENU::fNoNotify, tagPOPUPMENU::fSynchronous, FWINABLE, tagWND::head, MFMWFP_NOITEM, NULL, tagMENUSTATE::pGlobalPopupMenu, PlayEventSound(), PtiCurrent, tagMENUSTATE::ptiMenuStateOwner, SMS_NOMENU, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestWF, ThreadLock, ThreadUnlock, TRUE, USER_SOUND_MENUCOMMAND, Validateppopupmenu, WFWIN31COMPAT, xxxDestroyWindow(), xxxMNCloseHierarchy(), xxxMNReleaseCapture(), xxxMNSelectItem(), xxxSendMenuSelect(), xxxSendMessage(), and xxxWindowEvent().

Referenced by xxxMenuWindowProc(), xxxMNDismiss(), and xxxMNDismissWithNotify().

03400 { 03401 PPOPUPMENU ppopupmenu = pMenuState->pGlobalPopupMenu; 03402 BOOL fSynchronous = ppopupmenu->fSynchronous; 03403 BOOL fTrackFlagsSet = ppopupmenu->fIsTrackPopup; 03404 BOOL fIsSysMenu = ppopupmenu->fIsSysMenu; 03405 BOOL fIsMenuBar = ppopupmenu->fIsMenuBar; 03406 BOOL fNotify = !ppopupmenu->fNoNotify; 03407 PWND pwndT; 03408 TL tlpwndT; 03409 TL tlpwndPopupMenu; 03410 03411 Validateppopupmenu(ppopupmenu); 03412 03413 pMenuState->fInsideMenuLoop = FALSE; 03414 pMenuState->fButtonDown = FALSE; 03415 /* 03416 * Mark the popup as destroyed so people will not use it anymore. 03417 * This means that root popups can be marked as destroyed before 03418 * actually being destroyed (nice and confusing). 03419 */ 03420 ppopupmenu->fDestroyed = TRUE; 03421 03422 /* 03423 * Only the menu loop owner can destroy the menu windows (i.e, xxxMNCloseHierarchy) 03424 */ 03425 if (PtiCurrent() != pMenuState->ptiMenuStateOwner) { 03426 RIPMSG1(RIP_WARNING, "xxxMNCancel: Thread %#p doesn't own the menu loop", PtiCurrent()); 03427 return; 03428 } 03429 03430 /* 03431 * If the menu loop is running on a thread different than the thread 03432 * that owns spwndNotify, we can have two threads trying to cancel 03433 * this popup at the same time. 03434 */ 03435 if (ppopupmenu->fInCancel) { 03436 RIPMSG1(RIP_WARNING, "xxxMNCancel: already in cancel. ppopupmenu:%#p", ppopupmenu); 03437 return; 03438 } 03439 ppopupmenu->fInCancel = TRUE; 03440 03441 ThreadLock(ppopupmenu->spwndPopupMenu, &tlpwndPopupMenu); 03442 03443 /* 03444 * Close all hierarchies from this point down. 03445 */ 03446 xxxMNCloseHierarchy(ppopupmenu, pMenuState); 03447 03448 /* 03449 * Unselect any items on this top level window 03450 */ 03451 xxxMNSelectItem(ppopupmenu, pMenuState, MFMWFP_NOITEM); 03452 03453 pMenuState->fMenuStarted = FALSE; 03454 03455 pwndT = ppopupmenu->spwndNotify; 03456 03457 ThreadLock(pwndT, &tlpwndT); 03458 03459 xxxMNReleaseCapture(); 03460 03461 if (fTrackFlagsSet) { 03462 /* 03463 * Send a POPUPEND so people watching see them paired 03464 */ 03465 if (FWINABLE()) { 03466 xxxWindowEvent(EVENT_SYSTEM_MENUPOPUPEND, 03467 ppopupmenu->spwndPopupMenu, OBJID_CLIENT, 0, 0); 03468 } 03469 03470 UserAssert(ppopupmenu->spwndPopupMenu != ppopupmenu->spwndPopupMenu->head.rpdesk->spwndMenu); 03471 xxxDestroyWindow(ppopupmenu->spwndPopupMenu); 03472 } 03473 03474 if (pwndT == NULL) { 03475 ThreadUnlock(&tlpwndT); 03476 ThreadUnlock(&tlpwndPopupMenu); 03477 return; 03478 } 03479 03480 /* 03481 * SMS_NOMENU hack so we can send MenuSelect messages with 03482 * (loword(lparam) = -1) when 03483 * the menu pops back up for the CBT people. In 3.0, all WM_MENUSELECT 03484 * messages went through the message filter so go through the function 03485 * SendMenuSelect. We need to do this in 3.1 since WordDefect for Windows 03486 * depends on this. 03487 */ 03488 xxxSendMenuSelect(pwndT, NULL, SMS_NOMENU, MFMWFP_NOITEM); 03489 03490 if (FWINABLE()) { 03491 xxxWindowEvent(EVENT_SYSTEM_MENUEND, pwndT, (fIsSysMenu ? 03492 OBJID_SYSMENU : (fIsMenuBar ? OBJID_MENU : OBJID_WINDOW)), 03493 INDEXID_CONTAINER, 0); 03494 } 03495 03496 if (fNotify) { 03497 /* 03498 * Notify app we are exiting the menu loop. Mainly for WinOldApp 386. 03499 * wParam is 1 if a TrackPopupMenu else 0. 03500 */ 03501 xxxSendMessage(pwndT, WM_EXITMENULOOP, 03502 ((fTrackFlagsSet && !fIsSysMenu)? 1 : 0), 0); 03503 } 03504 03505 if (uMsg != 0) { 03506 PlayEventSound(USER_SOUND_MENUCOMMAND); 03507 pMenuState->cmdLast = cmd; 03508 if (!fSynchronous) { 03509 if (!fIsSysMenu && fTrackFlagsSet && !TestWF(pwndT, WFWIN31COMPAT)) { 03510 xxxSendMessage(pwndT, uMsg, cmd, lParam); 03511 } else { 03512 _PostMessage(pwndT, uMsg, cmd, lParam); 03513 } 03514 } 03515 } else 03516 pMenuState->cmdLast = 0; 03517 03518 ThreadUnlock(&tlpwndT); 03519 03520 ThreadUnlock(&tlpwndPopupMenu); 03521 03522 }

VOID xxxMNChar PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  character
 

Definition at line 1011 of file ntuser/kernel/menu.c.

References BOOL, tagMENU::cItems, FALSE, tagPOPUPMENU::fDestroyed, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagITEM::fState, INT, MFMWFP_NOITEM, NULL, tagPOPUPMENU::posSelectedItem, PtoH, tagMENU::rgItems, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndNotify, ThreadLock, ThreadUnlock, TRUE, UINT, Validateppopupmenu, xxxMessageBeep(), xxxMNDismiss(), xxxMNFindChar(), xxxMNKeyDown(), xxxMNSelectItem(), xxxMNSwitchToAlternateMenu(), and xxxSendMessage().

Referenced by xxxHandleMenuMessages(), xxxMenuWindowProc(), and xxxMNKeyFilter().

01015 { 01016 PMENU pMenu; 01017 UINT flags; 01018 LRESULT result; 01019 int item; 01020 INT matchType; 01021 BOOL fExecute = FALSE; 01022 TL tlpwndNotify; 01023 01024 pMenu = ppopupmenu->spmenu; 01025 01026 Validateppopupmenu(ppopupmenu); 01027 01028 /* 01029 * If this comes in with a NULL pMenu, then we could have problems. 01030 * This could happen if the xxxMNStartMenuState never gets called 01031 * because the fInsideMenuLoop is set. 01032 * 01033 * This is placed in here temporarily until we can discover why 01034 * this pMenu isn't set. We will prevent the system from crashing 01035 * in the meantime. 01036 * 01037 * HACK: ChrisWil 01038 */ 01039 if (pMenu == NULL) { 01040 UserAssert(pMenu); 01041 xxxMNDismiss(pMenuState); 01042 return; 01043 } 01044 01045 /* 01046 * If we're getting out of menu mode, bail 01047 */ 01048 if (ppopupmenu->fDestroyed) { 01049 return; 01050 } 01051 01052 item = xxxMNFindChar(pMenu, character, 01053 ppopupmenu->posSelectedItem, &matchType); 01054 if (item != MFMWFP_NOITEM) { 01055 int item1; 01056 int firstItem = item; 01057 01058 /* 01059 * Find first ENABLED menu item with the given mnemonic 'character' 01060 * !!! If none found, exit menu loop !!! 01061 */ 01062 while (pMenu->rgItems[item].fState & MFS_GRAYED) { 01063 item = xxxMNFindChar(pMenu, character, item, &matchType); 01064 if (item == firstItem) { 01065 xxxMNDismiss(pMenuState); 01066 return; 01067 } 01068 } 01069 item1 = item; 01070 01071 /* 01072 * Find next ENABLED menu item with the given mnemonic 'character' 01073 * This is to see if we have a DUPLICATE MNEMONIC situation 01074 */ 01075 do { 01076 item = xxxMNFindChar(pMenu, character, item, &matchType); 01077 } while ((pMenu->rgItems[item].fState & MFS_GRAYED) && (item != firstItem)); 01078 01079 if ((firstItem == item) || (item == item1)) 01080 fExecute = TRUE; 01081 01082 item = item1; 01083 } 01084 01085 if ((item == MFMWFP_NOITEM) && ppopupmenu->fIsMenuBar && (character == TEXT(' '))) { 01086 01087 /* 01088 * Handle the case of the user cruising through the top level menu bar 01089 * without any popups dropped. We need to handle switching to and from 01090 * the system menu. 01091 */ 01092 if (ppopupmenu->fIsSysMenu) { 01093 01094 /* 01095 * If we are on the system menu and user hits space, bring 01096 * down thesystem menu. 01097 */ 01098 item = 0; 01099 fExecute = TRUE; 01100 } else if (ppopupmenu->spmenuAlternate != NULL) { 01101 01102 /* 01103 * We are not currently on the system menu but one exists. So 01104 * switch to it and bring it down. 01105 */ 01106 item = 0; 01107 goto SwitchToAlternate; 01108 } 01109 } 01110 01111 if ((item == MFMWFP_NOITEM) && ppopupmenu->fIsMenuBar && ppopupmenu->spmenuAlternate) { 01112 01113 /* 01114 * No matching item found on this top level menu (could be either the 01115 * system menu or the menu bar). We need to check the other menu. 01116 */ 01117 item = xxxMNFindChar(ppopupmenu->spmenuAlternate, 01118 character, 0, &matchType); 01119 01120 if (item != MFMWFP_NOITEM) { 01121 SwitchToAlternate: 01122 if (xxxMNSwitchToAlternateMenu(ppopupmenu)) { 01123 xxxMNChar(ppopupmenu, pMenuState, character); 01124 } 01125 return; 01126 } 01127 } 01128 01129 if (item == MFMWFP_NOITEM) { 01130 flags = (ppopupmenu->fIsSysMenu) ? MF_SYSMENU : 0; 01131 01132 if (!ppopupmenu->fIsMenuBar) { 01133 flags |= MF_POPUP; 01134 } 01135 01136 ThreadLock(ppopupmenu->spwndNotify, &tlpwndNotify); 01137 result = xxxSendMessage(ppopupmenu->spwndNotify, WM_MENUCHAR, 01138 MAKELONG((WORD)character, (WORD)flags), 01139 (LPARAM)PtoH(ppopupmenu->spmenu)); 01140 ThreadUnlock(&tlpwndNotify); 01141 01142 switch (HIWORD(result)) { 01143 case MNC_IGNORE: 01144 xxxMessageBeep(0); 01145 /* 01146 * If we're on the menu bar, cancel menu mode (fall through). 01147 * We do this because you can really freak out an end user 01148 * who accidentally tapped the Alt key (causing us to go 01149 * into "invisible" menu mode) and now can't type anything! 01150 */ 01151 if (flags & MF_POPUP) { 01152 return; 01153 } 01154 /* 01155 * Fall through. 01156 */ 01157 01158 case MNC_CLOSE: 01159 xxxMNDismiss(pMenuState); 01160 return; 01161 01162 case MNC_EXECUTE: 01163 fExecute = TRUE; 01164 /* fall thru */ 01165 01166 case MNC_SELECT: 01167 item = (UINT)(short)LOWORD(result); 01168 if ((WORD) item >= ppopupmenu->spmenu->cItems) 01169 { 01170 RIPMSG1(RIP_WARNING, "Invalid item number returned from WM_MENUCHAR %#lx", result); 01171 return; 01172 } 01173 break; 01174 } 01175 } 01176 01177 if (item != MFMWFP_NOITEM) { 01178 xxxMNSelectItem(ppopupmenu, pMenuState, item); 01179 01180 if (fExecute) 01181 xxxMNKeyDown(ppopupmenu, pMenuState, VK_RETURN); 01182 } 01183 }

VOID xxxMNCloseHierarchy PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState
 

Definition at line 2517 of file ntuser/kernel/menu.c.

References _KillTimer(), DF_MENUINUSE, tagDESKTOP::dwDTFlags, FALSE, tagPOPUPMENU::fDesktopMenu, tagMENUSTATE::fDragAndDrop, tagPOPUPMENU::fHideTimer, tagPOPUPMENU::fHierarchyDropped, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, tagMENUSTATE::fModelessMenu, FWINABLE, tagWND::head, HW, IDSYS_MNHIDE, L, Lock, MFMWFP_NOITEM, MNAnimate(), NT_SUCCESS, NULL, tagTHREADINFO::pMenuState, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, PtiCurrent, PUDF_ANIMATE, tagTHREADINFO::rpdesk, SetVisible(), tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndActivePopup, tagDESKTOP::spwndMenu, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, SV_UNSET, TEST_PUDF, TestWF, ThreadLockAlways, ThreadUnlock, TRUE, Unlock, Validateppopupmenu, WFVISIBLE, xxxActivateThisWindow(), xxxCleanupDesktopMenu(), xxxClientRevokeDragDrop(), xxxDestroyWindow(), xxxMNDestroyHandler(), xxxSendMenuSelect(), xxxSendMessage(), xxxShowWindow(), and xxxWindowEvent().

Referenced by xxxDestroyThreadInfo(), xxxEndMenu(), xxxMenuWindowProc(), xxxMNCancel(), xxxMNKeyDown(), xxxMNKeyFilter(), xxxMNOpenHierarchy(), and xxxMNSelectItem().

02519 { 02520 TL tlpwndNext; 02521 TL tlpwnd; 02522 TL tlpopup; 02523 PTHREADINFO ptiCurrent = PtiCurrent(); 02524 PDESKTOP pdesk; 02525 PWND pwndNext; 02526 02527 Validateppopupmenu(ppopupmenu); 02528 02529 /* 02530 * Terminate any animation 02531 */ 02532 MNAnimate(pMenuState, FALSE); 02533 02534 /* 02535 * If a hierarchy exists, close all childen below us. Do it in reversed 02536 * order so savebits work out. 02537 */ 02538 if (!ppopupmenu->fHierarchyDropped) { 02539 /* 02540 * Assert that there's no next or it might not get closed 02541 */ 02542 UserAssert(ppopupmenu->spwndNextPopup == NULL); 02543 return; 02544 } 02545 02546 if (ppopupmenu->fHideTimer) 02547 { 02548 _KillTimer(ppopupmenu->spwndPopupMenu, IDSYS_MNHIDE); 02549 ppopupmenu->fHideTimer = FALSE; 02550 } 02551 02552 pwndNext = ppopupmenu->spwndNextPopup; 02553 if (pwndNext != NULL) { 02554 02555 ThreadLockAlways(pwndNext, &tlpwndNext); 02556 xxxSendMessage(pwndNext, MN_CLOSEHIERARCHY, 0, 0); 02557 02558 /* 02559 * If modeless menu, activate the this popup since we're about 02560 * to destroy the current active one. We want to keep activation 02561 * on a menu window so we can get the keys. Also, modeless menus 02562 * are canceled when a non-menu window is activated in their queue 02563 */ 02564 if (pMenuState->fModelessMenu 02565 && pMenuState->fInsideMenuLoop 02566 && !ppopupmenu->fIsMenuBar) { 02567 02568 ThreadLockAlways(ppopupmenu->spwndPopupMenu, &tlpwnd); 02569 xxxActivateThisWindow(ppopupmenu->spwndPopupMenu, 0, 0); 02570 ThreadUnlock(&tlpwnd); 02571 } 02572 02573 if (FWINABLE()) { 02574 xxxWindowEvent(EVENT_SYSTEM_MENUPOPUPEND, pwndNext, OBJID_CLIENT, INDEXID_CONTAINER, 0); 02575 } 02576 02577 /* 02578 * If the current thread is not in the right pdesk, then that could 02579 * be the cause of the stuck menu bug. 02580 * In other words, are we nuking this menu out of context? 02581 */ 02582 UserAssert(ptiCurrent->pMenuState != NULL); 02583 pdesk = ptiCurrent->rpdesk; 02584 02585 if (pwndNext == pdesk->spwndMenu) { 02586 PPOPUPMENU ppopupmenuReal; 02587 02588 UserAssert(pdesk->dwDTFlags & DF_MENUINUSE); 02589 02590 /* 02591 * If this is our precreated real popup window, 02592 * initialize ourselves and just hide. 02593 */ 02594 xxxShowWindow(pwndNext, SW_HIDE | TEST_PUDF(PUDF_ANIMATE)); 02595 02596 /* 02597 * Its possible that during Logoff the above xxxShowWindow 02598 * won't get prossessed and because this window is a special 02599 * window that is owned by they desktop we have to manually mark 02600 * it as invisible. 02601 */ 02602 if (TestWF(pwndNext, WFVISIBLE)) { 02603 SetVisible(pwndNext, SV_UNSET); 02604 } 02605 02606 #ifdef HAVE_MN_GETPPOPUPMENU 02607 ppopupmenuReal = (PPOPUPMENU)xxxSendMessage(pwndNext, 02608 MN_GETPPOPUPMENU,0, 0L); 02609 #else 02610 ppopupmenuReal = ((PMENUWND)pwndNext)->ppopupmenu; 02611 #endif 02612 UserAssert(ppopupmenuReal->fDesktopMenu == TRUE); 02613 02614 /* 02615 * We don't want this window to be a drop target anymore. 02616 * Non cached menu windows revoke it on WM_FINALDESTROY. 02617 */ 02618 if (pMenuState->fDragAndDrop) { 02619 if (!NT_SUCCESS(xxxClientRevokeDragDrop(HW(pwndNext)))) { 02620 RIPMSG1(RIP_ERROR, "xxxMNCloseHierarchy: xxxClientRevokeRegisterDragDrop failed:%#p", pwndNext); 02621 } 02622 } 02623 02624 if (ppopupmenuReal != NULL) { 02625 xxxMNDestroyHandler(ppopupmenuReal); 02626 /* 02627 * We used to clear the popup contents here but the popup might be 02628 * still in use if this is happening during a callback. So we let 02629 * MNFreePopup do that. If it didn't happen during the call above, 02630 * it'll happen when MNFlushDestroyedPopups is executed. 02631 */ 02632 } 02633 02634 xxxCleanupDesktopMenu(pwndNext, pdesk); 02635 02636 ThreadUnlock(&tlpwndNext); 02637 } else if (ThreadUnlock(&tlpwndNext)) { 02638 /* 02639 * We know this is not the current thread's desktop menu window. 02640 * Let's assert that it's not the menu window of another desktop. 02641 */ 02642 UserAssert(pwndNext != pwndNext->head.rpdesk->spwndMenu); 02643 xxxDestroyWindow(pwndNext); 02644 } 02645 02646 Unlock(&ppopupmenu->spwndNextPopup); 02647 ppopupmenu->fHierarchyDropped = FALSE; 02648 02649 } 02650 02651 if (ppopupmenu->fIsMenuBar) { 02652 Unlock(&ppopupmenu->spwndActivePopup); 02653 } else { 02654 Lock(&(ppopupmenu->ppopupmenuRoot->spwndActivePopup), 02655 ppopupmenu->spwndPopupMenu); 02656 } 02657 02658 if (pMenuState->fInsideMenuLoop && 02659 (ppopupmenu->posSelectedItem != MFMWFP_NOITEM)) { 02660 /* 02661 * Send a menu select as if this item had just been selected. This 02662 * allows people to easily update their menu status bars when a 02663 * hierarchy from this item has been closed. 02664 */ 02665 PWND pwnd = ppopupmenu->ppopupmenuRoot->spwndNotify; 02666 if (pwnd) { 02667 ThreadLockAlways(pwnd, &tlpwnd); 02668 ThreadLockAlways(ppopupmenu->spwndPopupMenu, &tlpopup); 02669 xxxSendMenuSelect(pwnd, ppopupmenu->spwndPopupMenu, 02670 ppopupmenu->spmenu, ppopupmenu->posSelectedItem); 02671 ThreadUnlock(&tlpopup); 02672 ThreadUnlock(&tlpwnd); 02673 } 02674 } 02675 02676 }

int xxxMNCompute PMENU  pMenu,
PWND  pwndNotify,
DWORD  yMenuTop,
DWORD  xMenuLeft,
DWORD  cxMax,
LPDWORD  lpdwHeight
 

Definition at line 233 of file mncomput.c.

References _GetDCEx(), _ReleaseDC(), BOOL, CH_HELPPREFIX, CheckLock, tagMENU::cItems, tagITEM::cxItem, tagMENU::cxMenu, tagMENU::cxTextAlign, tagITEM::cyItem, tagMENU::cyMenu, tagTHREADINFO::dwExpWinVer, DWORD, FALSE, tagMENU::fFlags, gcxMenuFontChar, ghMenuFont, gpsi, tagITEM::hbmp, INT, L, Lock, tagITEM::lpstr, max, MFISPOPUP, MFMULTIROW, MNLEFTMARGIN, MNRecalcTabStrings(), MNXSPACE, NULL, OBI_MENUCHECK, PtiCurrent, tagMENU::rgItems, tagMENU::spwndNotify, SYSMET, TestMF, TestMFT, TestWF, TextPointer, TRUE, UINT, VER40, WFWIN40COMPAT, tagITEM::xItem, xxxMNItemSize(), and tagITEM::yItem.

Referenced by xxxMenuBarCompute(), and xxxMenuWindowProc().

00240 { 00241 UINT cItem; 00242 DWORD cxItem; 00243 DWORD cyItem; 00244 DWORD cyItemKeep; 00245 DWORD yPopupTop; 00246 INT cMaxWidth; 00247 DWORD cMaxHeight; 00248 UINT cItemBegCol; 00249 DWORD temp; 00250 int ret; 00251 PITEM pCurItem; 00252 POINT ptMNItemSize; 00253 BOOL fOwnerDrawItems; 00254 BOOL fMenuBreak; 00255 LPWSTR lpsz; 00256 BOOL fPopupMenu; 00257 DWORD menuHeight = 0; 00258 HDC hdc; 00259 HFONT hOldFont; 00260 PTHREADINFO ptiCurrent = PtiCurrent(); 00261 BOOL fStringAndBitmapItems; 00262 00263 CheckLock(pMenu); 00264 CheckLock(pwndNotify); 00265 00266 /* 00267 * Whoever computes the menu, becomes the owner. 00268 */ 00269 if (pwndNotify != pMenu->spwndNotify) { 00270 Lock(&pMenu->spwndNotify, pwndNotify); 00271 } 00272 00273 00274 if (lpdwMenuHeight != NULL) 00275 menuHeight = *lpdwMenuHeight; 00276 00277 /* 00278 * Empty menus have a height of zero. 00279 */ 00280 ret = 0; 00281 if (pMenu->cItems == 0) 00282 return ret; 00283 00284 hdc = _GetDCEx(NULL, NULL, DCX_WINDOW | DCX_CACHE); 00285 hOldFont = GreSelectFont(hdc, ghMenuFont); 00286 00287 /* 00288 * Try to make a non-multirow menu first. 00289 */ 00290 pMenu->fFlags &= (~MFMULTIROW); 00291 00292 fPopupMenu = TestMF(pMenu, MFISPOPUP); 00293 00294 if (fPopupMenu) { 00295 00296 /* 00297 * Reset the menu bar height to 0 if this is a popup since we are 00298 * being called from menu.c MN_SIZEWINDOW. 00299 */ 00300 menuHeight = 0; 00301 } else if (pwndNotify != NULL) { 00302 pMenu->cxMenu = cxMax; 00303 } 00304 00305 /* 00306 * Initialize the computing variables. 00307 */ 00308 cMaxWidth = cyItemKeep = 0L; 00309 cItemBegCol = 0; 00310 00311 cyItem = yPopupTop = yMenuTop; 00312 cxItem = xMenuLeft; 00313 00314 pCurItem = (PITEM)&pMenu->rgItems[0]; 00315 /* 00316 * cxTextAlign is used to align the text in all items; this is useful 00317 * in popup menus that mix text only items with bitmap-text items. It's 00318 * set to the max bitmap width plus some spacing. 00319 * Do this for new menus wich use string AND bitmaps on the same item 00320 */ 00321 fStringAndBitmapItems = FALSE; 00322 pMenu->cxTextAlign = 0; 00323 00324 /* 00325 * Process each item in the menu. 00326 */ 00327 fOwnerDrawItems = FALSE; 00328 for (cItem = 0; cItem < pMenu->cItems; cItem++) { 00329 00330 /* 00331 * If it's not a separator, find the dimensions of the object. 00332 */ 00333 if (TestMFT(pCurItem, MFT_SEPARATOR) && 00334 ( !TestMFT(pCurItem, MFT_OWNERDRAW) || 00335 (LOWORD(ptiCurrent->dwExpWinVer) < VER40)) ) { 00336 /* 00337 * If version is less than 4.0 don't test the MFT_OWNERDRAW 00338 * flag. Bug 21922; App MaxEda has both separator and Ownerdraw 00339 * flags on. In 3.51 we didn't test the OwnerDraw flag 00340 */ 00341 00342 // 00343 // This is a separator. It's drawn as wide as the menu area, 00344 // leaving some space above and below. Since the menu area is 00345 // the max of the items' widths, we set our width to 0 so as not 00346 // to affect the result. 00347 // 00348 pCurItem->cxItem = 0; 00349 pCurItem->cyItem = SYSMET(CYMENUSIZE) / 2; 00350 00351 00352 } else { 00353 /* 00354 * Are we using NT5 strings and bitmaps? 00355 */ 00356 fStringAndBitmapItems |= ((pCurItem->hbmp != NULL) && (pCurItem->lpstr != NULL)); 00357 /* 00358 * Get the item's X and Y dimensions. 00359 */ 00360 if (xxxMNItemSize(pMenu, pwndNotify, hdc, pCurItem, fPopupMenu, &ptMNItemSize)) 00361 fOwnerDrawItems = TRUE; 00362 00363 pCurItem->cxItem = ptMNItemSize.x; 00364 pCurItem->cyItem = ptMNItemSize.y; 00365 if (!fPopupMenu && ((pCurItem->hbmp == NULL) || (pCurItem->lpstr != NULL))) { 00366 pCurItem->cxItem += gcxMenuFontChar * 2; 00367 } 00368 } 00369 00370 if (menuHeight != 0) 00371 pCurItem->cyItem = menuHeight; 00372 00373 /* 00374 * If this is the first item, initialize cMaxHeight. 00375 */ 00376 if (cItem == 0) 00377 cMaxHeight = pCurItem->cyItem; 00378 00379 /* 00380 * Is this a Pull-Down menu? 00381 */ 00382 if (fPopupMenu) { 00383 00384 /* 00385 * If this item has a break or is the last item... 00386 */ 00387 if ((fMenuBreak = TestMFT(pCurItem, MFT_BREAK)) || 00388 pMenu->cItems == cItem + (UINT)1) { 00389 00390 /* 00391 * Keep cMaxWidth around if this is not the last item. 00392 */ 00393 temp = cMaxWidth; 00394 if (pMenu->cItems == cItem + (UINT)1) { 00395 if ((int)(pCurItem->cxItem) > cMaxWidth) 00396 temp = pCurItem->cxItem; 00397 } 00398 00399 /* 00400 * Get new width of string from RecalcTabStrings. 00401 */ 00402 temp = MNRecalcTabStrings(hdc, pMenu, cItemBegCol, 00403 (UINT)(cItem + (fMenuBreak ? 0 : 1)), temp, cxItem); 00404 00405 /* 00406 * If this item has a break, account for it. 00407 */ 00408 if (fMenuBreak) { 00409 // 00410 // Add on space for the etch and a border on either side. 00411 // NOTE: For old apps that do weird stuff with owner 00412 // draw, keep 'em happy by adding on the same amount 00413 // of space we did in 3.1. 00414 // 00415 if (fOwnerDrawItems && !TestWF(pwndNotify, WFWIN40COMPAT)) 00416 cxItem = temp + SYSMET(CXBORDER); 00417 else 00418 cxItem = temp + 2 * SYSMET(CXEDGE); 00419 00420 /* 00421 * Reset the cMaxWidth to the current item. 00422 */ 00423 cMaxWidth = pCurItem->cxItem; 00424 00425 /* 00426 * Start at the top. 00427 */ 00428 cyItem = yPopupTop; 00429 00430 /* 00431 * Save the item where this column begins. 00432 */ 00433 cItemBegCol = cItem; 00434 00435 /* 00436 * If this item is also the last item, recalc for this 00437 * column. 00438 */ 00439 if (pMenu->cItems == (UINT)(cItem + 1)) { 00440 temp = MNRecalcTabStrings(hdc, pMenu, cItem, 00441 (UINT)(cItem + 1), cMaxWidth, cxItem); 00442 } 00443 } 00444 00445 /* 00446 * If this is the last entry, supply the width. 00447 */ 00448 if (pMenu->cItems == cItem + (UINT)1) 00449 pMenu->cxMenu = temp; 00450 } 00451 00452 pCurItem->xItem = cxItem; 00453 pCurItem->yItem = cyItem; 00454 00455 cyItem += pCurItem->cyItem; 00456 00457 if (cyItemKeep < cyItem) 00458 cyItemKeep = cyItem; 00459 00460 } else { 00461 00462 /* 00463 * This a Top Level menu, not a Pull-Down. 00464 */ 00465 00466 /* 00467 * Adjust right aligned items before testing for multirow 00468 */ 00469 if (pCurItem->lpstr != NULL) { 00470 lpsz = TextPointer(pCurItem->lpstr); 00471 if ((lpsz != NULL) && (*lpsz == CH_HELPPREFIX)) { 00472 pCurItem->cxItem -= gcxMenuFontChar; 00473 } 00474 } 00475 00476 00477 /* 00478 * If this is a new line or a menu break. 00479 */ 00480 if ((TestMFT(pCurItem, MFT_BREAK)) || 00481 (((cxItem + pCurItem->cxItem + gcxMenuFontChar) > 00482 pMenu->cxMenu) && (cItem != 0))) { 00483 cyItem += cMaxHeight; 00484 00485 cxItem = xMenuLeft; 00486 cMaxHeight = pCurItem->cyItem; 00487 pMenu->fFlags |= MFMULTIROW; 00488 } 00489 00490 pCurItem->yItem = cyItem; 00491 00492 pCurItem->xItem = cxItem; 00493 cxItem += pCurItem->cxItem; 00494 } 00495 00496 if (cMaxWidth < (int)(pCurItem->cxItem)) 00497 cMaxWidth = pCurItem->cxItem; 00498 00499 if (cMaxHeight != pCurItem->cyItem) { 00500 if (cMaxHeight < pCurItem->cyItem) 00501 cMaxHeight = pCurItem->cyItem; 00502 00503 if (!fPopupMenu) 00504 menuHeight = cMaxHeight; 00505 } 00506 00507 if (!fPopupMenu) 00508 cyItemKeep = cyItem + cMaxHeight; 00509 00510 pCurItem++; 00511 00512 } /* of for loop */ 00513 /* 00514 * Determine where the strings should be drawn so they are aligned 00515 * The alignment is only for popup (vertical) menus (see xxxRealDrawMenuItem) 00516 * The actual space depends on the MNS_NOCHECK and MNS_CHECKORBMP styles 00517 * Multicolumn menus don't get aligment (now that we have scrollbars, multicolum is out) 00518 */ 00519 if (!fStringAndBitmapItems || (cItemBegCol != 0)) { 00520 pMenu->cxTextAlign = 0; 00521 } else if (TestMF(pMenu, MNS_NOCHECK)) { 00522 pMenu->cxTextAlign += MNXSPACE; 00523 } else if (TestMF(pMenu, MNS_CHECKORBMP)) { 00524 pMenu->cxTextAlign = max(pMenu->cxTextAlign, (UINT)gpsi->oembmi[OBI_MENUCHECK].cx); 00525 pMenu->cxTextAlign += MNXSPACE; 00526 } else { 00527 pMenu->cxTextAlign += gpsi->oembmi[OBI_MENUCHECK].cx + MNXSPACE; 00528 } 00529 /* 00530 * Add the left margin 00531 */ 00532 if (pMenu->cxTextAlign != 0) { 00533 pMenu->cxTextAlign += MNLEFTMARGIN; 00534 } 00535 00536 00537 if (cItemBegCol && pMenu->cItems && 00538 TestMFT(((PITEM)&pMenu->rgItems[0]), MFT_RIGHTJUSTIFY)) { 00539 // 00540 // multi-column, if we are in RtoL mode, reverse the columns 00541 // 00542 pCurItem = (PITEM)&pMenu->rgItems[0]; 00543 00544 for (cItem = 0; cItem < pMenu->cItems; cItem++) { 00545 pCurItem->xItem = pMenu->cxMenu - 00546 (pCurItem->xItem + pCurItem->cxItem); 00547 pCurItem++; 00548 } 00549 } 00550 00551 GreSelectFont(hdc, hOldFont); 00552 _ReleaseDC(hdc); 00553 00554 pMenu->cyMenu = cyItemKeep - yMenuTop; 00555 ret = pMenu->cyMenu; 00556 00557 if (lpdwMenuHeight != NULL) 00558 *lpdwMenuHeight = menuHeight; 00559 00560 return ret; 00561 }

void xxxMNDismiss PMENUSTATE  pMenuState  ) 
 

Definition at line 36 of file ntuser/kernel/menu.c.

References xxxMNCancel().

Referenced by xxxEndMenu(), xxxEndMenuLoop(), xxxHandleMenuMessages(), xxxMNButtonUp(), xxxMNChar(), xxxMNKeyDown(), and xxxMNKeyFilter().

00037 { 00038 xxxMNCancel(pMenuState, 0, 0, 0); 00039 }

BOOL xxxMNDoubleClick PMENUSTATE  pMenuState,
PPOPUPMENU  ppopup,
int  idxItem
 

Definition at line 2697 of file ntuser/kernel/menu.c.

References _GetMenuDefaultItem(), BOOL, tagMENU::cItems, FALSE, tagITEM::fState, msg, NULL, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, tagMENU::rgItems, tagPOPUPMENU::spmenu, tagITEM::spSubMenu, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestWF, ThreadLock, ThreadUnlock, TRUE, UINT, WFWIN40COMPAT, xxxMNDismissWithNotify(), xxxMNDoScroll(), xxxPeekMessage, and xxxSendMenuSelect().

Referenced by xxxHandleMenuMessages(), and xxxMenuWindowProc().

02698 { 02699 PMENU pMenu; 02700 PITEM pItem; 02701 MSG msg; 02702 UINT uPos; 02703 02704 /* 02705 * This code to swallow double clicks isn't executed! MNLoop will 02706 * swallow all double clicks for us. Swallow the up button for the 02707 * double dude instead. Word will not be happy if they get a spurious 02708 * WM_LBUTTONUP on the menu bar if their code to close the MDI child 02709 * doesn't swallow it soon enough. 02710 */ 02711 02712 /* 02713 * Eat the click. 02714 */ 02715 if (xxxPeekMessage(&msg, NULL, 0, 0, PM_NOYIELD)) { 02716 if ((msg.message == WM_LBUTTONUP) || 02717 (msg.message == WM_NCLBUTTONUP)) { 02718 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 02719 } 02720 #if DBG 02721 else if (msg.message == WM_LBUTTONDBLCLK || 02722 msg.message == WM_NCLBUTTONDBLCLK) 02723 { 02724 UserAssertMsg0(FALSE, "xxxMNDoubleClick found a double click"); 02725 } 02726 #endif 02727 } 02728 02729 /* 02730 * Get current item. 02731 */ 02732 pMenu = ppopup->spmenu; 02733 if ((pMenu==NULL) || ((UINT)idxItem >= pMenu->cItems)) { 02734 xxxMNDoScroll(ppopup, ppopup->posSelectedItem, FALSE); 02735 goto Done; 02736 } 02737 02738 pItem = pMenu->rgItems + idxItem; 02739 uPos = idxItem; 02740 02741 /* 02742 * Do nothing if item is disabled. 02743 */ 02744 if (pItem->fState & MFS_GRAYED) 02745 goto Done; 02746 02747 /* 02748 * Traverse the hierarchy down as far as possible. 02749 */ 02750 do 02751 { 02752 if (pItem->spSubMenu != NULL) { 02753 /* 02754 * The item is a popup menu, so continue traversing. 02755 */ 02756 pMenu = pItem->spSubMenu; 02757 idxItem = (UINT)_GetMenuDefaultItem(pMenu, MF_BYPOSITION, 0); 02758 02759 if (idxItem != -1) { 02760 pItem = pMenu->rgItems + idxItem; 02761 uPos = idxItem; 02762 continue; 02763 } else /* if (lpItem->wID == -1) How do we know this popup has an ID? */ 02764 break; 02765 } 02766 02767 /* 02768 * We've found a leaf node of some kind, either a MFS_DEFAULT popup 02769 * with a valid cmd ID that has no valid MFS_DEFAULT children, or 02770 * a real cmd with MFS_DEFAULT style. 02771 * 02772 * Exit menu mode and send command ID. 02773 */ 02774 02775 /* 02776 * For old apps we need to generate a WM_MENUSELECT message first. 02777 * Old apps, esp. Word 6.0, can't handle double-clicks on maximized 02778 * child sys menus because they never get a WM_MENUSELECT for the 02779 * item, unlike with normal keyboard/mouse choosing. We need to 02780 * fake it so they won't fault. Several VB apps have a similar 02781 * problem. 02782 */ 02783 if (!TestWF(ppopup->ppopupmenuRoot->spwndNotify, WFWIN40COMPAT)) 02784 { 02785 TL tlpwndNotify, tlpopup; 02786 02787 ThreadLock(ppopup->ppopupmenuRoot->spwndNotify, &tlpwndNotify); 02788 ThreadLock(ppopup->spwndPopupMenu, &tlpopup); 02789 xxxSendMenuSelect(ppopup->ppopupmenuRoot->spwndNotify, 02790 ppopup->spwndPopupMenu, pMenu, idxItem); 02791 ThreadUnlock(&tlpopup); 02792 ThreadUnlock(&tlpwndNotify); 02793 } 02794 02795 xxxMNDismissWithNotify(pMenuState, pMenu, pItem, uPos, 0); 02796 return TRUE; 02797 } 02798 while (TRUE); 02799 02800 Done: 02801 return(FALSE); 02802 }

BOOL xxxMNDragLeave VOID   ) 
 

Definition at line 237 of file menudd.c.

References BOOL, FALSE, tagMENUSTATE::fInDoDragDrop, LockMenuState(), MFMWFP_NOITEM, NULL, PtiCurrent, TRUE, tagMENUSTATE::uDraggingFlags, tagMENUSTATE::uDraggingHitArea, tagMENUSTATE::uDraggingIndex, UnlockMFMWFPWindow(), xxxMNSetGapState(), and xxxUnlockMenuState().

Referenced by NtUserMNDragLeave().

00238 { 00239 PMENUSTATE pMenuState; 00240 00241 pMenuState = PtiCurrent()->pMenuState; 00242 if (pMenuState == NULL) { 00243 RIPMSG0(RIP_WARNING, "xxxMNDragLeave: Not in menu mode"); 00244 return FALSE; 00245 } 00246 00247 LockMenuState(pMenuState); 00248 00249 /* 00250 * Clean up any present insertion bar state 00251 */ 00252 xxxMNSetGapState(pMenuState->uDraggingHitArea, 00253 pMenuState->uDraggingIndex, 00254 pMenuState->uDraggingFlags, 00255 FALSE); 00256 00257 /* 00258 * Forget the last dragging area 00259 */ 00260 UnlockMFMWFPWindow(&pMenuState->uDraggingHitArea); 00261 pMenuState->uDraggingIndex = MFMWFP_NOITEM; 00262 pMenuState->uDraggingFlags = 0; 00263 00264 00265 /* 00266 * The DoDragDrop loop has left our window. 00267 */ 00268 pMenuState->fInDoDragDrop = FALSE; 00269 00270 xxxUnlockMenuState(pMenuState); 00271 00272 return TRUE; 00273 }

BOOL xxxMNDragOver POINT *  ppt,
PMNDRAGOVERINFO  pmndoi
 

Definition at line 156 of file menudd.c.

References BOOL, tagMNDRAGOVERINFO::dwFlags, FALSE, tagMENUSTATE::fDragAndDrop, tagMENUSTATE::fInDoDragDrop, GetMenuStateWindow(), tagMNDRAGOVERINFO::hmenu, tagMNDRAGOVERINFO::hwndNotify, LockMenuState(), MFMWFP_NOITEM, MFMWFP_OFFMENU, NULL, PMNDRAGOVERINFO, PtiCurrent, PtoH, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndNotify, ThreadLockAlways, ThreadUnlock, TRUE, tagMENUSTATE::uDraggingFlags, tagMENUSTATE::uDraggingHitArea, tagMENUSTATE::uDraggingIndex, tagMNDRAGOVERINFO::uItemIndex, xxxCallHandleMenuMessages(), and xxxUnlockMenuState().

Referenced by NtUserMNDragOver().

00157 { 00158 BOOL fRet; 00159 PMENUSTATE pMenuState; 00160 PWND pwnd; 00161 PPOPUPMENU ppopup; 00162 TL tlpwnd; 00163 00164 /* 00165 * OLE always calls us in context (proxy/marshall stuff). So the 00166 * current thread must be in menu mode 00167 */ 00168 pMenuState = PtiCurrent()->pMenuState; 00169 if (pMenuState == NULL) { 00170 RIPMSG0(RIP_WARNING, "xxxMNDragOver: Not in menu mode"); 00171 return FALSE; 00172 } 00173 00174 /* 00175 * This must be a drag and drop menu 00176 */ 00177 UserAssert(pMenuState->fDragAndDrop); 00178 00179 /* 00180 * We might have not initiated this DoDragDrop so make sure 00181 * the internal flag is set. 00182 */ 00183 pMenuState->fInDoDragDrop = TRUE; 00184 00185 /* 00186 * Get a window to call xxxCallHandleMenuMessages 00187 */ 00188 pwnd = GetMenuStateWindow(pMenuState); 00189 if (pwnd == NULL) { 00190 RIPMSG0(RIP_WARNING, "xxxMNDragOver: Failed to get MenuStateWindow"); 00191 return FALSE; 00192 } 00193 00194 /* 00195 * We need this after calling back, so lock it 00196 */ 00197 LockMenuState(pMenuState); 00198 00199 /* 00200 * Update the selection and the dragging info 00201 * Use WM_NCMOUSEMOVE because the point is in screen coordinates already. 00202 */ 00203 ThreadLockAlways(pwnd, &tlpwnd); 00204 xxxCallHandleMenuMessages(pMenuState, pwnd, WM_NCMOUSEMOVE, 0, MAKELONG(ppt->x, ppt->y)); 00205 ThreadUnlock(&tlpwnd); 00206 00207 /* 00208 * If we're on a popup, propagate the hit test info 00209 */ 00210 if (pMenuState->uDraggingHitArea != MFMWFP_OFFMENU) { 00211 ppopup = ((PMENUWND)pMenuState->uDraggingHitArea)->ppopupmenu; 00212 pmndoi->hmenu = PtoH(ppopup->spmenu); 00213 pmndoi->uItemIndex = pMenuState->uDraggingIndex; 00214 pmndoi->hwndNotify = PtoH(ppopup->spwndNotify); 00215 pmndoi->dwFlags = pMenuState->uDraggingFlags; 00216 /* 00217 * Bottom gap of item N corresponds to N+1 gap 00218 */ 00219 if (pmndoi->dwFlags & MNGOF_BOTTOMGAP) { 00220 UserAssert(pmndoi->uItemIndex != MFMWFP_NOITEM); 00221 (pmndoi->uItemIndex)++; 00222 } 00223 fRet = TRUE; 00224 } else { 00225 fRet = FALSE; 00226 } 00227 00228 xxxUnlockMenuState(pMenuState); 00229 return fRet;; 00230 00231 }

void xxxMNEndMenuState BOOL  fFreePopup  ) 
 

Definition at line 265 of file mnstate.c.

References CLEAR_PUDF, DBGDecModalMenuCount, DecSFWLockCount(), DF_MENUINUSE, tagDESKTOP::dwDTFlags, tagMENUSTATE::dwLockCount, FALSE, tagPOPUPMENU::fDelayedFree, tagPOPUPMENU::fDestroyed, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fModelessMenu, GetpMenuState(), GETPTI, gMenuState, tagMENUSTATE::hbmAni, MNDestroyAnimationBitmap(), MNEndMenuStateNotify(), MNFreePopup(), NULL, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagMENUSTATE::pmnsPrev, PtiCurrent, tagDESKTOP::PtiList, tagMENUSTATE::ptiMenuStateOwner, PUDF_MENUSTATEINUSE, tagTHREADINFO::rpdesk, tagPOPUPMENU::spwndActivePopup, tagDESKTOP::spwndMenu, TEST_PUDF, tagMENUSTATE::uButtonDownHitArea, tagMENUSTATE::uDraggingHitArea, UnlockMFMWFPWindow(), xxxActivateThisWindow(), and xxxMNSetCapture().

Referenced by xxxCallHandleMenuMessages(), xxxDestroyThreadInfo(), xxxMenuWindowProc(), xxxMNAllocMenuState(), xxxSysCommand(), xxxTrackPopupMenuEx(), and xxxUnlockMenuState().

00266 { 00267 PTHREADINFO ptiCurrent = PtiCurrent(); 00268 PMENUSTATE pMenuState; 00269 pMenuState = ptiCurrent->pMenuState; 00270 UserAssert(ptiCurrent->pMenuState != NULL); 00271 UserAssert(ptiCurrent == pMenuState->ptiMenuStateOwner); 00272 00273 /* 00274 * If the menu is locked, someone doesn't want it to go just yet. 00275 */ 00276 if (pMenuState->dwLockCount != 0) { 00277 RIPMSG1(RIP_WARNING, "xxxMNEndMenuState Locked:%#p", pMenuState); 00278 return; 00279 } 00280 00281 MNEndMenuStateNotify(pMenuState); 00282 00283 /* 00284 * pMenuState->pGlobalPopupMenu could be NULL if xxxMNAllocMenuState failed 00285 */ 00286 if (pMenuState->pGlobalPopupMenu != NULL) { 00287 if (fFreePopup) { 00288 UserAssert(pMenuState->pGlobalPopupMenu->fIsMenuBar || pMenuState->pGlobalPopupMenu->fDestroyed); 00289 00290 MNFreePopup(pMenuState->pGlobalPopupMenu); 00291 } else { 00292 /* 00293 * This means that we're ending the menustate but the popup menu 00294 * window is still around. This can happen when called from 00295 * xxxDestroyThreadInfo. 00296 */ 00297 UserAssert(pMenuState->pGlobalPopupMenu->fIsTrackPopup); 00298 pMenuState->pGlobalPopupMenu->fDelayedFree = FALSE; 00299 } 00300 } 00301 00302 /* 00303 * Unlock MFMWFP windows. 00304 */ 00305 UnlockMFMWFPWindow(&pMenuState->uButtonDownHitArea); 00306 UnlockMFMWFPWindow(&pMenuState->uDraggingHitArea); 00307 00308 /* 00309 * Restore the previous state, if any 00310 */ 00311 ptiCurrent->pMenuState = pMenuState->pmnsPrev; 00312 00313 /* 00314 * This (modal) menu mode is off 00315 */ 00316 if (!pMenuState->fModelessMenu) { 00317 DecSFWLockCount(); 00318 DBGDecModalMenuCount(); 00319 } 00320 00321 if (pMenuState->hbmAni != NULL) { 00322 MNDestroyAnimationBitmap(pMenuState); 00323 } 00324 00325 /* 00326 * Free the menu state 00327 */ 00328 if (pMenuState == &gMenuState) { 00329 UserAssert(TEST_PUDF(PUDF_MENUSTATEINUSE)); 00330 CLEAR_PUDF(PUDF_MENUSTATEINUSE); 00331 GreSetDCOwner(gMenuState.hdcAni, OBJECT_OWNER_PUBLIC); 00332 } else { 00333 if (pMenuState->hdcAni != NULL) { 00334 GreDeleteDC(pMenuState->hdcAni); 00335 } 00336 UserFreePool(pMenuState); 00337 } 00338 00339 /* 00340 * If returning to a modeless menu, make sure have activation 00341 * If returning to a modal menu, make sure we have capture 00342 */ 00343 if (ptiCurrent->pMenuState != NULL) { 00344 if (ptiCurrent->pMenuState->fModelessMenu) { 00345 xxxActivateThisWindow(ptiCurrent->pMenuState->pGlobalPopupMenu->spwndActivePopup, 00346 0, 0); 00347 } else { 00348 xxxMNSetCapture(ptiCurrent->pMenuState->pGlobalPopupMenu); 00349 } 00350 } 00351 00352 #if DBG 00353 /* 00354 * If this thread is not in menu mode anymore, it must not be using 00355 * the desktop menu 00356 */ 00357 if ((ptiCurrent->pMenuState == NULL) && (ptiCurrent->rpdesk->spwndMenu != NULL)) { 00358 UserAssert(ptiCurrent != GETPTI(ptiCurrent->rpdesk->spwndMenu)); 00359 } 00360 /* 00361 * If someone is using the menu window, it must be in menu mode 00362 */ 00363 if (ptiCurrent->rpdesk->dwDTFlags & DF_MENUINUSE) { 00364 UserAssert(GetpMenuState(ptiCurrent->rpdesk->spwndMenu) != NULL); 00365 } 00366 /* 00367 * No pti should point to this pMenuState anymore 00368 * If guModalMenuStateCount is zero, all pMenuState must be NULL or modeless 00369 */ 00370 { 00371 PLIST_ENTRY pHead, pEntry; 00372 PTHREADINFO ptiT; 00373 00374 pHead = &(ptiCurrent->rpdesk->PtiList); 00375 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 00376 ptiT = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 00377 UserAssert(ptiT->pMenuState != pMenuState); 00378 if (guModalMenuStateCount == 0) { 00379 UserAssert(ptiT->pMenuState == NULL || ptiT->pMenuState->fModelessMenu); 00380 } 00381 } 00382 } 00383 #endif 00384 }

UINT xxxMNFindChar PMENU  pMenu,
UINT  ch,
INT  idxC,
INT lpr
 

Referenced by xxxMNChar().

LONG_PTR xxxMNFindWindowFromPoint PPOPUPMENU  ppopupMenu,
PUINT  pIndex,
POINTS  screenPt
 

Definition at line 3180 of file ntuser/kernel/menu.c.

References _HasCaptionIcon(), FALSE, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, GetWindowBorders(), IsMFMWFPWindow(), L, MFMWFP_ALTMENU, MFMWFP_NOITEM, MFMWFP_OFFMENU, MNItemHitTest(), NULL, OffsetRect(), PtInRect(), tagWND::rcWindow, RevalidateHwnd, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, SYSMET, TestWF, ThreadLockAlways, ThreadUnlock, TRUE, UINT, WFMINIMIZED, and xxxSendMessage().

Referenced by xxxHandleMenuMessages(), xxxMenuWindowProc(), and xxxMNMouseMove().

03184 { 03185 POINT pt; 03186 RECT rect; 03187 LONG_PTR longHit; 03188 UINT itemHit; 03189 PWND pwnd; 03190 TL tlpwndT; 03191 #ifdef USE_MIRRORING 03192 int cx; 03193 #endif 03194 03195 03196 *pIndex = 0; 03197 03198 if (ppopupmenu->spwndNextPopup) { 03199 03200 /* 03201 * Check if this point is on any of our children before checking if it 03202 * is on ourselves. 03203 */ 03204 ThreadLockAlways(ppopupmenu->spwndNextPopup, &tlpwndT); 03205 longHit = xxxSendMessage(ppopupmenu->spwndNextPopup, 03206 MN_FINDMENUWINDOWFROMPOINT, (WPARAM)&itemHit, 03207 MAKELONG(screenPt.x, screenPt.y)); 03208 ThreadUnlock(&tlpwndT); 03209 03210 /* 03211 * If return value is an hwnd, convert to pwnd. 03212 */ 03213 if (IsMFMWFPWindow(longHit)) { 03214 longHit = (LONG_PTR)RevalidateHwnd((HWND)longHit); 03215 } 03216 03217 if (longHit) { 03218 03219 /* 03220 * Hit occurred on one of our children. 03221 */ 03222 03223 *pIndex = itemHit; 03224 return longHit; 03225 } 03226 } 03227 03228 if (ppopupmenu->fIsMenuBar) { 03229 int cBorders; 03230 03231 /* 03232 * Check if this point is on the menu bar 03233 */ 03234 pwnd = ppopupmenu->spwndNotify; 03235 if (pwnd == NULL) { 03236 return MFMWFP_OFFMENU; 03237 } 03238 03239 pt.x = screenPt.x; 03240 pt.y = screenPt.y; 03241 03242 if (ppopupmenu->fIsSysMenu) { 03243 03244 if (!_HasCaptionIcon(pwnd)) { 03245 /* 03246 * no system menu rect to click in if it doesn't have an icon 03247 */ 03248 return(0L); 03249 } 03250 03251 /* 03252 * Check if this is a click on the system menu icon. 03253 */ 03254 if (TestWF(pwnd, WFMINIMIZED)) { 03255 03256 /* 03257 * If the window is minimized, then check if there was a hit in 03258 * the client area of the icon's window. 03259 */ 03260 03261 /* 03262 * Mikehar 5/27 03263 * Don't know how this ever worked. If we are the system menu of an icon 03264 * we want to punt the menus if the click occurs ANYWHERE outside of the 03265 * menu. 03266 * Johnc 03-Jun-1992 the next 4 lines were commented out for Mike's 03267 * problem above but that made clicking on a minimized window with 03268 * the system menu already up, bring down the menu and put it right 03269 * up again (bug 10951) because the mnloop wouldn't swallow the mouse 03270 * down click message. The problem Mike mentions no longer shows up. 03271 */ 03272 03273 if (PtInRect(&(pwnd->rcWindow), pt)) { 03274 return MFMWFP_NOITEM; 03275 } 03276 03277 /* 03278 * It's an iconic window, so can't be hitting anywhere else. 03279 */ 03280 return MFMWFP_OFFMENU; 03281 } 03282 03283 /* 03284 * Check if we are hitting on the system menu rectangle on the top 03285 * left of windows. 03286 */ 03287 rect.top = rect.left = 0; 03288 rect.right = SYSMET(CXSIZE); 03289 rect.bottom = SYSMET(CYSIZE); 03290 03291 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 03292 03293 OffsetRect(&rect, pwnd->rcWindow.left + cBorders*SYSMET(CXBORDER), 03294 pwnd->rcWindow.top + cBorders*SYSMET(CYBORDER)); 03295 #ifdef USE_MIRRORING 03296 //Mirror the rect because the buttons in the left hand side of the window if it mirrored 03297 if (TestWF(pwnd, WEFLAYOUTRTL)) { 03298 cx = rect.right - rect.left; 03299 rect.right = pwnd->rcWindow.right - (rect.left - pwnd->rcWindow.left); 03300 rect.left = rect.right - cx; 03301 } 03302 #endif 03303 if (PtInRect(&rect, pt)) { 03304 *pIndex = 0; 03305 return(MFMWFP_NOITEM); 03306 } 03307 /* 03308 * Check if we hit in the alternate menu if available. 03309 */ 03310 if (ppopupmenu->spmenuAlternate) { 03311 itemHit = MNItemHitTest(ppopupmenu->spmenuAlternate, pwnd, pt); 03312 if (itemHit != MFMWFP_NOITEM) { 03313 *pIndex = itemHit; 03314 return MFMWFP_ALTMENU; 03315 } 03316 } 03317 return MFMWFP_OFFMENU; 03318 } else { 03319 if (TestWF(ppopupmenu->spwndNotify, WFMINIMIZED)) { 03320 03321 /* 03322 * If we are minimized, we can't hit on the main menu bar. 03323 */ 03324 return MFMWFP_OFFMENU; 03325 } 03326 } 03327 } else { 03328 pwnd = ppopupmenu->spwndPopupMenu; 03329 03330 /* 03331 * else this is a popup window and we need to check if we are hitting 03332 * anywhere on this popup window. 03333 */ 03334 pt.x = screenPt.x; 03335 pt.y = screenPt.y; 03336 if (!PtInRect(&pwnd->rcWindow, pt)) { 03337 03338 /* 03339 * Point completely outside the popup menu window so return 0. 03340 */ 03341 return MFMWFP_OFFMENU; 03342 } 03343 } 03344 03345 pt.x = screenPt.x; 03346 pt.y = screenPt.y; 03347 03348 itemHit = MNItemHitTest(ppopupmenu->spmenu, pwnd, pt); 03349 03350 if (ppopupmenu->fIsMenuBar) { 03351 03352 /* 03353 * If hit is on menu bar but no item is there, treat it as if the user 03354 * hit nothing. 03355 */ 03356 if (itemHit == MFMWFP_NOITEM) { 03357 03358 /* 03359 * Check if we hit in the alternate menu if available. 03360 */ 03361 if (ppopupmenu->spmenuAlternate) { 03362 itemHit = MNItemHitTest(ppopupmenu->spmenuAlternate, pwnd, pt); 03363 if (itemHit != MFMWFP_NOITEM) { 03364 *pIndex = itemHit; 03365 return MFMWFP_ALTMENU; 03366 } 03367 } 03368 return MFMWFP_OFFMENU; 03369 } 03370 03371 *pIndex = itemHit; 03372 return MFMWFP_NOITEM; 03373 } else { 03374 03375 /* 03376 * If hit is on popup menu but no item is there, itemHit 03377 * will be MFMWFP_NOITEM 03378 */ 03379 *pIndex = itemHit; 03380 return (LONG_PTR)pwnd; 03381 } 03382 return MFMWFP_OFFMENU; 03383 }

PITEM xxxMNInvertItem PPOPUPMENU  ppopupmenu,
PMENU  pMenu,
int  itemNumber,
PWND  pwndNotify,
BOOL  fOn
 

Definition at line 1697 of file mndraw.c.

References _GetDC(), _GetWindowDC(), _ReleaseDC(), BOOL, CheckLock, tagMENU::cItems, ClearMFS, CreateEmptyRgn(), tagITEM::cxItem, tagITEM::cyItem, tagMENU::cyMenu, DMI_INVERT, tagMENU::dwArrowsOn, FALSE, ghMenuFont, gpDispInfo, GreGetTextAlign(), GreSetTextAlign(), tagITEM::hbmp, tagMENU::hbrBack, tagDISPLAYINFO::hDev, tagMENU::iTop, MFISPOPUP, MFMWFP_DOWNARROW, MFMWFP_UPARROW, MNDrawArrow(), mnDrawHilite(), MNEraseBackground(), MNGetToppItem(), MNPositionSysMenu(), MSA_OFF, NULL, tagWND::rcWindow, tagMENU::rgItems, SetMFS, tagPOPUPMENU::spwndPopupMenu, SYSMET, TestMF, TestMFS, TestMFT, TestWF, ThreadLock, ThreadUnlock, TRUE, UINT, WFMINIMIZED, WFSIZEBOX, tagITEM::xItem, xxxDrawMenuItem(), xxxGetSysMenuHandle(), xxxMNSetTop(), xxxSendMenuSelect(), xxxUpdateWindow(), and tagITEM::yItem.

Referenced by xxxHiliteMenuItem(), and xxxMNSelectItem().

01703 { 01704 PITEM pItem = NULL; 01705 HDC hdc; 01706 int y, iNewTop; 01707 RECT rcItem; 01708 BOOL fSysMenuIcon = FALSE; 01709 PMENU pmenusys; 01710 BOOL fClipped = FALSE; 01711 HFONT hOldFont; 01712 HRGN hrgnVisSave; 01713 PWND pwnd; 01714 POINT ptOrg; 01715 TL tlpwnd; 01716 UINT oldAlign; 01717 01718 CheckLock(pmenu); 01719 CheckLock(pwndNotify); 01720 01721 /* 01722 * If we are in the middle of trying to get out of menu mode, hMenu 01723 * and/or pwndNotify will be NULL, so just bail out now. 01724 */ 01725 if ((pmenu == NULL) || (pwndNotify == NULL)) { 01726 return NULL; 01727 } 01728 01729 01730 /* 01731 * If ppopupmenu is NULL, we're not in menu mode (i.e, call from 01732 * HiliteMenuItem). 01733 */ 01734 if (ppopupmenu == NULL) { 01735 pwnd = pwndNotify; 01736 } else { 01737 pwnd = ppopupmenu->spwndPopupMenu; 01738 } 01739 01740 if (pwnd != pwndNotify) { 01741 ThreadLock(pwnd, &tlpwnd); 01742 } 01743 01744 01745 if (itemNumber < 0) { 01746 01747 if (ppopupmenu != NULL) { 01748 if ((itemNumber == MFMWFP_UPARROW) || (itemNumber == MFMWFP_DOWNARROW)) { 01749 MNDrawArrow(NULL, ppopupmenu, itemNumber); 01750 } 01751 } 01752 01753 xxxSendMenuSelect(pwndNotify, pwnd, pmenu, itemNumber); 01754 goto SeeYa; 01755 } 01756 01757 if (!TestMF(pmenu, MFISPOPUP)) { 01758 pmenusys = xxxGetSysMenuHandle(pwndNotify); 01759 if (pmenu == pmenusys) { 01760 MNPositionSysMenu(pwndNotify, pmenusys); 01761 fSysMenuIcon = TRUE; 01762 } 01763 } 01764 01765 if ((UINT)itemNumber >= pmenu->cItems) 01766 goto SeeYa; 01767 01768 pItem = &pmenu->rgItems[itemNumber]; 01769 01770 if (!TestMF(pmenu, MFISPOPUP) && TestWF(pwndNotify, WFMINIMIZED)) { 01771 01772 /* 01773 * Skip inverting top level menus if the window is iconic. 01774 */ 01775 goto SeeYa; 01776 } 01777 01778 /* 01779 * Is this a separator? 01780 */ 01781 if (TestMFT(pItem, MFT_SEPARATOR)) { 01782 goto SendSelectMsg; 01783 } 01784 01785 if ((BOOL)TestMFS(pItem, MFS_HILITE) == (BOOL)fOn) { 01786 01787 /* 01788 * Item's state isn't really changing. Just return. 01789 */ 01790 goto SeeYa; 01791 } 01792 01793 if (fOn && (ppopupmenu != NULL) && (pmenu->dwArrowsOn != MSA_OFF)) { 01794 /* 01795 * when selecting an item, ensure that the item is fully visible 01796 * BUGBUG -- for mouse use, partially visible should be acceptable 01797 * -- can we get mouse info down this far ? 01798 */ 01799 01800 if (itemNumber < pmenu->iTop) { 01801 iNewTop = itemNumber; 01802 goto NewTop; 01803 } else { 01804 PITEM pWalk = MNGetToppItem(pmenu); 01805 int dy = pItem->yItem + pItem->cyItem - pWalk->yItem - pmenu->cyMenu; 01806 iNewTop = pmenu->iTop; 01807 while ((dy > 0) && (iNewTop < (int)pmenu->cItems)) { 01808 dy -= pWalk->cyItem; 01809 pWalk++; 01810 iNewTop++; 01811 } 01812 if (iNewTop >= (int)pmenu->cItems) { 01813 iNewTop = pmenu->cItems; 01814 } 01815 NewTop: 01816 if (xxxMNSetTop(ppopupmenu, iNewTop)) { 01817 xxxUpdateWindow(pwnd); 01818 } 01819 } 01820 } 01821 01822 rcItem.left = pItem->xItem; 01823 rcItem.top = pItem->yItem; 01824 rcItem.right = pItem->xItem + pItem->cxItem; 01825 rcItem.bottom = pItem->yItem + pItem->cyItem; 01826 01827 y = pItem->cyItem; 01828 01829 if (TestMF(pmenu, MFISPOPUP)) { 01830 hdc = _GetDC(pwnd); 01831 } else { 01832 hdc = _GetWindowDC(pwnd); 01833 if ( TestWF(pwnd, WFSIZEBOX) && !fSysMenuIcon) { 01834 01835 /* 01836 * If the window is small enough that some of the menu bar has been 01837 * obscured by the frame, we don't want to draw on the bottom of the 01838 * sizing frame. Note that we don't want to do this if we are 01839 * inverting the system menu icon since that will be clipped to the 01840 * window rect. (otherwise we end up with only half the sys menu 01841 * icon inverted) 01842 */ 01843 int xMenuMax = (pwnd->rcWindow.right - pwnd->rcWindow.left) - SYSMET(CXSIZEFRAME); 01844 01845 if (rcItem.right > xMenuMax || 01846 rcItem.bottom > ((pwnd->rcWindow.bottom - 01847 pwnd->rcWindow.top) - SYSMET(CYSIZEFRAME))) { 01848 01849 /* 01850 * Lock the display while we're playing around with visrgns. 01851 * Make a local copy of the visrgn, so that it can be 01852 * properly restored on potential callbacks (i.e. WM_DRAWITEM). 01853 */ 01854 GreLockDisplay(gpDispInfo->hDev); 01855 01856 fClipped = TRUE; 01857 01858 #ifdef LATER 01859 // mikeke - don't use the visrgn here if possible 01860 hrgnVisSave = GreCreateRectRgn( 01861 pwnd->rcWindow.left + rcItem.left, 01862 pwnd->rcWindow.top + rcItem.top, 01863 pwnd->rcWindow.left + xMenuMax, 01864 pwnd->rcWindow.bottom - SYSMET(CYSIZEFRAME)); 01865 GreExtSelectClipRgn(hdc, hrgnVisSave, RGN_COPY); 01866 GreSetMetaRgn(hdc); 01867 GreDeleteObject(hrgnVisSave); 01868 #else 01869 hrgnVisSave = CreateEmptyRgn(); 01870 GreCopyVisRgn(hdc,hrgnVisSave); 01871 GreIntersectVisRect(hdc, 01872 pwnd->rcWindow.left + rcItem.left, 01873 pwnd->rcWindow.top + rcItem.top, 01874 pwnd->rcWindow.left + xMenuMax, 01875 pwnd->rcWindow.bottom - SYSMET(CYSIZEFRAME)); 01876 #endif 01877 01878 GreUnlockDisplay(gpDispInfo->hDev); 01879 } 01880 } 01881 } 01882 01883 oldAlign = GreGetTextAlign(hdc); 01884 if (pItem && TestMFT(pItem, MFT_RIGHTORDER)) 01885 GreSetTextAlign(hdc, oldAlign | TA_RTLREADING); 01886 01887 hOldFont = GreSelectFont(hdc, ghMenuFont); 01888 GreGetViewportOrg(hdc, &ptOrg); 01889 01890 if (fOn) { 01891 SetMFS(pItem, MFS_HILITE); 01892 } else { 01893 ClearMFS(pItem, MFS_HILITE); 01894 } 01895 01896 if (!fSysMenuIcon 01897 && ((pItem->hbmp != HBMMENU_SYSTEM) 01898 || (TestMF(pmenu, MFISPOPUP)))) { 01899 01900 if (pmenu->dwArrowsOn != MSA_OFF) { 01901 GreSetViewportOrg(hdc, ptOrg.x, ptOrg.y - ((int)MNGetToppItem(pmenu)->yItem), NULL); 01902 } 01903 01904 if ((pmenu->hbrBack != NULL) 01905 && !mnDrawHilite(pItem) 01906 && !TestMFT(pItem, MFT_OWNERDRAW)) { 01907 01908 /* 01909 * fill the background here so xxxDrawMenuItem doesn't have to fool 01910 * around with hbrBack 01911 */ 01912 int iBkSave = GreSetBkMode(hdc, TRANSPARENT); 01913 MNEraseBackground (hdc, pmenu, 01914 pItem->xItem, pItem->yItem, 01915 pItem->cxItem, pItem->cyItem); 01916 GreSetBkMode(hdc, iBkSave); 01917 } 01918 01919 xxxDrawMenuItem(hdc, pmenu, pItem, DMI_INVERT); 01920 } 01921 01922 01923 if (fClipped) { 01924 GreLockDisplay(gpDispInfo->hDev); 01925 GreSelectVisRgn(hdc, hrgnVisSave, SVR_DELETEOLD); 01926 GreUnlockDisplay(gpDispInfo->hDev); 01927 } 01928 01929 GreSelectFont(hdc, hOldFont); 01930 GreSetViewportOrg(hdc, ptOrg.x, ptOrg.y, NULL); 01931 GreSetTextAlign(hdc, oldAlign); 01932 _ReleaseDC(hdc); 01933 01934 SendSelectMsg: 01935 /* 01936 * send select msg only if we are selecting an item. 01937 */ 01938 if (fOn) { 01939 xxxSendMenuSelect(pwndNotify, pwnd, pmenu, itemNumber); 01940 } 01941 01942 SeeYa: 01943 if (pwnd != pwndNotify) { 01944 ThreadUnlock(&tlpwnd); 01945 } 01946 01947 return(pItem); 01948 }

VOID xxxMNKeyDown PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  key
 

Definition at line 1251 of file ntuser/kernel/menu.c.

References _GetSubMenu(), _IsIconic, BOOL, dir(), FALSE, tagMENUSTATE::fButtonDown, tagMENUSTATE::fDragging, tagPOPUPMENU::fDropNextPopup, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fHierarchyDropped, tagMENUSTATE::fIgnoreButtonUp, tagPOPUPMENU::fIsMenuBar, tagMENUSTATE::fIsSysMenu, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fRtoL, tagITEM::fState, tagMENUSTATE::fUnderline, GetMenuInheritedContextHelpId(), GETPTI, gwinOldAppHackoMaticFlags, IsRootPopupMenu(), Lock, LockPopupMenu(), MFMWFP_NOITEM, MNFindItemInColumn(), MNFindNextValidItem(), NULL, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, tagTHREADINFO::pq, PtiCurrent, PtoH, PtoHq, QF_CAPTURELOCKED, tagQ::QF_flags, RevalidateHmenu, RevalidateHwnd, tagWND::spmenu, tagPOPUPMENU::spmenu, tagWND::spmenuSys, tagITEM::spSubMenu, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, tagPOPUPMENU::spwndPrevPopup, TestWF, ThreadLock, ThreadUnlock, TRUE, UINT, UnlockPopupMenu(), WFCHILD, WFMINIMIZED, WFSYSMENU, tagITEM::wID, WOAHACK_CHECKALTKEYSTATE, WOAHACK_IGNOREALTKEYDOWN, xxxMNCloseHierarchy(), xxxMNDismiss(), xxxMNDismissWithNotify(), xxxMNOpenHierarchy(), xxxMNSelectItem(), xxxMNSetCapture(), xxxMNSwitchToAlternateMenu(), xxxSendHelpMessage(), and xxxSendMessage().

Referenced by xxxHandleMenuMessages(), xxxMenuWindowProc(), and xxxMNChar().

01255 { 01256 LRESULT dwMDIMenu; 01257 UINT item; 01258 BOOL fHierarchyWasDropped = FALSE; 01259 TL tlpwndT; 01260 PPOPUPMENU ppopupSave; 01261 BOOL bFakedKey; 01262 UINT keyOrig = key; 01263 01264 /* 01265 * Blow off keyboard if mouse down. 01266 */ 01267 if ((pMenuState->fButtonDown) && (key != VK_F1)) { 01268 /* 01269 * Check if the user wants to cancel dragging. 01270 */ 01271 if (pMenuState->fDragging && (key == VK_ESCAPE)) { 01272 RIPMSG0(RIP_WARNING, "xxxMNKeyDown: ESC while dragging"); 01273 pMenuState->fIgnoreButtonUp = TRUE; 01274 } 01275 01276 return; 01277 } 01278 01279 switch (key) { 01280 case VK_MENU: 01281 case VK_F10: 01282 { 01283 /* 01284 * Modeless don't go away when the menu key is hit. They just 01285 * ignore it. 01286 */ 01287 if (pMenuState->fModelessMenu) { 01288 return; 01289 } 01290 01291 if (gwinOldAppHackoMaticFlags & WOAHACK_CHECKALTKEYSTATE) { 01292 01293 /* 01294 * Winoldapp is telling us to put up/down the system menu. Due to 01295 * possible race conditions, we need to check the state of the alt 01296 * key before throwing away the menu. 01297 */ 01298 if (gwinOldAppHackoMaticFlags & WOAHACK_IGNOREALTKEYDOWN) { 01299 return; 01300 } 01301 } 01302 xxxMNDismiss(pMenuState); 01303 01304 /* 01305 * We're going to exit menu mode but the ALT key is down, so clear 01306 * pMenuState->fUnderline to cause xxxMNLoop not to erase the underlines 01307 */ 01308 if (key == VK_MENU) { 01309 pMenuState->fUnderline = FALSE; 01310 } 01311 } 01312 return; 01313 01314 case VK_ESCAPE: 01315 01316 /* 01317 * Escape key was hit. Get out of one level of menus. If no active 01318 * popups or we are minimized and there are no active popups below 01319 * this, we need to get out of menu mode. Otherwise, we popup up 01320 * one level in the hierarchy. 01321 */ 01322 if (ppopupmenu->fIsMenuBar || 01323 ppopupmenu == ppopupmenu->ppopupmenuRoot || 01324 TestWF(ppopupmenu->ppopupmenuRoot->spwndNotify, WFMINIMIZED)) { 01325 xxxMNDismiss(pMenuState); 01326 } else { 01327 /* 01328 * Pop back one level of menus. 01329 */ 01330 if (ppopupmenu->fHasMenuBar && 01331 ppopupmenu->spwndPrevPopup == ppopupmenu->spwndNotify) { 01332 01333 PPOPUPMENU ppopupmenuRoot = ppopupmenu->ppopupmenuRoot; 01334 01335 ppopupmenuRoot->fDropNextPopup = FALSE; 01336 01337 #if 0 01338 /* 01339 * We are on a menu bar hierarchy and there is only one popup 01340 * visible. We have to cancel this popup and put focus back on 01341 * the menu bar. 01342 */ 01343 if (_IsIconic(ppopupmenuRoot->spwndNotify)) { 01344 01345 /* 01346 * However, if we are iconic there really is no menu 01347 * bar so let's make it easier for users and get out 01348 * of menu mode completely. 01349 */ 01350 xxxMNDismiss(pMenuState); 01351 } else 01352 #endif 01353 /* 01354 * If the popup is closed, a modeless menu won't 01355 * have a window to get the keys. So modeless menu 01356 * cancel the menu at this point. Modal menus go 01357 * to the menu bar. 01358 */ 01359 if (pMenuState->fModelessMenu) { 01360 xxxMNDismiss(pMenuState); 01361 } else { 01362 xxxMNCloseHierarchy(ppopupmenuRoot, pMenuState); 01363 } 01364 } else { 01365 ThreadLock(ppopupmenu->spwndPrevPopup, &tlpwndT); 01366 xxxSendMessage(ppopupmenu->spwndPrevPopup, MN_CLOSEHIERARCHY, 01367 0, 0); 01368 ThreadUnlock(&tlpwndT); 01369 } 01370 } 01371 return; 01372 01373 case VK_UP: 01374 case VK_DOWN: 01375 if (ppopupmenu->fIsMenuBar) { 01376 01377 /* 01378 * If we are on the top level menu bar, try to open the popup if 01379 * possible. 01380 */ 01381 if (xxxMNOpenHierarchy(ppopupmenu, pMenuState) == (PWND)-1) 01382 return; 01383 } else { 01384 item = MNFindNextValidItem(ppopupmenu->spmenu, 01385 ppopupmenu->posSelectedItem, (key == VK_UP ? -1 : 1), 0); 01386 xxxMNSelectItem(ppopupmenu, pMenuState, item); 01387 } 01388 return; 01389 01390 case VK_LEFT: 01391 case VK_RIGHT: 01392 #ifdef USE_MIRRORING 01393 bFakedKey = (!!ppopupmenu->fRtoL) ^ (!!TestWF(ppopupmenu->spwndPopupMenu, WEFLAYOUTRTL)); 01394 #else 01395 bFakedKey = ppopupmenu->fRtoL; 01396 #endif 01397 if (bFakedKey) 01398 /* 01399 * turn the keys around, we drew the menu backwards. 01400 */ 01401 key = (key == VK_LEFT) ? VK_RIGHT : VK_LEFT; 01402 if (!ppopupmenu->fIsMenuBar && (key == VK_RIGHT) && 01403 !ppopupmenu->spwndNextPopup) { 01404 /* 01405 * Try to open the hierarchy at this item if there is one. 01406 */ 01407 if (xxxMNOpenHierarchy(ppopupmenu, pMenuState) == (PWND)-1) 01408 return; 01409 if (ppopupmenu->fHierarchyDropped) { 01410 return; 01411 } 01412 } 01413 01414 if (ppopupmenu->spwndNextPopup) { 01415 fHierarchyWasDropped = TRUE; 01416 if ((key == VK_LEFT) && !ppopupmenu->fIsMenuBar) { 01417 xxxMNCloseHierarchy(ppopupmenu, pMenuState); 01418 return; 01419 } 01420 } else if (ppopupmenu->fDropNextPopup) 01421 fHierarchyWasDropped = TRUE; 01422 01423 ppopupSave = ppopupmenu; 01424 01425 item = MNFindItemInColumn(ppopupmenu->spmenu, 01426 ppopupmenu->posSelectedItem, 01427 (key == VK_LEFT ? -1 : 1), 01428 (ppopupmenu->fHasMenuBar && 01429 ppopupmenu == ppopupmenu->ppopupmenuRoot)); 01430 01431 if (item == MFMWFP_NOITEM) { 01432 01433 /* 01434 * No valid item found in the given direction so send it up to our 01435 * parent to handle. 01436 */ 01437 if (ppopupmenu->fHasMenuBar && 01438 ppopupmenu->spwndPrevPopup == ppopupmenu->spwndNotify) { 01439 01440 /* 01441 * if we turned the key round, then turn it back again. 01442 */ 01443 if (bFakedKey) 01444 key = (key == VK_LEFT) ? VK_RIGHT : VK_LEFT; 01445 /* 01446 * Go to next/prev item in menu bar since a popup was down and 01447 * no item on the popup to go to. 01448 */ 01449 xxxMNKeyDown(ppopupmenu->ppopupmenuRoot, pMenuState, key); 01450 return; 01451 } 01452 01453 if (ppopupmenu == ppopupmenu->ppopupmenuRoot) { 01454 if (!ppopupmenu->fIsMenuBar) { 01455 01456 /* 01457 * No menu bar associated with this menu so do nothing. 01458 */ 01459 return; 01460 } 01461 } else { 01462 ThreadLock(ppopupmenu->spwndPrevPopup, &tlpwndT); 01463 xxxSendMessage(ppopupmenu->spwndPrevPopup, WM_KEYDOWN, keyOrig, 0); 01464 ThreadUnlock(&tlpwndT); 01465 return; 01466 } 01467 } 01468 01469 if (!ppopupmenu->fIsMenuBar) { 01470 if (item != MFMWFP_NOITEM) { 01471 xxxMNSelectItem(ppopupmenu, pMenuState, item); 01472 } 01473 return; 01474 01475 } else { 01476 01477 /* 01478 * Special handling if keydown occurred on a menu bar. 01479 */ 01480 if (item == MFMWFP_NOITEM) { 01481 01482 if (TestWF(ppopupmenu->spwndNotify, WFSYSMENU)) { 01483 PTHREADINFO ptiCurrent = PtiCurrent(); 01484 PWND pwndNextMenu; 01485 PMENU pmenuNextMenu, pmenuUse; 01486 MDINEXTMENU mnm; 01487 TL tlpmenuNextMenu; 01488 TL tlpwndNextMenu; 01489 01490 mnm.hmenuIn = (HMENU)0; 01491 mnm.hmenuNext = (HMENU)0; 01492 mnm.hwndNext = (HWND)0; 01493 01494 /* 01495 * We are in the menu bar and need to go up to the system menu 01496 * or go from the system menu to the menu bar. 01497 */ 01498 pmenuNextMenu = ppopupmenu->fIsSysMenu ? 01499 _GetSubMenu(ppopupmenu->spmenu, 0) : 01500 ppopupmenu->spmenu; 01501 mnm.hmenuIn = PtoH(pmenuNextMenu); 01502 ThreadLock(ppopupmenu->spwndNotify, &tlpwndT); 01503 dwMDIMenu = xxxSendMessage(ppopupmenu->spwndNotify, 01504 WM_NEXTMENU, (WPARAM)keyOrig, (LPARAM)&mnm); 01505 ThreadUnlock(&tlpwndT); 01506 01507 pwndNextMenu = RevalidateHwnd(mnm.hwndNext); 01508 if (pwndNextMenu == NULL) 01509 goto TryAlternate; 01510 01511 /* 01512 * If this window belongs to another thread, we cannot 01513 * use it. The menu loop won't get any messages 01514 * directed to that thread. 01515 */ 01516 if (GETPTI(pwndNextMenu) != ptiCurrent) { 01517 RIPMSG1(RIP_WARNING, "xxxMNKeyDown: Ignoring mnm.hwndNext bacause it belongs to another thread: %#p", pwndNextMenu); 01518 goto TryAlternate; 01519 } 01520 01521 01522 pmenuNextMenu = RevalidateHmenu(mnm.hmenuNext); 01523 if (pmenuNextMenu == NULL) 01524 goto TryAlternate; 01525 01526 ThreadLock(pmenuNextMenu, &tlpmenuNextMenu); 01527 ThreadLock(pwndNextMenu, &tlpwndNextMenu); 01528 01529 /* 01530 * If the system menu is for a minimized MDI child, 01531 * make sure the menu is dropped to give the user a 01532 * visual clue that they are in menu mode 01533 */ 01534 if (TestWF(pwndNextMenu, WFMINIMIZED)) 01535 fHierarchyWasDropped = TRUE; 01536 01537 xxxMNSelectItem(ppopupmenu, pMenuState, MFMWFP_NOITEM); 01538 01539 pMenuState->fIsSysMenu = TRUE; 01540 UnlockPopupMenu(ppopupmenu, &ppopupmenu->spmenuAlternate); 01541 ppopupmenu->fToggle = FALSE; 01542 /* 01543 * GetSystemMenu(pwnd, FALSE) and pwnd->spmenuSys are 01544 * NOT equivalent -- GetSystemMenu returns the 1st submenu 01545 * of pwnd->spmenuSys -- make up for that here 01546 */ 01547 pmenuUse = (((pwndNextMenu->spmenuSys != NULL) 01548 && (_GetSubMenu(pwndNextMenu->spmenuSys, 0) == pmenuNextMenu)) 01549 ? pwndNextMenu->spmenuSys 01550 : pmenuNextMenu); 01551 /* 01552 * We're going to change the notification window AND the menu. 01553 * LockPopupMenu needs to unlock the current pmenu-spwndNotify 01554 * but also lock the new pmenu-spwndNotify. Since we cannot 01555 * give it the current AND the new pair, we unlock the 01556 * current one first, switch the notification window and 01557 * then call LockPopupMenu to lock the new pmenu-spwndNotify. 01558 */ 01559 UserAssert(IsRootPopupMenu(ppopupmenu)); 01560 UnlockPopupMenu(ppopupmenu, &ppopupmenu->spmenu); 01561 Lock(&ppopupmenu->spwndNotify, pwndNextMenu); 01562 Lock(&ppopupmenu->spwndPopupMenu, pwndNextMenu); 01563 LockPopupMenu(ppopupmenu, &ppopupmenu->spmenu, pmenuUse); 01564 /* 01565 * We just switched to a new notification window so 01566 * we need to Adjust capture accordingly 01567 */ 01568 if (!pMenuState->fModelessMenu) { 01569 ptiCurrent->pq->QF_flags &= ~QF_CAPTURELOCKED; 01570 xxxMNSetCapture(ppopupmenu); 01571 } 01572 01573 01574 if (!TestWF(pwndNextMenu, WFCHILD) && 01575 ppopupmenu->spmenu != NULL) { 01576 01577 /* 01578 * This window has a system menu and a main menu bar 01579 * Set the alternate menu to the appropriate menu 01580 */ 01581 if (pwndNextMenu->spmenu == ppopupmenu->spmenu) { 01582 LockPopupMenu(ppopupmenu, &ppopupmenu->spmenuAlternate, 01583 pwndNextMenu->spmenuSys); 01584 pMenuState->fIsSysMenu = FALSE; 01585 } else { 01586 LockPopupMenu(ppopupmenu, &ppopupmenu->spmenuAlternate, 01587 pwndNextMenu->spmenu); 01588 } 01589 } 01590 01591 ThreadUnlock(&tlpwndNextMenu); 01592 ThreadUnlock(&tlpmenuNextMenu); 01593 01594 ppopupmenu->fIsSysMenu = pMenuState->fIsSysMenu; 01595 01596 item = 0; 01597 } else 01598 TryAlternate: 01599 if (xxxMNSwitchToAlternateMenu(ppopupmenu)) { 01600 /* 01601 * go to first or last menu item int ppopup->hMenu 01602 * based on 'key' 01603 */ 01604 int dir = (key == VK_RIGHT) ? 1 : -1; 01605 01606 item = MNFindNextValidItem(ppopupmenu->spmenu, MFMWFP_NOITEM, dir, 0); 01607 } 01608 } 01609 01610 if (item != MFMWFP_NOITEM) { 01611 /* 01612 * we found a new menu item to go to 01613 * 1) close up the previous menu if it was dropped 01614 * 2) select the new menu item to go to 01615 * 3) drop the new menu if the previous menu was dropped 01616 */ 01617 01618 if (ppopupSave->spwndNextPopup) 01619 xxxMNCloseHierarchy(ppopupSave, pMenuState); 01620 01621 xxxMNSelectItem(ppopupmenu, pMenuState, item); 01622 01623 if (fHierarchyWasDropped) { 01624 DropHierarchy: 01625 if (xxxMNOpenHierarchy(ppopupmenu, pMenuState) == (PWND)-1) { 01626 return; 01627 } 01628 } 01629 } 01630 } 01631 return; 01632 01633 case VK_RETURN: 01634 { 01635 BOOL fEnabled; 01636 PITEM pItem; 01637 01638 if (ppopupmenu->posSelectedItem >= ppopupmenu->spmenu->cItems) { 01639 xxxMNDismiss(pMenuState); 01640 return; 01641 } 01642 01643 pItem = ppopupmenu->spmenu->rgItems + ppopupmenu->posSelectedItem; 01644 fEnabled = !(pItem->fState & MFS_GRAYED); 01645 if ((pItem->spSubMenu != NULL) && fEnabled) 01646 goto DropHierarchy; 01647 01648 /* 01649 * If no item is selected, throw away menu and return. 01650 */ 01651 if (fEnabled) { 01652 xxxMNDismissWithNotify(pMenuState, ppopupmenu->spmenu, pItem, ppopupmenu->posSelectedItem, 0); 01653 } else { 01654 xxxMNDismiss(pMenuState); 01655 } 01656 return; 01657 } 01658 01659 case VK_F1: /* Provide context sensitive help. */ 01660 { 01661 PITEM pItem; 01662 01663 pItem = ppopupmenu->spmenu->rgItems + ppopupmenu->posSelectedItem; 01664 ThreadLock(ppopupmenu->spwndNotify, &tlpwndT); 01665 xxxSendHelpMessage(ppopupmenu->spwndNotify, HELPINFO_MENUITEM, pItem->wID, 01666 PtoHq(ppopupmenu->spmenu), 01667 GetMenuInheritedContextHelpId(ppopupmenu)); 01668 ThreadUnlock(&tlpwndT); 01669 break; 01670 } 01671 01672 } 01673 }

VOID xxxMNKeyFilter PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  ch
 

Definition at line 290 of file mnkey.c.

References BOOL, FALSE, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fInCancel, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsSysMenu, tagMENUSTATE::fMenuStarted, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fToggle, KEYBDHOLD, MENUCHILDSYSMENU, MENUSYSMENU, MFMWFP_NOITEM, MNPositionSysMenu(), tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestWF, TestwndChild, TRUE, WFSYSMENU, xxxMessageBeep(), xxxMNChar(), xxxMNCloseHierarchy(), xxxMNDismiss(), xxxMNLoop(), xxxMNOpenHierarchy(), xxxMNSelectItem(), xxxMNStartMenu(), and xxxMNSwitchToAlternateMenu().

Referenced by xxxSysCommand().

00294 { 00295 BOOL fLocalInsideMenuLoop = pMenuState->fInsideMenuLoop; 00296 00297 if (pMenuState->fButtonDown) { 00298 00299 /* 00300 * Ignore keystrokes while the mouse is pressed (except ESC). 00301 */ 00302 return; 00303 } 00304 00305 if (!pMenuState->fInsideMenuLoop) { 00306 00307 /* 00308 * Need to send the WM_INITMENU message before we pull down the menu. 00309 */ 00310 if (!xxxMNStartMenu(ppopupMenu, KEYBDHOLD)) { 00311 return; 00312 } 00313 pMenuState->fInsideMenuLoop = TRUE; 00314 } 00315 00316 00317 switch (ch) { 00318 case 0: 00319 00320 /* 00321 * If we get a WM_KEYDOWN alt key and then a KEYUP alt key, we need to 00322 * activate the first item on the menu. ie. user hits and releases alt 00323 * key so just select first item. USER sends us a SC_KEYMENU with 00324 * lParam 0 when the user does this. 00325 */ 00326 xxxMNSelectItem(ppopupMenu, pMenuState, 0); 00327 break; 00328 00329 case MENUCHILDSYSMENU: 00330 if (!TestwndChild(ppopupMenu->spwndNotify)) { 00331 00332 /* 00333 * Change made to fix MDI problem: child window gets a keymenu, 00334 * and pops up sysmenu of frame when maximized. Need to act like 00335 * MENUCHAR if hwndMenu is a top-level. 00336 */ 00337 goto MenuCharHandler; 00338 } 00339 00340 /* 00341 * else fall through. 00342 */ 00343 00344 case MENUSYSMENU: 00345 if (!TestWF(ppopupMenu->spwndNotify, WFSYSMENU)) { 00346 xxxMessageBeep(0); 00347 goto MenuCancel; 00348 } 00349 00350 /* 00351 * Popup any hierarchies we have. 00352 */ 00353 xxxMNCloseHierarchy(ppopupMenu, pMenuState); 00354 if (!ppopupMenu->fIsSysMenu && ppopupMenu->spmenuAlternate) 00355 xxxMNSwitchToAlternateMenu(ppopupMenu); 00356 if (!ppopupMenu->fIsSysMenu) { 00357 /* 00358 * If no system menu, get out. 00359 */ 00360 goto MenuCancel; 00361 } 00362 00363 MNPositionSysMenu(ppopupMenu->spwndPopupMenu, ppopupMenu->spmenu); 00364 xxxMNSelectItem(ppopupMenu, pMenuState, 0); 00365 xxxMNOpenHierarchy(ppopupMenu, pMenuState); 00366 ppopupMenu->fToggle = FALSE; 00367 break; 00368 00369 00370 default: 00371 00372 /* 00373 * Handle ALT-Character sequences for items on top level menu bar. 00374 * Note that fInsideMenuLoop may be set to false on return from this 00375 * function if the app decides to return 1 to the WM_MENUCHAR message. 00376 * We detect this and not enter MenuLoop if fInsideMenuLoop is reset 00377 * to false. 00378 */ 00379 MenuCharHandler: 00380 xxxMNChar(ppopupMenu, pMenuState, ch); 00381 if (ppopupMenu->posSelectedItem == MFMWFP_NOITEM) { 00382 /* 00383 * No selection found. 00384 */ 00385 goto MenuCancel; 00386 } 00387 break; 00388 } 00389 00390 if (!fLocalInsideMenuLoop && pMenuState->fInsideMenuLoop) { 00391 xxxMNLoop(ppopupMenu, pMenuState, 0, FALSE); 00392 } 00393 00394 return; 00395 00396 00397 MenuCancel: 00398 pMenuState->fModelessMenu = FALSE; 00399 if (!ppopupMenu->fInCancel) { 00400 xxxMNDismiss(pMenuState); 00401 } 00402 UserAssert(!pMenuState->fInsideMenuLoop && !pMenuState->fMenuStarted); 00403 return; 00404 }

int xxxMNLoop PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
LPARAM  lParam,
BOOL  fDblClk
 

Definition at line 635 of file mnloop.c.

References _CallMsgFilter(), _GetKeyState(), _GetMenuState(), _IsChild(), _PostMessage(), BOOL, tagMENUSTATE::cmdLast, DBGDecModalMenuCount, DecSFWLockCount(), DWORD, ExitMenuLoop(), FALSE, tagPOPUPMENU::fFlushDelayedFree, FindNCHit(), tagMENUSTATE::fInDoDragDrop, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fMenuStarted, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fNoNotify, tagPOPUPMENU::fRightButton, tagMENUSTATE::hdcWndAni, HW, IsRootPopupMenu(), MNFlushDestroyedPopups(), MOUSEHOLD, msg, NULL, tagTHREADINFO::pq, PtiCurrent, tagTHREADINFO::ptLast, tagMENUSTATE::ptMouseLast, QF_ACTIVATIONCHANGE, QF_CAPTURELOCKED, tagQ::QF_flags, tagQ::spwndActive, tagPOPUPMENU::spwndActivePopup, tagQ::spwndCapture, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestWF, ThreadLock, ThreadLockAlways, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_IGNOREPLAYBACKDELAY, TRUE, Validateppopupmenu, WFVISIBLE, WM_SYSTIMER, xxxDispatchMessage(), xxxEndMenuLoop(), xxxGetSysMenuHandle(), xxxHandleMenuMessages(), xxxMNReleaseCapture(), xxxMNStartMenu(), xxxPeekMessage, xxxSendMessage(), xxxSendNotifyMessage(), xxxSleepThread(), and xxxTranslateMessage().

Referenced by xxxMNKeyFilter(), xxxSysCommand(), and xxxTrackPopupMenuEx().

00640 { 00641 int hit; 00642 MSG msg; 00643 BOOL fSendIdle = TRUE; 00644 BOOL fInQueue = FALSE; 00645 DWORD menuState; 00646 PTHREADINFO pti; 00647 TL tlpwndT; 00648 00649 UserAssert(IsRootPopupMenu(ppopupmenu)); 00650 00651 pMenuState->fInsideMenuLoop = TRUE; 00652 pMenuState->cmdLast = 0; 00653 00654 pti = PtiCurrent(); 00655 00656 pMenuState->ptMouseLast.x = pti->ptLast.x; 00657 pMenuState->ptMouseLast.y = pti->ptLast.y; 00658 00659 /* 00660 * Set flag to false, so that we can track if windows have 00661 * been activated since entering this loop. 00662 */ 00663 pti->pq->QF_flags &= ~QF_ACTIVATIONCHANGE; 00664 00665 /* 00666 * Were we called from xxxMenuKeyFilter? If not, simulate a LBUTTONDOWN 00667 * message to bring up the popup. 00668 */ 00669 if (!pMenuState->fMenuStarted) { 00670 if (_GetKeyState(((ppopupmenu->fRightButton) ? 00671 VK_RBUTTON : VK_LBUTTON)) >= 0) { 00672 00673 /* 00674 * We think the mouse button should be down but the call to get key 00675 * state says different so we need to get outta menu mode. This 00676 * happens if clicking on the menu causes a sys modal message box to 00677 * come up before we can enter this stuff. For example, run 00678 * winfile, click on drive a: to see its tree. Activate some other 00679 * app, then open drive a: and activate winfile by clicking on the 00680 * menu. This causes a sys modal msg box to come up just before 00681 * entering menu mode. The user may have the mouse button up but 00682 * menu mode code thinks it is down... 00683 */ 00684 00685 /* 00686 * Need to notify the app we are exiting menu mode because we told 00687 * it we were entering menu mode just before entering this function 00688 * in xxxSysCommand()... 00689 */ 00690 if (!ppopupmenu->fNoNotify) { 00691 ThreadLock(ppopupmenu->spwndNotify, &tlpwndT); 00692 xxxSendNotifyMessage(ppopupmenu->spwndNotify, WM_EXITMENULOOP, 00693 ((ppopupmenu->fIsTrackPopup && !ppopupmenu->fIsSysMenu) ? TRUE : FALSE), 0); 00694 ThreadUnlock(&tlpwndT); 00695 } 00696 goto ExitMenuLoop; 00697 } 00698 00699 /* 00700 * Simulate a WM_LBUTTONDOWN message. 00701 */ 00702 if (!ppopupmenu->fIsTrackPopup) { 00703 00704 /* 00705 * For TrackPopupMenus, we do it in the TrackPopupMenu function 00706 * itself so we don't want to do it again. 00707 */ 00708 if (!xxxMNStartMenu(ppopupmenu, MOUSEHOLD)) { 00709 goto ExitMenuLoop; 00710 } 00711 } 00712 00713 if ((ppopupmenu->fRightButton)) { 00714 msg.message = (fDblClk ? WM_RBUTTONDBLCLK : WM_RBUTTONDOWN); 00715 msg.wParam = MK_RBUTTON; 00716 } else { 00717 msg.message = (fDblClk ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN); 00718 msg.wParam = MK_LBUTTON; 00719 } 00720 msg.lParam = lParam; 00721 msg.hwnd = HW(ppopupmenu->spwndPopupMenu); 00722 xxxHandleMenuMessages(&msg, pMenuState, ppopupmenu); 00723 } 00724 00725 /* 00726 * If this is a modeless menu, release capture, mark it in the menu state 00727 * and return. Decrement foreground lock count. 00728 */ 00729 if (pMenuState->fModelessMenu) { 00730 xxxMNReleaseCapture(); 00731 00732 DecSFWLockCount(); 00733 DBGDecModalMenuCount(); 00734 return 0; 00735 } 00736 00737 while (pMenuState->fInsideMenuLoop) { 00738 00739 /* 00740 * Is a message waiting for us? 00741 */ 00742 BOOL fPeek = xxxPeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_NOREMOVE); 00743 00744 Validateppopupmenu(ppopupmenu); 00745 00746 if (fPeek) { 00747 /* 00748 * Bail if we have been forced out of menu loop 00749 */ 00750 if (ExitMenuLoop (pMenuState, ppopupmenu)) { 00751 goto ExitMenuLoop; 00752 } 00753 00754 /* 00755 * Since we could have blocked in xxxWaitMessage (see last line 00756 * of loop) or xxxPeekMessage, reset the cached copy of 00757 * ptiCurrent()->pq: It could have changed if someone did a 00758 * DetachThreadInput() while we were away. 00759 */ 00760 if ((!ppopupmenu->fIsTrackPopup && 00761 pti->pq->spwndActive != ppopupmenu->spwndNotify && 00762 ((pti->pq->spwndActive == NULL) || !_IsChild(pti->pq->spwndActive, ppopupmenu->spwndNotify)))) { 00763 00764 /* 00765 * End menu processing if we are no longer the active window. 00766 * This is needed in case a system modal dialog box pops up 00767 * while we are tracking the menu code for example. It also 00768 * helps out Tracer if a macro is executed while a menu is down. 00769 */ 00770 00771 /* 00772 * Also, end menu processing if we think the mouse button is 00773 * down but it really isn't. (Happens if a sys modal dialog int 00774 * time dlg box comes up while we are in menu mode.) 00775 */ 00776 00777 goto ExitMenuLoop; 00778 } 00779 00780 if (ppopupmenu->fIsMenuBar && msg.message == WM_LBUTTONDBLCLK) { 00781 00782 /* 00783 * Was the double click on the system menu or caption? 00784 */ 00785 hit = FindNCHit(ppopupmenu->spwndNotify, (LONG)msg.lParam); 00786 if (hit == HTCAPTION) { 00787 PWND pwnd; 00788 PMENU pmenu; 00789 00790 /* 00791 * Get the message out of the queue since we're gonna 00792 * process it. 00793 */ 00794 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 00795 if (ExitMenuLoop (pMenuState, ppopupmenu)) { 00796 goto ExitMenuLoop; 00797 } else { 00798 pwnd = ppopupmenu->spwndNotify; 00799 ThreadLockAlways(pwnd, &tlpwndT); 00800 pmenu = xxxGetSysMenuHandle(pwnd); 00801 UserAssert(pwnd == ppopupmenu->spwndNotify); 00802 00803 menuState = _GetMenuState(pmenu, SC_RESTORE & 0x0000FFF0, 00804 MF_BYCOMMAND); 00805 00806 /* 00807 * Only send the sys command if the item is valid. If 00808 * the item doesn't exist or is disabled, then don't 00809 * post the syscommand. Note that for win2 apps, we 00810 * always send the sys command if it is a child window. 00811 * This is so hosebag apps can change the sys menu. 00812 */ 00813 if (!(menuState & MFS_GRAYED)) { 00814 _PostMessage(pwnd, WM_SYSCOMMAND, SC_RESTORE, 0); 00815 } 00816 00817 /* 00818 * Get out of menu mode. 00819 */ 00820 ThreadUnlock(&tlpwndT); 00821 goto ExitMenuLoop; 00822 } 00823 } 00824 } 00825 00826 fInQueue = (msg.message == WM_LBUTTONDOWN || 00827 msg.message == WM_RBUTTONDOWN || 00828 msg.message == WM_NCLBUTTONDOWN || 00829 msg.message == WM_NCRBUTTONDOWN); 00830 00831 if (!fInQueue) { 00832 00833 /* 00834 * Note that we call xxxPeekMessage() with the filter 00835 * set to the message we got from xxxPeekMessage() rather 00836 * than simply 0, 0. This prevents problems when 00837 * xxxPeekMessage() returns something like a WM_TIMER, 00838 * and after we get here to remove it a WM_LBUTTONDOWN, 00839 * or some higher-priority input message, gets in the 00840 * queue and gets removed accidently. Basically we want 00841 * to be sure we remove the right message in this case. 00842 * NT bug 3852 was caused by this problem. 00843 * Set the TIF_IGNOREPLAYBACKDELAY bit in case journal playback 00844 * is happening: this allows us to proceed even if the hookproc 00845 * incorrectly returns a delay now. The bit will be cleared if 00846 * this happens, so we can see why the Peek-Remove below fails. 00847 * Lotus' Freelance Graphics tutorial does such bad journalling 00848 */ 00849 00850 pti->TIF_flags |= TIF_IGNOREPLAYBACKDELAY; 00851 if (!xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE)) { 00852 if (pti->TIF_flags & TIF_IGNOREPLAYBACKDELAY) { 00853 pti->TIF_flags &= ~TIF_IGNOREPLAYBACKDELAY; 00854 /* 00855 * It wasn't a bad journal playback: something else 00856 * made the previously peeked message disappear before 00857 * we could peek it again to remove it. 00858 */ 00859 RIPMSG1(RIP_WARNING, "Disappearing msg 0x%08lx", msg.message); 00860 goto NoMsg; 00861 } 00862 } 00863 pti->TIF_flags &= ~TIF_IGNOREPLAYBACKDELAY; 00864 } 00865 00866 if (!_CallMsgFilter(&msg, MSGF_MENU)) { 00867 if (!xxxHandleMenuMessages(&msg, pMenuState, ppopupmenu)) { 00868 xxxTranslateMessage(&msg, 0); 00869 xxxDispatchMessage(&msg); 00870 } 00871 00872 Validateppopupmenu(ppopupmenu); 00873 00874 if (ExitMenuLoop (pMenuState, ppopupmenu)) { 00875 goto ExitMenuLoop; 00876 } 00877 00878 if (pti->pq->QF_flags & QF_ACTIVATIONCHANGE) { 00879 00880 /* 00881 * Run away and exit menu mode if another window has become 00882 * active while a menu was up. 00883 */ 00884 RIPMSG0(RIP_WARNING, "Exiting menu mode: another window activated"); 00885 goto ExitMenuLoop; 00886 } 00887 00888 #if DBG 00889 /* 00890 * Nobody should be able to still capture from us. 00891 */ 00892 if (!pMenuState->fInDoDragDrop) { 00893 UserAssert(pti->pq->QF_flags & QF_CAPTURELOCKED); 00894 UserAssert(pti->pq->spwndCapture == ppopupmenu->spwndNotify); 00895 } 00896 #endif 00897 00898 /* 00899 * If we get a system timer, then it's like we're idle 00900 */ 00901 if (msg.message == WM_SYSTIMER) { 00902 goto NoMsg; 00903 } 00904 00905 /* 00906 * Don't set fSendIdle if we got these messages 00907 */ 00908 if ((msg.message == WM_TIMER) || (msg.message == WM_PAINT)) { 00909 continue; 00910 } 00911 00912 } else { 00913 if (fInQueue) 00914 xxxPeekMessage(&msg, NULL, msg.message, msg.message, 00915 PM_REMOVE); 00916 } 00917 00918 /* 00919 * Reenable WM_ENTERIDLE messages. 00920 */ 00921 fSendIdle = TRUE; 00922 00923 } else { 00924 NoMsg: 00925 /* 00926 * Bail if we have been forced out of menu loop 00927 */ 00928 if (ExitMenuLoop (pMenuState, ppopupmenu)) { 00929 goto ExitMenuLoop; 00930 } 00931 00932 UserAssert((ppopupmenu->spwndActivePopup == NULL) 00933 || (TestWF(ppopupmenu->spwndActivePopup, WFVISIBLE))); 00934 00935 00936 /* 00937 * If a hierarchical popup has been destroyed, this is a 00938 * good time to flush ppmDelayedFree 00939 */ 00940 if (ppopupmenu->fFlushDelayedFree) { 00941 MNFlushDestroyedPopups (ppopupmenu, FALSE); 00942 ppopupmenu->fFlushDelayedFree = FALSE; 00943 } 00944 00945 /* 00946 * We need to send the WM_ENTERIDLE message only the first time 00947 * there are no messages for us to process. Subsequent times we 00948 * need to yield via WaitMessage(). This will allow other tasks to 00949 * get some time while we have a menu down. 00950 */ 00951 if (fSendIdle) { 00952 if (ppopupmenu->spwndNotify != NULL) { 00953 ThreadLockAlways(ppopupmenu->spwndNotify, &tlpwndT); 00954 xxxSendMessage(ppopupmenu->spwndNotify, WM_ENTERIDLE, MSGF_MENU, 00955 (LPARAM)HW(ppopupmenu->spwndActivePopup)); 00956 ThreadUnlock(&tlpwndT); 00957 } 00958 fSendIdle = FALSE; 00959 } else { 00960 /* 00961 * If we're animating, sleep only 1 ms to reduce the chance 00962 * of jerky animation. 00963 * When not animating, this is the same as a xxxWaitMessage call 00964 */ 00965 xxxSleepThread(QS_ALLINPUT | QS_EVENT, (pMenuState->hdcWndAni != NULL), TRUE); 00966 } 00967 00968 } /* if (PeekMessage(&msg, NULL, 0, 0, PM_NOYIELD)) else */ 00969 00970 } /* end while (fInsideMenuLoop) */ 00971 00972 00973 00974 ExitMenuLoop: 00975 pMenuState->fInsideMenuLoop = FALSE; 00976 pMenuState->fModelessMenu = FALSE; 00977 00978 /* 00979 * Make sure that the menu has been ended/canceled 00980 */ 00981 xxxEndMenuLoop (pMenuState, ppopupmenu); 00982 00983 xxxMNReleaseCapture(); 00984 00985 // Throw in an extra peek here when we exit the menu loop to ensure that the input queue 00986 // for this thread gets unlocked if there is no more input left for him. 00987 xxxPeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOYIELD | PM_NOREMOVE); 00988 return(pMenuState->cmdLast); 00989 } /* xxxMenuLoop() */

VOID xxxMNMouseMove PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
POINTS  screenPt
 

Definition at line 3618 of file ntuser/kernel/menu.c.

References FALSE, tagMENUSTATE::fButtonDown, tagMENUSTATE::fInDoDragDrop, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fTrackMouseEvent, HWq, IsRootPopupMenu(), KEYBDHOLD, L, MFMWFP_ALTMENU, MFMWFP_NOITEM, MFMWFP_OFFMENU, tagMENUSTATE::mnFocus, MNSetTimerToAutoDismiss(), MOUSEHOLD, NULL, tagMENUSTATE::ptMouseLast, PtoH, tagPOPUPMENU::spwndActivePopup, tagPOPUPMENU::spwndNotify, TestWF, ThreadLock, ThreadUnlock, TrackMouseEvent(), TRUE, UINT, WFMINIMIZED, WFVISIBLE, xxxMNButtonDown(), xxxMNFindWindowFromPoint(), xxxMNHideNextHierarchy(), xxxMNSelectItem(), xxxMNSwitchToAlternateMenu(), xxxMNUpdateDraggingInfo(), and xxxSendMessage().

Referenced by xxxHandleMenuMessages(), and xxxMenuWindowProc().

03622 { 03623 LONG_PTR cmdHitArea; 03624 UINT uFlags; 03625 UINT cmdItem; 03626 PWND pwnd; 03627 TL tlpwndT; 03628 03629 03630 if (!IsRootPopupMenu(ppopup)) { 03631 RIPMSG0(RIP_ERROR, 03632 "MenuMouseMoveHandler() called for a non top most menu"); 03633 return; 03634 } 03635 03636 /* 03637 * Ignore mouse moves that aren't really moves. MSTEST jiggles 03638 * the mouse for some reason. And windows coming and going will 03639 * force mouse moves, to reset the cursor. 03640 */ 03641 if ((ptScreen.x == pMenuState->ptMouseLast.x) && (ptScreen.y == pMenuState->ptMouseLast.y)) 03642 return; 03643 03644 pMenuState->ptMouseLast.x = ptScreen.x; 03645 pMenuState->ptMouseLast.y = ptScreen.y; 03646 03647 /* 03648 * Find out where this mouse move occurred. 03649 */ 03650 cmdHitArea = xxxMNFindWindowFromPoint(ppopup, &cmdItem, ptScreen); 03651 03652 /* 03653 * If coming from an IDropTarget call out, remember the hit test 03654 */ 03655 if (pMenuState->fInDoDragDrop) { 03656 xxxMNUpdateDraggingInfo(pMenuState, cmdHitArea, cmdItem); 03657 } 03658 03659 if (pMenuState->mnFocus == KEYBDHOLD) { 03660 /* 03661 * Ignore mouse moves when in keyboard mode if the mouse isn't over any 03662 * menu at all. Also ignore mouse moves if over minimized window, 03663 * because we pretend that its entire window is like system menu. 03664 */ 03665 if ((cmdHitArea == MFMWFP_OFFMENU) || 03666 ((cmdHitArea == MFMWFP_NOITEM) && TestWF(ppopup->spwndNotify, WFMINIMIZED))) { 03667 return; 03668 } 03669 03670 pMenuState->mnFocus = MOUSEHOLD; 03671 } 03672 03673 if (cmdHitArea == MFMWFP_ALTMENU) { 03674 /* 03675 * User clicked in the other menu so switch to it ONLY IF 03676 * MOUSE IS DOWN. Usability testing proves that people frequently 03677 * get kicked into the system menu accidentally when browsing the 03678 * menu bar. We support the Win3.1 behavior when the mouse is 03679 * down however. 03680 */ 03681 if (pMenuState->fButtonDown) { 03682 xxxMNSwitchToAlternateMenu(ppopup); 03683 cmdHitArea = MFMWFP_NOITEM; 03684 } else 03685 goto OverNothing; 03686 } 03687 03688 if (cmdHitArea == MFMWFP_NOITEM) { 03689 /* 03690 * Mouse move occurred to an item in the main menu bar. If the item 03691 * is different than the one already selected, close up the current 03692 * one, select the new one and drop its menu. But if the item is the 03693 * same as the one currently selected, we need to pull up any popups 03694 * if needed and just keep the current level visible. Hey, this is 03695 * the same as a mousedown so lets do that instead. 03696 */ 03697 xxxMNButtonDown(ppopup, pMenuState, cmdItem, FALSE); 03698 return; 03699 } else if (cmdHitArea != 0) { 03700 /* This is a popup window we moved onto. */ 03701 pwnd = (PWND)(cmdHitArea); 03702 ThreadLock(pwnd, &tlpwndT); 03703 03704 UserAssert(TestWF(pwnd, WFVISIBLE)); 03705 03706 /* 03707 * Modeless menus don't capture the mouse, so track it to know 03708 * when it leaves the popup. 03709 */ 03710 ppopup = ((PMENUWND)pwnd)->ppopupmenu; 03711 if (pMenuState->fModelessMenu 03712 && !pMenuState->fInDoDragDrop 03713 && !ppopup->fTrackMouseEvent) { 03714 03715 TRACKMOUSEEVENT tme; 03716 03717 /* tme.cbSize = sizeof(TRACKMOUSEEVENT); Not checked on kernel side */ 03718 tme.dwFlags = TME_LEAVE; 03719 tme.hwndTrack = PtoH(pwnd); 03720 TrackMouseEvent(&tme); 03721 ppopup->fTrackMouseEvent = TRUE; 03722 03723 /* 03724 * We just entered this window so make sure the cursor 03725 * is properly set. 03726 */ 03727 xxxSendMessage(pwnd, WM_SETCURSOR, (WPARAM)HWq(pwnd), MAKELONG(MSGF_MENU, 0)); 03728 03729 } 03730 03731 /* 03732 * Select the item. 03733 */ 03734 uFlags = (UINT)xxxSendMessage(pwnd, MN_SELECTITEM, (WPARAM)cmdItem, 0L); 03735 if ((uFlags & MF_POPUP) && !(uFlags & MFS_GRAYED)) { 03736 /* 03737 * User moved back onto an item with a hierarchy. Hide the 03738 * the dropped popup. 03739 */ 03740 if (!xxxSendMessage(pwnd, MN_SETTIMERTOOPENHIERARCHY, 0, 0L)) { 03741 xxxMNHideNextHierarchy(ppopup); 03742 } 03743 } 03744 ThreadUnlock(&tlpwndT); 03745 } else 03746 OverNothing: 03747 { 03748 /* We moved off all menu windows... */ 03749 if (ppopup->spwndActivePopup != NULL) { 03750 pwnd = ppopup->spwndActivePopup; 03751 03752 ThreadLock(pwnd, &tlpwndT); 03753 xxxSendMessage(pwnd, MN_SELECTITEM, MFMWFP_NOITEM, 0L); 03754 MNSetTimerToAutoDismiss(pMenuState, pwnd); 03755 ThreadUnlock(&tlpwndT); 03756 } else { 03757 xxxMNSelectItem(ppopup, pMenuState, MFMWFP_NOITEM); 03758 } 03759 03760 } 03761 }

PWND xxxMNOpenHierarchy PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState
 

Definition at line 1934 of file ntuser/kernel/menu.c.

References _GetAsyncKeyState(), _KillTimer(), BOOL, tagMENU::cItems, ClearMF, ClrWF, CopyOffsetRect(), tagITEM::cxItem, tagITEM::cyItem, DF_MENUINUSE, tagDESKTOP::dwDTFlags, DWORD, tagPOPUPMENU::fAboutToHide, FALSE, tagPOPUPMENU::fDelayedFree, tagPOPUPMENU::fDesktopMenu, tagMENUSTATE::fDragAndDrop, tagPOPUPMENU::fDropNextPopup, tagPOPUPMENU::fDroppedLeft, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fHideTimer, tagPOPUPMENU::fHierarchyDropped, tagMENUSTATE::fInsideMenuLoop, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fNoNotify, tagPOPUPMENU::fRtoL, tagPOPUPMENU::fSendUninit, tagPOPUPMENU::fShowTimer, tagMENUSTATE::fUnderline, FWINABLE, HANDLEF_DESTROY, tagWND::head, HMChangeOwnerThread(), hModuleWin, HMPheFromObject, HW, tagPOPUPMENU::iDropDir, IDSYS_MNSHOW, IntersectRect(), KEYBDHOLD, L, Lock, LockPopupMenu(), LPVOID, MENUCLASS, MFMWFP_NOITEM, MFUNDERLINE, tagMENUSTATE::mnFocus, MNSW_SIZE, NT_SUCCESS, NULL, PAS_LEFT, PAS_OUT, PAS_RIGHT, tagDESKTOP::pDeskInfo, PlayEventSound(), tagTHREADINFO::pMenuState, tagPOPUPMENU::posDropped, tagPOPUPMENU::posSelectedItem, tagTHREADINFO::ppi, tagPOPUPMENU::ppmDelayedFree, tagPOPUPMENU::ppopupmenuRoot, tagWINDOWSTATION::pTerm, PtiCurrent, tagTERMINAL::ptiDesktop, PtoHq, PWND_TOP, PWND_TOPMOST, tagMONITOR::rcMonitor, tagWND::rcWindow, tagMENU::rgItems, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, SetMF, SetWF, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagITEM::spSubMenu, tagDESKTOPINFO::spwnd, tagPOPUPMENU::spwndActivePopup, tagDESKTOP::spwndMenu, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagWND::spwndOwner, tagPOPUPMENU::spwndPopupMenu, tagPOPUPMENU::spwndPrevPopup, SYSMET, TestMFS, TestMFT, TestWF, ThreadLock, ThreadLockAlways, ThreadUnlock, TIF_DISABLEHOOKS, tagTHREADINFO::TIF_flags, TRUE, Unlock, USER_SOUND_MENUPOPUP, WEFTOPMOST, WFOLDUI, WFVISIBLE, tagITEM::xItem, xxxCleanupDesktopMenu(), xxxClientRegisterDragDrop(), xxxCreateWindowEx(), xxxDestroyWindow(), xxxMNCloseHierarchy(), xxxMNDestroyHandler(), xxxMNPositionHierarchy(), xxxSendMessage(), xxxSetParent(), xxxSetWindowPos(), xxxUpdateWindow(), xxxWindowEvent(), and tagITEM::yItem.

Referenced by xxxMenuWindowProc(), xxxMNButtonDown(), xxxMNButtonUp(), xxxMNKeyDown(), and xxxMNKeyFilter().

01936 { 01937 PWND ret = 0; 01938 PITEM pItem; 01939 PWND pwndHierarchy; 01940 PPOPUPMENU ppopupmenuHierarchy; 01941 LONG sizeHierarchy; 01942 int xLeft; 01943 int yTop; 01944 int cxPopup, cyPopup; 01945 TL tlpwndT; 01946 TL tlpwndHierarchy; 01947 PTHREADINFO ptiCurrent = PtiCurrent(); 01948 PDESKTOP pdesk = ptiCurrent->rpdesk; 01949 BOOL fSendUninit = FALSE; 01950 HMENU hmenuInit; 01951 PMONITOR pMonitor; 01952 01953 01954 if (ppopupmenu->posSelectedItem == MFMWFP_NOITEM) { 01955 /* 01956 * No selection so fail. 01957 */ 01958 return NULL; 01959 } 01960 01961 if (ppopupmenu->posSelectedItem >= ppopupmenu->spmenu->cItems) 01962 return NULL; 01963 01964 if (ppopupmenu->fHierarchyDropped) { 01965 if (ppopupmenu->fHideTimer) { 01966 xxxMNCloseHierarchy(ppopupmenu,pMenuState); 01967 } else { 01968 /* 01969 * Hierarchy already dropped. What are we doing here? 01970 */ 01971 UserAssert(!ppopupmenu->fHierarchyDropped); 01972 return NULL; 01973 } 01974 } 01975 01976 if (ppopupmenu->fShowTimer) { 01977 _KillTimer(ppopupmenu->spwndPopupMenu, IDSYS_MNSHOW); 01978 ppopupmenu->fShowTimer = FALSE; 01979 } 01980 01981 /* 01982 * Get a pointer to the currently selected item in this menu. 01983 */ 01984 pItem = &(ppopupmenu->spmenu->rgItems[ppopupmenu->posSelectedItem]); 01985 01986 if (pItem->spSubMenu == NULL) 01987 goto Exit; 01988 01989 /* 01990 * Send the initmenupopup message. 01991 */ 01992 if (!ppopupmenu->fNoNotify) { 01993 ThreadLock(ppopupmenu->spwndNotify, &tlpwndT); 01994 /* 01995 * WordPerfect's Grammatik app doesn't know that TRUE means NON-ZERO, 01996 * not 1. So we must use 0 & 1 explicitly for fIsSysMenu here 01997 * -- Win95B B#4947 -- 2/13/95 -- jeffbog 01998 */ 01999 hmenuInit = PtoHq(pItem->spSubMenu); 02000 xxxSendMessage(ppopupmenu->spwndNotify, WM_INITMENUPOPUP, 02001 (WPARAM)hmenuInit, MAKELONG(ppopupmenu->posSelectedItem, 02002 (ppopupmenu->fIsSysMenu ? 1: 0))); 02003 ThreadUnlock(&tlpwndT); 02004 fSendUninit = TRUE; 02005 } 02006 02007 02008 /* 02009 * B#1517 02010 * Check if we're still in menu loop 02011 */ 02012 if (!pMenuState->fInsideMenuLoop) { 02013 RIPMSG0(RIP_WARNING, "Menu loop ended unexpectedly by WM_INITMENUPOPUP"); 02014 ret = (PWND)-1; 02015 goto Exit; 02016 } 02017 02018 /* 02019 * The WM_INITMENUPOPUP message may have resulted in a change to the 02020 * menu. Make sure the selection is still valid. 02021 */ 02022 if (ppopupmenu->posSelectedItem >= ppopupmenu->spmenu->cItems) { 02023 /* 02024 * Selection is out of range, so fail. 02025 */ 02026 goto Exit; 02027 } 02028 02029 /* 02030 * Get a pointer to the currently selected item in this menu. 02031 * Bug #17867 - the call can cause this thing to change, so reload it. 02032 */ 02033 pItem = &(ppopupmenu->spmenu->rgItems[ppopupmenu->posSelectedItem]); 02034 02035 if (TestMFS(pItem, MFS_GRAYED) || (pItem->spSubMenu == NULL) || (pItem->spSubMenu->cItems == 0)) { 02036 /* 02037 * The item is disabled, no longer a popup, or empty so don't drop. 02038 */ 02039 /* 02040 * No items in menu. 02041 */ 02042 goto Exit; 02043 } 02044 02045 /* 02046 * Let's make sure that the current thread is in menu mode and 02047 * it uses this pMenuState. Otherwise the window we're about to 02048 * create (or set the thread to) will point to a different pMenuState 02049 */ 02050 UserAssert(ptiCurrent->pMenuState == pMenuState); 02051 02052 if (ppopupmenu->fIsMenuBar && (pdesk->spwndMenu != NULL) && 02053 (!(pdesk->dwDTFlags & DF_MENUINUSE)) && 02054 !TestWF(pdesk->spwndMenu, WFVISIBLE)) { 02055 02056 pdesk->dwDTFlags |= DF_MENUINUSE; 02057 02058 if (HMPheFromObject(pdesk->spwndMenu)->bFlags & HANDLEF_DESTROY) { 02059 PPROCESSINFO ppi = pdesk->rpwinstaParent->pTerm->ptiDesktop->ppi; 02060 PPROCESSINFO ppiSave; 02061 PWND pwndMenu; 02062 DWORD dwDisableHooks; 02063 02064 /* 02065 * the menu window is destroyed -- recreate it 02066 * 02067 * clear the desktopMenu flag so that the popup is 02068 * freed. 02069 */ 02070 UserAssert(ppopupmenu->fDesktopMenu); 02071 02072 ppopupmenu->fDesktopMenu = FALSE; 02073 ppopupmenu->fDelayedFree = FALSE; 02074 02075 Unlock(&pdesk->spwndMenu); 02076 ppiSave = ptiCurrent->ppi; 02077 ptiCurrent->ppi = ppi; 02078 02079 /* 02080 * HACK HACK HACK!!! (adams) In order to create the menu window 02081 * with the correct desktop, we set the desktop of the current thread 02082 * to the new desktop. But in so doing we allow hooks on the current 02083 * thread to also hook this new desktop. This is bad, because we don't 02084 * want the menu window to be hooked while it is created. So we 02085 * temporarily disable hooks of the current thread or desktop, 02086 * and reenable them after switching back to the original desktop. 02087 */ 02088 02089 dwDisableHooks = ptiCurrent->TIF_flags & TIF_DISABLEHOOKS; 02090 ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS; 02091 02092 pwndMenu = xxxCreateWindowEx( 02093 WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 02094 (PLARGE_STRING)MENUCLASS, 02095 NULL, 02096 WS_POPUP | WS_BORDER, 02097 0, 02098 0, 02099 100, 02100 100, 02101 NULL, 02102 NULL, 02103 hModuleWin, 02104 NULL, 02105 WINVER); 02106 02107 UserAssert(ptiCurrent->TIF_flags & TIF_DISABLEHOOKS); 02108 ptiCurrent->TIF_flags = (ptiCurrent->TIF_flags & ~TIF_DISABLEHOOKS) | dwDisableHooks; 02109 02110 Lock(&(pdesk->spwndMenu), pwndMenu); 02111 02112 UserAssert(((PMENUWND)pwndMenu)->ppopupmenu != NULL); 02113 02114 /* 02115 * Set the desktopMenu flag to mark that this is the popup 02116 * allocated for pdesk->spwndMenu 02117 * Unlock spwndPopupMenu to avoid this special case in the common code path. 02118 */ 02119 ((PMENUWND)pwndMenu)->ppopupmenu->fDesktopMenu = TRUE; 02120 Unlock(&((PMENUWND)pwndMenu)->ppopupmenu->spwndPopupMenu); 02121 02122 ptiCurrent->ppi = ppiSave; 02123 02124 HMChangeOwnerThread(pdesk->spwndMenu, pdesk->rpwinstaParent->pTerm->ptiDesktop); 02125 } else { 02126 TL tlpwndDesk; 02127 02128 ThreadLockAlways(pdesk->spwndMenu, &tlpwndT); 02129 ThreadLockAlways(pdesk->pDeskInfo->spwnd, &tlpwndDesk); 02130 xxxSetParent(pdesk->spwndMenu, pdesk->pDeskInfo->spwnd); 02131 ThreadUnlock(&tlpwndDesk); 02132 ThreadUnlock(&tlpwndT); 02133 02134 } 02135 02136 02137 pwndHierarchy = pdesk->spwndMenu; 02138 Lock(&pwndHierarchy->spwndOwner, ppopupmenu->spwndNotify); 02139 pwndHierarchy->head.pti = ptiCurrent; 02140 02141 /* 02142 * Make the topmost state match the menu mode 02143 */ 02144 if ((TestWF(pdesk->spwndMenu, WEFTOPMOST) && pMenuState->fModelessMenu) 02145 || (!TestWF(pdesk->spwndMenu, WEFTOPMOST) && !pMenuState->fModelessMenu)) { 02146 02147 ThreadLock(pdesk->spwndMenu, &tlpwndHierarchy); 02148 xxxSetWindowPos(pdesk->spwndMenu, 02149 (pMenuState->fModelessMenu ? PWND_NOTOPMOST: PWND_TOPMOST), 02150 0,0,0,0, 02151 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING); 02152 ThreadUnlock(&tlpwndHierarchy); 02153 } 02154 02155 ppopupmenuHierarchy = ((PMENUWND)pwndHierarchy)->ppopupmenu; 02156 02157 UserAssert(ppopupmenuHierarchy->fDesktopMenu); 02158 /* 02159 * clear any leftover data from the last time we used it 02160 * Assert that we're not zapping any locks here 02161 */ 02162 UserAssert(ppopupmenuHierarchy->spwndPopupMenu == NULL); 02163 UserAssert(ppopupmenuHierarchy->spwndNextPopup == NULL); 02164 UserAssert(ppopupmenuHierarchy->spwndPrevPopup == NULL); 02165 UserAssert(ppopupmenuHierarchy->spmenu == NULL); 02166 UserAssert(ppopupmenuHierarchy->spmenuAlternate == NULL); 02167 UserAssert(ppopupmenuHierarchy->spwndNotify == NULL); 02168 UserAssert(ppopupmenuHierarchy->spwndActivePopup == NULL); 02169 02170 RtlZeroMemory((PVOID)ppopupmenuHierarchy, sizeof(POPUPMENU)); 02171 ppopupmenuHierarchy->fDesktopMenu = TRUE; 02172 02173 ppopupmenuHierarchy->posSelectedItem = MFMWFP_NOITEM; 02174 Lock(&ppopupmenuHierarchy->spwndPopupMenu, pdesk->spwndMenu); 02175 02176 Lock(&(ppopupmenuHierarchy->spwndNotify), ppopupmenu->spwndNotify); 02177 LockPopupMenu(ppopupmenuHierarchy, &ppopupmenuHierarchy->spmenu, pItem->spSubMenu); 02178 02179 } else { 02180 02181 ThreadLock(ppopupmenu->spwndNotify, &tlpwndT); 02182 02183 pwndHierarchy = xxxCreateWindowEx( 02184 WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 02185 (PLARGE_STRING)MENUCLASS, NULL, 02186 WS_POPUP | WS_BORDER, 0, 0, 100, 100, ppopupmenu->spwndNotify, 02187 NULL, (HANDLE)ppopupmenu->spwndNotify->hModule, 02188 (LPVOID)pItem->spSubMenu, WINVER); 02189 02190 ThreadUnlock(&tlpwndT); 02191 02192 if (!pwndHierarchy) 02193 goto Exit; 02194 02195 /* 02196 * Do this so old apps don't get weird borders on the popups of 02197 * hierarchical items! 02198 */ 02199 ClrWF(pwndHierarchy, WFOLDUI); 02200 02201 ppopupmenuHierarchy = ((PMENUWND)pwndHierarchy)->ppopupmenu; 02202 02203 } 02204 02205 /* 02206 * Mark this as fDelayedFree and link it 02207 */ 02208 ppopupmenuHierarchy->fDelayedFree = TRUE; 02209 ppopupmenuHierarchy->ppmDelayedFree = ppopupmenu->ppopupmenuRoot->ppmDelayedFree; 02210 ppopupmenu->ppopupmenuRoot->ppmDelayedFree = ppopupmenuHierarchy; 02211 02212 #ifdef USE_MIRRORING 02213 if (TestWF(ppopupmenu->spwndPopupMenu, WEFLAYOUTRTL)) { 02214 SetWF(pwndHierarchy, WEFLAYOUTRTL); 02215 } else { 02216 ClrWF(pwndHierarchy, WEFLAYOUTRTL); 02217 } 02218 #endif 02219 02220 02221 Lock(&(ppopupmenuHierarchy->spwndNotify), ppopupmenu->spwndNotify); 02222 #if DBG 02223 /* 02224 * We should associate ppopupmenuHierarchy to the same menu we sent the 02225 * WM_INITMsENUPOPUP message. Otherwise, the WM_UNINITMENUPOPUP 02226 * will go to the wrong window. It would be the app's fault... 02227 */ 02228 if (!ppopupmenu->fNoNotify && (hmenuInit != PtoHq(pItem->spSubMenu))) { 02229 RIPMSG2(RIP_WARNING, "xxxMNOpenHierarchy: bad app changed submenu from %#p to %#p", 02230 hmenuInit, PtoHq(pItem->spSubMenu)); 02231 } 02232 #endif 02233 LockPopupMenu(ppopupmenuHierarchy, &ppopupmenuHierarchy->spmenu, pItem->spSubMenu); 02234 Lock(&(ppopupmenu->spwndNextPopup), pwndHierarchy); 02235 ppopupmenu->posDropped = ppopupmenu->posSelectedItem; 02236 Lock(&(ppopupmenuHierarchy->spwndPrevPopup), ppopupmenu->spwndPopupMenu); 02237 ppopupmenuHierarchy->ppopupmenuRoot = ppopupmenu->ppopupmenuRoot; 02238 ppopupmenuHierarchy->fHasMenuBar = ppopupmenu->fHasMenuBar; 02239 ppopupmenuHierarchy->fIsSysMenu = ppopupmenu->fIsSysMenu; 02240 ppopupmenuHierarchy->fNoNotify = ppopupmenu->fNoNotify; 02241 ppopupmenuHierarchy->fSendUninit = TRUE; 02242 ppopupmenuHierarchy->fRtoL = ppopupmenu->fRtoL; 02243 02244 /* 02245 * The menu window has been created and intialized so if 02246 * something fails, the WM_UNINITMENUPOPUP message will 02247 * be sent from xxxMNDestroyHandler 02248 */ 02249 fSendUninit = FALSE; 02250 02251 /* 02252 * Set/clear the underline flag 02253 */ 02254 if (pMenuState->fUnderline) { 02255 SetMF(ppopupmenuHierarchy->spmenu, MFUNDERLINE); 02256 } else { 02257 ClearMF(ppopupmenuHierarchy->spmenu, MFUNDERLINE); 02258 } 02259 02260 ppopupmenuHierarchy->fAboutToHide = FALSE; 02261 02262 /* 02263 * Find the size of the menu window and actually size it (wParam = 1) 02264 */ 02265 ThreadLock(pwndHierarchy, &tlpwndHierarchy); 02266 sizeHierarchy = (LONG)xxxSendMessage(pwndHierarchy, MN_SIZEWINDOW, MNSW_SIZE, 0); 02267 02268 if (!sizeHierarchy) { 02269 /* 02270 * No size for this menu so zero it and blow off. 02271 */ 02272 UserAssert(ppopupmenuHierarchy->fDelayedFree); 02273 if (ppopupmenuHierarchy->fDesktopMenu) { 02274 xxxMNDestroyHandler(ppopupmenuHierarchy); 02275 xxxCleanupDesktopMenu(pwndHierarchy, pdesk); 02276 } 02277 02278 if (ThreadUnlock(&tlpwndHierarchy)) { 02279 if (!ppopupmenuHierarchy->fDesktopMenu) { 02280 xxxDestroyWindow(pwndHierarchy); 02281 } 02282 } 02283 02284 Unlock(&ppopupmenu->spwndNextPopup); 02285 goto Exit; 02286 } 02287 02288 cxPopup = LOWORD(sizeHierarchy) + 2*SYSMET(CXFIXEDFRAME); 02289 cyPopup = HIWORD(sizeHierarchy) + 2*SYSMET(CYFIXEDFRAME); 02290 02291 ppopupmenu->fHierarchyDropped = TRUE; 02292 02293 /* 02294 * Find out the x,y position to drop the hierarchy and the animation 02295 * direction 02296 */ 02297 ppopupmenuHierarchy->iDropDir = xxxMNPositionHierarchy( 02298 ppopupmenu, pItem, cxPopup, cyPopup, &xLeft, &yTop, &pMonitor); 02299 02300 if (ppopupmenu->fIsMenuBar && _GetAsyncKeyState(VK_LBUTTON) & 0x8000) { 02301 /* 02302 * If the menu had to be pinned to the bottom of the screen and 02303 * the mouse button is down, make sure the mouse isn't over the 02304 * menu rect. 02305 */ 02306 RECT rc; 02307 RECT rcParent; 02308 int xrightdrop; 02309 int xleftdrop; 02310 02311 /* 02312 * Get rect of hierarchical 02313 */ 02314 CopyOffsetRect( 02315 &rc, 02316 &pwndHierarchy->rcWindow, 02317 xLeft - pwndHierarchy->rcWindow.left, 02318 yTop - pwndHierarchy->rcWindow.top); 02319 02320 /* 02321 * Get the rect of the menu bar popup item 02322 */ 02323 rcParent.left = pItem->xItem + ppopupmenu->spwndPopupMenu->rcWindow.left; 02324 rcParent.top = pItem->yItem + ppopupmenu->spwndPopupMenu->rcWindow.top; 02325 rcParent.right = rcParent.left + pItem->cxItem; 02326 rcParent.bottom = rcParent.top + pItem->cyItem; 02327 02328 if (IntersectRect(&rc, &rc, &rcParent)) { 02329 02330 /* 02331 * Oh, oh... The cursor will sit right on top of a menu item. 02332 * If the user up clicks, a menu will be accidently selected. 02333 * 02334 * Calc x position of hierarchical if we dropped it to the 02335 * right/left of the menu bar item. 02336 */ 02337 xrightdrop = ppopupmenu->spwndPopupMenu->rcWindow.left + 02338 pItem->xItem + pItem->cxItem + cxPopup; 02339 02340 if (xrightdrop > pMonitor->rcMonitor.right) { 02341 xrightdrop = 0; 02342 } 02343 02344 xleftdrop = ppopupmenu->spwndPopupMenu->rcWindow.left + 02345 pItem->xItem - cxPopup; 02346 02347 if (xleftdrop < pMonitor->rcMonitor.left) { 02348 xleftdrop = 0; 02349 } 02350 02351 if (((SYSMET(MENUDROPALIGNMENT) || TestMFT(pItem, MFT_RIGHTORDER)) 02352 && xleftdrop) || !xrightdrop) { 02353 xLeft = ppopupmenu->spwndPopupMenu->rcWindow.left + 02354 pItem->xItem - cxPopup; 02355 ppopupmenuHierarchy->iDropDir = PAS_LEFT; 02356 } else if (xrightdrop) { 02357 xLeft = ppopupmenu->spwndPopupMenu->rcWindow.left + 02358 pItem->xItem + pItem->cxItem; 02359 ppopupmenuHierarchy->iDropDir = PAS_RIGHT; 02360 } 02361 } 02362 } 02363 02364 /* 02365 * Take care of fDropNextPopup (menu bar) or fDroppedLeft (popups) 02366 * Set animation flag 02367 */ 02368 if (ppopupmenu->fIsMenuBar) { 02369 /* 02370 * Only the first popup being dropped off the menu bar 02371 * is animated. 02372 */ 02373 if (!ppopupmenu->fDropNextPopup) { 02374 ppopupmenuHierarchy->iDropDir |= PAS_OUT; 02375 } 02376 02377 /* 02378 * Propagate right-to-left direction. 02379 */ 02380 if (ppopupmenu->fDroppedLeft || (ppopupmenuHierarchy->iDropDir == PAS_LEFT)) { 02381 ppopupmenuHierarchy->fDroppedLeft = TRUE; 02382 } 02383 /* 02384 * Once a popup is dropped from the menu bar, moving to the next 02385 * item on the menu bar should drop the popup. 02386 */ 02387 ppopupmenu->fDropNextPopup = TRUE; 02388 } else { 02389 /* 02390 * Submenus always animate. 02391 */ 02392 ppopupmenuHierarchy->iDropDir |= PAS_OUT; 02393 02394 /* 02395 * Is this popup a lefty? 02396 */ 02397 if (ppopupmenuHierarchy->iDropDir == PAS_LEFT) { 02398 ppopupmenuHierarchy->fDroppedLeft = TRUE; 02399 } 02400 } 02401 02402 /* 02403 * The previous active dude must be visible 02404 */ 02405 UserAssert((ppopupmenu->ppopupmenuRoot->spwndActivePopup == NULL) 02406 || TestWF(ppopupmenu->ppopupmenuRoot->spwndActivePopup, WFVISIBLE)); 02407 02408 /* 02409 * This is the new active popup 02410 */ 02411 Lock(&(ppopupmenu->ppopupmenuRoot->spwndActivePopup), pwndHierarchy); 02412 02413 /* 02414 * Paint the owner window before the popup menu comes up so that 02415 * the proper bits are saved. 02416 */ 02417 if (ppopupmenuHierarchy->spwndNotify != NULL) { 02418 ThreadLockAlways(ppopupmenuHierarchy->spwndNotify, &tlpwndT); 02419 xxxUpdateWindow(ppopupmenuHierarchy->spwndNotify); 02420 ThreadUnlock(&tlpwndT); 02421 } 02422 02423 /* 02424 * If this is a drag and drop menu, then we need to register the window 02425 * as a drop target. 02426 */ 02427 if (pMenuState->fDragAndDrop) { 02428 if (!NT_SUCCESS(xxxClientRegisterDragDrop(HW(pwndHierarchy)))) { 02429 RIPMSG1(RIP_ERROR, "xxxMNOpenHierarchy: xxxClientRegisterDragDrop failed:%#p", pwndHierarchy); 02430 } 02431 } 02432 02433 /* 02434 * Show the window. Modeless menus are not topmost and get activated. 02435 * Modal menus are topmost but don't get activated. 02436 */ 02437 PlayEventSound(USER_SOUND_MENUPOPUP); 02438 02439 xxxSetWindowPos(pwndHierarchy, 02440 (pMenuState->fModelessMenu ? PWND_TOP : PWND_TOPMOST), 02441 xLeft, yTop, 0, 0, 02442 SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOOWNERZORDER 02443 | (pMenuState->fModelessMenu ? 0 : SWP_NOACTIVATE)); 02444 02445 if (FWINABLE()) { 02446 xxxWindowEvent(EVENT_SYSTEM_MENUPOPUPSTART, pwndHierarchy, OBJID_CLIENT, INDEXID_CONTAINER, 0); 02447 } 02448 02449 /* 02450 * Select the first item IFF we're in keyboard mode. This fixes a 02451 * surprising number of compatibility problems with keyboard macros, 02452 * scripts, etc. 02453 */ 02454 if (pMenuState->mnFocus == KEYBDHOLD) { 02455 xxxSendMessage(pwndHierarchy, MN_SELECTITEM, 0, 0L); 02456 } 02457 02458 /* 02459 * This is needed so that popup menus are properly drawn on sys 02460 * modal dialog boxes. 02461 */ 02462 xxxUpdateWindow(pwndHierarchy); 02463 02464 ret = pwndHierarchy; 02465 ThreadUnlock(&tlpwndHierarchy); 02466 02467 Exit: 02468 /* 02469 * send matching WM_UNINITMENUPOPUP if needed (i.e, something 02470 * failed). 02471 */ 02472 if (fSendUninit 02473 && (ppopupmenu->spwndNotify != NULL)) { 02474 02475 ThreadLockAlways(ppopupmenu->spwndNotify, &tlpwndT); 02476 xxxSendMessage(ppopupmenu->spwndNotify, WM_UNINITMENUPOPUP, 02477 (WPARAM)hmenuInit, 02478 MAKELONG(0, (ppopupmenu->fIsSysMenu ? MF_SYSMENU : 0))); 02479 ThreadUnlock(&tlpwndT); 02480 } 02481 02482 return ret; 02483 }

VOID xxxMNRecomputeBarIfNeeded PWND  pwndNotify,
PMENU  pMenu
 

Definition at line 758 of file mncomput.c.

References CheckLock, tagMENU::cxMenu, tagMENU::cyMenu, FALSE, GetCaptionHeight(), GetWindowBorders(), MFISPOPUP, MFSYSMENU, tagWND::rcWindow, tagMENU::spwndNotify, SYSMET, TestMF, TRUE, and xxxMenuBarCompute().

Referenced by xxxGetMenuItemRect(), xxxHiliteMenuItem(), xxxHotTrackMenu(), xxxMenuItemFromPoint(), and xxxMNStartMenu().

00761 { 00762 int cxFrame; 00763 int cyFrame; 00764 00765 UserAssert(!TestMF(pMenu, MFISPOPUP)); 00766 00767 CheckLock(pwndNotify); 00768 CheckLock(pMenu); 00769 00770 if (!TestMF(pMenu, MFSYSMENU) 00771 && ((pMenu->spwndNotify != pwndNotify) || !pMenu->cxMenu || !pMenu->cyMenu)) { 00772 int cBorders; 00773 00774 cBorders = GetWindowBorders(pwndNotify->style, pwndNotify->ExStyle, TRUE, FALSE); 00775 cxFrame = cBorders * SYSMET(CXBORDER); 00776 cyFrame = cBorders * SYSMET(CYBORDER); 00777 00778 cyFrame += GetCaptionHeight(pwndNotify); 00779 00780 // The width passed in this call was larger by cxFrame; 00781 // Fix for Bug #11466 - Fixed by SANKAR - 01/06/92 -- 00782 xxxMenuBarCompute(pMenu, pwndNotify, cyFrame, cxFrame, 00783 (pwndNotify->rcWindow.right - pwndNotify->rcWindow.left) - cxFrame * 2); 00784 } 00785 }

void xxxMNReleaseCapture void   ) 
 

Definition at line 181 of file ntuser/kernel/menu.c.

References FALSE, tagMENUSTATE::fSetCapture, NULL, tagTHREADINFO::pMenuState, PtiCurrent, QF_CAPTURELOCKED, and xxxReleaseCapture().

Referenced by xxxEndMenu(), xxxMNCancel(), xxxMNLoop(), xxxMNStartMenu(), and xxxTrackPopupMenuEx().

00182 { 00183 PTHREADINFO ptiCurrent = PtiCurrent(); 00184 00185 /* 00186 * Bail if we didn't set capture 00187 */ 00188 if ((ptiCurrent->pMenuState == NULL) || 00189 (! ptiCurrent->pMenuState->fSetCapture)) { 00190 return; 00191 } 00192 ptiCurrent->pMenuState->fSetCapture = FALSE; 00193 00194 /* 00195 * Unlock capture and release it. 00196 */ 00197 PtiCurrent()->pq->QF_flags &= ~QF_CAPTURELOCKED; 00198 xxxReleaseCapture(); 00199 }

PITEM xxxMNSelectItem PPOPUPMENU  ppopupMenu,
PMENUSTATE  pMenuState,
UINT  itemPos
 

Definition at line 2818 of file ntuser/kernel/menu.c.

References _KillTimer(), tagMENU::cItems, tagMENUSTATE::fAboutToAutoDismiss, tagPOPUPMENU::fAboutToHide, FALSE, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fHideTimer, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagMENUSTATE::fMouseOffMenu, tagPOPUPMENU::fShowTimer, FWINABLE, IDSYS_MNHIDE, IDSYS_MNSHOW, L, Lock, MFMWFP_NOITEM, MNAnimate(), MNIsItemSelected(), MNIsScrollArrowSelected(), MNSetTimerToCloseHierarchy(), NULL, tagPOPUPMENU::posDropped, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, tagMENU::rgItems, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndActivePopup, tagPOPUPMENU::spwndNextPopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, tagPOPUPMENU::spwndPrevPopup, ThreadLock, ThreadUnlock, TRUE, xxxMNCloseHierarchy(), xxxMNDoScroll(), xxxMNInvertItem(), xxxSendMenuSelect(), xxxSendMessage(), and xxxWindowEvent().

Referenced by xxxMenuWindowProc(), xxxMNButtonDown(), xxxMNCancel(), xxxMNChar(), xxxMNKeyDown(), xxxMNKeyFilter(), xxxMNMouseMove(), and xxxMNSwitchToAlternateMenu().

02822 { 02823 PITEM pItem = NULL; 02824 TL tlpwndNotify; 02825 TL tlpwndPopup; 02826 TL tlpmenu; 02827 PWND pwndNotify; 02828 PMENU pmenu; 02829 02830 if (ppopupmenu->posSelectedItem == itemPos) { 02831 02832 /* 02833 * If this item is already selectected, just return its flags. 02834 */ 02835 if ((itemPos != MFMWFP_NOITEM) && (itemPos < ppopupmenu->spmenu->cItems)) { 02836 return &(ppopupmenu->spmenu->rgItems[itemPos]); 02837 } 02838 return NULL; 02839 } 02840 02841 /* 02842 * Terminate any animation 02843 */ 02844 MNAnimate(pMenuState, FALSE); 02845 02846 if (ppopupmenu->fShowTimer) { 02847 _KillTimer(ppopupmenu->spwndPopupMenu, IDSYS_MNSHOW); 02848 ppopupmenu->fShowTimer = FALSE; 02849 } 02850 02851 ThreadLock(pmenu = ppopupmenu->spmenu, &tlpmenu); 02852 ThreadLock(pwndNotify = ppopupmenu->spwndNotify, &tlpwndNotify); 02853 02854 if (ppopupmenu->fAboutToHide) 02855 { 02856 PPOPUPMENU ppopupPrev = ((PMENUWND)(ppopupmenu->spwndPrevPopup))->ppopupmenu; 02857 02858 _KillTimer(ppopupPrev->spwndPopupMenu, IDSYS_MNHIDE); 02859 ppopupPrev->fHideTimer = FALSE; 02860 if (ppopupPrev->fShowTimer) 02861 { 02862 _KillTimer(ppopupPrev->spwndPopupMenu, IDSYS_MNSHOW); 02863 ppopupPrev->fShowTimer = FALSE; 02864 } 02865 02866 if (ppopupPrev->posSelectedItem != ppopupPrev->posDropped) 02867 { 02868 TL tlpmenuPopupMenuPrev; 02869 ThreadLock(ppopupPrev->spmenu, &tlpmenuPopupMenuPrev); 02870 if (ppopupPrev->posSelectedItem != MFMWFP_NOITEM) { 02871 xxxMNInvertItem(ppopupPrev, ppopupPrev->spmenu, 02872 ppopupPrev->posSelectedItem, ppopupPrev->spwndNotify, FALSE); 02873 } 02874 02875 ppopupPrev->posSelectedItem = ppopupPrev->posDropped; 02876 02877 xxxMNInvertItem(ppopupPrev, ppopupPrev->spmenu, 02878 ppopupPrev->posDropped, ppopupPrev->spwndNotify, TRUE); 02879 ThreadUnlock(&tlpmenuPopupMenuPrev); 02880 } 02881 02882 ppopupmenu->fAboutToHide = FALSE; 02883 Lock(&ppopupmenu->ppopupmenuRoot->spwndActivePopup, ppopupmenu->spwndPopupMenu); 02884 } 02885 02886 if (MNIsItemSelected(ppopupmenu)) { 02887 /* 02888 * Something else is selected so we need to unselect it. 02889 */ 02890 if (ppopupmenu->spwndNextPopup) { 02891 if (ppopupmenu->fIsMenuBar) { 02892 xxxMNCloseHierarchy(ppopupmenu, pMenuState); 02893 } else { 02894 MNSetTimerToCloseHierarchy(ppopupmenu); 02895 } 02896 } 02897 02898 goto DeselectItem; 02899 } else if (MNIsScrollArrowSelected(ppopupmenu)) { 02900 _KillTimer(ppopupmenu->spwndPopupMenu, ppopupmenu->posSelectedItem); 02901 DeselectItem: 02902 02903 xxxMNInvertItem(ppopupmenu, pmenu, 02904 ppopupmenu->posSelectedItem, pwndNotify, FALSE); 02905 } 02906 02907 ppopupmenu->posSelectedItem = itemPos; 02908 02909 if (itemPos != MFMWFP_NOITEM) { 02910 /* 02911 * If an item is selected, no autodismiss plus this means 02912 * that the mouse is on the menu 02913 */ 02914 pMenuState->fAboutToAutoDismiss = 02915 pMenuState->fMouseOffMenu = FALSE; 02916 02917 if (pMenuState->fButtonDown) { 02918 xxxMNDoScroll(ppopupmenu, itemPos, TRUE); 02919 } 02920 02921 pItem = xxxMNInvertItem(ppopupmenu, pmenu, 02922 itemPos, pwndNotify, TRUE); 02923 ThreadUnlock(&tlpwndNotify); 02924 ThreadUnlock(&tlpmenu); 02925 return pItem; 02926 02927 } else if (FWINABLE()) { 02928 /* 02929 * Notify that nothing is now focused in this menu. 02930 */ 02931 xxxWindowEvent(EVENT_OBJECT_FOCUS, ppopupmenu->spwndPopupMenu, 02932 ((ppopupmenu->spwndNotify != ppopupmenu->spwndPopupMenu) ? OBJID_CLIENT : 02933 (ppopupmenu->fIsSysMenu ? OBJID_SYSMENU : OBJID_MENU)), 0, 0); 02934 } 02935 02936 ThreadUnlock(&tlpwndNotify); 02937 ThreadUnlock(&tlpmenu); 02938 02939 if (ppopupmenu->spwndPrevPopup != NULL) { 02940 PPOPUPMENU pp; 02941 02942 /* 02943 * Get the popupMenu data for the previous menu 02944 * Use the root popupMenu if the previous menu is the menu bar 02945 */ 02946 if (ppopupmenu->fHasMenuBar && (ppopupmenu->spwndPrevPopup == 02947 ppopupmenu->spwndNotify)) { 02948 pp = ppopupmenu->ppopupmenuRoot; 02949 } else { 02950 #ifdef HAVE_MN_GETPPOPUPMENU 02951 TL tlpwndPrevPopup; 02952 ThreadLock(ppopupmenu->spwndPrevPopup, &tlpwndPrevPopup); 02953 pp = (PPOPUPMENU)xxxSendMessage(ppopupmenu->spwndPrevPopup, 02954 MN_GETPPOPUPMENU, 0, 0L); 02955 ThreadUnlock(&tlpwndPrevPopup); 02956 #else 02957 pp = ((PMENUWND)ppopupmenu->spwndPrevPopup)->ppopupmenu; 02958 #endif 02959 } 02960 02961 /* 02962 * Generate a WM_MENUSELECT for the previous menu to re-establish 02963 * it's current item as the SELECTED item 02964 */ 02965 ThreadLock(pp->spwndNotify, &tlpwndNotify); 02966 ThreadLock(pp->spwndPopupMenu, &tlpwndPopup); 02967 xxxSendMenuSelect(pp->spwndNotify, pp->spwndPopupMenu, pp->spmenu, pp->posSelectedItem); 02968 ThreadUnlock(&tlpwndPopup); 02969 ThreadUnlock(&tlpwndNotify); 02970 } 02971 02972 return NULL; 02973 }

void xxxMNSetCapture PPOPUPMENU  ppopup  ) 
 

Definition at line 152 of file ntuser/kernel/menu.c.

References tagMENUSTATE::fSetCapture, gpqForeground, tagTHREADINFO::pMenuState, tagTHREADINFO::pq, PtiCurrent, QF_CAPTURELOCKED, tagQ::QF_flags, SCREEN_CAPTURE, tagQ::spwndCapture, tagPOPUPMENU::spwndNotify, TRUE, and xxxCapture().

Referenced by xxxMenuWindowProc(), xxxMNEndMenuState(), xxxMNKeyDown(), and xxxMNStartMenu().

00153 { 00154 PTHREADINFO ptiCurrent = PtiCurrent(); 00155 00156 /* 00157 * Set the capture and lock it so no one will be able to steal it 00158 * from us. 00159 */ 00160 xxxCapture(ptiCurrent, ppopup->spwndNotify, SCREEN_CAPTURE); 00161 UserAssert (ptiCurrent->pq->spwndCapture == ppopup->spwndNotify); 00162 ptiCurrent->pq->QF_flags |= QF_CAPTURELOCKED; 00163 ptiCurrent->pMenuState->fSetCapture = TRUE; 00164 #if DBG 00165 /* 00166 * Unless we're in the foreground, this menu mode won't go away 00167 * when the user clicks outside the menu. This is because only 00168 * the foreground queue capture sees clicks outside its windows. 00169 */ 00170 if (ptiCurrent->pq != gpqForeground) { 00171 RIPMSG0(RIP_WARNING, "xxxMNSetCapture: Menu mode is not in foreground queue"); 00172 } 00173 #endif 00174 }

void xxxMNSetGapState ULONG_PTR  uHitArea,
UINT  uIndex,
UINT  uFlags,
BOOL  fSet
 

Definition at line 63 of file menudd.c.

References ClearMFS, tagITEM::cxItem, tagITEM::cyItem, IsMFMWFPWindow(), MNGetpItem(), MNGetToppItem(), NULL, SetMFS, tagPOPUPMENU::spmenu, SYSMET, ThreadLockAlways, ThreadUnlock, TRUE, tagITEM::xItem, xxxInvalidateRect(), and tagITEM::yItem.

Referenced by xxxInsertMenuItem(), xxxMNDragLeave(), and xxxMNUpdateDraggingInfo().

00064 { 00065 int yTop; 00066 PITEM pItem, pItemGap; 00067 PPOPUPMENU ppopup; 00068 RECT rc; 00069 TL tlHitArea; 00070 00071 /* 00072 * Bail if there is nothing to do. 00073 */ 00074 if (!(uFlags & MNGOF_GAP) || !IsMFMWFPWindow(uHitArea)) { 00075 return; 00076 } 00077 00078 ppopup = ((PMENUWND)uHitArea)->ppopupmenu; 00079 pItem = MNGetpItem(ppopup, uIndex); 00080 00081 /* 00082 * The menu window might be destroyed by now so pItem could be NULL. 00083 */ 00084 if (pItem == NULL) { 00085 return; 00086 } 00087 00088 /* 00089 * Mark the item and set the rectangle we need to redraw. 00090 * Drawing/erasing the insertion bar unhilites/hiltes the 00091 * item, so pItem needs to be redrawn completely. In additon, 00092 * we need to draw the insertion bar in the next/previous item. 00093 */ 00094 rc.left = pItem->xItem; 00095 rc.right = pItem->xItem + pItem->cxItem; 00096 rc.top = pItem->yItem; 00097 rc.bottom = pItem->yItem + pItem->cyItem; 00098 00099 if (uFlags & MNGOF_TOPGAP) { 00100 pItemGap = MNGetpItem(ppopup, uIndex - 1); 00101 if (fSet) { 00102 SetMFS(pItem, MFS_TOPGAPDROP); 00103 if (pItemGap != NULL) { 00104 SetMFS(pItemGap, MFS_BOTTOMGAPDROP); 00105 } 00106 } else { 00107 ClearMFS(pItem, MFS_TOPGAPDROP); 00108 if (pItemGap != NULL) { 00109 ClearMFS(pItemGap, MFS_BOTTOMGAPDROP); 00110 } 00111 } 00112 if (pItemGap != NULL) { 00113 rc.top -= SYSMET(CYDRAG); 00114 } 00115 } else { 00116 pItemGap = MNGetpItem(ppopup, uIndex + 1); 00117 if (fSet) { 00118 SetMFS(pItem, MFS_BOTTOMGAPDROP); 00119 if (pItemGap != NULL) { 00120 SetMFS(pItemGap, MFS_TOPGAPDROP); 00121 } 00122 } else { 00123 ClearMFS(pItem, MFS_BOTTOMGAPDROP); 00124 if (pItemGap != NULL) { 00125 ClearMFS(pItemGap, MFS_TOPGAPDROP); 00126 } 00127 } 00128 if (pItemGap != NULL) { 00129 rc.bottom += SYSMET(CYDRAG); 00130 } 00131 } 00132 00133 /* 00134 * Adjust to "menu" coordinates (for scrollable menus) 00135 */ 00136 yTop = MNGetToppItem(ppopup->spmenu)->yItem; 00137 rc.top -= yTop; 00138 rc.bottom -= yTop; 00139 00140 /* 00141 * Invalidate this rect to repaint it later 00142 */ 00143 ThreadLockAlways((PWND)uHitArea, &tlHitArea); 00144 xxxInvalidateRect((PWND)uHitArea, &rc, TRUE); 00145 ThreadUnlock(&tlHitArea); 00146 }

BOOL xxxMNSetTop PPOPUPMENU  ppopup,
int  iNewTop
 

Definition at line 495 of file ntuser/kernel/menu.c.

References BOOL, tagMENU::cItems, tagITEM::cyItem, tagMENU::cyMax, tagMENU::cyMenu, tagMENU::dwArrowsOn, FALSE, tagMENU::hbrBack, tagMENU::iMaxTop, tagMENU::iTop, MFMWFP_DOWNARROW, MFMWFP_UPARROW, MNDrawArrow(), MNDrawFullNC(), MNGetToppItem(), MSA_ATBOTTOM, MSA_ATTOP, MSA_ON, NULL, tagMENU::rgItems, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndPopupMenu, TRUE, UINT, xxxInvalidateRect(), xxxScrollWindowEx(), and tagITEM::yItem.

Referenced by xxxMNDoScroll(), and xxxMNInvertItem().

00496 { 00497 PMENU pMenu = ppopup->spmenu; 00498 int dy; 00499 00500 if (iNewTop < 0) { 00501 iNewTop = 0; 00502 } else if (iNewTop > pMenu->iMaxTop) { 00503 iNewTop = pMenu->iMaxTop; 00504 } 00505 00506 /* 00507 * If no change, done 00508 */ 00509 if (iNewTop == pMenu->iTop) { 00510 return FALSE; 00511 } 00512 00513 #if DBG 00514 /* 00515 * We're going to scroll, so validate iMaxTop, cyMax and cyMenu 00516 */ 00517 UserAssert((pMenu->cyMax == 0) || (pMenu->cyMax >= pMenu->cyMenu)); 00518 if ((UINT)pMenu->iMaxTop < pMenu->cItems) { 00519 PITEM pitemLast = pMenu->rgItems + pMenu->cItems - 1; 00520 PITEM pitemMaxTop = pMenu->rgItems + pMenu->iMaxTop; 00521 UINT uHeight = pitemLast->yItem + pitemLast->cyItem - pitemMaxTop->yItem; 00522 UserAssert(uHeight <= pMenu->cyMenu); 00523 /* 00524 * Let's guess a max item height 00525 */ 00526 UserAssert(pMenu->cyMenu - uHeight <= 2 * pitemLast->cyItem); 00527 } else { 00528 UserAssert((UINT)pMenu->iMaxTop < pMenu->cItems); 00529 } 00530 #endif 00531 00532 00533 /* 00534 * if we've made it this far, the new iTop WILL change -- thus if the 00535 * current iTop is at the top it won't be after this change -- same goes 00536 * for iTop at the bottom 00537 */ 00538 if (pMenu->dwArrowsOn == MSA_ATTOP) { 00539 pMenu->dwArrowsOn = MSA_ON; 00540 if (pMenu->hbrBack == NULL) { 00541 MNDrawArrow(NULL, ppopup, MFMWFP_UPARROW); 00542 } 00543 } else if (pMenu->dwArrowsOn == MSA_ATBOTTOM) { 00544 pMenu->dwArrowsOn = MSA_ON; 00545 if (pMenu->hbrBack == NULL) { 00546 MNDrawArrow(NULL, ppopup, MFMWFP_DOWNARROW); 00547 } 00548 } 00549 00550 UserAssert((UINT)iNewTop < pMenu->cItems); 00551 dy = MNGetToppItem(pMenu)->yItem - (pMenu->rgItems + iNewTop)->yItem; 00552 00553 if ((dy > 0 ? dy : -dy) > (int)pMenu->cyMenu) { 00554 xxxInvalidateRect(ppopup->spwndPopupMenu, NULL, TRUE); 00555 } else { 00556 xxxScrollWindowEx(ppopup->spwndPopupMenu, 0, dy, NULL, NULL, NULL, NULL, SW_INVALIDATE | SW_ERASE); 00557 } 00558 00559 pMenu->iTop = iNewTop; 00560 00561 if (iNewTop == 0) { 00562 pMenu->dwArrowsOn = MSA_ATTOP; 00563 if (pMenu->hbrBack == NULL) { 00564 MNDrawArrow(NULL, ppopup, MFMWFP_UPARROW); 00565 } 00566 } else if (iNewTop == pMenu->iMaxTop) { 00567 pMenu->dwArrowsOn = MSA_ATBOTTOM; 00568 if (pMenu->hbrBack == NULL) { 00569 MNDrawArrow(NULL, ppopup, MFMWFP_DOWNARROW); 00570 } 00571 } 00572 00573 if (pMenu->hbrBack != NULL) { 00574 MNDrawFullNC(ppopup->spwndPopupMenu, NULL, ppopup); 00575 } 00576 00577 return TRUE; 00578 00579 }

BOOL xxxMNStartMenu PPOPUPMENU  ppopupMenu,
int  mn
 

Definition at line 677 of file mnstate.c.

References _GetKeyState(), BOOL, FALSE, tagMENUSTATE::fAutoDismiss, tagMENUSTATE::fButtonAlwaysDown, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fDestroyed, tagMENUSTATE::fDragAndDrop, tagPOPUPMENU::fIsMenuBar, tagMENUSTATE::fIsSysMenu, tagPOPUPMENU::fIsSysMenu, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fMenuStarted, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fNoNotify, tagMENUSTATE::fNotifyByPos, FWINABLE, GetpMenuState(), HWq, IsRootPopupMenu(), L, LockPopupMenu(), tagMENUSTATE::mnFocus, MNPositionSysMenu(), NT_SUCCESS, NULL, PtoH, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagPOPUPMENU::spwndNotify, TestMF, ThreadLock, ThreadUnlock, TRUE, xxxClientLoadOLE(), xxxGetInitMenuParam(), xxxGetSysMenu(), xxxMNRecomputeBarIfNeeded(), xxxMNReleaseCapture(), xxxMNSetCapture(), xxxSendMessage(), and xxxWindowEvent().

Referenced by xxxMNKeyFilter(), xxxMNLoop(), and xxxTrackPopupMenuEx().

00680 { 00681 PWND pwndMenu; 00682 PMENU pMenu; 00683 PMENUSTATE pMenuState; 00684 TL tlpwndMenu; 00685 TL tlpmenu; 00686 00687 UserAssert(IsRootPopupMenu(ppopupmenu)); 00688 00689 if (ppopupmenu->fDestroyed) { 00690 return FALSE; 00691 } 00692 00693 pwndMenu = ppopupmenu->spwndNotify; 00694 ThreadLock(pwndMenu, &tlpwndMenu); 00695 00696 pMenuState = GetpMenuState(pwndMenu); 00697 if (pMenuState == NULL) { 00698 RIPMSG0(RIP_ERROR, "xxxMNStartMenu: pMenuState == NULL"); 00699 ThreadUnlock(&tlpwndMenu); 00700 return FALSE; 00701 } 00702 pMenuState->mnFocus = mn; 00703 pMenuState->fMenuStarted = TRUE; 00704 pMenuState->fButtonDown = 00705 pMenuState->fButtonAlwaysDown = ((_GetKeyState(VK_LBUTTON) & 0x8000) != 0); 00706 00707 xxxMNSetCapture(ppopupmenu); 00708 00709 xxxSendMessage(pwndMenu, WM_SETCURSOR, (WPARAM)HWq(pwndMenu), 00710 MAKELONG(MSGF_MENU, 0)); 00711 00712 if (ppopupmenu->fIsMenuBar) { 00713 BOOL fSystemMenu; 00714 00715 00716 pMenu = xxxGetInitMenuParam(pwndMenu, &fSystemMenu); 00717 00718 if (pMenu == NULL) { 00719 pMenuState->fMenuStarted = FALSE; 00720 xxxMNReleaseCapture(); 00721 ThreadUnlock(&tlpwndMenu); 00722 return(FALSE); 00723 } 00724 00725 LockPopupMenu(ppopupmenu, &ppopupmenu->spmenu, pMenu); 00726 00727 ppopupmenu->fIsSysMenu = (fSystemMenu != 0); 00728 if (!fSystemMenu) { 00729 pMenu = xxxGetSysMenu(pwndMenu, FALSE); 00730 LockPopupMenu(ppopupmenu, &ppopupmenu->spmenuAlternate, pMenu); 00731 } 00732 } 00733 00734 pMenuState->fIsSysMenu = (ppopupmenu->fIsSysMenu != 0); 00735 00736 if (!ppopupmenu->fNoNotify) { 00737 00738 if (ppopupmenu->fIsTrackPopup && ppopupmenu->fIsSysMenu) { 00739 pMenu = xxxGetInitMenuParam(pwndMenu, NULL); 00740 } else { 00741 pMenu = ppopupmenu->spmenu; 00742 } 00743 00744 xxxSendMessage(pwndMenu, WM_INITMENU, (WPARAM)PtoH(pMenu), 0L); 00745 } 00746 00747 if (!ppopupmenu->fIsTrackPopup) { 00748 if (ppopupmenu->fIsSysMenu) { 00749 MNPositionSysMenu(pwndMenu, ppopupmenu->spmenu); 00750 } else if (ppopupmenu->fIsMenuBar) { 00751 ThreadLock(ppopupmenu->spmenu, &tlpmenu); 00752 xxxMNRecomputeBarIfNeeded(pwndMenu, ppopupmenu->spmenu); 00753 ThreadUnlock(&tlpmenu); 00754 MNPositionSysMenu(pwndMenu, ppopupmenu->spmenuAlternate); 00755 } 00756 } 00757 00758 /* 00759 * If returning TRUE, set menu style in pMenuState 00760 */ 00761 if (!ppopupmenu->fDestroyed) { 00762 if (TestMF(ppopupmenu->spmenu, MNS_MODELESS)) { 00763 pMenuState->fModelessMenu = TRUE; 00764 } 00765 00766 if (TestMF(ppopupmenu->spmenu, MNS_DRAGDROP)) { 00767 if (NT_SUCCESS(xxxClientLoadOLE())) { 00768 pMenuState->fDragAndDrop = TRUE; 00769 } 00770 } 00771 00772 if (TestMF(ppopupmenu->spmenu, MNS_AUTODISMISS)) { 00773 pMenuState->fAutoDismiss = TRUE; 00774 } 00775 00776 if (TestMF(ppopupmenu->spmenu, MNS_NOTIFYBYPOS)) { 00777 pMenuState->fNotifyByPos = TRUE; 00778 } 00779 00780 } 00781 00782 /* 00783 * Bogus! We don't always know that this is the system menu. We 00784 * will frequently pass on an OBJID_MENU even when you hit Alt+Space. 00785 * 00786 * Hence, MNSwitchToAlternate will send a EVENT_SYSTEM_MENUEND for the 00787 * menu bar and an EVENT_SYSTEM_MENUSTART for the sysmenu when we "switch". 00788 */ 00789 if (FWINABLE()) { 00790 xxxWindowEvent(EVENT_SYSTEM_MENUSTART, pwndMenu, 00791 (ppopupmenu->fIsSysMenu ? OBJID_SYSMENU : (ppopupmenu->fIsMenuBar ? OBJID_MENU : OBJID_WINDOW)), 00792 INDEXID_CONTAINER, 0); 00793 } 00794 00795 ThreadUnlock(&tlpwndMenu); 00796 00797 return !ppopupmenu->fDestroyed; 00798 }

PMENUSTATE xxxMNStartMenuState PWND  pwnd,
DWORD  cmd,
LPARAM  lParam
 

Definition at line 540 of file mnstate.c.

References _PostMessage(), CheckLock, FALSE, tagPOPUPMENU::fHasMenuBar, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fRtoL, GETPTI, L, Lock, MFMWFP_NOITEM, MFRTL, MNAllocPopup(), MNFreePopup(), NULL, tagTHREADINFO::pMenuState, tagPOPUPMENU::posSelectedItem, tagPOPUPMENU::ppopupmenuRoot, PtiCurrent, tagWND::spmenu, tagPOPUPMENU::spwndNotify, tagWND::spwndParent, tagPOPUPMENU::spwndPopupMenu, TestMF, TestWF, TestwndChild, ThreadLockAlways, ThreadUnlock, TRUE, WEFRTLREADING, WFSYSMENU, xxxMNAllocMenuState(), and xxxSendMessage().

Referenced by xxxSysCommand().

00541 { 00542 PPOPUPMENU ppopupmenu; 00543 PTHREADINFO ptiCurrent, ptiNotify; 00544 PMENUSTATE pMenuState; 00545 TL tlpwnd; 00546 PWND pwndT; 00547 00548 CheckLock(pwnd); 00549 00550 /* 00551 * Bail if the current thread is already in menu mode 00552 */ 00553 ptiCurrent = PtiCurrent(); 00554 if (ptiCurrent->pMenuState != NULL) { 00555 return NULL; 00556 } 00557 00558 /* 00559 * If pwnd is not owned by ptiCurrent, the _PostMessage call below might 00560 * send us in a loop 00561 */ 00562 UserAssert(ptiCurrent == GETPTI(pwnd)); 00563 00564 /* 00565 * If this is not a child window, use the active window on its queue 00566 */ 00567 if (!TestwndChild(pwnd)) { 00568 pwnd = GETPTI(pwnd)->pq->spwndActive; 00569 } else { 00570 /* 00571 * Search up the parents for a window with a System Menu. 00572 */ 00573 while (TestwndChild(pwnd)) { 00574 if (TestWF(pwnd, WFSYSMENU)) { 00575 break; 00576 } 00577 pwnd = pwnd->spwndParent; 00578 } 00579 } 00580 00581 if (pwnd == NULL) { 00582 return NULL; 00583 } 00584 00585 if (!TestwndChild(pwnd) && (pwnd->spmenu != NULL)) { 00586 goto hasmenu; 00587 } 00588 00589 if (!TestWF(pwnd, WFSYSMENU)) { 00590 return NULL; 00591 } 00592 00593 hasmenu: 00594 00595 /* 00596 * If the owner/notification window was created by another thread, 00597 * make sure that it's not in menu mode already 00598 * This can happen if PtiCurrent() is attached to other threads, one of 00599 * which created pwnd. 00600 */ 00601 ptiNotify = GETPTI(pwnd); 00602 if (ptiNotify->pMenuState != NULL) { 00603 return NULL; 00604 } 00605 00606 /* 00607 * If the notification window is owned by another thread, 00608 * then the menu loop wouldn't get any keyboard or mouse 00609 * messages because we set capture to the notification window. 00610 * So we pass the WM_SYSCOMMAND to that thread and bail 00611 */ 00612 if (ptiNotify != ptiCurrent) { 00613 RIPMSG2(RIP_WARNING, "Passing WM_SYSCOMMAND SC_*MENU from thread %#p to %#p", ptiCurrent, ptiNotify); 00614 _PostMessage(pwnd, WM_SYSCOMMAND, cmd, lParam); 00615 return NULL; 00616 } 00617 00618 /* 00619 * Allocate ppoupmenu and pMenuState 00620 */ 00621 ppopupmenu = MNAllocPopup(FALSE); 00622 if (ppopupmenu == NULL) { 00623 return NULL; 00624 } 00625 00626 pMenuState = xxxMNAllocMenuState(ptiCurrent, ptiNotify, ppopupmenu); 00627 if (pMenuState == NULL) { 00628 MNFreePopup(ppopupmenu); 00629 return NULL; 00630 } 00631 00632 ppopupmenu->fIsMenuBar = TRUE; 00633 ppopupmenu->fHasMenuBar = TRUE; 00634 Lock(&(ppopupmenu->spwndNotify), pwnd); 00635 ppopupmenu->posSelectedItem = MFMWFP_NOITEM; 00636 Lock(&(ppopupmenu->spwndPopupMenu), pwnd); 00637 ppopupmenu->ppopupmenuRoot = ppopupmenu; 00638 00639 pwndT = pwnd; 00640 while( TestwndChild(pwndT) ) 00641 pwndT = pwndT->spwndParent; 00642 00643 if (pwndT->spmenu) 00644 ppopupmenu->fRtoL = TestMF(pwndT->spmenu, MFRTL) ?TRUE:FALSE; 00645 else { 00646 // 00647 // no way to know, no menu, but there is a system menu. Thus arrow 00648 // keys are really not important. however lets take the next best 00649 // thing just to be safe 00650 // 00651 ppopupmenu->fRtoL = TestWF(pwnd, WEFRTLREADING) ?TRUE :FALSE; 00652 } 00653 /* 00654 * Notify the app we are entering menu mode. wParam is always 0 since this 00655 * procedure will only be called for menu bar menus not TrackPopupMenu 00656 * menus. 00657 */ 00658 ThreadLockAlways(pwnd, &tlpwnd); 00659 xxxSendMessage(pwnd, WM_ENTERMENULOOP, 0, 0L); 00660 ThreadUnlock(&tlpwnd); 00661 00662 return pMenuState; 00663 }

BOOL xxxMNSwitchToAlternateMenu PPOPUPMENU  ppopupMenu  ) 
 

Definition at line 795 of file ntuser/kernel/menu.c.

References BOOL, FALSE, tagPOPUPMENU::fDestroyed, tagPOPUPMENU::fIsMenuBar, tagPOPUPMENU::fIsSysMenu, tagMENUSTATE::fIsSysMenu, FWINABLE, GetpMenuState(), Lock, MFMWFP_NOITEM, MFSYSMENU, NULL, tagPOPUPMENU::spmenu, tagPOPUPMENU::spmenuAlternate, tagWND::spmenuSys, tagPOPUPMENU::spwndNotify, tagMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, TestMF, TestWF, ThreadLock, ThreadUnlock, TRUE, Unlock, WFSYSMENU, xxxMNSelectItem(), and xxxWindowEvent().

Referenced by xxxHandleMenuMessages(), xxxMNChar(), xxxMNKeyDown(), xxxMNKeyFilter(), and xxxMNMouseMove().

00797 { 00798 PMENU pmenuSwap = NULL; 00799 PMENUSTATE pMenuState; 00800 TL tlpwndPopupMenu; 00801 00802 if (!ppopupmenu->fIsMenuBar || !ppopupmenu->spmenuAlternate) { 00803 /* 00804 * Do nothing if no menu or not top level menu bar. 00805 * ppopupmenu->spmenuAlternate can be NULL when an app has 00806 * either system menu or menu bar but not both. If that menu 00807 * has only one popup that it's not dropped, then hitting 00808 * VK_RIGHT or VK_LEFT causes xxxMNKeyDown to end up here. 00809 * ppopupmenu->fIsMenuBar can be false when you drop the 00810 * system menu of an app with no menu bar; then hit VK_RIGHT 00811 * on an item that doesn't have a popup and you'll get here 00812 * There might be some other situations like this; in any case 00813 * the assertion got to go 00814 */ 00815 return FALSE; 00816 } 00817 00818 /* 00819 * If we're getting out of menu mode, do nothing 00820 */ 00821 if (ppopupmenu->fDestroyed) { 00822 return FALSE; 00823 } 00824 00825 /* 00826 * Select no items in the current menu. 00827 */ 00828 ThreadLock(ppopupmenu->spwndPopupMenu, &tlpwndPopupMenu); 00829 UserAssert(ppopupmenu->spwndPopupMenu != NULL); 00830 pMenuState = GetpMenuState(ppopupmenu->spwndPopupMenu); 00831 if (pMenuState == NULL) { 00832 RIPMSG0(RIP_ERROR, "xxxMNSwitchToAlternateMenu: pMenuState == NULL"); 00833 ThreadUnlock(&tlpwndPopupMenu); 00834 return FALSE; 00835 } 00836 xxxMNSelectItem(ppopupmenu, pMenuState, MFMWFP_NOITEM); 00837 00838 00839 UserAssert(ppopupmenu->spmenu->spwndNotify == ppopupmenu->spmenuAlternate->spwndNotify); 00840 Lock(&pmenuSwap, ppopupmenu->spmenuAlternate); 00841 Lock(&ppopupmenu->spmenuAlternate, ppopupmenu->spmenu); 00842 Lock(&ppopupmenu->spmenu, pmenuSwap); 00843 Unlock(&pmenuSwap); 00844 00845 /* 00846 * Set this global because it is used in SendMenuSelect() 00847 */ 00848 if (!TestWF(ppopupmenu->spwndNotify, WFSYSMENU)) { 00849 pMenuState->fIsSysMenu = FALSE; 00850 } else if (ppopupmenu->spwndNotify->spmenuSys != NULL) { 00851 pMenuState->fIsSysMenu = (ppopupmenu->spwndNotify->spmenuSys == 00852 ppopupmenu->spmenu); 00853 } else { 00854 pMenuState->fIsSysMenu = !!TestMF(ppopupmenu->spmenu, MFSYSMENU); 00855 } 00856 00857 ppopupmenu->fIsSysMenu = pMenuState->fIsSysMenu; 00858 00859 if (FWINABLE()) { 00860 xxxWindowEvent(EVENT_SYSTEM_MENUEND, ppopupmenu->spwndNotify, 00861 (ppopupmenu->fIsSysMenu ? OBJID_MENU : OBJID_SYSMENU), INDEXID_CONTAINER, 0); 00862 xxxWindowEvent(EVENT_SYSTEM_MENUSTART, ppopupmenu->spwndNotify, 00863 (ppopupmenu->fIsSysMenu ? OBJID_SYSMENU : OBJID_MENU), INDEXID_CONTAINER, 0); 00864 } 00865 00866 ThreadUnlock(&tlpwndPopupMenu); 00867 00868 return TRUE; 00869 }

void xxxMNUpdateDraggingInfo PMENUSTATE  pMenuState,
ULONG_PTR  uHitArea,
UINT  uIndex
 

Definition at line 279 of file menudd.c.

References BOOL, tagITEM::cyItem, FALSE, IsMFMWFPWindow(), LockMFMWFPWindow(), MFMWFP_NOITEM, MFMWFP_OFFMENU, MNGetpItem(), MNGetToppItem(), NULL, tagMENUSTATE::ptMouseLast, tagPOPUPMENU::spmenu, SYSMET, ThreadLock, ThreadUnlock, TRUE, tagMENUSTATE::uDraggingFlags, tagMENUSTATE::uDraggingHitArea, tagMENUSTATE::uDraggingIndex, UINT, xxxMNSetGapState(), and tagITEM::yItem.

Referenced by xxxMNMouseMove().

00280 { 00281 BOOL fCross; 00282 int y, iIndexDelta; 00283 PITEM pItem; 00284 PPOPUPMENU ppopup; 00285 TL tlLastHitArea; 00286 ULONG_PTR uLastHitArea; 00287 UINT uLastIndex, uLastFlags; 00288 00289 /* 00290 * Remember current dragging area so we can detected when 00291 * crossing item/gap boundries. 00292 */ 00293 UserAssert((pMenuState->uDraggingHitArea == 0) || IsMFMWFPWindow(pMenuState->uDraggingHitArea)); 00294 ThreadLock((PWND)pMenuState->uDraggingHitArea, &tlLastHitArea); 00295 uLastHitArea = pMenuState->uDraggingHitArea; 00296 uLastIndex = pMenuState->uDraggingIndex; 00297 uLastFlags = pMenuState->uDraggingFlags & MNGOF_GAP; 00298 00299 /* 00300 * Store new dragging area. 00301 */ 00302 LockMFMWFPWindow(&pMenuState->uDraggingHitArea, uHitArea); 00303 pMenuState->uDraggingIndex = uIndex; 00304 00305 /* 00306 * If we're not on a popup, done. 00307 */ 00308 if (!IsMFMWFPWindow(pMenuState->uDraggingHitArea)) { 00309 pMenuState->uDraggingHitArea = MFMWFP_OFFMENU; 00310 pMenuState->uDraggingIndex = MFMWFP_NOITEM; 00311 ThreadUnlock(&tlLastHitArea); 00312 return; 00313 } 00314 00315 /* 00316 * Get the popup and item we're on 00317 */ 00318 ppopup = ((PMENUWND)pMenuState->uDraggingHitArea)->ppopupmenu; 00319 pItem = MNGetpItem(ppopup, pMenuState->uDraggingIndex); 00320 00321 /* 00322 * Find out if we're on the gap, that is, the "virtual" space 00323 * between items. Some apps want to distinguish between a drop 00324 * ON the item and a drop BEFORE/AFTER the item; there is no 00325 * actual space between items so we define a virtual gap 00326 * 00327 */ 00328 pMenuState->uDraggingFlags = 0; 00329 if (pItem != NULL) { 00330 /* 00331 * Map the point to client coordinates and then to "menu" 00332 * coordinates (to take care of scrollable menus) 00333 */ 00334 y = pMenuState->ptMouseLast.y; 00335 y -= ((PWND)pMenuState->uDraggingHitArea)->rcClient.top; 00336 y += MNGetToppItem(ppopup->spmenu)->yItem; 00337 #if DBG 00338 if ((y < (int)pItem->yItem) 00339 || (y > (int)(pItem->yItem + pItem->cyItem))) { 00340 RIPMSG4(RIP_ERROR, "xxxMNUpdateDraggingInfo: y Point not in selected item. " 00341 "pwnd:%#lx ppopup:%#lx Index:%#lx pItem:%#lx", 00342 pMenuState->uDraggingHitArea, ppopup, pMenuState->uDraggingIndex, pItem); 00343 } 00344 #endif 00345 00346 /* 00347 * Top/bottom gap check 00348 */ 00349 if (y <= (int)(pItem->yItem + SYSMET(CYDRAG))) { 00350 pMenuState->uDraggingFlags = MNGOF_TOPGAP; 00351 } else if (y >= (int)(pItem->yItem + pItem->cyItem - SYSMET(CYDRAG))) { 00352 pMenuState->uDraggingFlags = MNGOF_BOTTOMGAP; 00353 } 00354 } 00355 00356 /* 00357 * Have we crossed an item/gap boundary? 00358 * We don't cross a boundary when we move from the bottom 00359 * of an item to the top of the next, or, from the top 00360 * of an item to the bottom of the previous. 00361 * (Item N is on top of and previous to item N+1). 00362 */ 00363 fCross = (uLastHitArea != pMenuState->uDraggingHitArea); 00364 if (!fCross) { 00365 iIndexDelta = (int)pMenuState->uDraggingIndex - (int)uLastIndex; 00366 switch (iIndexDelta) { 00367 case 0: 00368 /* 00369 * We're on the same item. 00370 */ 00371 fCross = (uLastFlags != pMenuState->uDraggingFlags); 00372 break; 00373 00374 case 1: 00375 /* 00376 * We've moved to the next item 00377 */ 00378 fCross = !((pMenuState->uDraggingFlags == MNGOF_TOPGAP) 00379 && (uLastFlags == MNGOF_BOTTOMGAP)); 00380 break; 00381 00382 case -1: 00383 /* 00384 * We've moved to the previous item 00385 */ 00386 fCross = !((pMenuState->uDraggingFlags == MNGOF_BOTTOMGAP) 00387 && (uLastFlags == MNGOF_TOPGAP)); 00388 break; 00389 00390 default: 00391 /* 00392 * We've skipped more than one item. 00393 */ 00394 fCross = TRUE; 00395 } 00396 } 00397 00398 if (fCross) { 00399 pMenuState->uDraggingFlags |= MNGOF_CROSSBOUNDARY; 00400 00401 /* 00402 * Update the insertion bar state. 00403 */ 00404 xxxMNSetGapState(uLastHitArea, uLastIndex, uLastFlags, FALSE); 00405 xxxMNSetGapState(pMenuState->uDraggingHitArea, 00406 pMenuState->uDraggingIndex, 00407 pMenuState->uDraggingFlags, 00408 TRUE); 00409 } 00410 00411 ThreadUnlock(&tlLastHitArea); 00412 }

void xxxMNUpdateShownMenu PPOPUPMENU  ppopup,
PITEM  pItem,
UINT  uFlags
 

Definition at line 1106 of file mnchange.c.

References _GetClientRect(), tagMENU::cxMenu, tagITEM::cyItem, tagMENU::cyMenu, tagMENU::dwArrowsOn, DWORD, L, MNGetToppItem(), MNUS_DELETE, MNUS_DRAWFRAME, MSA_OFF, NULL, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndPopupMenu, ThreadLock, ThreadUnlock, TRUE, xxxInvalidateRect(), xxxScrollWindowEx(), xxxSendMessage(), xxxSetWindowPos(), and tagITEM::yItem.

Referenced by xxxEnableMenuItem(), xxxRemoveDeleteMenuHelper(), xxxSetLPITEMInfo(), and xxxSetMenuInfo().

01107 { 01108 RECT rc; 01109 PWND pwnd = ppopup->spwndPopupMenu; 01110 PMENU pMenu = ppopup->spmenu; 01111 TL tlpwnd; 01112 TL tlpmenu; 01113 01114 /* 01115 * The popup might get destroyed while we callback, so lock this pwnd. 01116 */ 01117 ThreadLock(pwnd, &tlpwnd); 01118 ThreadLock(ppopup->spmenu, &tlpmenu); 01119 01120 _GetClientRect(pwnd, &rc); 01121 01122 /* 01123 * If we need to resize menu window 01124 */ 01125 if (pMenu->cxMenu == 0) { 01126 RECT rcScroll = rc; 01127 int cySave = rc.bottom; 01128 int cxSave = rc.right; 01129 DWORD dwSize; 01130 DWORD dwArrowsOnBefore; 01131 01132 dwArrowsOnBefore = pMenu->dwArrowsOn; 01133 UserAssert(uFlags != 0); 01134 dwSize = (DWORD)xxxSendMessage(pwnd, MN_SIZEWINDOW, uFlags, 0L); 01135 uFlags &= ~MNUS_DRAWFRAME; 01136 /* 01137 * If scroll arrows appeared or disappeared, redraw entire client 01138 */ 01139 if (dwArrowsOnBefore ^ pMenu->dwArrowsOn) { 01140 goto InvalidateAll; 01141 } 01142 01143 rc.right = LOWORD(dwSize); 01144 if (pItem != NULL) { 01145 if (rc.right != cxSave) { 01146 // width changed, redraw everything 01147 // BUGBUG -- this could be tuned to just redraw items with 01148 // submenus and/or accelerator fields 01149 goto InvalidateAll; 01150 } else { 01151 rc.bottom = pMenu->cyMenu; 01152 if (pMenu->dwArrowsOn != MSA_OFF) { 01153 if (rc.bottom <= cySave) { 01154 rc.top = pItem->yItem - MNGetToppItem(pMenu)->yItem; 01155 goto InvalidateRest; 01156 } 01157 01158 _GetClientRect(pwnd, &rcScroll); 01159 } 01160 01161 rc.top = rcScroll.top = pItem->yItem - MNGetToppItem(pMenu)->yItem; 01162 if ((rc.top >= 0) && (rc.top < (int)pMenu->cyMenu)) { 01163 xxxScrollWindowEx(pwnd, 0, rc.bottom - cySave, &rcScroll, &rc, NULL, NULL, SW_INVALIDATE | SW_ERASE); 01164 } 01165 } /* else of if (rc.right != cxSave) */ 01166 } /* if (pItem != NULL) */ 01167 } /* if (pMenu->cxMenu == 0) */ 01168 01169 if (!(uFlags & MNUS_DELETE)) { 01170 if (pItem != NULL) { 01171 rc.top = pItem->yItem - MNGetToppItem(pMenu)->yItem; 01172 rc.bottom = rc.top + pItem->cyItem; 01173 InvalidateRest: 01174 if ((rc.top >= 0) && (rc.top < (int)pMenu->cyMenu)) { 01175 xxxInvalidateRect(pwnd, &rc, TRUE); 01176 } 01177 } else { 01178 InvalidateAll: 01179 xxxInvalidateRect(pwnd, NULL, TRUE); 01180 } 01181 if (uFlags & MNUS_DRAWFRAME) { 01182 xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, 01183 SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE 01184 | SWP_NOACTIVATE | SWP_NOOWNERZORDER); 01185 } 01186 } 01187 01188 ThreadUnlock(&tlpmenu); 01189 ThreadUnlock(&tlpwnd); 01190 }

int xxxMouseActivate PTHREADINFO  pti,
PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPPOINT  lppt,
int  ht
 

Definition at line 2444 of file ntuser/kernel/input.c.

References _GETPDESK, AW_TRY, AW_TRY2, BOOL, CheckLock, CheckOnTop(), tagQ::codeCapture, GETPTI, HW, MA_PASSTHRU, MA_REHITTEST, MA_SKIP, NO_CAP_CLIENT, NULL, tagTHREADINFO::pq, PWNDDESKTOP, QF_EVENTDEACTIVATEREMOVED, tagQ::QF_flags, tagWND::rcClient, SHORT, tagQ::spwndActive, tagQ::spwndCapture, tagWND::spwndParent, TestUP, TestWF, TestwndChild, ThreadLockAlwaysWithPti, ThreadLockWithPti, ThreadUnlock, TIF_CSRSSTHREAD, UINT, WEFNOPARENTNOTIFY, WEFTOPMOST, WFDISABLED, WFWIN40COMPAT, xxxActivateWindow(), xxxActiveWindowTracking(), and xxxSendMessage().

Referenced by xxxScanSysQueue().

02451 { 02452 UINT x, y; 02453 PWND pwndTop; 02454 int result; 02455 TL tlpwndTop; 02456 BOOL fSend; 02457 02458 CheckLock(pwnd); 02459 02460 UserAssert(_GETPDESK(pwnd) != NULL); 02461 02462 /* 02463 * No mouse activation if the mouse is captured. Must check for the capture 02464 * ONLY here. 123W depends on it - create a graph, select Rearrange.. 02465 * flip horizontal, click outside the graph. If this code checks for 02466 * anything beside just capture, 123w will get the below messages and 02467 * get confused. 02468 */ 02469 if (pti->pq->spwndCapture != NULL) { 02470 return MA_PASSTHRU; 02471 } 02472 02473 result = MA_PASSTHRU; 02474 02475 pwndTop = pwnd; 02476 ThreadLockWithPti(pti, pwndTop, &tlpwndTop); 02477 02478 /* 02479 * B#1404 02480 * Don't send WM_PARENTNOTIFY messages if the child has 02481 * WS_EX_NOPARENTNOTIFY style. 02482 * 02483 * Unfortunately, this breaks people who create controls in 02484 * MDI children, like WinMail. They don't get WM_PARENTNOTIFY 02485 * messages, which don't get passed to DefMDIChildProc(), which 02486 * then can't update the active MDI child. Grrr. 02487 */ 02488 02489 fSend = (!TestWF(pwnd, WFWIN40COMPAT) || !TestWF(pwnd, WEFNOPARENTNOTIFY)); 02490 02491 /* 02492 * If it's a buttondown event, send WM_PARENTNOTIFY. 02493 */ 02494 switch (message) { 02495 case WM_LBUTTONDOWN: 02496 case WM_RBUTTONDOWN: 02497 case WM_MBUTTONDOWN: 02498 case WM_XBUTTONDOWN: 02499 while (TestwndChild(pwndTop)) { 02500 pwndTop = pwndTop->spwndParent; 02501 02502 if (fSend) { 02503 ThreadUnlock(&tlpwndTop); 02504 ThreadLockWithPti(pti, pwndTop, &tlpwndTop); 02505 x = (UINT)(lppt->x - pwndTop->rcClient.left); 02506 y = (UINT)(lppt->y - pwndTop->rcClient.top); 02507 02508 /* Get the xbutton from the hiword of wParam */ 02509 UserAssert(message == WM_XBUTTONDOWN || HIWORD(wParam) == 0); 02510 UserAssert(LOWORD(wParam) == 0); 02511 xxxSendMessage(pwndTop, WM_PARENTNOTIFY, (WPARAM)(message | wParam), MAKELPARAM(x, y)); 02512 } 02513 } 02514 02515 if (!fSend) { 02516 ThreadUnlock(&tlpwndTop); 02517 ThreadLockAlwaysWithPti(pti, pwndTop, &tlpwndTop); 02518 } 02519 02520 /* 02521 * NOTE: We break out of this loop with pwndTop locked. 02522 */ 02523 break; 02524 } 02525 02526 /* 02527 * The mouse was moved onto this window: make it foreground 02528 */ 02529 if (TestUP(ACTIVEWINDOWTRACKING) && (message == WM_MOUSEMOVE)) { 02530 result = xxxActiveWindowTracking(pwnd, WM_MOUSEMOVE, ht); 02531 } 02532 02533 /* 02534 * Are we hitting an inactive top-level window WHICH ISN'T THE DESKTOP(!)? 02535 * 02536 * craigc 7-14-89 hitting either inactive top level or any child window, 02537 * to be compatible with 2.X. Apps apparently needs this message. 02538 */ 02539 else if ((pti->pq->spwndActive != pwnd || pti->pq->QF_flags & QF_EVENTDEACTIVATEREMOVED) && 02540 (pwndTop != PWNDDESKTOP(pwndTop))) { 02541 switch (message) { 02542 case WM_LBUTTONDOWN: 02543 case WM_RBUTTONDOWN: 02544 case WM_MBUTTONDOWN: 02545 case WM_XBUTTONDOWN: 02546 02547 /* 02548 * Send the MOUSEACTIVATE message. 02549 */ 02550 result = (int)xxxSendMessage(pwnd, WM_MOUSEACTIVATE, 02551 (WPARAM)(HW(pwndTop)), MAKELONG((SHORT)ht, message)); 02552 02553 switch (result) { 02554 02555 case 0: 02556 case MA_ACTIVATE: 02557 case MA_ACTIVATEANDEAT: 02558 02559 /* 02560 * If activation fails, swallow the message. 02561 */ 02562 if ((pwndTop != pti->pq->spwndActive || 02563 pti->pq->QF_flags & QF_EVENTDEACTIVATEREMOVED) && 02564 !xxxActivateWindow(pwndTop, 02565 (UINT)((pti->pq->codeCapture == NO_CAP_CLIENT) ? 02566 AW_TRY2 : AW_TRY))) { 02567 result = MA_SKIP; 02568 } else if (TestWF(pwndTop, WFDISABLED)) { 02569 #ifdef NEVER 02570 02571 /* 02572 * Althoug this is what win3 does, it is braindead: it 02573 * can easily cause infinite loops. Returning "rehittest" 02574 * means process this event over again - nothing causes 02575 * anything different to happen, and we get an infinite 02576 * loop. This case never gets executed on win3 because if 02577 * the window is disabled, it got the HTERROR hittest 02578 * code. This can only be done on Win32 where input is 02579 * assigned to a window BEFORE process occurs to pull 02580 * it out of the queue. 02581 */ 02582 result = MA_REHITTEST; 02583 #endif 02584 02585 /* 02586 * Someone clicked on a window before it was disabled... 02587 * Since it is disabled now, don't send this message to 02588 * it: instead eat it. 02589 */ 02590 result = MA_SKIP; 02591 } else if (result == MA_ACTIVATEANDEAT) { 02592 result = MA_SKIP; 02593 } else { 02594 result = MA_PASSTHRU; 02595 goto ItsActiveJustCheckOnTop; 02596 } 02597 break; 02598 02599 case MA_NOACTIVATEANDEAT: 02600 result = MA_SKIP; 02601 break; 02602 } 02603 } 02604 } else { 02605 ItsActiveJustCheckOnTop: 02606 /* 02607 * Make sure this active window is on top (see comment 02608 * in CheckOnTop). 02609 */ 02610 if (TestUP(ACTIVEWINDOWTRACKING)) { 02611 if (CheckOnTop(pti, pwndTop, message)) { 02612 /* 02613 * The window was z-ordered to the top. 02614 * If it is a console window, skip the message 02615 * so it won't go into "selecting" mode 02616 * Hard error boxes are created by csrss as well 02617 * If we have topmost console windows someday, this 02618 * will need to change 02619 */ 02620 if ((ht == HTCLIENT) 02621 && (GETPTI(pwndTop)->TIF_flags & TIF_CSRSSTHREAD) 02622 && !(TestWF(pwndTop, WEFTOPMOST))) { 02623 02624 RIPMSG2(RIP_WARNING, "xxxMouseActivate: Skipping msg %#lx for pwnd %#p", 02625 message, pwndTop); 02626 result = MA_SKIP; 02627 } 02628 } 02629 } /* if (TestUP(ACTIVEWINDOWTRACKING)) */ 02630 } 02631 02632 /* 02633 * Now set the cursor shape. 02634 */ 02635 if (pti->pq->spwndCapture == NULL) { 02636 xxxSendMessage(pwnd, WM_SETCURSOR, (WPARAM)HW(pwnd), 02637 MAKELONG((SHORT)ht, message)); 02638 } 02639 02640 ThreadUnlock(&tlpwndTop); 02641 return result; 02642 }

VOID xxxMoveEvent LONG  dx,
LONG  dy,
DWORD  dwFlags,
ULONG_PTR  dwExtraInfo,
DWORD  time,
BOOL  bInjected
 

Definition at line 2020 of file ntinput.c.

References CheckCritOut, ConvertToMouseDriverFlags, dwFlags, GetMouseCoord(), gptCursorAsync, VOID(), and xxxMoveEventAbsolute().

Referenced by xxxMKMouseMove(), xxxMKMoveAccelCursorTimer(), xxxMKMoveConstCursorTimer(), and xxxMouseEventDirect().

02027 { 02028 POINT ptLastMove = gptCursorAsync; 02029 02030 CheckCritOut(); 02031 02032 /* 02033 * Get the actual point that will be injected. 02034 */ 02035 GetMouseCoord(dx, dy, ConvertToMouseDriverFlags(dwFlags), 02036 time, dwExtraInfo, &ptLastMove); 02037 02038 /* 02039 * move the mouse 02040 */ 02041 xxxMoveEventAbsolute( 02042 ptLastMove.x, 02043 ptLastMove.y, 02044 dwExtraInfo, 02045 time, 02046 bInjected); 02047 }

VOID xxxMoveSize PWND  pwnd,
UINT  cmdMove,
DWORD  wptStart
 

Definition at line 1053 of file movesize.c.

References _CallMsgFilter(), BORDER_EXTRA, CheckLock, CLEAR_PUDF, CLIENT_CAPTURE_INTERNAL, _MOVESIZEDATA::cmd, tagDISPLAYINFO::cMonitors, CopyRect, DDR_START, DWORD, _MOVESIZEDATA::dxMouse, _MOVESIZEDATA::dyMouse, FALSE, _MOVESIZEDATA::fDragFullWindows, _MOVESIZEDATA::fForeground, _MOVESIZEDATA::fInitSize, _MOVESIZEDATA::fmsKbd, FNID_COMBOBOX, _MOVESIZEDATA::fOffScreen, _MOVESIZEDATA::fTrackCancelled, FWINABLE, GetCaptionHeight(), GETFNID, GetPrimaryMonitor(), GETPTI, ghrgnUpdateSave, gnUpdateSave, gpDispInfo, gpqForeground, gpsi, gptiForeground, tagDISPLAYINFO::hDev, HISHORT, tagWND::hrgnClip, _MOVESIZEDATA::impx, _MOVESIZEDATA::impy, IntersectRect(), IsWinEventNotifyDeferredOK, L, Lock, LOSHORT, MOVESIZEDATA, msg, NULL, tagTHREADINFO::pmsd, tagTHREADINFO::pq, PtiCurrent, _MOVESIZEDATA::ptMaxTrack, _MOVESIZEDATA::ptMinTrack, _MOVESIZEDATA::ptRestore, PUDF_DRAGFULLWINDOWS, PUDF_DRAGGINGFULLWINDOW, PWNDDESKTOP, tagWND::rcClient, _MOVESIZEDATA::rcDrag, _MOVESIZEDATA::rcDragCursor, _MOVESIZEDATA::rcParent, tagDISPLAYINFO::rcScreen, tagWND::rcWindow, _MOVESIZEDATA::rcWindow, tagMONITOR::rcWork, rgcmdmpix, rgcmdmpiy, rgimpiwx, rgimpiwy, SET_OR_CLEAR_PUDF, SetForegroundPriority(), _MOVESIZEDATA::spwnd, tagQ::spwndCapture, tagQ::spwndFocus, tagWND::spwndParent, SYSCUR, SYSMET, TEST_BOOL_PUDF, TestWF, ThreadLockAlwaysWithPti, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_MOVESIZETRACKING, TIF_TRACKRECTVISIBLE, TRUE, Unlock, VOID(), WEFTOOLWINDOW, WEFTOPMOST, WFMINIMIZED, WFSIZEBOX, xxxCallHook(), xxxCapture(), xxxDispatchMessage(), xxxDrawDragRect(), xxxInitSendValidateMinMaxInfo(), xxxMS_FlushWigglies(), xxxMS_TrackMove(), xxxPeekMessage, xxxSendMessage(), xxxTrackInitSize(), xxxTranslateMessage(), xxxWaitMessage(), xxxWindowEvent(), zzzClipCursor(), zzzInternalSetCursorPos(), zzzSetCursor(), zzzSetFMouseMoved(), and zzzShowCursor().

Referenced by xxxSysCommand().

01057 { 01058 MSG msg; 01059 int x; 01060 int y; 01061 int i; 01062 RECT rcSys; 01063 PTHREADINFO ptiCurrent = PtiCurrent(); 01064 PMOVESIZEDATA pmsd; 01065 TL tlpwndT; 01066 PWND pwndT; 01067 POINT ptStart; 01068 MINMAXINFO mmi; 01069 01070 CheckLock(pwnd); 01071 UserAssert(IsWinEventNotifyDeferredOK()); 01072 01073 /* 01074 * Don't allow the app to track a window 01075 * from another queue. 01076 */ 01077 if (GETPTI(pwnd)->pq != ptiCurrent->pq) 01078 return; 01079 01080 if (ptiCurrent->pmsd != NULL) 01081 return; 01082 01083 /* 01084 * If the window with the focus is a combobox, hide the dropdown 01085 * listbox before tracking starts. The dropdown listbox is not a 01086 * child of the window being moved, therefore it won't be moved along 01087 * with the window. 01088 * 01089 * NOTE: Win 3.1 doesn't perform this check. 01090 */ 01091 if ((pwndT = ptiCurrent->pq->spwndFocus) != NULL) { 01092 01093 if (GETFNID(pwndT) == FNID_COMBOBOX) { 01094 ; 01095 } else if ((pwndT->spwndParent != NULL) && 01096 (GETFNID(pwndT->spwndParent) == FNID_COMBOBOX)) { 01097 01098 pwndT = pwndT->spwndParent; 01099 } else { 01100 pwndT = NULL; 01101 } 01102 01103 if (pwndT != NULL) { 01104 ThreadLockAlwaysWithPti(ptiCurrent, pwndT, &tlpwndT); 01105 xxxSendMessage(pwndT, CB_SHOWDROPDOWN, FALSE, 0); 01106 ThreadUnlock(&tlpwndT); 01107 } 01108 } 01109 01110 /* 01111 * Allocate and zero the movesize data structure 01112 */ 01113 pmsd = (PMOVESIZEDATA)UserAllocPoolWithQuotaZInit( 01114 sizeof(MOVESIZEDATA), TAG_MOVESIZE); 01115 01116 if (pmsd == NULL) 01117 return; 01118 01119 /* 01120 * Assign the move data into the pti. If the thread is destroyed before 01121 * we free the data the DestroyThreadInfo() routine will free the move data 01122 */ 01123 ptiCurrent->pmsd = pmsd; 01124 01125 Lock(&(pmsd->spwnd), pwnd); 01126 01127 /* 01128 * Set fForeground so we know whether to draw or not. 01129 */ 01130 pmsd->fForeground = (ptiCurrent->pq == gpqForeground) ? TRUE : FALSE; 01131 01132 /* 01133 * Lower the priority of the thread doing the dragging to make sure 01134 * that we don't starve other threads and they get to repaint more often. 01135 */ 01136 if (ptiCurrent == gptiForeground) { 01137 SetForegroundPriority(ptiCurrent, FALSE); 01138 } 01139 01140 /* 01141 * Get the client and window rects. 01142 */ 01143 CopyRect(&pmsd->rcWindow, &pwnd->rcWindow); 01144 01145 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 01146 if ( TestWF(pwnd, WEFTOPMOST) || 01147 TestWF(pwnd, WEFTOOLWINDOW) || 01148 gpDispInfo->cMonitors > 1) { 01149 01150 pmsd->rcParent = gpDispInfo->rcScreen; 01151 } else { 01152 pmsd->rcParent = GetPrimaryMonitor()->rcWork; 01153 } 01154 } else { 01155 CopyRect(&pmsd->rcParent, &pwnd->spwndParent->rcClient); 01156 01157 /* 01158 * If the parent does have a region, intersect with its bounding rect. 01159 */ 01160 if (pwnd->spwndParent->hrgnClip != NULL) { 01161 01162 RECT rcT; 01163 01164 GreGetRgnBox(pwnd->spwndParent->hrgnClip, &rcT); 01165 IntersectRect(&pmsd->rcParent, &pmsd->rcParent, &rcT); 01166 } 01167 } 01168 01169 /* 01170 * This works for multiple monitors _and_ regional windows 01171 */ 01172 if (pwnd->spwndParent->hrgnClip) { 01173 pmsd->fOffScreen = !GreRectInRegion(pwnd->spwndParent->hrgnClip, &pmsd->rcWindow); 01174 } else { 01175 pmsd->fOffScreen = !IntersectRect(&rcSys, &pmsd->rcWindow, &pmsd->rcParent); 01176 } 01177 01178 /* 01179 * No need to DeferWinEventNotify(), judging by xxxInitSendValidateMinMaxInfo below 01180 */ 01181 zzzClipCursor(&pmsd->rcParent); 01182 CopyRect(&rcSys, &pmsd->rcWindow); 01183 01184 if (TestWF(pwnd, WFMINIMIZED)) { 01185 01186 /* 01187 * No need to send WM_GETMINMAXINFO since we know the minimized size. 01188 */ 01189 pmsd->ptMinTrack.x = pmsd->ptMaxTrack.x = SYSMET(CXMINIMIZED); 01190 pmsd->ptMinTrack.y = pmsd->ptMaxTrack.y = SYSMET(CYMINIMIZED); 01191 01192 } else { 01193 xxxInitSendValidateMinMaxInfo(pwnd, &mmi); 01194 pmsd->ptMinTrack = mmi.ptMinTrackSize; 01195 pmsd->ptMaxTrack = mmi.ptMaxTrackSize; 01196 } 01197 01198 /* 01199 * Set up the drag rectangle. 01200 */ 01201 CopyRect(&pmsd->rcDrag, &pmsd->rcWindow); 01202 CopyRect(&pmsd->rcDragCursor, &pmsd->rcDrag); 01203 01204 ptStart.x = LOSHORT(wptStart); 01205 ptStart.y = HISHORT(wptStart); 01206 01207 /* 01208 * Assume Move/Size from mouse. 01209 */ 01210 pmsd->fInitSize = FALSE; 01211 pmsd->fmsKbd = FALSE; 01212 01213 /* 01214 * Get the mouse position for this move/size command. 01215 */ 01216 switch (pmsd->cmd = cmdMove) { 01217 case WMSZ_KEYMOVE: 01218 pmsd->cmd = cmdMove = WMSZ_MOVE; 01219 01220 /* 01221 ** FALL THRU ** 01222 */ 01223 01224 case WMSZ_KEYSIZE: 01225 /* 01226 * No need to DeferWinEventNotify() - pmsd won't go away, and pwnd is locked 01227 */ 01228 zzzSetCursor(SYSCUR(SIZEALL)); 01229 01230 if (!TestWF(pwnd, WFMINIMIZED)) 01231 pmsd->fInitSize = TRUE; 01232 01233 /* 01234 * Workaround: always behave as if the command is 01235 * issued using keyboard. 01236 * if it's found as the wrong way, the behavior is defined as: 01237 * if (mnFocus == KEYBDHOLD) || 01238 * ((mnFocus == MOUSEHOLD) && TestWF(pwnd, WFMINIMIZED))) { 01239 * In order to do this, mnFocus should be saved somewhere. 01240 * originally, mnFocus was saved in MenuState. 01241 */ 01242 pmsd->fmsKbd = TRUE; 01243 pmsd->ptRestore.x = LOSHORT(wptStart); 01244 pmsd->ptRestore.y = HISHORT(wptStart); 01245 01246 /* 01247 * Center cursor in caption area of window 01248 */ 01249 01250 /* 01251 * Horizontally 01252 */ 01253 ptStart.x = (pmsd->rcDrag.left + pmsd->rcDrag.right) / 2; 01254 01255 /* 01256 * Vertically 01257 */ 01258 if (TestWF(pwnd,WFMINIMIZED) || (pmsd->cmd != WMSZ_MOVE)) { 01259 ptStart.y = (pmsd->rcDrag.top + pmsd->rcDrag.bottom) / 2; 01260 } else { 01261 int dy; 01262 01263 dy = GetCaptionHeight(pwnd); 01264 ptStart.y = pmsd->rcDrag.top + SYSMET(CYFIXEDFRAME) + dy / 2; 01265 } 01266 01267 zzzInternalSetCursorPos(ptStart.x, ptStart.y); 01268 xxxMS_FlushWigglies(); 01269 break; 01270 01271 default: 01272 break; 01273 } 01274 01275 pmsd->fDragFullWindows = TEST_BOOL_PUDF(PUDF_DRAGFULLWINDOWS); 01276 SET_OR_CLEAR_PUDF(PUDF_DRAGGINGFULLWINDOW, pmsd->fDragFullWindows); 01277 01278 /* 01279 * If we hit with the mouse, set up impx and impy so that we 01280 * can use the keyboard too. 01281 */ 01282 pmsd->impx = rgcmdmpix[cmdMove]; 01283 pmsd->impy = rgcmdmpiy[cmdMove]; 01284 01285 /* 01286 * Setup dxMouse and dyMouse - If we're sizing with the keyboard these 01287 * guys are set to zero down in the keyboard code. 01288 */ 01289 if ((i = rgimpiwx[cmdMove]) != (-1)) 01290 pmsd->dxMouse = *((int *)&pmsd->rcWindow + (short)i) - ptStart.x; 01291 01292 if ((i = rgimpiwy[cmdMove]) != (-1)) 01293 pmsd->dyMouse = *((int *)&pmsd->rcWindow + (short)i) - ptStart.y; 01294 01295 /* 01296 * Tell Gdi the width of the drag rect (if its a special size) 01297 * Turn the drag rect on. 0 specifies start drag. 01298 */ 01299 if (!TestWF(pwnd, WFSIZEBOX)) 01300 bSetDevDragWidth(gpDispInfo->hDev, 1); 01301 01302 if (FWINABLE()) { 01303 xxxWindowEvent(EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, INDEXID_CONTAINER, 0); 01304 } 01305 01306 xxxDrawDragRect(pmsd, NULL, DDR_START); 01307 ptiCurrent->TIF_flags |= TIF_TRACKRECTVISIBLE; 01308 01309 msg.lParam = MAKELONG(ptStart.x, ptStart.y); 01310 01311 /* 01312 * Right here win3.1 calls LockWindowUpdate(). This calls zzzSetFMouseMoved() 01313 * which ensures that the next message in the queue is a mouse message. 01314 * We need that mouse message as the first message because the first 01315 * call to TrackInitSize() assumes that lParam is an x, y from a mouse 01316 * message - scottlu. 01317 */ 01318 zzzSetFMouseMoved(); 01319 01320 /* 01321 * Send this message for winoldapp support 01322 */ 01323 xxxSendMessage(pwnd, WM_ENTERSIZEMOVE, 0L, 0L); 01324 xxxCapture(ptiCurrent, pwnd, CLIENT_CAPTURE_INTERNAL); 01325 01326 /* 01327 * Show the move cursor for non-mouse systems. 01328 */ 01329 zzzShowCursor(TRUE); 01330 01331 while (!(pmsd->fTrackCancelled)) { 01332 01333 /* 01334 * Let other messages not related to dragging be dispatched 01335 * to the application window. 01336 * In the case of clock, clock will now receive messages to 01337 * update the time displayed instead of having the time display 01338 * freeze while we are dragging. 01339 */ 01340 while (ptiCurrent->pq->spwndCapture == pwnd) { 01341 01342 if (xxxPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { 01343 01344 if ((msg.message >= WM_MOUSEFIRST && msg.message <= WM_MOUSELAST) 01345 || (msg.message == WM_QUEUESYNC) 01346 || (msg.message >= WM_KEYFIRST && msg.message <= WM_KEYLAST)) { 01347 01348 break; 01349 } 01350 01351 if (_CallMsgFilter(&msg, cmdMove == WMSZ_MOVE ? MSGF_MOVE : MSGF_SIZE)) { 01352 continue; 01353 } 01354 01355 xxxTranslateMessage(&msg, 0); 01356 /* 01357 * To prevent applications from doing 01358 * a PeekMessage loop and getting the mouse move messages that 01359 * are destined for the xxxMoveSize PeekMessage loop, we OR in 01360 * this flag. See comments in input.c for xxxInternalGetMessage. 01361 */ 01362 ptiCurrent->TIF_flags |= TIF_MOVESIZETRACKING; 01363 xxxDispatchMessage(&msg); 01364 ptiCurrent->TIF_flags &= ~TIF_MOVESIZETRACKING; 01365 01366 } else { 01367 /* 01368 * If we've been cancelled by someone else, or our pwnd 01369 * has been destroyed, blow out of here. 01370 */ 01371 if (pmsd->fTrackCancelled) 01372 break; 01373 01374 if (!xxxWaitMessage()) 01375 break; 01376 } 01377 } 01378 01379 /* 01380 * If we've lost capture while tracking, 01381 * cancel the move/size operation. 01382 */ 01383 if (ptiCurrent->pq->spwndCapture != pwnd) { 01384 01385 /* 01386 * Fake a key-down of the escape key to cancel. 01387 */ 01388 xxxMS_TrackMove(pwnd, WM_KEYDOWN, (DWORD)VK_ESCAPE, 1, pmsd); 01389 goto MoveSizeCleanup; 01390 } 01391 01392 /* 01393 * If we've been cancelled by someone else, or our pwnd 01394 * has been destroyed, blow out of here. 01395 */ 01396 if (pmsd->fTrackCancelled) { 01397 pmsd->fTrackCancelled = FALSE; 01398 goto MoveSizeCleanup; 01399 } 01400 01401 /* 01402 * If we get a WM_QUEUESYNC, let the CBT hook know. 01403 */ 01404 if (msg.message == WM_QUEUESYNC) { 01405 xxxCallHook(HCBT_QS, 0, 0, WH_CBT); 01406 } 01407 01408 if (pmsd->fInitSize) { 01409 if (!xxxTrackInitSize(pwnd, msg.message, msg.wParam, msg.lParam, 01410 pmsd)) { 01411 break; 01412 } 01413 } 01414 01415 /* 01416 * Convert captured mouse into screen coordinates. 01417 */ 01418 x = msg.pt.x + pmsd->dxMouse; 01419 y = msg.pt.y + pmsd->dyMouse; 01420 01421 /* 01422 * This is checked twice so the same message is not processed both 01423 * places. 01424 */ 01425 if (!pmsd->fInitSize) { 01426 xxxMS_TrackMove(pwnd, msg.message, msg.wParam, MAKELONG(x, y), 01427 pmsd); 01428 } 01429 } 01430 01431 MoveSizeCleanup: 01432 01433 /* 01434 * Reset priority if still in the foreground thread. 01435 */ 01436 01437 if (ptiCurrent == gptiForeground) { 01438 SetForegroundPriority(ptiCurrent, TRUE); 01439 } 01440 01441 /* 01442 * Reset the border size if it was abnormal 01443 */ 01444 01445 if (!TestWF(pwnd, WFSIZEBOX)) 01446 bSetDevDragWidth(gpDispInfo->hDev, gpsi->gclBorder + BORDER_EXTRA); 01447 01448 /* 01449 * Revalidation: If pwnd is deleted unexpectedly, jump here to cleanup. 01450 */ 01451 01452 bSetDevDragRect(gpDispInfo->hDev, NULL, NULL); 01453 ptiCurrent->TIF_flags &= ~(TIF_TRACKRECTVISIBLE); 01454 01455 if (pmsd->fDragFullWindows) { 01456 if (ghrgnUpdateSave != NULL) { 01457 GreDeleteObject(ghrgnUpdateSave); 01458 ghrgnUpdateSave = NULL; 01459 gnUpdateSave = 0; 01460 } 01461 } 01462 01463 CLEAR_PUDF(PUDF_DRAGGINGFULLWINDOW); 01464 01465 ptiCurrent->pmsd = NULL; 01466 01467 Unlock(&pmsd->spwnd); 01468 01469 01470 zzzShowCursor(FALSE); 01471 01472 /* 01473 * Free the move/size data structure 01474 */ 01475 UserFreePool(pmsd); 01476 }

BOOL xxxMoveWindow PWND  pwnd,
int  x,
int  y,
int  cx,
int  cy,
BOOL  fRedraw
 

Definition at line 144 of file swp.c.

References BOOL, CheckLock, cy, MW_FLAGS_NOREDRAW, MW_FLAGS_REDRAW, NULL, PWNDDESKTOP, tagWND::spwndParent, TestWF, WFWIN31COMPAT, xxxSetWindowPos(), and xxxValidateRect().

Referenced by NtUserMoveWindow(), and xxxSBWndProc().

00151 { 00152 CheckLock(pwnd); 00153 00154 if ((pwnd == PWNDDESKTOP(pwnd)) || 00155 TestWF(pwnd, WFWIN31COMPAT) || 00156 (pwnd->spwndParent != PWNDDESKTOP(pwnd))) { 00157 00158 return xxxSetWindowPos( 00159 pwnd, 00160 NULL, 00161 x, 00162 y, 00163 cx, 00164 cy, 00165 (fRedraw ? MW_FLAGS_REDRAW : MW_FLAGS_NOREDRAW)); 00166 } else { 00167 00168 /* 00169 * BACKWARD COMPATIBILITY CODE FOR WIN 3.00 AND BELOW 00170 * 00171 * Everyone and their brother seems to depend on this behavior for 00172 * top-level windows. Specific examples are: 00173 * 00174 * AfterDark help window animation 00175 * Finale Speedy Note Editing 00176 * 00177 * If the window is a top-level window and fRedraw is FALSE, 00178 * we must call SetWindowPos with SWP_NOREDRAW CLEAR anyway so that 00179 * the frame and window background get drawn. We then validate the 00180 * entire client rectangle to avoid repainting that. 00181 */ 00182 BOOL fResult = xxxSetWindowPos(pwnd, 00183 NULL, 00184 x, 00185 y, 00186 cx, 00187 cy, 00188 MW_FLAGS_REDRAW); 00189 00190 if (!fRedraw) 00191 xxxValidateRect(pwnd, NULL); 00192 00193 return fResult; 00194 } 00195 }

DWORD xxxMsgWaitForMultipleObjects DWORD  nCount,
PVOID *  apObjects,
MSGWAITCALLBACK  pfnNonMsg,
PKWAIT_BLOCK  WaitBlockArray
 

Definition at line 4271 of file queue.c.

References apObjects, CheckForClientDeath, CheckProcessForeground(), ClearQueueServerEvent(), _CLIENTINFO::cSpins, DEVICE_TYPE_MOUSE, DWORD, EnterCrit, FALSE, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeMask, gptiForeground, IsHooked, IsWinEventNotifyDeferredOK, KeWaitForMultipleObjects(), LeaveCrit, MSGWAITCALLBACK, NT_SUCCESS, NTSTATUS(), NULL, tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, tagTHREADINFO::pEventQueueServer, PtiCurrent, SleepInputIdle(), Status, tagTHREADINFO::TIF_flags, TIF_SPINNING, UserMode, WHF_FOREGROUNDIDLE, WrUserRequest, xxxCallHook(), and zzzWakeInputIdle().

Referenced by xxxDesktopThread().

04276 { 04277 PTHREADINFO ptiCurrent = PtiCurrent(); 04278 NTSTATUS Status; 04279 04280 ptiCurrent = PtiCurrent(); 04281 UserAssert(IsWinEventNotifyDeferredOK()); 04282 04283 /* 04284 * Setup the wake mask for this thread. Wait for QS_EVENT or the app won't 04285 * get event messages like deactivate. 04286 */ 04287 ClearQueueServerEvent(QS_ALLINPUT | QS_EVENT); 04288 04289 /* 04290 * Stuff the event handle for the current queue at the end. 04291 */ 04292 apObjects[nCount] = ptiCurrent->pEventQueueServer; 04293 04294 /* 04295 * Check to see if any input came inbetween when we 04296 * last checked and the NtClearEvent() call. 04297 */ 04298 if (!(ptiCurrent->pcti->fsChangeBits & QS_ALLINPUT)) { 04299 04300 /* 04301 * This app is going idle. Clear the spin count check to see 04302 * if we need to make this process foreground again. 04303 */ 04304 if (ptiCurrent->TIF_flags & TIF_SPINNING) { 04305 CheckProcessForeground(ptiCurrent); 04306 } 04307 ptiCurrent->pClientInfo->cSpins = 0; 04308 04309 if (ptiCurrent == gptiForeground && 04310 IsHooked(ptiCurrent, WHF_FOREGROUNDIDLE)) { 04311 xxxCallHook(HC_ACTION, 0, 0, WH_FOREGROUNDIDLE); 04312 } 04313 04314 CheckForClientDeath(); 04315 04316 /* 04317 * Set the input idle event to wake up any threads waiting 04318 * for this thread to go into idle state. 04319 */ 04320 zzzWakeInputIdle(ptiCurrent); 04321 04322 Again: 04323 LeaveCrit(); 04324 04325 Status = KeWaitForMultipleObjects(nCount + 1, apObjects, 04326 WaitAny, WrUserRequest, 04327 UserMode, FALSE, 04328 NULL, WaitBlockArray); 04329 04330 EnterCrit(); 04331 04332 CheckForClientDeath(); 04333 04334 UserAssert(NT_SUCCESS(Status)); 04335 04336 04337 if ((Status == STATUS_WAIT_0) && (pfnNonMsg != NULL)) { 04338 /* 04339 * Call pfnNonMsg for the first event 04340 */ 04341 pfnNonMsg(DEVICE_TYPE_MOUSE); 04342 04343 /* 04344 * Setup again the wake mask for this thread. 04345 * Wait for QS_EVENT or the app won't 04346 * get event messages like deactivate. 04347 */ 04348 ptiCurrent->pcti->fsWakeMask = QS_ALLINPUT | QS_EVENT; 04349 goto Again; 04350 } 04351 04352 if (Status == (NTSTATUS)(STATUS_WAIT_0 + nCount)) { 04353 04354 /* 04355 * Reset the input idle event to block and threads waiting 04356 * for this thread to go into idle state. 04357 */ 04358 SleepInputIdle(ptiCurrent); 04359 } 04360 } else { 04361 Status = nCount; 04362 } 04363 04364 /* 04365 * Clear fsWakeMask since we're no longer waiting on the queue. 04366 */ 04367 ptiCurrent->pcti->fsWakeMask = 0; 04368 04369 return (DWORD)Status; 04370 }

VOID xxxNextWindow PQ  pq,
DWORD  wParam
 

Definition at line 1675 of file tmswitch.c.

References _GetAsyncKeyState(), _GetNextQueueWindow(), _PostMessage(), BOOL, ClearMF, DbgPrint, FALSE, FDIR_BACKWARD, FDIR_FORWARD, tagSwitchWndInfo::fJournaling, Getpswi(), GETPTI, GetTopLevelWindow(), gLangToggleKeyState, glinp, gpqForeground, gptiRit, grpdeskRitInput, gspwndActivate, gspwndAltTab, gspwndFullScreen, gwMouseOwnerButton, HW, InitSwitchWndInfo(), IsWinEventNotifyDeferred, KLT_NONE, Lock, MFUNDERLINE, NextTopWindow(), NTW_PREVIOUS, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, tagQ::ptiKeyboard, tagLASTINPUT::ptiLastWoken, PWND_BOTTOM, RevalidateHwnd, tagTHREADINFO::rpdesk, SetMF, Setpswi(), SFW_ACTIVATERESTORE, SFW_SWITCH, tagWND::spmenu, tagDESKTOPINFO::spwnd, tagQ::spwndActive, tagWND::spwndChild, tagQ::spwndFocus, SWITCHWNDCLASS, SwitchWndCleanup(), TestWF, ThreadLockAlwaysWithPti, ThreadLockPool, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPool, TIF_CSRSSTHREAD, TIF_SYSTEMTHREAD, TRUE, Unlock, VER40, VOID(), WEFTOPMOST, WFCHILD, xxxCancelCoolSwitch(), xxxCreateWindowEx(), xxxMoveSwitchWndHilite(), xxxSendMessageTimeout(), xxxSendNotifyMessage(), xxxSetForegroundWindow2(), xxxSetThreadDesktop(), xxxSetWindowPos(), and xxxShowSwitchWindow().

Referenced by xxxKeyEvent().

01678 { 01679 PWND pwndActivateNext; 01680 PWND pwndCurrentActivate, pwndCurrentTopFocus; 01681 int fDir; 01682 TL tlpwndActivateNext; 01683 TL tlpwndCurrentActivate; 01684 TL tlpwndT; 01685 PSWINFO pswCurrent; 01686 ULONG_PTR dwResult; 01687 BOOL fNonRit = FALSE; 01688 PTHREADINFO ptiCurrent = PtiCurrent(); 01689 PTHREADINFO ptiAltTab; 01690 01691 UserAssert(!IsWinEventNotifyDeferred()); 01692 01693 /* 01694 * HACK: We have a problem with direct-draw full apps where an alttab 01695 * window is created on a queue owned other than the RIT. This 01696 * shows up by alt-tabbing away from ROIDS.EXE during fullscreen. 01697 * 01698 * What is happening is on a ALT-TAB, from xxxSysCommand(), the 01699 * thread is not a rit. xxxSysCommand() calls xxxOldNextWindow 01700 * which finds that the current-thread doesn't have a switch 01701 * window, and then creates one on the current-thread-queue. 01702 * 01703 * The hack here is to make sure the calling thread is the RIT 01704 * before allowing any cool-switch creation. 01705 * 01706 * 21-Mar-1996 : Chriswil 01707 */ 01708 #if 0 01709 ptiAltTab = ptiCurrent; 01710 #else 01711 ptiAltTab = gptiRit; 01712 #endif 01713 01714 if (pq == NULL) 01715 return; 01716 01717 fDir = (_GetAsyncKeyState(VK_SHIFT) < 0) ? FDIR_BACKWARD : FDIR_FORWARD; 01718 01719 /* 01720 * NOTE: As of NT 4.0 the slow Alt+Tab functionality now officially acts 01721 * like Alt+Esc with the exception that Alt+Tab will activate the window 01722 * where Alt+Esc will not. 01723 */ 01724 switch (wParam) { 01725 01726 case VK_TAB: 01727 01728 if (gspwndAltTab == NULL) { 01729 01730 PWND pwndSwitch; 01731 TL tlpSwitchInfo; 01732 01733 /* 01734 * We are entering Alt+Tab for the first time, we need to 01735 * initialize the Switch Window structure and if needed 01736 * create and display the Alt+Tab window. We have two special 01737 * cases: (1) The user does not want to use the Switch window, 01738 * (2) The initialize switch window fails thus we will act 01739 * just like slow Alt+Tab 01740 */ 01741 01742 /* 01743 * Since Alt+Shift is the default hotkey for keyboard layout switching, 01744 * Alt+Shift+Tab may cause a KL switching while AltTab window is up. 01745 * To prevent it, we'd better reset the global toggle key state here, 01746 * so that xxxScanSysQueue will not confuse when it handles keyup messages. 01747 */ 01748 gLangToggleKeyState = KLT_NONE; 01749 01750 /* 01751 * Mouse buttons sometimes get stuck down due to hardware glitches, 01752 * usually due to input concentrator switchboxes or faulty serial 01753 * mouse COM ports, so clear the global button state here just in case, 01754 * otherwise we may not be able to change focus with the mouse. 01755 * Also do this in zzzCancelJournalling (Ctr-Esc, Ctrl-Alt-Del, etc.) 01756 */ 01757 #if DBG 01758 if (gwMouseOwnerButton) 01759 RIPMSG1(RIP_WARNING, 01760 "gwMouseOwnerButton=%x, being forcibly cleared\n", 01761 gwMouseOwnerButton); 01762 #endif 01763 gwMouseOwnerButton = 0; 01764 01765 /* 01766 * Determine the current active window. 01767 */ 01768 Lock(&gspwndActivate, pq->spwndActive); 01769 if (gspwndActivate == NULL) { 01770 Lock(&gspwndActivate, grpdeskRitInput->pDeskInfo->spwnd->spwndChild); 01771 } 01772 01773 if (!gspwndActivate) { 01774 return; 01775 } 01776 01777 /* 01778 * Make a local copy of gspwndActivate and lock it because xxxFreeWindow will 01779 * unlock if it is the window being freed. 01780 */ 01781 pwndCurrentActivate = gspwndActivate; 01782 ThreadLockAlwaysWithPti(ptiCurrent, pwndCurrentActivate, &tlpwndCurrentActivate); 01783 01784 /* 01785 * Cancel the active window's mode 01786 */ 01787 xxxSendMessageTimeout(pwndCurrentActivate, WM_CANCELMODE, 0, 0, SMTO_ABORTIFHUNG, 100, &dwResult); 01788 01789 /* 01790 * Initialize the Switch Window data structure, if we 01791 * succeed create and display the window, otherwise act 01792 * like slow Alt+Tab. 01793 */ 01794 pwndActivateNext = InitSwitchWndInfo(&pswCurrent, pwndCurrentActivate, fDir); 01795 01796 ThreadLockWithPti(ptiCurrent, pwndActivateNext, &tlpwndActivateNext); 01797 01798 if (pswCurrent == NULL) { 01799 /* 01800 * Couldn't initialize our switch window data structure, so we 01801 * will act like Alt+Esc. 01802 */ 01803 goto DoSlowAltTab; 01804 } 01805 01806 if (pwndActivateNext == NULL) { 01807 SwitchWndCleanup(&pswCurrent); 01808 ThreadUnlock(&tlpwndActivateNext); 01809 ThreadUnlock(&tlpwndCurrentActivate); 01810 Unlock(&gspwndActivate); 01811 return; 01812 } 01813 01814 ThreadLockPool(ptiCurrent, pswCurrent, &tlpSwitchInfo); 01815 01816 /* 01817 * Since we are in the RIT, test the physical state of the keyboard 01818 */ 01819 pswCurrent->fJournaling = FALSE; 01820 01821 /* 01822 * Create the Alt+Tab window 01823 */ 01824 pwndSwitch = 01825 xxxCreateWindowEx( WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME, 01826 (PLARGE_STRING)SWITCHWNDCLASS, NULL, 01827 WS_POPUP | WS_BORDER | WS_DISABLED, 01828 0, 0, 10, 10, NULL, NULL, NULL, NULL, VER40); 01829 01830 if (gspwndAltTab != NULL) { 01831 UserAssert(0); 01832 01833 _PostMessage(gspwndAltTab, WM_CLOSE, 0, 0); 01834 } 01835 01836 Lock(&gspwndAltTab, pwndSwitch); 01837 01838 ThreadUnlockPool(ptiCurrent, &tlpSwitchInfo); 01839 01840 if (gspwndAltTab == NULL) { 01841 /* 01842 * Could not create the cool switch window, do the Alt+Esc thing 01843 */ 01844 #ifdef COOLSWITCHTRACE 01845 DbgPrint("CoolSwitch: Could not create window (contact bradg).\n"); 01846 UserAssert(gspwndAltTab != NULL); 01847 #endif 01848 SwitchWndCleanup(&pswCurrent); 01849 goto DoSlowAltTab; 01850 } 01851 01852 /* 01853 * Save the pointer to the switch window info structure 01854 */ 01855 Setpswi(gspwndAltTab, pswCurrent); 01856 /* 01857 * Set gspwndActivate so the RIT knows what window we would like 01858 * it to activate. 01859 */ 01860 Lock(&gspwndActivate, pwndActivateNext); 01861 01862 /* 01863 * Make sure that our rit queue has the correct pdesk 01864 */ 01865 if (ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD) { 01866 xxxSetThreadDesktop(NULL, grpdeskRitInput); // DeferWinEventNotify() ?? IANJA ?? 01867 } 01868 01869 /* 01870 * If we're currently full screen tell console to switch to 01871 * the desktop to GDI mode; we can't do this on the RIT because 01872 * it can be slow. 01873 */ 01874 if (gspwndFullScreen != grpdeskRitInput->pDeskInfo->spwnd) { 01875 ThreadLockWithPti(ptiCurrent, grpdeskRitInput->pDeskInfo->spwnd, &tlpwndT); 01876 xxxSendNotifyMessage(grpdeskRitInput->pDeskInfo->spwnd, WM_FULLSCREEN, GDIFULLSCREEN, (LPARAM)HW(grpdeskRitInput->pDeskInfo->spwnd)); 01877 ThreadUnlock(&tlpwndT); 01878 } 01879 01880 /* 01881 * Show the Alt+Tab window. If it returns FALSE this means 01882 * the ALT key has been released, so there is no need to 01883 * paint the icons. 01884 */ 01885 ThreadLockAlwaysWithPti(ptiCurrent, gspwndAltTab, &tlpwndT); 01886 xxxShowSwitchWindow(gspwndAltTab); 01887 ThreadUnlock(&tlpwndT); 01888 01889 /* 01890 * Exit now because the Switch window will have been 01891 * already updated. 01892 */ 01893 ThreadUnlock(&tlpwndActivateNext); 01894 ThreadUnlock(&tlpwndCurrentActivate); 01895 01896 } else { 01897 01898 /* 01899 * We come here to do the actual switching and/or updating of 01900 * the switch window when in Alt+Tab mode. 01901 */ 01902 PWND pwndSwitch; 01903 TL tlpwndSwitch; 01904 PSWINFO pswCurrent; 01905 HWND hwndActivateNext; 01906 HWND hwndStop; 01907 01908 if (!(pwndSwitch = gspwndAltTab)) { 01909 01910 goto DoAltEsc; 01911 01912 } else { 01913 /* 01914 * Move the hilight rect to the next/prev task. It is possible 01915 * that some tasks were destoryed, so we need to skip those. 01916 */ 01917 pswCurrent = Getpswi(pwndSwitch); 01918 ThreadLockAlwaysWithPti(ptiCurrent, pwndSwitch, &tlpwndSwitch); 01919 hwndStop = NULL; 01920 do { 01921 hwndActivateNext = xxxMoveSwitchWndHilite(pwndSwitch, pswCurrent, fDir); 01922 if (!hwndStop) { 01923 hwndStop = hwndActivateNext; 01924 } else { 01925 if (hwndStop == hwndActivateNext) { 01926 pwndActivateNext = NULL; 01927 break; 01928 } 01929 } 01930 pwndActivateNext = RevalidateHwnd(hwndActivateNext); 01931 } while (!pwndActivateNext); 01932 ThreadUnlock(&tlpwndSwitch); 01933 Lock(&gspwndActivate, pwndActivateNext); 01934 if (!gspwndActivate) { 01935 /* 01936 * No Window to activate, bail out of Alt+Tab mode 01937 */ 01938 xxxCancelCoolSwitch(); 01939 } 01940 } 01941 } 01942 break; 01943 01944 DoAltEsc: 01945 case VK_ESCAPE: 01946 /* 01947 * NOTE: The RIT doesn't use gspwndActivate to activate the window when 01948 * processing Alt+Esc, we just use it here as a convenient 01949 * variable. The actual activation takes place below. 01950 */ 01951 pwndCurrentActivate = pq->spwndActive; 01952 if (pwndCurrentActivate == NULL) { 01953 pwndCurrentActivate = pq->ptiKeyboard->rpdesk->pDeskInfo->spwnd->spwndChild; 01954 } 01955 if (!pwndCurrentActivate) 01956 return; 01957 ThreadLockAlwaysWithPti(ptiCurrent, pwndCurrentActivate, &tlpwndCurrentActivate); 01958 01959 /* 01960 * Cancel the active window's mode 01961 */ 01962 xxxSendMessageTimeout(pwndCurrentActivate, WM_CANCELMODE, 0, 0, SMTO_ABORTIFHUNG, 100, &dwResult); 01963 01964 /* 01965 * Determine the next window to activate 01966 */ 01967 pwndActivateNext = _GetNextQueueWindow(pwndCurrentActivate, fDir, TRUE); 01968 ThreadLockWithPti(ptiCurrent, pwndActivateNext, &tlpwndActivateNext); 01969 01970 /* 01971 * If we're going forward through the windows, move the currently 01972 * active window to the bottom so we'll do the right thing when 01973 * we go backwards. 01974 */ 01975 if (pwndActivateNext != pwndCurrentActivate) { 01976 DoSlowAltTab: 01977 if (pwndActivateNext) { 01978 01979 /* 01980 * We're about to activate another window while the ALT key is down, 01981 * so let the current focus window know that it doesn't need the 01982 * menu underlines anymore 01983 */ 01984 pwndCurrentTopFocus = GetTopLevelWindow(pq->spwndFocus); 01985 if ((pwndCurrentTopFocus != NULL) && (pwndCurrentTopFocus->spmenu != NULL)) { 01986 ClearMF(pwndCurrentTopFocus->spmenu, MFUNDERLINE); 01987 } 01988 01989 if (fDir == FDIR_FORWARD) { 01990 /* 01991 * For Alt+ESC only move the window to the bottom if it's 01992 * not a top most window 01993 */ 01994 if (!TestWF(pwndCurrentActivate, WEFTOPMOST)) { 01995 xxxSetWindowPos(pwndCurrentActivate, PWND_BOTTOM, 0, 0, 0, 0, 01996 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | 01997 SWP_DEFERDRAWING | SWP_NOSENDCHANGING | 01998 SWP_ASYNCWINDOWPOS); 01999 } 02000 } 02001 02002 /* 02003 * The ALT key is down, so this window needs menu underlines 02004 */ 02005 if (pwndActivateNext->spmenu != NULL) { 02006 SetMF(pwndActivateNext->spmenu, MFUNDERLINE); 02007 } 02008 02009 02010 /* 02011 * This little ugly hack will cause xxxSetForegroundWindow2() 02012 * to send out an activation messages to a queue that is 02013 * already the active queue allowing us to change the active 02014 * window on that queue. 02015 */ 02016 if (gpqForeground == GETPTI(pwndActivateNext)->pq) 02017 gpqForeground = NULL; 02018 02019 /* 02020 * Make the selected window thread the owner of the last input; 02021 * since he's next, he owns the ALT-ESC. 02022 */ 02023 glinp.ptiLastWoken = GETPTI(pwndActivateNext); 02024 02025 xxxSetForegroundWindow2(pwndActivateNext, NULL, 02026 (wParam == VK_TAB) ? SFW_SWITCH | SFW_ACTIVATERESTORE : SFW_SWITCH); 02027 02028 /* 02029 * Win3.1 calls SetWindowPos() with activate, which z-orders 02030 * first regardless, then activates. Our code relies on 02031 * xxxActivateThisWindow() to z-order, and it'll only do 02032 * it if the window does not have the child bit set (regardless 02033 * that the window is a child of the desktop). 02034 * 02035 * To be compatible, we'll just force z-order here if the 02036 * window has the child bit set. This z-order is asynchronous, 02037 * so this'll z-order after the activate event is processed. 02038 * That'll allow it to come on top because it'll be foreground 02039 * then. (Grammatik has a top level window with the child 02040 * bit set that wants to be come the active window). 02041 */ 02042 if (wParam == VK_TAB && TestWF(pwndActivateNext, WFCHILD)) { 02043 xxxSetWindowPos(pwndActivateNext, (PWND)HWND_TOP, 0, 0, 0, 0, 02044 SWP_NOSIZE | SWP_NOMOVE | SWP_ASYNCWINDOWPOS); 02045 } 02046 } 02047 } 02048 ThreadUnlock(&tlpwndActivateNext); 02049 ThreadUnlock(&tlpwndCurrentActivate); 02050 break; 02051 02052 case VK_F6: 02053 if ((pwndCurrentActivate = pq->spwndActive) == NULL) 02054 pwndCurrentActivate = pq->ptiKeyboard->rpdesk->pDeskInfo->spwnd->spwndChild; 02055 02056 pwndActivateNext = pwndCurrentActivate; 02057 02058 /* 02059 * HACK! console sessions are all one thread but we want them 02060 * to act like different threads so if its a console thread (csrss.exe) 02061 * then ALT-F6 does nothing just like in Win 3.1 02062 * Note: we never get called with wParam == VK_F6 anyway. Win NT 3.51 02063 * doesn't seem to either, but Windows '95 does. BUG?? (IanJa) 02064 */ 02065 if (!(GETPTI(pwndActivateNext)->TIF_flags & TIF_CSRSSTHREAD)) { 02066 /* 02067 * on a alt-f6, we want to keep the switch within the thread. 02068 * We may want to rethink this because this will look strange 02069 * when you alt-f6 on a multi-threaded app we will not rotate 02070 * through the windows on the different threads. This works 02071 * fine on Win 3.x because it is single threaded. 02072 */ 02073 do { 02074 pwndActivateNext = NextTopWindow(pq->ptiKeyboard, pwndActivateNext, NULL, 02075 fDir ? NTW_PREVIOUS : 0); 02076 } while( (pwndActivateNext != NULL) && 02077 (GETPTI(pwndActivateNext) != pq->ptiKeyboard)); 02078 02079 if (pwndActivateNext != NULL) { 02080 02081 if (pwndActivateNext != pwndCurrentActivate) { 02082 /* 02083 * We're about to activate another window while the ALT key is down, 02084 * so let the current focus window know that it doesn't need the 02085 * menu underlines anymore 02086 */ 02087 pwndCurrentTopFocus = GetTopLevelWindow(pq->spwndFocus); 02088 if ((pwndCurrentTopFocus != NULL) && (pwndCurrentTopFocus->spmenu != NULL)) { 02089 ClearMF(pwndCurrentTopFocus->spmenu, MFUNDERLINE); 02090 } 02091 /* 02092 * The ALT key is down, so this window needs menu underlines 02093 */ 02094 if (pwndActivateNext->spmenu != NULL) { 02095 SetMF(pwndActivateNext->spmenu, MFUNDERLINE); 02096 } 02097 } 02098 02099 02100 ThreadLockAlwaysWithPti(ptiCurrent, pwndActivateNext, &tlpwndActivateNext); 02101 xxxSetWindowPos(pwndActivateNext, PWND_BOTTOM, 0, 0, 0, 0, 02102 SWP_DEFERDRAWING | SWP_NOSENDCHANGING | SWP_NOCHANGE | 02103 SWP_ASYNCWINDOWPOS); 02104 xxxSetForegroundWindow2(pwndActivateNext, NULL, SFW_SWITCH); 02105 ThreadUnlock(&tlpwndActivateNext); 02106 } 02107 } 02108 break; 02109 } 02110 }

VOID xxxNotifyIMEStatus IN PWND  pwnd,
IN DWORD  dwOpen,
IN DWORD  dwConversion
 

Definition at line 2295 of file ntimm.c.

References CheckLock, gdwIMEConversionStatus, gdwIMEOpenStatus, GETPTI, gHimcFocus, gptiForeground, tagKL::hkl, HWq, IsHooked, NlsKbdSendIMENotification(), NULL, tagTHREADINFO::pq, SetConvMode(), tagTHREADINFO::spklActive, VOID(), WHF_SHELL, and xxxCallHook().

Referenced by NtUserNotifyIMEStatus().

02299 { 02300 PTHREADINFO pti; 02301 02302 CheckLock(pwnd); 02303 02304 if ( (pti = GETPTI(pwnd)) != NULL && gptiForeground != NULL ) { 02305 if ( pti == gptiForeground || pti->pq == gptiForeground->pq ) { 02306 02307 if ( gHimcFocus != pwnd->hImc || 02308 gdwIMEOpenStatus != dwOpen || 02309 gdwIMEConversionStatus != dwConversion ) { 02310 02311 // 02312 // save the new status 02313 // 02314 gHimcFocus = pwnd->hImc; 02315 if ( gHimcFocus != (HIMC)NULL ) { 02316 02317 RIPMSG2(RIP_VERBOSE, "xxxNotifyIMEStatus: newOpen=%x newConv=%x", 02318 dwOpen, dwConversion); 02319 gdwIMEOpenStatus = dwOpen; 02320 gdwIMEConversionStatus = dwConversion; 02321 02322 // 02323 // set keyboard states that are related to IME conversion status 02324 // 02325 SetConvMode(pti, dwOpen ? dwConversion : 0); 02326 } 02327 02328 // 02329 // notify shell the IME status change 02330 // 02331 // Implementation note: [takaok 9/5/96] 02332 // 02333 // Using HSHELL_LANGUAGE is not the best way to inform shell 02334 // IME status change because we didn't change the keyboard layout. 02335 // ( The spec says HSHELL_LANGUAGE is for keyboard layout change. 02336 // Also passing window handle as WPARAM is not documented ) 02337 // 02338 // This is same as what Win95 does. I won't change this for now 02339 // because in the future shell will be developed by a different 02340 // group in MS. 02341 // 02342 // Currently only Korean Windows is interested in getting 02343 // the conversion status change. 02344 // 02345 if (IsHooked(pti, WHF_SHELL)) { 02346 HKL hkl = NULL; 02347 02348 if (pti->spklActive != NULL) { 02349 hkl = pti->spklActive->hkl; 02350 } 02351 xxxCallHook(HSHELL_LANGUAGE, (WPARAM)HWq(pwnd), (LPARAM)hkl, WH_SHELL); 02352 } 02353 02354 // 02355 // notify keyboard driver 02356 // 02357 NlsKbdSendIMENotification(dwOpen,dwConversion); 02358 } 02359 } 02360 } 02361 }

VOID xxxODI_ColorInit PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 1508 of file w32/ntuser/kernel/init.c.

References CI_GetClrVal(), FastGetProfileStringFromIDW(), gargbInitial, gpsi, INT, PMAP_COLORS, SSCF_FORCESOLIDCOLOR, SSCF_SETMAGICCOLORS, STR_COLOREND, STR_COLORSTART, szNull, VOID(), and xxxSetSysColors().

Referenced by InitUserScreen(), and xxxUpdatePerUserSystemParameters().

01509 { 01510 int i; 01511 COLORREF colorVals[STR_COLOREND - STR_COLORSTART + 1]; 01512 INT colorIndex[STR_COLOREND - STR_COLORSTART + 1]; 01513 WCHAR rgchValue[25]; 01514 01515 #if COLOR_MAX - (STR_COLOREND - STR_COLORSTART + 1) 01516 #error "COLOR_MAX value conflicts with STR_COLOREND - STR_COLORSTART" 01517 #endif 01518 01519 /* 01520 * Now set up default color values. 01521 * These are not in display drivers anymore since we just want default. 01522 * The real values are stored in the profile. 01523 */ 01524 RtlCopyMemory(gpsi->argbSystem, gargbInitial, sizeof(COLORREF) * COLOR_MAX); 01525 01526 for (i = 0; i < COLOR_MAX; i++) { 01527 01528 /* 01529 * Try to find a WIN.INI entry for this object. 01530 */ 01531 *rgchValue = 0; 01532 FastGetProfileStringFromIDW(pProfileUserName, 01533 PMAP_COLORS, 01534 STR_COLORSTART + i, 01535 szNull, 01536 rgchValue, 01537 sizeof(rgchValue) / sizeof(WCHAR) 01538 ); 01539 01540 /* 01541 * Convert the string into an RGB value and store. Use the 01542 * default RGB value if the profile value is missing. 01543 */ 01544 colorVals[i] = *rgchValue ? CI_GetClrVal(rgchValue) : gpsi->argbSystem[i]; 01545 colorIndex[i] = i; 01546 } 01547 01548 xxxSetSysColors(pProfileUserName, 01549 i, 01550 colorIndex, 01551 colorVals, 01552 SSCF_FORCESOLIDCOLOR | SSCF_SETMAGICCOLORS); 01553 }

BOOL xxxOldMessageBeep VOID   ) 
 

VOID xxxOldNextWindow UINT  flags  ) 
 

Definition at line 2121 of file tmswitch.c.

References _CallMsgFilter(), _GetKeyState(), _GetNextQueueWindow(), _PostMessage(), ALT_ESCAPE, ALT_F6, BOOL, FALSE, tagSwitchWndInfo::fJournaling, Getpswi(), GETPTI, gpqForeground, gptiRit, grpdeskRitInput, gspwndAltTab, gspwndFullScreen, HW, InitSwitchWndInfo(), IsWinEventNotifyDeferredOK, Lock, msg, NextTopWindow(), NTW_PREVIOUS, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, PtoH, PWND_BOTTOM, RevalidateHwnd, SCREEN_CAPTURE, Setpswi(), tagDESKTOPINFO::spwnd, tagQ::spwndActive, SWITCHWNDCLASS, SwitchWndCleanup(), TestWF, ThreadLockAlwaysWithPti, ThreadLockPool, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPool, TRUE, UINT, VER40, VOID(), WEFTOPMOST, WFMINIMIZED, xxxCancelCoolSwitch(), xxxCapture(), xxxCreateWindowEx(), xxxDispatchMessage(), xxxMoveSwitchWndHilite(), xxxPeekMessage, xxxReleaseCapture(), xxxSendNotifyMessage(), xxxSetForegroundWindow(), xxxSetWindowPos(), xxxShowSwitchWindow(), xxxTranslateMessage(), and xxxWaitMessage().

Referenced by xxxSysCommand().

02123 { 02124 MSG msg; 02125 HWND hwndSel; 02126 PWND pwndNewSel; 02127 PWND pwndSel; 02128 BOOL fType = 0; 02129 BOOL fDrawIcon; 02130 WORD vk; 02131 TL tlpwndT; 02132 TL tlpwndSel; 02133 TL tlpwndSwitch; 02134 PSWINFO pswCurrent; 02135 PWND pwndSwitch; 02136 HWND hwndStop; 02137 HWND hwndNewSel; 02138 PTHREADINFO ptiCurrent = PtiCurrent(); 02139 PTHREADINFO ptiAltTab; 02140 UserAssert(IsWinEventNotifyDeferredOK()); 02141 02142 /* 02143 * HACK: We have a problem with direct-draw full apps where an alttab 02144 * window is created on a queue owned other than the RIT. This 02145 * shows up by alt-tabbing away from ROIDS.EXE during fullscreen. 02146 * 02147 * What is happening is on a ALT-TAB, from xxxSysCommand(), the 02148 * thread is not a rit. xxxSysCommand() calls xxxOldNextWindow 02149 * which finds that the current-thread doesn't have a switch 02150 * window, and then creates one on the current-thread-queue. 02151 * 02152 * The hack here is to make sure the calling thread is the RIT 02153 * before allowing any cool-switch creation. 02154 * 02155 * 21-Mar-1996 : Chriswil 02156 */ 02157 #if 0 02158 ptiAltTab = ptiCurrent; 02159 #else 02160 ptiAltTab = gptiRit; 02161 #endif 02162 02163 /* 02164 * Don't allow entering this routine when we're already in the AltTab 02165 * mode. The AltTab window may have been created via xxxNextWindow. 02166 */ 02167 if (gspwndAltTab != NULL) 02168 return; 02169 02170 if ((pwndSel = ptiCurrent->pq->spwndActive) == NULL) 02171 return; 02172 02173 ThreadLockWithPti(ptiCurrent, pwndSel, &tlpwndSel); 02174 xxxCapture(ptiCurrent, pwndSel, SCREEN_CAPTURE); 02175 02176 vk = (WORD)flags; 02177 msg.wParam = (UINT)flags; 02178 02179 pwndNewSel = NULL; 02180 02181 if (vk == VK_TAB) { 02182 02183 TL tlpSwitchInfo; 02184 02185 /* 02186 * Initialize the Switch window data structures 02187 */ 02188 pwndNewSel = InitSwitchWndInfo(&pswCurrent, 02189 pwndSel, 02190 _GetKeyState(VK_SHIFT) < 0); 02191 02192 if (pswCurrent == NULL) { 02193 /* 02194 * We were unable to initialize the data structure used by 02195 * the Switch window, so we will act like Alt+Esc. 02196 */ 02197 } else { 02198 02199 PWND pwndSwitch; 02200 02201 /* 02202 * We are doing a journal playback do use _GetKeyState to 02203 * test the keyboard 02204 */ 02205 pswCurrent->fJournaling = TRUE; 02206 02207 ThreadLockPool(ptiCurrent, pswCurrent, &tlpSwitchInfo); 02208 02209 /* 02210 * Attempt to create the Switch Window 02211 */ 02212 02213 pwndSwitch = 02214 xxxCreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME, 02215 (PLARGE_STRING)SWITCHWNDCLASS, 02216 NULL, 02217 WS_POPUP | WS_BORDER | WS_DISABLED, 02218 0, 02219 0, 02220 10, 02221 10, 02222 NULL, 02223 NULL, 02224 NULL, 02225 NULL, 02226 VER40); 02227 02228 if (gspwndAltTab != NULL) { 02229 UserAssert(0); 02230 02231 _PostMessage(gspwndAltTab, WM_CLOSE, 0, 0); 02232 } 02233 02234 ThreadUnlockPool(ptiCurrent, &tlpSwitchInfo); 02235 02236 Lock(&gspwndAltTab, pwndSwitch); 02237 02238 02239 if (!(pwndSwitch = gspwndAltTab)) { 02240 02241 SwitchWndCleanup(&pswCurrent); 02242 02243 } else { 02244 /* 02245 * Lock the switch window 02246 */ 02247 ThreadLockAlwaysWithPti(ptiCurrent, pwndSwitch, &tlpwndSwitch); 02248 02249 /* 02250 * Save the switch window info 02251 */ 02252 Setpswi(pwndSwitch, pswCurrent); 02253 02254 // Don't we need to switch from full screen mode if needed? 02255 #if 0 02256 /* 02257 * If we're currently full screen tell console to switch to 02258 * the desktop to GDI mode; we can't do this on the RIT because 02259 * it can be slow. 02260 */ 02261 if (gspwndFullScreen != grpdeskRitInput->pDeskInfo->spwnd) { 02262 ThreadLockWithPti(pti, grpdeskRitInput->pDeskInfo->spwnd, &tlpwndT); 02263 xxxSendNotifyMessage(grpdeskRitInput->pDeskInfo->spwnd, WM_FULLSCREEN, GDIFULLSCREEN, (LONG)HW(grpdeskRitInput->pDeskInfo->spwnd)); 02264 ThreadUnlock(&tlpwndT); 02265 } 02266 #endif 02267 02268 /* 02269 * Show the switch window, this also will paint the window 02270 */ 02271 xxxShowSwitchWindow(gspwndAltTab); 02272 ThreadUnlock(&tlpwndSwitch); 02273 } 02274 } 02275 02276 } 02277 02278 if (!pwndNewSel) 02279 goto StartTab; 02280 02281 pwndSel = pwndNewSel; 02282 02283 while (TRUE) { 02284 02285 hwndSel = PtoH(pwndSel); 02286 /* 02287 * Wait for a message without getting it out of the queue. 02288 */ 02289 while (!xxxPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD)) 02290 xxxWaitMessage(); 02291 02292 if ((pwndSel = RevalidateHwnd(hwndSel)) == NULL) 02293 pwndSel = ptiCurrent->pq->spwndActive; 02294 02295 if (_CallMsgFilter(&msg, MSGF_NEXTWINDOW)) { 02296 /* 02297 * Swallow the message if the hook processed it 02298 */ 02299 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 02300 continue; 02301 } 02302 02303 /* 02304 * If we are doing Alt+Tab and some other key comes in (other than 02305 * tab, escape or shift), then bomb out of this loop and leave that 02306 * key in the queue. 02307 */ 02308 if ((msg.message == WM_SYSKEYDOWN) && gspwndAltTab != NULL) { 02309 02310 vk = (WORD)msg.wParam; 02311 02312 if ((vk != VK_TAB) && (vk != VK_ESCAPE) && (vk != VK_SHIFT)) { 02313 pwndSel = ptiCurrent->pq->spwndActive; 02314 fType = 0; 02315 goto Exit; 02316 } 02317 } 02318 02319 switch (msg.message) { 02320 02321 case WM_CANCELJOURNAL: 02322 /* 02323 * If journalling was canceled we need to exit our loop and 02324 * remove the Alt+Tab window. We don't want to remove this 02325 * meesage because we want the app to know that journalling 02326 * was canceled. 02327 */ 02328 02329 /* > > > F A L L T H R O U G H < < < */ 02330 02331 case WM_LBUTTONDOWN: 02332 case WM_LBUTTONUP: 02333 case WM_RBUTTONDOWN: 02334 case WM_RBUTTONUP: 02335 case WM_MBUTTONDOWN: 02336 case WM_MBUTTONUP: 02337 case WM_XBUTTONDOWN: 02338 case WM_XBUTTONUP: 02339 /* 02340 * If mouse message, cancel and get out of loop. 02341 */ 02342 pwndSel = ptiCurrent->pq->spwndActive; 02343 fType = 0; 02344 goto Exit; 02345 02346 case WM_KEYUP: 02347 case WM_KEYDOWN: 02348 case WM_SYSCHAR: 02349 case WM_SYSKEYUP: 02350 case WM_MOUSEMOVE: 02351 /* 02352 * Swallow the message 02353 */ 02354 hwndSel = PtoH(pwndSel); 02355 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 02356 02357 if ((pwndSel = RevalidateHwnd(hwndSel)) == NULL) 02358 pwndSel = ptiCurrent->pq->spwndActive; 02359 02360 if (msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP) { 02361 02362 vk = (WORD)msg.wParam; 02363 02364 /* 02365 * If alt-tab up, then exit. 02366 */ 02367 if (vk == VK_MENU) { 02368 /* 02369 * If doing Alt+Esc, wait for up of ESC to get out. 02370 */ 02371 if (gspwndAltTab == NULL) 02372 break; 02373 02374 fType = 0; 02375 goto Exit; 02376 02377 } else if (vk == VK_ESCAPE || vk == VK_F6) { 02378 /* 02379 * Get out on up transition of ESC or F6 keys. 02380 */ 02381 if (gspwndAltTab != NULL) { 02382 02383 pwndSel = ptiCurrent->pq->spwndActive; 02384 fType = 0; 02385 02386 } else { 02387 02388 fType = ((vk == VK_ESCAPE) ? ALT_ESCAPE : ALT_F6); 02389 } 02390 02391 goto Exit; 02392 } 02393 02394 } else if (msg.message == WM_KEYDOWN) { 02395 /* 02396 * Exit out loop is a stray key stroke comes through. In 02397 * particular look for VK_CONTROL. 02398 */ 02399 pwndSel = ptiCurrent->pq->spwndActive; 02400 fType = 0; 02401 goto Exit; 02402 } 02403 break; 02404 02405 case WM_SYSKEYDOWN: 02406 vk = (WORD)msg.wParam; 02407 02408 switch (vk) { 02409 02410 case VK_SHIFT: 02411 case VK_TAB: 02412 case VK_ESCAPE: 02413 case VK_F6: 02414 02415 hwndSel = PtoH(pwndSel); 02416 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 02417 02418 if ((pwndSel = RevalidateHwnd(hwndSel)) == NULL) 02419 pwndSel = ptiCurrent->pq->spwndActive; 02420 02421 if (!(vk == VK_TAB)) 02422 break; 02423 StartTab: 02424 if (vk == VK_ESCAPE) { 02425 pwndNewSel = _GetNextQueueWindow( 02426 pwndSel, 02427 _GetKeyState(VK_SHIFT) < 0, 02428 TRUE); 02429 02430 if (pwndNewSel == NULL) 02431 break; 02432 02433 fType = ALT_ESCAPE; 02434 pwndSel = pwndNewSel; 02435 02436 /* 02437 * Wait until ESC goes up to activate new window. 02438 */ 02439 break; 02440 } 02441 if (vk == VK_F6) { 02442 02443 PWND pwndFirst; 02444 PWND pwndSaveSel = pwndSel; 02445 02446 /* 02447 * Save the first returned window to act as a limit 02448 * to the search because NextTopWindow will return NULL 02449 * only if pwndSel is the only window that meets its 02450 * selection criteria. 02451 * 02452 * This prevents a hang that can occur in winword or 02453 * excel when then Alt-F4-F6 key combination is hit 02454 * and unsaved changes exist. 02455 */ 02456 pwndFirst = pwndNewSel = (PWND)NextTopWindow(ptiCurrent, pwndSel, NULL, 02457 _GetKeyState(VK_SHIFT) < 0 ? NTW_PREVIOUS : 0); 02458 02459 while (TRUE) { 02460 02461 /* 02462 * If pwndNewSel is NULL, pwndSel is the only candidate. 02463 */ 02464 if (pwndNewSel == NULL) 02465 break; 02466 02467 pwndSel = pwndNewSel; 02468 02469 /* 02470 * If the window is on the same thread, wait until 02471 * F6 goes up to activate new window. 02472 */ 02473 if (GETPTI(pwndSel) == ptiCurrent) 02474 break; 02475 02476 pwndNewSel = (PWND)NextTopWindow(ptiCurrent, pwndSel, NULL, 02477 _GetKeyState(VK_SHIFT) < 0 ? NTW_PREVIOUS : 0); 02478 02479 /* 02480 * If we've looped around, use the original window. 02481 * Wait until F6 goes up to activate new window. 02482 */ 02483 if (pwndNewSel == pwndFirst) { 02484 pwndSel = pwndSaveSel; 02485 break; 02486 } 02487 } 02488 break; 02489 } 02490 02491 /* 02492 * Here for the Alt+Tab case 02493 */ 02494 if ((pwndSwitch = gspwndAltTab) != NULL) { 02495 pswCurrent = Getpswi(pwndSwitch); 02496 ThreadLockWithPti(ptiCurrent, pwndSwitch, &tlpwndSwitch); 02497 hwndStop = NULL; 02498 do { 02499 02500 hwndNewSel = xxxMoveSwitchWndHilite( 02501 pwndSwitch, 02502 pswCurrent, 02503 _GetKeyState(VK_SHIFT) < 0); 02504 02505 if (!hwndStop) { 02506 hwndStop = hwndNewSel; 02507 } else { 02508 if (hwndStop == hwndNewSel) { 02509 pwndNewSel = NULL; 02510 break; 02511 } 02512 } 02513 pwndNewSel = RevalidateHwnd(hwndNewSel); 02514 } while (!pwndNewSel); 02515 ThreadUnlock(&tlpwndSwitch); 02516 pwndSel = pwndNewSel; 02517 02518 } else { 02519 02520 pwndNewSel = _GetNextQueueWindow( 02521 pwndSel, 02522 _GetKeyState(VK_SHIFT) < 0, 02523 FALSE); 02524 02525 if (pwndNewSel && pwndNewSel != pwndSel) { 02526 02527 if (!TestWF(pwndSel, WEFTOPMOST)) { 02528 /* 02529 * Force the old window to the bottom 02530 */ 02531 ThreadLockWithPti(ptiCurrent, pwndSel, &tlpwndT); 02532 xxxSetWindowPos(pwndSel, 02533 PWND_BOTTOM, 02534 0, 02535 0, 02536 0, 02537 0, 02538 SWP_NOMOVE | 02539 SWP_NOSIZE | 02540 SWP_NOACTIVATE | 02541 SWP_DEFERDRAWING | 02542 SWP_NOSENDCHANGING | 02543 SWP_ASYNCWINDOWPOS); 02544 ThreadUnlock(&tlpwndT); 02545 } 02546 02547 pwndSel = pwndNewSel; // Will be revalidated at top of loop 02548 } 02549 } 02550 break; 02551 02552 default: 02553 goto Exit; 02554 } 02555 break; 02556 02557 default: 02558 hwndSel = PtoH(pwndSel); 02559 xxxPeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE); 02560 xxxTranslateMessage(&msg, 0); 02561 xxxDispatchMessage(&msg); 02562 02563 if ((pwndSel = RevalidateHwnd(hwndSel)) == NULL) 02564 pwndSel = ptiCurrent->pq->spwndActive; 02565 02566 break; 02567 } 02568 } 02569 02570 Exit: 02571 xxxReleaseCapture(); 02572 02573 fDrawIcon = (gspwndAltTab != NULL); 02574 02575 /* 02576 * If this is an Alt-Escape we also have to send the current window 02577 * to the bottom. 02578 */ 02579 if (fType == ALT_ESCAPE) { 02580 02581 PWND pwndActive; 02582 02583 if (gpqForeground) { 02584 02585 pwndActive = gpqForeground->spwndActive; 02586 02587 if (pwndActive && (pwndActive != pwndSel)) { 02588 ThreadLockWithPti(ptiCurrent, pwndActive, &tlpwndT); 02589 xxxSetWindowPos(pwndActive, 02590 PWND_BOTTOM, 02591 0, 02592 0, 02593 0, 02594 0, 02595 SWP_NOMOVE | 02596 SWP_NOSIZE | 02597 SWP_NOACTIVATE | 02598 SWP_DEFERDRAWING | 02599 SWP_NOSENDCHANGING | 02600 SWP_ASYNCWINDOWPOS); 02601 ThreadUnlock(&tlpwndT); 02602 } 02603 } 02604 } 02605 02606 if (pwndSel) { 02607 ThreadLockWithPti(ptiCurrent, pwndSel, &tlpwndT); 02608 xxxSetForegroundWindow(pwndSel, FALSE); 02609 02610 if (TestWF(pwndSel, WFMINIMIZED)) { 02611 02612 if ((fType == 0) && fDrawIcon) 02613 _PostMessage(pwndSel, WM_SYSCOMMAND, (UINT)SC_RESTORE, 0); 02614 02615 } 02616 ThreadUnlock(&tlpwndT); 02617 } 02618 02619 /* 02620 * destroy the alt-tab window 02621 */ 02622 xxxCancelCoolSwitch(); 02623 02624 ThreadUnlock(&tlpwndSel); 02625 }

BOOL xxxOpenClipboard PWND  pwnd,
LPBOOL  lpfEmptyClient
 

Definition at line 124 of file ntuser/kernel/clipbrd.c.

References BOOL, CheckClipboardAccess(), CheckLock, FALSE, GETPTI, tagWINDOWSTATION::iClipSerialNumber, tagPROCESSINFO::iClipSerialNumber, Lock, NULL, tagTHREADINFO::ppi, tagWINDOWSTATION::ptiClipLock, PtiCurrent, tagWINDOWSTATION::spwndClipOpen, tagWINDOWSTATION::spwndClipOwner, TestWF, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, and WFDESTROYED.

Referenced by NtUserOpenClipboard(), and xxxSnapWindow().

00127 { 00128 PTHREADINFO pti; 00129 PWINDOWSTATION pwinsta; 00130 00131 CheckLock(pwnd); 00132 00133 if (lpfEmptyClient != NULL) 00134 *lpfEmptyClient = FALSE; 00135 00136 /* 00137 * Blow it off is the caller does not have the proper access rights 00138 */ 00139 if ((pwinsta = CheckClipboardAccess()) == NULL) 00140 return FALSE; 00141 00142 pti = PtiCurrent(); 00143 00144 /* 00145 * If this thread already has the clipboard open, then there's no 00146 * need to proceed further. 00147 */ 00148 if ((pwnd == pwinsta->spwndClipOpen) && (pti == pwinsta->ptiClipLock)) 00149 return TRUE; 00150 00151 if ((pwnd != pwinsta->spwndClipOpen) && (pwinsta->ptiClipLock != NULL)) { 00152 00153 #if DBG 00154 /* 00155 * Only rip if the current-thread doesn't have the clipboard 00156 * open. 00157 */ 00158 if (pti != pwinsta->ptiClipLock) { 00159 00160 RIPMSG0(RIP_VERBOSE, 00161 "Clipboard: OpenClipboard already out by another thread"); 00162 } 00163 #endif 00164 return FALSE; 00165 } 00166 00167 /* 00168 * If the window is already destroyed, then the clipboard will not 00169 * get disowned when the window is finally unlocked. FritzS 00170 */ 00171 00172 UserAssert((pwnd == NULL ) || (!TestWF(pwnd, WFDESTROYED))); 00173 00174 Lock(&pwinsta->spwndClipOpen, pwnd); 00175 pwinsta->ptiClipLock = pti; 00176 00177 /* 00178 * The client side clipboard cache needs to be emptied if this thread 00179 * doesn't own the data in the clipboard. 00180 * Note: We only empty the 16bit clipboard if a 32bit guy owns the 00181 * clipboard. 00182 * Harvard graphics uses a handle put into the clipboard 00183 * by another app, and it expects that handle to still be good after the 00184 * clipboard has opened and closed mutilple times 00185 * There may be a problem here if app A puts in format foo and app B opens 00186 * the clipboard for format foo and then closes it and opens it again 00187 * format foo client side handle may not be valid. We may need some 00188 * sort of uniqueness counter to tell if the client side handle is 00189 * in sync with the server and always call the server or put the data 00190 * in share memory with some semaphore. 00191 * 00192 * pwinsta->spwndClipOwner: window that last called EmptyClipboard 00193 * pwinsta->ptiClipLock : thread that currently has the clipboard open 00194 */ 00195 if (lpfEmptyClient != NULL) { 00196 00197 if (!(pti->TIF_flags & TIF_16BIT) || 00198 (pti->ppi->iClipSerialNumber != pwinsta->iClipSerialNumber)) { 00199 00200 *lpfEmptyClient = (pwinsta->spwndClipOwner == NULL) || 00201 (pwinsta->ptiClipLock->ppi != 00202 GETPTI(pwinsta->spwndClipOwner)->ppi); 00203 00204 pti->ppi->iClipSerialNumber = pwinsta->iClipSerialNumber; 00205 } 00206 } 00207 00208 return TRUE; 00209 }

HDESK xxxOpenDesktop POBJECT_ATTRIBUTES  ,
KPROCESSOR_MODE  ,
DWORD  ,
DWORD  ,
BOOL * 
 

Definition at line 3265 of file desktop.c.

References CloseProtectedHandle(), dwFlags, tagDESKTOP::dwSessionId, Error, ExDesktopObjectType, FALSE, gSessionId, HF_PROTECTED, KernelMode, LogDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObOpenObjectByName(), ObReferenceObjectByHandle(), OpenDesktopCompletion(), PtiCurrent, SetHandleFlag(), Status, TRACE_INIT, and TRUE.

Referenced by NtUserOpenDesktop(), xxxResolveDesktop(), and xxxResolveDesktopForWOW().

03271 { 03272 HDESK hdesk; 03273 PDESKTOP pdesk; 03274 NTSTATUS Status; 03275 03276 /* 03277 * Require read/write access 03278 */ 03279 dwDesiredAccess |= DESKTOP_READOBJECTS | DESKTOP_WRITEOBJECTS; 03280 03281 /* 03282 * Open the desktop -- Ob routines capture Obj attributes. 03283 */ 03284 Status = ObOpenObjectByName( 03285 ccxObjA, 03286 *ExDesktopObjectType, 03287 AccessMode, 03288 NULL, 03289 dwDesiredAccess, 03290 NULL, 03291 &hdesk); 03292 if (!NT_SUCCESS(Status)) { 03293 RIPNTERR0(Status, RIP_VERBOSE, ""); 03294 return NULL; 03295 } 03296 03297 /* 03298 * Reference the desktop 03299 */ 03300 ObReferenceObjectByHandle( 03301 hdesk, 03302 0, 03303 *ExDesktopObjectType, 03304 KernelMode, 03305 &pdesk, 03306 NULL); 03307 if (!NT_SUCCESS(Status)) { 03308 RIPNTERR0(Status, RIP_VERBOSE, ""); 03309 03310 Error: 03311 CloseProtectedHandle(hdesk); 03312 return NULL; 03313 } 03314 03315 if (pdesk->dwSessionId != gSessionId) { 03316 RIPNTERR1(STATUS_INVALID_HANDLE, RIP_WARNING, 03317 "xxxOpenDesktop pdesk %#p belongs to a different session", 03318 pdesk); 03319 ObDereferenceObject(pdesk); 03320 goto Error; 03321 } 03322 03323 LogDesktop(pdesk, LD_REF_FN_OPENDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 03324 03325 /* 03326 * Complete the desktop open 03327 */ 03328 if (!OpenDesktopCompletion(pdesk, hdesk, dwFlags, pbShutDown)) { 03329 CloseProtectedHandle(hdesk); 03330 hdesk = NULL; 03331 } 03332 03333 TRACE_INIT(("xxxOpenDesktop: Leaving\n")); 03334 03335 LogDesktop(pdesk, LD_DEREF_FN_OPENDESKTOP, FALSE, (ULONG_PTR)PtiCurrent()); 03336 ObDereferenceObject(pdesk); 03337 03338 if (hdesk != NULL) { 03339 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 03340 } 03341 03342 return hdesk; 03343 }

BOOL xxxPaintRect PWND  ,
PWND  ,
HDC  ,
HBRUSH  ,
LPRECT 
 

Definition at line 72 of file paint.c.

References BOOL, CheckLock, FillRect(), NULL, PtiCurrent, PWNDDESKTOP, tagWND::rcClient, TRUE, and xxxGetControlColor().

Referenced by xxxFillWindow().

00078 { 00079 POINT ptOrg; 00080 00081 CheckLock(pwndBrush); 00082 CheckLock(pwndPaint); 00083 00084 if (pwndBrush == NULL) { 00085 pwndBrush = PtiCurrent()->rpdesk->pDeskInfo->spwnd; 00086 } 00087 00088 if (pwndBrush == PWNDDESKTOP(pwndBrush)) { 00089 GreSetBrushOrg( 00090 hdc, 00091 0, 00092 0, 00093 &ptOrg); 00094 } else { 00095 GreSetBrushOrg( 00096 hdc, 00097 pwndBrush->rcClient.left - pwndPaint->rcClient.left, 00098 pwndBrush->rcClient.top - pwndPaint->rcClient.top, 00099 &ptOrg); 00100 } 00101 00102 /* 00103 * If hbr < CTLCOLOR_MAX, it isn't really a brush but is one of our 00104 * special color values. Translate it to the appropriate WM_CTLCOLOR 00105 * message and send it off to get back a real brush. The translation 00106 * process assumes the CTLCOLOR*** and WM_CTLCOLOR*** values map directly. 00107 */ 00108 if (hbr < (HBRUSH)CTLCOLOR_MAX) { 00109 hbr = xxxGetControlColor(pwndBrush, 00110 pwndPaint, 00111 hdc, 00112 HandleToUlong(hbr) + WM_CTLCOLORMSGBOX); 00113 } 00114 00115 FillRect(hdc, lprc, hbr); 00116 00117 GreSetBrushOrg(hdc, ptOrg.x, ptOrg.y, NULL); 00118 00119 00120 return TRUE; 00121 }

VOID xxxProcessAsyncSendMessage PASYNCSENDMSG  pmsg  ) 
 

Definition at line 2891 of file kernel/sendmsg.c.

Referenced by xxxProcessEventMessage().

02900 : 02901 * 05-12-94 JimA Created. 02902 \***************************************************************************/ 02903 02904 VOID xxxProcessAsyncSendMessage( 02905 PASYNCSENDMSG pmsg) 02906 { 02907 PWND pwnd; 02908 TL tlpwndT; 02909 WCHAR awchString[MAX_PATH]; 02910 ATOM Atom = 0; 02911 LARGE_UNICODE_STRING str; 02912 02913 pwnd = RevalidateHwnd(pmsg->hwnd); 02914 if (pwnd != NULL) { 02915 ThreadLockAlways(pwnd, &tlpwndT); 02916 switch (pmsg->message) { 02917 case WM_WININICHANGE: 02918 case WM_DEVMODECHANGE: 02919 if (pmsg->lParam) { 02920 if (UserGetAtomName((ATOM)pmsg->lParam, awchString, sizeof(awchString))) { 02921 Atom = (ATOM)pmsg->lParam; 02922 RtlInitLargeUnicodeString(&str, awchString, (UINT)-1); 02923 pmsg->lParam = (LPARAM)&str; 02924 } else { 02925 UserAssert(FALSE); pmsg->lParam = 0;

VOID xxxProcessEventMessage PTHREADINFO  ptiCurrent,
PQMSG  pqmsg
 

Definition at line 3772 of file queue.c.

References _PostMessage(), ATW_ASYNC, ATW_NOZORDER, ATW_SETFOCUS, BOOL, CBKEYSTATE, CleanEventMessage(), DF_MOUSEMOVETRK, DF_TOOLTIP, DF_TOOLTIPACTIVE, DF_TOOLTIPSHOWING, DF_TRACKMOUSELEAVE, DoBeep(), tagDESKTOP::dwDTFlags, DWORD, tagQMSG::dwQEvent, GetMouseKeyFlags(), GETPTI, gpqForeground, tagDESKTOP::htEx, IsHooked, IsWinEventNotifyDeferredOK, LockWindowUpdate2(), tagQMSG::msg, NULL, PBYTE, PEM_ACTIVATE_NOZORDER, PEM_ACTIVATE_RESTORE, pfnBP, PostEventMessage(), PostShellHookMessages(), tagTHREADINFO::ppi, tagTHREADINFO::pq, ProcessUpdateKeyStateEvent(), PtiCurrent, PtoHq, PTOOLTIPWND, PWND_TOP, QEVENT_ACTIVATE, QEVENT_APPCOMMAND, QEVENT_ASYNCSENDMSG, QEVENT_CANCELMODE, QEVENT_CANCELMOUSEMOVETRK, QEVENT_DEACTIVATE, QEVENT_DESTROYWINDOW, QEVENT_HUNGTHREAD, QEVENT_NOTIFYWINEVENT, QEVENT_POSTMESSAGE, QEVENT_RITACCESSIBILITY, QEVENT_RITSOUND, QEVENT_SETWINDOWPOS, QEVENT_SHOWWINDOW, QEVENT_UPDATEKEYSTATE, RevalidateHwnd, RITSOUND_DOBEEP, RITSOUND_DOWNSIREN, RITSOUND_HIGHBEEP, RITSOUND_KEYCLICK, RITSOUND_LOWBEEP, RITSOUND_UPSIREN, tagTHREADINFO::rpdesk, SetWakeBit(), tagQ::spwndActive, tagQ::spwndCapture, tagQ::spwndFocus, tagDESKTOP::spwndTooltip, tagDESKTOP::spwndTrack, TestUP, TestWF, ThreadLockAlwaysWithPti, ThreadLockPoolCleanup, ThreadUnlock, ThreadUnlockPoolCleanup, TIF_ALLOWFOREGROUNDACTIVATE, tagTHREADINFO::TIF_flags, TRUE, UINT, VOID(), WEF_ASYNC, WEF_POSTED, WFCHILD, WFINDESTROY, WFMINIMIZED, WHF_SHELL, WPUpdateCheckPointSettings(), xxxActivateThisWindow(), xxxCallHook(), xxxCancelMouseMoveTracking(), xxxCancelTracking(), xxxDeactivate(), xxxDestroyWindow(), xxxFreeWindow(), xxxProcessAsyncSendMessage(), xxxProcessHungThreadEvent(), xxxProcessNotifyWinEvent(), xxxProcessSetWindowPosEvent(), xxxResetTooltip(), xxxSendMessage(), xxxSetForegroundWindow2(), xxxSetWindowPos(), xxxShowWindow(), xxxUpdateTray(), zzzActiveCursorTracking(), and zzzClipCursor().

Referenced by xxxScanSysQueue().

03775 { 03776 PWND pwnd; 03777 TL tlpwndT; 03778 TL tlMsg; 03779 PQ pq; 03780 03781 UserAssert(IsWinEventNotifyDeferredOK()); 03782 UserAssert(ptiCurrent == PtiCurrent()); 03783 03784 ThreadLockPoolCleanup(ptiCurrent, pqmsg, &tlMsg, CleanEventMessage); 03785 03786 pq = ptiCurrent->pq; 03787 switch (pqmsg->dwQEvent) { 03788 case QEVENT_DESTROYWINDOW: 03789 /* 03790 * These events are posted from xxxDW_DestroyOwnedWindows 03791 * for owned windows that are not owned by the owner 03792 * window thread. 03793 */ 03794 pwnd = RevalidateHwnd((HWND)pqmsg->msg.wParam); 03795 if (pwnd != NULL) { 03796 if (!TestWF(pwnd, WFCHILD)) 03797 xxxDestroyWindow(pwnd); 03798 else { 03799 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 03800 xxxFreeWindow(pwnd, &tlpwndT); 03801 } 03802 } 03803 break; 03804 03805 case QEVENT_SHOWWINDOW: 03806 /* 03807 * These events are mainly used from within CascadeChildWindows() 03808 * and TileChildWindows() so that taskmgr doesn't hang while calling 03809 * these apis if it is trying to tile or cascade a hung application. 03810 */ 03811 /* The HIWORD of lParam now has the preserved state of gfAnimate at the 03812 * time of the call. 03813 */ 03814 pwnd = RevalidateHwnd((HWND)pqmsg->msg.wParam); 03815 if (pwnd != NULL && !TestWF(pwnd, WFINDESTROY)) { 03816 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 03817 xxxShowWindow(pwnd, (DWORD)pqmsg->msg.lParam); 03818 /* 03819 * If this is coming from an async SetWindowPlacement, update the 03820 * check point settings if the window is minimized. 03821 */ 03822 if ((pqmsg->msg.message & WPF_ASYNCWINDOWPLACEMENT) 03823 && TestWF(pwnd, WFMINIMIZED)) { 03824 03825 WPUpdateCheckPointSettings(pwnd, (UINT)pqmsg->msg.message); 03826 } 03827 ThreadUnlock(&tlpwndT); 03828 } 03829 break; 03830 03831 case QEVENT_NOTIFYWINEVENT: 03832 UserAssert(((PNOTIFY)pqmsg->msg.lParam)->dwWEFlags & WEF_POSTED); 03833 UserAssert(((PNOTIFY)pqmsg->msg.lParam)->dwWEFlags & WEF_ASYNC); 03834 xxxProcessNotifyWinEvent((PNOTIFY)pqmsg->msg.lParam); 03835 break; 03836 03837 case QEVENT_SETWINDOWPOS: 03838 /* 03839 * QEVENT_SETWINDOWPOS events are generated when a thread calls 03840 * SetWindowPos with a list of windows owned by threads other than 03841 * itself. This way all WINDOWPOSing on a window is done the thread 03842 * that owns (created) the window and we don't have any of those 03843 * nasty inter-thread synchronization problems. 03844 */ 03845 xxxProcessSetWindowPosEvent((PSMWP)pqmsg->msg.wParam); 03846 break; 03847 03848 case QEVENT_UPDATEKEYSTATE: 03849 /* 03850 * Update the local key state with the state from those 03851 * keys that have changed since the last time key state 03852 * was synchronized. 03853 */ 03854 ProcessUpdateKeyStateEvent(pq, (PBYTE)pqmsg->msg.wParam, (PBYTE)pqmsg->msg.wParam + CBKEYSTATE); 03855 break; 03856 03857 case QEVENT_ACTIVATE: 03858 { 03859 if (pqmsg->msg.lParam == 0) { 03860 03861 /* 03862 * Clear any visible tracking going on in system. We 03863 * only bother to do this if lParam == 0 since 03864 * xxxSetForegroundWindow2() deals with this in the 03865 * other case. 03866 */ 03867 xxxCancelTracking(); 03868 03869 /* 03870 * Remove the clip cursor rectangle - it is a global mode that 03871 * gets removed when switching. Also remove any LockWindowUpdate() 03872 * that's still around. 03873 */ 03874 zzzClipCursor(NULL); 03875 LockWindowUpdate2(NULL, TRUE); 03876 03877 /* 03878 * Reload pq because it may have changed. 03879 */ 03880 pq = ptiCurrent->pq; 03881 03882 /* 03883 * If this event didn't originate from an initializing app 03884 * coming to the foreground [wParam == 0] then go ahead 03885 * and check if there's already an active window and if so make 03886 * it visually active. Also make sure we're still the foreground 03887 * queue. 03888 */ 03889 if ((pqmsg->msg.wParam != 0) && (pq->spwndActive != NULL) && 03890 (pq == gpqForeground)) { 03891 PWND pwndActive; 03892 03893 ThreadLockAlwaysWithPti(ptiCurrent, pwndActive = pq->spwndActive, &tlpwndT); 03894 xxxSendMessage(pwndActive, WM_NCACTIVATE, TRUE, 0); 03895 xxxUpdateTray(pwndActive); 03896 xxxSetWindowPos(pwndActive, PWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); 03897 ThreadUnlock(&tlpwndT); 03898 } else if (pq != gpqForeground) { 03899 03900 /* 03901 * If we're not being activated, make sure we don't become foreground. 03902 */ 03903 ptiCurrent->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE; 03904 TAGMSG1(DBGTAG_FOREGROUND, "xxxProcessEventMessage clear TIF %#p", ptiCurrent); 03905 ptiCurrent->ppi->W32PF_Flags &= ~W32PF_ALLOWFOREGROUNDACTIVATE; 03906 TAGMSG1(DBGTAG_FOREGROUND, "xxxProcessEventMessage clear W32PF %#p", ptiCurrent->ppi); 03907 } 03908 03909 } else { 03910 03911 pwnd = RevalidateHwnd((HWND)pqmsg->msg.lParam); 03912 if (pwnd == NULL) 03913 break; 03914 03915 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 03916 03917 /* 03918 * If nobody is foreground, allow this app to become foreground. 03919 */ 03920 if (gpqForeground == NULL) { 03921 xxxSetForegroundWindow2(pwnd, ptiCurrent, 0); 03922 } else { 03923 if (pwnd != pq->spwndActive) { 03924 if (xxxActivateThisWindow(pwnd, (UINT)pqmsg->msg.wParam, 03925 (ATW_SETFOCUS | ATW_ASYNC) | 03926 ((pqmsg->msg.message & PEM_ACTIVATE_NOZORDER) ? ATW_NOZORDER : 0))) { 03927 03928 /* 03929 * This event was posted by SetForegroundWindow2 03930 * (i.e. pqmsg->msg.lParam != 0) so make sure 03931 * mouse is on this window. 03932 */ 03933 if (TestUP(ACTIVEWINDOWTRACKING)) { 03934 zzzActiveCursorTracking(pwnd); 03935 } 03936 } 03937 } else { 03938 BOOL fActive = (GETPTI(pwnd)->pq == gpqForeground); 03939 03940 xxxSendMessage(pwnd, WM_NCACTIVATE, 03941 (DWORD)(fActive), 0); 03942 if (fActive) { 03943 xxxUpdateTray(pwnd); 03944 } 03945 03946 /* 03947 * Only bring the window to the top if it is becoming active. 03948 */ 03949 if (fActive && !(pqmsg->msg.message & PEM_ACTIVATE_NOZORDER)) 03950 xxxSetWindowPos(pwnd, PWND_TOP, 0, 0, 0, 0, 03951 SWP_NOSIZE | SWP_NOMOVE); 03952 } 03953 } 03954 03955 /* 03956 * Check here to see if the window needs to be restored. This is a 03957 * hack so that we're compatible with what msmail expects out of 03958 * win3.1 alt-tab. msmail expects to always be active when it gets 03959 * asked to be restored. This will ensure that during alt-tab 03960 * activate. 03961 */ 03962 if (pqmsg->msg.message & PEM_ACTIVATE_RESTORE) { 03963 if (TestWF(pwnd, WFMINIMIZED)) { 03964 _PostMessage(pwnd, WM_SYSCOMMAND, SC_RESTORE, 0); 03965 } 03966 } 03967 03968 ThreadUnlock(&tlpwndT); 03969 } 03970 03971 } 03972 break; 03973 03974 case QEVENT_DEACTIVATE: 03975 xxxDeactivate(ptiCurrent, (DWORD)pqmsg->msg.wParam); 03976 break; 03977 03978 case QEVENT_CANCELMODE: 03979 if (pq->spwndCapture != NULL) { 03980 ThreadLockAlwaysWithPti(ptiCurrent, pq->spwndCapture, &tlpwndT); 03981 xxxSendMessage(pq->spwndCapture, WM_CANCELMODE, 0, 0); 03982 ThreadUnlock(&tlpwndT); 03983 03984 /* 03985 * Set QS_MOUSEMOVE so any sleeping modal loops, 03986 * like the move/size code, will wake up and figure 03987 * out that it should abort. 03988 */ 03989 SetWakeBit(ptiCurrent, QS_MOUSEMOVE); 03990 } 03991 break; 03992 03993 03994 case QEVENT_POSTMESSAGE: 03995 /* 03996 * This event is used in situations where we need to ensure that posted 03997 * messages are processed after previous QEVENT's. Normally, posting a 03998 * queue event and then calling postmessage will result in the posted 03999 * message being seen first by the app (because posted messages are 04000 * processed before input.) Instead we will post a QEVENT_POSTMESSAGE 04001 * instead of doing a postmessage directly, which will result in the 04002 * correct ordering of messages. 04003 * 04004 */ 04005 04006 if (pwnd = RevalidateHwnd((HWND)pqmsg->msg.hwnd)) { 04007 04008 _PostMessage(pwnd,pqmsg->msg.message,pqmsg->msg.wParam,pqmsg->msg.lParam); 04009 } 04010 break; 04011 04012 04013 case QEVENT_ASYNCSENDMSG: 04014 xxxProcessAsyncSendMessage((PASYNCSENDMSG)pqmsg->msg.wParam); 04015 break; 04016 04017 case QEVENT_HUNGTHREAD: 04018 pwnd = RevalidateHwnd((HWND)pqmsg->msg.hwnd); 04019 if (pwnd != NULL) { 04020 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 04021 xxxProcessHungThreadEvent(pwnd); 04022 ThreadUnlock(&tlpwndT); 04023 } 04024 break; 04025 04026 case QEVENT_CANCELMOUSEMOVETRK: { 04027 /* 04028 * hwnd: hwndTrack. message: dwDTFlags. 04029 * wParam: htEx. lParam: dwDTCancel 04030 */ 04031 PDESKTOP pdesk = ptiCurrent->rpdesk; 04032 pwnd = RevalidateHwnd((HWND)pqmsg->msg.hwnd); 04033 /* 04034 * Let's check that the app didn't manage to restart mouse leave 04035 * tracking before we had a chance to cancel it. 04036 */ 04037 UserAssert(!(pqmsg->msg.message & DF_TRACKMOUSELEAVE) 04038 || !(pdesk->dwDTFlags & DF_TRACKMOUSELEAVE) 04039 || (PtoHq(pdesk->spwndTrack) != pqmsg->msg.hwnd) 04040 || !((pdesk->htEx == HTCLIENT) ^ ((int)pqmsg->msg.wParam == HTCLIENT))); 04041 /* 04042 * If we're back tracking at the same spot, bail 04043 */ 04044 if ((pdesk->dwDTFlags & DF_MOUSEMOVETRK) 04045 && (PtoHq(pdesk->spwndTrack) == pqmsg->msg.hwnd) 04046 && (pdesk->htEx == (int)pqmsg->msg.wParam)) { 04047 /* 04048 * If we're tracking mouse leave, 04049 */ 04050 break; 04051 } 04052 /* 04053 * Don't nuke the tooltip if it has been reactivated. 04054 */ 04055 if (pdesk->dwDTFlags & DF_TOOLTIPACTIVE) { 04056 pqmsg->msg.lParam &= ~DF_TOOLTIP; 04057 } 04058 /* 04059 * Cancel tracking if the window is still around 04060 */ 04061 if (pwnd != NULL) { 04062 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 04063 xxxCancelMouseMoveTracking(pqmsg->msg.message, pwnd, 04064 (int)pqmsg->msg.wParam, 04065 (DWORD)pqmsg->msg.lParam); 04066 ThreadUnlock(&tlpwndT); 04067 } else if ((pqmsg->msg.lParam & DF_TOOLTIP) 04068 && (pqmsg->msg.message & DF_TOOLTIPSHOWING)) { 04069 /* 04070 * The window is gone and so must be tracking. 04071 * Just take care of the tooltip which is still showing. 04072 */ 04073 pwnd = pdesk->spwndTooltip; 04074 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 04075 xxxResetTooltip((PTOOLTIPWND)pwnd); 04076 ThreadUnlock(&tlpwndT); 04077 } 04078 } 04079 break; 04080 04081 case QEVENT_RITACCESSIBILITY: 04082 if (IsHooked(ptiCurrent, WHF_SHELL)) { 04083 xxxCallHook((UINT)pqmsg->msg.wParam, 04084 (WPARAM)pqmsg->msg.lParam, 04085 (LPARAM)0, 04086 WH_SHELL); 04087 } 04088 04089 PostShellHookMessages((UINT)pqmsg->msg.wParam, pqmsg->msg.lParam); 04090 break; 04091 04092 case QEVENT_RITSOUND: 04093 /* 04094 * This should only happen on the desktop thread. 04095 */ 04096 switch(pqmsg->msg.message) { 04097 case RITSOUND_UPSIREN: 04098 case RITSOUND_DOWNSIREN: 04099 case RITSOUND_LOWBEEP: 04100 case RITSOUND_HIGHBEEP: 04101 case RITSOUND_KEYCLICK: 04102 (pfnBP[pqmsg->msg.message])(); 04103 break; 04104 04105 case RITSOUND_DOBEEP: 04106 switch(pqmsg->msg.wParam) { 04107 case RITSOUND_UPSIREN: 04108 case RITSOUND_DOWNSIREN: 04109 case RITSOUND_LOWBEEP: 04110 case RITSOUND_HIGHBEEP: 04111 case RITSOUND_KEYCLICK: 04112 DoBeep(pfnBP[pqmsg->msg.wParam], (DWORD)pqmsg->msg.lParam); 04113 } 04114 break; 04115 } 04116 break; 04117 04118 case QEVENT_APPCOMMAND: { 04119 /* 04120 * qevent app commands so we can post a wm_appcommand to the queue 04121 */ 04122 THREADINFO *ptiWindowOwner; 04123 int cmd; 04124 UINT keystate; 04125 04126 /* 04127 * check the appcommand's are within reasonable ranges 04128 * if they aren't then we have an internal consistency error since xxxKeyEvent should 04129 * have generated correct ones for us 04130 */ 04131 UserAssert( pqmsg->msg.lParam >= VK_APPCOMMAND_FIRST && 04132 pqmsg->msg.lParam <= VK_APPCOMMAND_LAST ); 04133 04134 /* 04135 * We need to work out which window to send to here. Using the same 04136 * rules as from xxxScanSysQueue: 04137 * Assign the input to the focus window. If there is no focus 04138 * window, assign it to the active window as a SYS message. 04139 */ 04140 pwnd = ptiCurrent->pq->spwndFocus; 04141 if (!pwnd) { 04142 pwnd = ptiCurrent->pq->spwndActive; 04143 if (!pwnd ) { 04144 /* 04145 * At the moment we will just eat the message since we can't find a foreground q 04146 * This follows the method that any other app (eg hidserv) would mimic to 04147 * find the window to send to. 04148 */ 04149 break; 04150 } 04151 } 04152 04153 /* 04154 * We don't want to block on another thread since the xxxSendMessage is a synchronous call 04155 * so we post the message to the queue of the window owner thread 04156 */ 04157 ptiWindowOwner = GETPTI(pwnd); 04158 if (ptiCurrent != ptiWindowOwner) { 04159 /* 04160 * Post the event message to the window who should get it 04161 */ 04162 PostEventMessage(ptiWindowOwner, ptiWindowOwner->pq, QEVENT_APPCOMMAND, 04163 NULL, 0, (WPARAM)0, pqmsg->msg.lParam); 04164 04165 /* 04166 * break out of this since we've now posted the message to a different q - we 04167 * don't want to deal with it here 04168 */ 04169 break; 04170 } 04171 04172 cmd = APPCOMMAND_FIRST + ((UINT)pqmsg->msg.lParam - VK_APPCOMMAND_FIRST); 04173 keystate = GetMouseKeyFlags(ptiWindowOwner->pq); 04174 pqmsg->msg.lParam = MAKELPARAM(keystate, cmd); 04175 04176 04177 /* 04178 * Generate a WM_APPCOMMAND message from the keyboard keys 04179 */ 04180 ThreadLockAlwaysWithPti(ptiCurrent, pwnd, &tlpwndT); 04181 xxxSendMessage(pwnd, WM_APPCOMMAND, (WPARAM)pwnd, pqmsg->msg.lParam); 04182 ThreadUnlock(&tlpwndT); 04183 04184 break; 04185 } 04186 default: 04187 RIPMSG1(RIP_ERROR, "xxxProcessEventMessage Bad pqmsg->dwQEvent:%#lx", pqmsg->dwQEvent); 04188 break; 04189 } 04190 04191 ThreadUnlockPoolCleanup(ptiCurrent, &tlMsg); 04192 }

VOID xxxProcessKeyEvent PKE  pke,
ULONG_PTR  ExtraInformation,
BOOL  bInjected
 

Definition at line 2791 of file ntinput.c.

References BYTE, CheckCritIn, tagLASTINPUT::dwFlags, GetActiveHKL(), glinp, gpDispInfo, gpsi, KEOEMProcs(), LINP_INPUTTIMEOUTS, LINP_KEYBOARD, LINP_POWERTIMEOUTS, NtGetTickCount(), tagDISPLAYINFO::pmdev, TestRawKeyDown, tagLASTINPUT::timeLastInputMessage, UpdateRawKeyState(), VOID(), xxxKELocaleProcs(), xxxKENLSProcs(), and xxxKeyEvent().

Referenced by ProcessKeyboardInput(), RemoteSyncToggleKeys(), xxxFKAcceptanceDelayTimer(), xxxFKRepeatRateTimer(), xxxInternalKeyEventDirect(), xxxStickyKeys(), xxxToggleKeysTimer(), and xxxUpdateModifierState().

02795 { 02796 BYTE Vk; 02797 02798 CheckCritIn(); 02799 02800 Vk = (BYTE)pke->usFlaggedVk; 02801 02802 /* 02803 * KOREAN: 02804 * Check this is Korean keyboard layout, or not.. 02805 * 02806 * NOTE: 02807 * It would be better check this by "keyboard hardware" or 02808 * "keyboard layout" ??? 02809 * 02810 * 1. Check by hardware : 02811 * 02812 * if (KOREAN_KEYBOARD(gKeyboardInfo.KeyboardIdentifier)) { 02813 * 02814 * 2. Check by layout : 02815 * 02816 * if (KOREAN_KBD_LAYOUT(_GetKeyboardLayout(0L))) { 02817 */ 02818 if (KOREAN_KBD_LAYOUT(GetActiveHKL())) { 02819 if ((pke->usFlaggedVk & KBDBREAK) && 02820 !(pke->usFlaggedVk & KBDUNICODE) && 02821 (pke->bScanCode == 0xF1 || pke->bScanCode == 0xF2) && 02822 !TestRawKeyDown(Vk)) { 02823 /* 02824 * This is actually a keydown with a scancode of 0xF1 or 0xF2 from a 02825 * Korean keyboard. Korean IMEs and apps want a WM_KEYDOWN with a 02826 * scancode of 0xF1 or 0xF2. They don't mind not getting the WM_KEYUP. 02827 * Don't update physical keystate to allow a real 0x71/0x72 keydown. 02828 */ 02829 pke->usFlaggedVk &= ~KBDBREAK; 02830 } else { 02831 UpdateRawKeyState(Vk, pke->usFlaggedVk & KBDBREAK); 02832 } 02833 } else { 02834 UpdateRawKeyState(Vk, pke->usFlaggedVk & KBDBREAK); 02835 } 02836 02837 /* 02838 * Convert Left/Right Ctrl/Shift/Alt key to "unhanded" key. 02839 * ie: if VK_LCONTROL or VK_RCONTROL, convert to VK_CONTROL etc. 02840 */ 02841 if ((Vk >= VK_LSHIFT) && (Vk <= VK_RMENU)) { 02842 Vk = (BYTE)((Vk - VK_LSHIFT) / 2 + VK_SHIFT); 02843 UpdateRawKeyState(Vk, pke->usFlaggedVk & KBDBREAK); 02844 } 02845 02846 /* 02847 * Setup to shutdown screen saver and exit video power down mode. 02848 */ 02849 if (glinp.dwFlags & LINP_POWERTIMEOUTS) { 02850 /* 02851 * Call video driver here to exit power down mode. 02852 */ 02853 KdPrint(("Exit video power down mode\n")); 02854 DrvSetMonitorPowerState(gpDispInfo->pmdev, PowerDeviceD0); 02855 } 02856 glinp.dwFlags = (glinp.dwFlags & ~LINP_INPUTTIMEOUTS) | LINP_KEYBOARD; 02857 glinp.timeLastInputMessage = gpsi->dwLastRITEventTickCount = NtGetTickCount(); 02858 if (!bInjected || (pke->dwTime == 0)) { 02859 pke->dwTime = glinp.timeLastInputMessage; 02860 } 02861 02862 /* 02863 * Now call all the OEM- and Locale- specific KEProcs. 02864 * If KEProcs return FALSE, the keystroke has been discarded, in 02865 * which case don't pass the key event on to xxxKeyEvent(). 02866 */ 02867 if (pke->usFlaggedVk & KBDUNICODE) { 02868 xxxKeyEvent(pke->usFlaggedVk, pke->wchInjected, 02869 pke->dwTime, ExtraInformation, bInjected); 02870 } else { 02871 if (KEOEMProcs(pke) && xxxKELocaleProcs(pke) && xxxKENLSProcs(pke,ExtraInformation)) { 02872 xxxKeyEvent(pke->usFlaggedVk, pke->bScanCode, 02873 pke->dwTime, ExtraInformation, bInjected); 02874 } 02875 } 02876 }

PEVENTHOOK xxxProcessNotifyWinEvent PNOTIFY  pNotify  ) 
 

Definition at line 68 of file kernel/winable.c.

References BEGINATOMICCHECK, DBGVERIFYEVENTHOOK, DBGVERIFYNOTIFY, DestroyNotify(), tagNOTIFY::dwWEFlags, ENDATOMICCHECK, tagEVENTHOOK::fDestroyed, tagEVENTHOOK::fSync, GETPTI, gptiRit, tagEVENTHOOK::head, tagEVENTHOOK::ihmod, IsRestricted(), tagPROCESSINFO::luidSession, NULL, tagEVENTHOOK::offPfn, tagEVENTHOOK::pehNext, PostEventMessage(), tagTHREADINFO::ppi, PtiCurrent, tagNOTIFY::ptiReceiver, QEVENT_NOTIFYWINEVENT, RtlEqualLuid(), tagNOTIFY::spEventHook, ThreadLockAlways, ThreadUnlock, TIF_ALLOWOTHERACCOUNTHOOK, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TIF_SYSTEMTHREAD, TIF_WOW64, WEF_ASYNC, WEF_DEFERNOTIFY, WEF_POSTED, xxxClientCallWinEventProc(), and xxxGetEventProc().

Referenced by xxxFlushDeferredWindowEvents(), xxxProcessEventMessage(), and xxxWindowEvent().

00069 { 00070 WINEVENTPROC pfn; 00071 PEVENTHOOK pEventHook; 00072 TL tlpEventHook; 00073 PTHREADINFO ptiCurrent = PtiCurrent(); 00074 00075 pEventHook = pNotify->spEventHook; 00076 DBGVERIFYEVENTHOOK(pEventHook); 00077 UserAssert(pEventHook->head.cLockObj); 00078 00079 if (((pNotify->dwWEFlags & (WEF_ASYNC | WEF_POSTED)) == WEF_ASYNC) 00080 || 00081 (ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD | TIF_INCLEANUP)) 00082 00083 || 00084 (!RtlEqualLuid(&GETPTI(pEventHook)->ppi->luidSession, &ptiCurrent->ppi->luidSession) && 00085 !(ptiCurrent->TIF_flags & TIF_ALLOWOTHERACCOUNTHOOK)) 00086 00087 || 00088 (GETPTI(pEventHook)->ppi != ptiCurrent->ppi && 00089 IsRestricted(GETPTI(pEventHook)->pEThread)) 00090 00091 #if defined(_WIN64) 00092 || 00093 ((GETPTI(pEventHook)->TIF_flags & TIF_WOW64) != (ptiCurrent->TIF_flags & TIF_WOW64)) 00094 #endif 00095 ) { 00096 /* 00097 * POST 00098 * 00099 * WinEvent Hook set without WINEVENT_INCONTEXT flag are posted; 00100 * Events from system threads are posted because there is no user-mode 00101 * part to callback to; 00102 * Console is not permitted to load DLLs, so we must post back to the 00103 * hooking application; 00104 * DLLs can not be loaded cross bit type(32bit to 64bit) on 64bit NT 00105 * so we must post(It may be usefull to let the app be aware and 00106 * even supply both a 32bit and a 64bit DLL that are aware of each other); 00107 * Threads in cleanup can't get called back, so turn their 00108 * notifications into async ones. (Better late than never). 00109 * 00110 * If forcing these events ASYNC is unacceptable, we might consider 00111 * doing system/console SYNC events like low-level hooks (sync with 00112 * timeout: but may have to post it if the timeout expires) - IanJa 00113 */ 00114 PQ pqReceiver = GETPTI(pEventHook)->pq; 00115 PEVENTHOOK pEventHookNext = pEventHook->pehNext; 00116 00117 BEGINATOMICCHECK(); 00118 00119 DBGVERIFYNOTIFY(pNotify); 00120 pNotify->dwWEFlags |= WEF_POSTED | WEF_ASYNC; 00121 if (!pqReceiver || (GETPTI(pEventHook) == gptiRit) || 00122 pEventHook->fDestroyed || 00123 !PostEventMessage(GETPTI(pEventHook), pqReceiver, 00124 QEVENT_NOTIFYWINEVENT, 00125 NULL, 0, 0, (LPARAM)pNotify)) { 00126 /* 00127 * If the receiver doesn't have a queue or the 00128 * post failed (low memory), cleanup what we just 00129 * created. 00130 * Note: destroying the notification may destroy pEventHook too. 00131 */ 00132 RIPMSG2(RIP_WARNING, "failed to post NOTIFY at %#p, time %lx\n", 00133 pNotify, pNotify->dwEventTime); 00134 DestroyNotify(pNotify); 00135 } 00136 00137 ENDATOMICCHECK(); 00138 00139 if (pEventHookNext) { 00140 DBGVERIFYEVENTHOOK(pEventHookNext); 00141 } 00142 return pEventHookNext; 00143 } 00144 00145 /* 00146 * Don't call back if the hook has been destroyed (unhooked). 00147 */ 00148 if (pEventHook->fDestroyed) { 00149 /* 00150 * Save the next hook since DestroyNotify may cause pEventHook to 00151 * be freed by unlocking it. 00152 */ 00153 pEventHook = pEventHook->pehNext; 00154 DestroyNotify(pNotify); 00155 return pEventHook; 00156 } 00157 00158 /* 00159 * CALLBACK 00160 * 00161 * This leaves the critical section. 00162 * We return the next Event Hook in the list so that the caller doesn't 00163 * have to lock pEventHook. 00164 */ 00165 UserAssert((pNotify->dwWEFlags & WEF_DEFERNOTIFY) == 0); 00166 00167 ThreadLockAlways(pEventHook, &tlpEventHook); 00168 00169 UserAssertMsg1(pNotify->ptiReceiver == NULL, 00170 "pNotify %#p is already in callback! Reentrant?", pNotify); 00171 pNotify->ptiReceiver = ptiCurrent; 00172 00173 if (!pEventHook->fSync) { 00174 UserAssert(pEventHook->ihmod == -1); 00175 pfn = (WINEVENTPROC)pEventHook->offPfn; 00176 } else { 00177 pfn = xxxGetEventProc(pEventHook); 00178 } 00179 if (pfn) { 00180 xxxClientCallWinEventProc(pfn, pEventHook, pNotify); 00181 DBGVERIFYNOTIFY(pNotify); 00182 DBGVERIFYEVENTHOOK(pEventHook); 00183 UserAssert(pEventHook->head.cLockObj); 00184 } 00185 00186 pNotify->ptiReceiver = NULL; 00187 00188 /* 00189 * Save the next item in the list, ThreadUnlock() may destroy pEventHook. 00190 * DestroyNotify() may also kill the event if it is a zombie (destroyed 00191 * but being used, waiting for use count to go to 0 before being freed). 00192 */ 00193 pEventHook = pEventHook->pehNext; 00194 ThreadUnlock(&tlpEventHook); 00195 00196 /* 00197 * We are done with the notification. Kill it. 00198 * 00199 * NOTE that DestroyNotify does not yield, which is why we can hang on 00200 * to the pehNext field above around this call. 00201 * 00202 * NOTE ALSO that DestroyNotify will kill the event it references if the 00203 * ref count goes down to zero and it was zombied earlier. 00204 */ 00205 DestroyNotify(pNotify); 00206 00207 return pEventHook; 00208 }

VOID xxxProcessSetWindowPosEvent PSMWP  psmwpT  ) 
 

Definition at line 1884 of file swp.c.

References tagSMWP::acvr, tagSMWP::ccvr, FALSE, InternalBeginDeferWindowPos(), NULL, VOID(), and xxxEndDeferWindowPosEx().

Referenced by xxxProcessEventMessage().

01886 { 01887 PSMWP psmwp; 01888 01889 /* 01890 * Create a bonafide SMWP/CVR array that xxxEndDeferWindowPos can use 01891 * and later free. 01892 */ 01893 if ((psmwp = InternalBeginDeferWindowPos(psmwpT->ccvr)) == NULL) { 01894 UserFreePool(psmwpT); 01895 return; 01896 } 01897 01898 /* 01899 * Copy the contents of the temp SMWP/CVR array into the real one. 01900 */ 01901 RtlCopyMemory(psmwp->acvr, psmwpT->acvr, sizeof(CVR) * psmwpT->ccvr); 01902 psmwp->ccvr = psmwpT->ccvr; 01903 01904 /* 01905 * Complete the MultWindowPos operation now that we're on the correct 01906 * context. 01907 */ 01908 xxxEndDeferWindowPosEx(psmwp, FALSE); 01909 01910 /* 01911 * Free the temp SMWP/CVR array. 01912 */ 01913 UserFreePool(psmwpT); 01914 }

BOOL xxxPSMGetTextExtent HDC  hdc,
LPWSTR  lpstr,
int  cch,
PSIZE  psize
 

Referenced by xxxDrawMenuBarUnderlines(), xxxMB_FindLongestString(), xxxMNItemSize(), and xxxRealDrawMenuItem().

void xxxPSMTextOut HDC  hdc,
int  xLeft,
int  yTop,
LPWSTR  lpsz,
int  cch,
DWORD  dwFlags
 

Definition at line 41 of file kernel/text.c.

References _GetTextMetricsW(), _TextOutW(), CALL_LPK, dwFlags, GetPrefixCount(), NULL, PtiCurrentShared, RtlInitUnicodeString(), SetRect(), and xxxClientPSMTextOut().

Referenced by DT_InitDrawTextInfo(), xxxDrawMenuBarUnderlines(), xxxDrawMenuItemText(), and xxxRealDrawMenuItem().

00048 { 00049 int cx; 00050 LONG textsize, result; 00051 /* 00052 * In the kernel we have a limited amount of stack. So it should be a stack 00053 * variable in user mode and static in kernel mode where it is thread safe 00054 * since we are in the crit section. 00055 */ 00056 static WCHAR achWorkBuffer[255]; 00057 WCHAR *pchOut = achWorkBuffer; 00058 TEXTMETRICW textMetric; 00059 SIZE size; 00060 RECT rc; 00061 COLORREF color; 00062 PTHREADINFO ptiCurrent = PtiCurrentShared(); 00063 00064 if (CALL_LPK(ptiCurrent)) { 00065 /* 00066 * A user mode LPK is installed for layout and shaping. 00067 * Perform callback and return. 00068 */ 00069 UNICODE_STRING ustrStr; 00070 00071 RtlInitUnicodeString(&ustrStr, lpsz); 00072 xxxClientPSMTextOut(hdc, xLeft, yTop, &ustrStr, cch, dwFlags); 00073 return; 00074 } 00075 00076 if (cch > sizeof(achWorkBuffer)/sizeof(WCHAR)) { 00077 pchOut = (WCHAR*)UserAllocPool((cch+1) * sizeof(WCHAR), TAG_RTL); 00078 if (pchOut == NULL) 00079 return; 00080 } 00081 00082 result = GetPrefixCount(lpsz, cch, pchOut, cch); 00083 00084 if (!(dwFlags & DT_PREFIXONLY)) { 00085 _TextOutW(hdc, xLeft, yTop, pchOut, cch - HIWORD(result)); 00086 } 00087 00088 /* 00089 * Any true prefix characters to underline? 00090 */ 00091 if (LOWORD(result) == 0xFFFF || dwFlags & DT_HIDEPREFIX) { 00092 if (pchOut != achWorkBuffer) 00093 UserFreePool(pchOut); 00094 return; 00095 } 00096 00097 if (!_GetTextMetricsW(hdc, &textMetric)) { 00098 textMetric.tmOverhang = 0; 00099 textMetric.tmAscent = 0; 00100 } 00101 00102 /* 00103 * For proportional fonts, find starting point of underline. 00104 */ 00105 if (LOWORD(result) != 0) { 00106 00107 /* 00108 * How far in does underline start (if not at 0th byte.). 00109 */ 00110 GreGetTextExtentW(hdc, (LPWSTR)pchOut, LOWORD(result), &size, GGTE_WIN3_EXTENT); 00111 xLeft += size.cx; 00112 00113 /* 00114 * Adjust starting point of underline if not at first char and there is 00115 * an overhang. (Italics or bold fonts.) 00116 */ 00117 xLeft = xLeft - textMetric.tmOverhang; 00118 } 00119 00120 /* 00121 * Adjust for proportional font when setting the length of the underline and 00122 * height of text. 00123 */ 00124 GreGetTextExtentW(hdc, (LPWSTR)(pchOut + LOWORD(result)), 1, &size, GGTE_WIN3_EXTENT); 00125 textsize = size.cx; 00126 00127 /* 00128 * Find the width of the underline character. Just subtract out the overhang 00129 * divided by two so that we look better with italic fonts. This is not 00130 * going to effect embolded fonts since their overhang is 1. 00131 */ 00132 cx = LOWORD(textsize) - textMetric.tmOverhang / 2; 00133 00134 /* 00135 * Get height of text so that underline is at bottom. 00136 */ 00137 yTop += textMetric.tmAscent + 1; 00138 00139 /* 00140 * Draw the underline using the foreground color. 00141 */ 00142 SetRect(&rc, xLeft, yTop, xLeft+cx, yTop+1); 00143 color = GreSetBkColor(hdc, GreGetTextColor(hdc)); 00144 GreExtTextOutW(hdc, xLeft, yTop, ETO_OPAQUE, &rc, TEXT(""), 0, NULL); 00145 GreSetBkColor(hdc, color); 00146 00147 if (pchOut != achWorkBuffer) { 00148 UserFreePool(pchOut); 00149 } 00150 }

VOID xxxPushKeyEvent BYTE  bVk,
BYTE  bScan,
DWORD  dwFlags,
DWORD  dwExtraInfo
 

Definition at line 536 of file w32/ntuser/kernel/misc.c.

References dwFlags, FALSE, NtGetTickCount(), USHORT, VOID(), and xxxKeyEvent().

Referenced by xxxRemoteStopScreenUpdates().

00541 { 00542 USHORT usFlaggedVK; 00543 00544 usFlaggedVK = (USHORT)bVk; 00545 00546 if (dwFlags & KEYEVENTF_KEYUP) 00547 usFlaggedVK |= KBDBREAK; 00548 00549 // IanJa: not all extended keys are numpad, but this seems to work. 00550 if (dwFlags & KEYEVENTF_EXTENDEDKEY) 00551 usFlaggedVK |= KBDNUMPAD | KBDEXT; 00552 00553 xxxKeyEvent(usFlaggedVK, bScan, NtGetTickCount(), dwExtraInfo, FALSE); 00554 }

NTSTATUS xxxQueryInformationThread IN HANDLE  hThread,
IN USERTHREADINFOCLASS  ThreadInfoClass,
OUT PVOID  ThreadInformation,
IN ULONG  ThreadInformationLength,
OUT PULONG ReturnLength  OPTIONAL
 

Definition at line 5901 of file queue.c.

References BOOL, _ETHREAD::Cid, tagTHREADINFO::cWindows, DWORD, tagWINDOWSTATION::dwWSF_Flags, FALSE, FHungApp(), GetTaskName(), gpidLogon, tagTDB::hTaskWow, HW, ISCSRSS, tagWOWPROCESSINFO::lpfnWowExitTask, NT_SUCCESS, NTSTATUS(), NULL, ObReferenceObjectByHandle(), tagDESKTOP::pDeskInfo, tagTHREADINFO::ppi, PsThreadType, tagTHREADINFO::ptdb, PtiCurrent, PtiFromThread, tagPROCESSINFO::pwpi, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, SHUTDOWN_KNOWN_PROCESS, SHUTDOWN_UNKNOWN_PROCESS, tagDESKTOPINFO::spwnd, Status, TIF_16BIT, tagTHREADINFO::TIF_flags, UnlockThread, UserMode, WMCS_NORETRY, WSF_NOIO, WSF_REALSHUTDOWN, xxxRestoreCsrssThreadDesktop(), xxxSetCsrssThreadDesktop(), and xxxSwitchDesktop().

Referenced by NtUserQueryInformationThread().

05907 { 05908 PUSERTHREAD_SHUTDOWN_INFORMATION pShutdown; 05909 PUSERTHREAD_WOW_INFORMATION pWow; 05910 PETHREAD Thread; 05911 PTHREADINFO pti; 05912 NTSTATUS Status = STATUS_SUCCESS; 05913 ULONG LocalReturnLength = 0; 05914 DWORD dwClientFlags; 05915 05916 UNREFERENCED_PARAMETER(ThreadInformationLength); 05917 /* 05918 * Only allow CSRSS to make this call 05919 */ 05920 UserAssert(ISCSRSS()); 05921 05922 Status = ObReferenceObjectByHandle(hThread, 05923 THREAD_QUERY_INFORMATION, 05924 *PsThreadType, 05925 UserMode, 05926 &Thread, 05927 NULL); 05928 if (!NT_SUCCESS(Status)) 05929 return Status; 05930 05931 pti = PtiFromThread(Thread); 05932 05933 switch (ThreadInfoClass) { 05934 case UserThreadShutdownInformation: 05935 LocalReturnLength = sizeof(USERTHREAD_SHUTDOWN_INFORMATION); 05936 UserAssert(ThreadInformationLength == sizeof(USERTHREAD_SHUTDOWN_INFORMATION)); 05937 pShutdown = ThreadInformation; 05938 /* 05939 * Read the client flags and zero out the structure, 05940 * except for pdeskRestore (which is supposed 05941 * to be the last field) 05942 */ 05943 dwClientFlags = pShutdown->dwFlags; 05944 UserAssert(FIELD_OFFSET(USERTHREAD_SHUTDOWN_INFORMATION, drdRestore) 05945 == (sizeof(USERTHREAD_SHUTDOWN_INFORMATION) - sizeof(DESKRESTOREDATA))); 05946 RtlZeroMemory(pShutdown, 05947 sizeof(USERTHREAD_SHUTDOWN_INFORMATION) - sizeof(DESKRESTOREDATA)); 05948 05949 /* 05950 * Return the desktop window handle if the thread 05951 * has a desktop and the desktop is on a visible 05952 * windowstation. 05953 */ 05954 if (pti != NULL && pti->rpdesk != NULL && 05955 !(pti->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)) 05956 pShutdown->hwndDesktop = HW(pti->rpdesk->pDeskInfo->spwnd); 05957 05958 /* 05959 * Return shutdown status. Zero indicates that the thread 05960 * has windows and can be shut down in the normal manner. 05961 */ 05962 if (Thread->Cid.UniqueProcess == gpidLogon) { 05963 /* 05964 * Do not shutdown the logon process. 05965 */ 05966 pShutdown->StatusShutdown = SHUTDOWN_KNOWN_PROCESS; 05967 } else if (pti == NULL || pti->rpdesk == NULL) { 05968 05969 /* 05970 * The thread either is not a gui thread or it doesn't 05971 * have a desktop. Make console do the shutdown. 05972 */ 05973 pShutdown->StatusShutdown = SHUTDOWN_UNKNOWN_PROCESS; 05974 } 05975 05976 /* 05977 * Return flags 05978 */ 05979 if (pti != NULL && pti->cWindows != 0) 05980 pShutdown->dwFlags |= USER_THREAD_GUI; 05981 05982 /* 05983 * If we return the desktop window handle and the 05984 * app should be shut down, switch to the desktop 05985 * and assign it to the shutdown worker thread. 05986 */ 05987 if ((pShutdown->dwFlags & USER_THREAD_GUI) && 05988 pShutdown->StatusShutdown == 0) { 05989 /* 05990 * The current csrss thread is going to 05991 * make activation calls, send messages, 05992 * switch video modes, etc so we need to 05993 * assign it to a dekstop 05994 */ 05995 PTHREADINFO ptiCurrent = PtiCurrent(); 05996 UserAssert(pti->rpdesk != NULL); 05997 05998 if (ptiCurrent->rpdesk != pti->rpdesk) { 05999 /* 06000 * If this thread already has a desktop, 06001 * restore the old one first. 06002 * This might happen when threads of the same 06003 * process are attached to different desktops. 06004 */ 06005 if (ptiCurrent->rpdesk != NULL) { 06006 Status = xxxRestoreCsrssThreadDesktop(&pShutdown->drdRestore); 06007 UserAssert(pti == PtiFromThread(Thread)); 06008 } 06009 if (NT_SUCCESS(Status)) { 06010 Status = xxxSetCsrssThreadDesktop(pti->rpdesk, &pShutdown->drdRestore); 06011 UserAssert(pti == PtiFromThread(Thread)); 06012 } 06013 } 06014 /* 06015 * If we're forcing a shutdown, then there is no need to switch 06016 * since we won't send any messages or bring up the EndTask dialog 06017 * (We still want to have a proper rpdesk since BoostHardError might 06018 * call PostThreadMessage) 06019 */ 06020 if (!(dwClientFlags & WMCS_NORETRY)) { 06021 if (NT_SUCCESS(Status)) { 06022 #if DBG 06023 BOOL fSwitch = 06024 #endif 06025 xxxSwitchDesktop(pti->rpdesk->rpwinstaParent, pti->rpdesk, FALSE); 06026 #if DBG 06027 UserAssert(pti == PtiFromThread(Thread)); 06028 if (!fSwitch) { 06029 if ((pti->rpdesk->rpwinstaParent == NULL) 06030 || !(pti->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)) { 06031 06032 if (!(pti->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_REALSHUTDOWN)) 06033 RIPMSG1(RIP_ERROR, "UserThreadShutdownInformation: xxxSwitchDesktop failed. pti:%#p", pti); 06034 06035 } 06036 } 06037 #endif 06038 } 06039 } 06040 } 06041 break; 06042 06043 case UserThreadFlags: 06044 LocalReturnLength = sizeof(DWORD); 06045 if (pti == NULL) 06046 Status = STATUS_INVALID_HANDLE; 06047 else { 06048 UserAssert(ThreadInformationLength == sizeof(DWORD)); 06049 *(LPDWORD)ThreadInformation = pti->TIF_flags; 06050 } 06051 break; 06052 06053 case UserThreadTaskName: 06054 LocalReturnLength = GetTaskName(pti, ThreadInformation, ThreadInformationLength); 06055 break; 06056 06057 case UserThreadWOWInformation: 06058 LocalReturnLength = sizeof(USERTHREAD_WOW_INFORMATION); 06059 UserAssert(ThreadInformationLength == sizeof(USERTHREAD_WOW_INFORMATION)); 06060 pWow = ThreadInformation; 06061 RtlZeroMemory(pWow, sizeof(USERTHREAD_WOW_INFORMATION)); 06062 06063 /* 06064 * If the thread is 16-bit, Status = the exit task function 06065 * and task id. 06066 */ 06067 if (pti && pti->TIF_flags & TIF_16BIT) { 06068 pWow->lpfnWowExitTask = pti->ppi->pwpi->lpfnWowExitTask; 06069 if (pti->ptdb) 06070 pWow->hTaskWow = pti->ptdb->hTaskWow; 06071 else 06072 pWow->hTaskWow = 0; 06073 } 06074 break; 06075 06076 case UserThreadHungStatus: 06077 LocalReturnLength = sizeof(DWORD); 06078 UserAssert(ThreadInformationLength >= sizeof(DWORD)); 06079 06080 /* 06081 * Return hung status. 06082 */ 06083 if (pti) 06084 *(PDWORD)ThreadInformation = 06085 (DWORD) FHungApp(pti, (DWORD)*(PDWORD)ThreadInformation); 06086 else 06087 *(PDWORD)ThreadInformation = FALSE; 06088 break; 06089 06090 default: 06091 Status = STATUS_INVALID_INFO_CLASS; 06092 UserAssert(FALSE); 06093 break; 06094 } 06095 06096 if (ARGUMENT_PRESENT(ReturnLength) ) { 06097 *ReturnLength = LocalReturnLength; 06098 } 06099 06100 UnlockThread(Thread); 06101 06102 return Status; 06103 }

BOOL xxxRealDrawMenuItem HDC  hdc,
PGRAYMENU  lpGray,
int  cx,
int  cy
 

Definition at line 954 of file mndraw.c.

References _DrawIconEx(), BC_INVERT, BitBltSysBmp(), BltColor(), BOOL, tagITEM::cch, CH_HELPPREFIX, CheckLock, tagMENU::cItems, tagOEMBITMAPINFO::cx, tagITEM::cxBmp, tagITEM::cxItem, CXMENU3DEDGE, tagMENU::cxTextAlign, tagOEMBITMAPINFO::cy, cy, tagITEM::cyBmp, tagITEM::cyItem, CYMENU3DEDGE, DOBI_PUSHED, DrawMenuItemCheckMark(), tagTHREADINFO::dwExpWinVer, tagITEM::dwItemData, tagITEM::dxTab, FALSE, FindCharPosition(), gcxMenuFontChar, gcyMenuFontChar, gcyMenuFontExternLeading, ghdcMem2, gpsi, tagITEM::hbmp, HDCBITS, HMValidateHandleNoRip(), INT, tagITEM::lpstr, max, MFISPOPUP, MFUNDERLINE, mnDrawHilite(), MNLEFTMARGIN, MNXSPACE, NULL, OBI_CLOSE_MBAR, OBI_CLOSE_MBAR_I, OBI_COUNT, OBI_MENUARROW, OBI_MENUARROW_L, OBI_MENUCHECK, OBI_POPUPFIRST, OBI_REDUCE_MBAR, OBI_REDUCE_MBAR_I, OBI_RESTORE_MBAR, PICON, GRAYMENU::pItem, GRAYMENU::pMenu, PtiCurrent, tagMENU::rgItems, SetupFakeMDIAppStuff(), tagITEM::spSubMenu, SRCSTENCIL, SYSHBR, SYSICO, SYSMET, TestMF, TestMFS, TestMFT, TextPointer, ThreadLock, ThreadUnlock, TRUE, TYPE_WINDOW, UINT, VER40, tagOEMBITMAPINFO::x, xxxDrawMenuItemText(), xxxGetWindowSmIcon(), xxxPSMGetTextExtent(), xxxPSMTextOut(), xxxSendMenuDrawItemMessage(), and tagOEMBITMAPINFO::y.

Referenced by xxxDrawState().

00959 { 00960 PMENU pMenu; 00961 PITEM pItem; 00962 BOOL fPopup; 00963 int cch; 00964 int xLeft; 00965 int yTop; 00966 int tp; 00967 int rp; 00968 LPWSTR lpsz; 00969 int cyTemp; 00970 int xHilite = 0; 00971 int yHilite = 0; 00972 TL tlpwndChild; 00973 PTHREADINFO ptiCurrent = PtiCurrent(); 00974 BOOL fCheckDrawn = FALSE; 00975 int xFarLeft; 00976 // 00977 // BOGUS 00978 // Use cx and cy instead of lpItem->cxItem, lpItem->cyItem to 00979 // speed stuff up. 00980 // 00981 pMenu = pGray->pMenu; 00982 CheckLock(pMenu); 00983 pItem = pGray->pItem; 00984 fPopup = TestMF(pMenu, MFISPOPUP); 00985 00986 if (fPopup) { 00987 xLeft = MNLEFTMARGIN; 00988 if (TestMF(pMenu, MNS_NOCHECK)) { 00989 xLeft += MNXSPACE; 00990 } else { 00991 fCheckDrawn = DrawMenuItemCheckMark(hdc, pItem, xLeft); 00992 if (!TestMF(pMenu, MNS_CHECKORBMP) 00993 || ((pItem->hbmp == NULL) || fCheckDrawn)) { 00994 00995 xLeft += TestMFT(pItem, MFT_RIGHTORDER) 00996 ? 0 : (gpsi->oembmi[OBI_MENUCHECK].cx + MNXSPACE); 00997 } 00998 } 00999 } else { 01000 xLeft = 0; 01001 01002 if (TestMFS(pItem, MFS_HILITE)) { 01003 xHilite = CXMENU3DEDGE; 01004 yHilite = CYMENU3DEDGE; 01005 } 01006 } 01007 01008 /* 01009 * If there is not bitmap or we don't to draw it, go draw the text 01010 */ 01011 if ((pItem->hbmp == NULL) 01012 || (fCheckDrawn 01013 && TestMF(pMenu, MNS_CHECKORBMP))) { 01014 goto RealDrawMenuItemText; 01015 } 01016 01017 /* 01018 * Draw the bitmap 01019 */ 01020 if (TestMFS(pItem, MFS_CACHEDBMP)) { 01021 if (pItem->hbmp == HBMMENU_SYSTEM) { 01022 /* 01023 * Drawing app icon (system menu) 01024 */ 01025 PWND pwndChild; 01026 PICON pIcon = NULL; 01027 UINT cyUse, cxUse; 01028 01029 AintNothingLikeTheRealMDIThing: 01030 if (!(pItem->dwItemData)) 01031 SetupFakeMDIAppStuff(pMenu, pItem); 01032 01033 pwndChild = HMValidateHandleNoRip((HWND)(pItem->dwItemData),TYPE_WINDOW); 01034 if (!pwndChild) 01035 { 01036 // 01037 // Oops, child window isn't valid anymore. Go find 01038 // the new one. 01039 // 01040 if (pItem->dwItemData) 01041 { 01042 pItem->dwItemData = 0; 01043 goto AintNothingLikeTheRealMDIThing; 01044 } 01045 01046 pIcon = NULL; 01047 } 01048 else { 01049 ThreadLock(pwndChild, &tlpwndChild); 01050 pIcon = xxxGetWindowSmIcon(pwndChild, FALSE); 01051 ThreadUnlock(&tlpwndChild); 01052 } 01053 01054 01055 if (!pIcon) 01056 pIcon = SYSICO(WINLOGO); 01057 01058 cyUse = cy - SYSMET(CYEDGE); 01059 cxUse = cx - (SYSMET(CXEDGE) * 2); 01060 /* 01061 * If this is a popup, make sure that no weird 01062 * width/height stretch takes place. 01063 */ 01064 if (fPopup && (cyUse < cxUse)) { 01065 cxUse = cyUse; 01066 } 01067 01068 _DrawIconEx(hdc, xLeft + (SYSMET(CXEDGE) * 2), 01069 SYSMET(CYBORDER), pIcon, cxUse, 01070 cyUse, 0, SYSHBR(MENU), DI_NORMAL); 01071 01072 } else { 01073 /* 01074 * This is a cached bitmap 01075 */ 01076 UINT wBmp; 01077 int xBmpLeft = xLeft; 01078 int y; 01079 POEMBITMAPINFO pOem; 01080 01081 switch ((ULONG_PTR)pItem->hbmp) { 01082 case (ULONG_PTR)HBMMENU_MBAR_RESTORE: 01083 wBmp = OBI_RESTORE_MBAR; 01084 goto DrawSysBmp; 01085 01086 case (ULONG_PTR)HBMMENU_MBAR_MINIMIZE: 01087 wBmp = OBI_REDUCE_MBAR; 01088 xBmpLeft += SYSMET(CXEDGE); 01089 goto DrawSysBmp; 01090 01091 case (ULONG_PTR)HBMMENU_MBAR_CLOSE: 01092 wBmp = OBI_CLOSE_MBAR; 01093 goto DrawSysBmp; 01094 01095 case (ULONG_PTR)HBMMENU_MBAR_CLOSE_D: 01096 wBmp = OBI_CLOSE_MBAR_I; 01097 goto DrawSysBmp2; 01098 01099 case (ULONG_PTR)HBMMENU_MBAR_MINIMIZE_D: 01100 wBmp = OBI_REDUCE_MBAR_I; 01101 xBmpLeft += SYSMET(CXEDGE); 01102 goto DrawSysBmp2; 01103 01104 DrawSysBmp: 01105 /* 01106 * Select proper bitmap based on the item state 01107 */ 01108 if (TestMFS(pItem, MFS_HILITE)) { 01109 wBmp += DOBI_PUSHED; 01110 } 01111 01112 DrawSysBmp2: 01113 BitBltSysBmp(hdc, xBmpLeft, SYSMET(CYEDGE), wBmp); 01114 break; 01115 01116 default: 01117 UserAssert((pItem->hbmp >= HBMMENU_POPUPFIRST) 01118 && (pItem->hbmp <= HBMMENU_POPUPLAST)); 01119 01120 wBmp = OBI_POPUPFIRST + HandleToUlong(pItem->hbmp) - HandleToUlong(HBMMENU_POPUPFIRST); 01121 UserAssert(wBmp < OBI_COUNT); 01122 01123 pOem = gpsi->oembmi + wBmp; 01124 y = (pItem->cyItem - pOem->cy) / 2; 01125 if (y < 0) { 01126 y = 0; 01127 } 01128 BltColor(hdc, NULL, HDCBITS(), xLeft, y, 01129 pOem->cx, pOem->cy, pOem->x, pOem->y, BC_INVERT); 01130 break; 01131 } 01132 01133 } /* if (pItem->hbmp == HBMMENU_SYSTEM) */ 01134 01135 01136 } else if (pItem->hbmp == HBMMENU_CALLBACK) { 01137 /* 01138 * Owner draw bitmap 01139 */ 01140 xxxSendMenuDrawItemMessage(hdc,ODA_DRAWENTIRE, pMenu, pItem, TRUE, xLeft); 01141 01142 } else { 01143 /* 01144 * Drawing a regular bitmap. 01145 */ 01146 01147 int dx, dy; 01148 HBITMAP hbmSave; 01149 01150 // 01151 // Is this the zero'th item in a menu bar that's not all 01152 // bitmaps? Hmm, sounds like it could be a fake MDI dude. 01153 // If it is, use the windows icon instead 01154 // 01155 /* 01156 * Let's fail this for > 4.0 apps so we can get rid of 01157 * this horrible hack someday. The HBMMENU_ constants 01158 * have been made public so people can use them freely. 01159 * 01160 * Note: even if the app is marked as 4.0, he could be 01161 * recompiled and may utilizes the new feature in NT5 menu. 01162 * So just in case, we have to check both dwItemData and lpstr 01163 * so that the menu could have bitmap, dwItemData and a menu string. 01164 * 01165 */ 01166 if (ptiCurrent->dwExpWinVer <= VER40) { 01167 if (pItem->dwItemData && pItem->lpstr == NULL) 01168 goto AintNothingLikeTheRealMDIThing; 01169 else if (!fPopup && 01170 (pItem == pMenu->rgItems) && 01171 (pMenu->cItems > 1) && 01172 !(pMenu->rgItems[1].hbmp) && 01173 (pItem->spSubMenu)) { 01174 RIPMSG0(RIP_WARNING, "Fake MDI detected, using window icon in place of bitmap"); 01175 goto AintNothingLikeTheRealMDIThing; 01176 } 01177 } 01178 01179 UserAssert(hdc != ghdcMem2); 01180 01181 dx = pItem->cxBmp; 01182 01183 if (fPopup) { 01184 dy = pItem->cyBmp; 01185 01186 // 01187 // Center bitmap in middle of item area 01188 // 01189 cyTemp = (pItem->cyItem - dy); 01190 if (cyTemp > 0) 01191 cyTemp = cyTemp / 2; 01192 else 01193 cyTemp = 0; 01194 } else { 01195 dy = max(pItem->cyBmp, SYSMET(CYMENUSIZE)); 01196 cyTemp = 0; 01197 if (pItem->lpstr != NULL) { 01198 xLeft += gcxMenuFontChar; 01199 } 01200 } 01201 01202 if (hbmSave = GreSelectBitmap(ghdcMem2, pItem->hbmp)) { 01203 BITMAP bmp; 01204 // 01205 // Draw the bitmap leaving some room on the left for the 01206 // optional check mark if we are in a popup menu. (as opposed 01207 // to a top level menu bar). 01208 // 01209 // We can do cool stuff with monochrome bitmap itmes 01210 // by merging with the current colors. 01211 // 01212 // If the item is selected and the bitmap isn't monochrome, 01213 // we just invert the thing when we draw it. We can't do 01214 // anything more clever unless we want to convert to 01215 // monochrome. 01216 // 01217 GreExtGetObjectW(pItem->hbmp, sizeof(bmp), (LPSTR)&bmp); 01218 GreBitBlt(hdc, xLeft + xHilite, cyTemp + xHilite, dx, dy, ghdcMem2, 0, 0, 01219 (bmp.bmPlanes * bmp.bmBitsPixel == 1) ? 01220 SRCSTENCIL : 01221 (mnDrawHilite(pItem) ? NOTSRCCOPY : SRCCOPY), 01222 0x00FFFFFF); 01223 GreSelectBitmap(ghdcMem2, hbmSave); 01224 } else { 01225 RIPMSG3(RIP_WARNING, "Menu 0x%08X, item 0x%08X: Tried to draw invalid bitmap 0x%08X", pMenu, pItem, pItem->hbmp) ; 01226 } 01227 } 01228 01229 01230 RealDrawMenuItemText: 01231 if (pItem->lpstr != NULL) { 01232 /* 01233 * We want the text in all popup menu items to be aligned 01234 * if an alignment offset is available. 01235 */ 01236 if (fPopup && (pMenu->cxTextAlign != 0)) { 01237 xLeft = pMenu->cxTextAlign; 01238 } else if (pItem->hbmp != NULL) { 01239 xLeft += pItem->cxBmp + SYSMET(CXEDGE); 01240 } 01241 01242 // This item is a text string item. Display it. 01243 yTop = gcyMenuFontExternLeading; 01244 01245 cyTemp = pItem->cyItem - (gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYBORDER)); 01246 if (cyTemp > 0) 01247 yTop += (cyTemp / 2); 01248 01249 if (!fPopup && (pItem->hbmp == NULL)) { 01250 xLeft += gcxMenuFontChar; 01251 } 01252 01253 lpsz = TextPointer(pItem->lpstr); 01254 if (lpsz!=NULL) { 01255 cch = pItem->cch; 01256 01257 // Even though we no longer support any funky handling of the 01258 // help prefix character, we still need to eat it up if we run 01259 // across it so that the menu item is drawn correctly 01260 if ((*lpsz == CH_HELPPREFIX) && !fPopup) { 01261 // Skip help prefix character. 01262 lpsz++; 01263 cch--; 01264 } 01265 01266 // tp will contain the character position of the \t indicator 01267 // in the menu string. This is where we add a tab to the string. 01268 // 01269 // rp will contain the character position of the \a indicator 01270 // in the string. All text following this is right aligned. 01271 tp = FindCharPosition(lpsz, TEXT('\t')); 01272 rp = FindCharPosition(lpsz, TEXT('\t') - 1); 01273 01274 xFarLeft = pItem->cxItem - (gpsi->oembmi[OBI_MENUCHECK].cx + MNXSPACE); 01275 01276 if (rp && (rp != cch)) { 01277 // Display all the text up to the \a 01278 if (TestMFT(pItem, MFT_RIGHTORDER) && fPopup) { 01279 SIZE extent; 01280 01281 xxxPSMGetTextExtent(hdc, lpsz, rp, &extent); 01282 xLeft = xFarLeft - extent.cx; 01283 } 01284 xxxDrawMenuItemText(pItem, hdc, xLeft + xHilite, yTop + xHilite, lpsz, rp, 01285 TestMF(pMenu, MFUNDERLINE)); 01286 01287 // Do we also have a tab beyond the \a ?? 01288 if (tp > rp + 1) { 01289 SIZE extent; 01290 01291 if (TestMFT(pItem, MFT_RIGHTORDER) && fPopup) { 01292 xLeft = xFarLeft - pItem->dxTab ; 01293 } else { 01294 xxxPSMGetTextExtent(hdc, lpsz + rp + 1, 01295 (UINT)(tp - rp - 1), &extent); 01296 xLeft = (int)(pItem->dxTab - extent.cx); 01297 } 01298 // 01299 // lotus in Hebrew make their menus by putting the 01300 // accelerator on the left and the text on the right 01301 // 01302 xxxPSMTextOut(hdc, xLeft, yTop, (LPWSTR)(lpsz + rp + 1), tp - rp - 1, 01303 TestMF(pMenu, MFUNDERLINE) ? 0 : DT_HIDEPREFIX); 01304 } 01305 } else if (tp && rp == cch) { 01306 // Display text up to the tab position 01307 if (TestMFT(pItem, MFT_RIGHTORDER)) { 01308 SIZE extent; 01309 01310 xxxPSMGetTextExtent(hdc, lpsz, tp, &extent); 01311 xLeft = xFarLeft - extent.cx; 01312 if (!fPopup && (pItem->hbmp == NULL)) { 01313 xLeft += gcxMenuFontChar; 01314 } 01315 } 01316 xxxDrawMenuItemText(pItem, hdc, xLeft + xHilite, yTop + xHilite, lpsz, tp, 01317 TestMF(pMenu, MFUNDERLINE)); 01318 } 01319 01320 // Any text left to display (like after the tab) ?? 01321 if (tp < cch - 1) { 01322 if (TestMFT(pItem, MFT_RIGHTORDER) && fPopup) { 01323 SIZE extent; 01324 01325 xxxPSMGetTextExtent(hdc, lpsz + tp + 1, (int)cch - tp - 1, &extent); 01326 xLeft = pItem->cxItem - pItem->dxTab - extent.cx; 01327 } else { 01328 xLeft = pItem->dxTab + gcxMenuFontChar; 01329 } 01330 xxxPSMTextOut(hdc, xLeft, yTop, lpsz + tp + 1, cch - tp - 1, 01331 TestMF(pMenu, MFUNDERLINE) ? 0 : DT_HIDEPREFIX); 01332 } 01333 } 01334 } 01335 01336 // 01337 // Draw the hierarchical arrow for the cascade menu. 01338 // 01339 if (fPopup && (pItem->spSubMenu != NULL)) { 01340 POEMBITMAPINFO pOem; 01341 01342 pOem = gpsi->oembmi + (TestMFT(pItem, MFT_RIGHTORDER) 01343 ? OBI_MENUARROW_L : OBI_MENUARROW); 01344 01345 // This item has a hierarchical popup associated with it. Draw the 01346 // bitmap dealy to signify its presence. Note we check if fPopup is set 01347 // so that this isn't drawn for toplevel menus that have popups. 01348 01349 BltColor(hdc, 01350 NULL, 01351 HDCBITS(), 01352 TestMFT(pItem, MFT_RIGHTORDER) 01353 ? pOem->cx : 01354 pItem->cxItem - pOem->cx, 01355 max((INT)(pItem->cyItem - 2 - pOem->cy) / 2, 0), 01356 pOem->cx, 01357 pOem->cy, 01358 pOem->x, 01359 pOem->y, 01360 BC_INVERT); 01361 } 01362 01363 return(TRUE); 01364 }

VOID xxxRealizeDesktop PWND  pwnd  ) 
 

Definition at line 863 of file desktop.c.

References _GetDC(), _ReleaseDC(), CheckLock, FALSE, FNID_DESKTOP, GETFNID, ghpalWallpaper, VOID(), and xxxInternalPaintDesktop().

Referenced by xxxBroadcastPaletteChanged(), and xxxDesktopWndProc().

00864 { 00865 CheckLock(pwnd); 00866 UserAssert(GETFNID(pwnd) == FNID_DESKTOP); 00867 00868 if (ghpalWallpaper) { 00869 HDC hdc = _GetDC(pwnd); 00870 xxxInternalPaintDesktop(pwnd, hdc, FALSE); 00871 _ReleaseDC(hdc); 00872 } 00873 }

int xxxRealizePalette HDC  hdc  ) 
 

Definition at line 146 of file palette.c.

References DTF_NEEDSPALETTECHANGED, tagDESKTOP::dwDTFlags, DWORD, FALSE, FreeAllSpbs(), grpWinStaList, tagWND::head, NULL, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, tagWINDOWSTATION::rpwinstaNext, ThreadLock, ThreadUnlock, WindowFromCacheDC(), and xxxBroadcastPaletteChanged().

Referenced by BMPtoDIB(), ConvertToDDB(), DIBtoBMP(), xxxDrawWallpaper(), and xxxInternalPaintDesktop().

00148 { 00149 PWND pwnd; 00150 DWORD dwNumChanged; 00151 PWINDOWSTATION pwinsta; 00152 PDESKTOP pdesk; 00153 TL tlpwnd; 00154 00155 dwNumChanged = GreRealizePalette(hdc); 00156 00157 if (HIWORD(dwNumChanged) && IsDCCurrentPalette(hdc)) { 00158 00159 pwnd = WindowFromCacheDC(hdc); 00160 00161 /* 00162 * if there is no associated window, don't send the palette change 00163 * messages since this is a memory hdc. 00164 */ 00165 if (pwnd != NULL) { 00166 /* 00167 * Ok, send WM_PALETTECHANGED message to everyone. The wParam 00168 * contains a handle to the currently active window. Send 00169 * message to the desktop also, so things on the desktop bitmap 00170 * will paint ok. 00171 */ 00172 ThreadLock(pwnd, &tlpwnd); 00173 xxxBroadcastPaletteChanged(pwnd, FALSE); 00174 ThreadUnlock(&tlpwnd); 00175 00176 /* 00177 * Mark all other desktops as needing to send out 00178 * WM_PALETTECHANGED messages. 00179 */ 00180 00181 pwinsta = grpWinStaList; 00182 00183 while (pwinsta != NULL) { 00184 pdesk = pwinsta->rpdeskList; 00185 while (pdesk != NULL) { 00186 if (pdesk != pwnd->head.rpdesk) { 00187 pdesk->dwDTFlags |= DTF_NEEDSPALETTECHANGED; 00188 } 00189 pdesk = pdesk->rpdeskNext; 00190 } 00191 pwinsta = pwinsta->rpwinstaNext; 00192 } 00193 00194 GreRealizePalette(hdc); 00195 } 00196 } 00197 00198 /* 00199 * Walk through the SPB list (the saved bitmaps under windows with the 00200 * CS_SAVEBITS style) discarding all bitmaps 00201 */ 00202 if (HIWORD(dwNumChanged)) { 00203 FreeAllSpbs(); 00204 } 00205 00206 return LOWORD(dwNumChanged); 00207 }

VOID xxxReceiveMessage PTHREADINFO   ) 
 

Definition at line 1964 of file kernel/sendmsg.c.

References BOOL, CallClientProcA, CheckCritIn, tagCLIENTTHREADINFO::CTIF_flags, CTIF_INSENDMESSAGE, DirectedScheduleTask(), tagINTERSENDMSGEX::dwData, FALSE, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeBits, tagINTERSENDMSGEX::fuCall, HW, tagHOOK::iHook, IsHooked, ISM_CALLBACK, ISM_CB_CLIENT, ISM_REPLY, L, tagHOOKMSGSTRUCT::lParam, tagINTERSENDMSGEX::lpResultCallBack, _CWPRETSTRUCTEX::lResult, tagINTERSENDMSGEX::lRet, tagHOOKMSGSTRUCT::nCode, NULL, tagTHREADINFO::pcti, tagHOOKMSGSTRUCT::phk, PHOOKMSGSTRUCT, PSMS, tagTHREADINFO::psmsCurrent, tagTHREADINFO::psmsReceiveList, _CWPRETSTRUCTEX::psmsSender, _CWPSTRUCTEX::psmsSender, tagTHREADINFO::psmsSent, SET_FLAG, SET_OR_CLEAR_FLAG, SetWakeBit(), SMF_CB_CLIENT, SMF_CB_REPLY, SMF_CB_REQUEST, SMF_RECEIVEDMESSAGE, SMF_RECEIVERBUSY, SMF_RECEIVERDIED, SMF_RECEIVERFREE, SMF_REPLY, SMF_SENDERDIED, TestWF, ThreadLock, ThreadUnlock, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, UnlinkSendListSms(), VOID(), WFSERVERSIDEPROC, WHF_CALLWNDPROC, WHF_CALLWNDPROCRET, xxxCallHook(), xxxCallHook2(), xxxInterSendMsgEx(), XXXSENDMESSAGETOCLIENT, and xxxSleepTask().

01971 : 01972 * 01-13-91 DavidPe Ported. 01973 * 01-23-91 DavidPe Add xxxSendNotifyMessage() support. 01974 * 07-14-92 ChrisBl Added xxxSendMessageCallback support. 01975 \***********************************************************************/ 01976 01977 VOID xxxReceiveMessage( 01978 PTHREADINFO ptiReceiver) 01979 { 01980 PSMS psms; 01981 PSMS psmsCurrentSave; 01982 PTHREADINFO ptiSender; 01983 LRESULT lRet = 0; 01984 TL tlpwnd; 01985 01986 CheckCritIn(); 01987 01988 /* 01989 * Get the SMS and unlink it from the list of SMSs we've received 01990 */ 01991 psms = ptiReceiver->psmsReceiveList; 01992 01993 /* 01994 * This can be NULL because an SMS can be removed in our cleanup 01995 * code without clearing the QS_SENDMESSAGE bit. 01996 */ 01997 if (psms == NULL) { 01998 ptiReceiver->pcti->fsWakeBits &= ~QS_SENDMESSAGE; 01999 ptiReceiver->pcti->fsChangeBits &= ~QS_SENDMESSAGE; 02000 return; 02001 } 02002 02003 ptiReceiver->psmsReceiveList = psms->psmsReceiveNext; 02004 psms->psmsReceiveNext = NULL; 02005 02006 /* 02007 * We've taken the SMS off the receive list - mark the SMS with this 02008 * information - used during cleanup. 02009 */ 02010 psms->flags |= SMF_RECEIVERBUSY | SMF_RECEIVEDMESSAGE; 02011 02012 /* 02013 * Clear QS_SENDMESSAGE wakebit if list is now empty 02014 */ 02015 if (ptiReceiver->psmsReceiveList == NULL) { 02016 ptiReceiver->pcti->fsWakeBits &= ~QS_SENDMESSAGE; 02017 ptiReceiver->pcti->fsChangeBits &= ~QS_SENDMESSAGE; 02018 } 02019 02020 ptiSender = psms->ptiSender; 02021 02022 if (psms->flags & SMF_CB_REPLY) { 02023 /* 02024 * From SendMessageCallback REPLY to callback. We need to call 02025 * the call back function to give the return value. 02026 * Don't process any this message, just mechanism for notification 02027 * the sender's thread lock is already gone, so we need to re-lock here. 02028 */ 02029 if (ptiSender == NULL) { 02030 ThreadLock(psms->spwnd, &tlpwnd); 02031 } 02032 02033 if (psms->flags & SMF_CB_CLIENT) { 02034 /* 02035 * Application-defined callback proc is neither Unicode nor ANSI 02036 */ 02037 CallClientProcA(psms->spwnd, psms->message, psms->dwData, 02038 psms->lRet, (ULONG_PTR)psms->lpResultCallBack); 02039 } else { 02040 psms->lpResultCallBack(HW(psms->spwnd), psms->message, 02041 psms->dwData, psms->lRet); 02042 } 02043 02044 if (ptiSender == NULL) { 02045 ThreadUnlock(&tlpwnd); 02046 } 02047 } else if (!(psms->flags & (SMF_REPLY | SMF_SENDERDIED | SMF_RECEIVERDIED))) { 02048 /* 02049 * Don't process message if it has been replied to already or 02050 * if the sending or receiving thread has died 02051 */ 02052 02053 /* 02054 * Set new psmsCurrent for this queue, saving the current one 02055 */ 02056 psmsCurrentSave = ptiReceiver->psmsCurrent; 02057 ptiReceiver->psmsCurrent = psms; 02058 SET_FLAG(ptiReceiver->pcti->CTIF_flags, CTIF_INSENDMESSAGE); 02059 02060 /* 02061 * If this SMS originated from a xxxSendNotifyMessage() or a 02062 * xxxSendMessageCallback() call, the sender's thread lock is 02063 * already gone, so we need to re-lock here. 02064 */ 02065 if (ptiSender == NULL) { 02066 ThreadLock(psms->spwnd, &tlpwnd); 02067 } 02068 02069 if (psms->message == WM_HOOKMSG) { 02070 union { 02071 EVENTMSG emsg; // WH_JOURNALRECORD/PLAYBACK 02072 MOUSEHOOKSTRUCTEX mhs; // WH_MOUSE 02073 KBDLLHOOKSTRUCT kbds; // WH_KEYBORD_LL 02074 MSLLHOOKSTRUCT mslls;// WH_MOUSE_LL 02075 #ifdef REDIRECTION 02076 HTHOOKSTRUCT ht; // WH_HITTEST 02077 #endif // REDIRECTION 02078 } LocalData; 02079 PVOID pSendersData; 02080 PHOOKMSGSTRUCT phkmp; 02081 int iHook; 02082 BOOL bAnsiHook; 02083 02084 /* 02085 * Some hook types (eg: WH_JOURNALPLAYBACK) pass pointers to 02086 * data in the calling thread's stack. We must copy this to our 02087 * own (called thread's) stack for safety because of the way this 02088 * "message" is handled and in case the calling thread dies. #13577 02089 * 02090 * Originally only WH_JOURNALRECORD and WH_JOURNALPLAYBACK went 02091 * through this code, but now all sorts of hooks do. 02092 */ 02093 phkmp = (PHOOKMSGSTRUCT)psms->lParam; 02094 pSendersData = (PVOID)(phkmp->lParam); 02095 iHook = phkmp->phk->iHook; 02096 02097 switch (iHook) { 02098 case WH_JOURNALRECORD: 02099 case WH_JOURNALPLAYBACK: 02100 if (pSendersData) 02101 LocalData.emsg = *(PEVENTMSG)pSendersData; 02102 break; 02103 02104 case WH_MOUSE: 02105 if (pSendersData) 02106 LocalData.mhs = *(LPMOUSEHOOKSTRUCTEX)pSendersData; 02107 break; 02108 02109 case WH_KEYBOARD_LL: 02110 if (pSendersData) 02111 LocalData.kbds = *(LPKBDLLHOOKSTRUCT)pSendersData; 02112 break; 02113 02114 case WH_MOUSE_LL: 02115 if (pSendersData) 02116 LocalData.mslls = *(LPMSLLHOOKSTRUCT)pSendersData; 02117 break; 02118 02119 #ifdef REDIRECTION 02120 case WH_HITTEST: 02121 if (pSendersData) 02122 LocalData.ht = *(LPHTHOOKSTRUCT)pSendersData; 02123 break; 02124 #endif // REDIRECTION 02125 02126 case WH_KEYBOARD: 02127 case WH_SHELL: 02128 /* 02129 * Fall thru... 02130 */ 02131 pSendersData = NULL; 02132 break; 02133 02134 default: 02135 /* 02136 * No pointers: wParam & lParam can be sent as is. 02137 */ 02138 RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "Receive hook %d", iHook); 02139 pSendersData = NULL; 02140 break; 02141 } 02142 02143 02144 lRet = xxxCallHook2(phkmp->phk, phkmp->nCode, psms->wParam, 02145 pSendersData ? (LPARAM)&LocalData : phkmp->lParam, &bAnsiHook); 02146 02147 /* 02148 * Copy back data only if the sender hasn't died or timed out 02149 * (timed out messages are marked SMF_REPLY by the sending thread) 02150 */ 02151 if (!(psms->flags & (SMF_SENDERDIED|SMF_REPLY)) && pSendersData) { 02152 switch (iHook) { 02153 case WH_JOURNALRECORD: 02154 case WH_JOURNALPLAYBACK: 02155 *(PEVENTMSG)pSendersData = LocalData.emsg; 02156 break; 02157 02158 case WH_KEYBOARD_LL: 02159 *(LPKBDLLHOOKSTRUCT)pSendersData = LocalData.kbds; 02160 break; 02161 02162 case WH_MOUSE_LL: 02163 *(LPMSLLHOOKSTRUCT)pSendersData = LocalData.mslls; 02164 break; 02165 02166 case WH_MOUSE: 02167 *(LPMOUSEHOOKSTRUCTEX)pSendersData = LocalData.mhs; 02168 break; 02169 02170 #ifdef REDIRECTION 02171 case WH_HITTEST: 02172 *(LPHTHOOKSTRUCT)pSendersData = LocalData.ht; 02173 break; 02174 #endif // REDIRECTION 02175 } 02176 } 02177 02178 } else { 02179 /* 02180 * Call WH_CALLWNDPROC if it's installed and the window is not marked 02181 * as destroyed. 02182 */ 02183 if (IsHooked(ptiReceiver, WHF_CALLWNDPROC)) { 02184 CWPSTRUCTEX cwps; 02185 02186 cwps.hwnd = HW(psms->spwnd); 02187 cwps.message = psms->message; 02188 cwps.wParam = psms->wParam; 02189 cwps.lParam = psms->lParam; 02190 cwps.psmsSender = psms; 02191 02192 xxxCallHook(HC_ACTION, TRUE, (LPARAM)&cwps, WH_CALLWNDPROC); 02193 02194 /* 02195 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 02196 * to the CWPSTRUCT contents. If this behavior reverts to 02197 * Win3.1 semantics, we will need to copy the new parameters 02198 * from cwps. 02199 */ 02200 } 02201 02202 if (!(psms->flags & (SMF_REPLY | SMF_SENDERDIED | SMF_RECEIVERDIED)) && 02203 psms->spwnd != NULL) { 02204 if (TestWF(psms->spwnd, WFSERVERSIDEPROC)) { 02205 TL tlpwndKernel; 02206 02207 ThreadLock(psms->spwnd, &tlpwndKernel); 02208 /* 02209 * If this window's proc is meant to be executed from the server side 02210 * we'll just stay inside the semaphore and call it directly. Note 02211 * how we don't convert the pwnd into an hwnd before calling the proc. 02212 */ 02213 lRet = psms->spwnd->lpfnWndProc(psms->spwnd, psms->message, 02214 psms->wParam, psms->lParam); 02215 02216 ThreadUnlock(&tlpwndKernel); 02217 } else { 02218 /* 02219 * Call the client or xxxDefWindowProc. 02220 */ 02221 XXXSENDMESSAGETOCLIENT(psms->spwnd, psms->message, psms->wParam, psms->lParam, 02222 psms, TRUE); 02223 } 02224 02225 /* 02226 * Call WH_CALLWNDPROCRET if it's installed. 02227 */ 02228 if (IsHooked(ptiReceiver, WHF_CALLWNDPROCRET) && 02229 !(psms->flags & SMF_SENDERDIED)) { 02230 CWPRETSTRUCTEX cwps; 02231 02232 cwps.hwnd = HW(psms->spwnd); 02233 cwps.message = psms->message; 02234 cwps.wParam = psms->wParam; 02235 cwps.lParam = psms->lParam; 02236 cwps.lResult = lRet; 02237 cwps.psmsSender = psms; 02238 02239 /* 02240 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 02241 * to the CWPSTRUCT contents. 02242 */ 02243 xxxCallHook(HC_ACTION, TRUE, (LPARAM)&cwps, WH_CALLWNDPROCRET); 02244 02245 /* 02246 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 02247 * to the CWPSTRUCT contents. If this behavior reverts to 02248 * Win3.1 semantics, we will need to copy the new parameters 02249 * from cwps. 02250 */ 02251 } 02252 } 02253 } 02254 02255 if ((psms->flags & (SMF_CB_REQUEST | SMF_REPLY)) == SMF_CB_REQUEST) { 02256 02257 /* 02258 * From SendMessageCallback REQUEST callback. Send the message 02259 * back with a the REPLY value. 02260 */ 02261 INTRSENDMSGEX ism; 02262 02263 psms->flags |= SMF_REPLY; 02264 02265 if (!(psms->flags & SMF_SENDERDIED)) { 02266 ism.fuCall = ISM_CALLBACK | ISM_REPLY; 02267 if (psms->flags & SMF_CB_CLIENT) 02268 ism.fuCall |= ISM_CB_CLIENT; 02269 ism.lpResultCallBack = psms->lpResultCallBack; 02270 ism.dwData = psms->dwData; 02271 ism.lRet = lRet; 02272 02273 xxxInterSendMsgEx(psms->spwnd, psms->message, 0L, 0L, 02274 NULL, psms->ptiCallBackSender, &ism ); 02275 } 02276 } 02277 02278 if (ptiSender == NULL) { 02279 ThreadUnlock(&tlpwnd); 02280 } 02281 02282 /* 02283 * Restore receiver's original psmsCurrent. 02284 */ 02285 ptiReceiver->psmsCurrent = psmsCurrentSave; 02286 SET_OR_CLEAR_FLAG(ptiReceiver->pcti->CTIF_flags, 02287 CTIF_INSENDMESSAGE, 02288 ptiReceiver->psmsCurrent); 02289 02290 #ifdef DEBUG_SMS 02291 ValidateSmsSendLists(psmsCurrentSave); 02292 #endif 02293 } 02294 02295 /* 02296 * We're done with this sms, so the appropriate thread 02297 * can now free it. 02298 */ 02299 psms->flags &= ~SMF_RECEIVERBUSY; 02300 02301 /* 02302 * Free the sms and return without reply if the 02303 * SMF_RECEIVERFREE bit is set. Handily, this does just what we 02304 * want for xxxSendNotifyMessage() since we set SMF_RECEIVERFREE 02305 * in that case. 02306 */ 02307 if (psms->flags & SMF_RECEIVERFREE) { 02308 UnlinkSendListSms(psms, NULL); 02309 return; 02310 } 02311 02312 /* 02313 * Set reply flag and return value if this message has not already 02314 * been replied to with ReplyMessage(). 02315 */ 02316 if (!(psms->flags & SMF_REPLY)) { 02317 psms->lRet = lRet; 02318 psms->flags |= SMF_REPLY; 02319 02320 /* 02321 * Tell the sender, the reply is done 02322 */ 02323 if (ptiSender != NULL) { 02324 /* 02325 * Wake up the sender thread. 02326 */ 02327 SetWakeBit(ptiSender, QS_SMSREPLY); 02328 02329 /* 02330 * We have 4 conditions to satisfy: 02331 * 02332 * 16 - 16 : yielding required, if sender is waiting for this reply 02333 * 32 - 16 : yielding required, if sender is waiting for this reply 02334 * 16 - 32 : no yielding required 02335 * 32 - 32 : No yielding required. 02336 */

VOID xxxRecreateSmallIcons PWND  pwnd  ) 
 

Definition at line 75 of file metrics.c.

References _GetProp(), tagSERVERINFO::atomIconProp, BOOL, CheckLock, DestroyClassSmIcon(), DestroyWindowSmIcon(), gpsi, MAKEINTATOM, tagWND::pcls, PROPF_INTERNAL, TestWF, TRUE, VOID(), WFSMQUERYDRAGICON, xxxCreateClassSmIcon(), and xxxCreateWindowSmIcon().

Referenced by xxxDWP_SetIcon().

00076 { 00077 BOOL fSmQueryDrag; 00078 00079 CheckLock(pwnd); 00080 00081 if (DestroyClassSmIcon(pwnd->pcls)) 00082 xxxCreateClassSmIcon(pwnd->pcls); 00083 00084 fSmQueryDrag = (TestWF(pwnd, WFSMQUERYDRAGICON) != 0); 00085 if (DestroyWindowSmIcon(pwnd) && !fSmQueryDrag) 00086 xxxCreateWindowSmIcon(pwnd, (HICON)_GetProp(pwnd, MAKEINTATOM(gpsi->atomIconProp), PROPF_INTERNAL), TRUE); 00087 }

VOID xxxRedrawFrame PWND  pwnd  ) 
 

Definition at line 192 of file drawfrm.c.

References CheckLock, NULL, and xxxSetWindowPos().

Referenced by xxxDrawMenuBar(), xxxSetMenu(), xxxSetScrollBar(), xxxSetWindowStyle(), and xxxShowScrollBar().

00194 { 00195 CheckLock(pwnd); 00196 00197 /* 00198 * We always want to call xxxSetWindowPos, even if invisible or iconic, 00199 * because we need to make sure the WM_NCCALCSIZE message gets sent. 00200 */ 00201 xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | 00202 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); 00203 }

VOID xxxRedrawFrameAndHook PWND  pwnd  ) 
 

Definition at line 205 of file drawfrm.c.

References CheckLock, HWq, IsTrayWindow(), L, NULL, PostShellHookMessages(), xxxCallHook(), and xxxSetWindowPos().

00207 { 00208 CheckLock(pwnd); 00209 00210 /* 00211 * We always want to call xxxSetWindowPos, even if invisible or iconic, 00212 * because we need to make sure the WM_NCCALCSIZE message gets sent. 00213 */ 00214 xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | 00215 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_DRAWFRAME); 00216 if ( IsTrayWindow(pwnd) ) { 00217 HWND hw = HWq(pwnd); 00218 xxxCallHook(HSHELL_REDRAW, (WPARAM)hw, 0L, WH_SHELL); 00219 PostShellHookMessages(HSHELL_REDRAW, (LPARAM)hw); 00220 00221 } 00222 }

VOID xxxRedrawHungWindow PWND  pwnd,
HRGN  hrgnFullDrag
 

Definition at line 135 of file hungapp.c.

References _GetDCEx(), _GetWindowLong, _ReleaseDC(), tagCLS::atomClassName, BEGINATOMICCHECK, CheckCritIn, CheckLock, ClearHungFlag(), CMSHUNGAPPTIMEOUT, CopyRect, CopyRgn, CreateEmptyRgn(), DWORD, ENDATOMICCHECK, FHungApp(), FillRect(), gatomConsoleClass, GetCurrentProcessId, GETPTI, ghbrHungApp, ghrgnInv2, tagWND::head, HRGN_FULL, tagWND::hrgnUpdate, IntersectRect(), IntersectRgn, NULL, OffsetRect(), tagWND::pcls, PWNDDESKTOP, tagWND::rcWindow, SetRectRgnIndirect(), SetWF, tagWND::spwndChild, tagWND::spwndNext, SYSHBR, SYSHBRUSH, TestWF, TestwndFrameOn, ThreadLock, ThreadLockExchangeAlways(), ThreadLockNever, ThreadUnlock, TRUE, UINT, VOID(), WFCLIPCHILDREN, WFCLIPSIBLINGS, WFDESTROYED, WFDIALOGWINDOW, WFREDRAWIFHUNG, WFSENDERASEBKGND, WFSENDNCPAINT, WFSTARTPAINT, WFUPDATEDIRTY, WFVISIBLE, WFWIN40COMPAT, WINDOW, xxxCalcClientRect(), xxxDrawWindowFrame(), xxxInternalInvalidate(), and xxxInternalPaintDesktop().

Referenced by xxxHungAppDemon(), xxxSimpleDoSyncPaint(), and xxxUpdateOtherThreadsWindows().

00138 { 00139 HDC hdc; 00140 HBRUSH hbr; 00141 HRGN hrgnUpdate; 00142 RECT rc; 00143 TL tlpwnd; // should remove (IanJa) 00144 UINT flags; 00145 W32PID sid; 00146 DWORD dwColor; 00147 PWND pwndDesk; 00148 TL tlpwndDesk; 00149 00150 CheckCritIn(); 00151 CheckLock(pwnd); 00152 00153 if (pwnd->hrgnUpdate == NULL) { 00154 return; 00155 } 00156 00157 #ifdef HUNGAPP_GHOSTING 00158 00159 /* 00160 * Don't bother doing anything here when the window isn't even visible. 00161 */ 00162 if (!TestWF(pwnd, WFVISIBLE)) { 00163 return; 00164 } 00165 00166 /* 00167 * This function can be called from the full-drag code to quick redraw 00168 * windows that aren't hung. In that case check if that thread is hung. 00169 */ 00170 if ((hrgnFullDrag == NULL) || (hrgnFullDrag != NULL && 00171 FHungApp(GETPTI(pwnd), CMSHUNGAPPTIMEOUT))) { 00172 SignalGhost(pwnd); 00173 } 00174 00175 #endif // HUNGAPP_GHOSTING 00176 00177 /* 00178 * First calculate hrgnUpdate. 00179 */ 00180 if (pwnd->hrgnUpdate > HRGN_FULL) { 00181 hrgnUpdate = CreateEmptyRgn(); 00182 if (hrgnUpdate == NULL) { 00183 hrgnUpdate = HRGN_FULL; 00184 00185 } else if (CopyRgn(hrgnUpdate, pwnd->hrgnUpdate) == ERROR) { 00186 GreDeleteObject(hrgnUpdate); 00187 hrgnUpdate = HRGN_FULL; 00188 } 00189 00190 } else { 00191 00192 /* 00193 * For our purposes, we need a real hrgnUpdate, so try and 00194 * create one if even if the entire window needs updating. 00195 */ 00196 CopyRect(&rc, &pwnd->rcWindow); 00197 hrgnUpdate = GreCreateRectRgnIndirect(&rc); 00198 if (hrgnUpdate == NULL) { 00199 hrgnUpdate = HRGN_FULL; 00200 } 00201 } 00202 00203 /* 00204 * If we're redrawing because we're full dragging and if the window's 00205 * update region does not intersect with the Full drag 00206 * update region, don't erase the hung window again. This is to prevent 00207 * flickering when a window has been invalidated by another window doing 00208 * full drag and hasn't received the paint message yet. 00209 * This way, only if there is a new region that has been invalidated will 00210 * we redraw the hung window. 00211 */ 00212 if (hrgnFullDrag && hrgnUpdate != HRGN_FULL && 00213 IntersectRgn(hrgnUpdate, hrgnUpdate, hrgnFullDrag) == NULLREGION) { 00214 GreDeleteObject(hrgnUpdate); 00215 return; 00216 } 00217 00218 ThreadLock(pwnd, &tlpwnd); // should remove (IanJa) 00219 00220 hdc = _GetDCEx(pwnd, hrgnUpdate, DCX_USESTYLE | DCX_WINDOW | 00221 DCX_INTERSECTRGN | DCX_NODELETERGN | DCX_LOCKWINDOWUPDATE); 00222 xxxDrawWindowFrame(pwnd, hdc, TRUE, TestwndFrameOn(pwnd)); 00223 _ReleaseDC(hdc); 00224 00225 CopyRect(&rc, &pwnd->rcWindow); 00226 xxxCalcClientRect(pwnd, &rc, TRUE); 00227 SetRectRgnIndirect(ghrgnInv2, &rc); 00228 00229 if (hrgnUpdate > HRGN_FULL) { 00230 switch (IntersectRgn(hrgnUpdate, hrgnUpdate, ghrgnInv2)) { 00231 00232 case ERROR: 00233 GreDeleteObject(hrgnUpdate); 00234 hrgnUpdate = HRGN_FULL; 00235 break; 00236 00237 case NULLREGION: 00238 /* 00239 * There is nothing in the client area to repaint. 00240 * Blow the region away, and decrement the paint count 00241 * if possible. 00242 */ 00243 GreDeleteObject(hrgnUpdate); 00244 hrgnUpdate = NULL; 00245 break; 00246 } 00247 } 00248 00249 /* 00250 * Erase the rest of the window. 00251 * When pwnd isn't WFCLIPCHILDREN, make sure valid children bits 00252 * don't get overwritten if the child is in the middle of BeginPaint 00253 * or just completed it's painting and it's hrgnUpdate is NULL. 00254 */ 00255 if (hrgnUpdate != NULL && !TestWF(pwnd, WFCLIPCHILDREN)) { 00256 RECT rcT; 00257 PWND pwndT; 00258 00259 if (hrgnUpdate == HRGN_FULL) { 00260 rc = pwnd->rcWindow; 00261 } else { 00262 GreGetRgnBox(hrgnUpdate, &rc); 00263 } 00264 00265 for (pwndT = pwnd->spwndChild; pwndT != NULL; 00266 pwndT = pwndT->spwndNext) { 00267 00268 if (TestWF(pwndT, WFVISIBLE) && 00269 (TestWF(pwndT, WFSTARTPAINT) || pwndT->hrgnUpdate == NULL) && 00270 IntersectRect(&rcT, &rc, &pwndT->rcWindow)) { 00271 00272 /* 00273 * This invalidate call won't leave the critial section. In 00274 * reality the entire xxxRedrawHungWindow must not leave 00275 * the critical section. 00276 */ 00277 BEGINATOMICCHECK(); 00278 xxxInternalInvalidate(pwndT, hrgnUpdate, RDW_INVALIDATE | 00279 RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN); 00280 ENDATOMICCHECK(); 00281 } 00282 } 00283 } 00284 00285 /* 00286 * Get a window dc so that the menu and scroll bar areas are erased 00287 * appropriately. But make sure it is clipped so that the children 00288 * get clipped out correctly! If we don't do this, this we could erase 00289 * children that aren't invalid. 00290 * 00291 * Note: DCX_WINDOW and DCX_USESTYLE will never clip out children. 00292 * Need to pass the clipping styles in directly, instead of passing 00293 * DCX_USESTYLE. 00294 */ 00295 flags = DCX_INTERSECTRGN | DCX_WINDOW | DCX_CACHE; 00296 if (TestWF(pwnd, WFCLIPSIBLINGS)) 00297 flags |= DCX_CLIPSIBLINGS; 00298 if (TestWF(pwnd, WFCLIPCHILDREN)) 00299 flags |= DCX_CLIPCHILDREN; 00300 00301 hdc = _GetDCEx(pwnd, hrgnUpdate, flags); 00302 00303 if (pwnd == pwnd->head.rpdesk->pDeskInfo->spwndBkGnd) { 00304 pwndDesk = PWNDDESKTOP(pwnd); 00305 ThreadLock(pwndDesk, &tlpwndDesk); 00306 xxxInternalPaintDesktop(PWNDDESKTOP(pwnd), hdc, TRUE); 00307 ThreadUnlock(&tlpwndDesk); 00308 00309 } else { 00310 00311 rc = pwnd->rcWindow; 00312 00313 OffsetRect(&rc, -pwnd->rcWindow.left, -pwnd->rcWindow.top); 00314 00315 /* 00316 * Erase the rest of the window using the window' class background 00317 * brush. 00318 */ 00319 if ((hbr = pwnd->pcls->hbrBackground) != NULL) { 00320 if (hbr <= (HBRUSH)COLOR_ENDCOLORS + 1) 00321 hbr = SYSHBRUSH((ULONG_PTR)hbr - 1); 00322 } else { 00323 /* 00324 * Use the window brush for windows and 3.x dialogs, 00325 * Use the COLOR3D brush for 4.x dialogs. 00326 */ 00327 if (TestWF(pwnd, WFDIALOGWINDOW) && TestWF(pwnd, WFWIN40COMPAT)) 00328 hbr = SYSHBR(3DFACE); 00329 else 00330 hbr = SYSHBR(WINDOW); 00331 } 00332 00333 /* 00334 * If the window's class background brush is public, use it. 00335 */ 00336 sid = (W32PID)GreGetObjectOwner((HOBJ)hbr, BRUSH_TYPE); 00337 if (sid == (W32PID)(ULONG_PTR)GetCurrentProcessId() || sid == OBJECT_OWNER_PUBLIC) { 00338 00339 FillRect(hdc, &rc, hbr); 00340 00341 } else { 00342 00343 /* 00344 * The window's class background brush is not public. 00345 * We get its color and set the color of our own public brush and use 00346 * that for the background brush. 00347 */ 00348 00349 /* 00350 * If the window is a console window, get the console background brush. 00351 * This brush will be different than the console class brush if the user 00352 * changed the console background color. 00353 */ 00354 if (gatomConsoleClass == pwnd->pcls->atomClassName) { 00355 00356 dwColor = _GetWindowLong(pwnd, GWL_CONSOLE_BKCOLOR); 00357 00358 } else { 00359 00360 if ((dwColor = GreGetBrushColor(hbr)) == -1) 00361 dwColor = GreGetBrushColor(SYSHBR(WINDOW)); 00362 } 00363 00364 GreSetSolidBrush(ghbrHungApp, dwColor); 00365 00366 FillRect(hdc, &rc, ghbrHungApp); 00367 } 00368 } 00369 _ReleaseDC(hdc); 00370 00371 /* 00372 * The window has been erased and framed. It only did this because the 00373 * app hasn't done it yet: 00374 * 00375 * - the app hasn't erased and frame yet. 00376 * - the app is in the middle of erasing and framing. 00377 * 00378 * The app could not of completed erasing and framing, because the 00379 * WFREDRAWIFHUNG bit is cleared when this successfully completes. 00380 * 00381 * Given that the app may be in the middle of erasing and framing, we 00382 * need to set both the erase and frame bits *again* so it erasing and 00383 * frames over again (if we don't, it never will). If the app hasn't 00384 * done any erasing/framing yet, this is a nop. 00385 */ 00386 SetWF(pwnd, WFSENDNCPAINT); 00387 SetWF(pwnd, WFSENDERASEBKGND); 00388 00389 /* 00390 * Always set WFUPDATEDIRTY: we don't want the app to draw, then stop 00391 * and have the hung app thread draw, and then allow the app to validate 00392 * itself: Mark the update region dirty - cannot be validated until the 00393 * app calls a painting function and acknowledges the update region. 00394 */ 00395 SetWF(pwnd, WFUPDATEDIRTY); 00396 00397 #ifdef WIN95DOESTHIS 00398 /* 00399 * Go through all the children and redraw hung ones too. 00400 */ 00401 if (hrgnFullDrag != NULL) { 00402 PWND pwndT; 00403 TL tlpwndT; 00404 00405 pwndT = pwnd->spwndChild; 00406 ThreadLockNever(&tlpwndT); 00407 while (pwndT) { 00408 00409 if ( TestWF(pwndT, WFREDRAWIFHUNG) && 00410 FHungApp(GETPTI(pwndT), CMSHUNGAPPTIMEOUT)) { 00411 00412 ClearHungFlag(pwndT, WFREDRAWIFHUNG); 00413 ThreadLockExchangeAlways(pwndT, &tlpwndT); 00414 xxxRedrawHungWindow(pwndT, NULL); 00415 } 00416 00417 if (TestWF(pwndT, WFDESTROYED)) { 00418 break; 00419 } 00420 00421 pwndT = pwndT->spwndNext; 00422 } 00423 00424 ThreadUnlock(&tlpwndT); 00425 } 00426 #endif 00427 00428 ThreadUnlock(&tlpwnd); // should remove (IanJa) 00429 }

VOID xxxRedrawHungWindowFrame PWND  pwnd,
BOOL  fActive
 

Definition at line 107 of file hungapp.c.

References _GetDCEx(), _ReleaseDC(), CheckLock, NULL, UINT, VOID(), and xxxDrawCaptionBar().

Referenced by xxxHungAppDemon(), and xxxSetForegroundWindow2().

00110 { 00111 HDC hdc; 00112 UINT wFlags = DC_NC | DC_NOSENDMSG; 00113 00114 CheckLock(pwnd); 00115 00116 if (fActive) 00117 wFlags |= DC_ACTIVE; 00118 00119 hdc = _GetDCEx(pwnd, NULL, DCX_USESTYLE | DCX_WINDOW); 00120 xxxDrawCaptionBar(pwnd, hdc, wFlags); 00121 _ReleaseDC(hdc); 00122 }

BOOL xxxRedrawTitle PWND  pwnd,
UINT  wFlags
 

Definition at line 766 of file dwp.c.

References _GetWindowDC(), _ReleaseDC(), BOOL, BYTE, CheckLock, FALSE, HWq, IsTrayWindow(), L, LOBYTE, PostShellHookMessages(), TestWF, TestwndFrameOn, TRUE, WFBORDERMASK, WFCAPTION, WFVISIBLE, xxxCallHook(), and xxxDrawCaptionBar().

Referenced by xxxDefWindowProc(), xxxDWP_SetIcon(), xxxEnableMenuItem(), xxxHelpLoop(), and xxxSetClassIconEnum().

00768 { 00769 BOOL fDrawn = TRUE; 00770 00771 CheckLock(pwnd); 00772 00773 if (TestWF(pwnd, WFVISIBLE)) { 00774 00775 if (TestWF(pwnd, WFBORDERMASK) == (BYTE)LOBYTE(WFCAPTION)) { 00776 00777 HDC hdc = _GetWindowDC(pwnd); 00778 if (TestwndFrameOn(pwnd)) 00779 wFlags |= DC_ACTIVE; 00780 xxxDrawCaptionBar(pwnd, hdc, wFlags); 00781 _ReleaseDC(hdc); 00782 } 00783 else 00784 fDrawn = FALSE; 00785 } 00786 00787 if ( IsTrayWindow(pwnd) && (wFlags & (DC_ICON | DC_TEXT)) ) { 00788 HWND hw = HWq(pwnd); 00789 xxxCallHook(HSHELL_REDRAW, (WPARAM)hw, 0L, WH_SHELL); 00790 PostShellHookMessages(HSHELL_REDRAW, (LPARAM)hw); 00791 00792 } 00793 return(fDrawn); 00794 }

BOOL xxxRedrawWindow PWND  pwnd,
LPRECT  lprcUpdate,
HRGN  hrgnUpdate,
DWORD  flags
 

Definition at line 299 of file update.c.

References BOOL, CheckLock, CopyRgn, ghrgnInv0, HRGN_FULL, IsVisible(), NULL, PtiCurrent, PWNDDESKTOP, tagWND::rcClient, SetRectRgnIndirect(), TestWF, ThreadLock, ThreadUnlock, TRUE, and xxxInternalInvalidate().

Referenced by NtUserRedrawWindow(), RemoteRedrawRectangle(), xxxDesktopWndProc(), xxxDestroyWindow(), xxxInvalidateDesktopOnPaletteChange(), xxxInvalidateRect(), xxxInvalidateRgn(), xxxMakeWindowForegroundWithState(), xxxMinimizeHungWindow(), xxxScrollWindowEx(), xxxSetLayeredWindow(), xxxSetWindowPos(), xxxUserResetDisplayDevice(), xxxValidateRect(), and xxxValidateRgn().

00304 { 00305 CheckLock(pwnd); 00306 00307 /* 00308 * Always map NULL to the desktop. 00309 */ 00310 if (pwnd == NULL) { 00311 pwnd = PtiCurrent()->rpdesk->pDeskInfo->spwnd; 00312 } 00313 00314 UserAssert(pwnd != NULL); 00315 00316 if (IsVisible(pwnd)) { 00317 00318 TL tlpwnd; 00319 HRGN hrgn = hrgnUpdate; 00320 00321 if (flags & (RDW_VALIDATE | RDW_INVALIDATE)) { 00322 00323 /* 00324 * Create a (in)validate region in client window coordinates. 00325 */ 00326 if (hrgn == NULL) { 00327 if (!lprcUpdate) { 00328 hrgn = HRGN_FULL; 00329 } else { 00330 hrgn = ghrgnInv0; 00331 00332 #ifdef USE_MIRRORING 00333 if (TestWF(pwnd, WEFLAYOUTRTL)) { 00334 MirrorRect(pwnd, lprcUpdate); 00335 } 00336 #endif 00337 00338 if (pwnd == PWNDDESKTOP(pwnd)) { 00339 SetRectRgnIndirect(hrgn, lprcUpdate); 00340 } else { 00341 GreSetRectRgn( 00342 hrgn, 00343 lprcUpdate->left + pwnd->rcClient.left, 00344 lprcUpdate->top + pwnd->rcClient.top, 00345 lprcUpdate->right + pwnd->rcClient.left, 00346 lprcUpdate->bottom + pwnd->rcClient.top); 00347 } 00348 } 00349 } else { 00350 /* 00351 * If necessary, make a copy of the passed-in region, because 00352 * we'll be trashing it... 00353 */ 00354 if (hrgn != HRGN_FULL) { 00355 CopyRgn(ghrgnInv0, hrgn); 00356 00357 #ifdef USE_MIRRORING 00358 MirrorRegion(pwnd, ghrgnInv0, TRUE); 00359 #endif 00360 00361 hrgn = ghrgnInv0; 00362 } 00363 00364 if (pwnd != PWNDDESKTOP(pwnd)) { 00365 GreOffsetRgn(hrgn, pwnd->rcClient.left, pwnd->rcClient.top); 00366 } 00367 } 00368 } 00369 00370 ThreadLock(pwnd, &tlpwnd); 00371 xxxInternalInvalidate(pwnd, hrgn, flags | RDW_REDRAWWINDOW); 00372 ThreadUnlock(&tlpwnd); 00373 } 00374 00375 return TRUE; 00376 }

ATOM xxxRegisterClassEx LPWNDCLASSEX  pwc,
PCLSMENUNAME  pcmn,
WORD  fnid,
DWORD  dwFlags,
LPDWORD  pdwWOW
 

Definition at line 101 of file class.c.

References tagCLS::atomClassName, CSF_WOWCLASS, dwFlags, HMValidateHandleNoRip(), tagTDB::hTaskWow, tagCLS::hTaskWow, InternalRegisterClassEx(), ISCPDTAG, tagCLS::lpszClientAnsiMenuName, tagCLS::lpszClientUnicodeMenuName, NULL, PCALLPROCDATA, PCLSMENUNAME, _CALLPROCDATA::pfnClientPrevious, tagCLSMENUNAME::pszClientAnsiMenuName, tagTHREADINFO::ptdb, PtiCurrent, PWCFromPCLS, tagCLSMENUNAME::pwszClientUnicodeMenuName, TIF_16BIT, tagTHREADINFO::TIF_flags, and TYPE_CALLPROC.

Referenced by NtUserRegisterClassExWOW().

00107 { 00108 PCLS pcls; 00109 PTHREADINFO ptiCurrent = PtiCurrent(); 00110 00111 /* 00112 * NOTE -- lpszClassName and lpszMenuName in the wndclass may be client-side 00113 * pointers. Use of those fields must be protected in try blocks. 00114 */ 00115 00116 /* 00117 * Convert a possible CallProc Handle into a real address. They may 00118 * have kept the CallProc Handle from some previous mixed GetClassinfo 00119 * or SetWindowLong. 00120 */ 00121 if (ISCPDTAG(cczpwc->lpfnWndProc)) { 00122 PCALLPROCDATA pCPD; 00123 if (pCPD = HMValidateHandleNoRip((HANDLE)cczpwc->lpfnWndProc, TYPE_CALLPROC)) { 00124 cczpwc->lpfnWndProc = (WNDPROC)pCPD->pfnClientPrevious; 00125 } 00126 } 00127 00128 pcls = InternalRegisterClassEx(cczpwc, fnid, dwFlags | ((ptiCurrent->TIF_flags & TIF_16BIT)? CSF_WOWCLASS : 0) ); 00129 if (pcls != NULL) { 00130 00131 pcls->lpszClientUnicodeMenuName = pcmn->pwszClientUnicodeMenuName; 00132 pcls->lpszClientAnsiMenuName = pcmn->pszClientAnsiMenuName; 00133 00134 /* 00135 * copy 5 WOW dwords. 00136 */ 00137 if (pdwWOW) { 00138 RtlCopyMemory (PWCFromPCLS(pcls), pdwWOW, sizeof(WC)); 00139 } 00140 00141 if ((ptiCurrent->TIF_flags & TIF_16BIT) && ptiCurrent->ptdb) { 00142 pcls->hTaskWow = ptiCurrent->ptdb->hTaskWow; 00143 } else { 00144 pcls->hTaskWow = 0; 00145 } 00146 00147 /* 00148 * For some (presumably good) reason Win 3.1 changed RegisterClass 00149 * to return the classes classname atom. 00150 */ 00151 return pcls->atomClassName; 00152 } else { 00153 return 0; 00154 } 00155 }

NTSTATUS xxxRegisterForDeviceClassNotifications  ) 
 

Definition at line 639 of file w32/ntuser/kernel/pnp.c.

References aDeviceTemplate, CheckCritIn, DEVICE_TYPE_MAX, DeviceClassCDROMNotify(), DeviceClassNotify(), DWORD, EnterCrit, EventCategoryDeviceInterfaceChange, gbRemoteSession, gpWin32kDriverObject, IO_NOTIFICATION_EVENT_CATEGORY, IoCreateDriver(), IoRegisterPlugPlayNotification(), L, LeaveCrit, NT_SUCCESS, NTSTATUS(), NULL, OpenMultiplePortDevice(), PDRIVER_NOTIFICATION_CALLBACK_ROUTINE, PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES, RtlInitUnicodeString(), Status, and Win32kPnPDriverEntry().

Referenced by RawInputThread().

00640 { 00641 IO_NOTIFICATION_EVENT_CATEGORY eventCategory; 00642 ULONG eventFlags; 00643 PVOID RegistrationEntry; 00644 NTSTATUS Status; 00645 UNICODE_STRING ustrDriverName; 00646 DWORD DeviceType; 00647 00648 00649 00650 CheckCritIn(); 00651 00652 TAGMSG0(DBGTAG_PNP, "enter xxxRegisterForDeviceClassNotifications()"); 00653 00654 /* 00655 * Remote hydra session indicates CreateDeviceInfo in xxxRemoteReconnect 00656 */ 00657 UserAssert(!gbRemoteSession); 00658 00659 /* 00660 * This must be done before devices are registered for device notifications 00661 * which will occur as a result of CreateDeviceInfo()... 00662 */ 00663 RtlInitUnicodeString(&ustrDriverName, L"\\Driver\\Win32k"); 00664 Status = IoCreateDriver(&ustrDriverName, Win32kPnPDriverEntry); 00665 00666 TAGMSG1(DBGTAG_PNP | RIP_THERESMORE, "IoCreateDriver returned status = %lx", Status); 00667 TAGMSG1(DBGTAG_PNP, "gpWin32kDriverObject = %lx", gpWin32kDriverObject); 00668 00669 if (!NT_SUCCESS(Status)) { 00670 RIPMSG1(RIP_ERROR, "IoCreateDriver failed, status %lx", Status); 00671 Status = STATUS_SUCCESS; 00672 } 00673 00674 UserAssert(gpWin32kDriverObject); 00675 00676 // 00677 // We are only interested in DeviceClasses changing. 00678 // 00679 eventCategory = EventCategoryDeviceInterfaceChange; 00680 00681 // 00682 // We want to be notified for all devices that are in the system. 00683 // those that are know now, and those that will arive later. 00684 // This allows us to have one code path for adding devices, and eliminates 00685 // the nasty race condition. If we were only interested in the devices 00686 // that exist at this one moment in time, and not future devices, we 00687 // would call IoGetDeviceClassAssociations. 00688 // 00689 eventFlags = PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES; 00690 00691 /* 00692 * For all input device types: 00693 * If they are Multiple Port Devices (ie: not PnP) just open them 00694 * Else Register them for PnP notifications (they will be opened when the 00695 * arrival notification arrives. 00696 * If devices are already attached, we will received immediate notification 00697 * during the call to IoRegisterPlugPlayNotification, so we must LeaveCrit 00698 * because the callback routine DeviceClassNotify expects it. 00699 */ 00700 for (DeviceType = 0; DeviceType <= DEVICE_TYPE_MAX; DeviceType++) { 00701 if (!OpenMultiplePortDevice(DeviceType)) { 00702 /* 00703 * Make the registration 00704 */ 00705 00706 TAGMSG1(DBGTAG_PNP, "Registering device type %d", DeviceType); 00707 LeaveCrit(); // for DeviceClassNotify 00708 Status = IoRegisterPlugPlayNotification ( 00709 eventCategory, 00710 eventFlags, 00711 (PVOID)aDeviceTemplate[DeviceType].pClassGUID, 00712 gpWin32kDriverObject, 00713 (PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)DeviceClassNotify, 00714 LongToPtr( DeviceType ), 00715 &RegistrationEntry); 00716 EnterCrit(); 00717 TAGMSG1(DBGTAG_PNP, "Registration returned status %lx", Status); 00718 if (!NT_SUCCESS(Status)) { 00719 RIPMSG2(RIP_ERROR, "IoRegisterPlugPlayNotification(%d) failed, status %lx", 00720 DeviceType, Status); 00721 } 00722 } 00723 } 00724 00725 // Now Register for CD_ROM notifications 00726 LeaveCrit(); // for DeviceClassNotify 00727 00728 Status = IoRegisterPlugPlayNotification ( 00729 eventCategory, 00730 eventFlags, 00731 (PVOID) &CdRomClassGuid, 00732 gpWin32kDriverObject, 00733 (PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)DeviceClassCDROMNotify, 00734 NULL, 00735 &RegistrationEntry); 00736 EnterCrit(); 00737 00738 00739 00740 return Status; 00741 }

BOOL xxxRegisterUserHungAppHandlers PFNW32ET  pfnW32EndTask,
HANDLE  hEventWowExec
 

Definition at line 565 of file kernel/exitwin.c.

References BOOL, ExEventObjectType, FALSE, gpwpiFirstWow, tagWOWPROCESSINFO::hEventWowExecClient, tagWOWPROCESSINFO::lpfnWowExitTask, NT_SUCCESS, NULL, ObReferenceObjectByHandle(), tagWOWPROCESSINFO::pEventWowExec, PpiCurrent, PWOWPROCESSINFO, tagPROCESSINFO::pwpi, tagWOWPROCESSINFO::pwpiNext, UserMode, and WOWPROCESSINFO.

00568 { 00569 BOOL bRetVal; 00570 PPROCESSINFO ppi; 00571 PWOWPROCESSINFO pwpi; 00572 00573 // 00574 // Allocate the per wow process info stuff 00575 // ensuring the memory is Zero init. 00576 // 00577 pwpi = (PWOWPROCESSINFO) UserAllocPoolWithQuotaZInit( 00578 sizeof(WOWPROCESSINFO), TAG_WOWPROCESSINFO); 00579 00580 if (!pwpi) 00581 return FALSE; 00582 00583 // 00584 // Reference the WowExec event for kernel access 00585 // 00586 bRetVal = NT_SUCCESS(ObReferenceObjectByHandle( 00587 hEventWowExec, 00588 EVENT_ALL_ACCESS, 00589 *ExEventObjectType, 00590 UserMode, 00591 &pwpi->pEventWowExec, 00592 NULL 00593 )); 00594 00595 // 00596 // if sucess then intialize the pwpi, ppi structs 00597 // else free allocated memory 00598 // 00599 if (bRetVal) { 00600 pwpi->hEventWowExecClient = hEventWowExec; 00601 pwpi->lpfnWowExitTask = pfnW32EndTask; 00602 ppi = PpiCurrent(); 00603 ppi->pwpi = pwpi; 00604 00605 // add to the list, order doesn't matter 00606 pwpi->pwpiNext = gpwpiFirstWow; 00607 gpwpiFirstWow = pwpi; 00608 00609 } 00610 else { 00611 UserFreePool(pwpi); 00612 } 00613 00614 return bRetVal; 00615 }

BOOL xxxReleaseCapture VOID   ) 
 

Definition at line 78 of file w32/ntuser/kernel/capture.c.

References BOOL, DDR_ENDCANCEL, FALSE, _MOVESIZEDATA::fDragFullWindows, gpDispInfo, tagDISPLAYINFO::hDev, NO_CAP_CLIENT, NULL, tagTHREADINFO::pmsd, tagTHREADINFO::pq, PtiCurrent, QF_CAPTURELOCKED, tagQ::QF_flags, tagTHREADINFO::TIF_flags, TIF_MOVESIZETRACKING, TIF_TRACKRECTVISIBLE, TRUE, xxxCapture(), and xxxDrawDragRect().

Referenced by xxxDefWindowProc(), xxxDragObject(), xxxDWP_DoCancelMode(), xxxEndScroll(), xxxFreeWindow(), xxxHelpLoop(), xxxIsDragging(), xxxMNReleaseCapture(), xxxMS_TrackMove(), xxxOldNextWindow(), xxxTrackCaptionButton(), and xxxTrackInitSize().

00079 { 00080 PTHREADINFO ptiCurrent = PtiCurrent(); 00081 /* 00082 * If the capture is locked, bail 00083 */ 00084 if (ptiCurrent->pq->QF_flags & QF_CAPTURELOCKED) { 00085 RIPMSG0(RIP_WARNING, "xxxReleaseCapture: Capture is locked"); 00086 return FALSE; 00087 } 00088 00089 /* 00090 * If we're releasing the capture from a window during tracking, 00091 * cancel tracking first. 00092 */ 00093 if (ptiCurrent->pmsd != NULL) { 00094 00095 /* 00096 * Only remove the tracking rectangle if it's 00097 * been made visible. 00098 */ 00099 if (ptiCurrent->TIF_flags & TIF_TRACKRECTVISIBLE) { 00100 00101 bSetDevDragRect(gpDispInfo->hDev, NULL, NULL); 00102 00103 if (!(ptiCurrent->pmsd->fDragFullWindows)) 00104 xxxDrawDragRect(ptiCurrent->pmsd, NULL, DDR_ENDCANCEL); 00105 00106 ptiCurrent->TIF_flags &= ~(TIF_TRACKRECTVISIBLE | TIF_MOVESIZETRACKING); 00107 } 00108 } 00109 00110 xxxCapture(ptiCurrent, NULL, NO_CAP_CLIENT); 00111 00112 return TRUE; 00113 }

NTSTATUS xxxRemoteDisconnect VOID   ) 
 

Definition at line 188 of file w32/ntuser/kernel/misc.c.

References _PostMessage(), FALSE, gbConnected, ghRemoteThinwireChannel, gnShadowers, gpDispInfo, gpEventDiconnectDesktop, gspdeskDisconnect, gspwndLogonNotify, gstrBaseWinStationName, gThinwireFileObject, tagDISPLAYINFO::hDev, HH_REMOTEDISCONNECT, HYDRA_HINT, ISCSRSS, ISTS, KernelMode, KeWaitForSingleObject(), NT_SUCCESS, NTSTATUS(), NULL, RemoteRedrawScreen(), Status, TRACE_HYDAPI, WrUserRequest, and xxxRemoteStopScreenUpdates().

00190 { 00191 NTSTATUS Status = STATUS_SUCCESS; 00192 LARGE_INTEGER li; 00193 00194 TRACE_HYDAPI(("xxxRemoteDisconnect\n")); 00195 00196 /* 00197 * Only allow CSRSS to do this 00198 */ 00199 if (!ISCSRSS() || !ISTS()) { 00200 return STATUS_ACCESS_DENIED; 00201 } 00202 00203 HYDRA_HINT(HH_REMOTEDISCONNECT); 00204 00205 RtlZeroMemory(gstrBaseWinStationName, 00206 WINSTATIONNAME_LENGTH * sizeof(WCHAR)); 00207 00208 UserAssert(gbConnected); 00209 00210 if (gspdeskDisconnect == NULL) { 00211 /* 00212 * Convert dwMilliseconds to a relative-time(i.e. negative) 00213 * LARGE_INTEGER. NT Base calls take time values in 100 nanosecond 00214 * units. Timeout after 5 minutes. 00215 */ 00216 li.QuadPart = Int32x32To64(-10000, 300000); 00217 00218 KeWaitForSingleObject(gpEventDiconnectDesktop, 00219 WrUserRequest, 00220 KernelMode, 00221 FALSE, 00222 &li); 00223 } 00224 00225 00226 /* 00227 * If the disconnected desktop has not yet be setup. Do not do any 00228 * disconnect processing. It's better for the thinwire driver to try 00229 * and write rather than for the transmit buffers to be freed (trap). 00230 */ 00231 if (gspdeskDisconnect) { 00232 00233 /* 00234 * Blank the screen 00235 * 00236 * No need to stop graphics mode for disconnects 00237 */ 00238 Status = xxxRemoteStopScreenUpdates(FALSE); 00239 if (!NT_SUCCESS(Status)) { 00240 return Status; 00241 } 00242 00243 /* 00244 * If there are any shadow connections, then redraw the screen now. 00245 */ 00246 if (gnShadowers) 00247 RemoteRedrawScreen(); 00248 } else { 00249 RIPMSG0(RIP_WARNING, "xxxRemoteDisconnect failed. The disconnect desktop was not created"); 00250 return STATUS_UNSUCCESSFUL; 00251 } 00252 00253 /* 00254 * Tell thinwire driver about this 00255 */ 00256 bDrvDisconnect(gpDispInfo->hDev, ghRemoteThinwireChannel, 00257 gThinwireFileObject); 00258 00259 00260 /* 00261 * Tell winlogon about the disconnect 00262 */ 00263 if (gspwndLogonNotify != NULL) { 00264 _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, SESSION_DISCONNECTED, 0); 00265 } 00266 00267 gbConnected = FALSE; 00268 00269 return Status; 00270 }

NTSTATUS xxxRemotePassthruEnable VOID   ) 
 

Definition at line 735 of file w32/ntuser/kernel/misc.c.

References BOOL, FALSE, gapulCvt_VK, gapulCvt_VK_84, gbConnected, ghKbdTblBase, ghRemoteKeyboardChannel, ghRemoteThinwireChannel, gnShadowers, gpDispInfo, gpKbdTbl, gThinwireFileObject, guKbdTblSize, tagDISPLAYINFO::hDev, ISCSRSS, ISTS, NULL, TRACE_HYDAPI, and xxxRemoteStopScreenUpdates().

00737 { 00738 IO_STATUS_BLOCK IoStatus; 00739 static BOOL KeyboardType101; 00740 00741 TRACE_HYDAPI(("xxxRemotePassthruEnable\n")); 00742 00743 /* 00744 * Only allow CSRSS to do this 00745 */ 00746 if (!ISCSRSS() || !ISTS()) { 00747 return STATUS_ACCESS_DENIED; 00748 } 00749 00750 UserAssert(gbConnected); 00751 UserAssert(gnShadowers == 0); 00752 UserAssert(ISCSRSS()); 00753 00754 KeyboardType101 = !(gapulCvt_VK == gapulCvt_VK_84); 00755 00756 ZwDeviceIoControlFile(ghRemoteKeyboardChannel, NULL, NULL, NULL, 00757 &IoStatus, IOCTL_KEYBOARD_ICA_TYPE, 00758 &KeyboardType101, sizeof(KeyboardType101), 00759 NULL, 0); 00760 00761 if (guKbdTblSize != 0) { 00762 ZwDeviceIoControlFile(ghRemoteKeyboardChannel, NULL, NULL, NULL, 00763 &IoStatus, IOCTL_KEYBOARD_ICA_LAYOUT, 00764 ghKbdTblBase, guKbdTblSize, 00765 gpKbdTbl, 0); 00766 } 00767 00768 xxxRemoteStopScreenUpdates(FALSE); 00769 00770 /* 00771 * Tell thinwire driver about this 00772 */ 00773 bDrvDisconnect(gpDispInfo->hDev, ghRemoteThinwireChannel, 00774 gThinwireFileObject); 00775 00776 return STATUS_SUCCESS; 00777 }

NTSTATUS xxxRemoteReconnect IN PDORECONNECTDATA  pDoReconnectData  ) 
 

Definition at line 273 of file w32/ntuser/kernel/misc.c.

References _PostMessage(), BOOL, FALSE, gbClientDoubleClickSupport, gbConnected, gfEnableWindowsKey, ghRemoteThinwireChannel, gnShadowers, gpDispInfo, gRemoteClientKeyboardType, grpdeskRitInput, gspwndLogonNotify, gstrBaseWinStationName, gThinwireFileObject, tagDISPLAYINFO::hDev, HH_REMOTERECONNECT, HYDRA_HINT, InitKeyboard(), ISCSRSS, ISTS, KernelMode, L, min, NT_SUCCESS, NTSTATUS(), NULL, PDORECONNECTDATA, tagDISPLAYINFO::pmdev, RemoteRedrawScreen(), RtlInitUnicodeString(), SetPointer(), Status, TRACE_HYDAPI, TRUE, UpdateKeyLights(), UpdateMouseInfo(), xxxRemoteStopScreenUpdates(), and xxxUserChangeDisplaySettings().

00275 { 00276 NTSTATUS Status = STATUS_SUCCESS; 00277 BOOL fResult; 00278 PWCHAR pSep; 00279 00280 TRACE_HYDAPI(("xxxRemoteReconnect\n")); 00281 00282 /* 00283 * Only allow CSRSS to do this 00284 */ 00285 if (!ISCSRSS() || !ISTS()) { 00286 return STATUS_ACCESS_DENIED; 00287 } 00288 00289 HYDRA_HINT(HH_REMOTERECONNECT); 00290 00291 UserAssert(ISCSRSS()); 00292 00293 gRemoteClientKeyboardType = pDoReconnectData->ClientKeyboardType; 00294 00295 gbClientDoubleClickSupport = pDoReconnectData->fClientDoubleClickSupport; 00296 00297 gfEnableWindowsKey = pDoReconnectData->fEnableWindowsKey; 00298 00299 RtlCopyMemory(gstrBaseWinStationName, pDoReconnectData->WinStationName, 00300 min(WINSTATIONNAME_LENGTH * sizeof(WCHAR), sizeof(pDoReconnectData->WinStationName))); 00301 00302 if (pSep = wcschr(gstrBaseWinStationName, L'#')) 00303 *pSep = UNICODE_NULL; 00304 00305 if (gnShadowers) 00306 xxxRemoteStopScreenUpdates(TRUE); 00307 00308 00309 /* 00310 * Call thinwire driver to check for thinwire mode compatibility 00311 */ 00312 fResult = bDrvReconnect(gpDispInfo->hDev, ghRemoteThinwireChannel, 00313 gThinwireFileObject); 00314 00315 if (!fResult) { 00316 if (gnShadowers) 00317 RemoteRedrawScreen(); 00318 00319 return STATUS_CTX_BAD_VIDEO_MODE; 00320 } 00321 00322 00323 00324 /* 00325 * If instructed to do so, change Display mode before Reconnecting. 00326 * Use display resolution information from Reconnect data. 00327 */ 00328 00329 if (pDoReconnectData->fChangeDisplaySettings) { 00330 DEVMODEW devmodew; 00331 UNICODE_STRING ustrDeviceName; 00332 PDEVMODEW pDevmodew = &devmodew; 00333 00334 RtlZeroMemory(pDevmodew, sizeof(DEVMODEW)); 00335 pDevmodew->dmPelsHeight = pDoReconnectData->drPelsHeight; 00336 pDevmodew->dmPelsWidth = pDoReconnectData->drPelsWidth; 00337 pDevmodew->dmBitsPerPel = pDoReconnectData->drBitsPerPel; 00338 pDevmodew->dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; 00339 pDevmodew->dmSize = sizeof(DEVMODEW); 00340 00341 RtlInitUnicodeString(&ustrDeviceName, L"\\\\.\\DISPLAY1"); 00342 00343 00344 Status = xxxUserChangeDisplaySettings(NULL, //&ustrDeviceName, 00345 &devmodew, 00346 NULL, 00347 grpdeskRitInput, 00348 0, 00349 NULL, 00350 KernelMode); 00351 /* 00352 * If Display settings change fails, let us disconnect the display driver 00353 * as the reconnect is going to be failed anyway. 00354 */ 00355 00356 00357 if (!NT_SUCCESS(Status)) { 00358 bDrvDisconnect(gpDispInfo->hDev, ghRemoteThinwireChannel, gThinwireFileObject); 00359 return Status; 00360 } 00361 00362 /* 00363 * Code in RemoteRedrawScreen() Expects gpDispInfo->pmdev to disabled, but 00364 * it has been enabled by xxxUserChangeDisplaySettings(), so let's disable it 00365 * before calling RemoteRedrawScreen(). 00366 */ 00367 DrvDisableMDEV(gpDispInfo->pmdev, TRUE); 00368 00369 } 00370 00371 /* 00372 * Now we can swicth out from disconnected desktop, to normal 00373 * desktop, in order to renable screen update. 00374 */ 00375 00376 RemoteRedrawScreen(); 00377 00378 if (gspwndLogonNotify != NULL) { 00379 _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, 00380 SESSION_RECONNECTED, 0); 00381 } 00382 00383 /* 00384 * We need to re-init the mouse, especially since we may not have had one before. 00385 */ 00386 UpdateMouseInfo(); 00387 00388 /* 00389 * Re-init'ing the keyboard may not be as neccessary. Possibly the keyboard 00390 * attributes have changed. 00391 */ 00392 InitKeyboard(); 00393 00394 /* 00395 * This is neccessary to sync up the client and the host. 00396 */ 00397 UpdateKeyLights(FALSE); 00398 00399 SetPointer(TRUE); 00400 00401 gbConnected = TRUE; 00402 00403 00404 00405 return Status; 00406 }

NTSTATUS xxxRemoteShadowSetup VOID   ) 
 

Definition at line 606 of file w32/ntuser/kernel/misc.c.

References FALSE, gbConnected, gnShadowers, ISCSRSS, ISTS, NTSTATUS(), Status, TRACE_HYDAPI, and xxxRemoteStopScreenUpdates().

00608 { 00609 NTSTATUS Status = STATUS_SUCCESS; 00610 00611 TRACE_HYDAPI(("xxxRemoteShadowSetup\n")); 00612 00613 /* 00614 * Only allow CSRSS to do this 00615 */ 00616 if (!ISCSRSS() || !ISTS()) { 00617 return STATUS_ACCESS_DENIED; 00618 } 00619 00620 UserAssert(ISCSRSS()); 00621 00622 /* 00623 * Blank the screen 00624 */ 00625 if (gnShadowers || gbConnected) 00626 xxxRemoteStopScreenUpdates(FALSE); 00627 00628 gnShadowers++; 00629 00630 return Status; 00631 }

NTSTATUS xxxRemoteShadowStop VOID   ) 
 

Definition at line 674 of file w32/ntuser/kernel/misc.c.

References FALSE, ISCSRSS, ISTS, NTSTATUS(), Status, TRACE_HYDAPI, and xxxRemoteStopScreenUpdates().

00676 { 00677 NTSTATUS Status = STATUS_SUCCESS; 00678 00679 TRACE_HYDAPI(("xxxRemoteShadowStop\n")); 00680 00681 /* 00682 * Only allow CSRSS to do this 00683 */ 00684 if (!ISCSRSS() || !ISTS()) { 00685 return STATUS_ACCESS_DENIED; 00686 } 00687 00688 UserAssert(ISCSRSS()); 00689 00690 /* 00691 * Blank the screen 00692 */ 00693 xxxRemoteStopScreenUpdates(FALSE); 00694 00695 return Status; 00696 }

NTSTATUS xxxRemoteStopScreenUpdates BOOL  fDisableGraphics  ) 
 

Definition at line 446 of file w32/ntuser/kernel/misc.c.

References CheckCritIn, FALSE, gbFreezeScreenUpdates, ghRemoteVideoChannel, gptCursorAsync, grpdeskRitInput, gspdeskDisconnect, gwMKButtonState, gwMKCurrentButton, ISCSRSS, L, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, NT_SUCCESS, NtGetTickCount(), NTSTATUS(), NULL, RemoteDisableScreen(), Status, TRACE_HYDAPI, TRUE, xxxButtonEvent(), and xxxPushKeyEvent().

Referenced by NtUserRemoteStopScreenUpdates(), xxxRemoteDisconnect(), xxxRemotePassthruEnable(), xxxRemoteReconnect(), xxxRemoteShadowSetup(), and xxxRemoteShadowStop().

00448 { 00449 NTSTATUS Status = STATUS_SUCCESS; 00450 NTSTATUS SaveStatus = STATUS_SUCCESS; 00451 //ULONG BytesReturned; 00452 WORD NewButtonState; 00453 00454 TRACE_HYDAPI(("xxxRemoteStopScreenUpdates fDisableGraphics %d\n", fDisableGraphics)); 00455 00456 CheckCritIn(); 00457 00458 UserAssert(ISCSRSS()); 00459 00460 /* 00461 * No need to do this multiple times. 00462 */ 00463 if (gbFreezeScreenUpdates) 00464 return STATUS_SUCCESS; 00465 00466 /* 00467 * This could be called directly from the command channel. 00468 */ 00469 if (!gspdeskDisconnect) 00470 return STATUS_SUCCESS; 00471 00472 /* 00473 * If not connected, forget it 00474 */ 00475 if (ghRemoteVideoChannel == NULL) 00476 return STATUS_NO_SUCH_DEVICE; 00477 00478 /* 00479 * Mouse buttons up. 00480 * (Ensures no mouse buttons are left in a down state) 00481 */ 00482 NewButtonState = gwMKButtonState & ~gwMKCurrentButton; 00483 00484 if ((NewButtonState & MOUSE_BUTTON_LEFT) != (gwMKButtonState & MOUSE_BUTTON_LEFT)) { 00485 xxxButtonEvent(MOUSE_BUTTON_LEFT, gptCursorAsync, TRUE, NtGetTickCount(), 00486 0L, 0L, FALSE); 00487 } 00488 00489 if ((NewButtonState & MOUSE_BUTTON_RIGHT) != (gwMKButtonState & MOUSE_BUTTON_RIGHT)) { 00490 xxxButtonEvent(MOUSE_BUTTON_RIGHT, gptCursorAsync, TRUE, NtGetTickCount(), 00491 0L, 0L, FALSE); 00492 } 00493 gwMKButtonState = NewButtonState; 00494 00495 /* 00496 * Send shift key breaks to win32 00497 * (Ensures no shift keys are left on) 00498 */ 00499 00500 // { 0, 0xb8, KEY_BREAK, 0, 0 }, // L alt 00501 xxxPushKeyEvent(VK_LMENU, 0xb8, KEYEVENTF_KEYUP, 0); 00502 00503 // { 0, 0xb8, KEY_BREAK | KEY_E0, 0, 0 }, // R alt 00504 xxxPushKeyEvent(VK_RMENU, 0xb8, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); 00505 00506 // { 0, 0x9d, KEY_BREAK, 0, 0 }, // L ctrl 00507 xxxPushKeyEvent(VK_LCONTROL, 0x9d, KEYEVENTF_KEYUP, 0); 00508 00509 // { 0, 0x9d, KEY_BREAK | KEY_E0, 0, 0 }, // R ctrl 00510 xxxPushKeyEvent(VK_RCONTROL, 0x9d, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); 00511 00512 // { 0, 0xaa, KEY_BREAK, 0, 0 }, // L shift 00513 xxxPushKeyEvent(VK_LSHIFT, 0xaa, KEYEVENTF_KEYUP, 0); 00514 00515 // { 0, 0xb6, KEY_BREAK, 0, 0 } // R shift 00516 xxxPushKeyEvent(VK_RSHIFT, 0xb6, KEYEVENTF_KEYUP, 0); 00517 00518 Status = RemoteDisableScreen(); 00519 00520 if (!NT_SUCCESS(Status)) { 00521 return STATUS_NO_SUCH_DEVICE; 00522 } 00523 00524 UserAssert(gspdeskDisconnect != NULL && grpdeskRitInput == gspdeskDisconnect); 00525 00526 gbFreezeScreenUpdates = TRUE; 00527 00528 return Status; 00529 UNREFERENCED_PARAMETER(fDisableGraphics); 00530 }

VOID xxxRemoveEvents PQ  pq,
int  nQueue,
DWORD  flags
 

BOOL xxxRemoveFullScreen PWND  pwnd,
PMONITOR  pMonitor
 

Definition at line 205 of file winloop2.c.

References BOOL, tagMONITOR::cFullScreen, CheckLock, ClrWF, FALSE, FCallTray, tagWND::head, NULL, STW_SAME, TestWF, TRUE, WFFULLSCREEN, and xxxSetTrayWindow().

Referenced by xxxCheckFullScreen(), and xxxFreeWindow().

00206 { 00207 PDESKTOP pdesk = pwnd->head.rpdesk; 00208 BOOL fYielded; 00209 00210 CheckLock(pwnd); 00211 CheckLock(pMonitor); 00212 00213 if (pdesk == NULL) 00214 return FALSE; 00215 00216 fYielded = FALSE; 00217 if (TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk)) { 00218 ClrWF(pwnd, WFFULLSCREEN); 00219 00220 if (--pMonitor->cFullScreen == 0) { 00221 xxxSetTrayWindow(pdesk, STW_SAME, pMonitor); 00222 fYielded = TRUE; 00223 } 00224 00225 /* 00226 * (adams): Remove this assertion temporarily while I work on 00227 * a fix for the problem. 00228 * 00229 * UserAssert(pMonitor->cFullScreen >= 0); 00230 */ 00231 } 00232 00233 return fYielded; 00234 }

BOOL xxxRemoveMenu PMENU  pMenu,
UINT  nPos,
UINT  dwFlags
 

Definition at line 766 of file mnchange.c.

References BOOL, FALSE, and xxxRemoveDeleteMenuHelper().

Referenced by NtUserRemoveMenu().

00770 { 00771 return xxxRemoveDeleteMenuHelper(pMenu, nPosition, wFlags, FALSE); 00772 }

void xxxResetTooltip PTOOLTIPWND  pttwnd  ) 
 

Definition at line 453 of file tooltips.c.

References CheckLock, DF_TOOLTIP, KillTooltipTimer(), NULL, PWNDMESSAGE, TestWF, ThreadLockAlways, ThreadUnlock, WFVISIBLE, xxxSetParent(), xxxSetWindowPos(), and ZeroTooltip().

Referenced by xxxCancelMouseMoveTracking(), xxxFreeWindow(), xxxProcessEventMessage(), xxxTooltipHandleTimer(), and xxxTrackMouseMove().

00454 { 00455 KillTooltipTimer(pttwnd); 00456 00457 CheckLock(pttwnd); 00458 00459 if (TestWF(pttwnd, WFVISIBLE)) { 00460 PWND spwndMessage; 00461 TL tlpwnd; 00462 00463 xxxSetWindowPos((PWND)pttwnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | 00464 SWP_NOMOVE | SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOZORDER); 00465 00466 spwndMessage = PWNDMESSAGE(pttwnd); 00467 ThreadLockAlways(spwndMessage, &tlpwnd); 00468 xxxSetParent((PWND)pttwnd, spwndMessage); 00469 ThreadUnlock(&tlpwnd); 00470 } 00471 00472 ZeroTooltip(pttwnd); 00473 pttwnd->head.rpdesk->dwDTFlags &= ~DF_TOOLTIP; 00474 }

HDESK xxxResolveDesktop HANDLE  hProcess,
PUNICODE_STRING  pstrDesktop,
HWINSTA *  phwinsta,
BOOL  fInherit,
BOOL *  pbShutDown
 

Definition at line 4821 of file desktop.c.

References _OpenWindowStation(), _UserTestForWinStaAccess(), BOOL, CheckCritIn, CloseProtectedHandle(), tagWINDOWSTATION::dwWSF_Flags, ExDesktopObjectType, ExWindowStationObjectType, FALSE, gbRemoteSession, gbSecureDesktop, GetDesktopView(), GetProcessLuid(), grpWinStaList, tagPROCESSINFO::hdeskStartup, tagPROCESSINFO::hwinsta, KernelMode, KPROCESSOR_MODE, L, LogDesktop, MapDesktop(), NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObOpenHandle, ObOpenObjectByPointer(), ObReferenceObjectByHandle(), PBYTE, PpiFromProcess, PsGetCurrentProcess, PsProcessType, PtiCurrent, tagPROCESSINFO::rpdeskStartup, tagPROCESSINFO::rpwinsta, RtlAppendUnicodeStringToString(), RtlAppendUnicodeToString(), RtlCopyUnicodeString(), RtlInitUnicodeString(), Status, szWindowStationDirectory, TRUE, UserMode, USHORT, WSF_NOIO, xxxConnectService(), xxxOpenDesktop(), xxxUserDuplicateObject(), and xxxUserFindHandleForObject().

Referenced by NtUserResolveDesktop(), and xxxCreateThreadInfo().

04827 { 04828 PEPROCESS Process; 04829 PPROCESSINFO ppi; 04830 HWINSTA hwinsta; 04831 HDESK hdesk; 04832 PDESKTOP pdesk; 04833 PWINDOWSTATION pwinsta; 04834 BOOL fInteractive; 04835 UNICODE_STRING strDesktop; 04836 UNICODE_STRING strWinSta, strStatic; 04837 OBJECT_ATTRIBUTES ObjA; 04838 PUNICODE_STRING pstrStatic; 04839 POBJECT_ATTRIBUTES pObjA = NULL; 04840 SIZE_T cbObjA; 04841 LPWSTR pszDesktop; 04842 WCHAR awchName[sizeof(L"Service-0x0000-0000$") / sizeof(WCHAR)]; 04843 BOOL fWinStaDefaulted; 04844 BOOL fDesktopDefaulted; 04845 LUID luidService; 04846 NTSTATUS Status; 04847 HWINSTA hwinstaDup; 04848 PTEB pteb = NtCurrentTeb(); 04849 04850 CheckCritIn(); 04851 04852 UserAssert(pteb); 04853 04854 Status = ObReferenceObjectByHandle(hProcess, 04855 PROCESS_QUERY_INFORMATION, 04856 *PsProcessType, 04857 UserMode, 04858 &Process, 04859 NULL); 04860 if (!NT_SUCCESS(Status)) { 04861 RIPMSG1(RIP_WARNING, "ResolveDesktop: Could not reference process handle (0x%X)", hProcess); 04862 return NULL; 04863 } 04864 04865 strStatic.Length = 0; 04866 strStatic.MaximumLength = STATIC_UNICODE_BUFFER_LENGTH * sizeof(WCHAR); 04867 04868 /* 04869 * Use the StaticUnicodeBuffer on the TEB as the buffer for the object name. 04870 * Even if this is client side and we pass KernelMode to the Ob call in 04871 * _OpenWindowStation this is safe because the TEB is not going to go away 04872 * during this call. The worst it can happen is to have the buffer in the TEB 04873 * trashed. 04874 */ 04875 strStatic.Buffer = pteb->StaticUnicodeBuffer; 04876 04877 UserAssert(pteb->StaticUnicodeBuffer == pteb->StaticUnicodeString.Buffer); 04878 UserAssert(pteb->StaticUnicodeString.MaximumLength ==STATIC_UNICODE_BUFFER_LENGTH * sizeof(WCHAR)); 04879 /* 04880 * The static unicode buffer in the teb 04881 /* 04882 * If the process already has a windowstation and a startup desktop, 04883 * return them. 04884 */ 04885 hwinsta = NULL; 04886 hwinstaDup = NULL; 04887 hdesk = NULL; 04888 ppi = PpiFromProcess(Process); 04889 04890 /* 04891 * Make sure the process has not been destroyed. Bug 214643 04892 */ 04893 if (ppi != NULL) { 04894 04895 if (ppi->W32PF_Flags & W32PF_TERMINATED) { 04896 04897 ObDereferenceObject(Process); 04898 04899 RIPMSG1(RIP_WARNING, "xxxResolveDesktop: ppi %#p has been destroyed", ppi); 04900 return NULL; 04901 } 04902 04903 if (ppi->hwinsta != NULL && ppi->hdeskStartup != NULL) { 04904 04905 /* 04906 * If the target process is the current process, simply 04907 * return the handles. Otherwise, open the objects. 04908 */ 04909 if (Process == PsGetCurrentProcess()) { 04910 hwinsta = ppi->hwinsta; 04911 hdesk = ppi->hdeskStartup; 04912 } else { 04913 Status = ObOpenObjectByPointer( 04914 ppi->rpwinsta, 04915 0, 04916 NULL, 04917 MAXIMUM_ALLOWED, 04918 *ExWindowStationObjectType, 04919 (KPROCESSOR_MODE)(gbSecureDesktop ? UserMode : KernelMode), 04920 &hwinsta); 04921 if (NT_SUCCESS(Status)) { 04922 Status = ObOpenObjectByPointer( 04923 ppi->rpdeskStartup, 04924 0, 04925 NULL, 04926 MAXIMUM_ALLOWED, 04927 *ExDesktopObjectType, 04928 (KPROCESSOR_MODE)(gbSecureDesktop ? UserMode : KernelMode), 04929 &hdesk); 04930 if (!NT_SUCCESS(Status)) { 04931 UserVerify(NT_SUCCESS(ZwClose(hwinsta))); 04932 hwinsta = NULL; 04933 } 04934 } 04935 if (!NT_SUCCESS(Status)) { 04936 RIPNTERR2( 04937 Status, 04938 RIP_WARNING, 04939 "ResolveDesktop: Could not reference winsta=%#p and/or desk=%#p", 04940 ppi->rpwinsta, ppi->rpdeskStartup); 04941 } 04942 } 04943 04944 RIPMSG2(RIP_VERBOSE, 04945 "ResolveDesktop: to hwinsta=%#p desktop=%#p", 04946 hwinsta, hdesk); 04947 04948 ObDereferenceObject(Process); 04949 *phwinsta = hwinsta; 04950 return hdesk; 04951 } 04952 } 04953 04954 /* 04955 * Determine windowstation and desktop names. 04956 */ 04957 if (pstrDesktop == NULL || pstrDesktop->Length == 0) { 04958 RtlInitUnicodeString(&strDesktop, TEXT("Default")); 04959 fWinStaDefaulted = fDesktopDefaulted = TRUE; 04960 } else { 04961 USHORT cch; 04962 /* 04963 * The name be of the form windowstation\desktop. Parse 04964 * the string to separate out the names. 04965 */ 04966 strWinSta = *pstrDesktop; 04967 cch = strWinSta.Length / sizeof(WCHAR); 04968 pszDesktop = strWinSta.Buffer; 04969 while (cch && *pszDesktop != L'\\') { 04970 cch--; 04971 pszDesktop++; 04972 } 04973 fDesktopDefaulted = FALSE; 04974 04975 if (cch == 0) { 04976 04977 /* 04978 * No windowstation name was specified, only the desktop. 04979 */ 04980 strDesktop = strWinSta; 04981 fWinStaDefaulted = TRUE; 04982 } else { 04983 /* 04984 * Both names were in the string. 04985 */ 04986 strDesktop.Buffer = pszDesktop + 1; 04987 strDesktop.Length = strDesktop.MaximumLength = (cch - 1) * sizeof(WCHAR); 04988 strWinSta.Length = (USHORT)(pszDesktop - strWinSta.Buffer) * sizeof(WCHAR); 04989 fWinStaDefaulted = FALSE; 04990 04991 RtlAppendUnicodeToString(&strStatic, (PWSTR)szWindowStationDirectory); 04992 RtlAppendUnicodeToString(&strStatic, L"\\"); 04993 RtlAppendUnicodeStringToString(&strStatic, &strWinSta); 04994 04995 if (!NT_SUCCESS(Status = _UserTestForWinStaAccess(&strStatic,TRUE))) { 04996 if (strStatic.MaximumLength > strStatic.Length) 04997 strStatic.Buffer[strStatic.Length/sizeof(WCHAR)] = 0; 04998 else 04999 strStatic.Buffer[(strStatic.Length - sizeof(WCHAR))/sizeof(WCHAR)] = 0; 05000 RIPMSG2(RIP_WARNING, 05001 "ResolveDesktop: Error (0x%X) resolving to WinSta='%ws'", 05002 Status, strStatic.Buffer); 05003 ObDereferenceObject(Process); 05004 *phwinsta = NULL; 05005 return NULL; 05006 } 05007 05008 } 05009 } 05010 05011 /* 05012 * If the desktop name is defaulted, make the handles 05013 * not inheritable. 05014 */ 05015 if (fDesktopDefaulted) 05016 fInherit = FALSE; 05017 05018 /* 05019 * If a windowstation has not been assigned to this process yet and 05020 * there are existing windowstations, attempt an open. 05021 */ 05022 if (hwinsta == NULL && grpWinStaList) { 05023 05024 /* 05025 * If the windowstation name was defaulted, create a name 05026 * based on the session. 05027 */ 05028 if (fWinStaDefaulted) { 05029 //Default Window Station 05030 RtlInitUnicodeString(&strWinSta, L"WinSta0"); 05031 05032 RtlAppendUnicodeToString(&strStatic, (PWSTR)szWindowStationDirectory); 05033 RtlAppendUnicodeToString(&strStatic, L"\\"); 05034 RtlAppendUnicodeStringToString(&strStatic, &strWinSta); 05035 05036 if (gbRemoteSession) { 05037 /* 05038 * Fake this out if it's an non-interactive winstation startup. 05039 * We don't want an extra winsta. 05040 */ 05041 fInteractive = NT_SUCCESS(_UserTestForWinStaAccess(&strStatic, TRUE)); 05042 } else { 05043 fInteractive = NT_SUCCESS(_UserTestForWinStaAccess(&strStatic,fInherit)); 05044 } 05045 05046 if (!fInteractive) { 05047 GetProcessLuid(NULL, &luidService); 05048 swprintf(awchName, L"Service-0x%x-%x$", 05049 luidService.HighPart, luidService.LowPart); 05050 RtlInitUnicodeString(&strWinSta, awchName); 05051 } 05052 } 05053 05054 /* 05055 * If no windowstation name was passed in and a windowstation 05056 * handle was inherited, assign it. 05057 */ 05058 if (fWinStaDefaulted) { 05059 if (xxxUserFindHandleForObject(Process, NULL, *ExWindowStationObjectType, 05060 NULL, &hwinsta)) { 05061 05062 /* 05063 * If the handle belongs to another process, 05064 * dup it into this one 05065 */ 05066 if (Process != PsGetCurrentProcess()) { 05067 05068 Status = xxxUserDuplicateObject( 05069 hProcess, 05070 hwinsta, 05071 NtCurrentProcess(), 05072 &hwinstaDup, 05073 0, 05074 0, 05075 DUPLICATE_SAME_ACCESS); 05076 if (!NT_SUCCESS(Status)) { 05077 hwinsta = NULL; 05078 } else { 05079 hwinsta = hwinstaDup; 05080 } 05081 } 05082 } 05083 } 05084 05085 /* 05086 * If we were assigned to a windowstation, make sure 05087 * it matches our fInteractive flag 05088 */ 05089 if (hwinsta != NULL) { 05090 Status = ObReferenceObjectByHandle(hwinsta, 05091 0, 05092 *ExWindowStationObjectType, 05093 KernelMode, 05094 &pwinsta, 05095 NULL); 05096 if (NT_SUCCESS(Status)) { 05097 BOOL fIO = (pwinsta->dwWSF_Flags & WSF_NOIO) ? FALSE : TRUE; 05098 if (fIO != fInteractive) { 05099 if (hwinstaDup) { 05100 CloseProtectedHandle(hwinsta); 05101 } 05102 hwinsta = NULL; 05103 } 05104 ObDereferenceObject(pwinsta); 05105 } 05106 } 05107 05108 /* 05109 * If not, open the computed windowstation. 05110 */ 05111 if (NT_SUCCESS(Status) && hwinsta == NULL) { 05112 05113 /* 05114 * Fill in the path to the windowstation 05115 */ 05116 strStatic.Length = 0; 05117 RtlAppendUnicodeToString(&strStatic, (PWSTR)szWindowStationDirectory); 05118 RtlAppendUnicodeToString(&strStatic, L"\\"); 05119 RtlAppendUnicodeStringToString(&strStatic, &strWinSta); 05120 05121 if (gbSecureDesktop) { 05122 /* 05123 * Allocate an object attributes structure in user address space. 05124 */ 05125 cbObjA = sizeof(*pObjA) + sizeof(*pstrStatic); 05126 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), 05127 &pObjA, 0, &cbObjA, MEM_COMMIT, PAGE_READWRITE); 05128 pstrStatic = (PUNICODE_STRING)((PBYTE)pObjA + sizeof(*pObjA)); 05129 05130 if (NT_SUCCESS(Status)) { 05131 /* 05132 * Note -- the string must be in client-space or the 05133 * address validation in OpenWindowStation will fail. 05134 */ 05135 try { 05136 *pstrStatic = strStatic; 05137 InitializeObjectAttributes( pObjA, 05138 pstrStatic, 05139 OBJ_CASE_INSENSITIVE, 05140 NULL, 05141 NULL 05142 ); 05143 if (fInherit) 05144 pObjA->Attributes |= OBJ_INHERIT; 05145 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 05146 Status = GetExceptionCode(); 05147 } 05148 05149 if (NT_SUCCESS(Status)) { 05150 hwinsta = _OpenWindowStation(pObjA, MAXIMUM_ALLOWED, UserMode); 05151 } 05152 } 05153 } else { 05154 InitializeObjectAttributes( &ObjA, 05155 &strStatic, 05156 OBJ_CASE_INSENSITIVE, 05157 NULL, 05158 NULL 05159 ); 05160 if (fInherit) 05161 ObjA.Attributes |= OBJ_INHERIT; 05162 hwinsta = _OpenWindowStation(&ObjA, MAXIMUM_ALLOWED, KernelMode); 05163 } 05164 } 05165 05166 /* 05167 * Only allow service logons at the console. I don't think our 05168 * win32k exit routines cope with more than one windowstation. 05169 */ 05170 /* 05171 * If the open failed and the process is in a non-interactive 05172 * logon session, attempt to create a windowstation and 05173 * desktop for that session. Note that the desktop handle 05174 * will be closed after the desktop has been assigned. 05175 */ 05176 if (!gbRemoteSession && NT_SUCCESS(Status) && 05177 hwinsta == NULL && !fInteractive && fWinStaDefaulted) { 05178 05179 *phwinsta = xxxConnectService( 05180 &strStatic, 05181 &hdesk); 05182 05183 /* 05184 * Clean up and leave. 05185 */ 05186 if (pObjA != NULL) { 05187 ZwFreeVirtualMemory(NtCurrentProcess(), &pObjA, &cbObjA, 05188 MEM_RELEASE); 05189 } 05190 ObDereferenceObject(Process); 05191 05192 RIPMSG2(RIP_VERBOSE, 05193 "ResolveDesktop: xxxConnectService was called\n" 05194 "to hwinsta=%#p desktop=%#p", 05195 *phwinsta, hdesk); 05196 05197 return hdesk; 05198 } 05199 } 05200 05201 /* 05202 * Attempt to assign a desktop. 05203 */ 05204 if (hwinsta != NULL) { 05205 05206 /* 05207 * Every gui thread needs an associated desktop. We'll use the default 05208 * to start with and the application can override it if it wants. 05209 */ 05210 if (hdesk == NULL) { 05211 05212 /* 05213 * If no desktop name was passed in and a desktop 05214 * handle was inherited, assign it. 05215 */ 05216 if (fDesktopDefaulted) { 05217 if (xxxUserFindHandleForObject(Process, NULL, *ExDesktopObjectType, 05218 NULL, &hdesk)) { 05219 05220 /* 05221 * If the handle belongs to another process, 05222 * dup it into this one 05223 */ 05224 if (Process != PsGetCurrentProcess()) { 05225 HDESK hdeskDup; 05226 05227 Status = xxxUserDuplicateObject( 05228 hProcess, 05229 hdesk, 05230 NtCurrentProcess(), 05231 &hdeskDup, 05232 0, 05233 0, 05234 DUPLICATE_SAME_ACCESS); 05235 if (!NT_SUCCESS(Status)) { 05236 CloseProtectedHandle(hdesk); 05237 hdesk = NULL; 05238 } else { 05239 hdesk = hdeskDup; 05240 } 05241 } 05242 05243 /* 05244 * Map the desktop into the process. 05245 */ 05246 if (hdesk != NULL && ppi != NULL) { 05247 Status = ObReferenceObjectByHandle(hdesk, 05248 0, 05249 *ExDesktopObjectType, 05250 KernelMode, 05251 &pdesk, 05252 NULL); 05253 if (NT_SUCCESS(Status)) { 05254 05255 LogDesktop(pdesk, LD_REF_FN_RESOLVEDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 05256 05257 try { 05258 MapDesktop(ObOpenHandle, Process, pdesk, 0, 1); 05259 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 05260 Status = STATUS_NO_MEMORY; 05261 CloseProtectedHandle(hdesk); 05262 hdesk = NULL; 05263 } 05264 #if DBG 05265 if (hdesk != NULL) { 05266 UserAssert(GetDesktopView(ppi, pdesk) != NULL); 05267 } 05268 #endif // DBG 05269 LogDesktop(pdesk, LD_DEREF_FN_RESOLVEDESKTOP, FALSE, (ULONG_PTR)PtiCurrent()); 05270 ObDereferenceObject(pdesk); 05271 } else { 05272 CloseProtectedHandle(hdesk); 05273 hdesk = NULL; 05274 } 05275 } 05276 } 05277 } 05278 05279 /* 05280 * If not, open the desktop. 05281 */ 05282 if (NT_SUCCESS(Status) && hdesk == NULL) { 05283 RtlCopyUnicodeString(&strStatic, &strDesktop); 05284 05285 if (gbSecureDesktop) { 05286 if (pObjA == NULL) { 05287 /* 05288 * Allocate an object attributes structure in user address space. 05289 */ 05290 cbObjA = sizeof(*pObjA) + sizeof(*pstrStatic); 05291 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), 05292 &pObjA, 0, &cbObjA, MEM_COMMIT, PAGE_READWRITE); 05293 pstrStatic = (PUNICODE_STRING)((PBYTE)pObjA + sizeof(*pObjA)); 05294 } 05295 05296 if (NT_SUCCESS(Status)) { 05297 /* 05298 * Note -- the string must be in client-space or the 05299 * address validation in OpenDesktop will fail. 05300 */ 05301 try { 05302 *pstrStatic = strStatic; 05303 InitializeObjectAttributes( pObjA, 05304 pstrStatic, 05305 OBJ_CASE_INSENSITIVE, 05306 hwinsta, 05307 NULL 05308 ); 05309 if (fInherit) 05310 pObjA->Attributes |= OBJ_INHERIT; 05311 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 05312 Status = GetExceptionCode(); 05313 } 05314 05315 if (NT_SUCCESS(Status)) { 05316 hdesk = xxxOpenDesktop(pObjA, 05317 UserMode, 05318 0, 05319 MAXIMUM_ALLOWED, 05320 pbShutDown); 05321 } 05322 } 05323 } else { 05324 InitializeObjectAttributes( &ObjA, 05325 &strStatic, 05326 OBJ_CASE_INSENSITIVE, 05327 hwinsta, 05328 NULL 05329 ); 05330 if (fInherit) 05331 ObjA.Attributes |= OBJ_INHERIT; 05332 hdesk = xxxOpenDesktop(&ObjA, 05333 KernelMode, 05334 0, 05335 MAXIMUM_ALLOWED, 05336 pbShutDown); 05337 } 05338 } 05339 } 05340 if (hdesk == NULL) { 05341 UserVerify(NT_SUCCESS(ZwClose(hwinsta))); 05342 hwinsta = NULL; 05343 } 05344 } 05345 05346 ObDereferenceObject(Process); 05347 05348 if (pObjA != NULL) { 05349 ZwFreeVirtualMemory(NtCurrentProcess(), &pObjA, &cbObjA, 05350 MEM_RELEASE); 05351 } 05352 05353 *phwinsta = hwinsta; 05354 05355 RIPMSG2(RIP_VERBOSE, 05356 "ResolveDesktop: to hwinsta=%#p desktop=%#p", 05357 *phwinsta, hdesk); 05358 05359 return hdesk; 05360 }

NTSTATUS xxxResolveDesktopForWOW IN OUT PUNICODE_STRING  pstrDesktop  ) 
 

Definition at line 4588 of file desktop.c.

References _OpenWindowStation(), BOOL, CloseProtectedHandle(), FALSE, gbSecureDesktop, KernelMode, L, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, RtlAppendUnicodeStringToString(), RtlAppendUnicodeToString(), RtlCopyUnicodeString(), RtlInitUnicodeString(), Status, szWindowStationDirectory, TRUE, UserMode, USHORT, and xxxOpenDesktop().

Referenced by NtUserResolveDesktopForWOW().

04590 { 04591 NTSTATUS Status; 04592 UNICODE_STRING strDesktop, strWinSta, strStatic; 04593 LPWSTR pszDesktop; 04594 BOOL fWinStaDefaulted; 04595 BOOL fDesktopDefaulted; 04596 HWINSTA hwinsta; 04597 HDESK hdesk; 04598 OBJECT_ATTRIBUTES ObjA; 04599 PUNICODE_STRING pstrStatic; 04600 POBJECT_ATTRIBUTES pObjA = NULL; 04601 SIZE_T cbObjA; 04602 BOOL bShutDown = FALSE; 04603 PTEB pteb = NtCurrentTeb(); 04604 04605 UserAssert(pteb); 04606 04607 /* 04608 * Determine windowstation and desktop names. 04609 */ 04610 04611 04612 if (pstrDesktop == NULL) { 04613 return STATUS_INVALID_PARAMETER; 04614 } 04615 04616 strStatic.Length = 0; 04617 strStatic.MaximumLength = STATIC_UNICODE_BUFFER_LENGTH * sizeof(WCHAR); 04618 04619 /* 04620 * Use the StaticUnicodeBuffer on the TEB as the buffer for the object name. 04621 * Even if this is client side and we pass KernelMode to the Ob call in 04622 * _OpenWindowStation this is safe because the TEB is not going to go away 04623 * during this call. The worst it can happen is to have the buffer in the TEB 04624 * trashed. 04625 */ 04626 strStatic.Buffer = pteb->StaticUnicodeBuffer; 04627 04628 UserAssert(pteb->StaticUnicodeBuffer == pteb->StaticUnicodeString.Buffer); 04629 UserAssert(pteb->StaticUnicodeString.MaximumLength ==STATIC_UNICODE_BUFFER_LENGTH * sizeof(WCHAR)); 04630 04631 if (pstrDesktop->Length == 0) { 04632 RtlInitUnicodeString(&strDesktop, TEXT("Default")); 04633 fWinStaDefaulted = fDesktopDefaulted = TRUE; 04634 } else { 04635 USHORT cch; 04636 /* 04637 * The name be of the form windowstation\desktop. Parse 04638 * the string to separate out the names. 04639 */ 04640 strWinSta = *pstrDesktop; 04641 cch = strWinSta.Length / sizeof(WCHAR); 04642 pszDesktop = strWinSta.Buffer; 04643 while (cch && *pszDesktop != L'\\') { 04644 cch--; 04645 pszDesktop++; 04646 } 04647 fDesktopDefaulted = FALSE; 04648 04649 if (cch == 0) { 04650 04651 /* 04652 * No windowstation name was specified, only the desktop. 04653 */ 04654 strDesktop = strWinSta; 04655 fWinStaDefaulted = TRUE; 04656 } else { 04657 /* 04658 * Both names were in the string. 04659 */ 04660 strDesktop.Buffer = pszDesktop + 1; 04661 strDesktop.Length = strDesktop.MaximumLength = (cch - 1) * sizeof(WCHAR); 04662 strWinSta.Length = (USHORT)(pszDesktop - strWinSta.Buffer) * sizeof(WCHAR); 04663 04664 /* 04665 * zero terminate the strWinSta buffer so the rebuild of the desktop 04666 * name at the end of the function works. 04667 */ 04668 *pszDesktop = (WCHAR)0; 04669 04670 fWinStaDefaulted = FALSE; 04671 04672 RtlAppendUnicodeToString(&strStatic, (PWSTR)szWindowStationDirectory); 04673 RtlAppendUnicodeToString(&strStatic, L"\\"); 04674 RtlAppendUnicodeStringToString(&strStatic, &strWinSta); 04675 04676 } 04677 } 04678 04679 if (fWinStaDefaulted) { 04680 04681 //Default Window Station 04682 RtlInitUnicodeString(&strWinSta, L"WinSta0"); 04683 04684 RtlAppendUnicodeToString(&strStatic, (PWSTR)szWindowStationDirectory); 04685 RtlAppendUnicodeToString(&strStatic, L"\\"); 04686 RtlAppendUnicodeStringToString(&strStatic, &strWinSta); 04687 04688 } 04689 04690 /* 04691 * Open the computed windowstation. This will also do an access check 04692 */ 04693 if (gbSecureDesktop) { 04694 /* 04695 * Allocate an object attributes structure in user address space. 04696 */ 04697 cbObjA = sizeof(*pObjA) + sizeof(*pstrStatic); 04698 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), 04699 &pObjA, 0, &cbObjA, MEM_COMMIT, PAGE_READWRITE); 04700 pstrStatic = (PUNICODE_STRING)((PBYTE)pObjA + sizeof(*pObjA)); 04701 04702 if (NT_SUCCESS(Status)) { 04703 /* 04704 * Note -- the string must be in client-space or the 04705 * address validation in OpenWindowStation will fail. 04706 */ 04707 try { 04708 *pstrStatic = strStatic; 04709 InitializeObjectAttributes( pObjA, 04710 pstrStatic, 04711 OBJ_CASE_INSENSITIVE, 04712 NULL, 04713 NULL 04714 ); 04715 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 04716 Status = GetExceptionCode(); 04717 } 04718 04719 if (NT_SUCCESS(Status)) { 04720 hwinsta = _OpenWindowStation(pObjA, MAXIMUM_ALLOWED, UserMode); 04721 } else { 04722 hwinsta = NULL; 04723 } 04724 if (!hwinsta) { 04725 ZwFreeVirtualMemory(NtCurrentProcess(), &pObjA, &cbObjA, 04726 MEM_RELEASE); 04727 return STATUS_ACCESS_DENIED; 04728 } 04729 } else { 04730 return STATUS_NO_MEMORY; 04731 } 04732 } else { 04733 InitializeObjectAttributes( &ObjA, 04734 &strStatic, 04735 OBJ_CASE_INSENSITIVE, 04736 NULL, 04737 NULL 04738 ); 04739 hwinsta = _OpenWindowStation(&ObjA, MAXIMUM_ALLOWED, KernelMode); 04740 if (!hwinsta) { 04741 return STATUS_ACCESS_DENIED; 04742 } 04743 } 04744 04745 /* 04746 * Do an access check on the desktop by opening it 04747 */ 04748 04749 RtlCopyUnicodeString(&strStatic, &strDesktop); 04750 04751 if (gbSecureDesktop) { 04752 /* 04753 * Note -- the string must be in client-space or the 04754 * address validation in OpenDesktop will fail. 04755 */ 04756 try { 04757 *pstrStatic = strStatic; 04758 InitializeObjectAttributes( pObjA, 04759 pstrStatic, 04760 OBJ_CASE_INSENSITIVE, 04761 hwinsta, 04762 NULL 04763 ); 04764 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 04765 Status = GetExceptionCode(); 04766 } 04767 04768 if (NT_SUCCESS(Status)) { 04769 hdesk = xxxOpenDesktop(pObjA, 04770 UserMode, 04771 0, 04772 MAXIMUM_ALLOWED, 04773 &bShutDown); 04774 } else { 04775 hdesk = NULL; 04776 } 04777 04778 ZwFreeVirtualMemory(NtCurrentProcess(), &pObjA, &cbObjA, 04779 MEM_RELEASE); 04780 } else { 04781 InitializeObjectAttributes( &ObjA, 04782 &strStatic, 04783 OBJ_CASE_INSENSITIVE, 04784 hwinsta, 04785 NULL 04786 ); 04787 hdesk = xxxOpenDesktop(&ObjA, 04788 KernelMode, 04789 0, 04790 MAXIMUM_ALLOWED, 04791 &bShutDown); 04792 } 04793 04794 if (!hdesk) { 04795 UserVerify(NT_SUCCESS(ZwClose(hwinsta))); 04796 return STATUS_ACCESS_DENIED; 04797 } 04798 04799 CloseProtectedHandle(hdesk); 04800 UserVerify(NT_SUCCESS(ZwClose(hwinsta))); 04801 04802 /* 04803 * Copy the final Computed String 04804 */ 04805 RtlCopyUnicodeString(pstrDesktop, &strWinSta); 04806 RtlAppendUnicodeToString(pstrDesktop, L"\\"); 04807 RtlAppendUnicodeStringToString(pstrDesktop, &strDesktop); 04808 04809 return STATUS_SUCCESS; 04810 }

NTSTATUS xxxRestoreCsrssThreadDesktop PDESKRESTOREDATA  pdrdRestore  ) 
 

Definition at line 5804 of file queue.c.

References CloseProtectedHandle(), FALSE, ISCSRSS, LogDesktop, msg, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, PtiCurrent, tagTHREADINFO::rpdesk, Status, xxxDispatchMessage(), xxxPeekMessage, and xxxSetThreadDesktop().

Referenced by VideoPortCalloutThread(), xxxHardErrorControl(), xxxQueryInformationThread(), xxxSetInformationThread(), and xxxUserPowerEventCalloutWorker().

05805 { 05806 PTHREADINFO ptiCurrent = PtiCurrent(); 05807 NTSTATUS Status = STATUS_SUCCESS; 05808 MSG msg; 05809 05810 /* 05811 * Only csr should come here 05812 */ 05813 UserAssert(ISCSRSS()); 05814 UserAssert(pdrdRestore); 05815 05816 /* 05817 * Set the new desktop, if switching 05818 */ 05819 if (pdrdRestore->pdeskRestore != ptiCurrent->rpdesk) { 05820 /* 05821 * Process any remaining messages before we leave the desktop 05822 */ 05823 if (ptiCurrent->rpdesk) { 05824 while (xxxPeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_NOYIELD)) 05825 xxxDispatchMessage(&msg); 05826 } 05827 05828 if (!xxxSetThreadDesktop(NULL, pdrdRestore->pdeskRestore)) { 05829 RIPMSG1(RIP_WARNING, "xxxRestoreCsrssThreadDesktop: xxxRestoreThreadDesktop(%#p) failed", pdrdRestore->pdeskRestore); 05830 Status = STATUS_INVALID_HANDLE; 05831 } 05832 } 05833 05834 /* 05835 * Dereference the desktop, 05836 * even if failing the call. 05837 */ 05838 if (pdrdRestore->pdeskRestore != NULL) { 05839 LogDesktop(pdrdRestore->pdeskRestore, LD_DEREF_FN_SETCSRSSTHREADDESKTOP2, FALSE, 0); 05840 ObDereferenceObject(pdrdRestore->pdeskRestore); 05841 pdrdRestore->pdeskRestore = NULL; 05842 } 05843 05844 if(pdrdRestore->hdeskNew) { 05845 CloseProtectedHandle(pdrdRestore->hdeskNew); 05846 UserAssert(NT_SUCCESS(Status)); 05847 pdrdRestore->hdeskNew = NULL; 05848 } 05849 return Status; 05850 }

VOID xxxSBTrackInit PWND  pwnd,
LPARAM  lParam,
int  curArea,
UINT  uType
 

Definition at line 2196 of file sbctl.c.

References CalcSBStuff(), CalcTrackDragRect(), CheckLock, CopyRect, tagSBCALC::cpxThumb, FALSE, GET_X_LPARAM, GET_Y_LPARAM, GetWndSBDisableFlags(), Lock, LTUPFLAG, NULL, PtiCurrent, PWNDTOPSBTRACK, tagSBCALC::pxBottom, tagSBCALC::pxDownArrow, tagSBCALC::pxLeft, tagSBCALC::pxRight, tagSBCALC::pxStart, tagSBCALC::pxThumbBottom, tagSBCALC::pxThumbTop, tagSBCALC::pxTop, tagSBCALC::pxUpArrow, tagWND::rcWindow, REEVALUATE_PSBTRACK, RETURN_IF_PSBTRACK_INVALID, RTDNFLAG, SCROLL_DIRECT, SCROLL_MENU, tagWND::spwndParent, TestWF, UINT, Unlock, WINDOW_CAPTURE, xxxCapture(), xxxDoScroll(), xxxSBTrackLoop(), xxxTrackBox(), xxxTrackThumb(), and zzzShowCaret().

Referenced by xxxDoScrollMenu(), xxxSBWndProc(), and xxxSysCommand().

02201 { 02202 int px; 02203 LPINT pwX; 02204 LPINT pwY; 02205 UINT wDisable; // Scroll bar disable flags; 02206 SBCALC SBCalc; 02207 PSBCALC pSBCalc; 02208 RECT rcSB; 02209 PSBTRACK pSBTrack; 02210 02211 CheckLock(pwnd); 02212 02213 02214 if (PWNDTOPSBTRACK(pwnd)) { 02215 RIPMSG1(RIP_WARNING, "xxxSBTrackInit: PWNDTOPSBTRACK(pwnd) == %#p", 02216 PWNDTOPSBTRACK(pwnd)); 02217 return; 02218 } 02219 02220 pSBTrack = (PSBTRACK)UserAllocPoolWithQuota(sizeof(*pSBTrack), TAG_SCROLLTRACK); 02221 if (pSBTrack == NULL) 02222 return; 02223 02224 pSBTrack->hTimerSB = 0; 02225 pSBTrack->fHitOld = FALSE; 02226 02227 pSBTrack->xxxpfnSB = xxxTrackBox; 02228 02229 pSBTrack->spwndTrack = NULL; 02230 pSBTrack->spwndSB = NULL; 02231 pSBTrack->spwndSBNotify = NULL; 02232 Lock(&pSBTrack->spwndTrack, pwnd); 02233 PWNDTOPSBTRACK(pwnd) = pSBTrack; 02234 02235 pSBTrack->fCtlSB = (!curArea); 02236 if (pSBTrack->fCtlSB) { 02237 02238 /* 02239 * This is a scroll bar control. 02240 */ 02241 Lock(&pSBTrack->spwndSB, pwnd); 02242 pSBTrack->fTrackVert = ((PSBWND)pwnd)->fVert; 02243 Lock(&pSBTrack->spwndSBNotify, pwnd->spwndParent); 02244 wDisable = ((PSBWND)pwnd)->wDisableFlags; 02245 pSBCalc = &((PSBWND)pwnd)->SBCalc; 02246 pSBTrack->nBar = SB_CTL; 02247 } else { 02248 02249 /* 02250 * This is a scroll bar that is part of the window frame. 02251 */ 02252 02253 #ifdef USE_MIRRORING 02254 // 02255 // Mirror the window coord of the scroll bar, 02256 // if it is a mirrored one 02257 // 02258 if (TestWF(pwnd,WEFLAYOUTRTL)) { 02259 lParam = MAKELONG( 02260 pwnd->rcWindow.right - GET_X_LPARAM(lParam), 02261 GET_Y_LPARAM(lParam) - pwnd->rcWindow.top); 02262 } 02263 else { 02264 #endif 02265 lParam = MAKELONG( 02266 GET_X_LPARAM(lParam) - pwnd->rcWindow.left, 02267 GET_Y_LPARAM(lParam) - pwnd->rcWindow.top); 02268 02269 #ifdef USE_MIRRORING 02270 } 02271 #endif 02272 Lock(&pSBTrack->spwndSBNotify, pwnd); 02273 Lock(&pSBTrack->spwndSB, NULL); 02274 pSBTrack->fTrackVert = (curArea - HTHSCROLL); 02275 wDisable = GetWndSBDisableFlags(pwnd, pSBTrack->fTrackVert); 02276 pSBCalc = &SBCalc; 02277 pSBTrack->nBar = (curArea - HTHSCROLL) ? SB_VERT : SB_HORZ; 02278 } 02279 02280 pSBTrack->pSBCalc = pSBCalc; 02281 /* 02282 * Check if the whole scroll bar is disabled 02283 */ 02284 if((wDisable & SB_DISABLE_MASK) == SB_DISABLE_MASK) { 02285 Unlock(&pSBTrack->spwndSBNotify); 02286 Unlock(&pSBTrack->spwndSB); 02287 Unlock(&pSBTrack->spwndTrack); 02288 UserFreePool(pSBTrack); 02289 PWNDTOPSBTRACK(pwnd) = NULL; 02290 return; // It is a disabled scroll bar; So, do not respond. 02291 } 02292 02293 if (!pSBTrack->fCtlSB) { 02294 CalcSBStuff(pwnd, pSBCalc, pSBTrack->fTrackVert); 02295 } 02296 02297 pwX = (LPINT)&rcSB; 02298 pwY = pwX + 1; 02299 if (!pSBTrack->fTrackVert) 02300 pwX = pwY--; 02301 02302 px = (pSBTrack->fTrackVert ? GET_Y_LPARAM(lParam) : GET_X_LPARAM(lParam)); 02303 02304 *(pwX + 0) = pSBCalc->pxLeft; 02305 *(pwY + 0) = pSBCalc->pxTop; 02306 *(pwX + 2) = pSBCalc->pxRight; 02307 *(pwY + 2) = pSBCalc->pxBottom; 02308 pSBTrack->cmdSB = (UINT)-1; 02309 if (px < pSBCalc->pxUpArrow) { 02310 02311 /* 02312 * The click occurred on Left/Up arrow; Check if it is disabled 02313 */ 02314 if(wDisable & LTUPFLAG) { 02315 if(pSBTrack->fCtlSB) { // If this is a scroll bar control, 02316 zzzShowCaret(pSBTrack->spwndSB); // show the caret before returning; 02317 // After zzzShowCaret, revalidate pSBTrack 02318 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02319 } 02320 02321 Unlock(&pSBTrack->spwndSBNotify); 02322 Unlock(&pSBTrack->spwndSB); 02323 Unlock(&pSBTrack->spwndTrack); 02324 UserFreePool(pSBTrack); 02325 PWNDTOPSBTRACK(pwnd) = NULL; 02326 return; // Yes! disabled. Do not respond. 02327 } 02328 02329 // LINEUP -- make rcSB the Up Arrow's Rectangle 02330 pSBTrack->cmdSB = SB_LINEUP; 02331 *(pwY + 2) = pSBCalc->pxUpArrow; 02332 } else if (px >= pSBCalc->pxDownArrow) { 02333 02334 /* 02335 * The click occurred on Right/Down arrow; Check if it is disabled 02336 */ 02337 if (wDisable & RTDNFLAG) { 02338 if (pSBTrack->fCtlSB) { // If this is a scroll bar control, 02339 zzzShowCaret(pSBTrack->spwndSB); // show the caret before returning; 02340 // After zzzShowCaret, revalidate pSBTrack 02341 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02342 } 02343 02344 Unlock(&pSBTrack->spwndSBNotify); 02345 Unlock(&pSBTrack->spwndSB); 02346 Unlock(&pSBTrack->spwndTrack); 02347 UserFreePool(pSBTrack); 02348 PWNDTOPSBTRACK(pwnd) = NULL; 02349 return;// Yes! disabled. Do not respond. 02350 } 02351 02352 // LINEDOWN -- make rcSB the Down Arrow's Rectangle 02353 pSBTrack->cmdSB = SB_LINEDOWN; 02354 *(pwY + 0) = pSBCalc->pxDownArrow; 02355 } else if (px < pSBCalc->pxThumbTop) { 02356 // PAGEUP -- make rcSB the rectangle between Up Arrow and Thumb 02357 pSBTrack->cmdSB = SB_PAGEUP; 02358 *(pwY + 0) = pSBCalc->pxUpArrow; 02359 *(pwY + 2) = pSBCalc->pxThumbTop; 02360 } else if (px < pSBCalc->pxThumbBottom) { 02361 02362 DoThumbPos: 02363 /* 02364 * Elevator isn't there if there's no room. 02365 */ 02366 if (pSBCalc->pxDownArrow - pSBCalc->pxUpArrow <= pSBCalc->cpxThumb) { 02367 Unlock(&pSBTrack->spwndSBNotify); 02368 Unlock(&pSBTrack->spwndSB); 02369 Unlock(&pSBTrack->spwndTrack); 02370 UserFreePool(pSBTrack); 02371 PWNDTOPSBTRACK(pwnd) = NULL; 02372 return; 02373 } 02374 // THUMBPOSITION -- we're tracking with the thumb 02375 pSBTrack->cmdSB = SB_THUMBPOSITION; 02376 CalcTrackDragRect(pSBTrack); 02377 02378 pSBTrack->xxxpfnSB = xxxTrackThumb; 02379 pSBTrack->pxOld = pSBCalc->pxStart = pSBCalc->pxThumbTop; 02380 pSBTrack->posNew = pSBTrack->posOld = pSBCalc->pos; 02381 pSBTrack->dpxThumb = pSBCalc->pxStart - px; 02382 02383 xxxCapture(PtiCurrent(), pwnd, WINDOW_CAPTURE); 02384 // After xxxCapture, revalidate pSBTrack 02385 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02386 02387 /* 02388 * DoScroll does thread locking on these two pwnds - 02389 * this is ok since they are not used after this 02390 * call. 02391 */ 02392 if (pSBTrack->spwndSBNotify != NULL) { 02393 xxxDoScroll(pSBTrack->spwndSB, pSBTrack->spwndSBNotify, 02394 SB_THUMBTRACK, pSBTrack->posOld, pSBTrack->fTrackVert 02395 ); 02396 // Note: after xxx, pSBTrack may no longer be valid 02397 } 02398 } else if (px < pSBCalc->pxDownArrow) { 02399 // PAGEDOWN -- make rcSB the rectangle between Thumb and Down Arrow 02400 pSBTrack->cmdSB = SB_PAGEDOWN; 02401 *(pwY + 0) = pSBCalc->pxThumbBottom; 02402 *(pwY + 2) = pSBCalc->pxDownArrow; 02403 } 02404 02405 /* 02406 * If the shift key is down, we'll position the thumb directly so it's 02407 * centered on the click point. 02408 */ 02409 if ((uType == SCROLL_DIRECT && pSBTrack->cmdSB != SB_LINEUP && pSBTrack->cmdSB != SB_LINEDOWN) || 02410 (uType == SCROLL_MENU)) { 02411 if (pSBTrack->cmdSB != SB_THUMBPOSITION) { 02412 goto DoThumbPos; 02413 } 02414 pSBTrack->dpxThumb = -(pSBCalc->cpxThumb / 2); 02415 } 02416 02417 xxxCapture(PtiCurrent(), pwnd, WINDOW_CAPTURE); 02418 // After xxxCapture, revalidate pSBTrack 02419 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02420 02421 if (pSBTrack->cmdSB != SB_THUMBPOSITION) { 02422 CopyRect(&pSBTrack->rcTrack, &rcSB); 02423 } 02424 02425 xxxSBTrackLoop(pwnd, lParam, pSBCalc); 02426 02427 // After xxx, re-evaluate pSBTrack 02428 REEVALUATE_PSBTRACK(pSBTrack, pwnd, "xxxTrackLoop"); 02429 if (pSBTrack) { 02430 Unlock(&pSBTrack->spwndSBNotify); 02431 Unlock(&pSBTrack->spwndSB); 02432 Unlock(&pSBTrack->spwndTrack); 02433 UserFreePool(pSBTrack); 02434 PWNDTOPSBTRACK(pwnd) = NULL; 02435 } 02436 }

LRESULT xxxSBWndProc PSBWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 2582 of file sbctl.c.

References _ClientToScreen(), _FChildVisible(), _GetKeyState(), _GetWindowDC(), _ReleaseDC(), _SBGetParms(), BOOL, CheckLock, ClrWF, cy, DrawSize(), DrawThumb2(), FALSE, FNID_SCROLLBAR, FWINABLE, GET_X_LPARAM, GET_Y_LPARAM, HitTestScrollBar(), HWq, IsWinEventNotifyDeferredOK, L, LOBYTE, NULL, PtiCurrent, PWND, tagWND::rcWindow, SBCtlSetup(), SBSetParms(), SCROLL_DIRECT, SCROLL_NORMAL, SetWF, tagWND::spwndParent, SYSMET, TestWF, ThreadLock, ThreadUnlock, TrackMouseEvent(), TRUE, UINT, VALIDATECLASSANDSIZE, WEF_USEPWNDTHREAD, WFSIZEBOX, WFTABSTOP, WFWIN40COMPAT, xxxBeginPaint(), xxxCreateCaret(), xxxDefWindowProc(), xxxDoScroll(), xxxDoScrollMenu(), xxxDrawSB2(), xxxEnableSBCtlArrows(), xxxEnableScrollBar(), xxxEndPaint(), xxxGetColorObjects(), xxxMoveWindow(), xxxSBTrackInit(), xxxSendMessage(), xxxSetFocus(), xxxWindowEvent(), zzzDestroyCaret(), zzzHideCaret(), zzzSetSBCaretPos(), and zzzShowCaret().

Referenced by InitFunctionTables(), InitializeClientPfnArrays(), and LW_RegisterWindows().

02587 { 02588 LONG l; 02589 LONG lres; 02590 int cx; 02591 int cy; 02592 UINT cmd; 02593 UINT uSide; 02594 HDC hdc; 02595 RECT rc; 02596 POINT pt; 02597 BOOL fSizeReal; 02598 HBRUSH hbrSave; 02599 BOOL fSize; 02600 PAINTSTRUCT ps; 02601 UINT style; 02602 TL tlpwndParent; 02603 SCROLLINFO si; 02604 LPSCROLLINFO lpsi = &si; 02605 BOOL fRedraw = FALSE; 02606 BOOL fScroll; 02607 02608 CheckLock(psbwnd); 02609 UserAssert(IsWinEventNotifyDeferredOK()); 02610 02611 VALIDATECLASSANDSIZE(((PWND)psbwnd), message, wParam, lParam, FNID_SCROLLBAR, WM_CREATE); 02612 02613 style = LOBYTE(psbwnd->wnd.style); 02614 fSize = ((style & (SBS_SIZEBOX | SBS_SIZEGRIP)) != 0); 02615 02616 switch (message) { 02617 case WM_CREATE: 02618 /* 02619 * Guard against lParam being NULL since the thunk allows it [51986] 02620 */ 02621 if (lParam) { 02622 rc.right = (rc.left = ((LPCREATESTRUCT)lParam)->x) + 02623 ((LPCREATESTRUCT)lParam)->cx; 02624 rc.bottom = (rc.top = ((LPCREATESTRUCT)lParam)->y) + 02625 ((LPCREATESTRUCT)lParam)->cy; 02626 // This is because we can't just rev CardFile -- we should fix the 02627 // problem here in case anyone else happened to have some EXTRA 02628 // scroll styles on their scroll bar controls (jeffbog 03/21/94) 02629 if (!TestWF((PWND)psbwnd, WFWIN40COMPAT)) 02630 psbwnd->wnd.style &= ~(WS_HSCROLL | WS_VSCROLL); 02631 02632 if (!fSize) { 02633 l = PtrToLong(((LPCREATESTRUCT)lParam)->lpCreateParams); 02634 psbwnd->SBCalc.pos = psbwnd->SBCalc.posMin = LOWORD(l); 02635 psbwnd->SBCalc.posMax = HIWORD(l); 02636 psbwnd->fVert = ((LOBYTE(psbwnd->wnd.style) & SBS_VERT) != 0); 02637 psbwnd->SBCalc.page = 0; 02638 } 02639 02640 if (psbwnd->wnd.style & WS_DISABLED) 02641 psbwnd->wDisableFlags = SB_DISABLE_MASK; 02642 02643 if (style & (SBS_TOPALIGN | SBS_BOTTOMALIGN)) { 02644 if (fSize) { 02645 if (style & SBS_SIZEBOXBOTTOMRIGHTALIGN) { 02646 rc.left = rc.right - SYSMET(CXVSCROLL); 02647 rc.top = rc.bottom - SYSMET(CYHSCROLL); 02648 } 02649 02650 rc.right = rc.left + SYSMET(CXVSCROLL); 02651 rc.bottom = rc.top + SYSMET(CYHSCROLL); 02652 } else { 02653 if (style & SBS_VERT) { 02654 if (style & SBS_LEFTALIGN) 02655 rc.right = rc.left + SYSMET(CXVSCROLL); 02656 else 02657 rc.left = rc.right - SYSMET(CXVSCROLL); 02658 } else { 02659 if (style & SBS_TOPALIGN) 02660 rc.bottom = rc.top + SYSMET(CYHSCROLL); 02661 else 02662 rc.top = rc.bottom - SYSMET(CYHSCROLL); 02663 } 02664 } 02665 02666 xxxMoveWindow((PWND)psbwnd, rc.left, rc.top, rc.right - rc.left, 02667 rc.bottom - rc.top, FALSE); 02668 } 02669 } /* if */ 02670 02671 else { 02672 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, 02673 "xxxSBWndProc - NULL lParam for WM_CREATE\n") ; 02674 } /* else */ 02675 02676 break; 02677 02678 case WM_SIZE: 02679 if (PtiCurrent()->pq->spwndFocus != (PWND)psbwnd) 02680 break; 02681 02682 // scroll bar has the focus -- recalc it's thumb caret size 02683 // no need to DeferWinEventNotify() - see xxxCreateCaret below. 02684 zzzDestroyCaret(); 02685 02686 // | | 02687 // | FALL THRU | 02688 // V V 02689 02690 case WM_SETFOCUS: 02691 SBCtlSetup(psbwnd); 02692 02693 cx = (psbwnd->fVert ? psbwnd->wnd.rcWindow.right - psbwnd->wnd.rcWindow.left 02694 : psbwnd->SBCalc.cpxThumb) - 2 * SYSMET(CXEDGE); 02695 cy = (psbwnd->fVert ? psbwnd->SBCalc.cpxThumb 02696 : psbwnd->wnd.rcWindow.bottom - psbwnd->wnd.rcWindow.top) - 2 * SYSMET(CYEDGE); 02697 02698 xxxCreateCaret((PWND)psbwnd, (HBITMAP)1, cx, cy); 02699 zzzSetSBCaretPos(psbwnd); 02700 zzzShowCaret((PWND)psbwnd); 02701 break; 02702 02703 case WM_KILLFOCUS: 02704 zzzDestroyCaret(); 02705 break; 02706 02707 case WM_ERASEBKGND: 02708 02709 /* 02710 * Do nothing, but don't let DefWndProc() do it either. 02711 * It will be erased when its painted. 02712 */ 02713 return (LONG)TRUE; 02714 02715 case WM_PRINTCLIENT: 02716 case WM_PAINT: 02717 if ((hdc = (HDC)wParam) == NULL) { 02718 hdc = xxxBeginPaint((PWND)psbwnd, (LPPAINTSTRUCT)&ps); 02719 } 02720 if (!fSize) { 02721 SBCtlSetup(psbwnd); 02722 xxxDrawSB2((PWND)psbwnd, &psbwnd->SBCalc, hdc, psbwnd->fVert, psbwnd->wDisableFlags); 02723 } else { 02724 fSizeReal = TestWF((PWND)psbwnd, WFSIZEBOX); 02725 if (!fSizeReal) 02726 SetWF((PWND)psbwnd, WFSIZEBOX); 02727 02728 DrawSize((PWND)psbwnd, hdc, 0, 0); 02729 02730 if (!fSizeReal) 02731 ClrWF((PWND)psbwnd, WFSIZEBOX); 02732 } 02733 02734 if (wParam == 0L) 02735 xxxEndPaint((PWND)psbwnd, (LPPAINTSTRUCT)&ps); 02736 break; 02737 02738 case WM_GETDLGCODE: 02739 return DLGC_WANTARROWS; 02740 02741 case WM_CONTEXTMENU: 02742 ThreadLock(psbwnd->wnd.spwndParent, &tlpwndParent); 02743 xxxDoScrollMenu(psbwnd->wnd.spwndParent, (PWND)psbwnd, psbwnd->fVert, lParam); 02744 ThreadUnlock(&tlpwndParent); 02745 break; 02746 02747 case WM_NCHITTEST: 02748 if (style & SBS_SIZEGRIP) { 02749 #ifdef USE_MIRRORING 02750 /* 02751 * If the scroll bar is RTL mirrored, then 02752 * mirror the hittest of the grip location. 02753 */ 02754 if (TestWF((PWND)psbwnd, WEFLAYOUTRTL)) 02755 return HTBOTTOMLEFT; 02756 else 02757 #endif 02758 return HTBOTTOMRIGHT; 02759 } else { 02760 goto DoDefault; 02761 } 02762 break; 02763 02764 #ifdef COLOR_HOTTRACKING 02765 case WM_MOUSELEAVE: 02766 xxxHotTrackSBCtl(psbwnd, 0, FALSE); 02767 psbwnd->ht = 0; 02768 break; 02769 02770 case WM_MOUSEMOVE: 02771 { 02772 int ht; 02773 02774 if (psbwnd->ht == 0) { 02775 TRACKMOUSEEVENT tme = {sizeof(TRACKMOUSEEVENT), TME_LEAVE, HWq(psbwnd), 0}; 02776 TrackMouseEvent(&tme); 02777 } 02778 02779 pt.x = GET_X_LPARAM(lParam); 02780 pt.y = GET_Y_LPARAM(lParam); 02781 ht = HitTestScrollBar((PWND)psbwnd, psbwnd->fVert, pt); 02782 if (psbwnd->ht != ht) { 02783 xxxHotTrackSBCtl(psbwnd, ht, TRUE); 02784 psbwnd->ht = ht; 02785 } 02786 } 02787 break; 02788 #endif // COLOR_HOTTRACKING 02789 02790 case WM_LBUTTONDBLCLK: 02791 cmd = SC_ZOOM; 02792 if (fSize) 02793 goto postmsg; 02794 02795 /* 02796 *** FALL THRU ** 02797 */ 02798 02799 case WM_LBUTTONDOWN: 02800 // 02801 // Note that SBS_SIZEGRIP guys normally won't ever see button 02802 // downs. This is because they return HTBOTTOMRIGHT to 02803 // WindowHitTest handling. This will walk up the parent chain 02804 // to the first sizeable ancestor, bailing out at caption windows 02805 // of course. That dude, if he exists, will handle the sizing 02806 // instead. 02807 // 02808 if (!fSize) { 02809 if (TestWF((PWND)psbwnd, WFTABSTOP)) { 02810 xxxSetFocus((PWND)psbwnd); 02811 } 02812 02813 zzzHideCaret((PWND)psbwnd); 02814 SBCtlSetup(psbwnd); 02815 02816 /* 02817 * SBCtlSetup enters SEM_SB, and xxxSBTrackInit leaves it. 02818 */ 02819 xxxSBTrackInit((PWND)psbwnd, lParam, 0, (_GetKeyState(VK_SHIFT) < 0) ? SCROLL_DIRECT : SCROLL_NORMAL); 02820 break; 02821 } else { 02822 cmd = SC_SIZE; 02823 postmsg: 02824 pt.x = GET_X_LPARAM(lParam); 02825 pt.y = GET_Y_LPARAM(lParam); 02826 _ClientToScreen((PWND)psbwnd, &pt); 02827 lParam = MAKELONG(pt.x, pt.y); 02828 02829 /* 02830 * convert HT value into a move value. This is bad, 02831 * but this is purely temporary. 02832 */ 02833 #ifdef USE_MIRRORING 02834 if (TestWF(((PWND)psbwnd)->spwndParent,WEFLAYOUTRTL)) { 02835 uSide = HTBOTTOMLEFT; 02836 } else 02837 #endif 02838 { 02839 uSide = HTBOTTOMRIGHT; 02840 } 02841 ThreadLock(((PWND)psbwnd)->spwndParent, &tlpwndParent); 02842 xxxSendMessage(((PWND)psbwnd)->spwndParent, WM_SYSCOMMAND, 02843 (cmd | (uSide - HTSIZEFIRST + 1)), lParam); 02844 ThreadUnlock(&tlpwndParent); 02845 } 02846 break; 02847 02848 case WM_KEYUP: 02849 switch (wParam) { 02850 case VK_HOME: 02851 case VK_END: 02852 case VK_PRIOR: 02853 case VK_NEXT: 02854 case VK_LEFT: 02855 case VK_UP: 02856 case VK_RIGHT: 02857 case VK_DOWN: 02858 02859 /* 02860 * Send end scroll message when user up clicks on keyboard 02861 * scrolling. 02862 * 02863 * DoScroll does thread locking on these two pwnds - 02864 * this is ok since they are not used after this 02865 * call. 02866 */ 02867 xxxDoScroll((PWND)psbwnd, psbwnd->wnd.spwndParent, 02868 SB_ENDSCROLL, 0, psbwnd->fVert 02869 ); 02870 break; 02871 02872 default: 02873 break; 02874 } 02875 break; 02876 02877 case WM_KEYDOWN: 02878 switch (wParam) { 02879 case VK_HOME: 02880 wParam = SB_TOP; 02881 goto KeyScroll; 02882 02883 case VK_END: 02884 wParam = SB_BOTTOM; 02885 goto KeyScroll; 02886 02887 case VK_PRIOR: 02888 wParam = SB_PAGEUP; 02889 goto KeyScroll; 02890 02891 case VK_NEXT: 02892 wParam = SB_PAGEDOWN; 02893 goto KeyScroll; 02894 02895 case VK_LEFT: 02896 case VK_UP: 02897 wParam = SB_LINEUP; 02898 goto KeyScroll; 02899 02900 case VK_RIGHT: 02901 case VK_DOWN: 02902 wParam = SB_LINEDOWN; 02903 KeyScroll: 02904 02905 /* 02906 * DoScroll does thread locking on these two pwnds - 02907 * this is ok since they are not used after this 02908 * call. 02909 */ 02910 xxxDoScroll((PWND)psbwnd, psbwnd->wnd.spwndParent, (int)wParam, 02911 0, psbwnd->fVert 02912 ); 02913 break; 02914 02915 default: 02916 break; 02917 } 02918 break; 02919 02920 case WM_ENABLE: 02921 return xxxSendMessage((PWND)psbwnd, SBM_ENABLE_ARROWS, 02922 (wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH), 0); 02923 02924 case SBM_ENABLE_ARROWS: 02925 02926 /* 02927 * This is used to enable/disable the arrows in a SB ctrl 02928 */ 02929 return (LONG)xxxEnableSBCtlArrows((PWND)psbwnd, (UINT)wParam); 02930 02931 case SBM_GETPOS: 02932 return (LONG)psbwnd->SBCalc.pos; 02933 02934 case SBM_GETRANGE: 02935 *((LPINT)wParam) = psbwnd->SBCalc.posMin; 02936 *((LPINT)lParam) = psbwnd->SBCalc.posMax; 02937 return MAKELRESULT(LOWORD(psbwnd->SBCalc.posMin), LOWORD(psbwnd->SBCalc.posMax)); 02938 02939 case SBM_GETSCROLLINFO: 02940 return (LONG)_SBGetParms((PWND)psbwnd, SB_CTL, (PSBDATA)&psbwnd->SBCalc, (LPSCROLLINFO) lParam); 02941 02942 case SBM_SETRANGEREDRAW: 02943 fRedraw = TRUE; 02944 02945 case SBM_SETRANGE: 02946 // Save the old values of Min and Max for return value 02947 si.cbSize = sizeof(si); 02948 // si.nMin = LOWORD(lParam); 02949 // si.nMax = HIWORD(lParam); 02950 si.nMin = (int)wParam; 02951 si.nMax = (int)lParam; 02952 si.fMask = SIF_RANGE | SIF_RETURNOLDPOS; 02953 goto SetInfo; 02954 02955 case SBM_SETPOS: 02956 fRedraw = (BOOL) lParam; 02957 si.cbSize = sizeof(si); 02958 si.fMask = SIF_POS | SIF_RETURNOLDPOS; 02959 si.nPos = (int)wParam; 02960 goto SetInfo; 02961 02962 case SBM_SETSCROLLINFO: 02963 lpsi = (LPSCROLLINFO) lParam; 02964 fRedraw = (BOOL) wParam; 02965 SetInfo: 02966 fScroll = TRUE; 02967 02968 if (SBSetParms((PSBDATA)&psbwnd->SBCalc, lpsi, &fScroll, &lres) && FWINABLE()) { 02969 xxxWindowEvent(EVENT_OBJECT_VALUECHANGE, (PWND)psbwnd, OBJID_CLIENT, 02970 INDEX_SCROLLBAR_SELF, WEF_USEPWNDTHREAD); 02971 } 02972 02973 if (!fRedraw) 02974 return lres; 02975 02976 02977 /* 02978 * We must set the new position of the caret irrespective of 02979 * whether the window is visible or not; 02980 * Still, this will work only if the app has done a xxxSetScrollPos 02981 * with fRedraw = TRUE; 02982 * Fix for Bug #5188 --SANKAR-- 10-15-89 02983 * No need to DeferWinEventNotify since psbwnd is locked. 02984 */ 02985 zzzHideCaret((PWND)psbwnd); 02986 SBCtlSetup(psbwnd); 02987 zzzSetSBCaretPos(psbwnd); 02988 02989 /* 02990 ** The following zzzShowCaret() must be done after the DrawThumb2(), 02991 ** otherwise this caret will be erased by DrawThumb2() resulting 02992 ** in this bug: 02993 ** Fix for Bug #9263 --SANKAR-- 02-09-90 02994 * 02995 */ 02996 02997 /* 02998 *********** zzzShowCaret((PWND)psbwnd); ****** 02999 */ 03000 03001 if (_FChildVisible((PWND)psbwnd) && fRedraw) { 03002 UINT wDisable; 03003 HBRUSH hbrUse; 03004 03005 if (!fScroll) 03006 fScroll = !(lpsi->fMask & SIF_DISABLENOSCROLL); 03007 03008 wDisable = (fScroll) ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH; 03009 xxxEnableScrollBar((PWND) psbwnd, SB_CTL, wDisable); 03010 03011 hdc = _GetWindowDC((PWND)psbwnd); 03012 hbrSave = GreSelectBrush(hdc, hbrUse = xxxGetColorObjects((PWND)psbwnd, hdc)); 03013 03014 /* 03015 * Before we used to only hideshowthumb() if the mesage was 03016 * not SBM_SETPOS. I am not sure why but this case was ever 03017 * needed for win 3.x but on NT it resulted in trashing the border 03018 * of the scrollbar when the app called SetScrollPos() during 03019 * scrollbar tracking. - mikehar 8/26 03020 */ 03021 DrawThumb2((PWND)psbwnd, &psbwnd->SBCalc, hdc, hbrUse, psbwnd->fVert, 03022 psbwnd->wDisableFlags); 03023 GreSelectBrush(hdc, hbrSave); 03024 _ReleaseDC(hdc); 03025 } 03026 03027 /* 03028 * This zzzShowCaret() has been moved to this place from above 03029 * Fix for Bug #9263 --SANKAR-- 02-09-90 03030 */ 03031 zzzShowCaret((PWND)psbwnd); 03032 return lres; 03033 03034 default: 03035 DoDefault: 03036 return xxxDefWindowProc((PWND)psbwnd, message, wParam, lParam); 03037 } 03038 03039 return 0L; 03040 }

int xxxScrollWindowEx PWND  pwnd,
int  dx,
int  dy,
LPRECT  prcScroll,
LPRECT  prcClip,
HRGN  hrgnUpdate,
LPRECT  prcUpdate,
DWORD  flags
 

Referenced by NtUserScrollWindowEx(), xxxMNSetTop(), and xxxMNUpdateShownMenu().

BOOL xxxSendEraseBkgnd PWND  pwnd,
HDC  hdcBeginPaint,
HRGN  hrgnUpdate
 

Definition at line 1147 of file paint.c.

References _GetDCEx(), BOOL, CheckLock, FALSE, GETPTI, L, NULL, tagTHREADINFO::ppi, PtiCurrent, ReleaseCacheDC(), SetWF, TestWF, TRUE, WFERASEBKGND, WFMINIMIZED, WFSENDERASEBKGND, WFWIN31COMPAT, and xxxSendMessage().

Referenced by xxxBeginPaint(), and xxxSimpleDoSyncPaint().

01151 { 01152 PTHREADINFO ptiCurrent; 01153 BOOL fErased; 01154 HDC hdc; 01155 01156 CheckLock(pwnd); 01157 01158 /* 01159 * For minimized dudes in win3.1, we would've sent an 01160 * WM_ICONERASEBKGND and cleared the erase bit. Now that min 01161 * windows in 4.0 are all nonclient, don't bother erasing at 01162 * all. Pretend like we did. 01163 * 01164 * NOTE: 01165 * For < 4.0 windows, we may have to send a fake WM_ICONERASEKBGND 01166 * to keep 'em happy. Saves time not to though. Getting a DC and 01167 * sending the message ain't speedy. 01168 */ 01169 if ((hrgnUpdate == NULL) || TestWF(pwnd, WFMINIMIZED)) 01170 return FALSE; 01171 01172 /* 01173 * If a DC to use was not passed in, get one. 01174 * We want one clipped to this window's update region. 01175 */ 01176 if (hdcBeginPaint == NULL) { 01177 01178 hdc = _GetDCEx(pwnd, 01179 hrgnUpdate, 01180 DCX_USESTYLE | DCX_INTERSECTRGN | DCX_NODELETERGN); 01181 } else { 01182 01183 hdc = hdcBeginPaint; 01184 } 01185 01186 /* 01187 * If we're send the WM_ERASEBKGND to another process 01188 * we need to change the DC owner. 01189 * 01190 * We'd like to change the owner to pwnd->pti->idProcess, but 01191 * GDI won't let us assign ownership back to ourselves later. 01192 */ 01193 ptiCurrent = PtiCurrent(); 01194 01195 if (GETPTI(pwnd)->ppi != ptiCurrent->ppi) 01196 GreSetDCOwner(hdc, OBJECT_OWNER_PUBLIC); 01197 01198 /* 01199 * Send the event to the window. This contains the DC clipped to 01200 * the update-region. 01201 */ 01202 fErased = (BOOL)xxxSendMessage(pwnd, WM_ERASEBKGND, (WPARAM)hdc, 0L); 01203 01204 /* 01205 * If we've changed the DC owner, change it back to 01206 * the current process. 01207 */ 01208 if (GETPTI(pwnd)->ppi != ptiCurrent->ppi) 01209 GreSetDCOwner(hdc, OBJECT_OWNER_CURRENT); 01210 01211 /* 01212 * If the WM_ERASEBKGND message did not erase the 01213 * background, then set this flag to let BeginPaint() 01214 * know to ask the caller to do it via the fErase 01215 * flag in the PAINTSTRUCT. 01216 */ 01217 if (!fErased) { 01218 SetWF(pwnd, WFERASEBKGND); 01219 if (!TestWF(pwnd, WFWIN31COMPAT)) 01220 SetWF(pwnd, WFSENDERASEBKGND); 01221 } 01222 01223 /* 01224 * If we got a cache DC in this routine, release it. 01225 */ 01226 if (hdcBeginPaint == NULL) { 01227 ReleaseCacheDC(hdc, TRUE); 01228 } 01229 01230 return fErased; 01231 }

VOID xxxSendFocusMessages PTHREADINFO  pti,
PWND  pwndReceive
 

Definition at line 220 of file focusact.c.

References CheckLock, FALSE, FWINABLE, GETPTI, gpqForeground, HW, HWq, IS_IME_ENABLED, Lock, NULL, tagTHREADINFO::pq, tagQ::QF_flags, QF_FOCUSNULLSINCEACTIVE, SetForegroundThread(), tagQ::spwndActive, tagQ::spwndFocus, TestWF, ThreadLockWithPti, ThreadUnlock, TRUE, WFDESTROYED, xxxFocusSetInputContext(), xxxSendMessage(), and xxxWindowEvent().

Referenced by xxxActivateThisWindow(), and xxxSetFocus().

00223 { 00224 PWND pwndLose; 00225 TL tlpwndLose; 00226 00227 CheckLock(pwndReceive); 00228 00229 /* 00230 * Remember if this app set the focus to NULL on purpose after it was 00231 * activated (needed in ActivateThisWindow()). 00232 */ 00233 pti->pq->QF_flags &= ~QF_FOCUSNULLSINCEACTIVE; 00234 if (pwndReceive == NULL && pti->pq->spwndActive != NULL) 00235 pti->pq->QF_flags |= QF_FOCUSNULLSINCEACTIVE; 00236 00237 pwndLose = pti->pq->spwndFocus; 00238 ThreadLockWithPti(pti, pwndLose, &tlpwndLose); 00239 00240 /* 00241 * We shouldn't be locking a valid pwnd from another queue. 00242 */ 00243 UserAssert((pwndReceive == NULL) 00244 || TestWF(pwndReceive, WFDESTROYED) 00245 || (pti->pq == GETPTI(pwndReceive)->pq)); 00246 Lock(&pti->pq->spwndFocus, pwndReceive); 00247 00248 if (pwndReceive == NULL) { 00249 if (pwndLose != NULL) { 00250 /* 00251 * Tell the client that nobody is gaining focus. 00252 */ 00253 if (FWINABLE()) { 00254 xxxWindowEvent(EVENT_OBJECT_FOCUS, NULL, OBJID_CLIENT, INDEXID_OBJECT, 0); 00255 } 00256 xxxSendMessage(pwndLose, WM_KILLFOCUS, 0, 0); 00257 #ifdef FE_IME 00258 if (IS_IME_ENABLED()) { 00259 xxxFocusSetInputContext(pwndLose, FALSE, FALSE); 00260 } 00261 #endif 00262 } 00263 } else { 00264 00265 /* 00266 * Make this thread foreground so its base 00267 * priority get set higher. 00268 */ 00269 if (pti->pq == gpqForeground) 00270 SetForegroundThread(GETPTI(pwndReceive)); 00271 00272 if (pwndLose != NULL) { 00273 xxxSendMessage(pwndLose, WM_KILLFOCUS, (WPARAM)HWq(pwndReceive), 0); 00274 #ifdef FE_IME 00275 if (IS_IME_ENABLED()) { 00276 xxxFocusSetInputContext(pwndLose, FALSE, FALSE); 00277 } 00278 #endif 00279 } 00280 00281 /* 00282 * Send the WM_SETFOCUS message, but only if the window we're 00283 * setting the focus to still has the focus! This allows apps 00284 * to prevent themselves from losing the focus by catching 00285 * the WM_NCACTIVATE message and returning FALSE or by calling 00286 * SetFocus() inside their WM_KILLFOCUS handler. 00287 */ 00288 if (pwndReceive == pti->pq->spwndFocus) { 00289 #ifdef FE_IME 00290 if (IS_IME_ENABLED()) { 00291 xxxFocusSetInputContext(pwndReceive, TRUE, FALSE); 00292 } 00293 #endif 00294 /* 00295 * We have to do this BEFORE sending the WM_SETFOCUS message. 00296 * The app, upon receiving it, very well may turn around and 00297 * SetFocus() to a child window. 00298 */ 00299 if (FWINABLE()) { 00300 xxxWindowEvent(EVENT_OBJECT_FOCUS, pwndReceive, OBJID_CLIENT, 00301 INDEXID_OBJECT, 0); 00302 } 00303 xxxSendMessage(pwndReceive, WM_SETFOCUS, (WPARAM)HW(pwndLose), 0); 00304 } 00305 } 00306 00307 ThreadUnlock(&tlpwndLose); 00308 }

void xxxSendHelpMessage PWND  pwnd,
int  iType,
int  iCtrlId,
HANDLE  hItemHandle,
DWORD  dwContextId
 

Definition at line 43 of file kernel/help.c.

References _GetMessagePos(), CheckLock, GET_X_LPARAM, GET_Y_LPARAM, and xxxSendMessage().

Referenced by xxxDefWindowProc(), xxxHelpLoop(), and xxxMNKeyDown().

00049 { 00050 HELPINFO HelpInfo; 00051 long lValue; 00052 00053 CheckLock(pwnd); 00054 00055 HelpInfo.cbSize = sizeof(HELPINFO); 00056 HelpInfo.iContextType = iType; 00057 HelpInfo.iCtrlId = iCtrlId; 00058 HelpInfo.hItemHandle = hItemHandle; 00059 HelpInfo.dwContextId = dwContextId; 00060 00061 lValue = _GetMessagePos(); 00062 HelpInfo.MousePos.x = GET_X_LPARAM(lValue); 00063 HelpInfo.MousePos.y = GET_Y_LPARAM(lValue); 00064 00065 xxxSendMessage(pwnd, WM_HELP, 0, (LPARAM)(LPHELPINFO)&HelpInfo); 00066 }

UINT xxxSendInput UINT  nInputs,
LPINPUT  pInputs
 

Definition at line 3575 of file ntinput.c.

References DWORD, LOBYTE, PtiCurrent, UINT, xxxInternalKeyEventDirect(), and xxxMouseEventDirect().

Referenced by NtUserSendInput().

03578 { 03579 UINT nEv; 03580 LPINPUT pEvent; 03581 DWORD dwExpWinVer = PtiCurrent()->dwExpWinVer; 03582 03583 for (nEv = 0, pEvent = pInputs; nEv < nInputs; nEv++) { 03584 03585 switch (pEvent->type) { 03586 case INPUT_MOUSE: 03587 xxxMouseEventDirect( 03588 pEvent->mi.dx, 03589 pEvent->mi.dy, 03590 pEvent->mi.mouseData, 03591 pEvent->mi.dwFlags, 03592 pEvent->mi.time, 03593 pEvent->mi.dwExtraInfo); 03594 break; 03595 03596 case INPUT_KEYBOARD: 03597 if ((pEvent->ki.dwFlags & KEYEVENTF_UNICODE) && 03598 (pEvent->ki.wVk == 0) && 03599 ((pEvent->ki.dwFlags & ~(KEYEVENTF_KEYUP | KEYEVENTF_UNICODE)) == 0)) { 03600 xxxInternalKeyEventDirect( 03601 VK_PACKET, 03602 pEvent->ki.wScan, // actually a Unicode character 03603 pEvent->ki.dwFlags, 03604 pEvent->ki.time, 03605 pEvent->ki.dwExtraInfo); 03606 } else { 03607 xxxInternalKeyEventDirect( 03608 LOBYTE(pEvent->ki.wVk), 03609 LOBYTE(pEvent->ki.wScan), 03610 pEvent->ki.dwFlags, 03611 pEvent->ki.time, 03612 pEvent->ki.dwExtraInfo); 03613 } 03614 break; 03615 03616 case INPUT_HARDWARE: 03617 break; 03618 } 03619 03620 pEvent++; 03621 } 03622 return nInputs; 03623 }

VOID xxxSendMenuSelect PWND  pwndNotify,
PWND  pwndMenu,
PMENU  pMenu,
int  idx
 

Definition at line 29 of file mnsel.c.

References _CallMsgFilter(), CheckLock, tagMENU::cItems, DWORD, tagMENUSTATE::fIsSysMenu, tagITEM::fState, tagITEM::fType, FWINABLE, GetpMenuState(), HW, MF_MAINMENU, MFMWFP_NOITEM, tagMENUSTATE::mnFocus, MOUSEHOLD, msg, NULL, PtoH, tagMENU::rgItems, SMS_NOMENU, tagITEM::spSubMenu, UINT, tagITEM::wID, xxxSendNotifyMessage(), and xxxWindowEvent().

Referenced by xxxMNCancel(), xxxMNCloseHierarchy(), xxxMNDoubleClick(), xxxMNInvertItem(), and xxxMNSelectItem().

00034 { 00035 UINT cmd; // Menu ID if applicable. 00036 UINT flags; // MF_ values if any 00037 MSG msg; 00038 PMENUSTATE pMenuState; 00039 00040 CheckLock(pwndNotify); 00041 CheckLock(pwndMenu); 00042 00043 00044 /* 00045 * We must be hacking or passing valid things. 00046 */ 00047 UserAssert((pMenu != SMS_NOMENU) || (idx == MFMWFP_NOITEM)); 00048 00049 00050 if ((idx >= 0) && (pMenu->cItems > (UINT)idx)) { 00051 PITEM pItem = &(pMenu->rgItems[idx]); 00052 00053 flags = (pItem->fType & MFT_OLDAPI_MASK) | 00054 (pItem->fState & MFS_OLDAPI_MASK); 00055 00056 if (pItem->spSubMenu != NULL) 00057 flags |= MF_POPUP; 00058 00059 flags &= (~(MF_SYSMENU | MF_MOUSESELECT)); 00060 00061 /* 00062 * WARNING! 00063 * Under Windows the menu handle was always returned but additionally 00064 * if the menu was a pop-up the pop-up menu handle was returned 00065 * instead of the ID. In NT we don't have enough space for 2 handles 00066 * and flags so if it is a pop-up we return the pop-up index 00067 * and the main Menu handle. 00068 */ 00069 00070 if (flags & MF_POPUP) 00071 cmd = idx; // index of popup-menu 00072 else 00073 cmd = pItem->wID; 00074 00075 pMenuState = GetpMenuState(pwndNotify); 00076 if (pMenuState != NULL) { 00077 if (pMenuState->mnFocus == MOUSEHOLD) 00078 flags |= MF_MOUSESELECT; 00079 00080 if (pMenuState->fIsSysMenu) 00081 flags |= MF_SYSMENU; 00082 00083 } 00084 } else { 00085 /* 00086 * idx assumed to be MFMWFP_NOITEM 00087 */ 00088 if (pMenu == SMS_NOMENU) { 00089 00090 /* 00091 * Hack so we can send MenuSelect messages with MFMWFP_MAINMENU 00092 * (loword(lparam)=-1) when the menu pops back up for the CBT people. 00093 */ 00094 flags = MF_MAINMENU; 00095 } else { 00096 flags = 0; 00097 } 00098 00099 cmd = 0; // so MAKELONG(cmd, flags) == MFMWFP_MAINMENU 00100 pMenu = 0; 00101 idx = -1; // so that idx+1 == 0, meaning nothing for zzzWindowEvent() 00102 } 00103 00104 /* 00105 * Call msgfilter so help libraries can hook WM_MENUSELECT messages. 00106 */ 00107 msg.hwnd = HW(pwndNotify); 00108 msg.message = WM_MENUSELECT; 00109 msg.wParam = (DWORD)MAKELONG(cmd, flags); 00110 msg.lParam = (LPARAM)PtoH(pMenu); 00111 if (!_CallMsgFilter((LPMSG)&msg, MSGF_MENU)) { 00112 xxxSendNotifyMessage(pwndNotify, WM_MENUSELECT, msg.wParam, msg.lParam); 00113 } 00114 00115 if (FWINABLE() && pwndMenu) { 00116 xxxWindowEvent(EVENT_OBJECT_FOCUS, pwndMenu, 00117 ((pwndMenu != pwndNotify) ? OBJID_CLIENT : ((flags & MF_SYSMENU) ? OBJID_SYSMENU : OBJID_MENU)), 00118 idx+1, 0); 00119 } 00120 }

LRESULT xxxSendMessage PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 688 of file kernel/sendmsg.c.

References NULL, and xxxSendMessageTimeout().

Referenced by xxxActivateApp(), xxxActivateThisWindow(), xxxActiveWindowTracking(), xxxCalcValidRects(), xxxChangeClipboardChain(), xxxCheckImeShowStatus(), xxxClientShutdown2(), xxxCreateWindowEx(), xxxCsEvent(), xxxDeactivate(), xxxDefWindowProc(), xxxDesktopWndProc(), xxxDestroyWindow(), xxxDoScroll(), xxxDoSend(), xxxDragObject(), xxxDrawClipboard(), xxxDW_SendDestroyMessages(), xxxDWP_NCMouse(), xxxDWP_ProcessVirtKey(), xxxDWP_SetCursor(), xxxDWPPrint(), xxxEnableScrollBar(), xxxEnableWindow(), xxxFlashWindow(), xxxFocusSetInputContext(), xxxFreeWindow(), xxxGetControlColor(), xxxGetMenuBarInfo(), xxxGetRenderData(), xxxHandleMenuMessages(), xxxHandleNCMouseGuys(), xxxHandleWindowPosChanged(), xxxImmActivateLayout(), xxxInitSendValidateMinMaxInfo(), xxxInternalActivateKeyboardLayout(), xxxMakeWindowForegroundWithState(), xxxMenuWindowProc(), xxxMetricsRecalc(), xxxMinMaximize(), xxxMNCancel(), xxxMNChar(), xxxMNCloseHierarchy(), xxxMNDestroyHandler(), xxxMNFindWindowFromPoint(), xxxMNGetBitmapSize(), xxxMNHideNextHierarchy(), xxxMNKeyDown(), xxxMNLoop(), xxxMNMouseMove(), xxxMNOpenHierarchy(), xxxMNSelectItem(), xxxMNStartMenu(), xxxMNStartMenuState(), xxxMNUpdateShownMenu(), xxxMouseActivate(), xxxMoveSize(), xxxMS_TrackMove(), xxxProcessEventMessage(), xxxSBWndProc(), xxxScanSysQueue(), xxxScrollWindowEx(), xxxSendChangedMsgs(), xxxSendClipboardMessage(), xxxSendEraseBkgnd(), xxxSendFocusMessages(), xxxSendHelpMessage(), xxxSendMenuDrawItemMessage(), xxxSendMessageToUI(), xxxSendNCPaint(), xxxSendOpenStatusNotify(), xxxSetForegroundWindow2(), xxxSetScrollBar(), xxxSetWindowStyle(), xxxShowOwnedWindows(), xxxShowWindow(), xxxSwitchDesktop(), xxxSwpActivate(), xxxSysCommand(), xxxTA_AccelerateMenu(), xxxTM_MoveDragRect(), xxxTooltipWndProc(), xxxTrackInitSize(), xxxTrackPopupMenuEx(), xxxTranslateAccelerator(), xxxUpdateWindow2(), xxxUserPowerStateCalloutWorker(), and xxxWindowHitTest2().

00693 { 00694 return xxxSendMessageTimeout( pwnd, message, wParam, lParam, 00695 SMTO_NORMAL, 0, NULL ); 00696 }

LONG xxxSendMessageBSM PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
LPBROADCASTSYSTEMMSGPARAMS  pbsmParams
 

Definition at line 466 of file kernel/sendmsg.c.

References EnterCrit, FALSE, gbRemoteSession, grpWinStaList, IoPnPDeliverServicePowerNotification(), LeaveCrit, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, tagWINDOWSTATION::rpwinstaNext, tagDESKTOPINFO::spwnd, ThreadLockDesktop, ThreadLockExchangeDesktop, ThreadLockExchangeWinSta, ThreadLockWinSta, ThreadUnlockDesktop, ThreadUnlockWinSta, TRUE, and xxxSendBSMtoDesktop().

Referenced by xxxUserPowerEventCalloutWorker(), xxxUserPowerStateCalloutWorker(), and xxxWrapSendMessageBSM().

00473 { 00474 PTHREADINFO ptiCurrent = PtiCurrent(); 00475 LONG lRet; 00476 00477 if (pbsmParams->dwRecipients & BSM_ALLDESKTOPS) { 00478 PWINDOWSTATION pwinsta; 00479 PDESKTOP pdesk; 00480 TL tlpwinsta; 00481 TL tlpdesk; 00482 00483 /* 00484 * Walk through all windowstations and desktop looking for 00485 * top-level windows. 00486 */ 00487 ThreadLockWinSta(ptiCurrent, NULL, &tlpwinsta); 00488 ThreadLockDesktop(ptiCurrent, NULL, &tlpdesk, LDLT_FN_SENDMESSAGEBSM); 00489 for (pwinsta = grpWinStaList; pwinsta != NULL; ) { 00490 ThreadLockExchangeWinSta(ptiCurrent, pwinsta, &tlpwinsta); 00491 for (pdesk = pwinsta->rpdeskList; pdesk != NULL; ) { 00492 ThreadLockExchangeDesktop(ptiCurrent, pdesk, &tlpdesk, LDLT_FN_SENDMESSAGEBSM); 00493 00494 lRet = xxxSendBSMtoDesktop(pdesk->pDeskInfo->spwnd, 00495 message, wParam, lParam, pbsmParams); 00496 00497 /* 00498 * If our query was denied, return immediately. 00499 */ 00500 if ((lRet == 0) && (pbsmParams->dwFlags & BSF_QUERY)) { 00501 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_SENDMESSAGEBSM1); 00502 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00503 return 0; 00504 } 00505 pdesk = pdesk->rpdeskNext; 00506 } 00507 pwinsta = pwinsta->rpwinstaNext; 00508 } 00509 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_SENDMESSAGEBSM2); 00510 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00511 00512 /* 00513 * If this is a power broadcast, inform any service that cares. 00514 */ 00515 if (message == WM_POWERBROADCAST && !gbRemoteSession) { 00516 LeaveCrit(); 00517 00518 /* 00519 * If it's a query, deliver it synchronously to pickup the return code 00520 */ 00521 if ((wParam == PBT_APMQUERYSUSPEND) || 00522 (wParam == PBT_APMQUERYSTANDBY)) { 00523 lRet = IoPnPDeliverServicePowerNotification((ULONG)wParam,TRUE); 00524 }else { 00525 lRet = IoPnPDeliverServicePowerNotification((ULONG)wParam,FALSE); 00526 00527 } 00528 EnterCrit(); 00529 } 00530 00531 } else { 00532 lRet = xxxSendBSMtoDesktop(pwnd, message, wParam, lParam, 00533 pbsmParams); 00534 } 00535 00536 return lRet; 00537 }

BOOL xxxSendMessageCallback PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
SENDASYNCPROC  lpResultCallBack,
ULONG_PTR  dwData,
BOOL  bClientReqest
 

Definition at line 1114 of file kernel/sendmsg.c.

References BMSG_SENDMSGCALLBACK, BMSG_SENDNOTIFYMSG, BOOL, CallClientProcA, tagBROADCASTMSG::cb, CheckCritIn, CheckLock, tagINTERSENDMSGEX::dwData, FALSE, tagINTERSENDMSGEX::fuCall, GETPTI, HWq, IsHooked, ISM_CALLBACK, ISM_CB_CLIENT, L, tagWND::lpfnWndProc, tagINTERSENDMSGEX::lpResultCallBack, _CWPRETSTRUCTEX::lResult, NULL, _CWPRETSTRUCTEX::psmsSender, _CWPSTRUCTEX::psmsSender, PtiCurrent, PWND_BROADCAST, TESTSYNCONLYMESSAGE, TestWF, TRUE, UINT, WFSERVERSIDEPROC, WHF_CALLWNDPROC, WHF_CALLWNDPROCRET, xxxBroadcastMessage(), xxxCallHook(), xxxInterSendMsgEx(), and XXXSENDMESSAGETOCLIENT.

Referenced by NtUserSendMessageCallback(), xxxCapture(), xxxFocusSetInputContext(), xxxPaintIconsInSwitchWindow(), and xxxSendNotifyMessage().

01123 : 01124 * 07-13-92 ChrisBl Created/extended from SendNotifyMessage 01125 \***********************************************************************/ 01126 01127 BOOL xxxSendMessageCallback( 01128 PWND pwnd, 01129 UINT message, 01130 WPARAM wParam, 01131 LPARAM lParam, 01132 SENDASYNCPROC lpResultCallBack, 01133 ULONG_PTR dwData, 01134 BOOL fClientRequest) 01135 { 01136 LRESULT lRet; 01137 PTHREADINFO ptiCurrent; 01138 BOOL fQueuedNotify; 01139 01140 /* 01141 * See if this is a queued notify message. 01142 */ 01143 fQueuedNotify = FALSE; 01144 if (lpResultCallBack == NULL && dwData == 1L) 01145 fQueuedNotify = TRUE; 01146 01147 /* 01148 * First check to see if this message takes DWORDs only. If it does not, 01149 * fail the call. Cannot allow an app to post a message with pointers or 01150 * handles in it - this can cause the server to fault and cause other 01151 * problems - such as causing apps in separate address spaces to fault. 01152 * (or even an app in the same address space to fault!) 01153 */ 01154 if (TESTSYNCONLYMESSAGE(message, wParam)) { 01155 RIPERR1(ERROR_MESSAGE_SYNC_ONLY, RIP_WARNING, 01156 "Trying to non-synchronously send a structure msg=%lX", message); 01157 return FALSE; 01158 } 01159 01160 CheckCritIn(); 01161 01162 /* 01163 * Is this a BroadcastMsg()? 01164 */ 01165 if (pwnd == PWND_BROADCAST) { 01166 BROADCASTMSG bcm; 01167 PBROADCASTMSG pbcm = NULL; 01168 UINT uCmd = BMSG_SENDNOTIFYMSG; 01169 01170 if (lpResultCallBack != NULL) { 01171 uCmd = BMSG_SENDMSGCALLBACK; 01172 bcm.cb.lpResultCallBack = lpResultCallBack; 01173 bcm.cb.dwData = dwData; 01174 bcm.cb.bClientRequest = fClientRequest; 01175 pbcm = &bcm; 01176 } 01177 01178 return xxxBroadcastMessage(NULL, message, wParam, lParam, uCmd, pbcm ); 01179 } 01180 01181 CheckLock(pwnd); 01182 01183 ptiCurrent = PtiCurrent(); 01184 01185 /* 01186 * Do inter-thread call if window thead differs from current thread. 01187 * We pass NULL for ptiSender to tell xxxInterSendMsgEx() that this is 01188 * a xxxSendNotifyMessage() and that there's no need for a reply. 01189 * 01190 * If this is a queued notify, always call InterSendMsgEx() so that 01191 * we queue it up and return - we don't do callbacks here with queued 01192 * notifies. 01193 */ 01194 if (fQueuedNotify || ptiCurrent != GETPTI(pwnd)) { 01195 INTRSENDMSGEX ism; 01196 PINTRSENDMSGEX pism = NULL; 01197 01198 if (lpResultCallBack != NULL) { /* CallBack request */ 01199 ism.fuCall = ISM_CALLBACK | (fClientRequest ? ISM_CB_CLIENT : 0); 01200 ism.lpResultCallBack = lpResultCallBack; 01201 ism.dwData = dwData; 01202 pism = &ism; 01203 } 01204 return (BOOL)xxxInterSendMsgEx(pwnd, message, wParam, lParam, 01205 NULL, GETPTI(pwnd), pism ); 01206 } 01207 01208 /* 01209 * Call WH_CALLWNDPROC if it's installed. 01210 */ 01211 if (!fQueuedNotify && IsHooked(ptiCurrent, WHF_CALLWNDPROC)) { 01212 CWPSTRUCTEX cwps; 01213 01214 cwps.hwnd = HWq(pwnd); 01215 cwps.message = message; 01216 cwps.wParam = wParam; 01217 cwps.lParam = lParam; 01218 cwps.psmsSender = NULL; 01219 01220 /* 01221 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 01222 * to the CWPSTRUCT contents. 01223 */ 01224 xxxCallHook(HC_ACTION, FALSE, (LPARAM)&cwps, WH_CALLWNDPROC); 01225 01226 /* 01227 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 01228 * to the CWPSTRUCT contents. If this behavior reverts to 01229 * Win3.1 semantics, we will need to copy the new parameters 01230 * from cwps. 01231 */ 01232 } 01233 01234 /* 01235 * If this window's proc is meant to be executed from the server side 01236 * we'll just stay inside the semaphore and call it directly. Note 01237 * how we don't convert the pwnd into an hwnd before calling the proc. 01238 */ 01239 if (TestWF(pwnd, WFSERVERSIDEPROC)) { 01240 lRet = pwnd->lpfnWndProc(pwnd, message, wParam, lParam); 01241 } else { 01242 /* 01243 * Call the client or xxxDefWindowProc. pwnd is already locked 01244 */ 01245 XXXSENDMESSAGETOCLIENT(pwnd, message, wParam, lParam, NULL, FALSE); 01246 } 01247 01248 if (lpResultCallBack != NULL) { 01249 /* 01250 * Call the callback funtion for the return value 01251 */ 01252 if (fClientRequest) { 01253 /* 01254 * The application-defined callback proc is neither Unicode/ANSI 01255 */ 01256 CallClientProcA(pwnd, message, dwData, lRet, 01257 (ULONG_PTR)lpResultCallBack); 01258 } else { 01259 (*lpResultCallBack)((HWND)pwnd, message, dwData, lRet); 01260 } 01261 } 01262 01263 /* 01264 * Call WH_CALLWNDPROCRET if it's installed. 01265 */ 01266 if (!fQueuedNotify && IsHooked(ptiCurrent, WHF_CALLWNDPROCRET)) { 01267 CWPRETSTRUCTEX cwps; 01268 01269 cwps.hwnd = HWq(pwnd); 01270 cwps.message = message; 01271 cwps.wParam = wParam; 01272 cwps.lParam = lParam; 01273 cwps.lResult = lRet; 01274 cwps.psmsSender = NULL; 01275 01276 /* 01277 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 01278 * to the CWPSTRUCT contents. */

LRESULT xxxSendMessageEx PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 609 of file kernel/sendmsg.c.

References FALSE, tagSNDMSGTIMEOUT::fuFlags, L, tagSNDMSGTIMEOUT::lSMTOResult, tagSNDMSGTIMEOUT::lSMTOReturn, NT_SUCCESS, NTSTATUS(), NULL, ProbeForWrite(), PsGetCurrentThread, SNDMSGTIMEOUT, Status, tagSNDMSGTIMEOUT::uTimeout, and xxxSendMessageTimeout().

Referenced by InitFunctionTables(), and xxxSendMessageFF().

00615 { 00616 /* 00617 * extract values from the xParam if from TimeOut call 00618 * This should be the only way this function is ever 00619 * called, but check it just in case... 00620 */ 00621 if (xParam != 0L) { 00622 LRESULT lRet; 00623 LRESULT lResult; 00624 NTSTATUS Status; 00625 SNDMSGTIMEOUT smto; 00626 PETHREAD Thread = PsGetCurrentThread(); 00627 00628 if (Thread == NULL) 00629 return FALSE; 00630 00631 /* 00632 * Probe all read arguments 00633 */ 00634 try { 00635 ProbeForWrite((PVOID)xParam, sizeof(smto), sizeof(ULONG)); 00636 smto = *(SNDMSGTIMEOUT *)xParam; 00637 Status = STATUS_SUCCESS; 00638 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00639 Status = GetExceptionCode(); 00640 } 00641 if ( !NT_SUCCESS(Status) ) { 00642 return FALSE; 00643 } 00644 00645 lRet = xxxSendMessageTimeout(pwnd, message, wParam, lParam, 00646 smto.fuFlags, smto.uTimeout, &lResult ); 00647 00648 /* 00649 * put the result back into the client 00650 */ 00651 smto.lSMTOResult = lResult; 00652 smto.lSMTOReturn = lRet; 00653 00654 try { 00655 *(SNDMSGTIMEOUT *)xParam = smto; 00656 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 00657 lResult = FALSE; 00658 } 00659 00660 /* 00661 * Return the lResult so our thunks are happy. 00662 */ 00663 return lResult; 00664 } 00665 00666 return xxxSendMessageTimeout(pwnd, message, wParam, 00667 lParam, SMTO_NORMAL, 0, NULL ); 00668 }

LRESULT xxxSendMessageFF PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
ULONG_PTR  xParam
 

Definition at line 556 of file kernel/sendmsg.c.

References L, NULL, PWND_BROADCAST, xxxSendMessageEx(), and xxxSendMessageTimeout().

Referenced by InitFunctionTables().

00562 { 00563 DBG_UNREFERENCED_PARAMETER(pwnd); 00564 00565 /* 00566 * Call xxxSendMessage() to do broadcasting rather than calling 00567 * broadcast from here in case any internal code that calls 00568 * sendmessage passes a -1 (that way the internal code doesn't 00569 * need to know about this weird routine). 00570 */ 00571 if (xParam != 0L) { 00572 /* 00573 * SendMessageTimeout call 00574 */ 00575 return xxxSendMessageEx(PWND_BROADCAST, message, wParam, lParam, xParam); 00576 } else { 00577 /* 00578 * Normal SendMessage call 00579 */ 00580 return xxxSendMessageTimeout(PWND_BROADCAST, message, wParam, 00581 lParam, SMTO_NORMAL, 0, NULL ); 00582 } 00583 }

LRESULT xxxSendMessageTimeout PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
UINT  fuFlags,
UINT  uTimeout,
PLONG_PTR  lpdwResult
 

Definition at line 764 of file kernel/sendmsg.c.

References BMSG_SENDMSG, BMSG_SENDMSGTIMEOUT, BROADCASTMSG, CheckCritIn, CheckLock, CMSWAITTOKILLTIMEOUT, CWPRETSTRUCTEX, CWPSTRUCTEX, FALSE, FHungApp(), tagINTERSENDMSGEX::fuCall, tagINTERSENDMSGEX::fuSend, GETPTI, guDdeSendTimeout, HMIsMarkDestroy, HWq, IsHooked, ISM_TIMEOUT, KeGetCurrentThread, KERNEL_STACK_MINIMUM_RESERVE, L, tagINTERSENDMSGEX::lpdwResult, tagWND::lpfnWndProc, _CWPRETSTRUCTEX::lResult, NULL, PBROADCASTMSG, PINTRSENDMSGEX, _CWPRETSTRUCTEX::psmsSender, _CWPSTRUCTEX::psmsSender, PtiCurrent, PWND_BROADCAST, TestWF, tagBROADCASTMSG::to, TRUE, UINT, tagINTERSENDMSGEX::uTimeout, WFSERVERSIDEPROC, WHF_CALLWNDPROC, WHF_CALLWNDPROCRET, xxxBroadcastMessage(), xxxCallHook(), xxxDDETrackSendHook(), xxxDefWindowProc(), xxxInterSendMsgEx(), and XXXSENDMESSAGETOCLIENT.

Referenced by DrawSwitchWndHilite(), xxxGetWindowSmIcon(), xxxImmUnloadLayout(), xxxNextWindow(), xxxQueryDropObject(), xxxSendBSMtoDesktop(), xxxSendClipboardMessage(), xxxSendMessage(), xxxSendMessageEx(), xxxSendMessageFF(), xxxSendMinRectMessages(), xxxSystemParametersInfo(), and xxxWrapSendMessage().

00770 : 00771 * the value returned by the window procedure, or NULL if there is an error 00772 * 00773 * History: 00774 * 07-13-92 ChrisBl Created/extended from SendMessage 00775 \***********************************************************************/ 00776 00777 LRESULT xxxSendMessageTimeout( 00778 PWND pwnd, 00779 UINT message, 00780 WPARAM wParam, 00781 LPARAM lParam, 00782 UINT fuFlags, 00783 UINT uTimeout, 00784 PLONG_PTR lpdwResult) 00785 { 00786 LRESULT lRet; 00787 PTHREADINFO ptiCurrent; 00788 ULONG_PTR uResult; // holder for DDE_INITIATE case 00789 00790 CheckCritIn(); 00791 00792 if (lpdwResult != NULL) 00793 *lpdwResult = 0L; 00794 00795 /* 00796 * Is this a BroadcastMsg()? 00797 */ 00798 if (pwnd == PWND_BROADCAST) { 00799 BROADCASTMSG bcm; 00800 PBROADCASTMSG pbcm = NULL; 00801 UINT uCmd = BMSG_SENDMSG; 00802 00803 if (lpdwResult != NULL) { 00804 uCmd = BMSG_SENDMSGTIMEOUT; 00805 bcm.to.fuFlags = fuFlags; 00806 bcm.to.uTimeout = uTimeout; 00807 bcm.to.lpdwResult = lpdwResult; 00808 pbcm = &bcm; 00809 } 00810 00811 return xxxBroadcastMessage(NULL, message, wParam, lParam, uCmd, pbcm ); 00812 } 00813 00814 CheckLock(pwnd); 00815 00816 if (message >= WM_DDE_FIRST && message <= WM_DDE_LAST) { 00817 /* 00818 * Even though apps should only send WM_DDE_INITIATE or WM_DDE_ACK 00819 * messages, we hook them all so DDESPY can monitor them. 00820 */ 00821 if (!xxxDDETrackSendHook(pwnd, message, wParam, lParam)) { 00822 return 0; 00823 } 00824 if (message == WM_DDE_INITIATE && guDdeSendTimeout) { 00825 /* 00826 * This hack prevents DDE apps from locking up because some 00827 * bozo in the system has a top level window and is not 00828 * processing messages. guDdeSendTimeout is registry set. 00829 */ 00830 if (lpdwResult == NULL) { 00831 lpdwResult = &uResult; 00832 } 00833 fuFlags |= SMTO_ABORTIFHUNG; 00834 uTimeout = guDdeSendTimeout; 00835 } 00836 } 00837 00838 ptiCurrent = PtiCurrent(); 00839 00840 /* 00841 * Do inter-thread call if window queue differs from current queue 00842 */ 00843 if (ptiCurrent != GETPTI(pwnd)) { 00844 INTRSENDMSGEX ism; 00845 PINTRSENDMSGEX pism = NULL; 00846 00847 /* 00848 * If this window is a zombie, don't allow inter-thread send messages 00849 * to it. 00850 */ 00851 if (HMIsMarkDestroy(pwnd)) 00852 return xxxDefWindowProc(pwnd, message, wParam, lParam); 00853 00854 if ( lpdwResult != NULL ) { 00855 /* 00856 * fail if we think the thread is hung 00857 */ 00858 if ((fuFlags & SMTO_ABORTIFHUNG) && FHungApp(GETPTI(pwnd), CMSWAITTOKILLTIMEOUT)) 00859 return 0; 00860 00861 /* 00862 * Setup for a InterSend time-out call 00863 */ 00864 ism.fuCall = ISM_TIMEOUT; 00865 ism.fuSend = fuFlags; 00866 ism.uTimeout = uTimeout; 00867 ism.lpdwResult = lpdwResult; 00868 pism = &ism; 00869 } 00870 00871 lRet = xxxInterSendMsgEx(pwnd, message, wParam, lParam, 00872 ptiCurrent, GETPTI(pwnd), pism ); 00873 00874 return lRet; 00875 } 00876 00877 /* 00878 * Call WH_CALLWNDPROC if it's installed and the window is not marked 00879 * as destroyed. 00880 */ 00881 if (IsHooked(ptiCurrent, WHF_CALLWNDPROC)) { 00882 CWPSTRUCTEX cwps; 00883 00884 cwps.hwnd = HWq(pwnd); 00885 cwps.message = message; 00886 cwps.wParam = wParam; 00887 cwps.lParam = lParam; 00888 cwps.psmsSender = NULL; 00889 00890 /* 00891 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 00892 * to the CWPSTRUCT contents. 00893 */ 00894 xxxCallHook(HC_ACTION, FALSE, (LPARAM)&cwps, WH_CALLWNDPROC); 00895 00896 /* 00897 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 00898 * to the CWPSTRUCT contents. If this behavior reverts to 00899 * Win3.1 semantics, we will need to copy the new parameters 00900 * from cwps. 00901 */ 00902 } 00903 00904 /* 00905 * If this window's proc is meant to be executed from the server side 00906 * we'll just stay inside the semaphore and call it directly. Note 00907 * how we don't convert the pwnd into an hwnd before calling the proc. 00908 */ 00909 if (TestWF(pwnd, WFSERVERSIDEPROC)) { 00910 00911 /* 00912 * We have a number of places where we do recursion in User. This often goes 00913 * through SendMessage (when we send a message to the parent for example) which 00914 * can eat the amount of stack we have 00915 */ 00916 if (((ULONG_PTR)&uResult - (ULONG_PTR)KeGetCurrentThread()->StackLimit) < KERNEL_STACK_MINIMUM_RESERVE) { 00917 RIPMSG1(RIP_ERROR, "SendMessage: Thread recursing in User with message %lX; failing", message); 00918 return FALSE; 00919 } 00920 00921 lRet = pwnd->lpfnWndProc(pwnd, message, wParam, lParam); 00922 00923 if ( lpdwResult == NULL ) { 00924 return lRet; 00925 } else { /* time-out call */ 00926 *lpdwResult = lRet; 00927 return TRUE; 00928 } 00929 } 00930 00931 /* 00932 * Call the client or xxxDefWindowProc. pwnd is already locked. 00933 */ 00934 XXXSENDMESSAGETOCLIENT(pwnd, message, wParam, lParam, NULL, FALSE); 00935 00936 /* 00937 * Call WH_CALLWNDPROCRET if it's installed. 00938 */ 00939 if (IsHooked(ptiCurrent, WHF_CALLWNDPROCRET)) { 00940 CWPRETSTRUCTEX cwps; 00941 00942 cwps.hwnd = HWq(pwnd); 00943 cwps.message = message; 00944 cwps.wParam = wParam; 00945 cwps.lParam = lParam; 00946 cwps.lResult = lRet; 00947 cwps.psmsSender = NULL; 00948 00949 /* 00950 * Unlike Win3.1, NT and Win95 ignore any changes the app makes 00951 * to the CWPSTRUCT contents. 00952 */ 00953 xxxCallHook(HC_ACTION, FALSE, (LPARAM)&cwps, WH_CALLWNDPROCRET); 00954 00955 /* 00956 * Unlike Win3.1, NT and Win95 ignore any changes the app makes * to the CWPSTRUCT contents. If this behavior reverts to

BOOL xxxSendMinRectMessages PWND  pwnd,
RECT *  lpRect
 

Definition at line 3675 of file rare.c.

References BOOL, DWORD, FALSE, GETDESKINFO, HW, IsHooked, NULL, PtiCurrent, tagDESKTOPINFO::pvwplShellHook, ThreadLock, ThreadUnlock, TRUE, VWPLNext(), WHF_SHELL, xxxCallHook(), and xxxSendMessageTimeout().

Referenced by xxxDefWindowProc(), xxxMinimizeHungWindow(), xxxMinMaximize(), and xxxMNPositionHierarchy().

03675 { 03676 BOOL fRet = FALSE; 03677 HWND hwnd = HW(pwnd); 03678 PTHREADINFO pti = PtiCurrent(); 03679 PDESKTOPINFO pdeskinfo; 03680 DWORD nPwndShellHook; 03681 PWND pwndShellHook; 03682 03683 if (IsHooked(pti, WHF_SHELL)) { 03684 xxxCallHook(HSHELL_GETMINRECT, (WPARAM)hwnd, 03685 (LPARAM)lpRect, WH_SHELL); 03686 fRet = TRUE; 03687 } 03688 03689 pdeskinfo = GETDESKINFO(pti); 03690 if (pdeskinfo->pvwplShellHook == NULL) 03691 return fRet; 03692 03693 nPwndShellHook = 0; 03694 pwndShellHook = NULL; 03695 while (pwndShellHook = VWPLNext(pdeskinfo->pvwplShellHook, pwndShellHook, &nPwndShellHook)) { 03696 TL tlpwnd; 03697 ULONG_PTR dwRes; 03698 03699 ThreadLock(pwndShellHook, &tlpwnd); 03700 if (xxxSendMessageTimeout(pwndShellHook, WM_KLUDGEMINRECT, (WPARAM)(hwnd), (LPARAM)lpRect, 03701 SMTO_NORMAL, 100, &dwRes)) 03702 fRet = TRUE; 03703 03704 /* 03705 * pdeskinfo->pvwplShellHook may have been realloced to a different 03706 * location and size during the WM_KLUDGEMINRECT callback. 03707 */ 03708 ThreadUnlock(&tlpwnd); 03709 } 03710 return fRet; 03711 }

BOOL xxxSendNotifyMessage PWND  pwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam
 

Definition at line 1069 of file kernel/sendmsg.c.

References BMSG_SENDNOTIFYMSG, BOOL, L, NULL, PWND_BROADCAST, xxxSendMessageCallback(), and xxxSystemBroadcastMessage().

Referenced by FullScreenCleanup(), NtUserSendNotifyMessage(), xxxActivateThisWindow(), xxxBroadcastPaletteChanged(), xxxDesktopWndProc(), xxxDrawClipboard(), xxxMNLoop(), xxxNextWindow(), xxxOldNextWindow(), xxxSendBSMtoDesktop(), xxxSendClipboardMessage(), xxxSendMenuSelect(), xxxSetDeskPattern(), xxxSetDeskWallpaper(), and xxxSetSysColors().

01077 : 01078 * 01-23-91 DavidPe Created. 01079 * 07-14-92 ChrisBl Will return T/F if in same thread, as documented 01080 \***********************************************************************/ 01081 01082 BOOL xxxSendNotifyMessage( 01083 PWND pwnd, 01084 UINT message, 01085 WPARAM wParam, 01086 LPARAM lParam) 01087 { 01088 /* 01089 * If this is a broadcast of one of the system 01090 * notification messages, send it to all top-level 01091 * windows in the system. 01092 */ 01093 if (pwnd == PWND_BROADCAST) { 01094 switch (message) { 01095 case WM_WININICHANGE: 01096 case WM_DEVMODECHANGE: case WM_SPOOLERSTATUS:

VOID xxxSendSizeMessage PWND  pwnd,
UINT  cmdSize
 

Definition at line 2861 of file kernel/sendmsg.c.

Referenced by xxxCreateWindowEx(), xxxHandleWindowPosChanged(), and xxxShowWindow().

02870 : 02871 * 10-19-90 darrinm Ported from Win 3.0 sources. 02872 \***************************************************************************/ 02873 02874 void xxxSendSizeMessage( 02875 PWND pwnd, 02876 UINT cmdSize) 02877 { 02878 RECT rc; CheckLock(pwnd);

PWND xxxSetActiveWindow PWND  pwnd  ) 
 

Definition at line 1990 of file focusact.c.

References AW_USE, CheckLock, GETPTI, HW, NULL, tagTHREADINFO::pq, PtiCurrent, RevalidateHwnd, tagQ::spwndActive, TIF_16BIT, tagTHREADINFO::TIF_flags, and xxxActivateWindow().

Referenced by NtUserSetActiveWindow(), and xxxDWP_SetCursor().

01992 { 01993 HWND hwndActiveOld; 01994 PTHREADINFO pti; 01995 01996 CheckLock(pwnd); 01997 01998 pti = PtiCurrent(); 01999 02000 /* 02001 * 32 bit apps must call SetForegroundWindow (to be NT 3.1 compatible) 02002 * but 16 bit apps that are foreground can make other apps foreground. 02003 * xxxActivateWindow makes sure an app is foreground. 02004 */ 02005 if (!(pti->TIF_flags & TIF_16BIT) && (pwnd != NULL) && (GETPTI(pwnd)->pq != pti->pq)) { 02006 return NULL; 02007 } 02008 02009 hwndActiveOld = HW(pti->pq->spwndActive); 02010 02011 xxxActivateWindow(pwnd, AW_USE); 02012 02013 return RevalidateHwnd(hwndActiveOld); 02014 }

PWND xxxSetCapture PWND  pwnd  ) 
 

Definition at line 23 of file w32/ntuser/kernel/capture.c.

References CLIENT_CAPTURE, GETPTI, gspwndScreenCapture, HW, NULL, PtiCurrent, QF_CAPTURELOCKED, tagQ::QF_flags, RevalidateHwnd, tagQ::spwndCapture, and xxxCapture().

Referenced by NtUserSetCapture(), xxxDefWindowProc(), xxxDragObject(), xxxIsDragging(), and xxxTrackCaptionButton().

00025 { 00026 PQ pq; 00027 PWND pwndCaptureOld; 00028 HWND hwndCaptureOld; 00029 PTHREADINFO ptiCurrent = PtiCurrent(); 00030 00031 pq = (PQ)PtiCurrent()->pq; 00032 00033 /* 00034 * If the capture is locked, bail 00035 */ 00036 if (pq->QF_flags & QF_CAPTURELOCKED) { 00037 RIPMSG2(RIP_WARNING, "xxxSetCapture(%#p): Capture is locked. pq:%#p", pwnd, pq); 00038 return NULL; 00039 } 00040 00041 /* 00042 * Don't allow the app to set capture to a window 00043 * from another queue. 00044 */ 00045 if ((pwnd != NULL) && GETPTI(pwnd)->pq != pq) 00046 return NULL; 00047 00048 /* 00049 * If full screen capture don't allow any other capture 00050 */ 00051 if (gspwndScreenCapture) 00052 return NULL; 00053 00054 pwndCaptureOld = pq->spwndCapture; 00055 hwndCaptureOld = HW(pwndCaptureOld); 00056 00057 xxxCapture(ptiCurrent, pwnd, CLIENT_CAPTURE); 00058 00059 if (hwndCaptureOld != NULL) { 00060 00061 if (RevalidateHwnd(hwndCaptureOld)) 00062 return pwndCaptureOld; 00063 } 00064 00065 return NULL; 00066 }

ULONG_PTR xxxSetClassData PWND  pwnd,
int  index,
ULONG_PTR  dwData,
BOOL  bAnsi
 

Definition at line 1399 of file class.c.

References afClassDWord, aiClassOffset, AllocateUnicodeString(), BYTE, CheckLock, CPD_ANSI_TO_UNICODE, CPD_CLASS, CPD_UNICODE_TO_ANSI, CSF_ANSIPROC, tagCLS::CSF_flags, CSF_SERVERSIDEPROC, CSF_WOWCLASS, CSF_WOWEXTRA, DWORD, FALSE, GetCPD(), HMValidateHandleNoRip(), INDEX_OFFSET, IS_PTR, ISCPDTAG, tagCLS::lpszClientAnsiMenuName, tagCLS::lpszClientUnicodeMenuName, MapClientNeuterToClientPfn(), MapClientToServerPfn(), MapServerToClientPfn(), NULL, tagWND::pcls, tagCLS::pclsBase, tagCLS::pclsClone, tagCLS::pclsNext, _CALLPROCDATA::pfnClientPrevious, tagCLSMENUNAME::pszClientAnsiMenuName, tagCLSMENUNAME::pusMenuName, PWCFromPCLS, tagCLSMENUNAME::pwszClientUnicodeMenuName, RtlInitUnicodeString(), SetClassCursor(), TRUE, TYPE_CALLPROC, WNDPROC_PWND, and xxxClientWOWGetProcModule().

Referenced by xxxSetClassLongPtr().

01404 { 01405 PCLS pcls = pwnd->pcls; 01406 BYTE *pb; 01407 ULONG_PTR dwT; 01408 ULONG_PTR dwOld; 01409 DWORD dwCPDType = 0; 01410 PCLSMENUNAME pcmn; 01411 UNICODE_STRING strMenuName, UString; 01412 01413 CheckLock(pwnd); 01414 01415 switch(index) { 01416 case GCLP_WNDPROC: 01417 01418 /* 01419 * If the application (client) subclasses a class that has a server - 01420 * side window proc we must return a client side proc stub that it 01421 * can call. 01422 */ 01423 if (pcls->CSF_flags & CSF_SERVERSIDEPROC) { 01424 dwOld = MapServerToClientPfn((ULONG_PTR)pcls->lpfnWndProc, bAnsi); 01425 pcls->CSF_flags &= ~CSF_SERVERSIDEPROC; 01426 01427 UserAssert(!(pcls->CSF_flags & CSF_ANSIPROC)); 01428 if (bAnsi) { 01429 pcls->CSF_flags |= CSF_ANSIPROC; 01430 } 01431 } else { 01432 dwOld = MapClientNeuterToClientPfn(pcls, 0, bAnsi); 01433 01434 /* 01435 * If the client mapping didn't change the window proc then see if 01436 * we need a callproc handle. 01437 */ 01438 if (dwOld == (ULONG_PTR)pcls->lpfnWndProc) { 01439 /* 01440 * Need to return a CallProc handle if there is an Ansi/Unicode mismatch 01441 */ 01442 if (bAnsi != !!(pcls->CSF_flags & CSF_ANSIPROC)) { 01443 dwCPDType |= bAnsi ? CPD_ANSI_TO_UNICODE : CPD_UNICODE_TO_ANSI; 01444 } 01445 } 01446 } 01447 01448 if (dwCPDType) { 01449 ULONG_PTR dwCPD; 01450 01451 dwCPD = GetCPD(pcls, dwCPDType | CPD_CLASS, dwOld); 01452 01453 if (dwCPD) { 01454 dwOld = dwCPD; 01455 } else { 01456 RIPMSG0(RIP_WARNING, "GetClassLong unable to alloc CPD returning handle\n"); 01457 } 01458 } 01459 01460 /* 01461 * Convert a possible CallProc Handle into a real address. They may 01462 * have kept the CallProc Handle from some previous mixed GetClassinfo 01463 * or SetWindowLong. 01464 */ 01465 if (ISCPDTAG(dwData)) { 01466 PCALLPROCDATA pCPD; 01467 if (pCPD = HMValidateHandleNoRip((HANDLE)dwData, TYPE_CALLPROC)) { 01468 dwData = pCPD->pfnClientPrevious; 01469 } 01470 } 01471 01472 /* 01473 * If an app 'unsubclasses' a server-side window proc we need to 01474 * restore everything so SendMessage and friends know that it's 01475 * a server-side proc again. Need to check against client side 01476 * stub addresses. 01477 */ 01478 pcls->lpfnWndProc = (WNDPROC_PWND)dwData; 01479 if ((dwT = MapClientToServerPfn(dwData)) != 0) { 01480 pcls->lpfnWndProc = (WNDPROC_PWND)dwT; 01481 pcls->CSF_flags |= CSF_SERVERSIDEPROC; 01482 pcls->CSF_flags &= ~CSF_ANSIPROC; 01483 } else { 01484 if (bAnsi) { 01485 pcls->CSF_flags |= CSF_ANSIPROC; 01486 } else { 01487 pcls->CSF_flags &= ~CSF_ANSIPROC; 01488 } 01489 } 01490 if (pcls->CSF_flags & CSF_WOWCLASS) { 01491 PWC pwc = PWCFromPCLS(pcls); 01492 pwc->hMod16 = (pcls->CSF_flags & CSF_SERVERSIDEPROC) ? 0:xxxClientWOWGetProcModule(pcls->lpfnWndProc); 01493 } 01494 01495 return dwOld; 01496 break; 01497 01498 case GCLP_HICON: 01499 case GCLP_HICONSM: 01500 case GCLP_HCURSOR: 01501 return SetClassCursor(pwnd, pcls, index, dwData); 01502 break; 01503 01504 01505 case GCL_WOWMENUNAME: 01506 if (pcls->CSF_flags & CSF_WOWCLASS) { 01507 PWCFromPCLS(pcls)->vpszMenu = (DWORD)dwData; 01508 } else { 01509 UserAssert(FALSE); 01510 } 01511 break; 01512 01513 case GCL_CBCLSEXTRA: 01514 if (pcls->CSF_flags & CSF_WOWCLASS) { 01515 /* 01516 * yes -- we can do this for WOW classes only. 01517 */ 01518 if (pcls->CSF_flags & CSF_WOWEXTRA) { 01519 dwOld = PWCFromPCLS(pcls)->iClsExtra; 01520 PWCFromPCLS(pcls)->iClsExtra = LOWORD(dwData); 01521 return dwOld; 01522 } else { 01523 PWCFromPCLS(pcls)->iClsExtra = LOWORD(dwData); 01524 pcls->CSF_flags |= CSF_WOWEXTRA; 01525 return pcls->cbclsExtra; 01526 } 01527 } 01528 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Attempt to change cbClsExtra\n"); 01529 break; 01530 01531 case GCLP_MENUNAME: 01532 pcmn = (PCLSMENUNAME) dwData; 01533 01534 /* 01535 * pcmn->pusMenuName->Buffer is a client-side address. 01536 */ 01537 01538 dwOld = (ULONG_PTR) pcls->lpszMenuName; 01539 /* Is it a string? */ 01540 if (IS_PTR(pcmn->pusMenuName->Buffer)) { 01541 try { 01542 RtlInitUnicodeString(&UString, pcmn->pusMenuName->Buffer); 01543 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 01544 break; 01545 } 01546 /* Empty String? */ 01547 if (UString.Length == 0) { 01548 pcls->lpszMenuName = NULL; 01549 } else { 01550 /* Make a copy of the string */ 01551 if (!AllocateUnicodeString(&strMenuName, &UString)) { 01552 RIPMSG0(RIP_WARNING, "xxxSetClassData: GCL_MENUNAME AllocateUnicodeString failed\n"); 01553 break; 01554 } 01555 01556 pcls->lpszMenuName = strMenuName.Buffer; 01557 } 01558 } else { 01559 /* Just copy the id */ 01560 pcls->lpszMenuName = pcmn->pusMenuName->Buffer; 01561 } 01562 /* Don't return the kernel side pointer */ 01563 pcmn->pusMenuName = NULL; 01564 01565 /* Free old string, if any */ 01566 if (IS_PTR(dwOld)) { 01567 UserFreePool((PVOID)dwOld); 01568 } 01569 01570 /* Return client side pointers */ 01571 dwOld = (ULONG_PTR) pcls->lpszClientAnsiMenuName; 01572 pcls->lpszClientAnsiMenuName = pcmn->pszClientAnsiMenuName; 01573 pcmn->pszClientAnsiMenuName = (LPSTR)dwOld; 01574 01575 dwOld = (ULONG_PTR) pcls->lpszClientUnicodeMenuName; 01576 pcls->lpszClientUnicodeMenuName = pcmn->pwszClientUnicodeMenuName; 01577 pcmn->pwszClientUnicodeMenuName = (LPWSTR)dwOld; 01578 01579 return (bAnsi ? (ULONG_PTR) pcmn->pszClientAnsiMenuName : (ULONG_PTR) pcmn->pwszClientUnicodeMenuName); 01580 01581 default: 01582 /* 01583 * All other indexes go here... 01584 */ 01585 index -= INDEX_OFFSET; 01586 01587 /* 01588 * Only let valid indices go through; if aiClassOffset is zero 01589 * then we have no mapping for this negative index so it must 01590 * be a bogus index 01591 */ 01592 if ((index < 0) || (aiClassOffset[index] == 0)) { 01593 RIPERR0(ERROR_INVALID_INDEX, RIP_WARNING, "GetClassLong: invalid index"); 01594 return 0; 01595 } 01596 01597 pcls = pcls->pclsBase; 01598 pb = ((BYTE *)pcls) + aiClassOffset[index]; 01599 01600 if (afClassDWord[index] == sizeof(DWORD)) { 01601 dwOld = *(DWORD *)pb; 01602 *(DWORD *)pb = (DWORD)dwData; 01603 } else if (afClassDWord[index] == sizeof(ULONG_PTR)) { 01604 dwOld = *(ULONG_PTR *)pb; 01605 *(ULONG_PTR *)pb = dwData; 01606 } else { 01607 dwOld = (DWORD)*(WORD *)pb; 01608 *(WORD *)pb = (WORD)dwData; 01609 } 01610 01611 pcls = pcls->pclsClone; 01612 while (pcls != NULL) { 01613 pb = ((BYTE *)pcls) + aiClassOffset[index]; 01614 01615 if (afClassDWord[index] == sizeof(DWORD)) { 01616 dwOld = *(DWORD *)pb; 01617 *(DWORD *)pb = (DWORD)dwData; 01618 } else if (afClassDWord[index] == sizeof(ULONG_PTR)) { 01619 dwOld = *(ULONG_PTR *)pb; 01620 *(ULONG_PTR *)pb = dwData; 01621 } else { 01622 dwOld = (DWORD)*(WORD *)pb; 01623 *(WORD *)pb = (WORD)dwData; 01624 } 01625 pcls = pcls->pclsNext; 01626 } 01627 01628 return dwOld; 01629 } 01630 01631 return 0; 01632 }

PCURSOR xxxSetClassIcon PWND  pwnd,
PCLS  pcls,
PCURSOR  pCursor,
int  gcw
 

Definition at line 56 of file classchg.c.

References BOOL, BWL_ENUMLIST, CheckLock, CSF_CACHEDSMICON, tagCLS::CSF_flags, tagCLS::cWndReferenceCount, DestroyClassSmIcon(), FALSE, HMRevalidateHandleNoRip, Lock, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, PtoH, tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, tagWND::spwndChild, ThreadLock, ThreadUnlock, TRUE, xxxCreateClassSmIcon(), xxxInternalEnumWindow(), and xxxSetClassIconEnum().

Referenced by SetClassCursor().

00061 { 00062 PTHREADINFO pti = PtiCurrent(); 00063 PCURSOR pCursorOld; 00064 HCURSOR hCursorOld; 00065 TL tlpwndChild; 00066 BOOL fRedraw; 00067 00068 CheckLock(pwnd); 00069 00070 /* 00071 * Save old icon 00072 */ 00073 pCursorOld = ((gcw == GCLP_HICON) ? pcls->spicn : pcls->spicnSm); 00074 00075 if (pCursorOld != pCursor) { 00076 00077 fRedraw = TRUE; 00078 00079 hCursorOld = PtoH(pCursorOld); 00080 00081 /* 00082 * Set new icon 00083 */ 00084 if (gcw == GCLP_HICON) { 00085 00086 /* 00087 * Destroy private cached small icon first. 00088 */ 00089 if (pcls->spicnSm && !DestroyClassSmIcon(pcls)) 00090 fRedraw = FALSE; 00091 00092 Lock(&(pcls->spicn), pCursor); 00093 00094 } else { 00095 00096 /* 00097 * We don't allow apps to see the small icons we create from 00098 * their big icons. They can see their own. Saves memory 00099 * leak problems and is easier. 00100 */ 00101 if (pcls->CSF_flags & CSF_CACHEDSMICON) { 00102 DestroyClassSmIcon(pcls); 00103 hCursorOld = NULL; 00104 } 00105 00106 Lock(&(pcls->spicnSm), pCursor); 00107 } 00108 00109 if (pcls->spicn && !pcls->spicnSm) 00110 xxxCreateClassSmIcon(pcls); 00111 00112 if (fRedraw) { 00113 00114 if (pcls->cWndReferenceCount > 1) { 00115 ThreadLock(pti->rpdesk->pDeskInfo->spwnd->spwndChild, &tlpwndChild); 00116 xxxInternalEnumWindow(pti->rpdesk->pDeskInfo->spwnd->spwndChild, 00117 xxxSetClassIconEnum, 00118 (LPARAM)pcls, 00119 BWL_ENUMLIST); 00120 ThreadUnlock(&tlpwndChild); 00121 } else { 00122 xxxSetClassIconEnum(pwnd, (LPARAM)pcls); 00123 } 00124 } 00125 00126 /* 00127 * Revalidate the old cursor 00128 */ 00129 if (hCursorOld != NULL) { 00130 pCursorOld = HMRevalidateHandleNoRip(hCursorOld); 00131 } else { 00132 pCursorOld = NULL; 00133 } 00134 } 00135 00136 return(pCursorOld); 00137 }

DWORD xxxSetClassLong PWND  pwnd,
int  index,
DWORD  value,
BOOL  bAnsi
 

PWND xxxSetClipboardViewer PWND  pwndClipViewerNew  ) 
 

Definition at line 2572 of file ntuser/kernel/clipbrd.c.

References CheckClipboardAccess(), CheckLock, HW, Lock, NULL, PtiCurrent, RevalidateHwnd, tagWINDOWSTATION::spwndClipViewer, ThreadLockWinSta, ThreadUnlockWinSta, and xxxDrawClipboard().

Referenced by NtUserSetClipboardViewer().

02574 { 02575 TL tlpwinsta; 02576 PWINDOWSTATION pwinsta; 02577 HWND hwndClipViewerOld; 02578 PTHREADINFO ptiCurrent; 02579 02580 CheckLock(pwndClipViewerNew); 02581 02582 /* 02583 * Blow it off is the caller does not have the proper access rights. 02584 * The NULL return really doesn't indicate an error but the 02585 * supposed viewer will never receive any clipboard messages, so 02586 * it shouldn't cause any problems. 02587 */ 02588 if ((pwinsta = CheckClipboardAccess()) == NULL) 02589 return NULL; 02590 02591 ptiCurrent = PtiCurrent(); 02592 02593 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 02594 02595 hwndClipViewerOld = HW(pwinsta->spwndClipViewer); 02596 Lock(&pwinsta->spwndClipViewer, pwndClipViewerNew); 02597 02598 xxxDrawClipboard(pwinsta); 02599 02600 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 02601 02602 if (hwndClipViewerOld != NULL) 02603 return RevalidateHwnd(hwndClipViewerOld); 02604 02605 return NULL; 02606 }

NTSTATUS xxxSetCsrssThreadDesktop PDESKTOP  pdesk,
PDESKRESTOREDATA  pdrdRestore
 

Definition at line 5713 of file queue.c.

References CloseProtectedHandle(), DF_DESTROYED, tagDESKTOP::dwDTFlags, ExDesktopObjectType, FALSE, ISCSRSS, KernelMode, LogDesktop, msg, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObOpenObjectByPointer(), ObReferenceObjectByPointer(), PtiCurrent, tagTHREADINFO::rpdesk, Status, TRUE, xxxDispatchMessage(), xxxPeekMessage, and xxxSetThreadDesktop().

Referenced by VideoPortCalloutThread(), xxxHardErrorControl(), xxxQueryInformationThread(), xxxSetInformationThread(), and xxxUserPowerEventCalloutWorker().

05714 { 05715 PTHREADINFO ptiCurrent = PtiCurrent(); 05716 NTSTATUS Status = STATUS_SUCCESS; 05717 MSG msg; 05718 05719 /* 05720 * Only csr should come here 05721 */ 05722 UserAssert(ISCSRSS()); 05723 UserAssert(pdrdRestore); 05724 UserAssert(pdrdRestore->pdeskRestore == NULL); 05725 05726 if (pdesk->dwDTFlags & DF_DESTROYED) { 05727 RIPMSG1(RIP_WARNING, "xxxSetCsrssThreadDesktop: pdesk 0x%x destroyed", 05728 pdesk); 05729 return STATUS_UNSUCCESSFUL; 05730 } 05731 05732 /* 05733 * Lock the current desktop (set operation). Also, create and save a 05734 * handle to the new desktop. 05735 */ 05736 pdrdRestore->pdeskRestore = ptiCurrent->rpdesk; 05737 05738 if (pdrdRestore->pdeskRestore != NULL) { 05739 Status = ObReferenceObjectByPointer(pdrdRestore->pdeskRestore, 05740 MAXIMUM_ALLOWED, 05741 *ExDesktopObjectType, 05742 KernelMode); 05743 05744 if (!NT_SUCCESS(Status)) { 05745 pdrdRestore->pdeskRestore = NULL; 05746 pdrdRestore->hdeskNew = NULL; 05747 return Status; 05748 } 05749 LogDesktop(pdrdRestore->pdeskRestore, LD_REF_FN_SETCSRSSTHREADDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 05750 } 05751 05752 Status = ObOpenObjectByPointer( 05753 pdesk, 05754 0, 05755 NULL, 05756 EVENT_ALL_ACCESS, 05757 NULL, 05758 KernelMode, 05759 &(pdrdRestore->hdeskNew)); 05760 05761 05762 if (!NT_SUCCESS(Status)) { 05763 RIPNTERR2(Status, RIP_WARNING, "SetCsrssThreadDesktop, can't open handle, pdesk %#p. Status: %#x", pdesk, Status); 05764 if (pdrdRestore->pdeskRestore) { 05765 LogDesktop(pdrdRestore->pdeskRestore, LD_DEREF_FN_SETCSRSSTHREADDESKTOP1, FALSE, (ULONG_PTR)PtiCurrent()); 05766 ObDereferenceObject(pdrdRestore->pdeskRestore); 05767 pdrdRestore->pdeskRestore = NULL; 05768 } 05769 pdrdRestore->hdeskNew = NULL; 05770 return Status; 05771 } 05772 /* 05773 * Set the new desktop, if switching 05774 */ 05775 if (pdesk != ptiCurrent->rpdesk) { 05776 /* 05777 * Process any remaining messages before we leave the desktop 05778 */ 05779 if (ptiCurrent->rpdesk) { 05780 while (xxxPeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_NOYIELD)) 05781 xxxDispatchMessage(&msg); 05782 } 05783 05784 if (!xxxSetThreadDesktop(NULL, pdesk)) { 05785 RIPMSG1(RIP_WARNING, "xxxSetCsrssThreadDesktop: xxxSetThreadDesktop(%#p) failed", pdesk); 05786 Status = STATUS_INVALID_HANDLE; 05787 /* 05788 * We're failing so deref if needed. 05789 */ 05790 if (pdrdRestore->pdeskRestore != NULL) { 05791 LogDesktop(pdrdRestore->pdeskRestore, LD_DEREF_FN_SETCSRSSTHREADDESKTOP1, FALSE, (ULONG_PTR)PtiCurrent()); 05792 ObDereferenceObject(pdrdRestore->pdeskRestore); 05793 pdrdRestore->pdeskRestore = NULL; 05794 } 05795 CloseProtectedHandle(pdrdRestore->hdeskNew); 05796 pdrdRestore->hdeskNew = NULL; 05797 } 05798 } 05799 05800 UserAssert(NT_SUCCESS(Status)); 05801 return Status; 05802 }

BOOL xxxSetDeskPattern PUNICODE_STRING  pProfileUserName,
LPWSTR  lpPat,
BOOL  fCreation
 

Definition at line 1105 of file desktop.c.

References BOOL, CheckCritIn, CXYDESKPATTERN, DESKTOP, FALSE, FastGetProfileStringFromIDW(), ghbmDesktop, hModuleWin, L, MAX_PATH, NULL, PMAP_DESKTOP, PWND_BROADCAST, RecolorDeskPattern(), ServerLoadString, SYSHBR, SYSRGB, TRUE, UINT, xxxRedrawScreen, and xxxSendNotifyMessage().

Referenced by xxxDesktopWndProc(), and xxxSystemParametersInfo().

01108 { 01109 LPWSTR p; 01110 int i; 01111 UINT val; 01112 WCHAR wszNone[20]; 01113 WCHAR wchValue[MAX_PATH]; 01114 WORD rgBits[CXYDESKPATTERN]; 01115 HBRUSH hBrushTemp; 01116 01117 CheckCritIn(); 01118 01119 /* 01120 * Get rid of the old bitmap (if any). 01121 */ 01122 if (ghbmDesktop != NULL) { 01123 GreDeleteObject(ghbmDesktop); 01124 ghbmDesktop = NULL; 01125 } 01126 01127 /* 01128 * Check if a pattern is passed via lpszPattern. 01129 */ 01130 if (lpszPattern != (LPWSTR)LongToPtr( (LONG)-1 )) { 01131 01132 /* 01133 * Yes! Then use that pattern; 01134 */ 01135 p = lpszPattern; 01136 goto GotThePattern; 01137 } 01138 01139 /* 01140 * Else, pickup the pattern selected in WIN.INI. 01141 * Get the "DeskPattern" string from WIN.INI's [Desktop] section. 01142 */ 01143 if (!FastGetProfileStringFromIDW(pProfileUserName, 01144 PMAP_DESKTOP, 01145 STR_DESKPATTERN, 01146 TEXT(""), 01147 wchValue, 01148 sizeof(wchValue)/sizeof(WCHAR) 01149 )) { 01150 return FALSE; 01151 } 01152 01153 ServerLoadString(hModuleWin, 01154 STR_NONE, 01155 wszNone, 01156 sizeof(wszNone)/sizeof(WCHAR)); 01157 01158 p = wchValue; 01159 01160 GotThePattern: 01161 01162 /* 01163 * Was a Desk Pattern selected? 01164 */ 01165 if (*p == TEXT('\0') || _wcsicmp(p, wszNone) == 0) { 01166 hBrushTemp = GreCreateSolidBrush(SYSRGB(DESKTOP)); 01167 if (hBrushTemp != NULL) { 01168 if (SYSHBR(DESKTOP)) { 01169 GreMarkDeletableBrush(SYSHBR(DESKTOP)); 01170 GreDeleteObject(SYSHBR(DESKTOP)); 01171 } 01172 GreMarkUndeletableBrush(hBrushTemp); 01173 SYSHBR(DESKTOP) = hBrushTemp; 01174 } 01175 GreSetBrushOwnerPublic(hBrushTemp); 01176 goto SDPExit; 01177 } 01178 01179 /* 01180 * Get eight groups of numbers seprated by non-numeric characters. 01181 */ 01182 for (i = 0; i < CXYDESKPATTERN; i++) { 01183 val = 0; 01184 01185 /* 01186 * Skip over any non-numeric characters, check for null EVERY time. 01187 */ 01188 while (*p && !(*p >= TEXT('0') && *p <= TEXT('9'))) 01189 p++; 01190 01191 /* 01192 * Get the next series of digits. 01193 */ 01194 while (*p >= TEXT('0') && *p <= TEXT('9')) 01195 val = val * (UINT)10 + (UINT)(*p++ - TEXT('0')); 01196 01197 rgBits[i] = (WORD)val; 01198 } 01199 01200 ghbmDesktop = GreCreateBitmap(CXYDESKPATTERN, 01201 CXYDESKPATTERN, 01202 1, 01203 1, 01204 (LPBYTE)rgBits); 01205 01206 if (ghbmDesktop == NULL) 01207 return FALSE; 01208 01209 GreSetBitmapOwner(ghbmDesktop, OBJECT_OWNER_PUBLIC); 01210 01211 RecolorDeskPattern(); 01212 01213 SDPExit: 01214 if (!fCreation) { 01215 01216 /* 01217 * Notify everyone that the colors have changed. 01218 */ 01219 xxxSendNotifyMessage(PWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0L); 01220 01221 /* 01222 * Update the entire screen. If this is creation, don't update: the 01223 * screen hasn't drawn, and also there are some things that aren't 01224 * initialized yet. 01225 */ 01226 xxxRedrawScreen(); 01227 } 01228 01229 return TRUE; 01230 }

BOOL xxxSetDeskWallpaper PUNICODE_STRING  pProfileUserName,
LPWSTR  lpszFile
 

Definition at line 1079 of file dtbitmap.c.

References BOOL, tagSIZERECT::cx, tagSIZERECT::cy, FALSE, FastGetProfileIntsW(), FreeAllSpbs(), GetDeskWallpaperName(), ghbmWallpaper, ghpalWallpaper, gpDispInfo, gpszWall, gsrcWallpaper, gwWPStyle, tagDISPLAYINFO::hdcScreen, HW, NULL, tagDESKTOP::pDeskInfo, PMAP_DESKTOP, PROFINTINFO, PtiCurrent, tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, tagDESKTOPINFO::spwndShell, ThreadLockAlways, ThreadUnlock, TRUE, UINT, tagSIZERECT::x, xxxLoadDesktopWallpaper(), xxxSendNotifyMessage(), and tagSIZERECT::y.

Referenced by xxxResetDisplayDevice(), and xxxSystemParametersInfo().

01081 { 01082 BITMAP bm; 01083 UINT WallpaperStyle2; 01084 PWND pwndShell; 01085 TL tl; 01086 PTHREADINFO ptiCurrent = PtiCurrent(); 01087 PDESKTOP pdesk; 01088 BOOL fRet = FALSE; 01089 HBITMAP hbmOld; 01090 01091 PROFINTINFO apsi[] = { 01092 {PMAP_DESKTOP, (LPWSTR)STR_TILEWALL , 0, &gwWPStyle }, 01093 {PMAP_DESKTOP, (LPWSTR)STR_DTSTYLE , 0, &WallpaperStyle2 }, 01094 {PMAP_DESKTOP, (LPWSTR)STR_DTORIGINX, 0, &gsrcWallpaper.x }, 01095 {PMAP_DESKTOP, (LPWSTR)STR_DTORIGINY, 0, &gsrcWallpaper.y }, 01096 {0, NULL, 0, NULL } 01097 }; 01098 01099 pdesk = ptiCurrent->rpdesk; 01100 hbmOld = ghbmWallpaper; 01101 01102 /* 01103 * Get the shell-window. This could be NULL on system 01104 * initialization. We will use this to do palette realization. 01105 */ 01106 pwndShell = (pdesk ? pdesk->pDeskInfo->spwndShell : NULL); 01107 01108 if ((lpszFile == SETWALLPAPER_METRICS) && !(gwWPStyle & DTF_STRETCH)) { 01109 01110 gsrcWallpaper.x = 0; 01111 gsrcWallpaper.y = 0; 01112 01113 if (ghbmWallpaper) 01114 goto CreateNewWallpaper; 01115 01116 goto Metric_Change; 01117 } 01118 01119 CreateNewWallpaper: 01120 01121 /* 01122 * Delete the old wallpaper and palette if the exist. 01123 */ 01124 if (ghpalWallpaper) { 01125 GreDeleteObject(ghpalWallpaper); 01126 ghpalWallpaper = NULL; 01127 } 01128 01129 if (ghbmWallpaper) { 01130 GreDeleteObject(ghbmWallpaper); 01131 ghbmWallpaper = NULL; 01132 } 01133 01134 /* 01135 * Kill any SPBs no matter what. 01136 * Works if we're switching from/to palettized wallpaper. 01137 * Fixes a lot of problems because palette doesn't change, shell 01138 * paints funny on desktop, etc. 01139 */ 01140 FreeAllSpbs(); 01141 01142 /* 01143 * If this is a metric-change (and stretched), then we need to 01144 * reload it. However, since we are called from the winlogon process 01145 * during a desktop-switch, we would be mapped to the wrong Luid 01146 * when we attempt to grab the name from GetDeskWallpaperName. This 01147 * would use the Luid from the DEFAULT user rather than the current 01148 * logged on user. In order to avoid this, we cache the wallpaer 01149 * name so that on METRIC-CHANGES we use the current-user's wallpaper. 01150 * 01151 * NOTE: we assume that prior to any METRIC change, we have already 01152 * setup the ghbmWallpaper and lpszCached. This is usually done 01153 * either on logon or during user desktop-changes through conrol-Panel. 01154 */ 01155 if (lpszFile == SETWALLPAPER_METRICS) { 01156 01157 UserAssert(gpszWall != NULL); 01158 01159 goto LoadWallpaper; 01160 } 01161 01162 /* 01163 * Free the cached handle. 01164 */ 01165 if (gpszWall) { 01166 UserFreePool(gpszWall); 01167 gpszWall = NULL; 01168 } 01169 01170 /* 01171 * Load the wallpaper-name. If this returns FALSE, then 01172 * the user specified (None). We will return true to force 01173 * the repainting of the desktop. 01174 */ 01175 gpszWall = GetDeskWallpaperName(pProfileUserName,lpszFile); 01176 if (!gpszWall) { 01177 fRet = TRUE; 01178 goto SDW_Exit; 01179 } 01180 01181 /* 01182 * Retrieve the default settings from the registry. 01183 * 01184 * If tile is indicated, then normalize style to not include 01185 * FIT/STRETCH which are center-only styles. Likewise, if 01186 * we are centered, then normalize out the TILE bit. 01187 */ 01188 FastGetProfileIntsW(pProfileUserName, apsi); 01189 01190 gwWPStyle &= DTF_TILE; 01191 if (!(gwWPStyle & DTF_TILE)) { 01192 gwWPStyle = WallpaperStyle2 & DTF_STRETCH; 01193 } 01194 01195 /* 01196 * Load the wallpaper. This makes a callback to the client to 01197 * perform the bitmap-creation. 01198 */ 01199 01200 LoadWallpaper: 01201 01202 if (xxxLoadDesktopWallpaper(gpszWall) == FALSE) { 01203 gwWPStyle = 0; 01204 goto SDW_Exit; 01205 } 01206 01207 /* 01208 * If we have a palette, then we need to do the correct realization and 01209 * notification. 01210 */ 01211 if (ghpalWallpaper != NULL) { 01212 PWND pwndSend; 01213 01214 if (pwndShell) { 01215 pwndSend = pwndShell; 01216 } else { 01217 pwndSend = (pdesk ? pdesk->pDeskInfo->spwnd : NULL); 01218 } 01219 01220 /* 01221 * Update the desktop with the new bitmap. This cleans 01222 * out the system-palette so colors can be realized. 01223 */ 01224 GreRealizeDefaultPalette(gpDispInfo->hdcScreen, TRUE); 01225 01226 /* 01227 * Don't broadcast if system initialization is occuring. Otherwise 01228 * this gives the shell first-crack at realizing its colors 01229 * correctly. 01230 */ 01231 if (pwndSend) { 01232 HWND hwnd = HW(pwndSend); 01233 01234 ThreadLockAlways(pwndSend, &tl); 01235 xxxSendNotifyMessage(pwndSend, WM_PALETTECHANGED, (WPARAM)hwnd, 0); 01236 ThreadUnlock(&tl); 01237 } 01238 } 01239 01240 Metric_Change: 01241 if (fRet = GreExtGetObjectW(ghbmWallpaper, sizeof(bm), (PBITMAP)&bm)) { 01242 gsrcWallpaper.cx = bm.bmWidth; 01243 gsrcWallpaper.cy = bm.bmHeight; 01244 } 01245 // fall-through 01246 01247 SDW_Exit: 01248 01249 /* 01250 * Notify the shell-window that the wallpaper changed. 01251 */ 01252 if ((pwndShell != NULL) && 01253 ((hbmOld && !ghbmWallpaper) || (!hbmOld && ghbmWallpaper))) { 01254 01255 ThreadLockAlways(pwndShell, &tl); 01256 xxxSendNotifyMessage(pwndShell, 01257 WM_SHELLNOTIFY, 01258 SHELLNOTIFY_WALLPAPERCHANGED, 01259 (LPARAM)ghbmWallpaper); 01260 ThreadUnlock(&tl); 01261 } 01262 01263 return fRet; 01264 }

BOOL xxxSetDialogSystemMenu PWND  pwnd  ) 
 

Definition at line 95 of file mnapi.c.

References BOOL, CheckLock, tagWND::head, ID_DIALOGSYSMENU, LockWndMenu(), NULL, tagWND::spmenuSys, and xxxLoadSysDesktopMenu().

00097 { 00098 PMENU pMenu; 00099 00100 CheckLock(pwnd); 00101 00102 pMenu = pwnd->head.rpdesk->spmenuDialogSys; 00103 if (pMenu == NULL) { 00104 pMenu = xxxLoadSysDesktopMenu (&pwnd->head.rpdesk->spmenuDialogSys, ID_DIALOGSYSMENU); 00105 } 00106 00107 LockWndMenu(pwnd, &pwnd->spmenuSys, pMenu); 00108 00109 return (pMenu != NULL); 00110 }

PWND xxxSetFocus PWND  pwnd  ) 
 

Definition at line 1815 of file focusact.c.

References CheckLock, FAllowForegroundActivate(), GETPTI, gLCIDSentToShell, gpqForeground, tagKL::hkl, HW, HWq, IsHooked, NULL, tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrent, RevalidateHwnd, SFW_SETFOCUS, tagTHREADINFO::spklActive, tagQ::spwndActive, tagQ::spwndFocus, tagWND::spwndParent, TestWF, TestwndChild, ThreadLockWithPti, ThreadUnlock, WFDISABLED, WFMINIMIZED, WFVISIBLE, WHF_CBT, WHF_SHELL, xxxActivateThisWindow(), xxxCallHook(), xxxSendFocusMessages(), and xxxSetForegroundWindow2().

Referenced by NtUserSetFocus(), xxxCheckFocus(), xxxDefWindowProc(), xxxDWP_ProcessVirtKey(), xxxEnableWindow(), xxxMinMaximize(), and xxxSBWndProc().

01817 { 01818 HWND hwndTemp; 01819 PTHREADINFO ptiCurrent = PtiCurrent(); 01820 PTHREADINFO ptiActiveKL; 01821 PWND pwndTemp = NULL; 01822 TL tlpwndTemp; 01823 01824 CheckLock(pwnd); 01825 /* 01826 * Special case if we are setting the focus to a null window. 01827 */ 01828 if (pwnd == NULL) { 01829 if (IsHooked(ptiCurrent, WHF_CBT) && xxxCallHook(HCBT_SETFOCUS, 0, 01830 (LPARAM)HW(ptiCurrent->pq->spwndFocus), WH_CBT)) { 01831 return NULL; 01832 } 01833 01834 /* 01835 * Save old focus so that we can return it. 01836 */ 01837 hwndTemp = HW(ptiCurrent->pq->spwndFocus); 01838 xxxSendFocusMessages(ptiCurrent, pwnd); 01839 return RevalidateHwnd(hwndTemp); 01840 } 01841 01842 /* 01843 * We no longer allow inter-thread set focuses. 01844 */ 01845 if (GETPTI(pwnd)->pq != ptiCurrent->pq) { 01846 return NULL; 01847 } 01848 01849 /* 01850 * If the window recieving the focus or any of its ancestors is either 01851 * minimized or disabled, don't set the focus. 01852 */ 01853 for (pwndTemp = pwnd; pwndTemp != NULL; pwndTemp = pwndTemp->spwndParent) { 01854 if (TestWF(pwndTemp, WFMINIMIZED) || TestWF(pwndTemp, WFDISABLED)) { 01855 01856 /* 01857 * Don't change the focus if going to a minimized or disabled 01858 * window. 01859 */ 01860 return NULL; 01861 } 01862 01863 if (!TestwndChild(pwndTemp)) { 01864 break; 01865 } 01866 } 01867 UserAssert(pwndTemp != NULL); 01868 01869 /* 01870 * pwndTemp should now be the top level ancestor of pwnd. 01871 */ 01872 ThreadLockWithPti(ptiCurrent, pwndTemp, &tlpwndTemp); 01873 if (pwnd != ptiCurrent->pq->spwndFocus) { 01874 if (IsHooked(ptiCurrent, WHF_CBT) && xxxCallHook(HCBT_SETFOCUS, (WPARAM)HWq(pwnd), 01875 (LPARAM)HW(ptiCurrent->pq->spwndFocus), WH_CBT)) { 01876 ThreadUnlock(&tlpwndTemp); 01877 return NULL; 01878 } 01879 01880 /* 01881 * Activation must follow the focus. That is, setting the focus to 01882 * a particualr window means that the top-level parent of this window 01883 * must be the active window (top-level parent is determined by 01884 * following the parent chain until you hit a top-level guy). So, 01885 * we must activate this top-level parent if it is different than 01886 * the current active window. 01887 * 01888 * Only change activation if top-level parent is not the currently 01889 * active window. 01890 */ 01891 if (pwndTemp != ptiCurrent->pq->spwndActive) { 01892 01893 /* 01894 * If this app is not in the foreground, see if foreground 01895 * activation is allowed. 01896 */ 01897 if (ptiCurrent->pq != gpqForeground && FAllowForegroundActivate(ptiCurrent->pq, pwndTemp)) { 01898 /* 01899 * If the process lost the foreground activation right by giving 01900 * focus to a hidden window, then give it the right back. See 01901 * bug #401932 for how this might affect an app 01902 */ 01903 if (!TestWF(pwndTemp, WFVISIBLE)){ 01904 ptiCurrent->ppi->W32PF_Flags |= W32PF_ALLOWFOREGROUNDACTIVATE; 01905 } 01906 if (!xxxSetForegroundWindow2(pwndTemp, ptiCurrent, SFW_SETFOCUS)) { 01907 ThreadUnlock(&tlpwndTemp); 01908 return NULL; 01909 } 01910 } 01911 01912 /* 01913 * This will return FALSE if something goes wrong. 01914 */ 01915 if (pwndTemp != ptiCurrent->pq->spwndActive) { 01916 if (!xxxActivateThisWindow(pwndTemp, 0, 0)) { 01917 ThreadUnlock(&tlpwndTemp); 01918 return NULL; 01919 } 01920 } 01921 } 01922 01923 /* 01924 * Save current pwndFocus since we must return this. 01925 */ 01926 pwndTemp = ptiCurrent->pq->spwndFocus; 01927 ThreadUnlock(&tlpwndTemp); 01928 ThreadLockWithPti(ptiCurrent, pwndTemp, &tlpwndTemp); 01929 01930 /* 01931 * Change the global pwndFocus and send the WM_{SET/KILL}FOCUS 01932 * messages. 01933 */ 01934 xxxSendFocusMessages(ptiCurrent, pwnd); 01935 01936 } else { 01937 pwndTemp = ptiCurrent->pq->spwndFocus; 01938 } 01939 01940 if (ptiCurrent->pq->spwndFocus) { 01941 /* 01942 * For the shell notification hook, we should use the pti->spkl 01943 * of the window with the focus. This could be a different thread, 01944 * (or even different process) when the queue is attached. The typical 01945 * case would be OLE out-of-process server. 01946 * #352877 01947 */ 01948 ptiActiveKL = GETPTI(ptiCurrent->pq->spwndFocus); 01949 } else { 01950 /* 01951 * Preserving the NT4 behavior, otherwise. 01952 */ 01953 ptiActiveKL = ptiCurrent; 01954 } 01955 UserAssert(ptiActiveKL); 01956 01957 /* 01958 * Update the keyboard icon on the tray if the layout changed during focus change. 01959 * Before winlogon loads kbd layouts, pti->spkActive is NULL. #99321 01960 */ 01961 if (ptiActiveKL->spklActive) { 01962 HKL hklActive = ptiActiveKL->spklActive->hkl; 01963 01964 if ((gLCIDSentToShell != hklActive) && IsHooked(ptiCurrent, WHF_SHELL)) { 01965 gLCIDSentToShell = hklActive; 01966 xxxCallHook(HSHELL_LANGUAGE, (WPARAM)NULL, (LPARAM)hklActive, WH_SHELL); 01967 } 01968 } 01969 01970 hwndTemp = HW(pwndTemp); 01971 ThreadUnlock(&tlpwndTemp); 01972 01973 /* 01974 * Return the pwnd of the window that lost the focus. 01975 * Return the validated hwndTemp: since we locked/unlocked pwndTemp, 01976 * it may be gone. 01977 */ 01978 return RevalidateHwnd(hwndTemp); 01979 }

BOOL xxxSetForegroundWindow PWND  pwnd,
BOOL  fFlash
 

Definition at line 1235 of file focusact.c.

References AW_USE, BOOL, CanForceForeground(), CheckLock, DSW_GetTopLevelCreatorWindow(), DWORD, FALSE, FRemoveForegroundActivate(), GETPTI, GetTopLevelWindow(), GiveUpForeground(), gppiInputProvider, gppiWantForegroundPriority, gpqForeground, HWq, IsForegroundLocked(), IsTrayWindow(), NULL, PostEventMessage(), tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrent, QEVENT_ACTIVATE, ThreadLockAlways, ThreadUnlock, TIF_ALLOWFOREGROUNDACTIVATE, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, TRUE, UP, xxxActivateWindow(), xxxFlashWindow(), and xxxSetForegroundWindow2().

Referenced by xxxActivateOnMinimize(), xxxActivateWindow(), xxxDefWindowProc(), xxxMenuWindowProc(), xxxOldNextWindow(), xxxStubSetForegroundWindow(), xxxSwitchToThisWindow(), and xxxSysCommand().

01238 { 01239 BOOL fNiceCall = TRUE; 01240 BOOL fSyncActivate, fActive; 01241 DWORD dwFlashFlags; 01242 PTHREADINFO ptiCurrent = PtiCurrent(); 01243 PWND pwndFlash; 01244 TL tlpwndFlash; 01245 01246 CheckLock(pwnd); 01247 01248 /* 01249 * If we're trying to set a window on our own thread to the foreground, 01250 * and we're already in the foreground, treat it just like a call to 01251 * SetActiveWindow(). 01252 */ 01253 if ((pwnd != NULL) && (GETPTI(pwnd)->pq == gpqForeground)) { 01254 fSyncActivate = (gpqForeground == ptiCurrent->pq); 01255 if (fSyncActivate) { 01256 gppiWantForegroundPriority = ptiCurrent->ppi; 01257 } else { 01258 gppiWantForegroundPriority = GETPTI(pwnd)->ppi; 01259 } 01260 01261 goto JustActivateIt; 01262 } 01263 /* 01264 * If the foregrond is not locked 01265 * and this thread has the right to changethe foreground, 01266 * then remove the activation right (it's a one-shot deal) 01267 * and do it. 01268 */ 01269 01270 /* 01271 * Bug 247768 - joejo 01272 * Add compatibility hack for foreground activation problems. 01273 * 01274 * To Fix Winstone99, ignore the foreground lock if the input 01275 * provider is making this call. GerardoB. 01276 * 01277 */ 01278 01279 if ((!IsForegroundLocked() || (ptiCurrent->ppi == gppiInputProvider)) 01280 && (ptiCurrent->TIF_flags & (TIF_ALLOWFOREGROUNDACTIVATE | TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD) 01281 || CanForceForeground(ptiCurrent->ppi) 01282 || GiveUpForeground())) { 01283 01284 TAGMSG1(DBGTAG_FOREGROUND, "xxxSetForegroundWindow FRemoveForegroundActivate %#p", ptiCurrent); 01285 01286 FRemoveForegroundActivate(ptiCurrent); 01287 return xxxSetForegroundWindow2(pwnd, ptiCurrent, 0); 01288 } 01289 fNiceCall = FALSE; 01290 TAGMSG3(DBGTAG_FOREGROUND, "xxxSetForegroundWindow: rude call by %#p to %#p-%#p", 01291 ptiCurrent, pwnd, (pwnd != NULL ? GETPTI(pwnd) : NULL)); 01292 if (pwnd == NULL) { 01293 return FALSE; 01294 } 01295 /* 01296 * Notify the user that this pwnd wants to come to the foreground. 01297 * Try to flash a tray button only; otherwise, flash pwnd 01298 */ 01299 if (fFlash) { 01300 pwndFlash = DSW_GetTopLevelCreatorWindow(GetTopLevelWindow(pwnd)); 01301 if (IsTrayWindow(pwndFlash)) { 01302 dwFlashFlags = FLASHW_TRAY; 01303 } else { 01304 pwndFlash = pwnd; 01305 dwFlashFlags = FLASHW_ALL; 01306 } 01307 ThreadLockAlways(pwndFlash, &tlpwndFlash); 01308 xxxFlashWindow(pwndFlash, 01309 MAKELONG(dwFlashFlags | FLASHW_TIMERNOFG, UP(FOREGROUNDFLASHCOUNT)), 01310 0); 01311 ThreadUnlock(&tlpwndFlash); 01312 } 01313 /* 01314 * Activate the window. 01315 */ 01316 fSyncActivate = (ptiCurrent->pq == GETPTI(pwnd)->pq); 01317 01318 JustActivateIt: 01319 01320 if (fSyncActivate) { 01321 fActive = xxxActivateWindow(pwnd, AW_USE); 01322 } else if (pwnd == GETPTI(pwnd)->pq->spwndActive) { 01323 fActive = TRUE; 01324 } else { 01325 fActive = PostEventMessage(GETPTI(pwnd), GETPTI(pwnd)->pq, 01326 QEVENT_ACTIVATE, NULL, 0, 01327 0, (LPARAM)HWq(pwnd)) ; 01328 } 01329 01330 /* 01331 * Return FALSE if we failed the set foreground request. 01332 */ 01333 return fNiceCall && fActive; 01334 }

BOOL xxxSetForegroundWindow2 PWND  pwnd,
PTHREADINFO  ptiCurrent,
DWORD  fFlags
 

Definition at line 1342 of file focusact.c.

References AllocQEntry(), ATW_SETFOCUS, BOOL, CheckLock, CMSHUNGAPPTIMEOUT, tagQ::cThreads, DWORD, FALSE, FHungApp(), GETPTI, gppiLockSFW, gppiWantForegroundPriority, gpqForeground, gpqForegroundPrev, gptiForeground, grpdeskRitInput, tagWND::head, HMIsMarkDestroy, HW, LockWindowUpdate2(), tagQ::mlInput, NULL, PEM_ACTIVATE_NOZORDER, PEM_ACTIVATE_RESTORE, tagTHREADINFO::pq, PtiCurrent, tagQ::ptiKeyboard, tagQ::ptiMouse, PWND_TOP, QEVENT_ACTIVATE, QEVENT_DEACTIVATE, QF_EVENTDEACTIVATEREMOVED, tagQ::QF_flags, RemoveEventMessage(), tagTHREADINFO::rpdesk, SetForegroundThread(), SetHungFlag(), SetWakeBit(), SFW_ACTIVATERESTORE, SFW_NOZORDER, SFW_SETFOCUS, SFW_STARTUP, SFW_SWITCH, tagQ::spwndActive, StoreQMessage(), StoreQMessagePti(), TestUP, ThreadLockAlwaysWithPti, ThreadLockPti, ThreadUnlock, ThreadUnlockPti, TID, TIDq, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, UINT, WFREDRAWFRAMEIFHUNG, xxxActivateThisWindow(), xxxCancelTracking(), xxxDeactivate(), xxxMakeWindowForegroundWithState(), xxxRedrawHungWindowFrame(), xxxSendMessage(), xxxSetWindowPos(), xxxUpdateTray(), zzzActiveCursorTracking(), and zzzClipCursor().

Referenced by xxxActiveWindowTracking(), xxxButtonEvent(), xxxDoHotKeyStuff(), xxxKeyEvent(), xxxMinMaximize(), xxxNextWindow(), xxxProcessEventMessage(), xxxSetFocus(), xxxSetForegroundWindow(), xxxSetThreadDesktop(), and xxxSwitchDesktop().

01346 { 01347 PTHREADINFO ptiForegroundOld; 01348 PTHREADINFO ptiForegroundNew; 01349 PQ pqForegroundOld, pqForegroundNew, pqCurrent; 01350 HWND hwnd; 01351 PQMSG pqmsgDeactivate, pqmsgActivate; 01352 BOOL bRemovedEvent; 01353 PTHREADINFO ptiCurrent = PtiCurrent(); 01354 BOOL retval = TRUE; 01355 UINT uMsg; 01356 CheckLock(pwnd); 01357 01358 /* 01359 * Queue pointers and threadinfo pointers can go away when calling xxx 01360 * calls. Also, queues can get recalced via AttachThreadInput() during 01361 * xxx calls - so we want to reference the application becoming foreground. 01362 * PQs cannot be refcount locked (either thread locked or structure locked) 01363 * so must (re)calculate them after returning from xxx calls. 01364 * 01365 * NOTE: gpqForeground and gpqForegroundPrev are always current and don't 01366 * need special handling. 01367 */ 01368 01369 /* 01370 * Don't allow the foreground to be set to a window that is not 01371 * on the current desktop. 01372 */ 01373 if (pwnd != NULL && (pwnd->head.rpdesk != grpdeskRitInput || 01374 HMIsMarkDestroy(pwnd))) { 01375 return FALSE; 01376 } 01377 01378 /* 01379 * Unlock SetForegroundWindow (if someone had it locked) 01380 */ 01381 gppiLockSFW = NULL; 01382 TAGMSG3(DBGTAG_FOREGROUND, "xxxSetForegroundWindow2 by %#p to %#p-%#p", 01383 ptiCurrent, pwnd, (pwnd != NULL ? GETPTI(pwnd) : NULL)); 01384 01385 /* 01386 * Calculate who is becoming foreground. Also, remember who we want 01387 * foreground (for priority setting reasons). 01388 */ 01389 if ((gptiForeground != NULL) && !(gptiForeground->TIF_flags & TIF_INCLEANUP)) { 01390 ptiForegroundOld = gptiForeground; 01391 } else { 01392 ptiForegroundOld = NULL; 01393 } 01394 pqForegroundOld = NULL; 01395 pqForegroundNew = NULL; 01396 pqCurrent = NULL; 01397 01398 gpqForegroundPrev = gpqForeground; 01399 01400 if (pwnd != NULL) { 01401 ptiForegroundNew = GETPTI(pwnd); 01402 UserAssert(ptiForegroundNew->rpdesk == grpdeskRitInput); 01403 gppiWantForegroundPriority = GETPTI(pwnd)->ppi; 01404 gpqForeground = GETPTI(pwnd)->pq; 01405 UserAssert(gpqForeground->cThreads != 0); 01406 UserAssert(gpqForeground->ptiMouse->rpdesk == grpdeskRitInput); 01407 // Assert to catch AV in xxxNextWindow doing Alt-Esc: If we have a non-NULL 01408 // gpqForeground, its kbd input thread better have an rpdesk! -IanJa 01409 UserAssert(!gpqForeground || (gpqForeground->ptiKeyboard && gpqForeground->ptiKeyboard->rpdesk)); 01410 SetForegroundThread(GETPTI(pwnd)); 01411 } else { 01412 ptiForegroundNew = NULL; 01413 gppiWantForegroundPriority = NULL; 01414 gpqForeground = NULL; 01415 SetForegroundThread(NULL); 01416 } 01417 01418 /* 01419 * Are we switching the foreground queue? 01420 */ 01421 if (gpqForeground != gpqForegroundPrev) { 01422 TL tlptiForegroundOld; 01423 TL tlptiForegroundNew; 01424 TL tlpti; 01425 01426 ThreadLockPti(ptiCurrent, ptiForegroundOld, &tlptiForegroundOld); 01427 ThreadLockPti(ptiCurrent, ptiForegroundNew, &tlptiForegroundNew); 01428 ThreadLockPti(ptiCurrent, pti, &tlpti); 01429 01430 /* 01431 * If this call didn't come from the RIT, cancel tracking 01432 * and other global states. 01433 */ 01434 if (pti != NULL) { 01435 01436 /* 01437 * Clear any visible tracking going on in system. 01438 */ 01439 xxxCancelTracking(); 01440 01441 /* 01442 * Remove the clip cursor rectangle - it is a global mode that 01443 * gets removed when switching. Also remove any LockWindowUpdate() 01444 * that's still around. 01445 */ 01446 zzzClipCursor(NULL); 01447 LockWindowUpdate2(NULL, TRUE); 01448 01449 /* 01450 * Make sure the desktop of the newly activated window is the 01451 * foreground fullscreen window 01452 */ 01453 xxxMakeWindowForegroundWithState(NULL, 0); 01454 } 01455 01456 /* 01457 * We've potentially done callbacks. Calculate pqForegroundOld 01458 * based on our locked local variable ptiForegroundOld. 01459 */ 01460 pqForegroundOld = NULL; 01461 if (ptiForegroundOld && !(ptiForegroundOld->TIF_flags & TIF_INCLEANUP)) { 01462 pqForegroundOld = ptiForegroundOld->pq; 01463 } 01464 01465 pqCurrent = NULL; 01466 if (pti != NULL) 01467 pqCurrent = pti->pq; 01468 01469 /* 01470 * Now allocate message for the deactivation 01471 */ 01472 pqmsgDeactivate = pqmsgActivate = NULL; 01473 01474 if ((pqForegroundOld != NULL) && (pqForegroundOld != pqCurrent)) { 01475 if ((pqmsgDeactivate = AllocQEntry(&pqForegroundOld->mlInput)) == 01476 NULL) { 01477 retval = FALSE; 01478 goto Exit; 01479 } 01480 } 01481 01482 /* 01483 * Do any appropriate deactivation. 01484 */ 01485 if (pqForegroundOld != NULL) { 01486 01487 /* 01488 * If we're already on the foreground queue we'll call 01489 * xxxDeactivate() directly later in this routine since 01490 * it'll cause us to leave the critical section. 01491 */ 01492 if (pqForegroundOld != pqCurrent) { 01493 StoreQMessage(pqmsgDeactivate, NULL, 0, 01494 gptiForeground != NULL ? (WPARAM)gptiForeground->pEThread->Cid.UniqueThread : 0, 01495 0, 0, QEVENT_DEACTIVATE, 0); 01496 01497 /* 01498 * If there was an old foreground thread, make it perform 01499 * the deactivation. Otherwise, any thread on the queue 01500 * can perform the deactivation. 01501 */ 01502 if (ptiForegroundOld != NULL) { 01503 SetWakeBit(ptiForegroundOld, QS_EVENTSET); 01504 01505 StoreQMessagePti(pqmsgDeactivate, ptiForegroundOld); 01506 01507 } 01508 01509 if (pqForegroundOld->spwndActive != NULL) { 01510 if (ptiForegroundOld != NULL && FHungApp(ptiForegroundOld, CMSHUNGAPPTIMEOUT)) { 01511 TL tlpwnd; 01512 ThreadLockAlwaysWithPti(ptiCurrent, pqForegroundOld->spwndActive, &tlpwnd); 01513 xxxRedrawHungWindowFrame(pqForegroundOld->spwndActive, FALSE); 01514 ThreadUnlock(&tlpwnd); 01515 } else { 01516 SetHungFlag(pqForegroundOld->spwndActive, WFREDRAWFRAMEIFHUNG); 01517 } 01518 } 01519 } 01520 } 01521 01522 /* 01523 * We've potentially done callbacks. Calculate pqForegroundNew 01524 * based on our locked local variable ptiForegroundNew. 01525 */ 01526 pqForegroundNew = NULL; 01527 if (ptiForegroundNew && !(ptiForegroundNew->TIF_flags & TIF_INCLEANUP)) { 01528 pqForegroundNew = ptiForegroundNew->pq; 01529 } 01530 01531 /* 01532 * Update pqCurrent since we may have made an xxx call, 01533 * and this variable may be invalid. 01534 */ 01535 pqCurrent = NULL; 01536 if (pti != NULL) { 01537 pqCurrent = pti->pq; 01538 } 01539 01540 if ((pqForegroundNew != NULL) && (pqForegroundNew != pqCurrent)) { 01541 pqmsgActivate = AllocQEntry(&pqForegroundNew->mlInput); 01542 if (pqmsgActivate == NULL) { 01543 retval = FALSE; 01544 goto Exit; 01545 } 01546 } 01547 01548 /* 01549 * Do any appropriate activation. 01550 */ 01551 if (pqForegroundNew != NULL) { 01552 /* 01553 * We're going to activate (synchronously or async with an activate 01554 * event). We want to remove the last deactivate event if there is 01555 * one because this is new state. If we don't, then 1> we could 01556 * synchronously activate and then asynchronously deactivate, 01557 * thereby processing these events out of order, or 2> we could 01558 * pile up a chain of deactivate / activate events which would 01559 * make the titlebar flash alot if the app wasn't responding to 01560 * input for awhile (in this case, it doesn't matter if we 01561 * put a redundant activate in the queue, since the app is already 01562 * active. Remove all deactivate events because this app is 01563 * setting a state that is not meant to be synchronized with 01564 * existing queued input. 01565 * 01566 * Case: run setup, switch away (it gets deactivate event). setup 01567 * is not reading messages so it hasn't go it yet. It finally 01568 * comes up, calls SetForegroundWindow(). It's synchronous, 01569 * it activates ok and sets foreground. Then the app calls 01570 * GetMessage() and gets the deactivate. Now it isn't active. 01571 */ 01572 bRemovedEvent = RemoveEventMessage(pqForegroundNew, QEVENT_DEACTIVATE, (DWORD)-1); 01573 01574 /* 01575 * Now do any appropriate activation. See comment below 01576 * for special cases. If we're already on the foreground 01577 * queue we'll call xxxActivateThisWindow() directly. 01578 */ 01579 if (pqForegroundNew != pqCurrent) { 01580 01581 /* 01582 * We do the 'pqCurrent == NULL' test to see if we're being 01583 * called from the RIT. In this case we pass NULL for the 01584 * HWND which will check to see if there is already an active 01585 * window for the thread and redraw its frame as truly active 01586 * since it's in the foreground now. It will also cancel any 01587 * global state like LockWindowUpdate() and ClipRect(). 01588 */ 01589 if ((pqCurrent == NULL) && (!(fFlags & SFW_SWITCH))) { 01590 hwnd = NULL; 01591 } else { 01592 hwnd = HW(pwnd); 01593 } 01594 01595 if (bRemovedEvent) { 01596 pqForegroundNew->QF_flags |= QF_EVENTDEACTIVATEREMOVED; 01597 } 01598 /* 01599 * MSMail relies on a specific order to how win3.1 does 01600 * fast switch alt-tab activation. On win3.1, it essentially 01601 * activates the window, then restores it. MsMail gets confused 01602 * if it isn't active when it gets restored, so this logic 01603 * will make sure msmail gets restore after it gets activated. 01604 * 01605 * Click on a message line in the in-box, minimize msmail, 01606 * alt-tab to it. The same line should have the focus if msmail 01607 * got restored after it got activated. 01608 * 01609 * This is the history behind SFW_ACTIVATERESTORE. 01610 */ 01611 if (fFlags & SFW_ACTIVATERESTORE) { 01612 uMsg = PEM_ACTIVATE_RESTORE; 01613 } else { 01614 uMsg = 0; 01615 } 01616 01617 if (fFlags & SFW_NOZORDER) { 01618 uMsg |= PEM_ACTIVATE_NOZORDER; 01619 } 01620 01621 StoreQMessage(pqmsgActivate, NULL, uMsg, 01622 (fFlags & SFW_STARTUP) ? 0 : (WPARAM)TID(ptiForegroundOld), 01623 (LPARAM)hwnd, 0, QEVENT_ACTIVATE, 0); 01624 01625 01626 /* 01627 * Signal the window's thread to perform activation. We 01628 * know that ptiForegroundNew is valid because pqForegroundNew 01629 * is not NULL. 01630 */ 01631 01632 StoreQMessagePti(pqmsgActivate, ptiForegroundNew); 01633 01634 SetWakeBit(ptiForegroundNew, QS_EVENTSET); 01635 01636 if (pqForegroundNew->spwndActive != NULL) { 01637 if (FHungApp(ptiForegroundNew, CMSHUNGAPPTIMEOUT)) { 01638 TL tlpwnd; 01639 ThreadLockAlwaysWithPti(ptiCurrent, pqForegroundNew->spwndActive, &tlpwnd); 01640 xxxRedrawHungWindowFrame(pqForegroundNew->spwndActive, TRUE); 01641 ThreadUnlock(&tlpwnd); 01642 } else { 01643 SetHungFlag(pqForegroundNew->spwndActive, WFREDRAWFRAMEIFHUNG); 01644 } 01645 } 01646 01647 } else { 01648 if (pwnd != pqCurrent->spwndActive) { 01649 if (!(fFlags & SFW_STARTUP)) { 01650 retval = xxxActivateThisWindow(pwnd, TID(ptiForegroundOld), 01651 ((fFlags & SFW_SETFOCUS) ? 0 : ATW_SETFOCUS)); 01652 01653 /* 01654 * Make sure the mouse is on this window. 01655 */ 01656 if (retval && TestUP(ACTIVEWINDOWTRACKING)) { 01657 zzzActiveCursorTracking(pwnd); 01658 } 01659 goto Exit; 01660 } 01661 01662 } else { 01663 01664 /* 01665 * If pwnd is already the active window, just make sure 01666 * it's drawn active and on top (if requested). 01667 */ 01668 xxxSendMessage(pwnd, WM_NCACTIVATE, 01669 TRUE, 01670 (LPARAM)HW(pwnd)); 01671 xxxUpdateTray(pwnd); 01672 if (!(fFlags & SFW_NOZORDER)) { 01673 xxxSetWindowPos(pwnd, PWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 01674 } 01675 } 01676 } 01677 01678 01679 } /* if (pqForegroundNew != NULL) */ 01680 01681 /* 01682 * First update pqForegroundOld and pqCurrent since we may have 01683 * made an xxx call, and these variables may be invalid. 01684 */ 01685 pqForegroundOld = NULL; 01686 if (ptiForegroundOld && !(ptiForegroundOld->TIF_flags & TIF_INCLEANUP)) { 01687 pqForegroundOld = ptiForegroundOld->pq; 01688 } 01689 01690 pqCurrent = NULL; 01691 if (pti != NULL) 01692 pqCurrent = pti->pq; 01693 01694 /* 01695 * Now check to see if we needed to do any 'local' deactivation. 01696 * (ie. were we on the queue that is being deactivated by this 01697 * SetForegroundWindow() call?) 01698 */ 01699 if ((pqForegroundOld != NULL) && (pqForegroundOld == pqCurrent)) { 01700 xxxDeactivate(pti, (pwnd != NULL) ? TIDq(GETPTI(pwnd)) : 0); 01701 } 01702 Exit: 01703 ThreadUnlockPti(ptiCurrent, &tlpti); 01704 ThreadUnlockPti(ptiCurrent, &tlptiForegroundNew); 01705 ThreadUnlockPti(ptiCurrent, &tlptiForegroundOld); 01706 } 01707 01708 return retval; 01709 }

BOOL xxxSetIMEShowStatus IN BOOL  fShow  ) 
 

Definition at line 2606 of file ntimm.c.

References BOOL, CheckCritIn, CreateProfileUserName(), FALSE, FreeProfileUserName(), GETPTI, gfIMEShowStatus, gpqForeground, IMESHOWSTATUS_NOTINITIALIZED, IS_IME_ENABLED, NULL, PMAP_INPUTMETHOD, tagTHREADINFO::spwndDefaultIme, tagQ::spwndFocus, ThreadLockAlways, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, UpdateWinIniInt(), and xxxNotifyImeShowStatus().

Referenced by xxxSystemParametersInfo().

02607 { 02608 CheckCritIn(); 02609 02610 UserAssert(fShow == FALSE || fShow == TRUE); 02611 02612 if (gfIMEShowStatus == fShow) { 02613 return TRUE; 02614 } 02615 02616 if (gfIMEShowStatus == IMESHOWSTATUS_NOTINITIALIZED) { 02617 /* 02618 * Called for the first time after logon. 02619 * No need to write the value to the registry. 02620 */ 02621 gfIMEShowStatus = fShow; 02622 } 02623 else { 02624 /* 02625 * We need to save the new fShow status to the registry. 02626 */ 02627 TL tlName; 02628 PUNICODE_STRING pProfileUserName; 02629 BOOL fOK = FALSE; 02630 02631 pProfileUserName = CreateProfileUserName(&tlName); 02632 if (pProfileUserName) { 02633 UserAssert(pProfileUserName != NULL); 02634 fOK = UpdateWinIniInt(pProfileUserName, PMAP_INPUTMETHOD, STR_SHOWIMESTATUS, fShow); 02635 FreeProfileUserName(pProfileUserName, &tlName); 02636 } 02637 if (!fOK) { 02638 return FALSE; 02639 } 02640 gfIMEShowStatus = fShow; 02641 } 02642 02643 /* 02644 * If IME is not enabled, further processing is not needed 02645 */ 02646 if (!IS_IME_ENABLED()) { 02647 return TRUE; 02648 } 02649 02650 /* 02651 * Let the current active IME window know the change. 02652 */ 02653 if (gpqForeground && gpqForeground->spwndFocus) { 02654 PTHREADINFO ptiFocus = GETPTI(gpqForeground->spwndFocus); 02655 TL tl; 02656 02657 UserAssert(ptiFocus); 02658 02659 if (ptiFocus->spwndDefaultIme && !(ptiFocus->TIF_flags & TIF_INCLEANUP)) { 02660 ThreadLockAlways(ptiFocus->spwndDefaultIme, &tl); 02661 xxxNotifyImeShowStatus(ptiFocus->spwndDefaultIme); 02662 ThreadUnlock(&tl); 02663 } 02664 } 02665 02666 return TRUE; 02667 }

NTSTATUS xxxSetInformationThread IN HANDLE  hThread,
IN USERTHREADINFOCLASS  ThreadInfoClass,
IN PVOID  ThreadInformation,
IN ULONG  ThreadInformationLength
 

Definition at line 6114 of file queue.c.

References CsrApiPort, CsrPortHandle, DWORD, EndShutdown(), FALSE, gpepCSRSS, grpdeskRitInput, InitiateShutdown(), ISCSRSS, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PsThreadType, PtiFromThread, tagTHREADINFO::rpdesk, SET_TIME_LAST_READ, Status, _ETHREAD::ThreadsProcess, tagTHREADINFO::TIF_flags, UnlockThread, UserMode, xxxRestoreCsrssThreadDesktop(), and xxxSetCsrssThreadDesktop().

Referenced by NtUserSetInformationThread().

06119 { 06120 PUSERTHREAD_FLAGS pFlags; 06121 HANDLE hClientThread; 06122 DWORD dwOldFlags; 06123 PTHREADINFO ptiT; 06124 NTSTATUS Status = STATUS_SUCCESS; 06125 PETHREAD Thread; 06126 PETHREAD ThreadClient; 06127 PTHREADINFO pti; 06128 HANDLE CsrPortHandle; 06129 06130 UNREFERENCED_PARAMETER(ThreadInformationLength); 06131 06132 /* 06133 * Only allow CSRSS to make this call 06134 */ 06135 UserAssert(ISCSRSS()); 06136 06137 Status = ObReferenceObjectByHandle(hThread, 06138 THREAD_SET_INFORMATION, 06139 *PsThreadType, 06140 UserMode, 06141 &Thread, 06142 NULL); 06143 if (!NT_SUCCESS(Status)) 06144 return Status; 06145 06146 pti = PtiFromThread(Thread); 06147 06148 switch (ThreadInfoClass) { 06149 case UserThreadFlags: 06150 if (pti == NULL) 06151 Status = STATUS_INVALID_HANDLE; 06152 else { 06153 UserAssert(ThreadInformationLength == sizeof(USERTHREAD_FLAGS)); 06154 pFlags = ThreadInformation; 06155 dwOldFlags = pti->TIF_flags; 06156 pti->TIF_flags ^= ((dwOldFlags ^ pFlags->dwFlags) & pFlags->dwMask); 06157 } 06158 break; 06159 06160 case UserThreadHungStatus: 06161 if (pti == NULL) 06162 Status = STATUS_INVALID_HANDLE; 06163 else { 06164 06165 /* 06166 * No arguments, simple set the last time read. 06167 */ 06168 SET_TIME_LAST_READ(pti); 06169 } 06170 break; 06171 06172 case UserThreadInitiateShutdown: 06173 UserAssert(ThreadInformationLength == sizeof(ULONG)); 06174 Status = InitiateShutdown(Thread, (PULONG)ThreadInformation); 06175 break; 06176 06177 case UserThreadEndShutdown: 06178 UserAssert(ThreadInformationLength == sizeof(NTSTATUS)); 06179 Status = EndShutdown(Thread, *(NTSTATUS *)ThreadInformation); 06180 break; 06181 06182 case UserThreadUseDesktop: 06183 UserAssert(ThreadInformationLength == sizeof(USERTHREAD_USEDESKTOPINFO)); 06184 if (pti == NULL) { 06185 Status = STATUS_INVALID_HANDLE; 06186 break; 06187 } 06188 06189 /* 06190 * If the caller provides a thread handle, then we use that 06191 * thread's pdesk and return the pdesk currently used 06192 * by the caller (set operation). Otherwise, 06193 * we use the pdesk provided by the caller (restore operation). 06194 */ 06195 hClientThread = ((PUSERTHREAD_USEDESKTOPINFO)ThreadInformation)->hThread; 06196 if (hClientThread != NULL) { 06197 Status = ObReferenceObjectByHandle(hClientThread, 06198 THREAD_QUERY_INFORMATION, 06199 *PsThreadType, 06200 UserMode, 06201 &ThreadClient, 06202 NULL); 06203 if (!NT_SUCCESS(Status)) 06204 break; 06205 06206 ptiT = PtiFromThread(ThreadClient); 06207 if ((ptiT == NULL) || (ptiT->rpdesk == NULL)) { 06208 Status = STATUS_INVALID_HANDLE; 06209 goto DerefClientThread; 06210 } 06211 Status = xxxSetCsrssThreadDesktop(ptiT->rpdesk, &((PUSERTHREAD_USEDESKTOPINFO)ThreadInformation)->drdRestore); 06212 } else { 06213 Status = xxxRestoreCsrssThreadDesktop(&((PUSERTHREAD_USEDESKTOPINFO)ThreadInformation)->drdRestore); 06214 } 06215 06216 06217 if (hClientThread != NULL) { 06218 DerefClientThread: 06219 ObDereferenceObject(ThreadClient); 06220 } 06221 break; 06222 06223 case UserThreadUseActiveDesktop: 06224 { 06225 UserAssert(ThreadInformationLength == sizeof(USERTHREAD_USEDESKTOPINFO)); 06226 if (pti == NULL || grpdeskRitInput == NULL) { 06227 Status = STATUS_INVALID_HANDLE; 06228 break; 06229 } 06230 Status = xxxSetCsrssThreadDesktop(grpdeskRitInput, 06231 &((PUSERTHREAD_USEDESKTOPINFO)ThreadInformation)->drdRestore); 06232 break; 06233 } 06234 case UserThreadCsrApiPort: 06235 06236 /* 06237 * Only CSR can call this 06238 */ 06239 if (Thread->ThreadsProcess != gpepCSRSS) { 06240 Status = STATUS_ACCESS_DENIED; 06241 break; 06242 } 06243 06244 UserAssert(ThreadInformationLength == sizeof(HANDLE)); 06245 06246 /* 06247 * Only set it once. 06248 */ 06249 if (CsrApiPort != NULL) 06250 break; 06251 06252 CsrPortHandle = *(PHANDLE)ThreadInformation; 06253 Status = ObReferenceObjectByHandle( 06254 CsrPortHandle, 06255 0, 06256 NULL, //*LpcPortObjectType, 06257 UserMode, 06258 &CsrApiPort, 06259 NULL); 06260 if (!NT_SUCCESS(Status)) { 06261 CsrApiPort = NULL; 06262 RIPMSG1(RIP_WARNING, 06263 "CSR port reference failed, Status=%#lx", 06264 Status); 06265 } 06266 06267 break; 06268 06269 default: 06270 Status = STATUS_INVALID_INFO_CLASS; 06271 UserAssert(FALSE); 06272 break; 06273 } 06274 06275 UnlockThread(Thread); 06276 06277 return Status; 06278 }

BOOL xxxSetInternalWindowPos PWND  pwnd,
UINT  cmdShow,
LPRECT  lprcWin,
LPPOINT  lpptMin
 

Definition at line 1054 of file kernel/winmgr.c.

References _MonitorFromRect(), BOOL, CheckLock, FALSE, tagCHECKPOINT::fDragged, tagCHECKPOINT::fMinInitialized, NULL, OffsetRect(), tagCHECKPOINT::ptMin, PUDF_ANIMATE, PWND_TOP, PWNDDESKTOP, tagMONITOR::rcMonitor, tagCHECKPOINT::rcNormal, tagMONITOR::rcWork, tagWND::spwndParent, TEST_PUDF, TestWF, TRUE, UpdateCheckpoint(), WFMAXIMIZED, WFMINIMIZED, xxxSetWindowPos(), and xxxShowWindow().

Referenced by NtUserSetInternalWindowPos().

01059 { 01060 CHECKPOINT * pcp; 01061 PMONITOR pMonitor; 01062 01063 CheckLock(pwnd); 01064 01065 if ((pcp = UpdateCheckpoint(pwnd)) == NULL) { 01066 return FALSE; 01067 } 01068 01069 if (lprcWin) { 01070 01071 pcp->rcNormal = *lprcWin; 01072 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 01073 pMonitor = _MonitorFromRect(lprcWin, MONITOR_DEFAULTTOPRIMARY); 01074 OffsetRect( 01075 &pcp->rcNormal, 01076 pMonitor->rcWork.left - pMonitor->rcMonitor.left, 01077 pMonitor->rcWork.top - pMonitor->rcMonitor.top); 01078 } 01079 } 01080 01081 if (lpptMin && (lpptMin->x != -1)) { 01082 01083 pcp->ptMin = *lpptMin; 01084 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 01085 pMonitor = _MonitorFromRect(&pcp->rcNormal, MONITOR_DEFAULTTOPRIMARY); 01086 pcp->ptMin.x += pMonitor->rcWork.left - pMonitor->rcMonitor.left; 01087 pcp->ptMin.y += pMonitor->rcWork.top - pMonitor->rcMonitor.top; 01088 } 01089 01090 pcp->fDragged = TRUE; 01091 pcp->fMinInitialized = TRUE; 01092 01093 } else { 01094 pcp->fMinInitialized = FALSE; 01095 pcp->fDragged = FALSE; 01096 } 01097 01098 if (TestWF(pwnd, WFMINIMIZED)) { 01099 01100 /* 01101 * need to move the icon 01102 */ 01103 if (pcp->fMinInitialized) { 01104 xxxSetWindowPos(pwnd, 01105 PWND_TOP, 01106 pcp->ptMin.x, 01107 pcp->ptMin.y, 01108 0, 01109 0, 01110 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 01111 } 01112 01113 } else if (!TestWF(pwnd, WFMAXIMIZED) && lprcWin) { 01114 /* 01115 * need to set the size and the position 01116 */ 01117 xxxSetWindowPos(pwnd, 01118 NULL, 01119 lprcWin->left, 01120 lprcWin->top, 01121 lprcWin->right - lprcWin->left, 01122 lprcWin->bottom - lprcWin->top, 01123 SWP_NOZORDER); 01124 } 01125 01126 xxxShowWindow(pwnd, MAKELONG(cmdShow, TEST_PUDF(PUDF_ANIMATE))); 01127 01128 return TRUE; 01129 }

HANDLE xxxSetLayeredWindow PWND  pwnd,
BOOL  fRepaintBehind
 

Definition at line 467 of file sprite.c.

References _UpdateLayeredWindow(), BEGINATOMICCHECK, CheckLock, ENDATOMICCHECK, FALSE, FTopLevel, gpDispInfo, tagDISPLAYINFO::hdcScreen, tagDISPLAYINFO::hDev, IDC_DEFAULT, IDC_NOMOUSE, NULL, PtoHq, tagWND::rcWindow, SetWF, TestWF, TrackLayeredZorder(), WEFLAYERED, WFVISIBLE, xxxRedrawWindow(), xxxUpdateWindows(), and zzzInvalidateDCCache().

Referenced by CreateFade(), xxxCreateWindowEx(), and xxxSetWindowStyle().

00468 { 00469 HANDLE hsprite; 00470 SIZE size; 00471 00472 CheckLock(pwnd); 00473 00474 #ifndef CHILD_LAYERING 00475 if (!FTopLevel(pwnd)) { 00476 RIPMSG1(RIP_WARNING, "xxxSetLayeredWindow: not top-level %X", pwnd); 00477 return NULL; 00478 } 00479 #endif // CHILD_LAYERING 00480 00481 #ifdef REDIRECTION 00482 /* 00483 * For now disallow making a layered window redirected and vice versa. 00484 * This is because we need to come up with a clear way to expose 00485 * layered attributes for redirected windows and also because we don't 00486 * know if the redirected bitmap was created for layered redirection 00487 * or redirection in itself. We would need to store a struct with 00488 * flags and the bitmap in the window property to keep track of that. 00489 */ 00490 if (TestWF(pwnd, WEFREDIRECTED)) 00491 return NULL; 00492 #endif // REDIRECTION 00493 00494 #if DBG 00495 if (TestWF(pwnd, WEFLAYERED)) { 00496 RIPMSG1(RIP_ERROR, "xxxSetLayeredWindow: already layered %X", pwnd); 00497 } 00498 #endif 00499 00500 size.cx = pwnd->rcWindow.right - pwnd->rcWindow.left; 00501 size.cy = pwnd->rcWindow.bottom - pwnd->rcWindow.top; 00502 00503 hsprite = GreCreateSprite(gpDispInfo->hDev, PtoHq(pwnd), &pwnd->rcWindow); 00504 if (hsprite == NULL) { 00505 RIPMSG1(RIP_WARNING, "xxxSetLayeredWindow failed %X", pwnd); 00506 return NULL; 00507 } 00508 00509 SetWF(pwnd, WEFLAYERED); 00510 TrackLayeredZorder(pwnd); 00511 00512 /* 00513 * Invalidate the DC cache because changing the sprite status 00514 * may change the visrgn for some windows. 00515 * 00516 * BUGBUG: should jiggle the mouse. Remove IDC_NOMOUSE when 00517 * SetFMouseMoved and thus InvalidateDCCache don't leave crit. 00518 */ 00519 BEGINATOMICCHECK(); 00520 zzzInvalidateDCCache(pwnd, IDC_DEFAULT | IDC_NOMOUSE); 00521 ENDATOMICCHECK(); 00522 00523 /* 00524 * For the dynamic promotion to a sprite, put the proper bits into 00525 * the sprite itself by doing ULW with the current screen content 00526 * and into the background by invalidating windows behind. There 00527 * might be some dirty bits if the window is partially obscured, but 00528 * they will be refreshed as soon as the app calls ULW on its own. 00529 */ 00530 if (TestWF(pwnd, WFVISIBLE)) { 00531 if (fRepaintBehind) { 00532 POINT pt; 00533 00534 pt.x = pwnd->rcWindow.left; 00535 pt.y = pwnd->rcWindow.top; 00536 00537 _UpdateLayeredWindow(pwnd, gpDispInfo->hdcScreen, &pt, &size, 00538 gpDispInfo->hdcScreen, &pt, 0, NULL, ULW_OPAQUE); 00539 } 00540 } else { 00541 /* 00542 * No need to repaint behind if the window is still invisible. 00543 */ 00544 fRepaintBehind = FALSE; 00545 } 00546 00547 /* 00548 * This must be done after the DC cache is invalidated, because 00549 * the xxxUpdateWindows call will redraw some stuff. 00550 */ 00551 if (fRepaintBehind) { 00552 HRGN hrgn = GreCreateRectRgnIndirect(&pwnd->rcWindow); 00553 xxxRedrawWindow(NULL, NULL, hrgn, RDW_INVALIDATE | RDW_FRAME | 00554 RDW_ERASE | RDW_ALLCHILDREN); 00555 xxxUpdateWindows(pwnd, hrgn); 00556 GreDeleteObject(hrgn); 00557 } 00558 return hsprite; 00559 }

BOOL xxxSetMenu PWND  pwnd,
PMENU  pmenu,
BOOL  fRedraw
 

Definition at line 27 of file mnapi.c.

References BOOL, CheckLock, FALSE, LockWndMenu(), tagWND::spmenu, TestWF, TestwndChild, TRUE, WFMINIMIZED, and xxxRedrawFrame().

Referenced by NtUserSetMenu().

00031 { 00032 CheckLock(pwnd); 00033 CheckLock(pMenu); 00034 00035 if (!TestwndChild(pwnd)) { 00036 00037 LockWndMenu(pwnd, &pwnd->spmenu, pMenu); 00038 00039 /* 00040 * only redraw the frame if the window is non-minimized -- 00041 * even if it's not visible, we need RedrawFrame to recalc the NC size 00042 * 00043 * Added a check for (redraw) since the MDISetMenu() only needs to 00044 * set the menu and not perform any redraws. 00045 */ 00046 if (!TestWF(pwnd, WFMINIMIZED) && fRedraw) 00047 xxxRedrawFrame(pwnd); 00048 00049 return TRUE; 00050 } 00051 00052 RIPERR0(ERROR_CHILD_WINDOW_MENU, RIP_VERBOSE, ""); 00053 return FALSE; 00054 }

BOOL xxxSetMenuInfo PMENU  pMenu,
LPCMENUINFO  lpmi
 

Definition at line 204 of file mnchange.c.

References BOOL, CheckLock, tagMENU::cItems, tagMENU::cxMenu, tagMENU::cyMax, tagMENU::cyMenu, tagMENU::dwArrowsOn, tagMENU::dwContextHelpId, tagMENU::dwMenuData, FALSE, tagMENU::fFlags, tagMENU::hbrBack, MNGetPopupFromMenu(), MNUS_DEFAULT, MNUS_DRAWFRAME, MSA_OFF, NULL, tagMENU::rgItems, tagITEM::spSubMenu, ThreadLock, ThreadUnlock, TRUE, UINT, and xxxMNUpdateShownMenu().

Referenced by NtUserThunkedMenuInfo().

00205 { 00206 PPOPUPMENU ppopup; 00207 BOOL fRecompute = FALSE; 00208 BOOL fRedraw = FALSE; 00209 UINT uFlags = MNUS_DEFAULT; 00210 PITEM pItem; 00211 UINT uItems; 00212 TL tlSubMenu; 00213 00214 CheckLock(pMenu); 00215 00216 if (lpmi->fMask & MIM_STYLE) { 00217 pMenu->fFlags ^= (pMenu->fFlags ^ lpmi->dwStyle) & MNS_VALID; 00218 fRecompute = TRUE; 00219 } 00220 00221 if (lpmi->fMask & MIM_MAXHEIGHT) { 00222 pMenu->cyMax = lpmi->cyMax; 00223 fRecompute = TRUE; 00224 } 00225 00226 if (lpmi->fMask & MIM_BACKGROUND) { 00227 pMenu->hbrBack = lpmi->hbrBack; 00228 fRedraw = TRUE; 00229 if (pMenu->dwArrowsOn != MSA_OFF) { 00230 uFlags |= MNUS_DRAWFRAME; 00231 } 00232 } 00233 00234 if (lpmi->fMask & MIM_HELPID) { 00235 pMenu->dwContextHelpId = lpmi->dwContextHelpID; 00236 } 00237 00238 if (lpmi->fMask & MIM_MENUDATA) { 00239 pMenu->dwMenuData = lpmi->dwMenuData; 00240 } 00241 00242 /* 00243 * Do we need to set this for all submenus? 00244 */ 00245 if (lpmi->fMask & MIM_APPLYTOSUBMENUS) { 00246 pItem = pMenu->rgItems; 00247 for (uItems = pMenu->cItems; uItems--; pItem++) { 00248 if (pItem->spSubMenu != NULL) { 00249 ThreadLock(pItem->spSubMenu, &tlSubMenu); 00250 xxxSetMenuInfo(pItem->spSubMenu, lpmi); 00251 ThreadUnlock(&tlSubMenu); 00252 } 00253 } 00254 } 00255 00256 00257 if (fRecompute) { 00258 // Set the size of this menu to be 0 so that it gets recomputed with this 00259 // new item... 00260 pMenu->cyMenu = pMenu->cxMenu = 0; 00261 } 00262 00263 if (fRecompute || fRedraw) { 00264 if (ppopup = MNGetPopupFromMenu(pMenu, NULL)) { 00265 // this menu is currently being displayed -- redisplay the menu, 00266 // recomputing if necessary 00267 xxxMNUpdateShownMenu(ppopup, NULL, uFlags); 00268 } 00269 } 00270 00271 return TRUE; 00272 }

BOOL xxxSetMenuItemInfo PMENU  pMenu,
UINT  nPos,
BOOL  fByPosition,
LPMENUITEMINFOW  lpmii,
PUNICODE_STRING  pstrItem
 

Definition at line 146 of file mnchange.c.

References BOOL, CheckLock, FALSE, MakeMenuRtoL(), MFRTL, MNLookUpItem(), NULL, TestMF, TRUE, and xxxSetLPITEMInfo().

Referenced by NtUserThunkedMenuItemInfo().

00152 { 00153 00154 PITEM pItem; 00155 00156 CheckLock(pMenu); 00157 00158 pItem = MNLookUpItem(pMenu, wIndex, fByPosition,NULL); 00159 if (pItem == NULL) { 00160 /* 00161 * Word doesn't like not finding SC_TASKLIST -- so it that's what 00162 * they're looking for, let's pretend we changed it. 00163 */ 00164 if (!fByPosition && (wIndex == SC_TASKLIST)) 00165 return TRUE; 00166 00167 /* 00168 * Item not found. Return false. 00169 */ 00170 RIPERR0(ERROR_MENU_ITEM_NOT_FOUND, RIP_WARNING, "ModifyMenu: Menu item not found"); 00171 return FALSE; 00172 } 00173 /* 00174 * we need to treat MFT_RIGHTORDER separately as this is propogated down 00175 * to the entire menu not just to this item so that we stay in ssync. This 00176 * is pretty similar to the use of MFT_RIGHTJUST, we actually do the 00177 * propogation because we need the flag in all sorts of places, not just 00178 * in MBC_RightJustifyMenu() 00179 */ 00180 00181 /* 00182 * See ValidateMENUITEMINFO in client\clmenu.c will add more flags to fMask if it use to be MIIM_TYPE 00183 * Then fMask will not be any more == MIIM_TYPE. 00184 */ 00185 00186 if (lpmii->fMask & MIIM_TYPE) { 00187 BOOL bRtoL = (lpmii->fType & MFT_RIGHTORDER) ? TRUE : FALSE; 00188 00189 if (bRtoL || TestMF(pMenu, MFRTL)) { 00190 MakeMenuRtoL(pMenu, bRtoL); 00191 } 00192 } 00193 return xxxSetLPITEMInfo(pMenu, pItem, lpmii, pstrItem); 00194 }

BOOL xxxSetNCFonts PUNICODE_STRING  pProfileUserName,
LPNONCLIENTMETRICS  lpnc
 

Definition at line 861 of file inctlpan.c.

References BOOL, DU_BTNWIDTH, FALSE, gcxCaptionFontChar, gcxMenuFontChar, gcxMenuFontOverhang, gcxSmCaptionFontChar, gcyCaptionFontChar, gcyMenuFontAscent, gcyMenuFontChar, gcyMenuFontExternLeading, gcyMenuScrollArrow, gcySmCaptionFontChar, GetCharDimensions(), ghFontSys, ghMenuFont, ghMenuFontDef, ghSmCaptionFont, ghStatusFont, gMenuState, gpsi, HDCBITS, lf, max, NULL, SYSMET, TRUE, UINT, UserSetFont(), tagSERVERINFO::wMaxBtnSize, XPixFromXDU, and xxxMB_FindLongestString().

Referenced by xxxSetWindowNCMetrics().

00864 { 00865 HFONT hOldFont; 00866 TEXTMETRIC tm; 00867 LOGFONTW lf; 00868 LPLOGFONTW lplf = (lpnc) ? &lf : 0; 00869 00870 /* 00871 * Caption font 00872 */ 00873 if (lplf) { 00874 *lplf = lpnc->lfCaptionFont; 00875 } 00876 00877 if (!UserSetFont(pProfileUserName,lplf, STR_CAPTIONFONT, &gpsi->hCaptionFont)) { 00878 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for gpsi->hCaptionFont"); 00879 return FALSE; 00880 } 00881 00882 hOldFont = GreSelectFont(HDCBITS(), gpsi->hCaptionFont); 00883 gcxCaptionFontChar = GetCharDimensions( 00884 HDCBITS(), NULL, &gcyCaptionFontChar); 00885 00886 /* 00887 * Small caption font 00888 */ 00889 if (lplf) { 00890 *lplf = lpnc->lfSmCaptionFont; 00891 } 00892 00893 if (!UserSetFont(pProfileUserName,lplf, STR_SMCAPTIONFONT, &ghSmCaptionFont)) { 00894 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghSmCaptionFont"); 00895 return FALSE; 00896 } 00897 00898 GreSelectFont(HDCBITS(), ghSmCaptionFont); 00899 gcxSmCaptionFontChar = GetCharDimensions( 00900 HDCBITS(), NULL, &gcySmCaptionFontChar); 00901 00902 /* 00903 * Menu font 00904 */ 00905 if (lplf) { 00906 *lplf = lpnc->lfMenuFont; 00907 } 00908 00909 if (!UserSetFont(pProfileUserName,lplf, STR_MENUFONT, &ghMenuFont)) { 00910 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghMenuFont"); 00911 return FALSE; 00912 } 00913 00914 /* 00915 * if ghMenuFont is selected in cached animation DC, select the new one. 00916 */ 00917 if (gMenuState.hdcAni != NULL) { 00918 GreSelectFont(gMenuState.hdcAni, ghMenuFont); 00919 } 00920 00921 GreSelectFont(HDCBITS(), ghMenuFont); 00922 gcxMenuFontChar = GetCharDimensions( 00923 HDCBITS(), &tm, &gcyMenuFontChar); 00924 gcxMenuFontOverhang = tm.tmOverhang; 00925 00926 gcyMenuFontExternLeading = tm.tmExternalLeading; 00927 gcyMenuScrollArrow = gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYEDGE); 00928 gcyMenuFontAscent = tm.tmAscent; 00929 00930 /* 00931 * We only use gcyMenuFontAscent in mndraw.c once, and in U.S. we 00932 * always add on CYBORDER! So calculate gcyMenuFontAscent+CYBORDER 00933 * once only. 00934 * Legacy NT4: For Korean version, don't add it on; the underline would 00935 * be too low. 00936 * NT5: according to #254327, Korean version now sees underline is 00937 * too close to menu strings. Korean hack is pulled out so. 00938 */ 00939 gcyMenuFontAscent += SYSMET(CYBORDER); 00940 00941 /* 00942 * Default menu item font: bolder version of menu font 00943 */ 00944 00945 /* 00946 * Create default menu font by bolding hMenuFont. If this doesn't 00947 * work, then fall back to using simulation. 00948 */ 00949 if (ghMenuFontDef != NULL && ghMenuFontDef != ghFontSys) { 00950 GreMarkDeletableFont(ghMenuFontDef); 00951 GreDeleteObject(ghMenuFontDef); 00952 ghMenuFontDef = NULL; 00953 } 00954 00955 GreExtGetObjectW(ghMenuFont, sizeof(LOGFONTW), &lf); 00956 if (lf.lfWeight < FW_BOLD) { 00957 lf.lfWeight += 200; 00958 00959 ghMenuFontDef = GreCreateFontIndirectW(&lf); 00960 if (ghMenuFontDef) { 00961 GreMarkUndeletableFont(ghMenuFontDef); 00962 GreSetLFONTOwner((HLFONT)ghMenuFontDef, OBJECT_OWNER_PUBLIC); 00963 } 00964 } 00965 00966 /* 00967 * Status Bar font 00968 */ 00969 if (lplf) { 00970 *lplf = lpnc->lfStatusFont; 00971 } 00972 00973 if (!UserSetFont(pProfileUserName,lplf, STR_STATUSFONT, &ghStatusFont)) { 00974 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghStatusFont"); 00975 return FALSE; 00976 } 00977 00978 /* 00979 * Message Box font 00980 */ 00981 if (lplf) { 00982 *lplf = lpnc->lfMessageFont; 00983 } 00984 00985 if (!UserSetFont(pProfileUserName,lplf, STR_MESSAGEFONT, &gpsi->hMsgFont)) { 00986 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for gpsi->hMsgFont"); 00987 return FALSE; 00988 } 00989 00990 GreSelectFont(HDCBITS(), gpsi->hMsgFont); 00991 gpsi->cxMsgFontChar = GetCharDimensions( 00992 HDCBITS(), NULL, &gpsi->cyMsgFontChar); 00993 00994 /* 00995 * Recalculate length of the widest MessageBox button 00996 * Make sure the width is no less than DU_BTNWIDTH dialog units MCostea #170582 00997 */ 00998 gpsi->wMaxBtnSize = max((UINT)XPixFromXDU(DU_BTNWIDTH, gpsi->cxMsgFontChar), 00999 xxxMB_FindLongestString(HDCBITS())); 01000 GreSelectFont(HDCBITS(), hOldFont); 01001 01002 return TRUE; 01003 }

PWND xxxSetParent PWND  pwnd,
PWND  pwndNewParent
 

Definition at line 311 of file kernel/winmgr.c.

References _GetDesktopWindow(), _ScreenToClient(), BOOL, CalcForegroundInsertAfter(), CheckLock, FALSE, FWINABLE, GETPTI, IDC_DEFAULT, LinkWindow(), Lock, NULL, PUDF_ANIMATE, PWNDDESKTOP, PWNDMESSAGE, tagWND::rcWindow, SetWF, tagWND::spwndOwner, tagWND::spwndParent, TEST_PUDF, TestWF, TestwndChild, ThreadLock, ThreadUnlock, TRUE, UnlinkWindow(), ValidateParentDepth(), WEF_USEPWNDTHREAD, WEFTOPMOST, WFCHILD, WFCLIPSIBLINGS, WFDESTROYED, xxxSetWindowPos(), xxxShowWindow(), xxxWindowEvent(), zzzAttachThreadInput(), and zzzInvalidateDCCache().

Referenced by NtUserSetParent(), xxxCleanupDesktopMenu(), xxxMNOpenHierarchy(), xxxResetTooltip(), xxxSetWindowData(), and xxxTooltipHandleTimer().

00314 { 00315 POINT pt; 00316 BOOL fVisible; 00317 PWND pwndOldParent; 00318 TL tlpwndOldParent; 00319 TL tlpwndNewParent; 00320 PVOID pvRet; 00321 PWND pwndDesktop; 00322 PWND pwndT; 00323 int flags = SWP_NOZORDER | SWP_NOSIZE; 00324 00325 CheckLock(pwnd); 00326 CheckLock(pwndNewParent); 00327 00328 if (!ValidateParentDepth(pwnd, pwndNewParent)) { 00329 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Exceeded nested children limit"); 00330 return NULL; 00331 } 00332 00333 pwndDesktop = PWNDDESKTOP(pwnd); 00334 00335 /* 00336 * In 1.0x, an app's parent was null, but now it is pwndDesktop. 00337 * Need to remember to lock pwndNewParent because we're reassigning 00338 * it here. 00339 */ 00340 if (pwndNewParent == NULL) 00341 pwndNewParent = pwndDesktop; 00342 00343 /* 00344 * Don't ever change the parent of the desktop. 00345 */ 00346 if ((pwnd == pwndDesktop) || (pwnd == PWNDMESSAGE(pwnd))) { 00347 RIPERR0(ERROR_ACCESS_DENIED, 00348 RIP_WARNING, 00349 "Access denied: can't change parent of the desktop"); 00350 00351 return NULL; 00352 } 00353 00354 /* 00355 * Don't let the window become its own parent, grandparent, etc. 00356 */ 00357 for (pwndT = pwndNewParent; pwndT != NULL; pwndT = pwndT->spwndParent) { 00358 00359 if (pwnd == pwndT) { 00360 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, 00361 "Attempting to creating a parent-child relationship loop"); 00362 return NULL; 00363 } 00364 } 00365 00366 /* 00367 * We still need pwndNewParent across callbacks... and even though 00368 * it was passed in, it may have been reassigned above. 00369 */ 00370 ThreadLock(pwndNewParent, &tlpwndNewParent); 00371 00372 /* 00373 * Make the thing disappear from original parent. 00374 */ 00375 fVisible = xxxShowWindow(pwnd, MAKELONG(SW_HIDE, TEST_PUDF(PUDF_ANIMATE))); 00376 00377 /* 00378 * Ensure that the window being changed and the new parent 00379 * are not in a destroyed state. 00380 * 00381 * IMPORTANT: After this check, do not leave the critical section 00382 * until the window links have been rearranged. 00383 */ 00384 if (TestWF(pwnd, WFDESTROYED) || TestWF(pwndNewParent, WFDESTROYED)) { 00385 ThreadUnlock(&tlpwndNewParent); 00386 return NULL; 00387 } 00388 00389 pwndOldParent = pwnd->spwndParent; 00390 ThreadLock(pwndOldParent, &tlpwndOldParent); 00391 00392 #ifdef USE_MIRRORING 00393 if (TestWF(pwndOldParent, WEFLAYOUTRTL)) { 00394 pt.x = pwnd->rcWindow.right; 00395 } else 00396 #endif 00397 { 00398 pt.x = pwnd->rcWindow.left; 00399 } 00400 pt.y = pwnd->rcWindow.top; 00401 _ScreenToClient(pwndOldParent, &pt); 00402 00403 UnlinkWindow(pwnd, pwndOldParent); 00404 Lock(&pwnd->spwndParent, pwndNewParent); 00405 00406 if (pwndNewParent == PWNDDESKTOP(pwnd) && !TestWF(pwnd, WEFTOPMOST)) { 00407 00408 /* 00409 * Make sure a child who's owner is topmost inherits the topmost 00410 * bit. - win31 bug 7568 00411 */ 00412 if (TestWF(pwnd, WFCHILD) && 00413 (pwnd->spwndOwner) && 00414 TestWF(pwnd->spwndOwner, WEFTOPMOST)) { 00415 00416 SetWF(pwnd, WEFTOPMOST); 00417 } 00418 00419 /* 00420 * BACKWARD COMPATIBILITY HACK ALERT 00421 * 00422 * All top level windows must be WS_CLIPSIBLINGs bit set. 00423 * The SDM ComboBox() code calls SetParent() with a listbox 00424 * window that does not have this set. This causes problems 00425 * with InternalInvalidate2() because it does not subtract off 00426 * the window from the desktop's update region. 00427 * 00428 * We must invalidate the DC cache here, too, because if there is 00429 * a cache entry lying around, its clipping region will be incorrect. 00430 */ 00431 if ((pwndNewParent == _GetDesktopWindow()) && 00432 !TestWF(pwnd, WFCLIPSIBLINGS)) { 00433 00434 SetWF(pwnd, WFCLIPSIBLINGS); 00435 zzzInvalidateDCCache(pwnd, IDC_DEFAULT); 00436 } 00437 00438 /* 00439 * This is a top level window but it isn't a topmost window so we 00440 * have to link it below all topmost windows. 00441 */ 00442 LinkWindow(pwnd, 00443 CalcForegroundInsertAfter(pwnd), 00444 pwndNewParent); 00445 } else { 00446 00447 /* 00448 * If this is a child window or if this is a TOPMOST window, we can 00449 * link at the head of the parent chain. 00450 */ 00451 LinkWindow(pwnd, NULL, pwndNewParent); 00452 } 00453 00454 /* 00455 * If we're a child window, do any necessary attaching and 00456 * detaching. 00457 */ 00458 if (TestwndChild(pwnd)) { 00459 00460 /* 00461 * Make sure we're not a WFCHILD window that got SetParent()'ed 00462 * to the desktop. 00463 */ 00464 if ((pwnd->spwndParent != PWNDDESKTOP(pwnd)) && 00465 GETPTI(pwnd) != GETPTI(pwndOldParent)) { 00466 00467 zzzAttachThreadInput(GETPTI(pwnd), GETPTI(pwndOldParent), FALSE); 00468 } 00469 00470 /* 00471 * If the new parent window is on a different thread, and also 00472 * isn't the desktop window, attach ourselves appropriately. 00473 */ 00474 if (pwndNewParent != PWNDDESKTOP(pwnd) && 00475 GETPTI(pwnd) != GETPTI(pwndNewParent)) { 00476 00477 zzzAttachThreadInput(GETPTI(pwnd), GETPTI(pwndNewParent), TRUE); 00478 } 00479 } 00480 00481 if (pwndNewParent == PWNDMESSAGE(pwnd) || pwndOldParent == PWNDMESSAGE(pwnd)) 00482 flags |= SWP_NOACTIVATE; 00483 00484 if (FWINABLE()) { 00485 xxxWindowEvent(EVENT_OBJECT_PARENTCHANGE, pwnd, OBJID_WINDOW, 00486 INDEXID_CONTAINER, WEF_USEPWNDTHREAD); 00487 } 00488 00489 /* 00490 * We mustn't return an invalid pwndOldParent 00491 */ 00492 xxxSetWindowPos(pwnd, NULL, pt.x, pt.y, 0, 0, flags); 00493 00494 if (fVisible) { 00495 xxxShowWindow(pwnd, MAKELONG(SW_SHOWNORMAL, TEST_PUDF(PUDF_ANIMATE))); 00496 } 00497 00498 /* 00499 * returns pwndOldParent if still valid, else NULL. 00500 */ 00501 pvRet = ThreadUnlock(&tlpwndOldParent); 00502 ThreadUnlock(&tlpwndNewParent); 00503 00504 return pvRet; 00505 }

BOOL xxxSetProcessWindowStation HWINSTA  ,
KPROCESSOR_MODE 
 

Definition at line 1077 of file winsta.c.

References tagPROCESSINFO::amwinsta, BOOL, tagWINDOWSTATION::dwWSF_Flags, ExWindowStationObjectType, FALSE, _OBJECT_HANDLE_INFORMATION::GrantedAccess, HF_PROTECTED, tagPROCESSINFO::hwinsta, LockWinSta, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PpiFromProcess, PsGetCurrentProcess, PsGetCurrentThread, tagPROCESSINFO::rpwinsta, RtlAreAllAccessesGranted(), SetHandleFlag(), Status, THREAD_TO_PROCESS, TRUE, _EPROCESS::Win32WindowStation, WSF_NOIO, and xxxUserDuplicateObject().

Referenced by NtUserSetProcessWindowStation(), and xxxCreateThreadInfo().

01080 { 01081 PETHREAD Thread = PsGetCurrentThread(); 01082 PEPROCESS Process = PsGetCurrentProcess(); 01083 HWINSTA hwinstaDup; 01084 NTSTATUS Status; 01085 PPROCESSINFO ppi; 01086 PWINDOWSTATION pwinsta; 01087 PWINDOWSTATION pwinstaOld; 01088 OBJECT_HANDLE_INFORMATION ohi; 01089 OBJECT_HANDLE_INFORMATION ohiOld; 01090 01091 if (Process == NULL) { 01092 UserAssert(Process); 01093 return FALSE; 01094 } 01095 01096 if (Thread == NULL) { 01097 UserAssert(Thread); 01098 return FALSE; 01099 } 01100 01101 ppi = PpiFromProcess(THREAD_TO_PROCESS(Thread)); 01102 01103 if (!NT_SUCCESS(ObReferenceObjectByHandle( 01104 hwinsta, 01105 0, 01106 *ExWindowStationObjectType, 01107 AccessMode, 01108 &pwinsta, 01109 &ohi))) { 01110 return FALSE; 01111 } 01112 01113 /* 01114 * Bug 38780. Lock the handle to window station so that an app cannot free the 01115 * this handle by calling GetProcessWindowStation() & CloseHandle() 01116 */ 01117 01118 /* 01119 * Unprotect the old hwinsta 01120 */ 01121 if (ppi->hwinsta) { 01122 SetHandleFlag(ppi->hwinsta, HF_PROTECTED, FALSE); 01123 } 01124 01125 /* 01126 * Save the WindowStation information 01127 */ 01128 LockWinSta(&ppi->rpwinsta, pwinsta); 01129 ObDereferenceObject(pwinsta); 01130 ppi->hwinsta = hwinsta; 01131 01132 /* 01133 * Protect the new Window Station Handle 01134 */ 01135 SetHandleFlag(ppi->hwinsta, HF_PROTECTED, TRUE); 01136 01137 /* 01138 * Check the old Atom Manager WindowStation to see if we are 01139 * changing this process' WindowStation. 01140 */ 01141 if (Process->Win32WindowStation) { 01142 /* 01143 * Get a pointer to the old WindowStation object to see if it's 01144 * the same WindowStation that we are setting. 01145 */ 01146 Status = ObReferenceObjectByHandle( 01147 Process->Win32WindowStation, 01148 0, 01149 *ExWindowStationObjectType, 01150 AccessMode, 01151 &pwinstaOld, 01152 &ohiOld); 01153 if (NT_SUCCESS(Status)) { 01154 /* 01155 * Are they different WindowStations? If so, NULL out the 01156 * atom manager cache so we will reset it below. 01157 */ 01158 if (pwinsta != pwinstaOld) { 01159 ZwClose(Process->Win32WindowStation); 01160 Process->Win32WindowStation = NULL; 01161 } 01162 ObDereferenceObject(pwinstaOld); 01163 01164 } else { 01165 /* 01166 * Their Atom Manager handle is bad? Give them a new one. 01167 */ 01168 Process->Win32WindowStation = NULL; 01169 #if DBG 01170 RIPMSG2(RIP_WARNING, 01171 "SetProcessWindowStation: Couldn't reference old WindowStation (0x%X) Status=0x%X", 01172 Process->Win32WindowStation, 01173 Status); 01174 #endif 01175 } 01176 } 01177 01178 /* 01179 * Duplicate the WindowStation handle and stash it in the atom 01180 * manager's cache (Process->Win32WindowStation). We duplicate 01181 * the handle in case 01182 */ 01183 if (Process->Win32WindowStation == NULL) { 01184 Status = xxxUserDuplicateObject( 01185 NtCurrentProcess(), 01186 hwinsta, 01187 NtCurrentProcess(), 01188 &hwinstaDup, 01189 0, 01190 0, 01191 DUPLICATE_SAME_ACCESS); 01192 01193 if (NT_SUCCESS(Status)) { 01194 Process->Win32WindowStation = hwinstaDup; 01195 } 01196 #if DBG 01197 else { 01198 RIPMSG2(RIP_WARNING, 01199 "SetProcessWindowStation: Couldn't duplicate WindowStation handle (0x%X) Status=0x%X", 01200 hwinsta, 01201 Status); 01202 } 01203 #endif 01204 } 01205 01206 ppi->amwinsta = ohi.GrantedAccess; 01207 01208 /* 01209 * Cache WSF_NOIO flag in the W32PROCESS so that GDI can access it. 01210 */ 01211 if (pwinsta->dwWSF_Flags & WSF_NOIO) { 01212 ppi->W32PF_Flags &= ~W32PF_IOWINSTA; 01213 } else { 01214 ppi->W32PF_Flags |= W32PF_IOWINSTA; 01215 } 01216 01217 /* 01218 * Do the access check now for readscreen so that 01219 * blts off of the display will be as fast as possible. 01220 */ 01221 if (RtlAreAllAccessesGranted(ohi.GrantedAccess, WINSTA_READSCREEN)) { 01222 ppi->W32PF_Flags |= W32PF_READSCREENACCESSGRANTED; 01223 } else { 01224 ppi->W32PF_Flags &= ~W32PF_READSCREENACCESSGRANTED; 01225 } 01226 01227 return TRUE; 01228 }

LONG xxxSetScrollBar PWND  pwnd,
int  code,
LPSCROLLINFO  lpsi,
BOOL  fRedraw
 

Definition at line 1316 of file sbctl.c.

References _InitPwSB(), BOOL, CheckLock, ClrWF, DesktopFree, FALSE, tagSBTRACK::fTrackRecalc, tagSBTRACK::fTrackVert, FWINABLE, GETPTI, tagWND::head, tagSBINFO::Horz, IsVisible(), IsWinEventNotifyDeferredOK, NULL, tagSBDATA::posMax, tagSBDATA::posMin, tagWND::pSBInfo, PWNDTOPSBTRACK, SBSetParms(), SetWF, tagSBTRACK::spwndTrack, TestWF, TIF_16BIT, TRUE, tagSBINFO::Vert, WEF_USEPWNDTHREAD, WFHPRESENT, WFHSCROLL, WFVPRESENT, WFVSCROLL, xxxDrawThumb(), xxxEnableWndSBArrows(), tagSBTRACK::xxxpfnSB, xxxRedrawFrame(), xxxSendMessage(), xxxTrackThumb(), and xxxWindowEvent().

Referenced by NtUserSetScrollInfo().

01321 { 01322 BOOL fVert; 01323 PSBDATA pw; 01324 PSBINFO pSBInfo; 01325 BOOL fOldScroll; 01326 BOOL fScroll; 01327 WORD wfScroll; 01328 LONG lres; 01329 BOOL fNewScroll; 01330 01331 CheckLock(pwnd); 01332 UserAssert(IsWinEventNotifyDeferredOK()); 01333 01334 if (fRedraw) 01335 // window must be visible to redraw 01336 fRedraw = IsVisible(pwnd); 01337 01338 if (code == SB_CTL) 01339 #ifdef FE_SB // xxxSetScrollBar() 01340 // scroll bar control; send the control a message 01341 if(GETPTI(pwnd)->TIF_flags & TIF_16BIT) { 01342 // 01343 // If the target application is 16bit apps, we don't pass win40's message. 01344 // This fix for Ichitaro v6.3. It eats the message. It never forwards 01345 // the un-processed messages to original windows procedure via 01346 // CallWindowProc(). 01347 // 01348 // Is this from xxxSetScrollPos() ? 01349 if(lpsi->fMask == (SIF_POS|SIF_RETURNOLDPOS)) { 01350 return (int)xxxSendMessage(pwnd, SBM_SETPOS, lpsi->nPos, fRedraw); 01351 // Is this from xxxSetScrollRange() ? 01352 } else if(lpsi->fMask == SIF_RANGE) { 01353 xxxSendMessage(pwnd, SBM_SETRANGE, lpsi->nMin, lpsi->nMax); 01354 return TRUE; 01355 // Others... 01356 } else { 01357 return (LONG)xxxSendMessage(pwnd, SBM_SETSCROLLINFO, (WPARAM) fRedraw, (LPARAM) lpsi); 01358 } 01359 } else { 01360 return (LONG)xxxSendMessage(pwnd, SBM_SETSCROLLINFO, (WPARAM) fRedraw, (LPARAM) lpsi); 01361 } 01362 #else 01363 // scroll bar control; send the control a message 01364 return (LONG)xxxSendMessage(pwnd, SBM_SETSCROLLINFO, (WPARAM) fRedraw, (LPARAM) lpsi); 01365 #endif // FE_SB 01366 01367 fVert = (code != SB_HORZ); 01368 01369 wfScroll = (fVert) ? WFVSCROLL : WFHSCROLL; 01370 01371 fScroll = fOldScroll = (TestWF(pwnd, wfScroll)) ? TRUE : FALSE; 01372 01373 /* 01374 * Don't do anything if we're setting position of a nonexistent scroll bar. 01375 */ 01376 if (!(lpsi->fMask & SIF_RANGE) && !fOldScroll && (pwnd->pSBInfo == NULL)) { 01377 RIPERR0(ERROR_NO_SCROLLBARS, RIP_VERBOSE, ""); 01378 return 0; 01379 } 01380 01381 if (fNewScroll = !(pSBInfo = pwnd->pSBInfo)) { 01382 if ((pSBInfo = _InitPwSB(pwnd)) == NULL) 01383 return 0; 01384 } 01385 01386 pw = (fVert) ? &(pSBInfo->Vert) : &(pSBInfo->Horz); 01387 01388 if (!SBSetParms(pw, lpsi, &fScroll, &lres) && !fNewScroll) { 01389 // no change -- but if REDRAW is specified and there's a scrollbar, 01390 // redraw the thumb 01391 if (fOldScroll && fRedraw) 01392 goto redrawAfterSet; 01393 01394 return lres; 01395 } 01396 01397 ClrWF(pwnd, wfScroll); 01398 01399 if (fScroll) 01400 SetWF(pwnd, wfScroll); 01401 else if (!TestWF(pwnd, (WFHSCROLL | WFVSCROLL))) { 01402 // if neither scroll bar is set and both ranges are 0, then free up the 01403 // scroll info 01404 01405 pSBInfo = pwnd->pSBInfo; 01406 01407 if ((pSBInfo->Horz.posMin == pSBInfo->Horz.posMax) && 01408 (pSBInfo->Vert.posMin == pSBInfo->Vert.posMax)) { 01409 DesktopFree(pwnd->head.rpdesk, (HANDLE)(pwnd->pSBInfo)); 01410 pwnd->pSBInfo = NULL; 01411 } 01412 } 01413 01414 if (lpsi->fMask & SIF_DISABLENOSCROLL) { 01415 if (fOldScroll) { 01416 SetWF(pwnd, wfScroll); 01417 xxxEnableWndSBArrows(pwnd, code, (fScroll) ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH); 01418 } 01419 } else if (fOldScroll ^ fScroll) { 01420 PSBTRACK pSBTrack = PWNDTOPSBTRACK(pwnd); 01421 if (pSBTrack && (pwnd == pSBTrack->spwndTrack)) { 01422 pSBTrack->fTrackRecalc = TRUE; 01423 } 01424 xxxRedrawFrame(pwnd); 01425 // Note: after xxx, pSBTrack may no longer be valid (but we return now) 01426 return lres; 01427 } 01428 01429 if (fScroll && fRedraw && (fVert ? TestWF(pwnd, WFVPRESENT) : TestWF(pwnd, WFHPRESENT))) { 01430 PSBTRACK pSBTrack; 01431 redrawAfterSet: 01432 if (FWINABLE()) { 01433 xxxWindowEvent(EVENT_OBJECT_VALUECHANGE, pwnd, (fVert ? OBJID_VSCROLL : OBJID_HSCROLL), 01434 INDEX_SCROLLBAR_SELF, WEF_USEPWNDTHREAD); 01435 } 01436 pSBTrack = PWNDTOPSBTRACK(pwnd); 01437 // Bail out if the caller is trying to change the position of 01438 // a scrollbar that is in the middle of tracking. We'll hose 01439 // TrackThumb() otherwise. 01440 01441 if (pSBTrack && (pwnd == pSBTrack->spwndTrack) && 01442 ((BOOL)(pSBTrack->fTrackVert) == fVert) && 01443 (pSBTrack->xxxpfnSB == xxxTrackThumb)) { 01444 return lres; 01445 } 01446 01447 xxxDrawThumb(pwnd, NULL, fVert); 01448 // Note: after xxx, pSBTrack may no longer be valid (but we return now) 01449 } 01450 01451 return lres; 01452 }

BOOL xxxSetShellWindow PWND  pwnd,
PWND  pwndBkGnd
 

Definition at line 97 of file miscutil.c.

References _RegisterHotKey(), BOOL, FALSE, GETDESKINFO, GETPTI, Lock, NULL, tagDESKTOPINFO::ppiShellProcess, PtiCurrent, PWND_BOTTOM, SetWF, tagDESKTOPINFO::spwndBkGnd, tagWND::spwndOwner, tagDESKTOPINFO::spwndShell, TestWF, TestwndChild, TRUE, WEFTOPMOST, WFBOTTOMMOST, and xxxSetWindowPos().

Referenced by NtUserSetShellWindowEx().

00098 { 00099 PTHREADINFO ptiCurrent = PtiCurrent(); 00100 PDESKTOPINFO pdeskinfo = GETDESKINFO(ptiCurrent); 00101 00102 PPROCESSINFO ppiShellProcess; 00103 00104 UserAssert(pwnd); 00105 00106 /* 00107 * Fail the call if another shell window exists 00108 */ 00109 if (pdeskinfo->spwndShell != NULL) 00110 return(FALSE); 00111 00112 /* 00113 * The shell window must be 00114 * (1) Top-level 00115 * (2) Unowned 00116 * (3) Not topmost 00117 */ 00118 if (TestwndChild(pwnd) || 00119 (pwnd->spwndOwner != NULL) || 00120 TestWF(pwnd, WEFTOPMOST)) { 00121 00122 RIPMSG0(RIP_WARNING, "xxxSetShellWindow: Invalid type of window"); 00123 return(FALSE); 00124 } 00125 00126 /* 00127 * Chicago has a totally different input model which has special code 00128 * that checks for Ctrl-Esc and sends it to the shell. We can get 00129 * the same functionality, without totally re-writing our input model 00130 * by just automatically installing the Ctrl-Esc as a hotkey for the 00131 * shell window. The hotkey delivery code has a special case which 00132 * turns this into a WM_SYSCOMMAND message instead of a WM_HOTKEY 00133 * message. 00134 * 00135 * We don't both checking for failure. Somebody could already have 00136 * a Ctrl-Esc handler installed. 00137 */ 00138 _RegisterHotKey(pwnd,SC_TASKLIST,MOD_CONTROL,VK_ESCAPE); 00139 00140 /* 00141 * This is the shell window wright. 00142 * So get the process id for the shell. 00143 */ 00144 ppiShellProcess = GETPTI(pwnd)->ppi; 00145 00146 /* 00147 * Set the shell process id to the desktop only if it's the first instance 00148 */ 00149 if ((ppiShellProcess != NULL) && (pdeskinfo->ppiShellProcess == NULL)) { 00150 pdeskinfo->ppiShellProcess = ppiShellProcess; 00151 } 00152 00153 Lock(&pdeskinfo->spwndShell, pwnd); 00154 Lock(&pdeskinfo->spwndBkGnd, pwndBkGnd); 00155 00156 /* 00157 * Push window to bottom of stack. 00158 */ 00159 SetWF(pdeskinfo->spwndShell, WFBOTTOMMOST); 00160 xxxSetWindowPos(pdeskinfo->spwndShell, 00161 PWND_BOTTOM, 00162 0, 00163 0, 00164 0, 00165 0, 00166 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); 00167 00168 return(TRUE); 00169 }

BOOL APIENTRY xxxSetSysColors PUNICODE_STRING  pProfileUserName,
int  count,
PUINT  pIndex,
LPDWORD  pClrVal,
UINT  uOptions
 

Referenced by NtUserSetSysColors(), ResetSystemColors(), and xxxODI_ColorInit().

VOID xxxSetSysMenu PWND  pwnd  ) 
 

Definition at line 232 of file mnsys.c.

References _GetSubMenu(), _SetCloseDefault(), _SetMenuDefaultItem(), BOOL, BYTE, CheckLock, FALSE, IsSmallerThanScreen(), IsTrayWindow(), LOBYTE, MFSYSMENU, MNLookUpItem(), NULL, TestMF, TestMFS, TestWF, ThreadLockAlways, ThreadUnlock, UINT, WEFDLGMODALFRAME, WEFTOOLWINDOW, WFBORDERMASK, WFCHILD, WFDLGFRAME, WFMAXBOX, WFMAXIMIZED, WFMINBOX, WFMINIMIZED, WFSIZEBOX, xxxEnableMenuItem(), and xxxGetSysMenuHandle().

Referenced by xxxGetSysMenu(), xxxHandleNCMouseGuys(), and xxxTranslateAccelerator().

00234 { 00235 PMENU pMenu; 00236 UINT wSize; 00237 UINT wMinimize; 00238 UINT wMaximize; 00239 UINT wMove; 00240 UINT wRestore; 00241 UINT wDefault; 00242 BOOL fFramedDialogBox; 00243 TL tlmenu; 00244 00245 CheckLock(pwnd); 00246 /* 00247 * Get the handle of the current system menu. 00248 */ 00249 if ((pMenu = xxxGetSysMenuHandle(pwnd)) != NULL) { 00250 00251 pMenu = _GetSubMenu(pMenu, 0); 00252 if (!pMenu) 00253 return; 00254 00255 ThreadLockAlways(pMenu, &tlmenu); 00256 00257 /* 00258 * System modal window: no size, icon, zoom, or move. 00259 */ 00260 00261 // No system modal windows on NT. 00262 // wSize = wMaximize = wMinimize = wMove = 00263 // (UINT)((_GetSysModalWindow() == NULL) || hTaskLockInput ? 0: MFS_GRAYED); 00264 wSize = wMaximize = wMinimize = wMove = 0; 00265 wRestore = MFS_GRAYED; 00266 00267 // 00268 // Default menu command is close. 00269 // 00270 wDefault = SC_CLOSE; 00271 00272 /* 00273 * Minimized exceptions: no minimize, restore. 00274 */ 00275 00276 // we need to reverse these because VB has a "special" window 00277 // that is both minimized but without a minbox. 00278 if (TestWF(pwnd, WFMINIMIZED)) 00279 { 00280 wRestore = 0; 00281 wMinimize = MFS_GRAYED; 00282 wSize = MFS_GRAYED; 00283 wDefault = SC_RESTORE; 00284 00285 if (IsTrayWindow(pwnd)) 00286 wMove = MFS_GRAYED; 00287 } 00288 else if (!TestWF(pwnd, WFMINBOX)) 00289 wMinimize = MFS_GRAYED; 00290 00291 /* 00292 * Maximized exceptions: no maximize, restore. 00293 */ 00294 if (!TestWF(pwnd, WFMAXBOX)) 00295 wMaximize = MFS_GRAYED; 00296 else if (TestWF(pwnd, WFMAXIMIZED)) { 00297 wRestore = 0; 00298 00299 /* 00300 * If the window is maximized but it isn't larger than the 00301 * screen, we allow the user to move the window around the 00302 * desktop (but we don't allow resizing). 00303 */ 00304 wMove = MFS_GRAYED; 00305 if (!TestWF(pwnd, WFCHILD)) { 00306 if (IsSmallerThanScreen(pwnd)) { 00307 wMove = 0; 00308 } 00309 } 00310 00311 wSize = MFS_GRAYED; 00312 wMaximize = MFS_GRAYED; 00313 } 00314 00315 if (!TestWF(pwnd, WFSIZEBOX)) 00316 wSize = MFS_GRAYED; 00317 00318 /* 00319 * Are we dealing with a framed dialog box with a sys menu? 00320 * Dialogs with min/max/size boxes get a regular system menu 00321 * (as opposed to the dialog menu) 00322 */ 00323 fFramedDialogBox = 00324 (((TestWF(pwnd, WFBORDERMASK) == (BYTE)LOBYTE(WFDLGFRAME)) 00325 || (TestWF(pwnd, WEFDLGMODALFRAME))) 00326 && !TestWF(pwnd, WFSIZEBOX | WFMINBOX | WFMAXBOX)); 00327 00328 if (!fFramedDialogBox) { 00329 xxxEnableMenuItem(pMenu, (UINT)SC_SIZE, wSize); 00330 if (!TestWF(pwnd, WEFTOOLWINDOW)) 00331 { 00332 xxxEnableMenuItem(pMenu, (UINT)SC_MINIMIZE, wMinimize); 00333 xxxEnableMenuItem(pMenu, (UINT)SC_MAXIMIZE, wMaximize); 00334 xxxEnableMenuItem(pMenu, (UINT)SC_RESTORE, wRestore); 00335 } 00336 } 00337 00338 xxxEnableMenuItem(pMenu, (UINT)SC_MOVE, wMove); 00339 00340 #if DBG 00341 /* 00342 * Assert that nobody managed to change the desktop menus. 00343 */ 00344 if (TestMF(pMenu, MFSYSMENU)) { 00345 PITEM pItem = MNLookUpItem(pMenu, SC_CLOSE, FALSE, NULL); 00346 UserAssert((pItem != NULL) && !TestMFS(pItem, MFS_GRAYED)); 00347 } 00348 #endif 00349 00350 if (wDefault == SC_CLOSE) 00351 _SetCloseDefault(pMenu); 00352 else 00353 _SetMenuDefaultItem(pMenu, wDefault, MF_BYCOMMAND); 00354 00355 ThreadUnlock(&tlmenu); 00356 } 00357 }

BOOL xxxSetSystemMenu PWND  pwnd,
PMENU  pMenu
 

Definition at line 65 of file mnapi.c.

References _DestroyMenu(), BOOL, CheckLock, FALSE, LockWndMenu(), MNPositionSysMenu(), tagWND::spmenuSys, TestWF, TRUE, and WFSYSMENU.

Referenced by NtUserSetSystemMenu().

00068 { 00069 CheckLock(pwnd); 00070 CheckLock(pMenu); 00071 00072 if (TestWF(pwnd, WFSYSMENU)) { 00073 PMENU pmenuT = pwnd->spmenuSys; 00074 if (LockWndMenu(pwnd, &pwnd->spmenuSys, pMenu)) 00075 _DestroyMenu(pmenuT); 00076 00077 MNPositionSysMenu(pwnd, pMenu); 00078 00079 return TRUE; 00080 } 00081 00082 RIPERR0(ERROR_NO_SYSTEM_MENU, RIP_VERBOSE, ""); 00083 return FALSE; 00084 }

BOOL xxxSetThreadDesktop HDESK  ,
PDESKTOP 
 

Definition at line 4033 of file desktop.c.

References AllocQueue(), BOOL, tagQ::cThreads, tagTHREADINFO::cWindows, FALSE, tagTHREADINFO::fsHooks, GetDesktopView(), gpepCSRSS, gpqForeground, GTERMF_MOUSE, tagQ::iCursorLevel, tagTHREADINFO::iCursorLevel, LockDesktop, MapDesktop(), NULL, ObOpenHandle, tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrent, tagTHREADINFO::rpdesk, tagPROCESSINFO::rpdeskStartup, tagQ::spwndActive, tagQ::spwndActivePrev, tagQ::spwndCapture, tagQ::spwndFocus, TEST_GTERMF, TRUE, xxxSetForegroundWindow2(), zzzAttachToQueue(), and zzzSetDesktop().

Referenced by NtUserSetThreadDesktop(), xxxDesktopThread(), xxxDesktopWndProc(), xxxNextWindow(), xxxRestoreCsrssThreadDesktop(), and xxxSetCsrssThreadDesktop().

04036 { 04037 PTHREADINFO ptiCurrent; 04038 PPROCESSINFO ppiCurrent; 04039 PQ pqAttach; 04040 04041 ptiCurrent = PtiCurrent(); 04042 ppiCurrent = ptiCurrent->ppi; 04043 04044 04045 /* 04046 * If the handle has not been mapped in, do it now. 04047 */ 04048 if (pdesk != NULL) { 04049 try { 04050 MapDesktop(ObOpenHandle, ppiCurrent->Process, pdesk, 0, 1); 04051 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) { 04052 return FALSE; 04053 } 04054 04055 UserAssert(GetDesktopView(ppiCurrent, pdesk) != NULL); 04056 } 04057 04058 /* 04059 * Check non-system thread status 04060 */ 04061 if (ptiCurrent->pEThread->ThreadsProcess != gpepCSRSS) { 04062 04063 /* 04064 * Fail if the non-system thread has any windows or thread hooks. 04065 */ 04066 if (ptiCurrent->cWindows != 0 || ptiCurrent->fsHooks) { 04067 RIPERR0(ERROR_BUSY, RIP_WARNING, "Thread has windows or hooks"); 04068 return FALSE; 04069 } 04070 04071 /* 04072 * If this is the first desktop assigned to the process, 04073 * make it the startup desktop. 04074 */ 04075 if (ppiCurrent->rpdeskStartup == NULL && hdesk != NULL) { 04076 LockDesktop(&ppiCurrent->rpdeskStartup, pdesk, LDL_PPI_DESKSTARTUP1, (ULONG_PTR)ppiCurrent); 04077 ppiCurrent->hdeskStartup = hdesk; 04078 } 04079 } 04080 04081 04082 /* 04083 * If the desktop is changing and the thread is sharing a queue, 04084 * detach the thread. This will ensure that threads sharing 04085 * queues are all on the same desktop. This will prevent 04086 * zzzDestroyQueue from getting confused and setting ptiKeyboard 04087 * and ptiMouse to NULL when a thread detachs. 04088 */ 04089 if (ptiCurrent->rpdesk != pdesk) { 04090 if (ptiCurrent->pq->cThreads > 1) { 04091 pqAttach = AllocQueue(NULL, NULL); 04092 if (pqAttach != NULL) { 04093 pqAttach->cThreads++; 04094 zzzAttachToQueue(ptiCurrent, pqAttach, NULL, FALSE); 04095 } else { 04096 RIPERR0(ERROR_NOT_ENOUGH_MEMORY, RIP_WARNING, "Thread could not be detached"); 04097 return FALSE; 04098 } 04099 } else if (ptiCurrent->pq == gpqForeground) { 04100 /* 04101 * This thread doesn't own any windows, still it's attached to qpgForeground and 04102 * it's the only thread attached to it. 04103 * Since any threads attached to qpgForeground must be in grpdeskRitInput, 04104 * we must set qpgForeground to NULL here because this thread is going to another 04105 * desktop. 04106 */ 04107 UserAssert(ptiCurrent->pq->spwndActive == NULL); 04108 UserAssert(ptiCurrent->pq->spwndCapture == NULL); 04109 UserAssert(ptiCurrent->pq->spwndFocus == NULL); 04110 UserAssert(ptiCurrent->pq->spwndActivePrev == NULL); 04111 xxxSetForegroundWindow2(NULL, ptiCurrent, 0); 04112 } else if (ptiCurrent->rpdesk == NULL) { 04113 /* 04114 * We need to initialize iCursorLevel. 04115 */ 04116 ptiCurrent->iCursorLevel = TEST_GTERMF(GTERMF_MOUSE) ? 0 : -1; 04117 ptiCurrent->pq->iCursorLevel = ptiCurrent->iCursorLevel; 04118 } 04119 04120 UserAssert(ptiCurrent->pq != gpqForeground); 04121 04122 } 04123 04124 zzzSetDesktop(ptiCurrent, pdesk, hdesk); 04125 04126 return TRUE; 04127 }

void xxxSetTrayWindow PDESKTOP  pdesk,
PWND  pwnd,
PMONITOR  pMonitor
 

Definition at line 100 of file winloop2.c.

References _MonitorFromWindow(), tagMONITOR::cFullScreen, CheckLock, FCallHookTray, FPostTray, GetPrimaryMonitor(), Lock, PostShellHookMessages(), PtoH, tagDESKTOP::spwndTray, STW_SAME, and xxxCallHook().

Referenced by xxxAddFullScreen(), xxxEndDeferWindowPosEx(), xxxRemoveFullScreen(), and xxxUpdateTray().

00101 { 00102 HWND hwnd; 00103 00104 CheckLock(pMonitor); 00105 00106 if (pwnd == STW_SAME) { 00107 pwnd = pdesk->spwndTray; 00108 hwnd = PtoH(pwnd); 00109 } else { 00110 CheckLock(pwnd); 00111 hwnd = PtoH(pwnd); 00112 Lock(&(pdesk->spwndTray), pwnd); 00113 } 00114 00115 if (!pMonitor) { 00116 if (pwnd) { 00117 pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY); 00118 } else { 00119 pMonitor = GetPrimaryMonitor(); 00120 } 00121 } 00122 00123 if ( FPostTray(pdesk)) { 00124 PostShellHookMessages( 00125 pMonitor->cFullScreen ? 00126 HSHELL_RUDEAPPACTIVATED : HSHELL_WINDOWACTIVATED, 00127 (LPARAM) hwnd); 00128 } 00129 00130 if ( FCallHookTray() ) { 00131 xxxCallHook( 00132 HSHELL_WINDOWACTIVATED, 00133 (WPARAM) hwnd, 00134 (pMonitor->cFullScreen ? 1 : 0), 00135 WH_SHELL); 00136 } 00137 }

ULONG_PTR xxxSetWindowData PWND  pwnd,
int  index,
ULONG_PTR  dwData,
BOOL  bAnsi
 

Definition at line 568 of file ntuser/kernel/getset.c.

References BOOL, CheckLock, ClrWF, CPD_ANSI_TO_UNICODE, CPD_UNICODE_TO_ANSI, CPD_WND, DWORD, tagWND::dwUserData, FALSE, FNID_DELETED_BIT, FNID_EDIT, GetCPD(), GETFNID, GETPTI, HMValidateHandleNoRip(), HW, ISCPDTAG, IsWinEventNotifyDeferredOK, Lock, LockWndMenu(), tagWND::lpfnWndProc, MapClientNeuterToClientPfn(), MapClientToServerPfn(), MapServerToClientPfn(), NULL, tagWND::pcls, _CALLPROCDATA::pfnClientPrevious, PpiCurrent, PtoH, PWNDDESKTOP, SetWF, tagWND::spmenu, tagWND::spwndOwner, tagWND::spwndParent, TestWF, TestwndChild, ThreadLock, ThreadUnlock, TRUE, TYPE_CALLPROC, Unlock, UnlockWndMenu(), ValidateHmenu(), ValidateHwnd, ValidateOwnerDepth(), WFANSIPROC, WFSERVERSIDEPROC, WNDPROC_PWND, _CALLPROCDATA::wType, xxxClientWOWGetProcModule(), xxxDefWindowProc(), xxxHandleOwnerSwitch(), xxxSetParent(), and xxxSetWindowStyle().

Referenced by xxxSetWindowLongPtr().

00573 { 00574 ULONG_PTR dwT; 00575 ULONG_PTR dwOld; 00576 PMENU pmenu; 00577 PWND *ppwnd; 00578 PWND pwndNewParent; 00579 PWND pwndOldParent; 00580 BOOL fTopOwner; 00581 TL tlpwndOld; 00582 TL tlpwndNew; 00583 DWORD dwCPDType = 0; 00584 00585 CheckLock(pwnd); 00586 UserAssert(IsWinEventNotifyDeferredOK()); 00587 00588 switch (index) { 00589 case GWLP_USERDATA: 00590 dwOld = pwnd->dwUserData; 00591 pwnd->dwUserData = dwData; 00592 break; 00593 00594 case GWL_EXSTYLE: 00595 case GWL_STYLE: 00596 dwOld = xxxSetWindowStyle(pwnd, index, (DWORD)dwData); 00597 break; 00598 00599 case GWLP_ID: 00600 /* 00601 * Win95 does a TestWF(pwnd, WFCHILD) here, but we'll do the same 00602 * check we do everywhere else or it'll cause us trouble. 00603 */ 00604 if (TestwndChild(pwnd)) { 00605 00606 /* 00607 * pwnd->spmenu is an id in this case. 00608 */ 00609 dwOld = (ULONG_PTR)pwnd->spmenu; 00610 pwnd->spmenu = (struct tagMENU *)dwData; 00611 } else { 00612 dwOld = 0; 00613 if (pwnd->spmenu != NULL) 00614 dwOld = (ULONG_PTR)PtoH(pwnd->spmenu); 00615 00616 if (dwData == 0) { 00617 UnlockWndMenu(pwnd, &pwnd->spmenu); 00618 } else { 00619 pmenu = ValidateHmenu((HANDLE)dwData); 00620 if (pmenu != NULL) { 00621 LockWndMenu(pwnd, &pwnd->spmenu, pmenu); 00622 } else { 00623 00624 /* 00625 * Menu is invalid, so don't set a new one! 00626 */ 00627 dwOld = 0; 00628 } 00629 } 00630 } 00631 break; 00632 00633 case GWLP_HINSTANCE: 00634 dwOld = (ULONG_PTR)pwnd->hModule; 00635 pwnd->hModule = (HANDLE)dwData; 00636 break; 00637 00638 case GWLP_WNDPROC: // See similar case DWLP_DLGPROC 00639 00640 /* 00641 * Hide the window proc from other processes 00642 */ 00643 if (PpiCurrent() != GETPTI(pwnd)->ppi) { 00644 RIPERR1(ERROR_ACCESS_DENIED, RIP_WARNING, 00645 "SetWindowLong: Window owned by another process %#p", pwnd); 00646 return 0; 00647 } 00648 00649 /* 00650 * If the window has been zombized by a DestroyWindow but is still 00651 * around because the window was locked don't let anyone change 00652 * the window proc from DefWindowProc! 00653 * 00654 * !!! LATER long term move this test into the ValidateHWND; kind of 00655 * !!! LATER close to shipping for that 00656 */ 00657 if (pwnd->fnid & FNID_DELETED_BIT) { 00658 UserAssert(pwnd->lpfnWndProc == xxxDefWindowProc); 00659 RIPERR1(ERROR_ACCESS_DENIED, RIP_WARNING, 00660 "SetWindowLong: Window is a zombie %#p", pwnd); 00661 return 0; 00662 } 00663 00664 /* 00665 * If the application (client) subclasses a window that has a server - 00666 * side window proc we must return an address that the client can call: 00667 * this client-side wndproc expectes Unicode or ANSI depending on bAnsi 00668 */ 00669 00670 if (TestWF(pwnd, WFSERVERSIDEPROC)) { 00671 dwOld = MapServerToClientPfn((ULONG_PTR)pwnd->lpfnWndProc, bAnsi); 00672 00673 /* 00674 * If we don't have a client side address (like for the DDEMLMon 00675 * window) then blow off the subclassing. 00676 */ 00677 if (dwOld == 0) { 00678 RIPMSG0(RIP_WARNING, "SetWindowLong: subclass server only window"); 00679 return(0); 00680 } 00681 00682 ClrWF(pwnd, WFSERVERSIDEPROC); 00683 } else { 00684 /* 00685 * Keep edit control behavior compatible with NT 3.51. 00686 */ 00687 if (GETFNID(pwnd) == FNID_EDIT) { 00688 dwOld = (ULONG_PTR)pwnd->lpfnWndProc; 00689 } else { 00690 dwOld = MapClientNeuterToClientPfn(pwnd->pcls, (ULONG_PTR)pwnd->lpfnWndProc, bAnsi); 00691 } 00692 00693 /* 00694 * If the client mapping didn't change the window proc then see if 00695 * we need a callproc handle. 00696 */ 00697 if (dwOld == (ULONG_PTR)pwnd->lpfnWndProc) { 00698 /* 00699 * May need to return a CallProc handle if there is an Ansi/Unicode mismatch 00700 */ 00701 if (bAnsi != (TestWF(pwnd, WFANSIPROC) ? TRUE : FALSE)) { 00702 dwCPDType |= bAnsi ? CPD_ANSI_TO_UNICODE : CPD_UNICODE_TO_ANSI; 00703 } 00704 } 00705 00706 UserAssert(!ISCPDTAG(dwOld)); 00707 00708 if (dwCPDType) { 00709 ULONG_PTR cpd; 00710 00711 cpd = GetCPD(pwnd, dwCPDType | CPD_WND, dwOld); 00712 00713 if (cpd) { 00714 dwOld = cpd; 00715 } else { 00716 RIPMSG0(RIP_WARNING, "SetWindowLong unable to alloc CPD returning handle\n"); 00717 } 00718 } 00719 } 00720 00721 /* 00722 * Convert a possible CallProc Handle into a real address. They may 00723 * have kept the CallProc Handle from some previous mixed GetClassinfo 00724 * or SetWindowLong. 00725 * 00726 * WARNING bAnsi is modified here to represent real type of 00727 * proc rather than if SetWindowLongA or W was called 00728 * 00729 */ 00730 if (ISCPDTAG(dwData)) { 00731 PCALLPROCDATA pCPD; 00732 if (pCPD = HMValidateHandleNoRip((HANDLE)dwData, TYPE_CALLPROC)) { 00733 dwData = pCPD->pfnClientPrevious; 00734 bAnsi = pCPD->wType & CPD_UNICODE_TO_ANSI; 00735 } 00736 } 00737 00738 /* 00739 * If an app 'unsubclasses' a server-side window proc we need to 00740 * restore everything so SendMessage and friends know that it's 00741 * a server-side proc again. Need to check against client side 00742 * stub addresses. 00743 */ 00744 if ((dwT = MapClientToServerPfn(dwData)) != 0) { 00745 pwnd->lpfnWndProc = (WNDPROC_PWND)dwT; 00746 SetWF(pwnd, WFSERVERSIDEPROC); 00747 ClrWF(pwnd, WFANSIPROC); 00748 } else { 00749 pwnd->lpfnWndProc = (WNDPROC_PWND)MapClientNeuterToClientPfn(pwnd->pcls, dwData, bAnsi); 00750 if (bAnsi) { 00751 SetWF(pwnd, WFANSIPROC); 00752 } else { 00753 ClrWF(pwnd, WFANSIPROC); 00754 } 00755 00756 pwnd->hMod16 = xxxClientWOWGetProcModule(pwnd->lpfnWndProc); 00757 00758 } 00759 00760 break; 00761 00762 case GWLP_HWNDPARENT: 00763 /* 00764 * Special case for pre-1.1 versions of Windows 00765 * Set/GetWindowWord(GWW_HWNDPARENT) needs to be mapped 00766 * to the hwndOwner for top level windows. 00767 */ 00768 fTopOwner = FALSE; 00769 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00770 ppwnd = &pwnd->spwndOwner; 00771 fTopOwner = TRUE; 00772 } else { 00773 ppwnd = &pwnd->spwndParent; 00774 } 00775 00776 00777 /* 00778 * If we're a topmost, then we're only changing the owner 00779 * relationship. Otherwise, we are doing a relinking of the 00780 * parent/child relationship. 00781 */ 00782 pwndOldParent = *ppwnd; 00783 pwndNewParent = ValidateHwnd((HWND)dwData); 00784 00785 if ((pwndNewParent == NULL) && dwData) { 00786 RIPERR1(ERROR_INVALID_PARAMETER, RIP_VERBOSE, "Set GWL_HWNDPARENT, invalid hwndParent %#p", dwData); 00787 return 0; 00788 } 00789 00790 dwOld = (ULONG_PTR)HW(*ppwnd); 00791 00792 ThreadLock(pwndNewParent, &tlpwndNew); 00793 00794 if (fTopOwner) { 00795 00796 ThreadLock(pwndOldParent, &tlpwndOld); 00797 00798 xxxHandleOwnerSwitch(pwnd, pwndNewParent, pwndOldParent); 00799 00800 if (ValidateOwnerDepth(pwnd, pwndNewParent)) { 00801 00802 /* 00803 * Set the owner. 00804 */ 00805 if (pwndNewParent) { 00806 Lock(ppwnd, pwndNewParent); 00807 } else { 00808 Unlock(ppwnd); 00809 } 00810 } else { 00811 00812 /* 00813 * Undo the switch and set last error. 00814 */ 00815 xxxHandleOwnerSwitch(pwnd, pwndOldParent, pwndNewParent); 00816 RIPERR0(ERROR_INVALID_PARAMETER, RIP_ERROR, "Detected loop in owner chain"); 00817 dwOld = 0; 00818 } 00819 00820 ThreadUnlock(&tlpwndOld); 00821 00822 } else { 00823 if (!xxxSetParent(pwnd, pwndNewParent)) { 00824 dwOld = 0; 00825 } 00826 } 00827 00828 ThreadUnlock(&tlpwndNew); 00829 break; 00830 00831 default: 00832 RIPERR0(ERROR_INVALID_INDEX, RIP_VERBOSE, ""); 00833 return 0; 00834 } 00835 00836 return dwOld; 00837 }

DWORD xxxSetWindowLong PWND  pwnd,
int  index,
DWORD  value,
BOOL  bAnsi
 

Referenced by xxxDesktopWndProc().

BOOL xxxSetWindowNCMetrics PUNICODE_STRING  pProfileUserName,
LPNONCLIENTMETRICS  lpnc,
BOOL  fSizeChange,
int  clNewBorder
 

Definition at line 1080 of file inctlpan.c.

References BOOL, CreateBitmapStrip(), FALSE, gcyCaptionFontChar, gcyMenuFontChar, gcyMenuFontExternLeading, gcySmCaptionFontChar, max, MetricGetID(), min, NULL, SetNCMetrics(), SYSMET, TRUE, and xxxSetNCFonts().

Referenced by xxxInitWindowStation(), xxxSetAndDrawNCMetrics(), xxxSetSysColors(), and xxxUpdatePerUserSystemParameters().

01085 { 01086 NONCLIENTMETRICS nc; 01087 int cxEdge4; 01088 01089 if (fSizeChange) { 01090 if (!xxxSetNCFonts(pProfileUserName, lpnc)) { 01091 RIPMSG0(RIP_WARNING, "xxxSetWindowNCMetrics failed in xxxSetNCFonts"); 01092 return FALSE; 01093 } 01094 01095 if (lpnc == NULL) { 01096 if (clNewBorder < 0) 01097 nc.iBorderWidth = MetricGetID(pProfileUserName,STR_BORDERWIDTH, 1); 01098 else 01099 nc.iBorderWidth = clNewBorder; 01100 01101 nc.iScrollWidth = MetricGetID(pProfileUserName,STR_SCROLLWIDTH, 16 ); 01102 nc.iScrollHeight = MetricGetID(pProfileUserName,STR_SCROLLHEIGHT, 16 ); 01103 nc.iCaptionWidth = MetricGetID(pProfileUserName,STR_CAPTIONWIDTH, 18 ); 01104 nc.iCaptionHeight = MetricGetID(pProfileUserName,STR_CAPTIONHEIGHT, 18 ); 01105 nc.iSmCaptionWidth = MetricGetID(pProfileUserName,STR_SMCAPTIONWIDTH, 13 ); 01106 nc.iSmCaptionHeight = MetricGetID(pProfileUserName,STR_SMCAPTIONHEIGHT, 13 ); 01107 nc.iMenuWidth = MetricGetID(pProfileUserName,STR_MENUWIDTH, 18 ); 01108 nc.iMenuHeight = MetricGetID(pProfileUserName,STR_MENUHEIGHT, 18 ); 01109 01110 lpnc = &nc; 01111 } 01112 01113 /* 01114 * SANITY CHECK for metric values 01115 */ 01116 cxEdge4 = 4 * SYSMET(CXEDGE); 01117 01118 /* 01119 * Border 01120 */ 01121 lpnc->iBorderWidth = max(lpnc->iBorderWidth, 1); 01122 lpnc->iBorderWidth = min(lpnc->iBorderWidth, 50); 01123 01124 /* 01125 * Scrollbar 01126 */ 01127 lpnc->iScrollWidth = max(lpnc->iScrollWidth, cxEdge4); 01128 lpnc->iScrollHeight = max(lpnc->iScrollHeight, 4 * SYSMET(CYEDGE)); 01129 01130 /* 01131 * Caption -- Buttons must be wide enough to draw edges, and text 01132 * area must be tall enough to fit caption font with a border above 01133 * and below. If we have to reset the caption height, should we 01134 * reset the button width as well? 01135 */ 01136 lpnc->iCaptionWidth = max(lpnc->iCaptionWidth, cxEdge4); 01137 lpnc->iCaptionHeight = max(lpnc->iCaptionHeight, gcyCaptionFontChar + SYSMET(CYEDGE)); 01138 01139 /* 01140 * Small caption -- Buttons must be wide enough to draw edges, and 01141 * text area must be tall enough to fit small caption font with a 01142 * border above and below. Again, if we have to reset the height, 01143 * reset the width as well? 01144 */ 01145 lpnc->iSmCaptionWidth = max(lpnc->iSmCaptionWidth, cxEdge4); 01146 lpnc->iSmCaptionHeight = max(lpnc->iSmCaptionHeight, gcySmCaptionFontChar + SYSMET(CYEDGE)); 01147 01148 /* 01149 * Menu -- Buttons must be wide enough to draw edges, and text 01150 * area must be tall enough to fit menu font with underscore. 01151 */ 01152 lpnc->iMenuWidth = max(lpnc->iMenuWidth, cxEdge4); 01153 lpnc->iMenuHeight = max(lpnc->iMenuHeight, gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYEDGE)); 01154 01155 /* 01156 * SET UP SYSTEM METRIC VALUES 01157 */ 01158 SetNCMetrics(lpnc); 01159 } 01160 01161 if (!CreateBitmapStrip()) { 01162 RIPMSG0(RIP_WARNING, "CreateBitmapStrip failed"); 01163 return FALSE; 01164 } 01165 01166 return TRUE; 01167 }

BOOL xxxSetWindowPlacement PWND  pwnd,
PWINDOWPLACEMENT  pwp
 

Definition at line 911 of file kernel/winmgr.c.

References _MonitorFromRect(), _ShowWindowAsync(), BOOL, CheckLock, CheckPlacementBounds(), CopyRect, FALSE, tagCHECKPOINT::fDragged, tagCHECKPOINT::fMaxInitialized, tagCHECKPOINT::fMinInitialized, tagCHECKPOINT::fWasMaximizedBeforeMinimized, GETPTI, NULL, OffsetRect(), PtiCurrent, tagCHECKPOINT::ptMax, tagCHECKPOINT::ptMin, PUDF_ANIMATE, PWND_TOP, PWNDDESKTOP, tagMONITOR::rcMonitor, tagCHECKPOINT::rcNormal, tagMONITOR::rcWork, tagWND::spwndParent, TEST_PUDF, TestWF, TRUE, UINT, UpdateCheckpoint(), WEFTOOLWINDOW, WFMAXIMIZED, WFMINIMIZED, WFREALLYMAXIMIZABLE, WPUpdateCheckPointSettings(), xxxSetWindowPos(), and xxxShowWindow().

Referenced by NtUserSetWindowPlacement().

00914 { 00915 CHECKPOINT * pcp; 00916 PMONITOR pMonitor; 00917 RECT rc; 00918 POINT ptMin; 00919 POINT ptMax; 00920 BOOL fMin; 00921 BOOL fMax; 00922 UINT uSWPFlags; 00923 BOOL fRealAsync; 00924 00925 CheckLock(pwnd); 00926 00927 CopyRect(&rc, &pwp->rcNormalPosition); 00928 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00929 pMonitor = _MonitorFromRect(&rc, MONITOR_DEFAULTTOPRIMARY); 00930 } 00931 00932 ptMin = pwp->ptMinPosition; 00933 fMin = ((ptMin.x != -1) && (ptMin.y != -1)); 00934 00935 ptMax = pwp->ptMaxPosition; 00936 fMax = ((ptMax.x != -1) && (ptMax.y != -1)); 00937 00938 /* 00939 * Convert back to working rectangle coordinates 00940 */ 00941 if ( pwnd->spwndParent == PWNDDESKTOP(pwnd) && 00942 !TestWF(pwnd, WEFTOOLWINDOW)) { 00943 00944 OffsetRect( 00945 &rc, 00946 pMonitor->rcWork.left - pMonitor->rcMonitor.left, 00947 pMonitor->rcWork.top - pMonitor->rcMonitor.top); 00948 00949 if (fMin) { 00950 ptMin.x += pMonitor->rcWork.left - pMonitor->rcMonitor.left; 00951 ptMin.y += pMonitor->rcWork.top - pMonitor->rcMonitor.top; 00952 } 00953 00954 CheckPlacementBounds(&rc, &ptMin, &ptMax, pMonitor); 00955 } 00956 00957 if (pcp = UpdateCheckpoint(pwnd)) { 00958 00959 /* 00960 * Save settings in the checkpoint struct 00961 */ 00962 CopyRect(&pcp->rcNormal, &rc); 00963 00964 pcp->ptMin = ptMin; 00965 pcp->fMinInitialized = fMin; 00966 pcp->fDragged = (pwp->flags & WPF_SETMINPOSITION) ? 00967 TRUE : FALSE; 00968 pcp->ptMax = ptMax; 00969 pcp->fMaxInitialized = fMax; 00970 pcp->fWasMaximizedBeforeMinimized = FALSE; 00971 } 00972 00973 /* 00974 * WPF_ASYNCWINDOWPLACEMENT new for NT5. 00975 */ 00976 uSWPFlags = SWP_NOZORDER | SWP_NOACTIVATE 00977 | ((pwp->flags & WPF_ASYNCWINDOWPLACEMENT) ? SWP_ASYNCWINDOWPOS : 0); 00978 00979 if (TestWF(pwnd, WFMINIMIZED)) { 00980 00981 if ((!pcp || pcp->fDragged) && fMin) { 00982 xxxSetWindowPos(pwnd, 00983 PWND_TOP, 00984 ptMin.x, 00985 ptMin.y, 00986 0, 00987 0, 00988 SWP_NOSIZE | uSWPFlags); 00989 } 00990 00991 } else if (TestWF(pwnd, WFMAXIMIZED)) { 00992 00993 if (pcp != NULL) { 00994 if (TestWF(pwnd, WFREALLYMAXIMIZABLE)) 00995 pcp->fMaxInitialized = FALSE; 00996 00997 if (pcp->fMaxInitialized) { 00998 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) { 00999 ptMax.x += pMonitor->rcWork.left; 01000 ptMax.y += pMonitor->rcWork.top; 01001 } 01002 01003 xxxSetWindowPos(pwnd, 01004 PWND_TOP, 01005 ptMax.x, 01006 ptMax.y, 01007 0, 01008 0, 01009 SWP_NOSIZE | uSWPFlags); 01010 } 01011 } 01012 01013 01014 } else { 01015 01016 xxxSetWindowPos(pwnd, 01017 PWND_TOP, 01018 rc.left, 01019 rc.top, 01020 rc.right - rc.left, 01021 rc.bottom - rc.top, 01022 uSWPFlags); 01023 } 01024 /* 01025 * xxxSetWindowPos is only assync when the window's thread is on a 01026 * different queue than the current thread's. See AsyncWindowPos. 01027 */ 01028 fRealAsync = (pwp->flags & WPF_ASYNCWINDOWPLACEMENT) 01029 && (GETPTI(pwnd)->pq != PtiCurrent()->pq); 01030 01031 if (fRealAsync) { 01032 _ShowWindowAsync(pwnd, pwp->showCmd, pwp->flags); 01033 } else { 01034 xxxShowWindow(pwnd, MAKELONG(pwp->showCmd, TEST_PUDF(PUDF_ANIMATE))); 01035 } 01036 01037 if (TestWF(pwnd, WFMINIMIZED) && !fRealAsync) { 01038 WPUpdateCheckPointSettings(pwnd, pwp->flags); 01039 } 01040 01041 return TRUE; 01042 }

BOOL xxxSetWindowPos PWND  pwnd,
PWND  pwndInsertAfter,
int  x,
int  y,
int  cx,
int  cy,
UINT  flags
 

Definition at line 1468 of file swp.c.

References _DeferWindowPos(), BOOL, CheckLock, tagDISPLAYINFO::cMonitors, cy, FALSE, FixBogusSWP(), gpDispInfo, InternalBeginDeferWindowPos(), IsRectEmpty(), LOBYTE, NULL, tagWND::rcWindow, tagWND::spwndOwner, TestWF, TRUE, WFBORDERMASK, WFCAPTION, WFCHILD, WFVISIBLE, WFWIN31COMPAT, WFWIN50COMPAT, xxxEndDeferWindowPosEx(), and xxxRedrawWindow().

Referenced by CheckOnTop(), NtUserSetWindowPos(), ResetSharedDesktops(), xxxActivateThisWindow(), xxxCreateDesktop(), xxxCreateTooltip(), xxxDesktopThread(), xxxDestroyWindow(), xxxDrawDragRect(), xxxDWP_SetCursor(), xxxKeyEvent(), xxxMenuWindowProc(), xxxMetricsRecalc(), xxxMNOpenHierarchy(), xxxMNUpdateShownMenu(), xxxMoveWindow(), xxxMS_TrackMove(), xxxNextWindow(), xxxOldNextWindow(), xxxProcessEventMessage(), xxxRedrawFrame(), xxxRedrawFrameAndHook(), xxxResetTooltip(), xxxSetForegroundWindow2(), xxxSetInternalWindowPos(), xxxSetParent(), xxxSetShellWindow(), xxxSetWindowPlacement(), xxxShowSwitchWindow(), xxxShowTooltip(), xxxShowWindow(), xxxSwitchDesktop(), xxxSwitchToThisWindow(), xxxSwitchWndProc(), xxxSysCommand(), and xxxTrackPopupMenuEx().

01476 { 01477 PSMWP psmwp; 01478 BOOL fInval = FALSE; 01479 01480 #if DBG 01481 CheckLock(pwnd); 01482 01483 switch((ULONG_PTR)pwndInsertAfter) { 01484 case 0x0000FFFF: 01485 case (ULONG_PTR)HWND_TOPMOST: 01486 case (ULONG_PTR)HWND_NOTOPMOST: 01487 case (ULONG_PTR)HWND_TOP: 01488 case (ULONG_PTR)HWND_BOTTOM: 01489 break; 01490 01491 default: 01492 CheckLock(pwndInsertAfter); 01493 break; 01494 } 01495 #endif 01496 01497 /* 01498 * BACKWARD COMPATIBILITY HACKS 01499 * 01500 * Hack 1: For Win 3.0 and below, SetWindowPos() must ignore the 01501 * move and size flags if SWP_SHOWWINDOW or SWP_HIDEWINDOW 01502 * is specified. KnowledgePro is one application that depends on 01503 * this behavior for the positioning of its MDI icons. 01504 * 01505 * Hack 2: In 3.0, if SetWindowPos() is called with SWP_SHOWWINDOW 01506 * and the window is already visible, then the window was 01507 * completely invalidated anyway. So, we do that here too. 01508 * 01509 * NOTE: The placement of the invalidation AFTER the EndDeferWindowPos() 01510 * call means that if the guy is Z-ordering and showing a 3.0 window, 01511 * it may flash, because EndDefer calls DoSyncPaint, and we invalidate 01512 * again after that. Could be fixed with some major hackery in EndDefer, 01513 * and it's probably not worth the trouble. 01514 */ 01515 if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW)) { 01516 01517 if (!TestWF(pwnd, WFWIN31COMPAT)) { 01518 01519 flags |= SWP_NOMOVE | SWP_NOSIZE; 01520 if ((flags & SWP_SHOWWINDOW) && TestWF(pwnd, WFVISIBLE)) 01521 fInval = TRUE; 01522 } 01523 } 01524 01525 /* 01526 * MULTIMONITOR HACKS 01527 * 01528 * if a app is centering or cliping a hidden owned window 01529 * to the primary monitor we should center the window to the owner 01530 * 01531 * this makes apps that center/position their own dialogs 01532 * work when the app is on a secondary monitor. 01533 */ 01534 if ( !TestWF(pwnd, WFWIN50COMPAT) && 01535 gpDispInfo->cMonitors > 1 && 01536 !(flags & SWP_NOMOVE) && 01537 !TestWF(pwnd, WFCHILD) && 01538 !TestWF(pwnd, WFVISIBLE) && 01539 (TestWF(pwnd, WFBORDERMASK) == LOBYTE(WFCAPTION)) && 01540 pwnd->spwndOwner && 01541 TestWF(pwnd->spwndOwner, WFVISIBLE) && 01542 !IsRectEmpty(&pwnd->spwndOwner->rcWindow)) { 01543 01544 FixBogusSWP(pwnd, &x, &y, cx, cy, flags); 01545 01546 } 01547 01548 if (!(psmwp = InternalBeginDeferWindowPos(1)) || 01549 !(psmwp = _DeferWindowPos(psmwp, 01550 pwnd, 01551 pwndInsertAfter, 01552 x, 01553 y, 01554 cx, 01555 cy, 01556 flags))) { 01557 01558 return FALSE; 01559 } 01560 01561 01562 if (xxxEndDeferWindowPosEx(psmwp, flags & SWP_ASYNCWINDOWPOS)) { 01563 01564 if (fInval) { 01565 xxxRedrawWindow( 01566 pwnd, 01567 NULL, 01568 NULL, 01569 RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN); 01570 } 01571 01572 return TRUE; 01573 } 01574 01575 return FALSE; 01576 }

BOOL xxxSetWindowRgn PWND  pwnd,
HRGN  hrgn,
BOOL  fRedraw
 

Definition at line 5661 of file swp.c.

References _DeferWindowPos(), tagSMWP::acvr, BOOL, FALSE, HRGN_FULL, tagCVR::hrgnClip, InternalBeginDeferWindowPos(), NULL, PWND_TOP, SWR_FLAGS_NOREDRAW, SWR_FLAGS_REDRAW, UserValidateCopyRgn(), and xxxEndDeferWindowPosEx().

Referenced by NtUserSetWindowRgn().

05665 { 05666 PSMWP psmwp; 05667 HRGN hrgnClip = NULL; 05668 BOOL bRet = FALSE; 05669 05670 /* 05671 * Validate the region handle. We did this for 3.51, so 05672 * we better do it for later versions. Our validation will 05673 * make a copy of the clip-rgn and send it through to the 05674 * SetWIndowRgn code. Once this is set in the kernel, we 05675 * will return to the client and the old region will be deleted 05676 * there. 05677 * 05678 * If the region passed in is NULL, then we get rid of the 05679 * current retion. Map it to HRGN_FULL so that SetWindowPos() 05680 * can tell this is what the caller wants. 05681 */ 05682 if (hrgn) { 05683 05684 if ((hrgnClip = UserValidateCopyRgn(hrgn)) == NULL) { 05685 05686 #if DBG 05687 RIPMSG0(RIP_WARNING, "xxxSetWindowRgn: Failed to create region!"); 05688 #endif 05689 goto swrClean; 05690 } 05691 #ifdef USE_MIRRORING 05692 MirrorRegion(pwnd, hrgnClip, FALSE); 05693 #endif 05694 } else { 05695 05696 hrgnClip = HRGN_FULL; 05697 } 05698 05699 /* 05700 * Get a psmwp, and put the region in it, correctly offset. 05701 * Use SWP_FRAMECHANGED with acts really as a "empty" SetWindowPos 05702 * that still sends WM_WINDOWPOSCHANGING and CHANGED messages. 05703 * SWP_NOCHANGE ensures that we don't size, move, activate, zorder. 05704 */ 05705 if (psmwp = InternalBeginDeferWindowPos(1)) { 05706 05707 /* 05708 * psmwp gets freed automatically if this routine fails. 05709 */ 05710 if (psmwp = _DeferWindowPos( 05711 psmwp, 05712 pwnd, 05713 PWND_TOP, 05714 0, 05715 0, 05716 0, 05717 0, 05718 fRedraw ? SWR_FLAGS_REDRAW : SWR_FLAGS_NOREDRAW)) { 05719 05720 /* 05721 * Do the operation. Note that hrgn is still in window coordinates. 05722 * SetWindowPos() will change it to screen coordinates before 05723 * selecting into the window. 05724 */ 05725 psmwp->acvr[0].hrgnClip = hrgnClip; 05726 bRet = xxxEndDeferWindowPosEx(psmwp, FALSE); 05727 } 05728 } 05729 05730 /* 05731 * If the call failed, then delete our region we created. A FALSE 05732 * return means it should've never made it to the xxxSelectWindowRgn 05733 * call, so everything should be as it was. 05734 */ 05735 if (!bRet && (hrgnClip != HRGN_FULL)) { 05736 05737 swrClean: 05738 05739 GreDeleteObject(hrgnClip); 05740 } 05741 05742 return bRet; 05743 }

LONG xxxSetWindowStyle PWND  pwnd,
int  gwl,
DWORD  styleNew
 

Definition at line 203 of file classchg.c.

References BOOL, CheckLock, ClrWF, DecVisWindows(), FNID_EDIT, GetAppCompatFlags2(), GETFNID, GETPTI, IDC_DEFAULT, IncVisWindows(), IsWinEventNotifyDeferredOK, NeedsWindowEdge(), NULL, PpiCurrent, PWNDDESKTOP, SetWF, tagWND::spmenu, tagWND::spwndParent, TestWF, TestwndChild, TRUE, UnlockWndMenu(), UnsetLayeredWindow(), VER40, VisWindow(), WEFWINDOWEDGE, WFCHILD, WFCPRESENT, WFINDESTROY, WFMINIMIZED, WFMPRESENT, WFWIN40COMPAT, xxxRedrawFrame(), xxxSendMessage(), xxxSetLayeredWindow(), and zzzInvalidateDCCache().

Referenced by xxxSetWindowData().

00207 { 00208 STYLESTRUCT sty; 00209 BOOL fWasChild; 00210 BOOL fIsChild; 00211 00212 CheckLock(pwnd); 00213 UserAssert(IsWinEventNotifyDeferredOK()); 00214 00215 /* 00216 * HACK-O-RAMA 00217 * A STYLESTRUCT currently has just one field: a DWORD for the style. 00218 * Therefore, conveniently, we can pass a pointer into the stack for 00219 * LPARAM. But, if we add stuff, we'll have to change this. 00220 */ 00221 sty.styleOld = ((gwl == GWL_STYLE) ? pwnd->style : pwnd->ExStyle); 00222 sty.styleNew = styleNew; 00223 00224 /* 00225 * Note that we don't do validation before _and_ after. It is sufficient 00226 * to do our stuff at the end. 00227 */ 00228 00229 /* 00230 * We break Quicken 2.0 if we send the messages. That's why we version 00231 * switch them. 00232 */ 00233 00234 /* 00235 * Send a WM_STYLECHANGING message to the window, so it can muck with 00236 * the style bits. Like validate some stuff. 00237 */ 00238 if (TestWF(pwnd, WFWIN40COMPAT)) { 00239 xxxSendMessage(pwnd, WM_STYLECHANGING, gwl, (LPARAM)(LPSTYLESTRUCT)&sty); 00240 } 00241 00242 /* 00243 * Now do our own validation. 00244 */ 00245 if (gwl == GWL_STYLE) { 00246 00247 BOOL fWasVisWindow; 00248 00249 /* 00250 * If this is an edit control that has ES_PASSWORD set and 00251 * the caller does not own it and is trying to reset it, 00252 * fail the call. 00253 */ 00254 if ((PpiCurrent() != GETPTI(pwnd)->ppi) && 00255 (GETFNID(pwnd) == FNID_EDIT) && 00256 (sty.styleOld & ES_PASSWORD) && 00257 !(sty.styleNew & ES_PASSWORD)) { 00258 RIPERR0(ERROR_ACCESS_DENIED, 00259 RIP_WARNING, 00260 "Access denied in xxxSetWindowStyle"); 00261 00262 return 0; 00263 } 00264 00265 /* Listbox ownerdraw style check was moved to the client side (client\ntstubs.c) */ 00266 00267 /* 00268 * Do proper validation on style bits 00269 */ 00270 if (pwnd->spwndParent == PWNDDESKTOP(pwnd)) 00271 sty.styleNew |= WS_CLIPSIBLINGS; 00272 00273 /* 00274 * If the clipping-ness is changing, invalidate the dc cache. 00275 */ 00276 if ((sty.styleNew & (WS_CLIPCHILDREN | WS_CLIPSIBLINGS)) != 00277 (sty.styleOld & (WS_CLIPCHILDREN | WS_CLIPSIBLINGS))) { 00278 00279 /* 00280 * No need to DeferWinEventNotify() - pwnd is locked 00281 */ 00282 zzzInvalidateDCCache(pwnd, IDC_DEFAULT); 00283 } 00284 00285 /* 00286 * This breaks all Paradox dialogs 1.0-5.0 that have combos. They 00287 * enumerate all child windows, add on minimized, then sit in a peek 00288 * loop. After that they enumerate all child windows and remove 00289 * WS_MINIMIZE--except the code below won't let them. 00290 * 00291 * Result is weird painting and an inability to use the dialog any 00292 * more short of dismissing it 00293 * 00294 * Temp fix: Check for child window first. 00295 */ 00296 00297 /* 00298 * if this window is REALLY minimized (minimized bit is set and caption 00299 * present bit is removed), then don't allow app to remove the minimize 00300 * bit -- this fixes FoxBlow's attempt at being the OS -- jeffbog 00301 */ 00302 if (!TestWF(pwnd, WFCHILD) && 00303 TestWF(pwnd, WFMINIMIZED) && 00304 !TestWF(pwnd, WFCPRESENT) && 00305 !(sty.styleNew & WS_MINIMIZE)) { 00306 00307 sty.styleNew |= WS_MINIMIZE; 00308 } 00309 00310 /* 00311 * If we're changing the child bit, deal with spmenu appropriately. 00312 * If we're turning into a child, change spmenu to an id. If we're 00313 * turning into a top level window, turn spmenu into a menu. 00314 */ 00315 fWasChild = TestwndChild(pwnd); 00316 00317 pwnd->style = sty.styleNew; 00318 00319 fIsChild = TestwndChild(pwnd); 00320 00321 /* 00322 * If we turned into a top level window, change spmenu to NULL. 00323 * If we turned into a child from a top level window, unlock spmenu. 00324 */ 00325 if (fWasChild && !fIsChild) 00326 pwnd->spmenu = NULL; 00327 00328 if (!fWasChild && fIsChild) { 00329 ClrWF(pwnd, WFMPRESENT); 00330 UnlockWndMenu(pwnd, &pwnd->spmenu); 00331 } 00332 00333 /* 00334 * If the visible, child, or minimized style is changing, 00335 * then update the cVisWindows count 00336 */ 00337 fWasVisWindow = VisWindow(pwnd, sty.styleOld); 00338 if (fWasVisWindow != VisWindow(pwnd, sty.styleNew)) 00339 { 00340 00341 #if DBG 00342 if (TestWF(pwnd, WFINDESTROY)) { 00343 RIPMSG1(RIP_ERROR, "xxxSetWindowStyle: window INDESTROY 0x%08X", pwnd); 00344 } 00345 #endif 00346 00347 // IncDecVisWindows(pwnd, !fWasVisWindow); 00348 if (fWasVisWindow) 00349 DecVisWindows(pwnd); 00350 else 00351 IncVisWindows(pwnd); 00352 } 00353 } else { 00354 /* 00355 * First, see if the app might be setting bits that it really 00356 * doesn't know about. If so, replace those bits with the 00357 * current values. 00358 */ 00359 if (GetAppCompatFlags2(VER40) & GACF2_NO50EXSTYLEBITS) { 00360 sty.styleNew &= WS_EX_VALID40; 00361 } else { 00362 /* 00363 * Don't let aplications set unused extended bits 00364 * Mcostea #237449 00365 */ 00366 #if DBG 00367 if (sty.styleNew & ~WS_EX_ALLVALID) { 00368 RIPMSG0(RIP_WARNING, "Trying to set reserved exStyle bits in SetWindowLong"); 00369 } 00370 #endif 00371 sty.styleNew &= WS_EX_ALLVALID; 00372 } 00373 /* 00374 * Is someone trying to toggle the WS_EX_TOPMOST style bit? 00375 */ 00376 if ((sty.styleOld & WS_EX_TOPMOST) != (sty.styleNew & WS_EX_TOPMOST)) { 00377 00378 #if DBG 00379 /* 00380 * Rip in debug about this 00381 */ 00382 RIPMSG0(RIP_WARNING, "Can't change WS_EX_TOPMOST with SetWindowLong"); 00383 #endif 00384 00385 /* 00386 * BACKWARDS COMPATIBILITY HACK 00387 * If stuff is getting stored in the high word, then it must be 00388 * Lotus 123-W sticking a FAR pointer in this field. So don't 00389 * modify it. 00390 */ 00391 if (TestWF(pwnd, WFWIN40COMPAT) || !HIWORD(sty.styleNew)) { 00392 00393 /* 00394 * Don't let the bit be flipped 00395 */ 00396 sty.styleNew &= ~WS_EX_TOPMOST; 00397 sty.styleNew |= (sty.styleOld & WS_EX_TOPMOST); 00398 } 00399 } 00400 00401 { 00402 /* 00403 * Check pwnd->ExStyle directly since sty.styleOld can now be 00404 * different from the real state of the window, because of the 00405 * callbacks in this function from the time sty.styleOld was 00406 * remembered and up to now. We must call the layering functions 00407 * based on the real state of the layering bit. 00408 */ 00409 BOOL fWasSprite = (pwnd->ExStyle & WS_EX_LAYERED); 00410 BOOL fSprite = (sty.styleNew & WS_EX_LAYERED); 00411 00412 if (fWasSprite && !fSprite) { 00413 if (!UnsetLayeredWindow(pwnd)) { 00414 return 0; 00415 } 00416 } else if (!fWasSprite && fSprite) { 00417 if (!xxxSetLayeredWindow(pwnd, TRUE)) { 00418 return 0; 00419 } 00420 } 00421 } 00422 00423 #ifdef REDIRECTION 00424 { 00425 BOOL fWasRedirected = (pwnd->ExStyle & WS_EX_REDIRECTED); 00426 BOOL fRedirected = (sty.styleNew & WS_EX_REDIRECTED); 00427 00428 if (fWasRedirected && !fRedirected) { 00429 if (!UnsetRedirectedWindow(pwnd)) { 00430 return 0; 00431 } 00432 } else if (!fWasRedirected && fRedirected) { 00433 if (!SetRedirectedWindow(pwnd)) { 00434 return 0; 00435 } 00436 } 00437 } 00438 #endif // REDIRECTION 00439 00440 /* 00441 * The bits we use internally should be preserved 00442 */ 00443 pwnd->ExStyle = sty.styleNew | (sty.styleOld & ~WS_EX_ALLVALID); 00444 if ((sty.styleOld ^ sty.styleNew) 00445 & (WS_EX_LEFTSCROLLBAR | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LAYOUTRTL)) { 00446 xxxRedrawFrame(pwnd); 00447 } 00448 } 00449 00450 /* 00451 * See if we still need the 3D edge since the window styles changed. 00452 */ 00453 if (NeedsWindowEdge(pwnd->style, pwnd->ExStyle, TestWF(pwnd, WFWIN40COMPAT))) 00454 SetWF(pwnd, WEFWINDOWEDGE); 00455 else 00456 ClrWF(pwnd, WEFWINDOWEDGE); 00457 00458 /* 00459 * Send a WM_STYLECHANGED message 00460 */ 00461 if (TestWF(pwnd, WFWIN40COMPAT)) 00462 xxxSendMessage(pwnd, WM_STYLECHANGED, gwl, (LPARAM)(LPSTYLESTRUCT)&sty); 00463 00464 return(sty.styleOld); 00465 }

BOOL xxxShowOwnedPopups PWND  pwndOwner,
BOOL  fShow
 

Definition at line 593 of file showwin.c.

References BOOL, CheckLock, NULL, TRUE, UINT, and xxxShowOwnedWindows().

00596 { 00597 CheckLock(pwndOwner); 00598 00599 xxxShowOwnedWindows(pwndOwner, 00600 (UINT)(fShow ? SW_PARENTOPENING : SW_PARENTCLOSING), NULL); 00601 return TRUE; 00602 }

VOID xxxShowOwnedWindows PWND  pwndOwner,
UINT  cmdShow,
HRGN  hrgnHung
 

Definition at line 437 of file showwin.c.

References BOOL, BuildHwndList(), BWL_ENUMLIST, CFKANJIWINDOW, CheckLock, FreeHwndList(), NULL, PWNDDESKTOP, tagWND::rcWindow, RevalidateHwnd, tagBWL::rghwnd, SetVisible(), SetWF, tagWND::spwndOwner, SV_UNSET, TestCF, TestWF, TestwndChild, TestwndHI, ThreadLockAlways, ThreadUnlock, UnionRgn, WFDISABLED, WFHIDDENPOPUP, WFMINIMIZED, WFVISIBLE, and xxxSendMessage().

Referenced by xxxMinimizeHungWindow(), xxxMinMaximize(), and xxxShowOwnedPopups().

00441 { 00442 BOOL fShow; 00443 int cmdZoom; 00444 HWND *phwnd; 00445 PBWL pbwl; 00446 PWND pwnd, pwndTopOwner; 00447 TL tlpwnd; 00448 00449 CheckLock(pwndOwner); 00450 00451 /* 00452 * Not interested in child windows 00453 */ 00454 if (TestwndChild(pwndOwner)) 00455 return; 00456 00457 if ((pbwl = BuildHwndList(PWNDDESKTOP(pwndOwner)->spwndChild, BWL_ENUMLIST, NULL)) == NULL) 00458 return; 00459 00460 /* 00461 * NOTE: The following code assumes the values of SW_* are 1, 2, 3, and 4 00462 */ 00463 fShow = (cmdShow >= SW_PARENTOPENING); 00464 00465 cmdZoom = 0; 00466 if (cmdShow == SW_OTHERZOOM) 00467 cmdZoom = SIZEZOOMHIDE; 00468 00469 if (cmdShow == SW_OTHERUNZOOM) 00470 cmdZoom = SIZEZOOMSHOW; 00471 00472 /* 00473 * If zoom/unzoom, then open/close all popups owned by all other 00474 * windows. Otherwise, open/close popups owned by pwndOwner. 00475 */ 00476 for (phwnd = pbwl->rghwnd; *phwnd != (HWND)1; phwnd++) { 00477 00478 /* 00479 * Lock the window before we play with it. 00480 * If the window handle is invalid, skip it 00481 */ 00482 if ((pwnd = RevalidateHwnd(*phwnd)) == NULL) 00483 continue; 00484 00485 /* 00486 * Kanji windows can't be owned, so skip it. 00487 */ 00488 if (TestCF(pwnd, CFKANJIWINDOW)) 00489 continue; 00490 00491 /* 00492 * If same as window passed in, skip it. 00493 */ 00494 if (pwnd == pwndOwner) 00495 continue; 00496 00497 /* 00498 * Find ultimate owner of popup, but only go up as far as pwndOwner. 00499 */ 00500 if ((pwndTopOwner = pwnd->spwndOwner) != NULL) { 00501 00502 /* 00503 * The TestwndHI is needed since if it has an icon, pwndOwner 00504 * is invalid. 00505 */ 00506 while (!TestwndHI(pwndTopOwner) && pwndTopOwner != pwndOwner && 00507 pwndTopOwner->spwndOwner != NULL) 00508 pwndTopOwner = pwndTopOwner->spwndOwner; 00509 } 00510 00511 /* 00512 * Zoom/Unzoom case. 00513 */ 00514 if (cmdZoom != 0) { 00515 00516 /* 00517 * If no parent, or parents are the same, skip. 00518 */ 00519 if (pwndTopOwner == NULL || pwndTopOwner == pwndOwner) 00520 continue; 00521 00522 /* 00523 * If owner is iconic, then this window should stay hidden, 00524 * UNLESS the minimized window is disabled, in which case we'd 00525 * better show the window. 00526 */ 00527 if ( cmdShow == SW_OTHERUNZOOM 00528 && pwndTopOwner != NULL 00529 && TestWF(pwndTopOwner, WFMINIMIZED) 00530 && !TestWF(pwndTopOwner, WFDISABLED) 00531 ) 00532 continue; 00533 } else { 00534 /* 00535 * Hide/Iconize/Show/Open case. 00536 */ 00537 /* 00538 * If parents aren't the same, skip. 00539 */ 00540 if (pwndTopOwner != pwndOwner) 00541 continue; 00542 } 00543 00544 /* 00545 * Hide or show if: 00546 * Showing & this is a hidden popup 00547 * OR 00548 * Hiding & this is a visible window 00549 */ 00550 if ((fShow && TestWF(pwnd, WFHIDDENPOPUP)) || 00551 (!fShow && TestWF(pwnd, WFVISIBLE))) { 00552 /* 00553 * For hung minimization, just set the HIDDENPOPUP bit, clear 00554 * the visible bit and add the window rect to the region to 00555 * be repainted. 00556 */ 00557 if (hrgnHung != NULL) { 00558 HRGN hrgn = GreCreateRectRgnIndirect(&pwnd->rcWindow); 00559 UnionRgn(hrgnHung, hrgnHung, hrgn); 00560 GreDeleteObject(hrgn); 00561 00562 UserAssert(!fShow); 00563 00564 SetWF(pwnd, WFHIDDENPOPUP); 00565 SetVisible(pwnd, SV_UNSET); 00566 } else { 00567 ThreadLockAlways(pwnd, &tlpwnd); 00568 xxxSendMessage(pwnd, WM_SHOWWINDOW, fShow, (LONG)cmdShow); 00569 ThreadUnlock(&tlpwnd); 00570 } 00571 } 00572 } 00573 00574 /* 00575 * Free the window list. 00576 */ 00577 FreeHwndList(pbwl); 00578 }

BOOL xxxShowScrollBar PWND  ,
UINT  ,
BOOL 
 

Definition at line 32 of file kernel/sbapi.c.

References _InitPwSB(), BOOL, CheckLock, DWORD, FALSE, NULL, tagWND::pSBInfo, PUDF_ANIMATE, TEST_PUDF, TRUE, xxxRedrawFrame(), and xxxShowWindow().

Referenced by NtUserShowScrollBar().

00036 { 00037 BOOL fChanged = FALSE; 00038 DWORD dwStyle; 00039 00040 CheckLock(pwnd); 00041 00042 switch (wBar) 00043 { 00044 case SB_CTL: 00045 { 00046 00047 xxxShowWindow( 00048 pwnd, 00049 (fShow ? SHOW_OPENWINDOW : HIDE_WINDOW) | TEST_PUDF(PUDF_ANIMATE)); 00050 00051 return(TRUE); 00052 } 00053 00054 case SB_HORZ: 00055 dwStyle = WS_HSCROLL; 00056 break; 00057 00058 case SB_VERT: 00059 dwStyle = WS_VSCROLL; 00060 break; 00061 00062 case SB_BOTH: 00063 dwStyle = WS_HSCROLL | WS_VSCROLL; 00064 break; 00065 } 00066 00067 if (!fShow) 00068 { 00069 if (pwnd->style & dwStyle) 00070 { 00071 fChanged = TRUE; 00072 pwnd->style &= ~dwStyle; 00073 } 00074 } else { 00075 if ((pwnd->style & dwStyle) != dwStyle) 00076 { 00077 fChanged = TRUE; 00078 pwnd->style |= dwStyle; 00079 } 00080 00081 /* 00082 * Make sure that pwsb is initialized. 00083 */ 00084 if (pwnd->pSBInfo == NULL) 00085 _InitPwSB(pwnd); 00086 } 00087 00088 /* 00089 * If the state changed, redraw the frame and force WM_NCPAINT. 00090 */ 00091 if (fChanged) { 00092 00093 /* 00094 * We always redraw even if minimized or hidden... Otherwise, it seems 00095 * the scroll bars aren't properly hidden/shown when we become 00096 * visible 00097 */ 00098 xxxRedrawFrame(pwnd); 00099 } 00100 return TRUE; 00101 }

BOOL xxxShowWindow PWND  pwnd,
DWORD  cmdShowAnimate
 

Definition at line 85 of file showwin.c.

References _FChildVisible(), AW_SKIP, AW_USE, BOOL, BYTE, CFSAVEBITS, CheckLock, ClrWF, tagUSERSTARTUPINFO::dwFlags, FALSE, GetFullScreen, gpqForeground, grpdeskRitInput, tagWND::head, L, LOBYTE, MINMAX_ANIMATE, NULL, tagTHREADINFO::ppi, tagTHREADINFO::pq, PtiCurrent, PWNDDESKTOP, tagWND::rcClient, SetFullScreen, SetVisible(), tagQ::spwndActive, tagWND::spwndOwner, tagWND::spwndParent, SV_SET, SV_UNSET, TestCF, TestWF, TestwndChild, TRUE, UINT, tagPROCESSINFO::usi, WFBORDERMASK, WFCAPTION, WFMAXIMIZED, WFMINIMIZED, WFSENDSIZEMOVE, WFVISIBLE, WFWIN31COMPAT, tagUSERSTARTUPINFO::wShowWindow, xxxActivateWindow(), xxxCheckFocus(), xxxMakeWindowForegroundWithState(), xxxMinimizeHungWindow(), xxxMinMaximize(), xxxSendMessage(), xxxSendSizeMessage(), and xxxSetWindowPos().

Referenced by NtUserShowWindow(), xxxbFullscreenSwitch(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyWindow(), xxxMenuWindowProc(), xxxMNCloseHierarchy(), xxxProcessEventMessage(), xxxSetInternalWindowPos(), xxxSetParent(), xxxSetWindowPlacement(), xxxShowScrollBar(), and xxxSysCommand().

00088 { 00089 BOOL fVisOld, fVisNew; 00090 UINT swpFlags = SWP_NOMOVE | SWP_NOSIZE; 00091 PTHREADINFO pti; 00092 BOOL bFirstMain = FALSE; 00093 int cmdShow = LOWORD(cmdShowAnimate); 00094 00095 CheckLock(pwnd); 00096 00097 fVisOld = TestWF(pwnd, WFVISIBLE); 00098 pti = PtiCurrent(); 00099 00100 /* 00101 * See if this is the first "main" top level 00102 * window being created by this application - if show, assume it 00103 * is showing with the SW_SHOWDEFAULT command. 00104 * 00105 * Checks for: 00106 * - cmdShow is a "default" show command 00107 * - we haven't done startupinfo yet (we only use it once) 00108 * - this is not a child (it is a top level window) 00109 * - this has a titlebar (indicator of the main window) 00110 * - it isn't owned (indicator of the main window) 00111 */ 00112 if ((pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW) && 00113 !TestwndChild(pwnd) && 00114 (TestWF(pwnd, WFBORDERMASK) == (BYTE)LOBYTE(WFCAPTION)) && 00115 (pwnd->spwndOwner == NULL)) { 00116 00117 bFirstMain = TRUE; 00118 00119 switch (cmdShow) { 00120 case SW_SHOWNORMAL: 00121 case SW_SHOW: 00122 00123 /* 00124 * Then assume default! 00125 */ 00126 cmdShow = SW_SHOWDEFAULT; 00127 break; 00128 } 00129 } 00130 00131 /* 00132 * If this application specified SW_SHOWDEFAULT, then we get the 00133 * real SW_* command from the application's STARTUPINFO structure 00134 * (STARTUPINFO is passed to CreateProcess() when this application 00135 * was launched). 00136 */ 00137 if (cmdShow == SW_SHOWDEFAULT) { 00138 00139 /* 00140 * Call the client to get the SW_* command from the STARTUPINFO 00141 * for this process. 00142 */ 00143 if (pti->ppi->usi.dwFlags & STARTF_USESHOWWINDOW) { 00144 00145 bFirstMain = TRUE; 00146 00147 cmdShow = pti->ppi->usi.wShowWindow; 00148 00149 /* 00150 * The following code was removed in 3.51 00151 * 00152 * switch (cmdShow) { 00153 * case SW_SHOWMINIMIZED: 00154 * case SW_MINIMIZE: 00155 * 00156 * * 00157 * * If the default show was "minimized", then make sure it doesn't 00158 * * become active. Minimized is effectively "background". 00159 * * 00160 * cmdShow = SW_SHOWMINNOACTIVE; 00161 * break; 00162 * } 00163 * 00164 */ 00165 } 00166 } 00167 00168 00169 /* 00170 * This is in case someone said SW_SHOWDEFAULT but has no startupinfo. 00171 * Or in case cmdShow inside of STARTUPINFO is SW_SHOWDEFAULT. 00172 */ 00173 if (cmdShow == SW_SHOWDEFAULT) 00174 cmdShow = SW_SHOWNORMAL; 00175 00176 /* 00177 * Turn off startup info. We turn this off after the first call to 00178 * ShowWindow. If we don't apps can be started by progman with 00179 * the start info being minimized and then be restored and then 00180 * call ShowWindow(SW_SHOW) and the app would minimize again. 00181 * Notepad had that problem 2985. 00182 */ 00183 if (bFirstMain) { 00184 pti->ppi->usi.dwFlags &= 00185 ~(STARTF_USESHOWWINDOW | STARTF_USESIZE | STARTF_USEPOSITION); 00186 } 00187 00188 00189 /* 00190 * Take care of all the OLD show commands with columns & iconslot. 00191 */ 00192 if (cmdShow & 0xFF00) { 00193 if ((cmdShow & 0xFF80) == (int)0xFF80) 00194 cmdShow = SW_SHOWMINNOACTIVE; 00195 else 00196 cmdShow = SW_SHOW; 00197 } 00198 00199 /* 00200 * Change to new fullscreen if needed and in same desktop 00201 */ 00202 if ((GetFullScreen(pwnd) != WINDOWED) 00203 && (pwnd->head.rpdesk == grpdeskRitInput)) { 00204 if ((cmdShow == SW_SHOWNORMAL) || 00205 (cmdShow == SW_RESTORE) || 00206 (cmdShow == SW_MAXIMIZE) || 00207 (cmdShow == SW_SHOWMAXIMIZED)) { 00208 cmdShow = SW_SHOWMINIMIZED; 00209 00210 if (GetFullScreen(pwnd) == FULLSCREENMIN) { 00211 SetFullScreen(pwnd, FULLSCREEN); 00212 } 00213 00214 if (gpqForeground != NULL && 00215 gpqForeground->spwndActive == pwnd) { 00216 xxxMakeWindowForegroundWithState(NULL, 0); 00217 } 00218 } 00219 } 00220 00221 switch (cmdShow) { 00222 case SW_SHOWNOACTIVATE: 00223 case SW_SHOWNORMAL: 00224 case SW_RESTORE: 00225 00226 /* 00227 * If min/max, let xxxMinMaximize() do all the work. 00228 */ 00229 if (TestWF(pwnd, WFMINIMIZED) || TestWF(pwnd, WFMAXIMIZED)) { 00230 xxxMinMaximize(pwnd, (UINT)cmdShow, cmdShowAnimate & MINMAX_ANIMATE); 00231 return fVisOld; 00232 00233 } else { 00234 00235 /* 00236 * Ignore if the window is already visible. 00237 */ 00238 if (fVisOld) { 00239 return fVisOld; 00240 } 00241 00242 swpFlags |= SWP_SHOWWINDOW; 00243 if ( cmdShow == SW_SHOWNOACTIVATE) { 00244 swpFlags |= SWP_NOZORDER; 00245 #ifdef NEVER 00246 /* 00247 * This is what win3.1 does. On NT, since each "queue" has 00248 * its own active window, there is often no active window. 00249 * In this case, win3.1 turns a SHOWNOACTIVATE into a "SHOW 00250 * with activate". Since win3.1 almost always has an active 00251 * window, this almost never happens. So on NT, we're not 00252 * going to do this check - that way we'll be more compatible 00253 * with win3.1 because we'll usally not activate (like win3.1). 00254 * With this check, this causes FoxPro 2.5 for Windows to not 00255 * properly activate its command window when first coming up. 00256 */ 00257 if (pti->pq->spwndActive != NULL) 00258 swpFlags |= SWP_NOACTIVATE; 00259 #else 00260 swpFlags |= SWP_NOACTIVATE; 00261 #endif 00262 } 00263 } 00264 break; 00265 00266 case SW_FORCEMINIMIZE: 00267 xxxMinimizeHungWindow(pwnd); 00268 return fVisOld; 00269 00270 case SW_SHOWMINNOACTIVE: 00271 case SW_SHOWMINIMIZED: 00272 case SW_SHOWMAXIMIZED: 00273 case SW_MINIMIZE: 00274 xxxMinMaximize(pwnd, (UINT)cmdShow, cmdShowAnimate & MINMAX_ANIMATE); 00275 return fVisOld; 00276 00277 case SW_SHOWNA: 00278 swpFlags |= SWP_SHOWWINDOW | SWP_NOACTIVATE; 00279 00280 00281 /* 00282 * LATER removed this to be compatible with SHOWNOACTIVATE 00283 * if (pti->pq->spwndActive != NULL) 00284 * swpFlags |= SWP_NOACTIVATE; 00285 */ 00286 break; 00287 00288 case SW_SHOW: 00289 00290 /* 00291 * Don't bother if it is already visible. 00292 */ 00293 if (fVisOld) 00294 return fVisOld; 00295 00296 swpFlags |= SWP_SHOWWINDOW; 00297 UserAssert(cmdShow != SW_SHOWNOACTIVATE); 00298 break; 00299 00300 case SW_HIDE: 00301 00302 /* 00303 * Don't bother if it is already hidden. 00304 */ 00305 if (!fVisOld) 00306 return fVisOld; 00307 00308 swpFlags |= SWP_HIDEWINDOW; 00309 if (pwnd != pti->pq->spwndActive) 00310 swpFlags |= (SWP_NOACTIVATE | SWP_NOZORDER); 00311 break; 00312 00313 default: 00314 RIPERR0(ERROR_INVALID_SHOWWIN_COMMAND, RIP_VERBOSE, ""); 00315 return fVisOld; 00316 } 00317 00318 /* 00319 * If we're changing from visible to hidden or vise-versa, send 00320 * WM_SHOWWINDOW. 00321 */ 00322 fVisNew = !(cmdShow == SW_HIDE); 00323 if (fVisNew != fVisOld) { 00324 xxxSendMessage(pwnd, WM_SHOWWINDOW, fVisNew, 0L); 00325 if (!TestWF(pwnd, WFWIN31COMPAT)) { 00326 xxxSendMessage(pwnd, WM_SETVISIBLE, fVisNew, 0L); 00327 } 00328 } 00329 00330 if (!TestwndChild(pwnd)) { 00331 if (TestCF(pwnd, CFSAVEBITS)) { 00332 00333 /* 00334 * Activate to prevent discarding saved bits??? 00335 */ 00336 if (cmdShow == SW_SHOW || cmdShow == SW_SHOWNORMAL) { 00337 xxxActivateWindow(pwnd, AW_USE); 00338 swpFlags |= SWP_NOZORDER | SWP_NOACTIVATE; 00339 } 00340 } 00341 } else { 00342 00343 /* 00344 * Children can't get activation... 00345 */ 00346 swpFlags |= (SWP_NOACTIVATE | SWP_NOZORDER); 00347 } 00348 00349 /* 00350 * If our parent is hidden, don't bother to call xxxSetWindowPos. 00351 */ 00352 if (_FChildVisible(pwnd)) { 00353 xxxSetWindowPos(pwnd, (PWND)NULL, 0, 0, 0, 0, swpFlags); 00354 } else { 00355 if (cmdShow == SW_HIDE) 00356 SetVisible(pwnd, SV_UNSET); 00357 else 00358 SetVisible(pwnd, SV_SET); 00359 } 00360 00361 /* 00362 * Send size and move messages AFTER repainting 00363 */ 00364 if (TestWF(pwnd, WFSENDSIZEMOVE)) { 00365 ClrWF(pwnd, WFSENDSIZEMOVE); 00366 if (TestWF(pwnd, WFMINIMIZED)) { 00367 xxxSendSizeMessage(pwnd, SIZE_MINIMIZED); 00368 } else if (TestWF(pwnd, WFMAXIMIZED)) { 00369 xxxSendSizeMessage(pwnd, SIZE_MAXIMIZED); 00370 } else { 00371 xxxSendSizeMessage(pwnd, SIZE_RESTORED); 00372 } 00373 00374 xxxSendMessage(pwnd, WM_MOVE, 0, 00375 (pwnd->spwndParent == PWNDDESKTOP(pwnd)) ? 00376 MAKELONG(pwnd->rcClient.left, pwnd->rcClient.top) : 00377 MAKELONG( 00378 pwnd->rcClient.left - pwnd->spwndParent->rcClient.left, 00379 pwnd->rcClient.top - pwnd->spwndParent->rcClient. top)); 00380 } 00381 00382 /* 00383 * If hiding and is active-foreground window, activate someone else. 00384 * If hiding a active window make someone active. 00385 */ 00386 if (cmdShow == SW_HIDE) { 00387 if ((pwnd == pti->pq->spwndActive) && (pti->pq == gpqForeground)) { 00388 xxxActivateWindow(pwnd, AW_SKIP); 00389 } else { 00390 xxxCheckFocus(pwnd); 00391 } 00392 } 00393 00394 return fVisOld; 00395 }

void xxxSimpleDoSyncPaint PWND  pwnd  ) 
 

Definition at line 740 of file paint.c.

References CheckLock, ClearHungFlag(), ClrWF, CMSHUNGAPPTIMEOUT, DeleteMaybeSpecialRgn(), DSP_ERASE, DSP_FRAME, DWORD, FALSE, FHungApp(), GetNCUpdateRgn(), GETPTI, grpdeskRitInput, tagWND::hrgnUpdate, NULL, tagDESKTOP::pDeskInfo, PtiCurrent, tagDESKTOPINFO::spwnd, TestWF, TestwndChild, TRUE, VOID(), WFERASEBKGND, WFPAINTNOTPROCESSED, WFPIXIEHACK, WFREDRAWIFHUNG, WFSENDERASEBKGND, WFSENDNCPAINT, WFVISIBLE, xxxRedrawHungWindow(), xxxSendEraseBkgnd(), and xxxSendNCPaint().

Referenced by xxxDispatchMessage(), xxxGetUpdateRect(), xxxGetUpdateRgn(), xxxInternalDoSyncPaint(), and xxxUpdateWindow2().

00742 { 00743 HRGN hrgnUpdate; 00744 DWORD flags = 0; 00745 00746 CheckLock(pwnd); 00747 00748 /* 00749 * Since we're taking care of the frame drawing, we can consider 00750 * this WM_PAINT message processed. 00751 */ 00752 ClrWF(pwnd, WFPAINTNOTPROCESSED); 00753 00754 /* 00755 * Make copies of these flags, because their state might 00756 * change after we send a message, and we don't want 00757 * to "lose" them. 00758 */ 00759 if (TestWF(pwnd, WFSENDNCPAINT)) 00760 flags |= DSP_FRAME; 00761 00762 if (TestWF(pwnd, WFSENDERASEBKGND)) 00763 flags |= DSP_ERASE; 00764 00765 if (flags & (DSP_ERASE | DSP_FRAME)) { 00766 00767 if (!TestWF(pwnd, WFVISIBLE)) { 00768 00769 /* 00770 * If there is no update region, just clear the bits. 00771 */ 00772 ClrWF(pwnd, WFSENDNCPAINT); 00773 ClrWF(pwnd, WFSENDERASEBKGND); 00774 ClrWF(pwnd, WFPIXIEHACK); 00775 ClrWF(pwnd, WFERASEBKGND); 00776 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 00777 00778 } else { 00779 00780 PTHREADINFO ptiCurrent = PtiCurrent(); 00781 00782 /* 00783 * If there is no update region, we don't have to 00784 * do any erasing, but we may need to send an NCPAINT. 00785 */ 00786 if (pwnd->hrgnUpdate == NULL) { 00787 ClrWF(pwnd, WFSENDERASEBKGND); 00788 ClrWF(pwnd, WFERASEBKGND); 00789 flags &= ~DSP_ERASE; 00790 } 00791 00792 /* 00793 * Only mess with windows owned by the current thread. 00794 * NOTE: This means that WM_NCPAINT and WM_ERASEBKGND are 00795 * only sent intra-thread. 00796 */ 00797 if (GETPTI(pwnd) == ptiCurrent) { 00798 00799 hrgnUpdate = GetNCUpdateRgn(pwnd, TRUE); 00800 00801 if (flags & DSP_FRAME) { 00802 00803 /* 00804 * If the message got sent before we got here then do 00805 * nothing. 00806 */ 00807 if (TestWF(pwnd, WFSENDNCPAINT)) 00808 xxxSendNCPaint(pwnd, hrgnUpdate); 00809 } 00810 00811 if (flags & DSP_ERASE) { 00812 00813 if (TestWF(pwnd, WFSENDNCPAINT)) { 00814 /* 00815 * If we got another invalidate during the NCPAINT 00816 * callback get the new update region 00817 */ 00818 DeleteMaybeSpecialRgn(hrgnUpdate); 00819 hrgnUpdate = GetNCUpdateRgn(pwnd, FALSE); 00820 } 00821 00822 /* 00823 * If the message got sent before we got here 00824 * (e.g.: an UpdateWindow() inside WM_NCPAINT handler, 00825 * for example), don't do anything. 00826 * 00827 * WINPROJ.EXE (version 1.0) calls UpdateWindow() in 00828 * the WM_NCPAINT handlers for its subclassed listboxes 00829 * in the open dialog. 00830 */ 00831 if (TestWF(pwnd, WFSENDERASEBKGND)) { 00832 ClrWF(pwnd, WFSENDERASEBKGND); 00833 ClrWF(pwnd, WFERASEBKGND); 00834 xxxSendEraseBkgnd(pwnd, NULL, hrgnUpdate); 00835 } 00836 00837 /* 00838 * The erase and frame operation has occured. Clear the 00839 * WFREDRAWIFHUNG bit here. We don't want to clear it until we 00840 * know the erase and frame has occured, so we know we always 00841 * have a consistent looking window. 00842 */ 00843 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 00844 } 00845 00846 DeleteMaybeSpecialRgn(hrgnUpdate); 00847 00848 } else if (!TestwndChild(pwnd) && 00849 (pwnd != grpdeskRitInput->pDeskInfo->spwnd) && 00850 FHungApp(GETPTI(pwnd), CMSHUNGAPPTIMEOUT) && 00851 TestWF(pwnd, WFREDRAWIFHUNG)) { 00852 00853 ClearHungFlag(pwnd, WFREDRAWIFHUNG); 00854 xxxRedrawHungWindow(pwnd, NULL); 00855 } 00856 } 00857 } 00858 }

VOID xxxSimulateShiftF10 VOID   ) 
 

Definition at line 3797 of file rare.c.

References FALSE, NtGetTickCount(), VOID(), and xxxKeyEvent().

Referenced by xxxDefWindowProc().

03798 { 03799 /* 03800 * VK_SHIFT down 03801 */ 03802 xxxKeyEvent(VK_LSHIFT, 0x2A | SCANCODE_SIMULATED, NtGetTickCount(), 0, FALSE); 03803 03804 /* 03805 * VK_F10 down 03806 */ 03807 xxxKeyEvent(VK_F10, 0x44 | SCANCODE_SIMULATED, NtGetTickCount(), 0, FALSE); 03808 03809 /* 03810 * VK_F10 up 03811 */ 03812 xxxKeyEvent(VK_F10 | KBDBREAK, 0x44 | SCANCODE_SIMULATED, NtGetTickCount(), 0, FALSE); 03813 03814 /* 03815 * VK_SHIFT up 03816 */ 03817 xxxKeyEvent(VK_LSHIFT | KBDBREAK, 0x2A | SCANCODE_SIMULATED, NtGetTickCount(), 0, FALSE); 03818 }

BOOL xxxSleepTask BOOL  fInputIdle,
HANDLE 
 

Definition at line 252 of file taskman.c.

References tagTHREADINFO::apEvent, BOOL, CheckCritIn, CheckForClientDeath, ClientDeliverUserApc(), tagWOWPROCESSINFO::CSOwningThread, DirectedScheduleTask(), EnterCrit, EnterWowCritSect(), EVENT_INCREMENT, ExitWowCritSect(), FALSE, tagCLIENTTHREADINFO::fsChangeBits, tagCLIENTTHREADINFO::fsWakeMask, gpsi, HEVENT_REMOVEME, tagWOWPROCESSINFO::hEventWowExecClient, IEV_TASK, IEV_WOWEXEC, InsertTask(), IsHooked, KeClearEvent, KeSetEvent(), KeWaitForMultipleObjects(), LeaveCrit, tagTDB::nEvents, tagWOWPROCESSINFO::nRecvLock, tagWOWPROCESSINFO::nSendLock, tagWOWPROCESSINFO::nTaskLock, NTSTATUS(), NULL, tagTHREADINFO::pcti, tagTHREADINFO::pEventQueueServer, tagWOWPROCESSINFO::pEventWowExec, POLL_EVENT_CNT, tagTHREADINFO::ppi, PsGetCurrentThread, PsIsThreadTerminating, PSMS, tagTHREADINFO::psmsCurrent, tagTHREADINFO::ptdb, tagWOWPROCESSINFO::ptdbHead, tagTDB::ptdbNext, tagTDB::pti, PtiCurrent, tagWOWPROCESSINFO::ptiScheduled, tagPROCESSINFO::pwpi, SMF_RECEIVEDMESSAGE, SMF_RECEIVERBUSY, SMF_REPLY, Status, TIF_16BIT, tagTHREADINFO::TIF_flags, TIF_SHAREDWOW, TRUE, UserMode, WHF_FOREGROUNDIDLE, WrUserRequest, xxxCallHook(), and zzzWakeInputIdle().

Referenced by _ReplyMessage(), NtUserWaitForMsgAndEvent(), xxxDirectedYield(), xxxInternalGetMessage(), xxxPollAndWaitForSingleObject(), xxxReceiveMessage(), xxxSleepThread(), and xxxUserYield().

00255 { 00256 PTDB ptdb; 00257 PTHREADINFO pti; 00258 PPROCESSINFO ppi; 00259 PWOWPROCESSINFO pwpi; 00260 PSMS psms; 00261 NTSTATUS Status; 00262 int nHandles; 00263 BOOLEAN bWaitedAtLeastOnce; 00264 00265 /* 00266 * !!! 00267 * ClearSendMessages assumes that this function does NOT leave the 00268 * critical section when called with fInputIdle==FALSE and from a 00269 * 32bit thread! 00270 */ 00271 00272 CheckCritIn(); 00273 00274 pti = PtiCurrent(); 00275 ppi = pti->ppi; 00276 pwpi = ppi->pwpi; 00277 00278 /* 00279 * If this task has received a message from outside of the current 00280 * wow scheduler and hasn't yet replied to the message, the scheduler 00281 * will deadlock because the send\receive lock counts are updated 00282 * in ReplyMessage and not in receive message. Check for this 00283 * condition and do the DirectedSchedukeTask that normally occurs 00284 * in ReplyMessage. 16-Feb-1995 Jonle 00285 */ 00286 psms = pti->psmsCurrent; 00287 if (psms && psms->ptiReceiver == pti && 00288 psms->ptiSender && !(psms->flags & SMF_REPLY) && 00289 psms->flags & (SMF_RECEIVERBUSY | SMF_RECEIVEDMESSAGE) && 00290 psms->ptiSender->TIF_flags & TIF_16BIT && 00291 (pwpi != psms->ptiSender->ppi->pwpi || !(pti->TIF_flags & TIF_16BIT)) ) { 00292 DirectedScheduleTask(psms->ptiReceiver, psms->ptiSender, FALSE, psms); 00293 } 00294 00295 00296 /* 00297 * return immediately if we are not 16 bit (don't have a pwpi) 00298 */ 00299 if (!(pti->TIF_flags & TIF_16BIT)) { 00300 return FALSE; 00301 } 00302 00303 00304 /* 00305 * Deschedule the current task 00306 */ 00307 if (pti == pwpi->ptiScheduled) { 00308 ExitWowCritSect(pti, pwpi); 00309 if (!pwpi->nTaskLock) { 00310 pwpi->ptiScheduled = NULL; 00311 } 00312 } 00313 UserAssert(pti != pwpi->CSOwningThread); 00314 00315 00316 /* 00317 * If this is wowexec calling on WowWaitForMsgAndEvent 00318 * set up the WakeMask for all messages , and check for wake 00319 * bits set since the last time. Reinsert wowexec, at the end 00320 * of the list so other 16 bit tasks will be scheduled first. 00321 */ 00322 if (pwpi->hEventWowExecClient == hEvent) { 00323 InsertTask(ppi, pti->ptdb); 00324 pti->pcti->fsWakeMask = QS_ALLINPUT | QS_EVENT; 00325 if (pti->pcti->fsChangeBits & pti->pcti->fsWakeMask) { 00326 pti->ptdb->nEvents++; 00327 gpsi->nEvents++; 00328 } 00329 } 00330 00331 00332 bWaitedAtLeastOnce = FALSE; 00333 00334 do { 00335 00336 /* 00337 * If nobody is Active look for the highest priority task with 00338 * some events pending. if MsgWaitForMultiple call don't 00339 * reschedule self 00340 */ 00341 00342 if (pwpi->ptiScheduled == NULL) { 00343 rescan: 00344 if (pwpi->nRecvLock >= pwpi->nSendLock) { 00345 for (ptdb = pwpi->ptdbHead; ptdb; ptdb = ptdb->ptdbNext) { 00346 if (ptdb->nEvents > 0 && 00347 !(hEvent == HEVENT_REMOVEME && ptdb->pti == pti)) { 00348 pwpi->ptiScheduled = ptdb->pti; 00349 break; 00350 } 00351 } 00352 00353 if (bWaitedAtLeastOnce) { 00354 // 00355 // If not first entry into sleep task avoid waiting 00356 // more than needed, if the curr task is now scheduled. 00357 // 00358 if (pwpi->ptiScheduled == pti) { 00359 break; 00360 } 00361 00362 } else { 00363 // 00364 // On the first entry into sleep task input is going 00365 // idle if no tasks are ready to run. Call the idle 00366 // hook if there is one. 00367 // 00368 if (fInputIdle && 00369 pwpi->ptiScheduled == NULL && 00370 IsHooked(pti, WHF_FOREGROUNDIDLE)) { 00371 00372 /* 00373 * Make this the active task so that no other 00374 * task will become active while we're calling 00375 * the hook. 00376 */ 00377 pwpi->ptiScheduled = pti; 00378 xxxCallHook(HC_ACTION, 0, 0, WH_FOREGROUNDIDLE); 00379 00380 /* 00381 * Reset state so that no tasks are active. We 00382 * then need to rescan the task list to see if 00383 * a task was scheduled during the call to the 00384 * hook. Clear the input idle flag to ensure 00385 * that the hook won't be called again if there 00386 * are no tasks ready to run. 00387 */ 00388 pwpi->ptiScheduled = NULL; 00389 fInputIdle = FALSE; 00390 goto rescan; 00391 } 00392 } 00393 } 00394 00395 00396 /* 00397 * If there is a task ready, wake it up. 00398 */ 00399 if (pwpi->ptiScheduled != NULL) { 00400 KeSetEvent(pwpi->ptiScheduled->pEventQueueServer, 00401 EVENT_INCREMENT, 00402 FALSE 00403 ); 00404 00405 /* 00406 * There is no one to wake up, but we may have to wake 00407 * wowexec to service virtual hardware interrupts 00408 */ 00409 } else if (ppi->W32PF_Flags & W32PF_WAKEWOWEXEC) { 00410 if (pwpi->hEventWowExecClient == hEvent) { 00411 pwpi->ptiScheduled = pti; 00412 ppi->W32PF_Flags &= ~W32PF_WAKEWOWEXEC; 00413 InsertTask(ppi, pti->ptdb); 00414 EnterWowCritSect(pti, pwpi); 00415 UserAssert(pti == pwpi->ptiScheduled); 00416 return TRUE; 00417 } else { 00418 KeSetEvent(pwpi->pEventWowExec, EVENT_INCREMENT, FALSE); 00419 } 00420 } else if ((pti->TIF_flags & TIF_SHAREDWOW) && !bWaitedAtLeastOnce) { 00421 if (pwpi->hEventWowExecClient == hEvent) { 00422 /* 00423 * We have to call zzzWakeInputIdle only if this will 00424 * awake WowExec's thread and not other thread. Bug 44060. 00425 */ 00426 zzzWakeInputIdle(pti); // need to DeferWinEventNotify() ?? IANJA ?? 00427 } 00428 } 00429 00430 } else if (pwpi->nTaskLock > 0 && pwpi->ptiScheduled == pti 00431 && pti->ptdb->nEvents > 0) { 00432 KeSetEvent(pwpi->ptiScheduled->pEventQueueServer, 00433 EVENT_INCREMENT, FALSE); 00434 } 00435 /* 00436 * return if we are a 32 bit thread, or if we were called by 00437 * MsgWaitForMultiple to exit the wow scheduler 00438 */ 00439 if (!(pti->TIF_flags & TIF_16BIT)) { 00440 return FALSE; 00441 } else if (hEvent == HEVENT_REMOVEME) { 00442 InsertTask(ppi, pti->ptdb); 00443 KeClearEvent(pti->pEventQueueServer); 00444 return FALSE; 00445 } 00446 00447 if (pti->apEvent == NULL) { 00448 pti->apEvent = UserAllocPoolNonPaged(POLL_EVENT_CNT * sizeof(PKEVENT), TAG_EVENT); 00449 if (pti->apEvent == NULL) 00450 return FALSE; 00451 } 00452 00453 /* 00454 * Wait for input to this thread. 00455 */ 00456 pti->apEvent[IEV_TASK] = pti->pEventQueueServer; 00457 00458 /* 00459 * Add the WowExec, handle for virtual hw interrupts 00460 */ 00461 if (pwpi->hEventWowExecClient == hEvent) { 00462 pti->apEvent[IEV_WOWEXEC] = pwpi->pEventWowExec; 00463 nHandles = 2; 00464 } else { 00465 nHandles = 1; 00466 } 00467 00468 CheckForClientDeath(); 00469 LeaveCrit(); 00470 00471 Status = KeWaitForMultipleObjects(nHandles, 00472 &pti->apEvent[IEV_TASK], 00473 WaitAny, 00474 WrUserRequest, 00475 UserMode, 00476 TRUE, 00477 NULL, 00478 NULL); 00479 00480 CheckForClientDeath(); 00481 00482 EnterCrit(); 00483 00484 bWaitedAtLeastOnce = TRUE; 00485 00486 // remember if we woke up for wowexec 00487 if (Status == STATUS_WAIT_1) { 00488 ppi->W32PF_Flags |= W32PF_WAKEWOWEXEC; 00489 } else if (Status == STATUS_USER_APC) { 00490 00491 /* 00492 * An alert was received. This should only occur when the 00493 * thread has been terminated. 00494 * ClientDeliverUserApc() delivers User-mode APCs by calling back 00495 * to the client and immediately returning without doing anything: 00496 * KeUserModeCallback will automatically deliver any pending APCs. 00497 */ 00498 UserAssert(PsIsThreadTerminating(PsGetCurrentThread())); 00499 ClientDeliverUserApc(); 00500 } 00501 00502 } while (pwpi->ptiScheduled != pti); 00503 00504 00505 /* 00506 * We are the Active Task, reduce number of Events 00507 * Place ourselves at the far end of tasks in the same priority 00508 * so that next time we sleep someone else will run. 00509 */ 00510 pti->ptdb->nEvents--; 00511 gpsi->nEvents--; 00512 UserAssert(gpsi->nEvents >= 0); 00513 00514 InsertTask(ppi, pti->ptdb); 00515 00516 ppi->W32PF_Flags &= ~W32PF_WAKEWOWEXEC; 00517 00518 EnterWowCritSect(pti, pwpi); 00519 UserAssert(pti == pwpi->ptiScheduled); 00520 00521 00522 00523 return FALSE; 00524 }

BOOL xxxSleepThread UINT  fsWakeMask,
DWORD  Timeout,
BOOL  fForegroundIdle
 

Definition at line 4382 of file queue.c.

References BOOL, CheckCritIn, CheckForClientDeath, CheckProcessForeground(), ClearQueueServerEvent(), ClientDeliverUserApc(), _CLIENTINFO::cSpins, tagPROCESSINFO::cSysExpunge, tagPROCESSINFO::dwhmodLibLoadedMask, EnterCrit, FALSE, tagPOWERSTATE::fCritical, tagCLIENTTHREADINFO::fsChangeBits, tagTHREADINFO::fsChangeBitsRemoved, tagCLIENTTHREADINFO::fsWakeBits, tagCLIENTTHREADINFO::fsWakeMask, gcSysExpunge, gdwSysExpungeMask, gPowerState, gptiForeground, IsHooked, IsWinEventNotifyDeferredOK, KeWaitForSingleObject(), LeaveCrit, NTSTATUS(), NULL, tagTHREADINFO::pClientInfo, tagTHREADINFO::pcti, tagPOWERSTATE::pEvent, tagTHREADINFO::pEventQueueServer, tagTHREADINFO::ppi, PtiCurrent, SET_TIME_LAST_READ, SleepInputIdle(), TIF_16BIT, tagTHREADINFO::TIF_flags, TIF_SPINNING, TRUE, UserMode, WHF_FOREGROUNDIDLE, WrUserRequest, xxxCallHook(), xxxDoSysExpunge(), xxxReceiveMessages, xxxSleepTask(), and zzzWakeInputIdle().

Referenced by xxxbFullscreenSwitch(), xxxDefWindowProc(), xxxDragObject(), xxxInternalGetMessage(), xxxInterSendMsgEx(), xxxIsDragging(), xxxMNLoop(), xxxTrackCaptionButton(), and xxxWaitMessage().

04386 { 04387 PTHREADINFO ptiCurrent; 04388 LARGE_INTEGER li, *pli; 04389 NTSTATUS status = STATUS_SUCCESS; 04390 BOOL fExclusive = fsWakeMask & QS_EXCLUSIVE; 04391 WORD fsWakeMaskSaved; 04392 04393 UserAssert(IsWinEventNotifyDeferredOK()); 04394 04395 if (fExclusive) { 04396 /* 04397 * the exclusive bit is a 'dummy' arg, turn it off to 04398 * avoid any possible conflictions 04399 */ 04400 fsWakeMask = fsWakeMask & ~QS_EXCLUSIVE; 04401 } 04402 04403 if (Timeout) { 04404 /* 04405 * Convert dwMilliseconds to a relative-time(i.e. negative) 04406 * LARGE_INTEGER. NT Base calls take time values in 100 nanosecond 04407 * units. 04408 */ 04409 li.QuadPart = Int32x32To64(-10000, Timeout); 04410 pli = &li; 04411 } else 04412 pli = NULL; 04413 04414 CheckCritIn(); 04415 04416 ptiCurrent = PtiCurrent(); 04417 04418 fsWakeMaskSaved = ptiCurrent->pcti->fsWakeMask; 04419 04420 while (TRUE) { 04421 04422 /* 04423 * First check if the input has arrived. 04424 */ 04425 if (ptiCurrent->pcti->fsChangeBits & fsWakeMask) { 04426 /* 04427 * Restore the wake mask to what it was before we went to sleep 04428 * to allow possible callbacks before KeWait... but after the mask 04429 * has been set and also APCs from KeWait... to still be able to 04430 * wake up. Simply clearing the mask here if we're in such a 04431 * callback or in an APC means that the thread will never wake up. 04432 */ 04433 ptiCurrent->pcti->fsWakeMask = fsWakeMaskSaved; 04434 04435 /* 04436 * Update timeLastRead - it is used for hung app calculations. 04437 * If the thread is waking up to process input, it isn't hung! 04438 */ 04439 SET_TIME_LAST_READ(ptiCurrent); 04440 return TRUE; 04441 } 04442 04443 /* 04444 * Next check for SendMessages 04445 */ 04446 if (!fExclusive && ptiCurrent->pcti->fsWakeBits & QS_SENDMESSAGE) { 04447 xxxReceiveMessages(ptiCurrent); 04448 04449 /* 04450 * Restore the change bits we took out in PeekMessage() 04451 */ 04452 ptiCurrent->pcti->fsChangeBits |= (ptiCurrent->pcti->fsWakeBits & ptiCurrent->fsChangeBitsRemoved); 04453 ptiCurrent->fsChangeBitsRemoved = 0; 04454 } 04455 04456 /* 04457 * Check to see if some resources need expunging. 04458 * This will unload Hook DLLs, including WinEvent ones 04459 */ 04460 if (ptiCurrent->ppi->cSysExpunge != gcSysExpunge) { 04461 ptiCurrent->ppi->cSysExpunge = gcSysExpunge; 04462 if (ptiCurrent->ppi->dwhmodLibLoadedMask & gdwSysExpungeMask) 04463 xxxDoSysExpunge(ptiCurrent); 04464 } 04465 04466 /* 04467 * OR QS_SENDMESSAGE in since ReceiveMessage() will end up 04468 * trashing pq->fsWakeMask. Do the same for QS_SYSEXPUNGE. 04469 */ 04470 ClearQueueServerEvent((WORD)(fsWakeMask | (fExclusive ? 0 : QS_SENDMESSAGE))); 04471 04472 /* 04473 * If we have timed out then return our error to the caller. 04474 */ 04475 if (status == STATUS_TIMEOUT) { 04476 RIPERR1(ERROR_TIMEOUT, RIP_VERBOSE, "SleepThread: The timeout has expired %lX", Timeout); 04477 return FALSE; 04478 } 04479 04480 /* 04481 * Because we do a non-alertable wait, we know that a status 04482 * of STATUS_USER_APC means that the thread was terminated. 04483 * If we have terminated, get back to user mode. 04484 */ 04485 if (status == STATUS_USER_APC) { 04486 ClientDeliverUserApc(); 04487 return FALSE; 04488 } 04489 04490 /* 04491 * If this is the power state callout thread, we might need to bail 04492 * out early. 04493 */ 04494 if (gPowerState.pEvent == ptiCurrent->pEventQueueServer) { 04495 if (gPowerState.fCritical) { 04496 return FALSE; 04497 } 04498 } 04499 04500 UserAssert(status == STATUS_SUCCESS); 04501 /* 04502 * Check to see if any input came inbetween when we 04503 * last checked and the NtClearEvent() call. 04504 * 04505 * We call NtWaitForSingleObject() rather than 04506 * WaitForSingleObject() so we can set fAlertable 04507 * to TRUE and thus allow timer APCs to be processed. 04508 */ 04509 if (!(ptiCurrent->pcti->fsChangeBits & ptiCurrent->pcti->fsWakeMask)) { 04510 /* 04511 * This app is going idle. Clear the spin count check to see 04512 * if we need to make this process foreground again. 04513 */ 04514 if (fInputIdle) { 04515 if (ptiCurrent->TIF_flags & TIF_SPINNING) { 04516 CheckProcessForeground(ptiCurrent); 04517 } 04518 ptiCurrent->pClientInfo->cSpins = 0; 04519 } 04520 04521 04522 if (!(ptiCurrent->TIF_flags & TIF_16BIT)) { 04523 if (fInputIdle && ptiCurrent == gptiForeground && 04524 IsHooked(ptiCurrent, WHF_FOREGROUNDIDLE)) { 04525 xxxCallHook(HC_ACTION, 0, 0, WH_FOREGROUNDIDLE); 04526 } 04527 04528 CheckForClientDeath(); 04529 04530 /* 04531 * Set the input idle event to wake up any threads waiting 04532 * for this thread to go into idle state. 04533 */ 04534 if (fInputIdle) 04535 zzzWakeInputIdle(ptiCurrent); 04536 04537 xxxSleepTask(fInputIdle, NULL); 04538 04539 LeaveCrit(); 04540 status = KeWaitForSingleObject(ptiCurrent->pEventQueueServer, 04541 WrUserRequest, UserMode, FALSE, pli); 04542 CheckForClientDeath(); 04543 EnterCrit(); 04544 04545 /* 04546 * Reset the input idle event to block and threads waiting 04547 * for this thread to go into idle state. 04548 */ 04549 SleepInputIdle(ptiCurrent); 04550 04551 /* 04552 * ptiCurrent is 16bit! 04553 */ 04554 } else { 04555 if (fInputIdle) 04556 zzzWakeInputIdle(ptiCurrent); 04557 04558 xxxSleepTask(fInputIdle, NULL); 04559 } 04560 } 04561 } 04562 }

BOOL xxxSnapWindow PWND  pwnd  ) 
 

Definition at line 23 of file snapshot.c.

References _GetWindowDC(), _ReleaseDC(), _SetClipboardData(), tagDISPLAYINFO::BitCountMax, BOOL, CheckLock, ClientNoMemoryPopup(), CopyRect, tagWINDOWSTATION::dwWSF_Flags, FALSE, GetCurrentProcessId, gpDispInfo, gpidLogon, tagWND::head, IntersectRect(), NT_SUCCESS, NULL, tagDESKTOP::pDeskInfo, PlayEventSound(), PsGetCurrentThread, PtiCurrent, PUSIF_PALETTEDISPLAY, PWNDDESKTOP, tagDISPLAYINFO::rcScreen, tagWND::rcWindow, ReferenceWindowStation(), tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, tagWINDOWSTATION::spwndClipOwner, tagWND::spwndParent, SYSMET, TEST_PUSIF, TestWF, ThreadLockWinSta, ThreadLockWithPti, ThreadUnlock, ThreadUnlockWinSta, TRUE, Unlock, WFCHILD, WSF_NOIO, xxxCloseClipboard(), xxxEmptyClipboard(), and xxxOpenClipboard().

Referenced by xxxScanSysQueue().

00025 { 00026 PTHREADINFO ptiCurrent; 00027 RECT rc; 00028 HDC hdcScr = NULL; 00029 HDC hdcMem = NULL; 00030 BOOL fRet; 00031 HBITMAP hbmOld; 00032 HBITMAP hbm; 00033 HANDLE hPal; 00034 LPLOGPALETTE lppal; 00035 int palsize; 00036 int iFixedPaletteEntries; 00037 BOOL fSuccess; 00038 PWND pwndT; 00039 TL tlpwndT; 00040 PWINDOWSTATION pwinsta; 00041 TL tlpwinsta; 00042 00043 CheckLock(pwnd); 00044 UserAssert(pwnd); 00045 00046 ptiCurrent = PtiCurrent(); 00047 00048 /* 00049 * If this is a thread of winlogon, don't do the snapshot. 00050 */ 00051 if (GetCurrentProcessId() == gpidLogon) 00052 return FALSE; 00053 00054 /* 00055 * Get the affected windowstation 00056 */ 00057 if (!NT_SUCCESS(ReferenceWindowStation( 00058 PsGetCurrentThread(), 00059 NULL, 00060 WINSTA_READSCREEN, 00061 &pwinsta, 00062 TRUE)) || 00063 pwinsta->dwWSF_Flags & WSF_NOIO) { 00064 return FALSE; 00065 } 00066 00067 /* 00068 * If the window is on another windowstation, do nothing 00069 */ 00070 if (pwnd->head.rpdesk->rpwinstaParent != pwinsta) 00071 return FALSE; 00072 00073 /* 00074 * Get the parent of any child windows. 00075 */ 00076 while ((pwnd != NULL) && TestWF(pwnd, WFCHILD)) { 00077 pwnd = pwnd->spwndParent; 00078 } 00079 00080 /* 00081 * Lock the windowstation before we leave the critical section 00082 */ 00083 ThreadLockWinSta(ptiCurrent, pwinsta, &tlpwinsta); 00084 00085 /* 00086 * Open the clipboard and empty it. 00087 * 00088 * pwndDesktop is made the owner of the clipboard, instead of the 00089 * currently active window; -- SANKAR -- 20th July, 1989 -- 00090 */ 00091 pwndT = ptiCurrent->rpdesk->pDeskInfo->spwnd; 00092 ThreadLockWithPti(ptiCurrent, pwndT, &tlpwndT); 00093 fSuccess = xxxOpenClipboard(pwndT, NULL); 00094 ThreadUnlock(&tlpwndT); 00095 00096 if (!fSuccess) { 00097 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00098 return FALSE; 00099 } 00100 00101 xxxEmptyClipboard(pwinsta); 00102 00103 /* 00104 * Use the whole window. 00105 */ 00106 CopyRect(&rc, &pwnd->rcWindow); 00107 00108 /* 00109 * Only snap what is on the screen. 00110 */ 00111 if (!IntersectRect(&rc, &rc, &gpDispInfo->rcScreen)) { 00112 fRet = FALSE; 00113 goto SnapExit; 00114 } 00115 00116 rc.right -= rc.left; 00117 rc.bottom -= rc.top; 00118 00119 /* 00120 * Figure out how far offset from window origin visible part is 00121 */ 00122 if (pwnd != PWNDDESKTOP(pwnd)) { 00123 rc.left -= pwnd->rcWindow.left; 00124 rc.top -= pwnd->rcWindow.top; 00125 } 00126 00127 /* 00128 * Get the entire window's DC. 00129 */ 00130 hdcScr = _GetWindowDC(pwnd); 00131 if (!hdcScr) 00132 goto MemoryError; 00133 00134 /* 00135 * Create the memory DC. 00136 */ 00137 hdcMem = GreCreateCompatibleDC(hdcScr); 00138 if (!hdcMem) 00139 goto MemoryError; 00140 00141 /* 00142 * Create the destination bitmap. If it fails, then attempt 00143 * to create a monochrome bitmap. 00144 * Did we have enough memory? 00145 */ 00146 00147 if (SYSMET(SAMEDISPLAYFORMAT)) { 00148 hbm = GreCreateCompatibleBitmap(hdcScr, rc.right, rc.bottom); 00149 } else { 00150 hbm = GreCreateBitmap(rc.right, rc.bottom, 1, gpDispInfo->BitCountMax, NULL); 00151 } 00152 00153 if (!hbm) { 00154 hbm = GreCreateBitmap(rc.right, rc.bottom, 1, 1, NULL); 00155 if (!hbm) 00156 goto MemoryError; 00157 } 00158 00159 /* 00160 * Select the bitmap into the memory DC. 00161 */ 00162 hbmOld = GreSelectBitmap(hdcMem, hbm); 00163 00164 /* 00165 * Snap!!! 00166 * Check the return value because the process taking the snapshot 00167 * may not have access to read the screen. 00168 */ 00169 fRet = GreBitBlt(hdcMem, 0, 0, rc.right, rc.bottom, hdcScr, rc.left, rc.top, SRCCOPY | CAPTUREBLT, 0); 00170 00171 /* 00172 * Restore the old bitmap into the memory DC. 00173 */ 00174 GreSelectBitmap(hdcMem, hbmOld); 00175 00176 /* 00177 * If the blt failed, leave now. 00178 */ 00179 if (!fRet) 00180 goto SnapExit; 00181 00182 _SetClipboardData(CF_BITMAP, hbm, FALSE, TRUE); 00183 00184 /* 00185 * If this is a palette device, let's throw the current system palette 00186 * into the clipboard also. Useful if the user just snapped a window 00187 * containing palette colors... 00188 */ 00189 if (TEST_PUSIF(PUSIF_PALETTEDISPLAY)) { 00190 00191 int i; 00192 int iPalSize; 00193 00194 palsize = GreGetDeviceCaps(hdcScr, SIZEPALETTE); 00195 00196 /* 00197 * Determine the number of system colors. 00198 */ 00199 if (GreGetSystemPaletteUse(hdcScr) == SYSPAL_STATIC) 00200 iFixedPaletteEntries = GreGetDeviceCaps(hdcScr, NUMRESERVED); 00201 else 00202 iFixedPaletteEntries = 2; 00203 00204 lppal = (LPLOGPALETTE)UserAllocPoolWithQuota( 00205 (LONG)(sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * palsize), 00206 TAG_CLIPBOARD); 00207 00208 if (lppal != NULL) { 00209 lppal->palVersion = 0x300; 00210 lppal->palNumEntries = (WORD)palsize; 00211 00212 if (GreGetSystemPaletteEntries(hdcScr, 00213 0, 00214 palsize, 00215 lppal->palPalEntry)) { 00216 00217 iPalSize = palsize - iFixedPaletteEntries / 2; 00218 00219 for (i = iFixedPaletteEntries / 2; i < iPalSize; i++) { 00220 00221 /* 00222 * Any non system palette enteries need to have the NOCOLLAPSE 00223 * flag set otherwise bitmaps containing different palette 00224 * indices but same colors get messed up. 00225 */ 00226 lppal->palPalEntry[i].peFlags = PC_NOCOLLAPSE; 00227 } 00228 00229 if (hPal = GreCreatePalette(lppal)) 00230 _SetClipboardData(CF_PALETTE, hPal, FALSE, TRUE); 00231 } 00232 00233 UserFreePool(lppal); 00234 } 00235 } 00236 PlayEventSound(USER_SOUND_SNAPSHOT); 00237 00238 fRet = TRUE; 00239 00240 SnapExit: 00241 00242 /* 00243 * Release the window/client DC. 00244 */ 00245 if (hdcScr) { 00246 _ReleaseDC(hdcScr); 00247 } 00248 00249 xxxCloseClipboard(pwinsta); 00250 Unlock(&pwinsta->spwndClipOwner); 00251 00252 /* 00253 * Delete the memory DC. 00254 */ 00255 if (hdcMem) { 00256 GreDeleteDC(hdcMem); 00257 } 00258 00259 ThreadUnlockWinSta(ptiCurrent, &tlpwinsta); 00260 00261 return fRet; 00262 00263 MemoryError: 00264 /* 00265 * Display an error message box. 00266 */ 00267 ClientNoMemoryPopup(); 00268 fRet = FALSE; 00269 goto SnapExit; 00270 }

BOOL xxxStubSetForegroundWindow PWND  pwnd  ) 
 

Definition at line 1230 of file focusact.c.

References BOOL, TRUE, and xxxSetForegroundWindow().

01232 { 01233 return xxxSetForegroundWindow(pwnd, TRUE); 01234 }

BOOL xxxSwitchDesktop PWINDOWSTATION  ,
PDESKTOP  ,
BOOL 
 

Definition at line 3358 of file desktop.c.

References tagQ::afKeyRecentDown, AllocQueue(), BOOL, CBKEYSTATERECENTDOWN, CheckCritIn, _ETHREAD::Cid, tagQ::cThreads, DF_DESKWNDDESTROYED, DF_DESTROYED, DF_DYING, DF_NEWDISPLAYSETTINGS, tagDESKTOP::dwDTFlags, DWORD, tagWINDOWSTATION::dwWSF_Flags, EVENT_INCREMENT, FALSE, FreeAllSpbs(), gbDesktopLocked, GetFullScreen, GETPTI, gHardErrorHandler, gpEventSwitchDesktop, gpidLogon, gpqCursor, gpqForeground, gpsi, gptiRit, grpdeskLogon, grpdeskRitInput, gspdeskDisconnect, gspdeskShouldBeForeground, gspwndAltTab, tagDISPLAYINFO::hDev, HMIsMarkDestroy, IPostQuitMessage(), IS_SYSTEM_THREAD, IsWinEventNotifyDeferredOK, KePulseEvent(), KernelMode, Lock, LockDesktop, NT_SUCCESS, NTSTATUS(), NULL, ObOpenObjectByPointer(), tagDESKTOP::pDeskInfo, tagDESKTOP::pDispInfo, tagDISPLAYINFO::pmdev, POBJECT_NAME, PostUpdateKeyStateEvent(), tagTHREADINFO::pq, tagTERMINAL::pqDesktop, PsGetCurrentThread, tagWINDOWSTATION::pTerm, tagHARDERRORHANDLER::pti, PtiCurrent, tagTERMINAL::ptiDesktop, tagDESKTOP::PtiList, tagQ::QF_flags, QF_KEYSTATERESET, QF_UPDATEKEYSTATE, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, SetFullScreen, SetPointer(), tagDESKTOPINFO::spwnd, tagQ::spwndActive, tagWND::spwndChild, tagDESKTOP::spwndForeground, tagWND::spwndNext, Status, TestWF, ThreadLockAlwaysWithPti, ThreadLockDesktopHandle, ThreadLockWithPti, ThreadUnlock, ThreadUnlockDesktopHandle, TRACE_DESKTOP, TRACE_INIT, TRUE, Unlock, WFVISIBLE, WSF_NOIO, WSF_SWITCHLOCK, xxxBroadcastDisplaySettingsChange(), xxxSendMessage(), xxxSetForegroundWindow2(), xxxSetWindowPos(), zzzAttachToQueue(), zzzCancelJournalling(), zzzInternalSetCursorPos(), and zzzSetDesktop().

Referenced by NtUserSwitchDesktop(), RawInputThread(), RemoteDisableScreen(), RemoteRedrawScreen(), xxxCreateDesktop(), xxxDesktopThread(), and xxxQueryInformationThread().

03362 { 03363 PETHREAD Thread; 03364 PWND pwndSetForeground; 03365 TL tlpwndChild; 03366 TL tlpwnd; 03367 TL tlhdesk; 03368 PQ pq; 03369 BOOL bUpdateCursor = FALSE; 03370 PLIST_ENTRY pHead, pEntry; 03371 PTHREADINFO pti; 03372 PTHREADINFO ptiCurrent = PtiCurrent(); 03373 PTERMINAL pTerm; 03374 NTSTATUS Status; 03375 HDESK hdesk; 03376 03377 CheckCritIn(); 03378 03379 UserAssert(IsWinEventNotifyDeferredOK()); 03380 03381 if (pdesk == NULL) { 03382 return FALSE; 03383 } 03384 03385 if (pdesk == grpdeskRitInput) { 03386 return TRUE; 03387 } 03388 03389 if (pdesk->dwDTFlags & DF_DESTROYED) { 03390 RIPMSG1(RIP_ERROR, "xxxSwitchDesktop: destroyed:%#p", pdesk); 03391 return FALSE; 03392 } 03393 03394 UserAssert(!(pdesk->dwDTFlags & (DF_DESKWNDDESTROYED | DF_DYING))); 03395 03396 if (pwinsta == NULL) 03397 pwinsta = pdesk->rpwinstaParent; 03398 03399 /* 03400 * Get the windowstation, and assert if this process doesn't have one. 03401 */ 03402 UserAssert(pwinsta); 03403 if (pwinsta == NULL) { 03404 RIPMSG1(RIP_WARNING, 03405 "xxxSwitchDesktop: failed for pwinsta NULL pdesk %#p", pdesk); 03406 return FALSE; 03407 } 03408 03409 /* 03410 * Don't allow invisible desktops to become active 03411 */ 03412 if (pwinsta->dwWSF_Flags & WSF_NOIO) { 03413 RIPMSG1(RIP_VERBOSE, 03414 "xxxSwitchDesktop: failed for NOIO pdesk %#p", pdesk); 03415 return FALSE; 03416 } 03417 03418 pTerm = pwinsta->pTerm; 03419 03420 UserAssert(grpdeskRitInput == pwinsta->pdeskCurrent); 03421 03422 /* 03423 * Do tracing only if compiled in. 03424 */ 03425 TRACE_INIT(("xxxSwitchDesktop: Entering, desktop = %ws, createdNew = %01lx\n", POBJECT_NAME(pdesk), (DWORD)bCreateNew)); 03426 if (grpdeskRitInput) { 03427 TRACE_INIT((" coming from desktop = %ws\n", POBJECT_NAME(grpdeskRitInput))); 03428 } 03429 03430 /* 03431 * Wait if the logon has the windowstation locked 03432 */ 03433 Thread = PsGetCurrentThread(); 03434 03435 /* 03436 * Allow switches to the disconnected desktop 03437 */ 03438 if (pdesk != gspdeskDisconnect) 03439 if (!IS_SYSTEM_THREAD(Thread) && pwinsta->dwWSF_Flags & WSF_SWITCHLOCK && 03440 pdesk != grpdeskLogon && 03441 Thread->Cid.UniqueProcess != gpidLogon) 03442 return FALSE; 03443 03444 /* 03445 * We don't allow switching away from the disconnect desktop. 03446 */ 03447 if (gbDesktopLocked && ((!gspdeskDisconnect) || (pdesk != gspdeskDisconnect))) { 03448 TRACE_DESKTOP(("Attempt to switch away from the disconnect desktop\n")); 03449 03450 /* 03451 * we should not lock this global !!! clupu 03452 */ 03453 LockDesktop(&gspdeskShouldBeForeground, pdesk, LDL_DESKSHOULDBEFOREGROUND1, 0); 03454 return TRUE; 03455 } 03456 03457 /* 03458 * HACKHACK LATER !!! 03459 * Where should we really switch the desktop ... 03460 * And we need to send repaint messages to everyone... 03461 * 03462 */ 03463 03464 UserAssert(grpdeskRitInput == pwinsta->pdeskCurrent); 03465 03466 if (!bCreateNew && grpdeskRitInput && 03467 (grpdeskRitInput->pDispInfo->hDev != pdesk->pDispInfo->hDev)) { 03468 03469 if (!DrvDisableMDEV(grpdeskRitInput->pDispInfo->pmdev, TRUE)) { 03470 RIPMSG1(RIP_WARNING, "xxxSwitchDesktop: DrvDisableMDEV failed for pdesk %#p", 03471 grpdeskRitInput); 03472 return FALSE; 03473 } 03474 DrvEnableMDEV(pdesk->pDispInfo->pmdev, TRUE); 03475 bUpdateCursor = TRUE; 03476 03477 } 03478 03479 /* 03480 * Grab a handle to the pdesk 03481 */ 03482 Status = ObOpenObjectByPointer(pdesk, 03483 0, 03484 NULL, 03485 EVENT_ALL_ACCESS, 03486 NULL, 03487 KernelMode, 03488 &hdesk); 03489 if (!NT_SUCCESS(Status)) { 03490 03491 RIPMSG2(RIP_ERROR, "Could not get a handle for pdesk %#p Status %x", 03492 pdesk, Status); 03493 return FALSE; 03494 } 03495 03496 ThreadLockDesktopHandle(ptiCurrent, &tlhdesk, hdesk); 03497 03498 #if DBG 03499 /* 03500 * The current desktop is now the new desktop. 03501 */ 03502 pwinsta->pdeskCurrent = pdesk; 03503 #endif // DBG 03504 03505 /* 03506 * Kill any journalling that is occuring. If an app is journaling to 03507 * the CoolSwitch window, zzzCancelJournalling() will kill the window. 03508 */ 03509 if (ptiCurrent->rpdesk != NULL) 03510 zzzCancelJournalling(); 03511 03512 /* 03513 * Remove the cool switch window if it's on the RIT. Sending the message 03514 * is OK because the destination is the RIT, which should never block. 03515 */ 03516 if (gspwndAltTab != NULL) { 03517 03518 TL tlpwndT; 03519 03520 ThreadLockWithPti(ptiCurrent, gspwndAltTab, &tlpwndT); 03521 xxxSendMessage(gspwndAltTab, WM_CLOSE, 0, 0); 03522 ThreadUnlock(&tlpwndT); 03523 } 03524 03525 /* 03526 * Remove all trace of previous active window. 03527 */ 03528 if (grpdeskRitInput != NULL) { 03529 03530 UserAssert(grpdeskRitInput->spwndForeground == NULL); 03531 03532 if (grpdeskRitInput->pDeskInfo->spwnd != NULL) { 03533 if (gpqForeground != NULL) { 03534 03535 Lock(&grpdeskRitInput->spwndForeground, 03536 gpqForeground->spwndActive); 03537 03538 /* 03539 * This is an API so ptiCurrent can pretty much be on any 03540 * state; it might not be in grpdeskRitInput (current) or 03541 * pdesk (the one we're switching to). It can be sharing its 03542 * queue with other threads from another desktop. 03543 * This is tricky because we're calling xxxSetForegroundWindow 03544 * and xxxSetWindowPos but PtiCurrent might be on whatever 03545 * desktop. We cannot cleanly switch ptiCurrent to the proper 03546 * desktop because it might be sharing its queue with other 03547 * threads, own windows, hooks, etc. So this is kind of broken. 03548 * 03549 * Old Comment: 03550 * Fixup the current-thread (system) desktop. This 03551 * could be needed in case the xxxSetForegroundWindow() 03552 * calls xxxDeactivate(). There is logic in their which 03553 * requires the desktop. This is only needed temporarily 03554 * for this case. 03555 * 03556 * We would only go into xxxDeactivate if 03557 * ptiCurrent->pq == qpqForeground; but if this is the case, 03558 * then ptiCurrent must be in grpdeskRitInput already. So 03559 * I don't think we need this at all. Let's find out. 03560 * Note that we might switch queues while processing the 03561 * xxxSetForegroundWindow call. That should be fine as long 03562 * as we don't switch desktops..... 03563 */ 03564 UserAssert((ptiCurrent->pq != gpqForeground) 03565 || (ptiCurrent->rpdesk == grpdeskRitInput)); 03566 03567 /* 03568 * The SetForegroundWindow call must succed here, so we call 03569 * xxxSetForegroundWindow2() directly 03570 */ 03571 xxxSetForegroundWindow2(NULL, ptiCurrent, 0); // WHAT KEEPS pdesk LOCKED - IANJA ??? 03572 03573 } 03574 } 03575 } 03576 03577 /* 03578 * Post update events to all queues sending input to the desktop 03579 * that is becoming inactive. This keeps the queues in sync up 03580 * to the desktop switch. 03581 */ 03582 if (grpdeskRitInput != NULL) { 03583 03584 pHead = &grpdeskRitInput->PtiList; 03585 03586 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 03587 03588 pti = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 03589 pq = pti->pq; 03590 03591 if (pq->QF_flags & QF_UPDATEKEYSTATE) 03592 PostUpdateKeyStateEvent(pq); 03593 03594 /* 03595 * Clear the reset bit to ensure that we can properly 03596 * reset the key state when this desktop again becomes 03597 * active. 03598 */ 03599 pq->QF_flags &= ~QF_KEYSTATERESET; 03600 } 03601 } 03602 03603 /* 03604 * Send the RIT input to the desktop. We do this before any window 03605 * management since DoPaint() uses grpdeskRitInput to go looking for 03606 * windows with update regions. 03607 */ 03608 LockDesktop(&grpdeskRitInput, pdesk, LDL_DESKRITINPUT, 0); 03609 03610 /* 03611 * Free any spbs that are only valid for the previous desktop. 03612 */ 03613 FreeAllSpbs(); 03614 03615 /* 03616 * Lock it into the RIT thread (we could use this desktop rather than 03617 * the global grpdeskRitInput to direct input!) 03618 */ 03619 zzzSetDesktop(gptiRit, pdesk, NULL); // DeferWinEventNotify() ?? IANJA ?? 03620 03621 /* 03622 * Lock the desktop into the desktop thread. Be sure 03623 * that the thread is using an unattached queue before 03624 * setting the desktop. This is needed to ensure that 03625 * the thread does not using a shared journal queue 03626 * for the old desktop. 03627 */ 03628 if (pTerm->ptiDesktop->pq != pTerm->pqDesktop) { 03629 UserAssert(pTerm->pqDesktop->cThreads == 0); 03630 AllocQueue(NULL, pTerm->pqDesktop); 03631 pTerm->pqDesktop->cThreads++; 03632 zzzAttachToQueue(pTerm->ptiDesktop, pTerm->pqDesktop, NULL, FALSE); 03633 } 03634 zzzSetDesktop(pTerm->ptiDesktop, pdesk, NULL); // DeferWinEventNotify() ?? IANJA ?? 03635 03636 /* 03637 * Bring the desktop window to the top and invalidate 03638 * everything. 03639 */ 03640 ThreadLockWithPti(ptiCurrent, pdesk->pDeskInfo->spwnd, &tlpwnd); 03641 03642 03643 /* 03644 * Suspend DirectDraw before we bring up the desktop window, so we make 03645 * sure that everything is repainted properly once DirectDraw is disabled. 03646 */ 03647 03648 GreSuspendDirectDraw(pdesk->pDispInfo->hDev, TRUE); 03649 03650 xxxSetWindowPos(pdesk->pDeskInfo->spwnd, // WHAT KEEPS pdesk LOCKED - IANJA ??? 03651 NULL, 03652 0, 03653 0, 03654 0, 03655 0, 03656 SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOCOPYBITS); 03657 03658 /* 03659 * At this point, my understanding is that the new desktop window has been 03660 * brought to the front, and therefore the vis-region of any app on any 03661 * other desktop is now NULL. 03662 * 03663 * So this is the appropriate time to resume DirectDraw, which will 03664 * ensure the DirectDraw app can not draw anything in the future. 03665 * 03666 * If this is not the case, then this code needs to be moved to a more 03667 * appropriate location. 03668 * 03669 * [andreva] 6-26-96 03670 */ 03671 03672 GreResumeDirectDraw(pdesk->pDispInfo->hDev, TRUE); 03673 03674 /* 03675 * Find the first visible top-level window. 03676 */ 03677 pwndSetForeground = pdesk->spwndForeground; 03678 if (pwndSetForeground == NULL || HMIsMarkDestroy(pwndSetForeground)) { 03679 03680 pwndSetForeground = pdesk->pDeskInfo->spwnd->spwndChild; 03681 03682 while ((pwndSetForeground != NULL) && 03683 !TestWF(pwndSetForeground, WFVISIBLE)) { 03684 03685 pwndSetForeground = pwndSetForeground->spwndNext; 03686 } 03687 } 03688 Unlock(&pdesk->spwndForeground); 03689 03690 /* 03691 * Now set it to the foreground. 03692 */ 03693 03694 if (pwndSetForeground == NULL) { 03695 xxxSetForegroundWindow2(NULL, NULL, 0); 03696 } else { 03697 03698 UserAssert(GETPTI(pwndSetForeground)->rpdesk == grpdeskRitInput); 03699 /* 03700 * If the new foreground window is a minimized fullscreen app, 03701 * make it fullscreen. 03702 */ 03703 if (GetFullScreen(pwndSetForeground) == FULLSCREENMIN) { 03704 SetFullScreen(pwndSetForeground, FULLSCREEN); 03705 } 03706 03707 ThreadLockAlwaysWithPti(ptiCurrent, pwndSetForeground, &tlpwndChild); 03708 /* 03709 * The SetForegroundWindow call must succed here, so we call 03710 * xxxSetForegroundWindow2() directly 03711 */ 03712 xxxSetForegroundWindow2(pwndSetForeground, ptiCurrent, 0); 03713 ThreadUnlock(&tlpwndChild); 03714 } 03715 03716 03717 ThreadUnlock(&tlpwnd); 03718 03719 /* 03720 * Overwrite key state of all queues sending input to the new 03721 * active desktop with the current async key state. This 03722 * prevents apps on inactive desktops from spying on active 03723 * desktops. This blows away anything set with SetKeyState, 03724 * but there is no way of preserving this without giving 03725 * away information about what keys were hit on other 03726 * desktops. 03727 */ 03728 pHead = &grpdeskRitInput->PtiList; 03729 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 03730 03731 pti = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 03732 pq = pti->pq; 03733 03734 if (!(pq->QF_flags & QF_KEYSTATERESET)) { 03735 pq->QF_flags |= QF_UPDATEKEYSTATE | QF_KEYSTATERESET; 03736 RtlFillMemory(pq->afKeyRecentDown, CBKEYSTATERECENTDOWN, 0xff); 03737 PostUpdateKeyStateEvent(pq); 03738 } 03739 } 03740 03741 /* 03742 * If there is a hard-error popup up, nuke it and notify the 03743 * hard error thread that it needs to pop it up again. 03744 */ 03745 if (gHardErrorHandler.pti) { 03746 IPostQuitMessage(gHardErrorHandler.pti, 0); 03747 } 03748 03749 /* 03750 * Notify anyone waiting for a desktop switch. 03751 */ 03752 UserAssert(!(pdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)); 03753 03754 KePulseEvent(gpEventSwitchDesktop, EVENT_INCREMENT, FALSE); 03755 03756 /* 03757 * reset the cursor when we come back from another pdev 03758 */ 03759 if (bUpdateCursor == TRUE) { 03760 03761 gpqCursor = NULL; 03762 zzzInternalSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y); 03763 03764 SetPointer(TRUE); 03765 } 03766 03767 /* 03768 * Make sure we come back to the right mode when this is all done, because 03769 * the device may be left in an interesting state if we were running 03770 * DirectDraw. 03771 */ 03772 03773 { 03774 /* 03775 * Don't check the return code right now since there is nothing 03776 * we can do if we can not reset the mode ... 03777 */ 03778 03779 // BUGBUG 03780 // DONT_CHECKIN 03781 03782 //UserChangeDisplaySettings(pdesk->pDispInfo->hDevInfo, 03783 // pdesk->pDesktopDevmode, 03784 // _GetDesktopWindow(), 03785 // pdesk, 03786 // 0, 03787 // NULL, 03788 // TRUE); 03789 } 03790 03791 03792 /* 03793 * If this desktop was not active during last display settings change 03794 * let's now bradcast the settings change to its windows. This 03795 * code is copied from xxxResetDisplayDevice(). 03796 */ 03797 03798 03799 if ((pdesk->dwDTFlags & DF_NEWDISPLAYSETTINGS) && pdesk->pDeskInfo && pdesk->pDeskInfo->spwnd ){ 03800 03801 pdesk->dwDTFlags &= ~DF_NEWDISPLAYSETTINGS; 03802 xxxBroadcastDisplaySettingsChange(pdesk, TRUE); 03803 03804 03805 } 03806 03807 ThreadUnlockDesktopHandle(&tlhdesk); 03808 03809 TRACE_INIT(("xxxSwitchDesktop: Leaving\n")); 03810 03811 return TRUE; 03812 }

VOID xxxSwitchToThisWindow PWND  pwnd,
BOOL  fAltTab
 

Definition at line 253 of file tmswitch.c.

References _GetNextQueueWindow(), BOOL, CheckLock, FDIR_FORWARD, GETPTI, gpqForeground, PostEventMessage(), PWND_BOTTOM, QEVENT_POSTMESSAGE, tagQ::spwndActive, TestWF, ThreadLock, ThreadUnlock, TRUE, VOID(), WEFTOPMOST, WFBOTTOMMOST, WFMINIMIZED, xxxSetForegroundWindow(), and xxxSetWindowPos().

00256 { 00257 CheckLock(pwnd); 00258 00259 /* 00260 * If we need to, push old window to the bottom. 00261 */ 00262 if (gpqForeground && !fAltTab) { 00263 00264 BOOL fPush; 00265 PWND pwndActive; 00266 TL tlpwndActive; 00267 00268 /* 00269 * if ALT-ESC, and the window brought forward is the next one in the 00270 * list, we must be rotating the zorder forward, so push the current 00271 * window to the back 00272 */ 00273 pwndActive = gpqForeground->spwndActive; 00274 fPush = pwndActive && _GetNextQueueWindow(pwndActive, FDIR_FORWARD, !fAltTab); 00275 if (fPush && !TestWF(pwndActive, WEFTOPMOST) && !TestWF(pwndActive, WFBOTTOMMOST)) { 00276 ThreadLock(pwndActive, &tlpwndActive); 00277 xxxSetWindowPos(pwndActive, PWND_BOTTOM, 0, 0, 0, 0, 00278 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS); 00279 ThreadUnlock(&tlpwndActive); 00280 } 00281 } 00282 00283 /* 00284 * Switch this new window to the foreground 00285 * This window can go away during the SetForeground call if it isn't 00286 * on the thread calling SwitchToThisWindow()! 00287 */ 00288 xxxSetForegroundWindow(pwnd, TRUE); 00289 00290 /* 00291 * Restore minimized windows if the Alt+Tab case 00292 */ 00293 if (fAltTab && TestWF(pwnd,WFMINIMIZED)) { 00294 00295 /* 00296 * We need to package up a special 'posted' queue message here. This 00297 * ensures that this message gets processed after the asynchronous 00298 * activation event occurs (via SetForegroundWindow). 00299 */ 00300 PostEventMessage(GETPTI(pwnd), GETPTI(pwnd)->pq, 00301 QEVENT_POSTMESSAGE, pwnd, WM_SYSCOMMAND, 00302 SC_RESTORE, 0 ); 00303 } 00304 }

LRESULT xxxSwitchWndProc PWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 1564 of file tmswitch.c.

References CheckLock, FNID_SWITCH, Getpswi(), IsWinEventNotifyDeferredOK, NULL, tagWND::pcls, PtiCurrent, SwitchWndCleanup(), ThreadLockWithPti, ThreadUnlock, VALIDATECLASSANDSIZE, xxxCancelCoolSwitch(), xxxDefWindowProc(), xxxPaintSwitchWindow(), xxxSetWindowPos(), and zzzSetCursor().

Referenced by InitializeClientPfnArrays(), and LW_RegisterWindows().

01569 { 01570 TL tlpwndActivate; 01571 PTHREADINFO ptiCurrent = PtiCurrent(); 01572 01573 CheckLock(pwnd); 01574 UserAssert(IsWinEventNotifyDeferredOK()); 01575 01576 VALIDATECLASSANDSIZE(pwnd, message, wParam, lParam, FNID_SWITCH, WM_CREATE); 01577 01578 switch (message) { 01579 case WM_CREATE: 01580 /* 01581 * When the queue was created, the cursor was set to the wait cursor. 01582 * We want to use the normal one. 01583 */ 01584 zzzSetCursor(pwnd->pcls->spcur); 01585 break; 01586 01587 case WM_CLOSE: 01588 /* 01589 * Hide this window without activating anyone else. 01590 */ 01591 xxxSetWindowPos(pwnd, NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | 01592 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); 01593 01594 /* 01595 * Get us out of Alt+Tab mode. Since the alttab information 01596 * is stored in the gptiRit->pq, we will reference that insteatd 01597 * of the current-thread. 01598 */ 01599 xxxCancelCoolSwitch(); 01600 break; 01601 01602 case WM_ERASEBKGND: 01603 case WM_FULLSCREEN: 01604 ThreadLockWithPti(ptiCurrent, pwnd, &tlpwndActivate); 01605 xxxPaintSwitchWindow(pwnd); 01606 ThreadUnlock(&tlpwndActivate); 01607 return 0; 01608 01609 case WM_DESTROY: 01610 { 01611 /* 01612 * Get the switch window info for this window 01613 */ 01614 PSWINFO pswCurrent = Getpswi(pwnd); 01615 01616 01617 if (pswCurrent) 01618 SwitchWndCleanup(&pswCurrent); 01619 } 01620 break; 01621 } 01622 01623 return xxxDefWindowProc(pwnd, message, wParam, lParam); 01624 }

VOID xxxSysCommand PWND  pwnd,
DWORD  cmd,
LPARAM  lParam
 

Definition at line 193 of file syscmd.c.

References _GetDesktopWindow(), _GetKeyState(), _GetLastActivePopup(), _GetMessagePos(), _PostMessage(), _PostThreadMessage(), CheckLock, tagLASTINPUT::dwFlags, DWORD, FALSE, FCallHookTray, FDoTray, tagPOWERSTATE::fInProgress, tagMENUSTATE::fModelessMenu, FPostTray, tagMENUSTATE::fUnderline, GETPTI, ghwndSwitch, glinp, gpDispInfo, gPowerState, gpqForeground, gpsi, gptiTasklist, gspwndFullScreen, gspwndInternalCapture, tagWND::head, HWq, IsHooked, L, LINP_LOWPOWER, LINP_POWEROFF, LINP_POWERTIMEOUTS, LOWPOWER_PHASE, MENUSYSMENU, NULL, tagMENUSTATE::pGlobalPopupMenu, PlayEventSound(), tagDISPLAYINFO::pmdev, POWEROFF_PHASE, POWERON_PHASE, tagTHREADINFO::pq, PtiCurrent, tagLASTINPUT::ptiLastWoken, tagMENUSTATE::ptiMenuStateOwner, PUDF_ANIMATE, PWND_TOP, QF_CAPTURELOCKED, RevalidateHwnd, SCROLL_DIRECT, SCROLL_NORMAL, tagQ::spwndCapture, StartScreenSaver(), TEST_PUDF, TestWF, ThreadLock, ThreadLockAlways, ThreadUnlock, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, UINT, tagSERVERINFO::uiShellMsg, USER_SOUND_MAXIMIZE, USER_SOUND_MINIMIZE, USER_SOUND_RESTOREDOWN, USER_SOUND_RESTOREUP, ValidateHwnd, WFCHILD, WFDISABLED, WFMAXIMIZED, WFMINIMIZED, WHF_CBT, xxxCallHook(), xxxHelpLoop(), xxxIsDragging(), xxxMakeWindowForegroundWithState(), xxxMNEndMenuState(), xxxMNKeyFilter(), xxxMNLoop(), xxxMNStartMenuState(), xxxMoveSize(), xxxOldNextWindow(), xxxSBTrackInit(), xxxSendMessage(), xxxSetForegroundWindow(), xxxSetWindowPos(), and xxxShowWindow().

Referenced by xxxDefWindowProc().

00197 { 00198 UINT htArea; 00199 PWND pwndSwitch; 00200 PMENUSTATE pMenuState; 00201 TL tlpwnd; 00202 POINT pt; 00203 DWORD dw; 00204 PWND pwndCapture; 00205 PTHREADINFO pti; 00206 00207 CheckLock(pwnd); 00208 00209 htArea = (UINT)(cmd & 0x0F); 00210 cmd -= htArea; 00211 00212 /* 00213 * Intense hack o' death. 00214 */ 00215 if (lParam == 0x00010000L) 00216 lParam = 0L; 00217 00218 /* 00219 * If the system doesn't have capture (ie CLENT_CAPTURE_INTERNAL) 00220 * do the sys command. Also, do the sys command for the special case 00221 * where the window receiving the sys command is a console window that 00222 * is in full screen mode. In this case we let the sys command through. 00223 * 00224 * Also if this a SC_SCREENSAVE then we handle it anyway and 00225 * switching desktops will do the cancel. SC_SCREENSAVER 00226 * is special so we can start the screen saver even if we are in 00227 * menu mode for security so NT bug 10975 Banker's Trust 00228 */ 00229 pti = GETPTI(pwnd); 00230 00231 /* 00232 * For 32bit apps (and apps on seperate queues), we need to check 00233 * the capture in the queue. Otherwise, on MDI child-destruction 00234 * we would get the restore when they shouldn't. This broke MSGOLF 00235 * who during the restore, AV'd because they assumed this wouldn't 00236 * happen. On 16bit shared apps, we want to check the internal 00237 * capture. Otherwise, when doing 16bit drag-and-drop, we would 00238 * not restore the minimized window if we had a queue-capture-window. 00239 */ 00240 00241 /* 00242 * But... it is too broad a change to just check internal capture for all WoW apps. Some 00243 * apps depend on bailing out when they have capture set. (Adobe Persuasion, NT bug 68794, 00244 * for SC_MOVE). So, let's restrict the hack to SC_RESTORE to keep Ole drag-and-drop working. 00245 * See NT bug 6109. FritzS 00246 */ 00247 00248 pwndCapture = ((pti->TIF_flags & TIF_16BIT) && (cmd == SC_RESTORE)) ? gspwndInternalCapture : 00249 pti->pq->spwndCapture; 00250 00251 if ((!pwndCapture && !TestWF(pwnd, WFDISABLED)) || 00252 (pwnd == gspwndFullScreen) || 00253 (cmd == SC_SCREENSAVE) || 00254 (cmd == SC_MONITORPOWER) || 00255 (cmd == SC_TASKLIST)) { 00256 00257 /* 00258 * Perform the sys command 00259 */ 00260 00261 #ifdef SYSMODALWINDOWS 00262 if (gspwndSysModal != NULL) { 00263 switch (cmd) { 00264 case SC_SIZE: 00265 case SC_MOVE: 00266 case SC_MINIMIZE: 00267 case SC_MAXIMIZE: 00268 case SC_NEXTWINDOW: 00269 case SC_PREVWINDOW: 00270 case SC_SCREENSAVE: 00271 return; 00272 } 00273 } 00274 #endif 00275 00276 /* 00277 * Call the CBT hook asking if it's okay to do this command. 00278 * If not, return from here. 00279 */ 00280 if (IsHooked(PtiCurrent(), WHF_CBT) && xxxCallHook(HCBT_SYSCOMMAND, 00281 (DWORD)cmd, (DWORD)lParam, WH_CBT)) { 00282 return; 00283 } 00284 00285 switch (cmd) { 00286 case SC_RESTORE: 00287 cmd = SW_RESTORE; 00288 if (TestWF(pwnd, WFMINIMIZED) || !TestWF(pwnd, WFMAXIMIZED)) 00289 PlayEventSound(USER_SOUND_RESTOREUP); 00290 else 00291 PlayEventSound(USER_SOUND_RESTOREDOWN); 00292 goto MinMax; 00293 00294 00295 case SC_MINIMIZE: 00296 cmd = SW_MINIMIZE; 00297 00298 /* 00299 * Are we already minimized? 00300 */ 00301 if (TestWF(pwnd, WFMINIMIZED)) 00302 break; 00303 00304 PlayEventSound(USER_SOUND_MINIMIZE); 00305 00306 goto MinMax; 00307 case SC_MAXIMIZE: 00308 cmd = SW_SHOWMAXIMIZED; 00309 00310 /* 00311 * Are we already maximized? 00312 */ 00313 if (TestWF(pwnd, WFMAXIMIZED)) 00314 break; 00315 00316 PlayEventSound(USER_SOUND_MAXIMIZE); 00317 MinMax: 00318 xxxShowWindow(pwnd, cmd | TEST_PUDF(PUDF_ANIMATE)); 00319 return; 00320 00321 case SC_SIZE: 00322 { 00323 xxxMoveSize(pwnd, htArea, _GetMessagePos()); 00324 } 00325 return; 00326 00327 case SC_MOVE: 00328 // 00329 // Don't enter movesize loop unless the user is actually 00330 // dragging from the caption. Otherwise, put up the system 00331 // menu on a minimized window. 00332 // 00333 00334 // 00335 // Are we dragging with the left mouse button? 00336 // 00337 dw = _GetMessagePos(); 00338 POINTSTOPOINT( pt, MAKEPOINTS(dw)); 00339 if ( !htArea || 00340 xxxIsDragging(pwnd, pt, WM_LBUTTONUP)) { 00341 00342 /* 00343 * We are moving. Enter move/size loop. 00344 */ 00345 { 00346 xxxMoveSize(pwnd, (htArea == 0) ? WMSZ_KEYMOVE : WMSZ_MOVE, dw); 00347 } 00348 } else { 00349 00350 /* 00351 * Activate our window, just like we would have in 00352 * MoveSize(). 00353 */ 00354 xxxSetWindowPos(pwnd, PWND_TOP, 0, 0, 0, 0, 00355 SWP_NOMOVE | SWP_NOSIZE); 00356 if (TestWF(pwnd, WFMINIMIZED)) { 00357 00358 /* 00359 * Try to popup the system menu 00360 */ 00361 xxxSendMessage(pwnd, WM_SYSCOMMAND, SC_KEYMENU, 00362 (DWORD) (TestWF(pwnd, WFCHILD) ? '-' : MENUSYSMENU)); 00363 } 00364 } 00365 return; 00366 00367 case SC_CLOSE: 00368 xxxSendMessage(pwnd, WM_CLOSE, 0L, 0L); 00369 return; 00370 00371 case SC_NEXTWINDOW: 00372 case SC_PREVWINDOW: 00373 xxxOldNextWindow((UINT)lParam); 00374 break; 00375 00376 case SC_CONTEXTHELP: 00377 xxxHelpLoop(pwnd); 00378 break; 00379 00380 case SC_KEYMENU: 00381 00382 /* 00383 * A menu was selected via keyboard 00384 */ 00385 pMenuState = xxxMNStartMenuState(pwnd, cmd, lParam); 00386 if (pMenuState != NULL) { 00387 UserAssert(PtiCurrent() == pMenuState->ptiMenuStateOwner); 00388 00389 /* 00390 * Make sure we are not fullscreen 00391 */ 00392 if (gspwndFullScreen == pwnd) { 00393 PWND pwndT; 00394 TL tlpwndT; 00395 00396 pwndT = _GetDesktopWindow(); 00397 ThreadLock(pwndT, &tlpwndT); 00398 xxxMakeWindowForegroundWithState(pwndT, GDIFULLSCREEN); 00399 ThreadUnlock(&tlpwndT); 00400 } 00401 00402 pMenuState->fUnderline = TRUE; 00403 xxxMNKeyFilter(pMenuState->pGlobalPopupMenu, pMenuState, (UINT)lParam); 00404 if (!pMenuState->fModelessMenu) { 00405 xxxMNEndMenuState (TRUE); 00406 } 00407 } 00408 /* 00409 * Capture must have been unlocked 00410 */ 00411 UserAssert(!(PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED)); 00412 return; 00413 00414 case SC_MOUSEMENU: 00415 case SC_DEFAULT: 00416 00417 /* 00418 * If the window is not foreground, eat the command to avoid 00419 * wasting time flashing the system menu. 00420 * 00421 * We used to check if the top level window was WFFRAMEON (so a 00422 * child window's system menu works like Win 3.1) but Excel's 00423 * (SDM) dialogs allow you to access their menus even though 00424 * the child and parent appear to be inactive. 00425 */ 00426 if (!(GETPTI(pwnd)->pq == gpqForeground)) 00427 return; 00428 00429 /* 00430 * A mouse click occurred on a toplevel menu. 00431 */ 00432 pMenuState = xxxMNStartMenuState(pwnd, cmd, lParam); 00433 if (pMenuState != NULL) { 00434 UserAssert(PtiCurrent() == pMenuState->ptiMenuStateOwner); 00435 xxxMNLoop(pMenuState->pGlobalPopupMenu, pMenuState, lParam, (cmd==SC_DEFAULT)); 00436 if (!pMenuState->fModelessMenu) { 00437 xxxMNEndMenuState (TRUE); 00438 } 00439 } 00440 /* 00441 * Capture must have been unlocked 00442 */ 00443 UserAssert(!(PtiCurrent()->pq->QF_flags & QF_CAPTURELOCKED)); 00444 return; 00445 00446 case SC_VSCROLL: 00447 case SC_HSCROLL: 00448 xxxSBTrackInit(pwnd, lParam, htArea, (_GetKeyState(VK_SHIFT) < 0) ? SCROLL_DIRECT : SCROLL_NORMAL); 00449 return; 00450 00451 case SC_TASKLIST: 00452 // _PostThreadMessage(gptiTasklist, WM_SYSCOMMAND, SC_TASKLIST, 0); 00453 // if (!FCallTray() || 00454 // !CallHook(HSHELL_TASKMAN, (WPARAM) HW16(hwnd), (LPARAM) 0, WH_SHELL)) 00455 00456 /* 00457 * Winlogon will set lParam to -1 to indicate that we really want a task list, 00458 * not just the start menu. We indicate this to the shell by passing a NULL 00459 * window ptr 00460 * This message is really intended for the SHELL, so give them the right 00461 * to set the foreground. 00462 */ 00463 if (FDoTray() && (FCallHookTray() || FPostTray(pwnd->head.rpdesk))) { 00464 PWND pwndTaskman = pwnd->head.rpdesk->pDeskInfo->spwndTaskman; 00465 if (FCallHookTray()) { 00466 xxxCallHook(HSHELL_TASKMAN, (WPARAM)HWq(pwnd), (LPARAM) 0, WH_SHELL); 00467 } 00468 if ((FPostTray(pwnd->head.rpdesk)) && (pwndTaskman != NULL)) { 00469 glinp.ptiLastWoken = GETPTI(pwndTaskman); 00470 _PostMessage(pwndTaskman, gpsi->uiShellMsg, HSHELL_TASKMAN, 00471 lParam == (ULONG)(-1) ? (LPARAM) -1 :(LPARAM)HWq(pwnd)); 00472 } 00473 } else if (gptiTasklist != NULL) { 00474 glinp.ptiLastWoken = gptiTasklist; 00475 _PostThreadMessage(gptiTasklist, WM_SYSCOMMAND, SC_TASKLIST, 0); 00476 // LATER -- FritzS 00477 // HCURSOR hCursorLast; 00478 // static char CODESEG szTask[] = " %d %d"; 00479 00480 // ShowCursor(TRUE); 00481 // hCursorLast = SetCursor32(hCursWait, TRUE); 00482 00483 // Try in the windows directory first. 00484 // GetWindowsDirectory(szBuff, sizeof(szBuff)); 00485 // if (szBuff[lstrlen(szBuff) - 1] != '\\') 00486 // lstrcatn(szBuff, "\\", sizeof(szBuff)); 00487 // lstrcatn(szBuff, (LPSTR)pTaskManName, sizeof(szBuff)); 00488 // wvsprintf(szBuff+lstrlen(szBuff), (LPSTR)szTask, (LPSTR)&lParam); 00489 00490 // if (WinExec((LPSTR)szBuff, SW_SHOWNORMAL) <= 32) 00491 // { 00492 // // If it wasn't in the windows directory then try 00493 // // searching the full path. 00494 // lstrcpyn(szBuff, pTaskManName, sizeof(szBuff)); 00495 // wvsprintf(szBuff+lstrlen(szBuff), (LPSTR)szTask, (LPSTR)&lParam); 00496 // WinExec((LPSTR)szBuff, SW_SHOWNORMAL); 00497 // } 00498 // 00499 // ShowCursor(FALSE); 00500 // SetCursor32(hCursorLast, TRUE); 00501 } 00502 00503 break; 00504 00505 case SC_MONITORPOWER: 00506 /* 00507 * If we're powering down the machine, ignore this request. 00508 */ 00509 if (gPowerState.fInProgress) { 00510 break; 00511 } 00512 00513 switch (lParam) { 00514 case POWERON_PHASE: 00515 if (glinp.dwFlags & LINP_POWERTIMEOUTS) { 00516 glinp.dwFlags &= ~LINP_POWERTIMEOUTS; 00517 DrvSetMonitorPowerState(gpDispInfo->pmdev, 00518 PowerDeviceD0); 00519 } 00520 break; 00521 case LOWPOWER_PHASE: 00522 if ((glinp.dwFlags & LINP_LOWPOWER) == 0) { 00523 glinp.dwFlags |= LINP_LOWPOWER; 00524 DrvSetMonitorPowerState(gpDispInfo->pmdev, 00525 PowerDeviceD1); 00526 } 00527 break; 00528 case POWEROFF_PHASE: 00529 if ((glinp.dwFlags & LINP_POWEROFF) == 0) { 00530 glinp.dwFlags |= LINP_POWEROFF; 00531 DrvSetMonitorPowerState(gpDispInfo->pmdev, 00532 PowerDeviceD3); 00533 } 00534 break; 00535 default: 00536 break; 00537 } 00538 break; 00539 00540 case SC_SCREENSAVE: 00541 pwndSwitch = RevalidateHwnd(ghwndSwitch); 00542 00543 // Lock out screen save until we get another input message. 00544 00545 if (pwndSwitch != NULL && pwnd != pwndSwitch) { 00546 _PostMessage(pwndSwitch, WM_SYSCOMMAND, SC_SCREENSAVE, 0L); 00547 } else { 00548 StartScreenSaver(FALSE); 00549 } 00550 break; 00551 00552 case SC_HOTKEY: 00553 00554 /* 00555 * Loword of the lparam is window to switch to 00556 */ 00557 pwnd = ValidateHwnd((HWND)lParam); 00558 if (pwnd != NULL) { 00559 pwndSwitch = _GetLastActivePopup(pwnd); 00560 00561 if (pwndSwitch != NULL) 00562 pwnd = pwndSwitch; 00563 00564 ThreadLockAlways(pwnd, &tlpwnd); 00565 xxxSetForegroundWindow(pwnd, FALSE); 00566 ThreadUnlock(&tlpwnd); 00567 00568 if (TestWF(pwnd, WFMINIMIZED)) 00569 _PostMessage(pwnd, WM_SYSCOMMAND, SC_RESTORE, 0); 00570 } 00571 break; 00572 } 00573 } 00574 }

BOOL xxxSystemParametersInfo UINT  wFlag,
DWORD  wParam,
LPVOID  lParam,
UINT  flags
 

Referenced by NtUserSystemParametersInfo(), xxxUpdatePerUserSystemParameters(), and xxxUserPowerEventCalloutWorker().

VOID xxxSystemTimerProc PWND  pwnd,
UINT  msg,
UINT_PTR  id,
LPARAM  lParam
 

Definition at line 882 of file timers.c.

References _KillSystemTimer(), _PostMessage(), AnimateFade(), CheckLock, tagDCE::DCX_flags, DF_TRACKMOUSEHOVER, tagDESKTOP::dwDTFlags, GetActiveTrackPwnd(), GetMouseKeyFlags(), GETPTI, gpDispInfo, gpsi, tagDESKTOP::htEx, HTEXMENUFIRST, HTEXMENULAST, HTEXSCROLLFIRST, HTEXSCROLLLAST, HWq, IDSYS_FADE, IDSYS_FLASHWND, IDSYS_LAYER, IDSYS_MOUSEHOVER, IDSYS_WNDTRACKING, msg, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, tagTHREADINFO::pq, PtInRect(), QF_ACTIVEWNDTRACKING, tagQ::QF_flags, QF_MOUSEMOVED, tagWND::rcClient, tagDESKTOP::rcMouseHover, tagTHREADINFO::rpdesk, SetWakeBit(), tagDESKTOP::spwndTrack, TestUP, TestWF, UINT, UpdateLayeredSprite(), VOID(), and xxxFlashWindow().

Referenced by IncrementRedirectedCount(), ResetMouseHover(), StartFade(), xxxFlashWindow(), and xxxTrackMouseMove().

00883 { 00884 CheckLock(pwnd); 00885 UNREFERENCED_PARAMETER(msg); 00886 UNREFERENCED_PARAMETER(id); 00887 UNREFERENCED_PARAMETER(lParam); 00888 00889 switch (id) { 00890 case IDSYS_LAYER: { 00891 PDCE pdce; 00892 00893 for (pdce = gpDispInfo->pdceFirst; pdce != NULL; pdce = pdce->pdceNext) { 00894 00895 if (pdce->DCX_flags & (DCX_INVALID | DCX_DESTROYTHIS)) 00896 continue; 00897 00898 if ((pdce->DCX_flags & DCX_LAYERED) && (pdce->DCX_flags & DCX_INUSE)) { 00899 UpdateLayeredSprite(pdce); 00900 } 00901 } 00902 } 00903 return; 00904 00905 case IDSYS_FADE: 00906 AnimateFade(); 00907 return; 00908 00909 case IDSYS_FLASHWND: 00910 xxxFlashWindow(pwnd, FLASHW_TIMERCALL, 0); 00911 return; 00912 00913 case IDSYS_WNDTRACKING: { 00914 /* 00915 * If the active track window hasn't changed, 00916 * it's time to active it. 00917 * spwndTrack can be NULL if it got destroyed but we haven't 00918 * destroyed the timer.yet 00919 */ 00920 PTHREADINFO pti = GETPTI(pwnd); 00921 UserAssert(TestUP(ACTIVEWINDOWTRACKING)); 00922 00923 if ((pti->rpdesk->spwndTrack != NULL) 00924 && (pwnd == GetActiveTrackPwnd(pti->rpdesk->spwndTrack, NULL))) { 00925 00926 pti->pq->QF_flags |= (QF_ACTIVEWNDTRACKING | QF_MOUSEMOVED); 00927 00928 #ifdef REDIRECTION 00929 /* 00930 * Should we call the hit test hook here ? 00931 */ 00932 PushMouseMove(pti->pq, gpsi->ptCursor); 00933 #endif // REDIRECTION 00934 00935 SetWakeBit(pti, QS_MOUSEMOVE); 00936 } 00937 } 00938 break; 00939 00940 case IDSYS_MOUSEHOVER: { 00941 PTHREADINFO pti = GETPTI(pwnd); 00942 PDESKTOP pdesk = pti->rpdesk; 00943 /* 00944 * If hover hasn't been canceled, the mouse is still on 00945 * this window and the point is still on the rect, then 00946 * it's hover time! 00947 */ 00948 if ((pdesk->dwDTFlags & DF_TRACKMOUSEHOVER) 00949 && (HWq(pwnd) == HWq(pdesk->spwndTrack) 00950 && PtInRect(&pdesk->rcMouseHover, gpsi->ptCursor))) { 00951 00952 UINT message; 00953 WPARAM wParam; 00954 POINT pt = gpsi->ptCursor; 00955 00956 if (pdesk->htEx == HTCLIENT) { 00957 message = WM_MOUSEHOVER; 00958 wParam = (WPARAM)GetMouseKeyFlags(pti->pq); 00959 #ifdef USE_MIRRORING 00960 if (TestWF(pwnd, WEFLAYOUTRTL)) { 00961 pt.x = pwnd->rcClient.right - pt.x - 1; 00962 } else 00963 #endif 00964 { 00965 pt.x -= pwnd->rcClient.left; 00966 } 00967 pt.y -= pwnd->rcClient.top; 00968 } else { 00969 message = WM_NCMOUSEHOVER; 00970 /* 00971 * Map the extended hit test code to a public one. 00972 */ 00973 wParam = (WPARAM)LOWORD(pdesk->htEx); 00974 if ((wParam >= HTEXMENUFIRST) && (wParam <= HTEXMENULAST)) { 00975 wParam = (WPARAM)HTMENU; 00976 } else if ((wParam >= HTEXSCROLLFIRST) && (wParam <= HTEXSCROLLLAST)) { 00977 wParam = (WPARAM)(HIWORD(pdesk->htEx) ? HTVSCROLL : HTHSCROLL); 00978 } 00979 } 00980 00981 _PostMessage(pwnd, message, wParam, MAKELPARAM(pt.x, pt.y)); 00982 00983 pdesk->dwDTFlags &= ~DF_TRACKMOUSEHOVER; 00984 break; 00985 } 00986 } 00987 return; 00988 00989 00990 default: 00991 RIPMSG1(RIP_ERROR, "xxxSystemTimerProc: unexpected id:%#lx", id); 00992 break; 00993 } 00994 00995 /* 00996 * if we fell through, the timer got to go 00997 */ 00998 _KillSystemTimer(pwnd, id); 00999 return; 01000 }

LRESULT xxxTooltipWndProc PWND  ,
UINT  ,
WPARAM  ,
LPARAM 
 

Definition at line 570 of file tooltips.c.

References CheckLock, CleanupTooltipAnimation(), CMS_TOOLTIP, CreateFade(), CreateTooltipBitmap(), cy, DestroyTooltipBitmap(), DF_TOOLTIP, tagTOOLTIPWND::dwHideDelay, FADE_SHOW, FADE_TOOLTIP, FNID_TOOLTIP, GETPDESK, tagTOOLTIPWND::hdcMem, InitTooltipAnimation(), InitTooltipDelay(), NtGetTickCount(), NULL, SetTooltipTimer(), StartFade(), StopFade(), TestALPHA, TestEffectUP, TestFadeFlags(), TooltipRender(), TT_ANIMATEDELAY, TTT_ANIMATE, TTT_HIDE, UINT, VALIDATECLASSANDSIZE, xxxBeginPaint(), xxxDefWindowProc(), xxxEndPaint(), xxxSendMessage(), and xxxTooltipHandleTimer().

Referenced by InitializeClientPfnArrays(), and LW_RegisterWindows().

00571 { 00572 PAINTSTRUCT ps; 00573 PTOOLTIPWND pttwnd; 00574 00575 CheckLock(pwnd); 00576 VALIDATECLASSANDSIZE(pwnd, uMsg, wParam, lParam, FNID_TOOLTIP, WM_NCCREATE); 00577 pttwnd = (PTOOLTIPWND)pwnd; 00578 00579 switch(uMsg) { 00580 case WM_TIMER: 00581 xxxTooltipHandleTimer(pttwnd, (UINT)wParam); 00582 break; 00583 00584 case WM_PAINT: 00585 xxxBeginPaint(pwnd, &ps); 00586 TooltipRender(pttwnd, ps.hdc); 00587 xxxEndPaint(pwnd, &ps); 00588 break; 00589 00590 case WM_PRINTCLIENT: 00591 TooltipRender(pttwnd, (HDC)wParam); 00592 break; 00593 00594 case WM_ERASEBKGND: 00595 break; 00596 00597 case WM_NCCREATE: 00598 InitTooltipDelay(pttwnd); 00599 InitTooltipAnimation(pttwnd); 00600 goto CallDWP; 00601 00602 case WM_NCDESTROY: 00603 CleanupTooltipAnimation(pttwnd); 00604 GETPDESK(pttwnd)->dwDTFlags &= ~DF_TOOLTIP; 00605 goto CallDWP; 00606 00607 case WM_WINDOWPOSCHANGED: 00608 if (((LPWINDOWPOS)lParam)->flags & SWP_SHOWWINDOW) { 00609 HDC hdc; 00610 int cx; 00611 int cy; 00612 00613 if (!TestEffectUP(TOOLTIPANIMATION)) { 00614 SetTooltipTimer(pttwnd, TTT_HIDE, pttwnd->dwHideDelay); 00615 goto CallDWP; 00616 } 00617 00618 hdc = NULL; 00619 cx = pttwnd->rcWindow.right - pttwnd->rcWindow.left; 00620 cy = pttwnd->rcWindow.bottom - pttwnd->rcWindow.top; 00621 00622 /* 00623 * At this point we're sure that the window is showing and the size 00624 * has been changed and we're in the context of the desktop thread. 00625 */ 00626 if (TestALPHA(TOOLTIPFADE)) { 00627 hdc = CreateFade((PWND)pttwnd, NULL, CMS_TOOLTIP, 00628 FADE_SHOW | FADE_TOOLTIP); 00629 } else { 00630 if (CreateTooltipBitmap(pttwnd, cx, cy)) { 00631 hdc = pttwnd->hdcMem; 00632 } 00633 } 00634 00635 if (hdc == NULL) { 00636 SetTooltipTimer(pttwnd, TTT_HIDE, 0); 00637 goto CallDWP; 00638 } 00639 00640 xxxSendMessage((PWND)pttwnd, WM_PRINT, (WPARAM)hdc, 00641 PRF_CLIENT | PRF_NONCLIENT | PRF_CHILDREN | PRF_ERASEBKGND); 00642 00643 /* 00644 * Start animation timer 00645 */ 00646 00647 if (TestFadeFlags(FADE_TOOLTIP)) { 00648 StartFade(); 00649 SetTooltipTimer(pttwnd, TTT_HIDE, pttwnd->dwHideDelay); 00650 } else { 00651 pttwnd->dwAnimStart = NtGetTickCount(); 00652 SetTooltipTimer(pttwnd, TTT_ANIMATE, TT_ANIMATEDELAY); 00653 } 00654 } else if (((LPWINDOWPOS)lParam)->flags & SWP_HIDEWINDOW) { 00655 if (TestFadeFlags(FADE_TOOLTIP)) { 00656 StopFade(); 00657 } else { 00658 DestroyTooltipBitmap(pttwnd); 00659 } 00660 } 00661 goto CallDWP; 00662 00663 default: 00664 CallDWP: 00665 return xxxDefWindowProc(pwnd, uMsg, wParam, lParam); 00666 } 00667 00668 return 0; 00669 }

int xxxToUnicodeEx UINT  wVirtKey,
UINT  wScanCode,
CONST BYTE lpKeyState,
LPWSTR  pwszBuff,
int  cchBuff,
UINT  wFlags,
HKL  hkl
 

Definition at line 40 of file tounicod.c.

References BYTE, CBKEYSTATE, ClearKeyDownBit, ClearKeyToggleBit, DWORD, SetKeyDownBit, SetKeyToggleBit, and xxxInternalToUnicode().

Referenced by NtUserToUnicodeEx().

00048 { 00049 int i; 00050 BYTE afKeyState[CBKEYSTATE]; 00051 DWORD dwDummy; 00052 00053 /* 00054 * pKeyState is an array of 256 bytes, each byte representing the 00055 * following virtual key state: 0x80 means down, 0x01 means toggled. 00056 * InternalToUnicode() takes an array of bits, so pKeyState needs to 00057 * be translated. _ToAscii only a public api and rarely gets called, 00058 * so this is no big deal. 00059 */ 00060 for (i = 0; i < 256; i++, pbKeyState++) { 00061 if (*pbKeyState & 0x80) { 00062 SetKeyDownBit(afKeyState, i); 00063 } else { 00064 ClearKeyDownBit(afKeyState, i); 00065 } 00066 00067 if (*pbKeyState & 0x01) { 00068 SetKeyToggleBit(afKeyState, i); 00069 } else { 00070 ClearKeyToggleBit(afKeyState, i); 00071 } 00072 } 00073 00074 i = xxxInternalToUnicode(wVirtKey, wScanCode, afKeyState, pwszBuff, cchBuff, 00075 wKeyFlags, &dwDummy, hkl); 00076 00077 00078 return i; 00079 }

VOID xxxTrackBox PWND  ,
UINT  ,
WPARAM  ,
LPARAM  ,
PSBCALC 
 

Definition at line 1971 of file sbctl.c.

References _SetSystemTimer(), BOOL, CheckLock, tagSBTRACK::cmdSB, FALSE, tagSBTRACK::fHitOld, tagSBTRACK::fTrackRecalc, tagSBTRACK::fTrackVert, GET_X_LPARAM, GET_Y_LPARAM, gpsi, HIBYTE, tagSBTRACK::hTimerSB, IDSYS_SCROLL, IsWinEventNotifyDeferredOK, NULL, PtInRect(), PWNDTOPSBTRACK, tagSBTRACK::rcTrack, RecalcTrackRect(), RETURN_IF_PSBTRACK_INVALID, tagSBTRACK::spwndSB, tagSBTRACK::spwndSBNotify, xxxContScroll(), xxxDoScroll(), xxxEndScroll(), and zzzDrawInvertScrollArea().

Referenced by xxxContScroll(), xxxEndScroll(), and xxxSBTrackInit().

01977 { 01978 BOOL fHit; 01979 POINT ptHit; 01980 PSBTRACK pSBTrack = PWNDTOPSBTRACK(pwnd); 01981 int cmsTimer; 01982 01983 UNREFERENCED_PARAMETER(wParam); 01984 UNREFERENCED_PARAMETER(pSBCalc); 01985 01986 CheckLock(pwnd); 01987 UserAssert(IsWinEventNotifyDeferredOK()); 01988 01989 if (pSBTrack == NULL) 01990 return; 01991 01992 if (message != WM_NULL && HIBYTE(message) != HIBYTE(WM_MOUSEFIRST)) 01993 return; 01994 01995 if (pSBTrack->fTrackRecalc) { 01996 RecalcTrackRect(pSBTrack); 01997 pSBTrack->fTrackRecalc = FALSE; 01998 } 01999 02000 ptHit.x = GET_X_LPARAM(lParam); 02001 ptHit.y = GET_Y_LPARAM(lParam); 02002 fHit = PtInRect(&pSBTrack->rcTrack, ptHit); 02003 02004 if (fHit != (BOOL)pSBTrack->fHitOld) { 02005 zzzDrawInvertScrollArea(pwnd, pSBTrack, fHit, pSBTrack->cmdSB); 02006 // After zzz, pSBTrack may no longer be valid 02007 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02008 } 02009 02010 cmsTimer = gpsi->dtScroll / 8; 02011 02012 switch (message) { 02013 case WM_LBUTTONUP: 02014 xxxEndScroll(pwnd, FALSE); 02015 // Note: after xxx, pSBTrack may no longer be valid 02016 break; 02017 02018 case WM_LBUTTONDOWN: 02019 pSBTrack->hTimerSB = 0; 02020 cmsTimer = gpsi->dtScroll; 02021 02022 /* 02023 *** FALL THRU ** 02024 */ 02025 02026 case WM_MOUSEMOVE: 02027 if (fHit && fHit != (BOOL)pSBTrack->fHitOld) { 02028 02029 /* 02030 * We moved back into the normal rectangle: reset timer 02031 */ 02032 pSBTrack->hTimerSB = _SetSystemTimer(pwnd, IDSYS_SCROLL, 02033 cmsTimer, xxxContScroll); 02034 02035 /* 02036 * DoScroll does thread locking on these two pwnds - 02037 * this is ok since they are not used after this 02038 * call. 02039 */ 02040 if (pSBTrack->spwndSBNotify != NULL) { 02041 xxxDoScroll(pSBTrack->spwndSB, pSBTrack->spwndSBNotify, 02042 pSBTrack->cmdSB, 0, pSBTrack->fTrackVert); 02043 // Note: after xxx, pSBTrack may no longer be valid 02044 } 02045 } 02046 } 02047 // After xxxDoScroll or xxxEndScroll, revalidate pSBTrack 02048 RETURN_IF_PSBTRACK_INVALID(pSBTrack, pwnd); 02049 pSBTrack->fHitOld = fHit; 02050 }

WORD xxxTrackCaptionButton PWND  pwnd,
UINT  hit
 

Definition at line 158 of file caption.c.

References _GetDCEx(), _ReleaseDC(), BitBltSysBmp(), BOOL, CheckLock, ClrWF, DOBI_NORMAL, DOBI_PUSHED, DWORD, FALSE, FWINABLE, GET_X_LPARAM, GET_Y_LPARAM, IsWinEventNotifyDeferredOK, msg, NULL, PtiCurrent, PtInRect(), SetWF, TRUE, WFCLOSEBUTTONDOWN, WFHELPBUTTONDOWN, WFREDUCEBUTTONDOWN, WFZOOMBUTTONDOWN, xxxCalcCaptionButton(), xxxPeekMessage, xxxReleaseCapture(), xxxSetCapture(), xxxSleepThread(), and xxxWindowEvent().

Referenced by xxxDWP_NCMouse().

00161 { 00162 WORD cmd; 00163 MSG msg; 00164 HDC hdc; 00165 WORD bm; 00166 int x; 00167 int y; 00168 WORD wState; 00169 WORD wNewState; 00170 BOOL fMouseUp = FALSE; 00171 RECT rcBtn; 00172 DWORD dwWhere; 00173 int iButton; 00174 WORD wf; 00175 UserAssert(IsWinEventNotifyDeferredOK()); 00176 00177 CheckLock(pwnd); 00178 00179 /* 00180 * Set up iButton for this and future STATECHANGE events 00181 */ 00182 switch (hit) { 00183 case HTCLOSE: 00184 iButton = INDEX_TITLEBAR_CLOSEBUTTON; 00185 wf = WFCLOSEBUTTONDOWN; 00186 break; 00187 00188 case HTREDUCE: 00189 iButton = INDEX_TITLEBAR_MINBUTTON; 00190 wf = WFREDUCEBUTTONDOWN; 00191 break; 00192 00193 case HTZOOM: 00194 iButton = INDEX_TITLEBAR_MAXBUTTON; 00195 wf = WFZOOMBUTTONDOWN; 00196 break; 00197 00198 case HTHELP: 00199 iButton = INDEX_TITLEBAR_HELPBUTTON; 00200 wf = WFHELPBUTTONDOWN; 00201 break; 00202 00203 default: 00204 UserAssert(FALSE); 00205 } 00206 dwWhere = xxxCalcCaptionButton(pwnd, iButton, &cmd, &rcBtn, &bm); 00207 x = GET_X_LPARAM(dwWhere); 00208 y = GET_Y_LPARAM(dwWhere); 00209 00210 if (cmd) { 00211 /* 00212 * Draw the image in its depressed state. 00213 */ 00214 hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE); 00215 BitBltSysBmp(hdc, x, y, bm + DOBI_PUSHED); 00216 _ReleaseDC(hdc); 00217 00218 wState = DOBI_PUSHED; 00219 00220 /* 00221 * Notification of button press. 00222 */ 00223 00224 SetWF(pwnd, wf); 00225 00226 if (FWINABLE()) { 00227 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR, 00228 iButton, 0); 00229 } 00230 } else { 00231 iButton = 0; 00232 } 00233 00234 xxxSetCapture(pwnd); 00235 00236 while (!fMouseUp) { 00237 00238 if (xxxPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE)) { 00239 if (msg.message == WM_LBUTTONUP) { 00240 00241 xxxReleaseCapture(); 00242 fMouseUp = TRUE; 00243 00244 } else if ((msg.message == WM_MOUSEMOVE) && cmd) { 00245 00246 wNewState = PtInRect(&rcBtn, msg.pt) ? DOBI_PUSHED : DOBI_NORMAL; 00247 00248 if (wState != wNewState) { 00249 wState = wNewState; 00250 00251 hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE); 00252 BitBltSysBmp(hdc, x, y, bm + wState); 00253 _ReleaseDC(hdc); 00254 00255 if (wState == DOBI_PUSHED) { 00256 SetWF(pwnd, wf); 00257 } else { 00258 ClrWF(pwnd, wf); 00259 } 00260 00261 if (FWINABLE()) { 00262 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR, 00263 iButton, 0); 00264 } 00265 } 00266 } 00267 } else if (!xxxSleepThread(QS_MOUSE, 0, TRUE)) { 00268 break; 00269 } 00270 if (pwnd != PtiCurrent()->pq->spwndCapture) { 00271 /* 00272 * We lost capture. This could have happened during 00273 * the WM_CAPTURECHANGED callback or later if we 00274 * are/were not in the foreground queue. 00275 */ 00276 break; 00277 } 00278 } 00279 00280 if (!cmd) 00281 return 0; 00282 00283 if (wState && (cmd != SC_CONTEXTHELP)) { 00284 hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE); 00285 BitBltSysBmp(hdc, x, y, bm); 00286 _ReleaseDC(hdc); 00287 00288 ClrWF(pwnd, wf); 00289 00290 if (FWINABLE()) { 00291 xxxWindowEvent(EVENT_OBJECT_STATECHANGE, pwnd, OBJID_TITLEBAR, 00292 iButton, 0); 00293 } 00294 } 00295 00296 return (fMouseUp && PtInRect(&rcBtn, msg.pt)) ? cmd : 0; 00297 }

void xxxTrackMouseMove PWND  pwnd,
int  htEx,
UINT  message
 

Definition at line 904 of file tooltips.c.

References BOOL, CheckLock, DF_HOTTRACKING, DF_MOUSEMOVETRK, DF_TOOLTIP, DF_TOOLTIPACTIVE, DF_TRACKMOUSEEVENT, tagDESKTOP::dwDTFlags, DWORD, tagWINDOWSTATION::dwWSF_Flags, GetActiveTrackPwnd(), GETPTI, gpsi, tagDESKTOP::htEx, IDSYS_WNDTRACKING, InternalSetTimer(), IsTooltipHittest(), Lock, NULL, PostEventMessage(), tagTHREADINFO::pq, PtiCurrent, QEVENT_CANCELMOUSEMOVETRK, QF_ACTIVEWNDTRACKING, tagDESKTOP::rpwinstaParent, tagDESKTOP::spwndTooltip, tagDESKTOP::spwndTrack, TestEffectUP, TestUP, ThreadLockAlways, ThreadUnlock, TRUE, UINT, UP, WSF_NOIO, xxxCancelMouseMoveTracking(), xxxCreateTooltip(), xxxHotTrack(), xxxResetTooltip(), and xxxSystemTimerProc().

Referenced by xxxScanSysQueue().

00905 { 00906 BOOL fNewpwndTrack; 00907 DWORD dwDTCancel = 0; 00908 TL tlpwnd; 00909 LPWSTR pstr; 00910 PDESKTOP pdesk = PtiCurrent()->rpdesk; 00911 PTHREADINFO ptiTrack; 00912 00913 00914 #if DBG 00915 /* 00916 * Let's warn if this function gets reenterd so we can make sure 00917 * nothing bad will follow. This should be a rare situation. 00918 * Look in gptiReEntered to find out who is already here. 00919 */ 00920 static UINT gcReEntered = 0; 00921 static PTHREADINFO gptiReEntered; 00922 if(gcReEntered++ != 0){ 00923 RIPMSG2(RIP_WARNING, "Reentered xxxTrackMouseMove; previous thread was %#p, current thread is %#p", gptiReEntered, PtiCurrent()); 00924 } 00925 gptiReEntered = PtiCurrent(); 00926 00927 CheckLock(pwnd); 00928 00929 /* 00930 * We must be on an interactive window station. 00931 */ 00932 if (pdesk->rpwinstaParent != NULL && 00933 pdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO) { 00934 RIPMSG0(RIP_ERROR, "Can't use tooltips on non-interactive winsta"); 00935 } 00936 00937 { 00938 static POINT pt = {0, 0}; 00939 00940 #ifdef UNDONE 00941 /* 00942 * We might have taken a guess on the hit test (see FindNCHitEx) 00943 * so if we're at the same point and same window, something 00944 * might be fishy 00945 */ 00946 if ((pt.x == gpsi->ptCursor.x) 00947 && (pt.y == gpsi->ptCursor.y) 00948 && (pdesk->spwndTrack == pwnd)) { 00949 RIPMSG1(RIP_WARNING, "xxxTrackMouseMove: Same point & window. %#p", pwnd); 00950 } 00951 #endif 00952 00953 /* 00954 * Something is supposed to have changed or we're wasting time 00955 */ 00956 UserAssert((pt.x != gpsi->ptCursor.x) 00957 || (pt.y != gpsi->ptCursor.y) 00958 || (pdesk->spwndTrack != pwnd) 00959 || (pdesk->htEx != htEx) 00960 || (message != WM_MOUSEMOVE)); 00961 /* 00962 * Remember last tracked point 00963 */ 00964 pt = gpsi->ptCursor; 00965 } 00966 /* 00967 * pwnd is supposed to be on the current thread and queue 00968 */ 00969 UserAssert(PtiCurrent() == GETPTI(pwnd)); 00970 UserAssert(PtiCurrent()->pq == GETPTI(pwnd)->pq); 00971 #endif 00972 00973 /* 00974 * Have we switched windows? 00975 */ 00976 fNewpwndTrack = (pdesk->spwndTrack != pwnd); 00977 /* 00978 * If no tracking is taking place, just go set the new 00979 * tracking state 00980 */ 00981 if (!(pdesk->dwDTFlags & DF_MOUSEMOVETRK)) { 00982 goto SetNewState; 00983 } 00984 /* 00985 * Potentially while we leave the critical section below in 00986 * xxxCancelMouseMoveTracking, spwndTrack could be destroyed and unlocked 00987 * and then we go and create the tooltip. This would mean that 00988 * DF_TOOLTIPACTIVE (part of DF_MOUSEMOVETRK test above) would be set, 00989 * but pdesk->spwndTrack would be NULL and we can AV dereferencing 00990 * pdesk->spwndTrack below. Prevent this by making the check here. 00991 */ 00992 if (pdesk->spwndTrack == NULL) { 00993 goto SetNewState; 00994 } 00995 00996 /* 00997 * Nuke hottracking and deactivate tooltip state, if any. 00998 * Do it sychronously if we're tracking on the current queue; 00999 * Otherwise, post an event and let it happen later. 01000 */ 01001 ptiTrack = GETPTI(pdesk->spwndTrack); 01002 if (PtiCurrent()->pq == ptiTrack->pq) { 01003 dwDTCancel |= DF_HOTTRACKING; 01004 } else if (pdesk->dwDTFlags & (DF_HOTTRACKING | DF_TOOLTIPACTIVE)) { 01005 PostEventMessage(ptiTrack, ptiTrack->pq, 01006 QEVENT_CANCELMOUSEMOVETRK, 01007 pdesk->spwndTrack, 01008 pdesk->dwDTFlags, 01009 pdesk->htEx, DF_HOTTRACKING); 01010 /* 01011 * Paranoid assertion. If we're switching queues, we must 01012 * be switching windows. Did we just go through 01013 * ReattachThreads? 01014 */ 01015 UserAssert(pwnd != pdesk->spwndTrack); 01016 pdesk->dwDTFlags &= ~(DF_HOTTRACKING | DF_TOOLTIPACTIVE); 01017 } 01018 /* 01019 * If we're on the client area or the user clicked, 01020 * nuke the tooltip (if any). 01021 * Since we might want to re-show the tooltip, we don't nuke it 01022 * now if we swichted windows (we'll nuke it later if needed) 01023 */ 01024 if ((htEx == HTCLIENT) || (message != WM_MOUSEMOVE)) { 01025 dwDTCancel |= DF_TOOLTIPACTIVE; 01026 } 01027 /* 01028 * If we switched windows or crossed client/nonclinet boundaries, 01029 * end track mouse leave/hover. 01030 */ 01031 if (fNewpwndTrack || ((pdesk->htEx == HTCLIENT) ^ (htEx == HTCLIENT))) { 01032 dwDTCancel |= DF_TRACKMOUSEEVENT; 01033 } 01034 /* 01035 * Cancel whatever is active and needs to go away 01036 */ 01037 ThreadLockAlways(pdesk->spwndTrack, &tlpwnd); 01038 xxxCancelMouseMoveTracking(pdesk->dwDTFlags, 01039 pdesk->spwndTrack, 01040 pdesk->htEx, 01041 dwDTCancel); 01042 ThreadUnlock(&tlpwnd); 01043 pdesk->dwDTFlags &= ~dwDTCancel; 01044 01045 01046 01047 SetNewState: 01048 /* 01049 * Hottracking/tooltip on mouse move if on NC hitest and enabled 01050 */ 01051 if ((htEx != HTCLIENT) && (message == WM_MOUSEMOVE) && TestEffectUP(HOTTRACKING)) { 01052 /* 01053 * Hottrack the new hit test area 01054 */ 01055 if (xxxHotTrack(pwnd, htEx, TRUE)) { 01056 pdesk->dwDTFlags |= DF_HOTTRACKING; 01057 } 01058 01059 /* 01060 * Remove/set the tool tip. 01061 * We always do this synchronously because it doesn't mess 01062 * with pwnd's or spwnTrack's queue 01063 */ 01064 if ((pstr = IsTooltipHittest(pwnd, LOWORD(htEx))) != NULL) { 01065 PTOOLTIPWND pttwnd = (PTOOLTIPWND)pdesk->spwndTooltip; 01066 ThreadLockAlways(pttwnd, &tlpwnd); 01067 xxxCreateTooltip(pttwnd, pstr); 01068 ThreadUnlock(&tlpwnd); 01069 pdesk->dwDTFlags |= DF_TOOLTIP; 01070 } else { 01071 PTOOLTIPWND pttwnd = (PTOOLTIPWND)pdesk->spwndTooltip; 01072 ThreadLockAlways(pttwnd, &tlpwnd); 01073 xxxResetTooltip(pttwnd); 01074 ThreadUnlock(&tlpwnd); 01075 } 01076 } /* if (htEx != HTCLIENT) */ 01077 01078 01079 ValidateThreadLocks(NULL, PtiCurrent()->ptl, (ULONG_PTR)&pwnd, TRUE); 01080 01081 /* 01082 * Update new track window if needed. 01083 */ 01084 if (fNewpwndTrack) { 01085 PWND pwndActivate; 01086 01087 Lock(&pdesk->spwndTrack, pwnd); 01088 /* 01089 * Active window tracking. 01090 * If there is non-zero timeout, get the window we're supposed to activate 01091 * and set the timer. Otherwise, set the queue flag so 01092 * xxxActiveWindowTracking can do its thing. 01093 */ 01094 if ((message == WM_MOUSEMOVE) && TestUP(ACTIVEWINDOWTRACKING)) { 01095 if (UP(ACTIVEWNDTRKTIMEOUT) != 0) { 01096 pwndActivate = GetActiveTrackPwnd(pwnd, NULL); 01097 if (pwndActivate != NULL) { 01098 InternalSetTimer(pwndActivate, IDSYS_WNDTRACKING, 01099 UP(ACTIVEWNDTRKTIMEOUT), 01100 xxxSystemTimerProc, TMRF_SYSTEM); 01101 } 01102 } else { 01103 PtiCurrent()->pq->QF_flags |= QF_ACTIVEWNDTRACKING; 01104 } /* if (TestUP(ACTIVEWNDTRKZORDER)) */ 01105 } /* if (TestUP(ACTIVEWINDOWTRACKING)) */ 01106 01107 } 01108 01109 /* 01110 * Save new hit test code 01111 */ 01112 pdesk->htEx = htEx; 01113 01114 #if DBG 01115 --gcReEntered; 01116 #endif 01117 }

BOOL xxxTrackPopupMenuEx PMENU  pmenu,
UINT  dwFlags,
int  x,
int  y,
PWND  pwnd,
CONST TPMPARAMS *  pparams
 

Definition at line 52 of file mnpopup.c.

References _GetKeyState(), _KillTimer(), _MonitorFromPoint(), BOOL, CheckLock, ClrWF, tagLASTINPUT::dwFlags, dwFlags, ExitMenuLoop(), FALSE, tagMENUSTATE::fButtonDown, tagPOPUPMENU::fDelayedFree, tagMENUSTATE::fDragAndDrop, tagPOPUPMENU::fDroppedLeft, tagPOPUPMENU::fFirstClick, FindBestPos(), tagPOPUPMENU::fIsSysMenu, tagPOPUPMENU::fIsTrackPopup, tagMENUSTATE::fModelessMenu, tagPOPUPMENU::fNoNotify, tagPOPUPMENU::fRightButton, tagPOPUPMENU::fSendUninit, tagPOPUPMENU::fShowTimer, tagPOPUPMENU::fSynchronous, tagMENUSTATE::fUnderline, FWINABLE, GET_X_LPARAM, GET_Y_LPARAM, GETPTI, glinp, HW, tagPOPUPMENU::iDropDir, IDSYS_MNSHOW, L, LINP_KEYBOARD, Lock, LockPopupMenu(), MENUCLASS, MFRTL, MFUNDERLINE, MNAnimate(), MNSW_SIZE, MOUSEHOLD, NULL, PAS_DOWN, PAS_HORZ, PAS_LEFT, PAS_OUT, PAS_RIGHT, PAS_UP, PAS_VERT, tagMENUSTATE::pGlobalPopupMenu, PlayEventSound(), tagTHREADINFO::pMenuState, tagPOPUPMENU::ppopupmenuRoot, tagTHREADINFO::pq, PtiCurrent, tagMENUSTATE::ptiMenuStateOwner, PtoHq, PWND_TOP, PWND_TOPMOST, QF_CAPTURELOCKED, tagQ::QF_flags, SetMF, SetWF, tagPOPUPMENU::spmenu, tagPOPUPMENU::spwndActivePopup, tagPOPUPMENU::spwndNotify, tagPOPUPMENU::spwndPopupMenu, SYSMET, TestMF, TestWF, ThreadLock, ThreadLockAlways, ThreadUnlock, TRUE, USER_SOUND_MENUPOPUP, WFDESTROYED, WFOLDUI, xxxClientRegisterDragDrop(), xxxCreateWindowEx(), xxxDestroyWindow(), xxxMNAllocMenuState(), xxxMNEndMenuState(), xxxMNLoop(), xxxMNReleaseCapture(), xxxMNStartMenu(), xxxSendMessage(), xxxSetWindowPos(), and xxxWindowEvent().

Referenced by NtUserTrackPopupMenuEx(), xxxDefWindowProc(), and xxxDoScrollMenu().

00059 { 00060 PMENUSTATE pMenuState; 00061 PWND pwndHierarchy; 00062 PPOPUPMENU ppopupMenuHierarchy; 00063 LONG sizeHierarchy; 00064 int cxPopup, 00065 cyPopup; 00066 BOOL fSync; 00067 int cmd; 00068 BOOL fButtonDown; 00069 TL tlpwndHierarchy; 00070 TL tlpwndT; 00071 RECT rcExclude; 00072 PTHREADINFO ptiCurrent, 00073 ptiOwner; 00074 PMONITOR pMonitor; 00075 POINT pt; 00076 00077 CheckLock(pMenu); 00078 CheckLock(pwndOwner); 00079 00080 /* 00081 * Capture the things we care about in case lpTpm goes away. 00082 */ 00083 if (lpTpm != NULL) { 00084 if (lpTpm->cbSize != sizeof(TPMPARAMS)) { 00085 RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "TrackPopupMenuEx: cbSize is invalid"); 00086 return(FALSE); 00087 } 00088 rcExclude = lpTpm->rcExclude; 00089 } 00090 00091 ptiCurrent = PtiCurrent(); 00092 ptiOwner = GETPTI(pwndOwner); 00093 00094 /* 00095 * Win95 compatibility: pwndOwner must be owned by ptiCurrent. 00096 */ 00097 if (ptiCurrent != ptiOwner) { 00098 RIPMSG0(RIP_WARNING, "xxxTrackPopupMenuEx: pwndOwner not owned by ptiCurrent"); 00099 return FALSE; 00100 } 00101 00102 UserAssert(pMenu != NULL); 00103 if (ptiCurrent->pMenuState != NULL) { 00104 00105 if (dwFlags & TPM_RECURSE) { 00106 /* 00107 * Only allow recursion if: 00108 * -The current menu mode is not about to exit 00109 * -Both menus notify the same window 00110 * -Only one thread is involved in the current menu mode 00111 * This will prevent us from getting into some random 00112 * scenarios we don't want to deal with 00113 */ 00114 ppopupMenuHierarchy = ptiCurrent->pMenuState->pGlobalPopupMenu; 00115 pwndHierarchy = ppopupMenuHierarchy->spwndNotify; 00116 if (ExitMenuLoop(ptiCurrent->pMenuState, ppopupMenuHierarchy) 00117 || (pwndHierarchy == NULL) 00118 || (pwndHierarchy != pwndOwner) 00119 || (ptiCurrent->pMenuState->ptiMenuStateOwner != GETPTI(pwndHierarchy))) { 00120 00121 RIPMSG0(RIP_WARNING, "xxxTrackPopupMenuEx: Failing TPM_RECURSE request"); 00122 return FALSE; 00123 } 00124 /* 00125 * Terminate any animation 00126 */ 00127 MNAnimate(ptiCurrent->pMenuState, FALSE); 00128 /* 00129 * Cancel pending show timer if any. ie, the app wants to 00130 * pop up a context menu on a popup before we drop it. 00131 */ 00132 ppopupMenuHierarchy = ((ppopupMenuHierarchy->spwndActivePopup != NULL) 00133 ? ((PMENUWND)(ppopupMenuHierarchy->spwndActivePopup))->ppopupmenu 00134 : NULL); 00135 if ((ppopupMenuHierarchy != NULL) && ppopupMenuHierarchy->fShowTimer) { 00136 00137 _KillTimer(ppopupMenuHierarchy->spwndPopupMenu, IDSYS_MNSHOW); 00138 ppopupMenuHierarchy->fShowTimer = FALSE; 00139 } 00140 /* 00141 * If we're currently on a modal menu, let's unlock the capture 00142 * so the recursive menu can get it. 00143 */ 00144 if (!ptiCurrent->pMenuState->fModelessMenu) { 00145 ptiCurrent->pq->QF_flags &= ~QF_CAPTURELOCKED; 00146 } 00147 } else { 00148 /* 00149 * Allow only one guy to have a popup menu up at a time... 00150 */ 00151 RIPERR0(ERROR_POPUP_ALREADY_ACTIVE, RIP_VERBOSE, ""); 00152 return FALSE; 00153 } 00154 } 00155 00156 // Is button down? 00157 00158 if (dwFlags & TPM_RIGHTBUTTON) 00159 { 00160 fButtonDown = (_GetKeyState(VK_RBUTTON) & 0x8000) != 0; 00161 } else { 00162 fButtonDown = (_GetKeyState(VK_LBUTTON) & 0x8000) != 0; 00163 } 00164 00165 /* 00166 * Create the menu window. 00167 */ 00168 pwndHierarchy = xxxCreateWindowEx( 00169 WS_EX_TOOLWINDOW | WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 00170 (PLARGE_STRING)MENUCLASS, 00171 NULL, 00172 WS_POPUP | WS_BORDER, 00173 x, y, 100, 100, 00174 TestMF(pMenu, MNS_MODELESS) ? pwndOwner : NULL, 00175 NULL, (HANDLE)pwndOwner->hModule, 00176 NULL, 00177 WINVER); 00178 00179 if (pwndHierarchy == NULL) { 00180 return FALSE; 00181 } 00182 00183 #ifdef USE_MIRRORING 00184 if (TestWF(pwndOwner, WEFLAYOUTRTL)) 00185 SetWF(pwndHierarchy, WEFLAYOUTRTL); 00186 #endif 00187 00188 // 00189 // Do this so that old apps don't get weird borders on tracked popups due 00190 // to the app hack used in CreateWindowEx32. 00191 // 00192 ClrWF(pwndHierarchy, WFOLDUI); 00193 00194 ThreadLockAlways(pwndHierarchy, &tlpwndHierarchy); 00195 00196 #ifdef HAVE_MN_GETPPOPUPMENU 00197 ppopupMenuHierarchy = (PPOPUPMENU)xxxSendMessage(pwndHierarchy, 00198 MN_GETPPOPUPMENU, 0, 0); 00199 #else 00200 ppopupMenuHierarchy = ((PMENUWND)pwndHierarchy)->ppopupmenu; 00201 #endif 00202 00203 00204 ppopupMenuHierarchy->fDelayedFree = TRUE; 00205 Lock(&(ppopupMenuHierarchy->spwndNotify), pwndOwner); 00206 LockPopupMenu(ppopupMenuHierarchy, &ppopupMenuHierarchy->spmenu, pMenu); 00207 Lock(&(ppopupMenuHierarchy->spwndActivePopup), pwndHierarchy); 00208 ppopupMenuHierarchy->ppopupmenuRoot = ppopupMenuHierarchy; 00209 ppopupMenuHierarchy->fIsTrackPopup = TRUE; 00210 ppopupMenuHierarchy->fFirstClick = fButtonDown; 00211 ppopupMenuHierarchy->fRightButton = ((dwFlags & TPM_RIGHTBUTTON) != 0); 00212 if (SYSMET(MENUDROPALIGNMENT) || TestMF(pMenu, MFRTL)) { 00213 // 00214 // popup's below this one need to follow the same direction as 00215 // the other menu's on the desktop. 00216 // 00217 ppopupMenuHierarchy->fDroppedLeft = TRUE; 00218 } 00219 ppopupMenuHierarchy->fNoNotify = ((dwFlags & TPM_NONOTIFY) != 0); 00220 00221 if (fSync = (dwFlags & TPM_RETURNCMD)) 00222 ppopupMenuHierarchy->fSynchronous = TRUE; 00223 00224 ppopupMenuHierarchy->fIsSysMenu = ((dwFlags & TPM_SYSMENU) != 0); 00225 00226 // Set the GlobalPopupMenu variable so that EndMenu works for popupmenus so 00227 // that WinWart II people can continue to abuse undocumented functions. 00228 // This is nulled out in MNCancel. 00229 /* 00230 * This is actually needed for cleanup in case this thread ends 00231 * execution before we can free the popup. (See xxxDestroyThreadInfo) 00232 * 00233 * Note that one thread might own pwndOwner and another one might call 00234 * TrackPopupMenu (pretty normal if the two threads are attached). So 00235 * properly setting (and initializing) pMenuState is a must here. 00236 */ 00237 pMenuState = xxxMNAllocMenuState(ptiCurrent, ptiOwner, ppopupMenuHierarchy); 00238 if (pMenuState == NULL) { 00239 /* 00240 * Get out. The app never knew we were here so don't notify it 00241 */ 00242 dwFlags |= TPM_NONOTIFY; 00243 goto AbortTrackPopupMenuEx; 00244 } 00245 00246 /* 00247 * Notify the app we are entering menu mode. wParam is 1 since this is a 00248 * TrackPopupMenu. 00249 */ 00250 00251 if (!ppopupMenuHierarchy->fNoNotify) 00252 xxxSendMessage(pwndOwner, WM_ENTERMENULOOP, 00253 (ppopupMenuHierarchy->fIsSysMenu ? FALSE : TRUE), 0); 00254 00255 /* 00256 * Send off the WM_INITMENU, set ourselves up for menu mode etc... 00257 */ 00258 if (!xxxMNStartMenu(ppopupMenuHierarchy, MOUSEHOLD)) { 00259 /* 00260 * ppopupMenuHierarchy has been destroyed already; let's bail 00261 */ 00262 goto AbortTrackPopupMenuEx; 00263 } 00264 00265 /* 00266 * If drag and drop, register the window as a target. 00267 */ 00268 if (pMenuState->fDragAndDrop) { 00269 if (!SUCCEEDED(xxxClientRegisterDragDrop(HW(pwndHierarchy)))) { 00270 RIPMSG0(RIP_ERROR, "xxxTrackPopupMenuEx: xxxClientRegisterDragDrop failed"); 00271 } 00272 } 00273 00274 if (!ppopupMenuHierarchy->fNoNotify) { 00275 ThreadLock(ppopupMenuHierarchy->spwndNotify, &tlpwndT); 00276 xxxSendMessage(ppopupMenuHierarchy->spwndNotify, WM_INITMENUPOPUP, 00277 (WPARAM)PtoHq(pMenu), MAKELONG(0, (ppopupMenuHierarchy->fIsSysMenu ? 1: 0))); 00278 ThreadUnlock(&tlpwndT); 00279 ppopupMenuHierarchy->fSendUninit = TRUE; 00280 } 00281 00282 /* 00283 * Size the menu window if needed... 00284 */ 00285 sizeHierarchy = (LONG)xxxSendMessage(pwndHierarchy, MN_SIZEWINDOW, MNSW_SIZE, 0); 00286 00287 if (!sizeHierarchy) { 00288 00289 AbortTrackPopupMenuEx: 00290 if (FWINABLE()) { 00291 xxxWindowEvent(EVENT_SYSTEM_MENUEND, pwndOwner, OBJID_WINDOW, INDEXID_CONTAINER, 0); 00292 } 00293 /* 00294 * Release the mouse capture we set when we called StartMenuState... 00295 */ 00296 xxxMNReleaseCapture(); 00297 00298 /* Notify the app we have exited menu mode. wParam is 1 for real 00299 * tracked popups, not sys menu. Check wFlags since ppopupHierarchy 00300 * will be gone. 00301 */ 00302 if (!(dwFlags & TPM_NONOTIFY)) 00303 xxxSendMessage(pwndOwner, WM_EXITMENULOOP, ((dwFlags & TPM_SYSMENU) ? 00304 FALSE : TRUE), 0L); 00305 00306 /* 00307 * Make sure we return failure 00308 */ 00309 fSync = TRUE; 00310 cmd = FALSE; 00311 goto CleanupTrackPopupMenuEx; 00312 } 00313 00314 if (glinp.dwFlags & LINP_KEYBOARD) { 00315 pMenuState->fUnderline = TRUE; 00316 SetMF(pMenu, MFUNDERLINE); 00317 } 00318 00319 // 00320 // Setup popup window dimensions 00321 // 00322 cxPopup = LOWORD(sizeHierarchy) + 2*SYSMET(CXFIXEDFRAME); 00323 cyPopup = HIWORD(sizeHierarchy) + 2*SYSMET(CYFIXEDFRAME); 00324 00325 // 00326 // Calculate the monitor BEFORE we adjust the point. Otherwise, we might 00327 // move the point offscreen. In which case, we will end up pinning the 00328 // popup to the primary display, which is wrong. 00329 // 00330 pt.x = x; 00331 pt.y = y; 00332 pMonitor = _MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); 00333 00334 // 00335 // Horizontal alignment 00336 // 00337 #ifdef USE_MIRRORING 00338 if (TestWF(pwndOwner, WEFLAYOUTRTL) && !(dwFlags & TPM_CENTERALIGN)) { 00339 dwFlags = dwFlags ^ TPM_RIGHTALIGN; 00340 } 00341 #endif 00342 if (dwFlags & TPM_RIGHTALIGN) { 00343 #if DBG 00344 if (dwFlags & TPM_CENTERALIGN) { 00345 RIPMSG0(RIP_WARNING, "TrackPopupMenuEx: TPM_CENTERALIGN ignored"); 00346 } 00347 #endif // DBG 00348 00349 x -= cxPopup; 00350 ppopupMenuHierarchy->iDropDir = PAS_LEFT; 00351 } else if (dwFlags & TPM_CENTERALIGN) { 00352 x -= (cxPopup / 2); 00353 } else { 00354 ppopupMenuHierarchy->iDropDir = (ppopupMenuHierarchy->fDroppedLeft ? PAS_LEFT : PAS_RIGHT); 00355 } 00356 00357 // 00358 // Vertical alignment 00359 // 00360 if (dwFlags & TPM_BOTTOMALIGN) { 00361 #if DBG 00362 if (dwFlags & TPM_VCENTERALIGN) { 00363 RIPMSG0(RIP_WARNING, "TrackPopupMenuEx: TPM_VCENTERALIGN ignored"); 00364 } 00365 #endif // DBG 00366 00367 y -= cyPopup; 00368 ppopupMenuHierarchy->iDropDir |= PAS_UP; 00369 } else if (dwFlags & TPM_VCENTERALIGN) { 00370 y -= (cyPopup / 2); 00371 } else { 00372 ppopupMenuHierarchy->iDropDir |= PAS_DOWN; 00373 } 00374 /* 00375 * If the caller provided an animation direction, use that instead 00376 */ 00377 if (dwFlags & TPM_ANIMATIONBITS) { 00378 ppopupMenuHierarchy->iDropDir = ((dwFlags >> TPM_FIRSTANIBITPOS) & (PAS_VERT | PAS_HORZ)); 00379 } 00380 // 00381 // Get coords to move to. 00382 // 00383 sizeHierarchy = FindBestPos( 00384 x, 00385 y, 00386 cxPopup, 00387 cyPopup, 00388 ((lpTpm != NULL) ? &rcExclude : NULL), 00389 dwFlags, 00390 ppopupMenuHierarchy, 00391 pMonitor); 00392 00393 #ifdef USE_MIRRORING 00394 if (TestWF(pwndOwner, WEFLAYOUTRTL) && (ppopupMenuHierarchy->iDropDir & PAS_HORZ)) { 00395 ppopupMenuHierarchy->iDropDir ^= PAS_HORZ; 00396 } 00397 #endif 00398 00399 /* 00400 * If we have an animation direction and the caller wants animation, 00401 * set the bit to get it going. 00402 */ 00403 if ((ppopupMenuHierarchy->iDropDir != 0) && !(dwFlags & TPM_NOANIMATION)) { 00404 ppopupMenuHierarchy->iDropDir |= PAS_OUT; 00405 } 00406 00407 /* 00408 * Show the window. Modeless menus are not topmost and get activated. 00409 * Modal menus are topmost but don't get activated. 00410 */ 00411 PlayEventSound(USER_SOUND_MENUPOPUP); 00412 xxxSetWindowPos(pwndHierarchy, 00413 (pMenuState->fModelessMenu ? PWND_TOP : PWND_TOPMOST), 00414 GET_X_LPARAM(sizeHierarchy), GET_Y_LPARAM(sizeHierarchy), 0, 0, 00415 SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOOWNERZORDER 00416 | (pMenuState->fModelessMenu ? 0 : SWP_NOACTIVATE)); 00417 00418 if (FWINABLE()) { 00419 xxxWindowEvent(EVENT_SYSTEM_MENUPOPUPSTART, pwndHierarchy, OBJID_CLIENT, INDEXID_CONTAINER, 0); 00420 } 00421 // 00422 // We need to return TRUE for compatibility w/ async TrackPopupMenu(). 00423 // It is conceivable that a menu ID could have ID 0, in which case just 00424 // returning the cmd chosen would return FALSE instead of TRUE. 00425 // 00426 00427 // 00428 // If mouse is in client of popup, act like clicked down 00429 // 00430 pMenuState->fButtonDown = fButtonDown; 00431 00432 cmd = xxxMNLoop(ppopupMenuHierarchy, pMenuState, 0, FALSE); 00433 00434 /* 00435 * If this is a modeless menu, return without clenning up because 00436 * the menu is up. 00437 */ 00438 if (pMenuState->fModelessMenu) { 00439 ThreadUnlock(&tlpwndHierarchy); 00440 goto ReturnCmdOrTrue; 00441 } 00442 00443 CleanupTrackPopupMenuEx: 00444 00445 if (ThreadUnlock(&tlpwndHierarchy)) { 00446 if (!TestWF(pwndHierarchy, WFDESTROYED)) { 00447 xxxDestroyWindow(pwndHierarchy); 00448 } 00449 } 00450 00451 if (pMenuState != NULL) { 00452 xxxMNEndMenuState (TRUE); 00453 } 00454 00455 /* 00456 * Capture must be unlocked if no menu is active. 00457 */ 00458 UserAssert(!(ptiCurrent->pq->QF_flags & QF_CAPTURELOCKED) 00459 || ((ptiCurrent->pMenuState != NULL) 00460 && !ptiCurrent->pMenuState->fModelessMenu)); 00461 00462 00463 ReturnCmdOrTrue: 00464 return(fSync ? cmd : TRUE); 00465 }

VOID xxxTrackThumb PWND  ,
UINT  ,
WPARAM  ,
LPARAM  ,
PSBCALC 
 

Definition at line 2061 of file sbctl.c.

References _GetKeyState(), CheckLock, tagSBCALC::cpx, tagSBTRACK::dpxThumb, FALSE, tagSBTRACK::fTrackRecalc, tagSBTRACK::fTrackVert, GET_X_LPARAM, GET_Y_LPARAM, HIBYTE, NULL, PtInRect(), PWNDTOPSBTRACK, tagSBCALC::pxMin, tagSBCALC::pxStart, tagSBTRACK::rcTrack, RecalcTrackRect(), xxxEndScroll(), and xxxMoveThumb().

Referenced by xxxEndScroll(), xxxSBTrackInit(), and xxxSetScrollBar().

02067 { 02068 int px; 02069 PSBTRACK pSBTrack = PWNDTOPSBTRACK(pwnd); 02070 POINT pt; 02071 02072 UNREFERENCED_PARAMETER(wParam); 02073 02074 CheckLock(pwnd); 02075 02076 if (HIBYTE(message) != HIBYTE(WM_MOUSEFIRST)) 02077 return; 02078 02079 if (pSBTrack == NULL) 02080 return; 02081 02082 // Make sure that the SBINFO structure contains data for the 02083 // window being tracked -- if not, recalculate data in SBINFO 02084 // CheckScrollRecalc(pwnd, pSBState, pSBCalc); 02085 if (pSBTrack->fTrackRecalc) { 02086 RecalcTrackRect(pSBTrack); 02087 pSBTrack->fTrackRecalc = FALSE; 02088 } 02089 02090 02091 pt.y = GET_Y_LPARAM(lParam); 02092 pt.x = GET_X_LPARAM(lParam); 02093 if (!PtInRect(&pSBTrack->rcTrack, pt)) 02094 px = pSBCalc->pxStart; 02095 else { 02096 px = (pSBTrack->fTrackVert ? pt.y : pt.x) + pSBTrack->dpxThumb; 02097 if (px < pSBCalc->pxMin) 02098 px = pSBCalc->pxMin; 02099 else if (px >= pSBCalc->pxMin + pSBCalc->cpx) 02100 px = pSBCalc->pxMin + pSBCalc->cpx; 02101 } 02102 02103 xxxMoveThumb(pwnd, pSBCalc, px); 02104 02105 /* 02106 * We won't get the WM_LBUTTONUP message if we got here through 02107 * the scroll menu, so test the button state directly. 02108 */ 02109 if (message == WM_LBUTTONUP || _GetKeyState(VK_LBUTTON) >= 0) { 02110 xxxEndScroll(pwnd, FALSE); 02111 } 02112 02113 }

int xxxTranslateAccelerator PWND  pwnd,
LPACCELTABLE  pat,
LPMSG  lpMsg
 

Definition at line 251 of file mnaccel.c.

References _GetKeyState(), tagACCELTABLE::accel, BOOL, CheckLock, DWORD, FALSE, FLASTKEY, gfInNumpadHexInput, tagWND::head, ID_SYSMENU, NULL, NUMPAD_HEXMODE_HL, PtiCurrent, tagWND::spmenu, tagWND::spmenuSys, SystoChar(), TA_DISABLED, TestWF, ThreadLock, ThreadUnlock, TRUE, UINT, WFCHILD, WFDISABLED, WFICONIC, WFSYSMENU, xxxLoadSysDesktopMenu(), xxxSendMessage(), xxxSetSysMenu(), and xxxTA_AccelerateMenu().

Referenced by NtUserTranslateAccelerator().

00255 { 00256 UINT cmd; 00257 BOOL fVirt; 00258 PMENU pMenu; 00259 BOOL fFound; 00260 UINT flags; 00261 UINT keystate; 00262 UINT message; 00263 UINT rgfItem; 00264 BOOL fDisabled; 00265 BOOL fSystemMenu; 00266 LPACCEL paccel; 00267 TL tlpMenu; 00268 int vkAlt, vkCtrl; 00269 HMENU hmenuInit = NULL; 00270 00271 CheckLock(pwnd); 00272 CheckLock(pat); 00273 00274 if (gfInNumpadHexInput & NUMPAD_HEXMODE_HL) { 00275 return FALSE; 00276 } 00277 00278 paccel = pat->accel; 00279 00280 fFound = FALSE; 00281 00282 message = SystoChar(lpMsg->message, lpMsg->lParam); 00283 00284 switch (message) { 00285 case WM_KEYDOWN: 00286 case WM_SYSKEYDOWN: 00287 fVirt = TRUE; 00288 break; 00289 00290 case WM_CHAR: 00291 case WM_SYSCHAR: 00292 fVirt = FALSE; 00293 break; 00294 00295 default: 00296 return FALSE; 00297 } 00298 00299 /* 00300 * Many kbd layouts use the r.h. Alt key like a shift key to generate some 00301 * additional chars: this r.h. Alt (or "AltGr") key synthesizes a left Ctrl 00302 * (for backward compatibility with 84-key kbds), so when the AltGr key is 00303 * down neither the left Ctrl nor the right Alt should be counted as part 00304 * of the keystate. 00305 * Note: Don't expect spklActive == NULL (winlogon should have loaded kbd 00306 * layouts already), but test it anyway to be robust. #99321) 00307 */ 00308 keystate = 0; 00309 UserAssert(PtiCurrent()->spklActive != NULL); // #99321 00310 if (PtiCurrent()->spklActive && 00311 (PtiCurrent()->spklActive->spkf->pKbdTbl->fLocaleFlags & KLLF_ALTGR) && 00312 (_GetKeyState(VK_RMENU) & 0x8000)) { 00313 /* 00314 * count only right hand Ctrl as a Ctrl keystate 00315 * count only left hand Alt as a Alt keystate 00316 */ 00317 vkCtrl = VK_RCONTROL; 00318 vkAlt = VK_LMENU; 00319 } else { 00320 /* 00321 * count left or right hand Ctrl as a Ctrl keystate 00322 * count left or right hand Alt as a Alt keystate 00323 */ 00324 vkAlt = VK_MENU; 00325 vkCtrl = VK_CONTROL; 00326 } 00327 00328 if (_GetKeyState(vkCtrl) & 0x8000) { 00329 keystate |= FCONTROL; 00330 } 00331 if (_GetKeyState(vkAlt) & 0x8000) { 00332 keystate |= FALT; 00333 } 00334 if (_GetKeyState(VK_SHIFT) & 0x8000) { 00335 keystate |= FSHIFT; 00336 } 00337 00338 do 00339 { 00340 flags = paccel->fVirt; 00341 if ( (DWORD)paccel->key != lpMsg->wParam || 00342 ((fVirt != 0) != ((flags & FVIRTKEY) != 0))) { 00343 goto Next; 00344 } 00345 00346 if (fVirt && ((keystate & (FSHIFT | FCONTROL)) != (flags & (FSHIFT | FCONTROL)))) { 00347 goto Next; 00348 } 00349 00350 if ((keystate & FALT) != (flags & FALT)) { 00351 goto Next; 00352 } 00353 00354 fFound = TRUE; 00355 fSystemMenu = 0; 00356 rgfItem = 0; 00357 00358 cmd = paccel->cmd; 00359 if (cmd != 0) { 00360 00361 /* 00362 * The order of these next two if's is important for default 00363 * situations. Also, just check accelerators in the system 00364 * menu of child windows passed to TranslateAccelerator. 00365 */ 00366 pMenu = pwnd->spmenu; 00367 rgfItem = 0; 00368 00369 if (!TestWF(pwnd, WFCHILD)) { 00370 ThreadLock(pMenu, &tlpMenu); 00371 rgfItem = xxxTA_AccelerateMenu(pwnd, pMenu, cmd, &hmenuInit); 00372 ThreadUnlock(&tlpMenu); 00373 } 00374 00375 if (TestWF(pwnd, WFCHILD) || rgfItem == 0) { 00376 UserAssert(hmenuInit == NULL); 00377 pMenu = pwnd->spmenuSys; 00378 if (pMenu == NULL && TestWF(pwnd, WFSYSMENU)) { 00379 00380 /* 00381 * Change owner so this app can access this menu. 00382 */ 00383 pMenu = pwnd->head.rpdesk->spmenuSys; 00384 if (pMenu == NULL) { 00385 pMenu = xxxLoadSysDesktopMenu (&pwnd->head.rpdesk->spmenuSys, ID_SYSMENU); 00386 } 00387 ThreadLock(pMenu, &tlpMenu); 00388 /* 00389 * Must reset the system menu for this window. 00390 */ 00391 xxxSetSysMenu(pwnd); 00392 } else { 00393 ThreadLock(pMenu, &tlpMenu); 00394 } 00395 00396 if ((rgfItem = xxxTA_AccelerateMenu(pwnd, pMenu, cmd, &hmenuInit)) != 0) { 00397 fSystemMenu = TRUE; 00398 } 00399 ThreadUnlock(&tlpMenu); 00400 } 00401 } 00402 00403 fDisabled = TestWF(pwnd, WFDISABLED); 00404 00405 /* 00406 * Send only if: 1. The Item is not disabled, AND 00407 * 2. The Window's not being captured AND 00408 * 3. The Window's not minimzed, OR 00409 * 4. The Window's minimized but the Item is in 00410 * the System Menu. 00411 */ 00412 if (!(rgfItem & TA_DISABLED) && 00413 !(rgfItem && TestWF(pwnd, WFICONIC) && !fSystemMenu)) { 00414 if (!(rgfItem != 0 && (PtiCurrent()->pq->spwndCapture != NULL || 00415 fDisabled))) { 00416 00417 if (fSystemMenu) { 00418 xxxSendMessage(pwnd, WM_SYSCOMMAND, cmd, 0x00010000L); 00419 } else { 00420 xxxSendMessage(pwnd, WM_COMMAND, MAKELONG(cmd, 1), 0); 00421 } 00422 00423 /* 00424 * Get outta here 00425 */ 00426 flags = FLASTKEY; 00427 } 00428 } 00429 00430 /* 00431 * Send matching WM_UNINITMENUPOPUP if needed 00432 */ 00433 if (hmenuInit != NULL) { 00434 xxxSendMessage(pwnd, WM_UNINITMENUPOPUP, (WPARAM)hmenuInit, 0); 00435 hmenuInit = NULL; 00436 } 00437 00438 Next: 00439 paccel++; 00440 00441 } while (!(flags & FLASTKEY) && !fFound); 00442 00443 00444 return fFound; 00445 }

BOOL xxxTranslateMessage LPMSG  pmsg,
UINT  flags
 

Definition at line 28 of file keyconv.c.

References _PostMessage(), tagQ::afKeyState, BOOL, DWORD, FALSE, HW, NULL, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagTHREADINFO::pq, PtiCurrent, tagPOPUPMENU::spwndPopupMenu, TRUE, UINT, ValidateHwnd, and xxxInternalToUnicode().

Referenced by NtUserTranslateMessage(), xxxHandleMenuMessages(), xxxHelpLoop(), xxxMNLoop(), xxxMoveSize(), xxxOldNextWindow(), and xxxSBTrackLoop().

00031 { 00032 PTHREADINFO pti; 00033 UINT wMsgType; 00034 int cChar; 00035 BOOL fSysKey = FALSE; 00036 DWORD dwKeyFlags; 00037 LPARAM lParam; 00038 UINT uVirKey; 00039 PWND pwnd; 00040 WCHAR awch[16]; 00041 WCHAR *pwch; 00042 00043 switch (pmsg->message) { 00044 00045 default: 00046 return FALSE; 00047 00048 case WM_SYSKEYDOWN: 00049 /* 00050 * HACK carried over from Win3 code: system messages 00051 * only get posted during KEYDOWN processing - so 00052 * set fSysKey only for WM_SYSKEYDOWN. 00053 */ 00054 fSysKey = TRUE; 00055 /* 00056 * Fall thru... 00057 */ 00058 00059 case WM_SYSKEYUP: 00060 case WM_KEYDOWN: 00061 case WM_KEYUP: 00062 pti = PtiCurrent(); 00063 00064 if ((pti->pMenuState != NULL) && 00065 (HW(pti->pMenuState->pGlobalPopupMenu->spwndPopupMenu) == 00066 pmsg->hwnd)) { 00067 uiTMFlags |= TM_INMENUMODE; 00068 } else { 00069 uiTMFlags &= ~TM_INMENUMODE; 00070 } 00071 00072 /* 00073 * Don't change the contents of the passed in structure. 00074 */ 00075 lParam = pmsg->lParam; 00076 00077 /* 00078 * For backward compatibility, mask the virtual key value. 00079 */ 00080 uVirKey = LOWORD(pmsg->wParam); 00081 00082 cChar = xxxInternalToUnicode(uVirKey, // virtual key code 00083 HIWORD(lParam), // scan code, make/break bit 00084 pti->pq->afKeyState, 00085 awch, sizeof(awch)/sizeof(awch[0]), 00086 uiTMFlags, &dwKeyFlags, NULL); 00087 lParam |= (dwKeyFlags & ALTNUMPAD_BIT); 00088 00089 /* 00090 * LATER 12/7/90 - GregoryW 00091 * Note: Win3.x TranslateMessage returns TRUE if ToAscii is called. 00092 * Proper behavior is to return TRUE if any translation is 00093 * performed by ToAscii. If we have to remain compatible 00094 * (even though apps clearly don't currently care about the 00095 * return value) then the following return should be changed 00096 * to TRUE. If we want the new 32-bit apps to have a meaningful 00097 * return value we should leave this as FALSE. 00098 * 00099 * If console is calling us with the TM_POSTCHARBREAKS flag then we 00100 * return FALSE if no char was actually posted 00101 * 00102 * !!! LATER get console to change so it does not need private API 00103 * TranslateMessageEx 00104 */ 00105 00106 if (!cChar) { 00107 if (uiTMFlags & TM_POSTCHARBREAKS) 00108 return FALSE; 00109 else 00110 return TRUE; 00111 } 00112 00113 /* 00114 * Some translation performed. Figure out what type of 00115 * message to post. 00116 * 00117 */ 00118 if (cChar > 0) 00119 wMsgType = (fSysKey) ? (UINT)WM_SYSCHAR : (UINT)WM_CHAR; 00120 else { 00121 wMsgType = (fSysKey) ? (UINT)WM_SYSDEADCHAR : (UINT)WM_DEADCHAR; 00122 cChar = -cChar; // want positive value 00123 } 00124 00125 if (dwKeyFlags & KBDBREAK) { 00126 lParam |= 0x80000000; 00127 } else { 00128 lParam &= ~0x80000000; 00129 } 00130 00131 /* 00132 * Since xxxInternalToUnicode can leave the crit sect, we need to 00133 * validate the message hwnd here. 00134 */ 00135 pwnd = ValidateHwnd(pmsg->hwnd); 00136 if (!pwnd) { 00137 return FALSE; 00138 } 00139 00140 for (pwch = awch; cChar > 0; cChar--) { 00141 00142 /* 00143 * If this is a multi-character posting, all but the last one 00144 * should be marked as fake keystrokes for Console/VDM. 00145 */ 00146 _PostMessage(pwnd, wMsgType, (WPARAM)*pwch, 00147 lParam | (cChar > 1 ? FAKE_KEYSTROKE : 0)); 00148 00149 *pwch = 0; // zero out old character (why?) 00150 pwch += 1; 00151 } 00152 00153 return TRUE; 00154 } 00155 }

BOOL xxxUnloadKeyboardLayout PWINDOWSTATION  ,
HKL 
 

Definition at line 1451 of file kbdlyout.c.

References BOOL, FALSE, HKLtoPKL(), NULL, PtiCurrent, and xxxInternalUnloadKeyboardLayout().

Referenced by NtUserUnloadKeyboardLayout().

01454 { 01455 PKL pkl; 01456 01457 /* 01458 * Validate HKL and check to make sure an app isn't attempting to unload a system 01459 * preloaded layout. 01460 */ 01461 pkl = HKLtoPKL(PtiCurrent(), hkl); 01462 if (pkl == NULL) { 01463 return FALSE; 01464 } 01465 01466 return xxxInternalUnloadKeyboardLayout(pwinsta, pkl, 0); 01467 }

BOOL xxxUnlockMenuState PMENUSTATE  pMenuState  ) 
 

Definition at line 441 of file mnstate.c.

References BOOL, tagMENUSTATE::dwLockCount, ExitMenuLoop(), FALSE, tagMENUSTATE::pGlobalPopupMenu, TRUE, and xxxMNEndMenuState().

Referenced by xxxMenuWindowProc(), xxxMNDragLeave(), and xxxMNDragOver().

00442 { 00443 UserAssert(pMenuState->dwLockCount != 0); 00444 (pMenuState->dwLockCount)--; 00445 if ((pMenuState->dwLockCount == 0) && ExitMenuLoop(pMenuState, pMenuState->pGlobalPopupMenu)) { 00446 xxxMNEndMenuState(TRUE); 00447 return TRUE; 00448 } 00449 return FALSE; 00450 }

VOID xxxUpdateClientRect PWND  pwnd  ) 
 

Definition at line 194 of file calcclrc.c.

References CopyRect, FALSE, tagWND::rcClient, tagWND::rcWindow, and xxxCalcClientRect().

00196 { 00197 RECT rc; 00198 00199 CopyRect(&rc, &pwnd->rcWindow); 00200 xxxCalcClientRect(pwnd, &rc, FALSE); 00201 CopyRect(&pwnd->rcClient, &rc); 00202 }

VOID xxxUpdatePerUserAccessPackSettings PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 2314 of file ntuser/kernel/access.c.

References AccessTimeOutReset(), ACCF_DEFAULTFILTERKEYSON, ACCF_DEFAULTHIGHCONTRASTON, ACCF_DEFAULTKEYBOARDPREF, ACCF_DEFAULTMOUSEKEYSON, ACCF_DEFAULTSCREENREADER, ACCF_DEFAULTSTICKYKEYSON, ACCF_DEFAULTTIMEOUTON, ACCF_DEFAULTTOGGLEKEYSON, ACCF_KEYBOARDPREF, ACCF_SCREENREADER, ACCF_SHOWSOUNDSON, BOOL, CalculateMouseTable(), CLEAR_ACCESSFLAG, CLEAR_ACCF, cMouseVKeys, DWORD, FALSE, FastGetProfileIntW(), FastGetProfileStringW(), FilterKeys(), gAccessTimeOut, gbMKMouseMode, GetProcessLuid(), gFilterKeys, gHighContrast, gHighContrastDefaultScheme, gMouseKeys, gNumLockVk, gOemScrollVk, gpKbdNlsTbl, gpsi, gpusMouseVKey, gSoundSentry, gStickyKeys, gToggleKeys, luidSystem, MKHideMouseCursor(), MKShowMouseCursor(), MouseKeys(), NTSTATUS(), NULL, PMAP_HIGHCONTRAST, PMAP_KEYBOARDPREF, PMAP_KEYBOARDRESPONSE, PMAP_MOUSEKEYS, PMAP_SCREENREADER, PMAP_SHOWSOUNDS, PMAP_SOUNDSENTRY, PMAP_STICKYKEYS, PMAP_TIMEOUT, PMAP_TOGGLEKEYS, RtlEqualLuid(), SET_ACCESSFLAG, SET_ACCF, SET_OR_CLEAR_ACCESSFLAG, SET_OR_CLEAR_ACCF, SET_OR_CLEAR_FLAG, SetAccessEnabledFlag(), TEST_ACCESSFLAG, TEST_BOOL_ACCESSFLAG, TEST_BOOL_ACCF, TestAsyncKeyStateToggle, ToggleKeys(), TRUE, and xxxTurnOffStickyKeys().

Referenced by xxxUpdatePerUserSystemParameters().

02315 { 02316 LUID luidCaller; 02317 NTSTATUS status; 02318 BOOL fSystem = FALSE; 02319 BOOL fRegFilterKeysOn; 02320 BOOL fRegStickyKeysOn; 02321 BOOL fRegMouseKeysOn; 02322 BOOL fRegToggleKeysOn; 02323 BOOL fRegTimeOutOn; 02324 BOOL fRegKeyboardPref; 02325 BOOL fRegScreenReader; 02326 BOOL fRegHighContrastOn; 02327 DWORD dwDefFlags; 02328 UNICODE_STRING usHighContrastScheme; 02329 WCHAR wcHighContrastScheme[MAX_SCHEME_NAME_SIZE]; 02330 02331 status = GetProcessLuid(NULL, &luidCaller); 02332 // 02333 // If we're called in the system context no one is logged on. 02334 // We want to read the current .DEFAULT settings for the access 02335 // features. Later when we're called in the user context (e.g., 02336 // someone has successfully logged on) we check to see if the 02337 // current access state is the same as the default setting. If 02338 // not, the user has enabled/disabled one or more access features 02339 // from the keyboard. These changes will be propagated across 02340 // the logon into the user's intial state (overriding the settings 02341 // in the user's profile). 02342 // 02343 if (RtlEqualLuid(&luidCaller, &luidSystem)) { 02344 fSystem = TRUE; 02345 } 02346 02347 02348 02349 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02350 PMAP_KEYBOARDRESPONSE, 02351 TEXT("Flags"), 02352 0 02353 ); 02354 fRegFilterKeysOn = (dwDefFlags & FKF_FILTERKEYSON) != 0; 02355 02356 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02357 PMAP_STICKYKEYS, 02358 TEXT("Flags"), 02359 0 02360 ); 02361 fRegStickyKeysOn = (dwDefFlags & SKF_STICKYKEYSON) != 0; 02362 02363 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02364 PMAP_MOUSEKEYS, 02365 TEXT("Flags"), 02366 0 02367 ); 02368 fRegMouseKeysOn = (dwDefFlags & MKF_MOUSEKEYSON) != 0; 02369 02370 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02371 PMAP_TOGGLEKEYS, 02372 TEXT("Flags"), 02373 0 02374 ); 02375 fRegToggleKeysOn = (dwDefFlags & TKF_TOGGLEKEYSON) != 0; 02376 02377 fRegKeyboardPref = !!FastGetProfileIntW(pProfileUserName, 02378 PMAP_KEYBOARDPREF, 02379 TEXT("On"), 02380 0 02381 ); 02382 02383 fRegScreenReader = !!FastGetProfileIntW(pProfileUserName, 02384 PMAP_SCREENREADER, 02385 TEXT("On"), 02386 0 02387 ); 02388 02389 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02390 PMAP_TIMEOUT, 02391 TEXT("Flags"), 02392 0 02393 ); 02394 fRegTimeOutOn = (dwDefFlags & ATF_TIMEOUTON) != 0; 02395 02396 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02397 PMAP_HIGHCONTRAST, 02398 TEXT("Flags"), 02399 0 02400 ); 02401 fRegHighContrastOn = (dwDefFlags & HCF_HIGHCONTRASTON) != 0; 02402 02403 if (fSystem) { 02404 // 02405 // We're in system mode (e.g., no one is logged in). Remember 02406 // the .DEFAULT state for comparison during the next user logon 02407 // and set the current state to the .DEFAULT state. 02408 // 02409 if (fRegFilterKeysOn) { 02410 SET_ACCF(ACCF_DEFAULTFILTERKEYSON); 02411 SET_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON); 02412 } else { 02413 CLEAR_ACCF(ACCF_DEFAULTFILTERKEYSON); 02414 CLEAR_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON); 02415 } 02416 02417 // 02418 // If StickyKeys is currently on and we're about to turn it 02419 // off we need to make sure the latch keys and lock keys are 02420 // released. 02421 // 02422 if (TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) && (fRegFilterKeysOn == 0)) { 02423 xxxTurnOffStickyKeys(); 02424 } 02425 02426 if (fRegStickyKeysOn) { 02427 SET_ACCF(ACCF_DEFAULTSTICKYKEYSON); 02428 SET_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON); 02429 } else { 02430 CLEAR_ACCF(ACCF_DEFAULTSTICKYKEYSON); 02431 CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON); 02432 } 02433 02434 if (fRegMouseKeysOn) { 02435 SET_ACCF(ACCF_DEFAULTMOUSEKEYSON); 02436 SET_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON); 02437 } else { 02438 CLEAR_ACCF(ACCF_DEFAULTMOUSEKEYSON); 02439 CLEAR_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON); 02440 } 02441 02442 if (fRegToggleKeysOn) { 02443 SET_ACCF(ACCF_DEFAULTTOGGLEKEYSON); 02444 SET_ACCESSFLAG(ToggleKeys, TKF_TOGGLEKEYSON); 02445 } else { 02446 CLEAR_ACCF(ACCF_DEFAULTTOGGLEKEYSON); 02447 CLEAR_ACCESSFLAG(ToggleKeys, TKF_TOGGLEKEYSON); 02448 } 02449 02450 if (fRegTimeOutOn) { 02451 SET_ACCF(ACCF_DEFAULTTIMEOUTON); 02452 SET_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON); 02453 } else { 02454 CLEAR_ACCF(ACCF_DEFAULTTIMEOUTON); 02455 CLEAR_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON); 02456 } 02457 02458 if (fRegKeyboardPref) { 02459 SET_ACCF(ACCF_DEFAULTKEYBOARDPREF); 02460 SET_ACCF(ACCF_KEYBOARDPREF); 02461 gpsi->bKeyboardPref = TRUE; 02462 } else { 02463 CLEAR_ACCF(ACCF_DEFAULTKEYBOARDPREF); 02464 CLEAR_ACCF(ACCF_KEYBOARDPREF); 02465 gpsi->bKeyboardPref = FALSE; 02466 } 02467 02468 if (fRegScreenReader) { 02469 SET_ACCF(ACCF_DEFAULTSCREENREADER); 02470 SET_ACCF(ACCF_SCREENREADER); 02471 } else { 02472 CLEAR_ACCF(ACCF_DEFAULTSCREENREADER); 02473 CLEAR_ACCF(ACCF_SCREENREADER); 02474 } 02475 02476 if (fRegHighContrastOn) { 02477 SET_ACCF(ACCF_DEFAULTHIGHCONTRASTON); 02478 SET_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON); 02479 } else { 02480 CLEAR_ACCF(ACCF_DEFAULTHIGHCONTRASTON); 02481 CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON); 02482 } 02483 } else { 02484 // 02485 // A user has successfully logged on. If the current state is 02486 // different from the default state stored earlier then we know 02487 // the user has modified the state via the keyboard (at the logon 02488 // dialog). This state will override whatever on/off state the 02489 // user has set in their profile. If the current state is the 02490 // same as the default state then the on/off setting from the 02491 // user profile is used. 02492 // 02493 02494 if ( TEST_BOOL_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON) == 02495 TEST_BOOL_ACCF(ACCF_DEFAULTFILTERKEYSON)) { 02496 // 02497 // Current state and default state are the same. Use the 02498 // user's profile setting. 02499 // 02500 02501 SET_OR_CLEAR_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON, fRegFilterKeysOn); 02502 } 02503 02504 if ( TEST_BOOL_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) == 02505 TEST_BOOL_ACCF(ACCF_DEFAULTSTICKYKEYSON)) { 02506 // 02507 // If StickyKeys is currently on and we're about to turn it 02508 // off we need to make sure the latch keys and lock keys are 02509 // released. 02510 // 02511 if ( TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) && 02512 (fRegStickyKeysOn == 0)) { 02513 02514 xxxTurnOffStickyKeys(); 02515 } 02516 02517 SET_OR_CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON, fRegStickyKeysOn); 02518 } 02519 02520 if ( TEST_BOOL_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON) == 02521 TEST_BOOL_ACCF(ACCF_DEFAULTMOUSEKEYSON)) { 02522 // 02523 // Current state and default state are the same. Use the user's 02524 // profile setting. 02525 // 02526 SET_OR_CLEAR_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON, fRegMouseKeysOn); 02527 } 02528 02529 if ( TEST_BOOL_ACCESSFLAG(ToggleKeys, TKF_TOGGLEKEYSON) == 02530 TEST_BOOL_ACCF(ACCF_DEFAULTTOGGLEKEYSON)) { 02531 // 02532 // Current state and default state are the same. Use the user's 02533 // profile setting. 02534 // 02535 SET_OR_CLEAR_ACCESSFLAG(ToggleKeys, TKF_TOGGLEKEYSON, fRegToggleKeysOn); 02536 } 02537 02538 if ( TEST_BOOL_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON) == 02539 TEST_BOOL_ACCF(ACCF_DEFAULTTIMEOUTON)) { 02540 // 02541 // Current state and default state are the same. Use the user's 02542 // profile setting. 02543 // 02544 SET_OR_CLEAR_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON, fRegTimeOutOn); 02545 } 02546 02547 if ( TEST_BOOL_ACCF(ACCF_KEYBOARDPREF) == 02548 TEST_BOOL_ACCF(ACCF_DEFAULTKEYBOARDPREF)) { 02549 // 02550 // Current state and default state are the same. Use the user's 02551 // profile setting. 02552 // 02553 SET_OR_CLEAR_ACCF(ACCF_KEYBOARDPREF, fRegKeyboardPref); 02554 } 02555 02556 if ( TEST_BOOL_ACCF(ACCF_SCREENREADER) == 02557 TEST_BOOL_ACCF(ACCF_DEFAULTSCREENREADER)) { 02558 // 02559 // Current state and default state are the same. Use the user's 02560 // profile setting. 02561 // 02562 SET_OR_CLEAR_ACCF(ACCF_SCREENREADER, fRegScreenReader); 02563 } 02564 02565 if ( TEST_BOOL_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON) == 02566 TEST_BOOL_ACCF(ACCF_DEFAULTHIGHCONTRASTON)) { 02567 // 02568 // Current state and default state are the same. Use the user's 02569 // profile setting. 02570 // 02571 SET_OR_CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON, fRegHighContrastOn); 02572 } 02573 } 02574 02575 // 02576 // Get the default FilterKeys state. 02577 // 02578 // -------- flag --------------- value --------- default ------ 02579 // #define FKF_FILTERKEYSON 0x00000001 0 02580 // #define FKF_AVAILABLE 0x00000002 2 02581 // #define FKF_HOTKEYACTIVE 0x00000004 0 02582 // #define FKF_CONFIRMHOTKEY 0x00000008 0 02583 // #define FKF_HOTKEYSOUND 0x00000010 10 02584 // #define FKF_INDICATOR 0x00000020 0 02585 // #define FKF_CLICKON 0x00000040 40 02586 // ----------------------------------------- total = 0x52 = 82 02587 // 02588 02589 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02590 PMAP_KEYBOARDRESPONSE, 02591 TEXT("Flags"), 02592 82 02593 ); 02594 02595 SET_OR_CLEAR_FLAG( 02596 dwDefFlags, 02597 FKF_FILTERKEYSON, 02598 TEST_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON)); 02599 02600 gFilterKeys.dwFlags = dwDefFlags; 02601 gFilterKeys.iWaitMSec = FastGetProfileIntW(pProfileUserName, 02602 PMAP_KEYBOARDRESPONSE, 02603 TEXT("DelayBeforeAcceptance"), 02604 1000 02605 ); 02606 02607 gFilterKeys.iRepeatMSec = FastGetProfileIntW(pProfileUserName, 02608 PMAP_KEYBOARDRESPONSE, 02609 TEXT("AutoRepeatRate"), 02610 500 02611 ); 02612 02613 gFilterKeys.iDelayMSec = FastGetProfileIntW(pProfileUserName, 02614 PMAP_KEYBOARDRESPONSE, 02615 TEXT("AutoRepeatDelay"), 02616 1000 02617 ); 02618 02619 gFilterKeys.iBounceMSec = FastGetProfileIntW(pProfileUserName, 02620 PMAP_KEYBOARDRESPONSE, 02621 TEXT("BounceTime"), 02622 0 02623 ); 02624 02625 // 02626 // Fill in the SoundSentry state. This release of the 02627 // accessibility features only supports iWindowsEffect. 02628 // 02629 // -------- flag --------------- value --------- default ------ 02630 // #define SSF_SOUNDSENTRYON 0x00000001 0 02631 // #define SSF_AVAILABLE 0x00000002 1 02632 // #define SSF_INDICATOR 0x00000004 0 02633 // ----------------------------------------- total = 0x2 = 2 02634 // 02635 gSoundSentry.dwFlags = FastGetProfileIntW(pProfileUserName, 02636 PMAP_SOUNDSENTRY, 02637 TEXT("Flags"), 02638 2 02639 ); 02640 02641 gSoundSentry.iFSTextEffect = FastGetProfileIntW(pProfileUserName, 02642 PMAP_SOUNDSENTRY, 02643 TEXT("FSTextEffect"), 02644 0 02645 ); 02646 02647 gSoundSentry.iWindowsEffect = FastGetProfileIntW(pProfileUserName, 02648 PMAP_SOUNDSENTRY, 02649 TEXT("WindowsEffect"), 02650 0 02651 ); 02652 02653 /* 02654 * Set ShowSounds flag. 02655 */ 02656 SET_OR_CLEAR_ACCF(ACCF_SHOWSOUNDSON, FastGetProfileIntW(pProfileUserName, 02657 PMAP_SHOWSOUNDS, 02658 TEXT("On"), 02659 0 02660 )); 02661 02662 // 02663 // Get the default StickyKeys state. 02664 // 02665 // -------- flag --------------- value --------- default ------ 02666 // #define SKF_STICKYKEYSON 0x00000001 0 02667 // #define SKF_AVAILABLE 0x00000002 2 02668 // #define SKF_HOTKEYACTIVE 0x00000004 0 02669 // #define SKF_CONFIRMHOTKEY 0x00000008 0 02670 // #define SKF_HOTKEYSOUND 0x00000010 10 02671 // #define SKF_INDICATOR 0x00000020 0 02672 // #define SKF_AUDIBLEFEEDBACK 0x00000040 40 02673 // #define SKF_TRISTATE 0x00000080 80 02674 // #define SKF_TWOKEYSOFF 0x00000100 100 02675 // ----------------------------------------- total = 0x1d2 = 466 02676 // 02677 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02678 PMAP_STICKYKEYS, 02679 TEXT("Flags"), 02680 466 02681 ); 02682 02683 SET_OR_CLEAR_FLAG( 02684 dwDefFlags, 02685 SKF_STICKYKEYSON, 02686 TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON)); 02687 02688 gStickyKeys.dwFlags = dwDefFlags; 02689 02690 // 02691 // Get the default MouseKeys state. 02692 // 02693 // -------- flag --------------- value --------- default ------ 02694 // #define MKF_MOUSEKEYSON 0x00000001 0 02695 // #define MKF_AVAILABLE 0x00000002 2 02696 // #define MKF_HOTKEYACTIVE 0x00000004 0 02697 // #define MKF_CONFIRMHOTKEY 0x00000008 0 02698 // #define MKF_HOTKEYSOUND 0x00000010 10 02699 // #define MKF_INDICATOR 0x00000020 0 02700 // #define MKF_MODIFIERS 0x00000040 0 02701 // #define MKF_REPLACENUMBERS 0x00000080 0 02702 // ----------------------------------------- total = 0x12 = 18 02703 // 02704 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02705 PMAP_MOUSEKEYS, 02706 TEXT("Flags"), 02707 18 02708 ); 02709 02710 SET_OR_CLEAR_FLAG( 02711 dwDefFlags, 02712 MKF_MOUSEKEYSON, 02713 TEST_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON)); 02714 02715 gMouseKeys.dwFlags = dwDefFlags; 02716 gMouseKeys.iMaxSpeed = FastGetProfileIntW(pProfileUserName, 02717 PMAP_MOUSEKEYS, 02718 TEXT("MaximumSpeed"), 02719 40 02720 ); 02721 02722 gMouseKeys.iTimeToMaxSpeed = FastGetProfileIntW(pProfileUserName, 02723 PMAP_MOUSEKEYS, 02724 TEXT("TimeToMaximumSpeed"), 02725 3000 02726 ); 02727 CalculateMouseTable(); 02728 02729 gbMKMouseMode = 02730 #ifdef FE_SB 02731 (TestAsyncKeyStateToggle(gNumLockVk) != 0) ^ 02732 #else // FE_SB 02733 (TestAsyncKeyStateToggle(VK_NUMLOCK) != 0) ^ 02734 #endif // FE_SB 02735 (TEST_ACCESSFLAG(MouseKeys, MKF_REPLACENUMBERS) != 0); 02736 02737 // 02738 // If the system does not have a hardware mouse: 02739 // If MouseKeys is enabled show the mouse cursor, 02740 // o.w. hide the mouse cursor. 02741 // 02742 if (TEST_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON)) { 02743 MKShowMouseCursor(); 02744 } else { 02745 MKHideMouseCursor(); 02746 } 02747 02748 // 02749 // Get the default ToggleKeys state. 02750 // 02751 // -------- flag --------------- value --------- default ------ 02752 // #define TKF_TOGGLEKEYSON 0x00000001 0 02753 // #define TKF_AVAILABLE 0x00000002 2 02754 // #define TKF_HOTKEYACTIVE 0x00000004 0 02755 // #define TKF_CONFIRMHOTKEY 0x00000008 0 02756 // #define TKF_HOTKEYSOUND 0x00000010 10 02757 // #define TKF_INDICATOR 0x00000020 0 02758 // ----------------------------------------- total = 0x12 = 18 02759 // 02760 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02761 PMAP_TOGGLEKEYS, 02762 TEXT("Flags"), 02763 18 02764 ); 02765 02766 SET_OR_CLEAR_FLAG( 02767 dwDefFlags, 02768 TKF_TOGGLEKEYSON, 02769 TEST_ACCESSFLAG(ToggleKeys, TKF_TOGGLEKEYSON)); 02770 02771 gToggleKeys.dwFlags = dwDefFlags; 02772 02773 // 02774 // Get the default Timeout state. 02775 // 02776 // -------- flag --------------- value --------- default ------ 02777 // #define ATF_TIMEOUTON 0x00000001 0 02778 // #define ATF_ONOFFFEEDBACK 0x00000002 2 02779 // ----------------------------------------- total = 0x2 = 2 02780 // 02781 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02782 PMAP_TIMEOUT, 02783 TEXT("Flags"), 02784 2 02785 ); 02786 02787 SET_OR_CLEAR_FLAG( 02788 dwDefFlags, 02789 ATF_TIMEOUTON, 02790 TEST_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON)); 02791 02792 gAccessTimeOut.dwFlags = dwDefFlags; 02793 02794 #ifdef FE_SB // 02795 if (gpKbdNlsTbl) { 02796 // 02797 // Is there any alternative MouseVKey table in KBDNLSTABLE ? 02798 // 02799 if ((gpKbdNlsTbl->NumOfMouseVKey == cMouseVKeys) && 02800 (gpKbdNlsTbl->pusMouseVKey != NULL)) { 02801 // 02802 // Overwite the pointer. 02803 // 02804 gpusMouseVKey = gpKbdNlsTbl->pusMouseVKey; 02805 } 02806 02807 // 02808 // Is there any remapping flag for VK_NUMLOCK/VK_SCROLL ? 02809 // 02810 if (gpKbdNlsTbl->LayoutInformation & NLSKBD_INFO_ACCESSIBILITY_KEYMAP) { 02811 // 02812 // Overwrite default. 02813 // 02814 gNumLockVk = VK_HOME; 02815 gOemScrollVk = VK_KANA; 02816 } 02817 } 02818 #endif // FE_SB 02819 02820 gAccessTimeOut.iTimeOutMSec = (DWORD)FastGetProfileIntW(pProfileUserName, 02821 PMAP_TIMEOUT, 02822 TEXT("TimeToWait"), 02823 300000 02824 ); // default is 5 minutes 02825 02826 /* 02827 * Get High Contrast state 02828 */ 02829 02830 dwDefFlags = FastGetProfileIntW(pProfileUserName, 02831 PMAP_HIGHCONTRAST, 02832 TEXT("Flags"), 02833 HCF_AVAILABLE | HCF_HOTKEYSOUND | HCF_HOTKEYAVAILABLE 02834 ); 02835 02836 SET_OR_CLEAR_FLAG( 02837 dwDefFlags, 02838 HCF_HIGHCONTRASTON, 02839 TEST_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON)); 02840 02841 gHighContrast.dwFlags = dwDefFlags; 02842 02843 /* 02844 * Get scheme -- set up buffer 02845 */ 02846 02847 usHighContrastScheme.Buffer = wcHighContrastScheme; 02848 if (FastGetProfileStringW(pProfileUserName, 02849 PMAP_HIGHCONTRAST, 02850 TEXT("High Contrast Scheme"), 02851 NULL, 02852 wcHighContrastScheme, 02853 MAX_SCHEME_NAME_SIZE 02854 )) { 02855 02856 /* 02857 * copy data 02858 */ 02859 02860 wcscpy(gHighContrastDefaultScheme, usHighContrastScheme.Buffer); 02861 } 02862 02863 02864 AccessTimeOutReset(); 02865 SetAccessEnabledFlag(); 02866 }

BOOL xxxUpdatePerUserSystemParameters HANDLE  hToken,
BOOL  bUserLoggedOn
 

Definition at line 2445 of file w32/ntuser/kernel/init.c.

References _DestroyMenu(), _SetCaretBlinkTime(), ARRAY_SIZE, BOOL, CalculateMouseSensitivity(), CheckDesktopPolicyChange(), CreateProfileUserName(), DWORD, tagWINDOWSTATION::dwWSF_Flags, FALSE, FastGetProfileDwordW(), FastGetProfileIntFromID(), FastGetProfileIntsW(), FastGetProfileIntW(), FastGetProfileValue(), FastWriteProfileStringW(), FreeProfileUserName(), gcxMouseHover, gcyMouseHover, gdtMNDropDown, gdtMouseHover, gdwCanPaintDesktop, gdwKeyboardAttributes, GetCurrentProcessId, GetKbdLangSwitch(), gfEnableHexNumpad, gfIMEShowStatus, gfUnsignedDrivers, gMouseSensitivity, gMouseSensitivityFactor, gMouseSpeed, gMouseThresh1, gMouseThresh2, gnFastAltTabColumns, gnFastAltTabRows, gnllHooksTimeout, gpDispInfo, gpidLogon, gpsi, grpWinStaList, tagDISPLAYINFO::hdcScreen, hModuleWin, IMESHOWSTATUS_NOTINITIALIZED, IsWinEventNotifyDeferredOK, L, LoadCPUserPreferences(), LW_LoadResources(), MOUSE_SENSITIVITY_DEFAULT, MOUSE_SENSITIVITY_MAX, NULL, OpenCacheKeyEx(), PMAP_DESKTOP, PMAP_INPUTMETHOD, PMAP_KEYBOARD, PMAP_METRICS, PMAP_MOUSE, PMAP_NETWORK, PMAP_TRUETYPE, PMAP_UKBDLAYOUT, PMAP_WINDOWSU, PUDF_ANIMATE, PUDF_DRAGFULLWINDOWS, tagWINDOWSTATION::rpdeskList, tagDESKTOP::rpdeskNext, ServerLoadString, SET_OR_CLEAR_PUDF, SetIconMetrics(), SetMinMetrics(), tagDESKTOP::spmenuDialogSys, tagDESKTOP::spmenuSys, SYSMET, TEST_BOOL_PUDF, TRUE, UINT, UnlockDesktopSysMenu(), UpdatePerUserKeyboardIndicators(), WSF_NOIO, xxxODI_ColorInit(), xxxSetWindowNCMetrics(), xxxSystemParametersInfo(), xxxUpdatePerUserAccessPackSettings(), and xxxUpdateSystemCursorsFromRegistry().

Referenced by NtUserUpdatePerUserSystemParameters().

02448 { 02449 int i; 02450 HANDLE hKey; 02451 DWORD dwFontSmoothing; 02452 BOOL fDragFullWindows; 02453 TL tlName; 02454 PUNICODE_STRING pProfileUserName = NULL; 02455 02456 02457 static struct { 02458 UINT idSection; 02459 UINT id; 02460 UINT idRes; 02461 UINT def; 02462 } spi[] = { 02463 { PMAP_DESKTOP, SPI_SETSCREENSAVETIMEOUT, STR_SCREENSAVETIMEOUT, 0 }, 02464 { PMAP_DESKTOP, SPI_SETSCREENSAVEACTIVE, STR_SCREENSAVEACTIVE, 0 }, 02465 { PMAP_DESKTOP, SPI_SETDRAGHEIGHT, STR_DRAGHEIGHT, 4 }, 02466 { PMAP_DESKTOP, SPI_SETDRAGWIDTH, STR_DRAGWIDTH, 4 }, 02467 { PMAP_DESKTOP, SPI_SETWHEELSCROLLLINES, STR_WHEELSCROLLLINES, 3 }, 02468 { PMAP_KEYBOARD, SPI_SETKEYBOARDDELAY, STR_KEYDELAY, 0 }, 02469 { PMAP_KEYBOARD, SPI_SETKEYBOARDSPEED, STR_KEYSPEED, 15 }, 02470 { PMAP_MOUSE, SPI_SETDOUBLECLICKTIME, STR_DBLCLKSPEED, 500 }, 02471 { PMAP_MOUSE, SPI_SETDOUBLECLKWIDTH, STR_DOUBLECLICKWIDTH, 4 }, 02472 { PMAP_MOUSE, SPI_SETDOUBLECLKHEIGHT, STR_DOUBLECLICKHEIGHT, 4 }, 02473 { PMAP_MOUSE, SPI_SETSNAPTODEFBUTTON, STR_SNAPTO, 0 }, 02474 { PMAP_WINDOWSU, SPI_SETMENUDROPALIGNMENT, STR_MENUDROPALIGNMENT, 0 }, 02475 { PMAP_INPUTMETHOD, SPI_SETSHOWIMEUI, STR_SHOWIMESTATUS, 1 }, 02476 }; 02477 02478 PROFINTINFO apii[] = { 02479 { PMAP_MOUSE, (LPWSTR)STR_MOUSETHRESH1, 6, &gMouseThresh1 }, 02480 { PMAP_MOUSE, (LPWSTR)STR_MOUSETHRESH2, 10, &gMouseThresh2 }, 02481 { PMAP_MOUSE, (LPWSTR)STR_MOUSESPEED, 1, &gMouseSpeed }, 02482 { PMAP_DESKTOP, (LPWSTR)STR_MENUSHOWDELAY, 400, &gdtMNDropDown }, 02483 { PMAP_DESKTOP, (LPWSTR)STR_DRAGFULLWINDOWS, 2, &fDragFullWindows }, 02484 { PMAP_DESKTOP, (LPWSTR)STR_FASTALTTABROWS, 3, &gnFastAltTabRows }, 02485 { PMAP_DESKTOP, (LPWSTR)STR_FASTALTTABCOLUMNS, 7, &gnFastAltTabColumns }, 02486 { PMAP_DESKTOP, (LPWSTR)STR_MAXLEFTOVERLAPCHARS, 3, &(gpsi->wMaxLeftOverlapChars) }, 02487 { PMAP_DESKTOP, (LPWSTR)STR_MAXRIGHTOVERLAPCHARS, 3, &(gpsi->wMaxRightOverlapChars) }, 02488 { PMAP_DESKTOP, (LPWSTR)STR_FONTSMOOTHING, 0, &dwFontSmoothing }, 02489 { PMAP_INPUTMETHOD, (LPWSTR)STR_HEXNUMPAD, 0, &gfEnableHexNumpad }, 02490 { 0, NULL, 0, NULL } 02491 }; 02492 02493 UserAssert(IsWinEventNotifyDeferredOK()); 02494 02495 UNREFERENCED_PARAMETER(hToken); 02496 02497 /* 02498 * Make sure the caller is the logon process 02499 */ 02500 if (GetCurrentProcessId() != gpidLogon) { 02501 RIPMSG0(RIP_WARNING, "Access denied in xxxUpdatePerUserSystemParameters"); 02502 return FALSE; 02503 } 02504 02505 pProfileUserName = CreateProfileUserName(&tlName); 02506 02507 /* 02508 * Check for new policy. 02509 */ 02510 CheckDesktopPolicyChange(pProfileUserName); 02511 02512 /* 02513 * Get the timeout for low level hooks from the registry 02514 */ 02515 FastGetProfileValue(pProfileUserName, 02516 PMAP_DESKTOP, 02517 (LPWSTR)STR_LLHOOKSTIMEOUT, 02518 NULL, 02519 (LPBYTE)&gnllHooksTimeout, 02520 sizeof(int) 02521 ); 02522 02523 /* 02524 * Control Panel User Preferences 02525 */ 02526 LoadCPUserPreferences(pProfileUserName); 02527 02528 /* 02529 * Set syscolors from registry. 02530 */ 02531 02532 xxxODI_ColorInit(pProfileUserName); 02533 02534 LW_LoadResources(pProfileUserName); 02535 02536 /* 02537 * This is the initialization from Chicago 02538 */ 02539 xxxSetWindowNCMetrics(pProfileUserName, NULL, TRUE, -1); // Colors must be set first 02540 SetMinMetrics(pProfileUserName, NULL); 02541 SetIconMetrics(pProfileUserName, NULL); 02542 02543 /* 02544 * Read the keyboard layout switching hot key 02545 */ 02546 GetKbdLangSwitch(pProfileUserName); 02547 02548 /* 02549 * Set the default thread locale for the system based on the value 02550 * in the current user's registry profile. 02551 */ 02552 ZwSetDefaultLocale( TRUE, 0 ); 02553 02554 /* 02555 * Set the default UI language based on the value in the current 02556 * user's registry profile. 02557 */ 02558 ZwSetDefaultUILanguage(0); 02559 02560 /* 02561 * And then Get it. 02562 */ 02563 ZwQueryDefaultUILanguage(&(gpsi->UILangID)); 02564 02565 02566 /* 02567 * Destroy the desktop system menus, so that they're recreated with 02568 * the correct UI language if the current user's UI language is different 02569 * from the previous one. This is done by finding the interactive 02570 * window station and destroying all its desktops's system menus. 02571 */ 02572 if (grpWinStaList != NULL) { 02573 PDESKTOP pdesk; 02574 PMENU pmenu; 02575 02576 UserAssert(!(grpWinStaList->dwWSF_Flags & WSF_NOIO)); 02577 for (pdesk = grpWinStaList->rpdeskList; pdesk != NULL; pdesk = pdesk->rpdeskNext) { 02578 if (pdesk->spmenuSys != NULL) { 02579 pmenu = pdesk->spmenuSys; 02580 if (UnlockDesktopSysMenu(&pdesk->spmenuSys)) 02581 _DestroyMenu(pmenu); 02582 } 02583 if (pdesk->spmenuDialogSys != NULL) { 02584 pmenu = pdesk->spmenuDialogSys; 02585 if (UnlockDesktopSysMenu(&pdesk->spmenuDialogSys)) 02586 _DestroyMenu(pmenu); 02587 } 02588 } 02589 } 02590 02591 xxxUpdateSystemCursorsFromRegistry(pProfileUserName); 02592 02593 /* 02594 * desktop Pattern now. Note no parameters. It just goes off 02595 * and reads win.ini and sets the desktop pattern. 02596 */ 02597 xxxSystemParametersInfo(SPI_SETDESKPATTERN, (UINT)-1, 0L, 0); // 265 version 02598 02599 /* 02600 * Initialize IME show status 02601 */ 02602 if (bUserLoggedOn) { 02603 gfIMEShowStatus = IMESHOWSTATUS_NOTINITIALIZED; 02604 } 02605 02606 /* 02607 * now go set a bunch of random values from the win.ini file. 02608 */ 02609 for (i = 0; i < ARRAY_SIZE(spi); i++) { 02610 02611 xxxSystemParametersInfo( 02612 spi[i].id, 02613 FastGetProfileIntFromID(pProfileUserName, 02614 spi[i].idSection, 02615 spi[i].idRes, 02616 spi[i].def 02617 ), 02618 0L, 02619 0 02620 ); 02621 } 02622 02623 /* 02624 * read profile integers and do any fixups 02625 */ 02626 FastGetProfileIntsW(pProfileUserName, apii); 02627 02628 if (gnFastAltTabColumns < 2) 02629 gnFastAltTabColumns = 7; 02630 02631 if (gnFastAltTabRows < 1) 02632 gnFastAltTabRows = 3; 02633 02634 /* 02635 * If this is the first time the user logs on, set the DragFullWindows 02636 * to the default. If we have an accelerated device, enable full drag. 02637 */ 02638 if (fDragFullWindows == 2) { 02639 02640 LPWSTR pwszd = L"%d"; 02641 WCHAR szTemp[40]; 02642 WCHAR szDragFullWindows[40]; 02643 02644 SET_OR_CLEAR_PUDF( 02645 PUDF_DRAGFULLWINDOWS, 02646 GreGetDeviceCaps(gpDispInfo->hdcScreen, BLTALIGNMENT) == 0); 02647 02648 if (bUserLoggedOn) { 02649 swprintf(szTemp, pwszd, TEST_BOOL_PUDF(PUDF_DRAGFULLWINDOWS)); 02650 02651 ServerLoadString(hModuleWin, 02652 STR_DRAGFULLWINDOWS, 02653 szDragFullWindows, 02654 sizeof(szDragFullWindows) / sizeof(WCHAR)); 02655 02656 FastWriteProfileStringW(pProfileUserName, 02657 PMAP_DESKTOP, 02658 szDragFullWindows, 02659 szTemp); 02660 } 02661 } else { 02662 SET_OR_CLEAR_PUDF(PUDF_DRAGFULLWINDOWS, fDragFullWindows); 02663 } 02664 02665 /* 02666 * !!!LATER!!! (adams) See if the following profile retrievals can't 02667 * be done in the "spi" array above (e.g. SPI_SETSNAPTO). 02668 */ 02669 02670 /* 02671 * Set mouse settings 02672 */ 02673 gMouseSensitivity = FastGetProfileIntFromID(pProfileUserName,PMAP_MOUSE, STR_MOUSESENSITIVITY, MOUSE_SENSITIVITY_DEFAULT); 02674 if ((gMouseSensitivity < MOUSE_SENSITIVITY_MIN) || (gMouseSensitivity > MOUSE_SENSITIVITY_MAX)) { 02675 gMouseSensitivity = MOUSE_SENSITIVITY_DEFAULT ; 02676 } 02677 gMouseSensitivityFactor = CalculateMouseSensitivity(gMouseSensitivity) ; 02678 02679 _SetCaretBlinkTime(FastGetProfileIntFromID(pProfileUserName,PMAP_DESKTOP, STR_BLINK, 500)); 02680 02681 /* 02682 * Font Information 02683 */ 02684 GreSetFontEnumeration( FastGetProfileIntW(pProfileUserName,PMAP_TRUETYPE, TEXT("TTOnly"), FALSE)); 02685 02686 /* 02687 * Mouse tracking variables 02688 */ 02689 gcxMouseHover = FastGetProfileIntFromID(pProfileUserName,PMAP_MOUSE, STR_MOUSEHOVERWIDTH, SYSMET(CXDOUBLECLK)); 02690 gcyMouseHover = FastGetProfileIntFromID(pProfileUserName,PMAP_MOUSE, STR_MOUSEHOVERHEIGHT, SYSMET(CYDOUBLECLK)); 02691 gdtMouseHover = FastGetProfileIntFromID(pProfileUserName,PMAP_MOUSE, STR_MOUSEHOVERTIME, gdtMNDropDown); 02692 02693 /* 02694 * Window animation 02695 */ 02696 SET_OR_CLEAR_PUDF(PUDF_ANIMATE, 02697 FastGetProfileIntFromID(pProfileUserName,PMAP_METRICS, STR_MINANIMATE, TRUE)); 02698 02699 /* 02700 * Initial Keyboard state: ScrollLock, NumLock and CapsLock state; 02701 * global (per-user) kbd layout attributes (such as ShiftLock/CapsLock) 02702 */ 02703 UpdatePerUserKeyboardIndicators(pProfileUserName); 02704 02705 gdwKeyboardAttributes = KLL_GLOBAL_ATTR_FROM_KLF(FastGetProfileDwordW(pProfileUserName,PMAP_UKBDLAYOUT, L"Attributes", 0)); 02706 02707 xxxUpdatePerUserAccessPackSettings(pProfileUserName); 02708 02709 /* 02710 * If we successfully opened this, we assume we have a network. 02711 */ 02712 if (hKey = OpenCacheKeyEx(NULL, PMAP_NETWORK, KEY_READ, NULL)) { 02713 RIPMSG0(RIP_WARNING | RIP_NONAME, ""); 02714 SYSMET(NETWORK) = RNC_NETWORKS; 02715 02716 ZwClose(hKey); 02717 } 02718 02719 SYSMET(NETWORK) |= RNC_LOGON; 02720 02721 /* 02722 * Font smoothing 02723 */ 02724 UserAssert ((dwFontSmoothing == 0) || (dwFontSmoothing == FE_AA_ON)); 02725 GreSetFontEnumeration( dwFontSmoothing | FE_SET_AA ); 02726 02727 /* 02728 * Desktop Build Number Painting 02729 */ 02730 if (USER_SHARED_DATA->SystemExpirationDate.QuadPart || gfUnsignedDrivers) { 02731 gdwCanPaintDesktop = 1; 02732 } else { 02733 gdwCanPaintDesktop = FastGetProfileDwordW(pProfileUserName, PMAP_DESKTOP, L"PaintDesktopVersion", 0); 02734 } 02735 02736 FreeProfileUserName(pProfileUserName, &tlName); 02737 return TRUE; 02738 }

VOID xxxUpdateSystemCursorsFromRegistry PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 1685 of file w32/ntuser/kernel/init.c.

References FALSE, FastGetProfileStringFromIDW(), gasyscur, MAX_PATH, PMAP_CURSORS, RtlInitUnicodeString(), RtlInitUnicodeStringOrId(), UINT, VOID(), xxxClientLoadImage(), and zzzSetSystemImage().

Referenced by xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

01686 { 01687 int i; 01688 UNICODE_STRING strName; 01689 TCHAR szFilename[MAX_PATH]; 01690 PCURSOR pCursor; 01691 UINT LR_flags; 01692 01693 for (i = 0; i < COCR_CONFIGURABLE; i++) { 01694 01695 FastGetProfileStringFromIDW(pProfileUserName, 01696 PMAP_CURSORS, 01697 gasyscur[i].StrId, 01698 TEXT(""), 01699 szFilename, 01700 sizeof(szFilename) / sizeof(TCHAR)); 01701 01702 if (*szFilename) { 01703 RtlInitUnicodeString(&strName, szFilename); 01704 LR_flags = LR_LOADFROMFILE | LR_ENVSUBST; 01705 } else { 01706 RtlInitUnicodeStringOrId(&strName, 01707 MAKEINTRESOURCE(i + OCR_FIRST_DEFAULT)); 01708 LR_flags = LR_ENVSUBST; 01709 } 01710 01711 pCursor = xxxClientLoadImage(&strName, 01712 0, 01713 IMAGE_CURSOR, 01714 0, 01715 0, 01716 LR_flags, 01717 FALSE); 01718 01719 if (pCursor) { 01720 zzzSetSystemImage(pCursor, gasyscur[i].spcur); 01721 } else { 01722 RIPMSG1(RIP_WARNING, "Unable to update cursor. id=%x.", i + OCR_FIRST_DEFAULT); 01723 01724 } 01725 } 01726 }

VOID xxxUpdateSystemIconsFromRegistry PUNICODE_STRING  pProfileUserName  ) 
 

Definition at line 1735 of file w32/ntuser/kernel/init.c.

References FALSE, FastGetProfileStringFromIDW(), gasysico, gpsi, HtoP, IS_PTR, MAX_PATH, NULL, PMAP_ICONS, PtoH, RtlInitUnicodeString(), RtlInitUnicodeStringOrId(), SYSMET, UINT, VOID(), xxxClientLoadImage(), and zzzSetSystemImage().

Referenced by xxxSystemParametersInfo().

01736 { 01737 int i; 01738 UNICODE_STRING strName; 01739 TCHAR szFilename[MAX_PATH]; 01740 PCURSOR pCursor; 01741 UINT LR_flags; 01742 01743 for (i = 0; i < COIC_CONFIGURABLE; i++) { 01744 01745 FastGetProfileStringFromIDW(pProfileUserName, 01746 PMAP_ICONS, 01747 gasysico[i].StrId, 01748 TEXT(""), 01749 szFilename, 01750 sizeof(szFilename) / sizeof(TCHAR)); 01751 01752 if (*szFilename) { 01753 RtlInitUnicodeString(&strName, szFilename); 01754 LR_flags = LR_LOADFROMFILE | LR_ENVSUBST; 01755 } else { 01756 RtlInitUnicodeStringOrId(&strName, 01757 MAKEINTRESOURCE(i + OIC_FIRST_DEFAULT)); 01758 LR_flags = LR_ENVSUBST; 01759 } 01760 01761 pCursor = xxxClientLoadImage(&strName, 01762 0, 01763 IMAGE_ICON, 01764 0, 01765 0, 01766 LR_flags, 01767 FALSE); 01768 01769 RIPMSG3(RIP_VERBOSE, 01770 (!IS_PTR(strName.Buffer)) ? 01771 "%#.8lx = Loaded id %ld" : 01772 "%#.8lx = Loaded file %ws for id %ld", 01773 PtoH(pCursor), 01774 strName.Buffer, 01775 i + OIC_FIRST_DEFAULT); 01776 01777 if (pCursor) { 01778 zzzSetSystemImage(pCursor, gasysico[i].spcur); 01779 } else { 01780 RIPMSG1(RIP_WARNING, "Unable to update icon. id=%ld", i + OIC_FIRST_DEFAULT); 01781 } 01782 01783 /* 01784 * update the small winlogo icon which is referenced by gpsi. 01785 * Seems like we should load the small version for all configurable 01786 * icons anyway. What is needed is for CopyImage to support 01787 * copying of images loaded from files with LR_COPYFROMRESOURCE 01788 * allowing a reaload of the bits. (SAS) 01789 */ 01790 if (i == OIC_WINLOGO_DEFAULT - OIC_FIRST_DEFAULT) { 01791 01792 PCURSOR pCurSys = HtoP(gpsi->hIconSmWindows); 01793 01794 if (pCurSys != NULL) { 01795 pCursor = xxxClientLoadImage(&strName, 01796 0, 01797 IMAGE_ICON, 01798 SYSMET(CXSMICON), 01799 SYSMET(CYSMICON), 01800 LR_flags, 01801 FALSE); 01802 01803 if (pCursor) { 01804 zzzSetSystemImage(pCursor, pCurSys); 01805 } else { 01806 RIPMSG0(RIP_WARNING, "Unable to update small winlogo icon."); 01807 } 01808 } 01809 } 01810 } 01811 }

void xxxUpdateThreadsWindows PTHREADINFO  pti,
PWND  pwnd,
HRGN  hrgnFullDrag
 

Definition at line 1523 of file movesize.c.

References CheckLock, GETPTI, NULL, tagWND::spwndNext, ThreadLockExchangeAlways(), ThreadLockNever, ThreadUnlock, VOID(), xxxUpdateOtherThreadsWindows(), and xxxUpdateWindow().

Referenced by xxxDrawDragRect(), and xxxUpdateWindows().

01527 { 01528 TL tlpwnd; 01529 01530 CheckLock(pwnd); 01531 01532 ThreadLockNever(&tlpwnd); 01533 while (pwnd != NULL) { 01534 ThreadLockExchangeAlways(pwnd, &tlpwnd); 01535 if (GETPTI(pwnd) == pti) { 01536 xxxUpdateWindow(pwnd); 01537 } else { 01538 xxxUpdateOtherThreadsWindows(pwnd, hrgnFullDrag); 01539 } 01540 01541 pwnd = pwnd->spwndNext; 01542 } 01543 01544 ThreadUnlock(&tlpwnd); 01545 }

void xxxUpdateTray PWND  pwnd  ) 
 

Definition at line 374 of file focusact.c.

References BOOL, CheckLock, FALSE, FCallHookTray, FDoTray, FHas31TrayStyles, FPostTray, FTopLevel, GETPTI, gpqForeground, tagWND::head, Is31TrayWindow(), IsTrayWindow(), NULL, tagWND::spwndLastActive, tagWND::spwndOwner, TestWF, ThreadLock, ThreadUnlock, TRUE, WEFTOOLWINDOW, WFVISIBLE, WFWIN40COMPAT, and xxxSetTrayWindow().

Referenced by xxxActivateThisWindow(), xxxProcessEventMessage(), and xxxSetForegroundWindow2().

00375 { 00376 PWND pwndT; 00377 00378 CheckLock(pwnd); 00379 if (!TestWF(pwnd, WFVISIBLE)) { 00380 return; 00381 } 00382 00383 for (pwndT = pwnd; pwndT->spwndOwner; pwndT = pwndT->spwndOwner) { 00384 } 00385 00386 // Notify the shell hook about this activation change 00387 if ( GETPTI(pwndT)->pq == gpqForeground && 00388 FDoTray() && 00389 (FCallHookTray() || FPostTray(pwndT->head.rpdesk)) && 00390 FTopLevel(pwndT) && 00391 TestWF(pwndT, WFVISIBLE)) 00392 { 00393 BOOL fFirstTry; 00394 BOOL fTryAgain; 00395 PWND pwndArg; 00396 TL tlpwndArg; 00397 00398 fFirstTry = TRUE; 00399 do { 00400 fTryAgain = FALSE; 00401 if (TestWF(pwndT, WFWIN40COMPAT)) { 00402 if (TestWF(pwnd, WFWIN40COMPAT) && IsTrayWindow(pwnd)) { 00403 pwndArg = pwnd; 00404 } else { 00405 pwndArg = IsTrayWindow(pwndT) ? pwndT : NULL; 00406 } 00407 } else { 00408 if (TestWF(pwndT, WEFTOOLWINDOW)) { 00409 pwndArg = NULL; 00410 } else if (FHas31TrayStyles(pwndT)) { 00411 pwndArg = Is31TrayWindow(pwndT) ? pwndT : NULL; 00412 } else if (fFirstTry && (pwndT = pwndT->spwndLastActive)) { 00413 fFirstTry = FALSE; 00414 fTryAgain = TRUE; 00415 } else { 00416 return; 00417 } 00418 } 00419 } while (fTryAgain); 00420 00421 ThreadLock(pwndArg, &tlpwndArg); 00422 xxxSetTrayWindow( 00423 (pwndArg) ? pwndArg->head.rpdesk : pwndT->head.rpdesk, 00424 pwndArg, 00425 NULL); 00426 00427 ThreadUnlock(&tlpwndArg); 00428 } 00429 }

BOOL xxxUpdateWindow PWND  pwnd  ) 
 

Definition at line 1430 of file update.c.

References BOOL, CheckLock, TRUE, UW_ENUMCHILDREN, and xxxInternalUpdateWindow().

Referenced by xxxbFullscreenSwitch(), xxxDragObject(), xxxMNInvertItem(), xxxMNOpenHierarchy(), xxxShowSwitchWindow(), and xxxUpdateThreadsWindows().

01432 { 01433 CheckLock(pwnd); 01434 01435 xxxInternalUpdateWindow(pwnd, UW_ENUMCHILDREN); 01436 01437 /* 01438 * This function needs to return a value, since it is 01439 * called through NtUserCallHwndLock. 01440 */ 01441 return TRUE; 01442 }

BOOL xxxUpdateWindows PWND  pwnd,
HRGN  hrgn
 

Definition at line 25 of file w32/ntuser/kernel/random.c.

References BOOL, CheckLock, PtiCurrent, TRUE, and xxxUpdateThreadsWindows().

Referenced by xxxSetLayeredWindow().

00026 { 00027 CheckLock(pwnd); 00028 00029 xxxUpdateThreadsWindows(PtiCurrent(), pwnd, hrgn); 00030 00031 /* 00032 * This function needs to return a value, since it is 00033 * called through NtUserCallHwndParam. 00034 */ 00035 return TRUE; 00036 }

LONG xxxUserChangeDisplaySettings PUNICODE_STRING  pstrDeviceName,
LPDEVMODEW  pDevMode,
HWND  hwnd,
PDESKTOP  pdesk,
DWORD  dwFlags,
PVOID  lParam,
MODE  PreviousMode
 

Referenced by NtUserChangeDisplaySettings(), VideoPortCalloutThread(), xxxDestroyThreadInfo(), xxxRemoteReconnect(), and xxxUserPowerEventCalloutWorker().

NTSTATUS xxxUserDuplicateObject HANDLE  SourceProcessHandle,
HANDLE  SourceHandle,
HANDLE  TargetProcessHandle,
PHANDLE  TargetHandle,
ACCESS_MASK  DesiredAccess,
ULONG  HandleAttributes,
ULONG  Options
 

Referenced by xxxResolveDesktop(), and xxxSetProcessWindowStation().

NTSTATUS xxxUserModeCallback ULONG  uApi,
PVOID  pIn,
ULONG  cbIn,
PVOID  pOut,
ULONG  cbOut
 

Referenced by xxxClientLoadOLE(), xxxClientRegisterDragDrop(), and xxxClientRevokeDragDrop().

VOID xxxUserPowerCalloutWorker VOID   ) 
 

Definition at line 684 of file power.c.

References CancelPowerRequest(), EVENT_INCREMENT, FALSE, gpPowerRequestCurrent, KeSetEvent(), NULL, PPOWERREQUEST, PtiCurrent, tagPOWERREQUEST::Status, ThreadLockPoolCleanup, ThreadUnlockPoolCleanup, UnqueuePowerRequest(), xxxUserPowerEventCalloutWorker(), and xxxUserPowerStateCalloutWorker().

Referenced by QueuePowerRequest().

00685 { 00686 PPOWERREQUEST pPowerRequest; 00687 TL tlPool; 00688 00689 while ((pPowerRequest = UnqueuePowerRequest()) != NULL) { 00690 /* 00691 * Make sure the event gets signalled even if the thread dies in a 00692 * callback or the waiting thread might get stuck. 00693 */ 00694 ThreadLockPoolCleanup(PtiCurrent(), pPowerRequest, &tlPool, CancelPowerRequest); 00695 00696 /* 00697 * Call the appropriate power worker function. 00698 */ 00699 gpPowerRequestCurrent = pPowerRequest; 00700 if (pPowerRequest->Parms) { 00701 pPowerRequest->Status = xxxUserPowerEventCalloutWorker(pPowerRequest->Parms); 00702 } else { 00703 pPowerRequest->Status = xxxUserPowerStateCalloutWorker(); 00704 } 00705 gpPowerRequestCurrent = NULL; 00706 00707 /* 00708 * Tell the waiting thread to proceed. 00709 */ 00710 ThreadUnlockPoolCleanup(PtiCurrent(), &tlPool); 00711 KeSetEvent(&pPowerRequest->Event, EVENT_INCREMENT, FALSE); 00712 } 00713 }

VOID xxxUserResetDisplayDevice  ) 
 

Definition at line 3136 of file desktop.c.

References BMSG_SENDNOTIFYMSG, gpqCursor, gpsi, grpdeskRitInput, NULL, tagDESKTOP::pDeskInfo, SetPointer(), tagDESKTOPINFO::spwnd, SYSMET, ThreadLock, ThreadUnlock, TRACE_INIT, TRUE, VOID(), xxxBroadcastMessage(), xxxRedrawWindow(), and zzzInternalSetCursorPos().

Referenced by NtUserEnumDisplayDevices(), VideoPortCalloutThread(), xxxCreateDesktop2(), xxxUserChangeDisplaySettings(), and xxxUserPowerEventCalloutWorker().

03137 { 03138 TL tlpwnd; 03139 TRACE_INIT(("xxxUserResetDisplayDevice: about to reset the device\n")); 03140 03141 /* 03142 * Handle early system initialization gracefully. 03143 */ 03144 if (grpdeskRitInput != NULL) { 03145 ThreadLock(grpdeskRitInput->pDeskInfo->spwnd, &tlpwnd); 03146 #if 0 03147 // what should we do here to notify the display applet ? 03148 // AndreVa 03149 03150 /* 03151 * Broadcast that the display has changed resolution. We are going 03152 * to specify the desktop for the changing-desktop. That way we 03153 * don't get confused as to what desktop to broadcast to. 03154 */ 03155 xxxBroadcastMessage(grpdeskRitInput->pDeskInfo->spwnd, 03156 WM_DISPLAYCHANGE, 03157 gpsi->BitCount, 03158 MAKELONG(SYSMET(CXSCREEN), SYSMET(CYSCREEN)), 03159 BMSG_SENDNOTIFYMSG, 03160 NULL); 03161 #endif 03162 xxxRedrawWindow(grpdeskRitInput->pDeskInfo->spwnd, 03163 NULL, 03164 NULL, 03165 RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW | 03166 RDW_ALLCHILDREN); 03167 gpqCursor = NULL; 03168 03169 /* 03170 * No need to DeferWinEventNotify() - we just made an xxx call above 03171 */ 03172 zzzInternalSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y); 03173 03174 SetPointer(TRUE); 03175 03176 ThreadUnlock(&tlpwnd); 03177 } 03178 03179 TRACE_INIT(("xxxUserResetDisplayDevice: complete\n")); 03180 03181 }

BOOL xxxUserYield PTHREADINFO  pti  ) 
 

Definition at line 537 of file taskman.c.

References BOOL, gpsi, InsertTask(), tagTDB::nEvents, NULL, tagTHREADINFO::ppi, tagTHREADINFO::ptdb, tagWOWPROCESSINFO::ptiScheduled, tagPROCESSINFO::pwpi, TIF_16BIT, tagTHREADINFO::TIF_flags, TRUE, xxxReceiveMessages, and xxxSleepTask().

Referenced by NtUserYieldTask(), and xxxInternalGetMessage().

00539 { 00540 PPROCESSINFO ppi = pti->ppi; 00541 00542 /* 00543 * Deal with any pending messages. Only call it this first time if 00544 * this is the current running 16 bit app. In the case when starting 00545 * up a 16 bit app, the starter calls UserYield() to yield to the new 00546 * task, but at this time ppi->ptiScheduled is set to the new task. 00547 * Receiving messages at this point would be bad! 00548 */ 00549 if (pti->TIF_flags & TIF_16BIT) { 00550 if (pti == ppi->pwpi->ptiScheduled) { 00551 xxxReceiveMessages(pti); 00552 } 00553 } else { 00554 xxxReceiveMessages(pti); 00555 } 00556 00557 /* 00558 * If we are a 16 bit task 00559 * Mark our task so it comes back some time. Also, remove it and 00560 * re-add it to the list so that we are the last task of our priority 00561 * to run. 00562 */ 00563 if ((pti->TIF_flags & TIF_16BIT) && (pti->ptdb != NULL)) { 00564 if (pti->ptdb->nEvents == 0) { 00565 pti->ptdb->nEvents++; 00566 gpsi->nEvents++; 00567 } 00568 InsertTask(ppi, pti->ptdb); 00569 00570 /* 00571 * Sleep. Return right away if there are no higher priority tasks 00572 * in need of running. 00573 */ 00574 xxxSleepTask(TRUE, NULL); 00575 00576 /* 00577 * Deal with any that arrived since we weren't executing. 00578 */ 00579 xxxReceiveMessages(pti); 00580 } 00581 00582 00583 return TRUE; 00584 }

BOOL xxxValidateRect PWND  pwnd,
LPRECT  lprc
 

Definition at line 77 of file update.c.

References BOOL, CheckLock, NULL, and xxxRedrawWindow().

Referenced by NtUserValidateRect(), xxxMenuWindowProc(), and xxxMoveWindow().

00080 { 00081 CheckLock(pwnd); 00082 00083 /* 00084 * BACKWARD COMPATIBILITY HACK 00085 * 00086 * In Windows 3.0 and less, ValidateRect/InvalidateRect() call with 00087 * hwnd == NULL always INVALIDATED and ERASED the entire desktop, and 00088 * synchronously sent WM_ERASEBKGND and WM_NCPAINT messages before 00089 * returning. The Rgn() calls did not have this behavior. 00090 */ 00091 if (pwnd == NULL) { 00092 return xxxRedrawWindow( 00093 pwnd, 00094 NULL, 00095 NULL, 00096 RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW); 00097 } else { 00098 return xxxRedrawWindow(pwnd, lprcValid, NULL, RDW_VALIDATE); 00099 } 00100 }

BOOL xxxValidateRgn PWND  pwnd,
HRGN  hrgn
 

Definition at line 132 of file update.c.

References BOOL, CheckLock, NULL, and xxxRedrawWindow().

00135 { 00136 CheckLock(pwnd); 00137 00138 return xxxRedrawWindow(pwnd, NULL, hrgnValid, RDW_VALIDATE); 00139 }

DWORD xxxWaitForInputIdle ULONG_PTR  idProcess,
DWORD  dwMilliseconds,
BOOL  fSharedWow
 

Definition at line 5310 of file queue.c.

References CheckForClientDeath, DWORD, EnterCrit, _EPROCESS::ExitProcessCalled, gpwtiFirst, tagWOWTHREADINFO::idParentProcess, tagWOWTHREADINFO::idWaitObject, LeaveCrit, LockProcessByClientId(), NT_SUCCESS, NTSTATUS(), NULL, tagWOWTHREADINFO::pIdleEvent, tagTHREADINFO::ppi, PtiCurrent, tagPROCESSINFO::ptiList, tagPROCESSINFO::ptiMainThread, tagTHREADINFO::ptiSibling, tagWOWTHREADINFO::pwtiNext, Status, tagTHREADINFO::TIF_flags, TIF_SYSTEMTHREAD, TIF_WAITFORINPUTIDLE, UnlockProcess, WaitOnPseudoEvent(), _EPROCESS::Win32Process, and xxxPollAndWaitForSingleObject().

Referenced by NtUserWaitForInputIdle().

05314 { 05315 PTHREADINFO ptiCurrent; 05316 PTHREADINFO pti; 05317 PEPROCESS Process; 05318 PW32PROCESS W32Process; 05319 PPROCESSINFO ppi; 05320 DWORD dwResult; 05321 NTSTATUS Status; 05322 TL tlProcess; 05323 05324 ptiCurrent = PtiCurrent(); 05325 05326 /* 05327 * If fSharedWow is set, the client passed in a fake process 05328 * handle which CreateProcess returns for Win16 apps started 05329 * in the shared WOW VDM. 05330 * 05331 * CreateProcess returns a real process handle when you start 05332 * a Win16 app in a separate WOW VDM. 05333 */ 05334 05335 if (fSharedWow) { // Waiting for a WOW task to go idle. 05336 PWOWTHREADINFO pwti; 05337 05338 05339 /* 05340 * Look for a matching thread in the WOW thread info list. 05341 */ 05342 for (pwti = gpwtiFirst; pwti != NULL; pwti = pwti->pwtiNext) { 05343 if (pwti->idParentProcess == HandleToUlong(ptiCurrent->pEThread->Cid.UniqueProcess) && 05344 pwti->idWaitObject == idProcess) { 05345 break; 05346 } 05347 } 05348 05349 /* 05350 * If we couldn't find the right thread, bail out. 05351 */ 05352 if (pwti == NULL) { 05353 RIPMSG0(RIP_WARNING, "WaitForInputIdle couldn't find 16-bit task\n"); 05354 return (DWORD)-1; 05355 } 05356 05357 /* 05358 * Now wait for it to go idle and return. 05359 */ 05360 dwResult = WaitOnPseudoEvent(&pwti->pIdleEvent, dwMilliseconds); 05361 if (dwResult == STATUS_ABANDONED) { 05362 dwResult = xxxPollAndWaitForSingleObject(pwti->pIdleEvent, 05363 NULL, 05364 dwMilliseconds); 05365 } 05366 return dwResult; 05367 05368 } 05369 05370 /* 05371 * We shouldn't get here for system threads. 05372 */ 05373 UserAssert(!(ptiCurrent->TIF_flags & TIF_SYSTEMTHREAD)); 05374 05375 /* 05376 * If the app is waiting for itself to go idle, error. 05377 */ 05378 if (ptiCurrent->pEThread->Cid.UniqueProcess == (HANDLE)idProcess && 05379 ptiCurrent == ptiCurrent->ppi->ptiMainThread) { 05380 RIPMSG0(RIP_WARNING, "WaitForInputIdle waiting on self\n"); 05381 return (DWORD)-1; 05382 } 05383 05384 /* 05385 * Now find the ppi structure for this process. 05386 */ 05387 LeaveCrit(); 05388 Status = LockProcessByClientId((HANDLE)idProcess, &Process); 05389 EnterCrit(); 05390 05391 if (!NT_SUCCESS(Status)) 05392 return (DWORD)-1; 05393 05394 if (Process->ExitProcessCalled) { 05395 UnlockProcess(Process); 05396 return (DWORD)-1; 05397 } 05398 05399 W32Process = (PW32PROCESS)Process->Win32Process; 05400 05401 /* 05402 * Couldn't find that process info structure.... return error. 05403 */ 05404 if (W32Process == NULL) { 05405 RIPMSG0(RIP_WARNING, "WaitForInputIdle process not GUI process\n"); 05406 UnlockProcess(Process); 05407 return (DWORD)-1; 05408 } 05409 05410 05411 ppi = (PPROCESSINFO)W32Process; 05412 05413 /* 05414 * If this is a console application, don't wait on it. 05415 */ 05416 if (W32Process->W32PF_Flags & W32PF_CONSOLEAPPLICATION) { 05417 RIPMSG0(RIP_WARNING, "WaitForInputIdle process is console process\n"); 05418 UnlockProcess(Process); 05419 return (DWORD)-1; 05420 } 05421 05422 /* 05423 * Wait on this event for the passed in time limit. 05424 */ 05425 CheckForClientDeath(); 05426 05427 /* 05428 * We have to wait mark the Process as one which others are waiting on 05429 */ 05430 ppi->W32PF_Flags |= W32PF_WAITFORINPUTIDLE; 05431 for (pti = ppi->ptiList; pti != NULL; pti = pti->ptiSibling) { 05432 pti->TIF_flags |= TIF_WAITFORINPUTIDLE; 05433 } 05434 05435 /* 05436 * Thread lock the process to ensure that it will be dereferenced 05437 * if the thread exits. 05438 */ 05439 LockW32Process(W32Process, &tlProcess); 05440 UnlockProcess(Process); 05441 05442 dwResult = WaitOnPseudoEvent(&W32Process->InputIdleEvent, dwMilliseconds); 05443 if (dwResult == STATUS_ABANDONED) { 05444 dwResult = xxxPollAndWaitForSingleObject(W32Process->InputIdleEvent, 05445 Process, 05446 dwMilliseconds); 05447 } 05448 05449 /* 05450 * Clear all thread TIF_WAIT bits from the process. 05451 */ 05452 ppi->W32PF_Flags &= ~W32PF_WAITFORINPUTIDLE; 05453 for (pti = ppi->ptiList; pti != NULL; pti = pti->ptiSibling) { 05454 pti->TIF_flags &= ~TIF_WAITFORINPUTIDLE; 05455 } 05456 05457 UnlockW32Process(&tlProcess); 05458 05459 return dwResult; 05460 }

BOOL xxxWaitMessage VOID   ) 
 

Definition at line 112 of file ntuser/kernel/input.c.

References BOOL, TRUE, and xxxSleepThread().

Referenced by NtUserWaitMessage(), xxxHelpLoop(), xxxMoveSize(), and xxxOldNextWindow().

00113 { 00114 return xxxSleepThread(QS_ALLINPUT | QS_EVENT, 0, TRUE); 00115 }

VOID xxxWindowEvent DWORD  event,
PWND  pwnd,
LONG  idObject,
LONG  idChild,
DWORD  dwFlags
 

Definition at line 274 of file kernel/winable.c.

References CreateNotify(), DBGVERIFYEVENTHOOK, DBGVERIFYNOTIFY, dwFlags, DWORD, tagNOTIFY::dwWEFlags, tagEVENTHOOK::eventMax, tagEVENTHOOK::eventMin, tagEVENTHOOK::fDestroyed, tagEVENTHOOK::fIgnoreOwnProcess, tagEVENTHOOK::fIgnoreOwnThread, FWINABLE, GETPTI, gptiCurrent, gpWinEventHooks, tagEVENTHOOK::head, tagEVENTHOOK::hEventProcess, HMIsMarkDestroy, tagEVENTHOOK::idEventThread, NtGetTickCount(), NULL, tagEVENTHOOK::pehNext, tagTHREADINFO::ppi, _THROBJHEAD::pti, PtiCurrent, tagTHREADINFO::rpdesk, TestWF, ThreadLockPti, ThreadLockWithPti, ThreadUnlock, ThreadUnlockPti, TIDq, TIF_DISABLEHOOKS, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, WEF_ASYNC, WEF_DEFERNOTIFY, WEF_USEPWNDTHREAD, WFDESTROYED, xxxFlushDeferredWindowEvents(), and xxxProcessNotifyWinEvent().

Referenced by NtUserNotifyWinEvent(), UpdateLayeredSprite(), xxxActivateThisWindow(), xxxCalcClientRect(), xxxCancelCoolSwitch(), xxxCreateCaret(), xxxCreateWindowEx(), xxxDefWindowProc(), xxxDestroyThreadInfo(), xxxDestroyWindow(), xxxDragObject(), xxxEnableSBCtlArrows(), xxxEnableWindow(), xxxEnableWndSBArrows(), xxxEndScroll(), xxxHelpLoop(), xxxMinMaximize(), xxxMNCancel(), xxxMNCloseHierarchy(), xxxMNOpenHierarchy(), xxxMNSelectItem(), xxxMNStartMenu(), xxxMNSwitchToAlternateMenu(), xxxMoveSize(), xxxMoveSwitchWndHilite(), xxxMS_TrackMove(), xxxSBTrackLoop(), xxxSBWndProc(), xxxScanSysQueue(), xxxSendChangedMsgs(), xxxSendFocusMessages(), xxxSendMenuSelect(), xxxSetConsoleCaretInfo(), xxxSetParent(), xxxSetScrollBar(), xxxShowSwitchWindow(), xxxTrackCaptionButton(), and xxxTrackPopupMenuEx().

00280 { 00281 PEVENTHOOK peh; 00282 PEVENTHOOK pehNext; 00283 PTHREADINFO ptiCurrent, ptiEvent; 00284 DWORD dwTime; 00285 PPROCESSINFO ppiEvent; 00286 DWORD idEventThread; 00287 HANDLE hEventProcess; 00288 PNOTIFY pNotify; 00289 TL tlpwnd; 00290 TL tlpti; 00291 00292 /* 00293 * Do not bother with CheckLock(pwnd) - we ThreadLock it below. 00294 */ 00295 UserAssert(FWINABLE()); 00296 00297 /* 00298 * This thread is in startup, and has not yet had it's pti set up 00299 * This is pretty rare, but sometimes encountered in stress. 00300 * Test gptiCurrent to avoid the UserAssert(gptiCurrent) in PtiCurrent() 00301 */ 00302 if (gptiCurrent == NULL) { 00303 RIPMSG3(RIP_WARNING, "Ignore WinEvent %lx %#p %lx... no PtiCurrent yet", 00304 event, pwnd, idObject); 00305 return; 00306 } 00307 ptiCurrent = PtiCurrent(); 00308 00309 /* 00310 * Don't bother with destroyed windows 00311 */ 00312 if (pwnd && TestWF(pwnd, WFDESTROYED)) { 00313 RIPMSG3(RIP_WARNING, 00314 "Ignore WinEvent %lx %#p %lx... pwnd already destroyed", 00315 event, pwnd, idObject); 00316 return; 00317 } 00318 00319 /* 00320 * Under some special circumstances we have to defer 00321 */ 00322 if (ptiCurrent->TIF_flags & (TIF_DISABLEHOOKS | TIF_INCLEANUP)) { 00323 dwFlags |= WEF_DEFERNOTIFY; 00324 } 00325 00326 /* 00327 * Determine process and thread issuing the event notification 00328 */ 00329 if ((dwFlags & WEF_USEPWNDTHREAD) && pwnd) { 00330 ptiEvent = GETPTI(pwnd); 00331 } else { 00332 ptiEvent = ptiCurrent; 00333 } 00334 idEventThread = TIDq(ptiEvent); 00335 ppiEvent = ptiEvent->ppi; 00336 hEventProcess = ptiEvent->pEThread->Cid.UniqueProcess; 00337 00338 dwTime = NtGetTickCount(); 00339 00340 ThreadLockWithPti(ptiCurrent, pwnd, &tlpwnd); 00341 ThreadLockPti(ptiCurrent, ptiEvent, &tlpti); 00342 00343 /* 00344 * If we're not deferring the current notification process any pending 00345 * deferred notifications before proceeding with the current notification 00346 */ 00347 if (!(dwFlags & WEF_DEFERNOTIFY)) { 00348 xxxFlushDeferredWindowEvents(); 00349 } 00350 00351 for (peh = gpWinEventHooks; peh; peh = pehNext) { 00352 DBGVERIFYEVENTHOOK(peh); 00353 pehNext = peh->pehNext; 00354 00355 // 00356 // Is event in the right range? And is it for this process/thread? 00357 // Note that we skip destroyed events. They will be freed any 00358 // second now, it's just that yielding may have caused reentrancy. 00359 // 00360 // If the caller said to ignore events on his own thread, make sure 00361 // we skip them. 00362 // 00363 if (!peh->fDestroyed && 00364 (peh->eventMin <= event) && 00365 (event <= peh->eventMax) && 00366 (!peh->hEventProcess || (peh->hEventProcess == hEventProcess)) && 00367 (!peh->fIgnoreOwnProcess || (ppiEvent != GETPTI(peh)->ppi)) && 00368 (!peh->idEventThread || (peh->idEventThread == idEventThread)) && 00369 (!peh->fIgnoreOwnThread || (ptiEvent != GETPTI(peh))) && 00370 // temp fix from SP3 - best to architect events on a per-desktop 00371 // basis, with a separate pWinEventHook list per desktop. (IanJa) 00372 (peh->head.pti->rpdesk == ptiCurrent->rpdesk)) 00373 { 00374 /* 00375 * Don't create new notifications for zombie event hooks. 00376 * When an event is destroyed, it stays as a zombie until the in-use 00377 * count goes to zero (all it's async and deferred notifies gone) 00378 */ 00379 if (HMIsMarkDestroy(peh)) { 00380 break; 00381 } 00382 00383 UserAssert(peh->fDestroyed == 0); 00384 00385 if ((pNotify = CreateNotify(peh, event, pwnd, idObject, 00386 idChild, ptiEvent, dwTime)) == NULL) { 00387 break; 00388 } 00389 pNotify->dwWEFlags |= dwFlags; 00390 00391 /* 00392 * If it's async, don't defer it: post it straight away. 00393 */ 00394 if (pNotify->dwWEFlags & WEF_ASYNC) { 00395 pNotify->dwWEFlags &= ~WEF_DEFERNOTIFY; 00396 } 00397 00398 if (pNotify->dwWEFlags & WEF_DEFERNOTIFY) { 00399 #if DBG 00400 gnDeferredWinEvents++; 00401 #endif 00402 DBGVERIFYNOTIFY(pNotify); 00403 } else { 00404 pehNext = xxxProcessNotifyWinEvent(pNotify); 00405 } 00406 } 00407 } 00408 00409 ThreadUnlockPti(ptiCurrent, &tlpti); 00410 ThreadUnlock(&tlpwnd); 00411 }

PWND xxxWindowFromPoint POINT  pt  ) 
 

Definition at line 128 of file winwhere.c.

References _GetDesktopWindow(), NULL, RevalidateHwnd, ThreadLock, ThreadUnlock, WHT_IGNOREDISABLED, and xxxWindowHitTest2().

Referenced by NtUserWindowFromPoint().

00130 { 00131 HWND hwnd; 00132 PWND pwndT; 00133 TL tlpwndT; 00134 00135 pwndT = _GetDesktopWindow(); 00136 ThreadLock(pwndT, &tlpwndT); 00137 00138 hwnd = xxxWindowHitTest2(pwndT, pt, NULL, WHT_IGNOREDISABLED); 00139 00140 ThreadUnlock(&tlpwndT); 00141 00142 return RevalidateHwnd(hwnd); 00143 }

HWND xxxWindowHitTest PWND  pwnd,
POINT  pt,
int *  pipos,
DWORD  dwHitTestFlags
 

Definition at line 274 of file winwhere.c.

References CheckLock, NULL, tagWND::spwndNext, ThreadLockExchangeAlways(), ThreadLockNever, ThreadUnlock, and xxxWindowHitTest2().

Referenced by xxxHelpLoop(), xxxScanSysQueue(), and xxxWindowHitTest2().

00279 { 00280 HWND hwndT; 00281 TL tlpwnd; 00282 00283 CheckLock(pwnd); 00284 00285 hwndT = NULL; 00286 ThreadLockNever(&tlpwnd); 00287 while (pwnd != NULL) { 00288 ThreadLockExchangeAlways(pwnd, &tlpwnd); 00289 hwndT = xxxWindowHitTest2(pwnd, pt, piPos, dwHitTestFlags); 00290 if (hwndT != NULL) 00291 break; 00292 00293 pwnd = pwnd->spwndNext; 00294 } 00295 00296 ThreadUnlock(&tlpwnd); 00297 return hwndT; 00298 }

HWND xxxWindowHitTest2 PWND  pwnd,
POINT  pt,
int *  pipos,
DWORD  dwHitTestFlags
 

Definition at line 315 of file winwhere.c.

References CheckLock, CheckPwndFilter(), GETPTI, tagWND::hrgnClip, HWq, LayerHitTest(), NULL, PpiCurrent, PtiCurrent, PtInRect(), tagWND::rcClient, tagWND::rcWindow, SizeBoxHwnd(), tagWND::spwndChild, TestWF, TestwndChild, ThreadLock, ThreadUnlock, WEFLAYERED, WFDISABLED, WFMINIMIZED, WFSIZEBOX, WFVISIBLE, WHT_IGNOREDISABLED, xxxSendMessage(), and xxxWindowHitTest().

Referenced by xxxWindowFromPoint(), and xxxWindowHitTest().

00320 { 00321 int ht = HTERROR, htGrip=HTBOTTOMRIGHT; 00322 HWND hwndT; 00323 TL tlpwndChild; 00324 00325 CheckLock(pwnd); 00326 00327 /* 00328 * Are we at the bottom of the window chain? 00329 */ 00330 if (pwnd == NULL) 00331 return NULL; 00332 00333 /* 00334 * Are we looking at an hidden window? 00335 */ 00336 if (!TestWF(pwnd, WFVISIBLE)) 00337 return NULL; 00338 00339 /* 00340 * Are we barking up the wrong tree? 00341 */ 00342 if (!PtInRect((LPRECT)&pwnd->rcWindow, pt)) { 00343 return NULL; 00344 } 00345 00346 if (pwnd->hrgnClip != NULL) { 00347 if (!GrePtInRegion(pwnd->hrgnClip, pt.x, pt.y)) 00348 return(NULL); 00349 } 00350 00351 if (TestWF(pwnd, WEFLAYERED)) { 00352 if (!LayerHitTest(pwnd, pt)) 00353 return NULL; 00354 } 00355 00356 #ifdef REDIRECTION 00357 /* 00358 * If this is called when the layered window is actually trying 00359 * to process the message then let it see the hit test 00360 */ 00361 if (TestWF(pwnd, WEFREDIRECTED) && PpiCurrent() != GETPTI(pwnd)->ppi) { 00362 return NULL; 00363 } 00364 #endif // REDIRECTION 00365 00366 /* 00367 * Are we looking at an disabled window? 00368 */ 00369 if (TestWF(pwnd, WFDISABLED) && (dwHitTestFlags & WHT_IGNOREDISABLED)) { 00370 if (TestwndChild(pwnd)) { 00371 return NULL; 00372 } else { 00373 ht = HTERROR; 00374 goto Exit; 00375 } 00376 } 00377 00378 #ifdef SYSMODALWINDOWS 00379 /* 00380 * If SysModal window present and we're not in it, return an error. 00381 * Be sure to assign the point to the SysModal window, so the message 00382 * will be sure to be removed from the queue. 00383 */ 00384 if (!CheckPwndFilter(pwnd, gspwndSysModal)) { 00385 pwnd = gspwndSysModal; 00386 00387 /* 00388 * Fix notorious stack overflow bug (some WINABLE fix from Memphis) 00389 */ 00390 ht = HTCLIENT; 00391 goto Exit; 00392 } 00393 #endif 00394 00395 /* 00396 * Are we on a minimized window? 00397 */ 00398 if (!TestWF(pwnd, WFMINIMIZED)) { 00399 /* 00400 * Are we in the window's client area? 00401 */ 00402 if (PtInRect((LPRECT)&pwnd->rcClient, pt)) { 00403 /* 00404 * Recurse through the children. 00405 */ 00406 ThreadLock(pwnd->spwndChild, &tlpwndChild); 00407 hwndT = xxxWindowHitTest(pwnd->spwndChild, 00408 pt, 00409 piPos, 00410 dwHitTestFlags); 00411 00412 ThreadUnlock(&tlpwndChild); 00413 if (hwndT != NULL) 00414 return hwndT; 00415 } 00416 00417 } 00418 00419 /* 00420 * If window not in same task, don't send WM_NCHITTEST. 00421 */ 00422 if (GETPTI(pwnd) != PtiCurrent()) { 00423 ht = HTCLIENT; 00424 goto Exit; 00425 } 00426 00427 /* 00428 * Send the message. 00429 */ 00430 ht = (int)xxxSendMessage(pwnd, WM_NCHITTEST, 0, MAKELONG(pt.x, pt.y)); 00431 00432 /* 00433 * If window is transparent keep enumerating. 00434 */ 00435 if (ht == HTTRANSPARENT) { 00436 return NULL; 00437 } 00438 00439 Exit: 00440 00441 /* 00442 * Set wndpos accordingly. 00443 */ 00444 if (piPos) { 00445 *piPos = ht; 00446 } 00447 00448 /* 00449 * If this is a RTL mirrored window, then the grip is at 00450 * HTBOTTOMLEFT (in terms of screen coordinates since they are 00451 * not RTL mirrored). 00452 */ 00453 if (TestWF(pwnd, WEFLAYOUTRTL)) { 00454 htGrip = HTBOTTOMLEFT; 00455 } 00456 00457 /* 00458 * if the click is in the sizebox of the window and this window itself is 00459 * not sizable, return the window that will be sized by this sizebox 00460 */ 00461 if ((ht == htGrip) && !TestWF(pwnd, WFSIZEBOX)) { 00462 00463 PWND pwndT; 00464 /* 00465 * SizeBoxHwnd() can return NULL! We don't want to act like this 00466 * is transparent if the sizebox isn't a grip 00467 */ 00468 pwnd = (pwndT = SizeBoxHwnd(pwnd)) ? pwndT : pwnd; 00469 } 00470 00471 return HWq(pwnd); 00472 }

VOID ZapActiveAndFocus VOID   ) 
 

Definition at line 16 of file miscutil.c.

References PtiCurrent, tagQ::spwndActive, tagQ::spwndFocus, Unlock, and VOID().

00017 { 00018 PQ pq = PtiCurrent()->pq; 00019 00020 Unlock(&pq->spwndActive); 00021 Unlock(&pq->spwndFocus); 00022 }

VOID ZombieCursor PCURSOR  pcur  ) 
 

Definition at line 156 of file loadbits.c.

References CURSORF_LINKED, gptiRit, HMChangeOwnerProcess, HMPheFromObject, ISTS, NULL, _HANDLEENTRY::pOwner, UnlinkCursor(), and VOID().

Referenced by DestroyProcessesObjects().

00157 { 00158 if (pcur->CURSORF_flags & CURSORF_LINKED) { 00159 UnlinkCursor(pcur); 00160 } 00161 00162 #if DBG 00163 if (ISTS()) { 00164 PHE phe; 00165 phe = HMPheFromObject(pcur); 00166 00167 if (phe->pOwner == NULL) { 00168 RIPMSG2(RIP_ERROR, "NULL owner for cursor %x phe %x\n", 00169 pcur, phe); 00170 } 00171 } 00172 #endif // DBG 00173 00174 HMChangeOwnerProcess(pcur, gptiRit); 00175 00176 RIPMSG1(RIP_WARNING, "ZombieCursor: 0x%08X became a zombie", pcur); 00177 }

void zzzActiveCursorTracking PWND  pwnd  ) 
 

Definition at line 2187 of file ntuser/kernel/input.c.

References BOOL, BoundCursor(), tagLASTINPUT::dwFlags, GetActiveTrackPwnd(), glinp, gptCursorAsync, gspwndCursor, LINP_KEYBOARD, NULL, PtInRect(), tagWND::rcWindow, SetVisible(), SV_SET, SV_UNSET, TestWF, WFVISIBLE, and zzzInternalSetCursorPos().

Referenced by xxxProcessEventMessage(), and xxxSetForegroundWindow2().

02188 { 02189 BOOL fVisible; 02190 POINT pt; 02191 02192 /* 02193 * If the last input event wasn't from the keyboard, bail 02194 * The user is probably moving the mouse. 02195 */ 02196 if (!(glinp.dwFlags & LINP_KEYBOARD)) { 02197 return; 02198 } 02199 /* 02200 * If we're already there, bail. 02201 */ 02202 if (PtInRect((LPRECT)&pwnd->rcWindow, gptCursorAsync)) { 02203 return; 02204 } 02205 /* 02206 * If the window the mouse is on is not "active-trackable", then 02207 * we can leave the mouse right where it is 02208 */ 02209 if ((gspwndCursor != NULL) && (GetActiveTrackPwnd(gspwndCursor, NULL) == NULL)) { 02210 return; 02211 } 02212 /* 02213 * If this window doesn't have a point visible in the screen, bail 02214 */ 02215 pt.x = pwnd->rcWindow.left + ((pwnd->rcWindow.right - pwnd->rcWindow.left) / 2); 02216 pt.y = pwnd->rcWindow.top + ((pwnd->rcWindow.bottom - pwnd->rcWindow.top) / 2); 02217 BoundCursor(&pt); 02218 if (!PtInRect((LPRECT)&pwnd->rcWindow, pt)) { 02219 return; 02220 } 02221 /* 02222 * We need to make sure that this window is marked as visible or someone 02223 * else will be waken up to update the cursor (and might 02224 * activate itself because of the active tracking). 02225 * 02226 * Later5.0 GerardoB: If the window is still not visible when 02227 * it wakes up, then we're out of luck. 02228 */ 02229 fVisible = TestWF(pwnd, WFVISIBLE); 02230 if (!fVisible) { 02231 SetVisible(pwnd, SV_SET); 02232 } 02233 02234 /* 02235 * Move the cursor to the center of this window 02236 */ 02237 zzzInternalSetCursorPos(pt.x, pt.y); 02238 /* 02239 * Restore visible bit. 02240 */ 02241 if (!fVisible) { 02242 SetVisible(pwnd, SV_UNSET); 02243 } 02244 }

BOOL zzzAttachThreadInput PTHREADINFO  ptiAttach,
PTHREADINFO  ptiAttachTo,
BOOL  fAttach
 

Definition at line 6367 of file ntuser/kernel/input.c.

References ATTACHINFO, BOOL, CheckCritIn, tagDESKTOP::dwConsoleIMEThreadId, tagDESKTOP::dwConsoleThreadId, FALSE, FJOURNALPLAYBACK, FJOURNALRECORD, gpai, IS_IME_ENABLED, NULL, tagATTACHINFO::paiNext, tagATTACHINFO::pti1, tagATTACHINFO::pti2, PtiFromThreadId(), tagTHREADINFO::rpdesk, TIF_DONTATTACHQUEUE, tagTHREADINFO::TIF_flags, TRUE, and zzzReattachThreads().

Referenced by NtUserAttachThreadInput(), xxxCreateWindowEx(), xxxDestroyWindow(), xxxHandleOwnerSwitch(), and xxxSetParent().

06371 { 06372 CheckCritIn(); 06373 06374 /* 06375 * Attaching to yourself doesn't make any sense. 06376 */ 06377 if (ptiAttach == ptiAttachTo) 06378 return FALSE; 06379 06380 #if defined(FE_IME) 06381 /* 06382 * For console IME issue 06383 * 06384 * Console IME do attach to console input thread message queue. 06385 * So needs share message queue for synchronize a key state. 06386 */ 06387 if (IS_IME_ENABLED()) { 06388 PTHREADINFO ptiConsoleIME; 06389 PTHREADINFO ptiConsoleInput; 06390 06391 if ( ((ptiConsoleIME = PtiFromThreadId(ptiAttach->rpdesk->dwConsoleIMEThreadId)) != NULL) && 06392 ((ptiConsoleInput = PtiFromThreadId(ptiAttach->rpdesk->dwConsoleThreadId)) != NULL) && 06393 (ptiAttach == ptiConsoleIME) && 06394 (ptiAttachTo == ptiConsoleInput) && 06395 (ptiConsoleIME->TIF_flags & TIF_DONTATTACHQUEUE) 06396 ) 06397 { 06398 goto SkipCheck; 06399 } 06400 } 06401 #endif 06402 /* 06403 * Will this thread allow attaching? Shell threads and system threads 06404 * won't allow attaching. 06405 */ 06406 if (ptiAttachTo->TIF_flags & TIF_DONTATTACHQUEUE) 06407 return FALSE; 06408 if (ptiAttach->TIF_flags & TIF_DONTATTACHQUEUE) 06409 return FALSE; 06410 06411 #if defined(FE_IME) 06412 SkipCheck: 06413 #endif 06414 /* 06415 * Don't allow attaching across desktops, either. 06416 */ 06417 if (ptiAttachTo->rpdesk != ptiAttach->rpdesk) 06418 return FALSE; 06419 06420 /* 06421 * If attaching, make a new attachinfo structure for this thread. 06422 * If not attaching, remove an existing attach reference. 06423 */ 06424 if (fAttach) { 06425 PATTACHINFO pai; 06426 06427 /* 06428 * Alloc a new attachinfo struct, fill it in, link it in. 06429 */ 06430 if ((pai = (PATTACHINFO)UserAllocPool(sizeof(ATTACHINFO), TAG_ATTACHINFO)) == NULL) 06431 return FALSE; 06432 06433 pai->pti1 = ptiAttach; 06434 pai->pti2 = ptiAttachTo;; 06435 pai->paiNext = gpai; 06436 gpai = pai; 06437 } else { 06438 PATTACHINFO *ppai; 06439 BOOL fFound = FALSE; 06440 06441 /* 06442 * Search for this attachinfo struct. If we can't find it, fail. 06443 * If we do find it, unlink it and free it. 06444 */ 06445 for (ppai = &gpai; (*ppai) != NULL; ppai = &(*ppai)->paiNext) { 06446 if (((*ppai)->pti2 == ptiAttachTo) && ((*ppai)->pti1 == ptiAttach)) { 06447 PATTACHINFO paiKill = *ppai; 06448 fFound = TRUE; 06449 *ppai = (*ppai)->paiNext; 06450 UserFreePool((HLOCAL)paiKill); 06451 break; 06452 } 06453 } 06454 06455 /* 06456 * If we couldn't find this reference, then fail. 06457 */ 06458 if (!fFound) { 06459 return FALSE; 06460 } 06461 } 06462 06463 /* 06464 * Now do the actual reattachment work for all threads - unless we're 06465 * journalling. If we did by mistake do attachment while journalling 06466 * was occuring, journalling would be hosed because journalling requires 06467 * all threads to be attached - but it is also treated as a special 06468 * case so it doesn't affect the ATTACHINFO structures. Therefore 06469 * recalcing attach info based on ATTACHINFO structures would break 06470 * the attachment required for journalling. 06471 */ 06472 if (!FJOURNALRECORD() && !FJOURNALPLAYBACK()) 06473 return zzzReattachThreads(FALSE); 06474 06475 return TRUE; 06476 }

void zzzAttachToQueue PTHREADINFO  pti,
PQ  pqAttach,
PQ  pqJournal,
BOOL  fJoiningForeground
 

Definition at line 5940 of file ntuser/kernel/input.c.

References CANCEL_ACTIVESTATE, CANCEL_CAPTURESTATE, CANCEL_FOCUSSTATE, CancelInputState(), tagQ::caret, CheckTransferState(), tagMLIST::cMsgs, tagQ::codeCapture, tagQ::cThreads, CTS_CANCELOLD, CTS_DONOTHING, CTS_TRANSFER, ExitMenuLoop(), tagMENUSTATE::fInDoDragDrop, tagMENUSTATE::fModelessMenu, GETPTI, gspwndCursor, tagQ::iCursorLevel, IsInsideMenuLoop(), Lock, LockCaptureWindow(), LockQCursor, tagQ::mlInput, NULL, tagMENUSTATE::pGlobalPopupMenu, tagTHREADINFO::pMenuState, tagTHREADINFO::pq, tagMLIST::pqmsgRead, tagMLIST::pqmsgWriteLast, tagQ::ptiKeyboard, tagQ::ptiMouse, tagQ::ptiSysLock, QF_ACTIVATIONCHANGE, QF_CAPTURELOCKED, tagQ::QF_flags, RedistributeInput(), tagQ::spcurCurrent, tagCARET::spwnd, tagQ::spwndActive, tagQ::spwndActivePrev, tagQ::spwndCapture, tagQ::spwndFocus, tagWND::spwndNext, Unlock, UnlockCaptureWindow(), and zzzDestroyQueue().

Referenced by xxxHardErrorControl(), xxxSetThreadDesktop(), xxxSwitchDesktop(), zzzReattachThreads(), and zzzSetDesktop().

05945 { 05946 PQMSG pqmsgT; 05947 PQ pqDestroy; 05948 05949 /* 05950 * Check active state. 05951 */ 05952 switch (CheckTransferState(pti, pqAttach, 05953 FIELD_OFFSET(Q, spwndActive), fJoiningForeground)) { 05954 case CTS_CANCELOLD: 05955 CancelInputState(pti, CANCEL_ACTIVESTATE); 05956 break; 05957 05958 case CTS_TRANSFER: 05959 Lock(&pqAttach->spwndActive, pti->pq->spwndActive); 05960 Unlock(&pti->pq->spwndActive); 05961 05962 /* 05963 * The caret usually follows the focus window, which follows 05964 * the active window... 05965 */ 05966 if (pti->pq->caret.spwnd != NULL) { 05967 05968 if (GETPTI(pti->pq->caret.spwnd) == pti) { 05969 /* 05970 * Just copy the entire caret structure... that way we 05971 * don't need to deal with locking/unlocking the spwnd. 05972 */ 05973 if (pqAttach->caret.spwnd == NULL) { 05974 pqAttach->caret = pti->pq->caret; 05975 pti->pq->caret.spwnd = NULL; 05976 } 05977 } 05978 } 05979 break; 05980 } 05981 05982 /* 05983 * Check focus state. 05984 */ 05985 switch (CheckTransferState(pti, pqAttach, 05986 FIELD_OFFSET(Q, spwndFocus), fJoiningForeground)) { 05987 case CTS_CANCELOLD: 05988 CancelInputState(pti, CANCEL_FOCUSSTATE); 05989 break; 05990 05991 case CTS_TRANSFER: 05992 Lock(&pqAttach->spwndFocus, pti->pq->spwndFocus); 05993 Unlock(&pti->pq->spwndFocus); 05994 break; 05995 } 05996 05997 /* 05998 * Check capture state. 05999 */ 06000 switch (CheckTransferState(pti, pqAttach, 06001 FIELD_OFFSET(Q, spwndCapture), fJoiningForeground)) { 06002 case CTS_CANCELOLD: 06003 CancelInputState(pti, CANCEL_CAPTURESTATE); 06004 break; 06005 06006 case CTS_TRANSFER: 06007 LockCaptureWindow(pqAttach, pti->pq->spwndCapture); 06008 UnlockCaptureWindow(pti->pq); 06009 pqAttach->codeCapture = pti->pq->codeCapture; 06010 pqAttach->QF_flags ^= ((pqAttach->QF_flags ^ pti->pq->QF_flags) & QF_CAPTURELOCKED); 06011 break; 06012 06013 #if DBG 06014 case CTS_DONOTHING: 06015 /* 06016 * We should always transfer the capture state of a thread 06017 * in modal menu mode 06018 */ 06019 UserAssert((pti->pMenuState == NULL) 06020 || ExitMenuLoop(pti->pMenuState, pti->pMenuState->pGlobalPopupMenu) 06021 || pti->pMenuState->fModelessMenu 06022 || pti->pMenuState->fInDoDragDrop); 06023 06024 break; 06025 #endif 06026 } 06027 06028 /* 06029 * Check spwndActivePrev state. This check has some considerations. 06030 * If the CTS_TRANSFER is returned, it usually means there was no 06031 * prev-active in the attach-queue, and it will use the first 06032 * window it encounters. Since we walk the thread-list, a out-of-zorder 06033 * window could be chosen. So, to counter this, we'll check the 06034 * attach-queue-next-prev against the thread-previous window to see 06035 * if it is truly the next-zorder window. 06036 */ 06037 switch (CheckTransferState(pti, pqAttach, 06038 FIELD_OFFSET(Q, spwndActivePrev), fJoiningForeground)) { 06039 case CTS_TRANSFER: 06040 Lock(&pqAttach->spwndActivePrev, pti->pq->spwndActivePrev); 06041 Unlock(&pti->pq->spwndActivePrev); 06042 break; 06043 06044 case CTS_CANCELOLD: 06045 06046 /* 06047 * Check to see if the previous window is what we would expect it 06048 * to be. 06049 */ 06050 if (pqAttach->spwndActive && 06051 (pqAttach->spwndActivePrev && pti->pq->spwndActivePrev) && 06052 (pqAttach->spwndActive->spwndNext == pti->pq->spwndActivePrev)) { 06053 06054 Lock(&pqAttach->spwndActivePrev, pti->pq->spwndActivePrev); 06055 Unlock(&pti->pq->spwndActivePrev); 06056 } 06057 break; 06058 } 06059 06060 if (pti == pti->pq->ptiSysLock) { 06061 /* 06062 * Preserve any of the flags we might have already been set on pqAttach. 06063 * Note that these flags might have been set on a previous call 06064 * to this function that received the same pqAttach 06065 */ 06066 pqAttach->QF_flags ^= ((pqAttach->QF_flags ^ pti->pq->QF_flags) 06067 & ~(QF_CAPTURELOCKED)); 06068 06069 /* 06070 * Fix for 29967 "Start menu disappears when clicked and Office 06071 * taskbar has focus!". Win95 uses a global counter instead of this 06072 * flag. In NT when we click on Office taskbar and then on the Start 06073 * Menu, MSoffice calls zzzAttachThreadInput() which changes the Start 06074 * Menu's queue and the new queue has the QF_ACTIVATIONCHANGE flag on. 06075 * Inside the xxxMNLoop we test if this flag is on and if it is we 06076 * exit the menu. 06077 */ 06078 if (!IsInsideMenuLoop(pti)) { 06079 pqAttach->QF_flags &= ~QF_ACTIVATIONCHANGE; 06080 } 06081 06082 /* 06083 * Unlock the queue since pti is moving to anotther queue. 06084 */ 06085 /* CheckSysLock(6, pq, NULL); what number? */ 06086 pti->pq->ptiSysLock = NULL; 06087 } 06088 06089 if (gspwndCursor != NULL && pti == GETPTI(gspwndCursor)) { 06090 LockQCursor(pqAttach, pti->pq->spcurCurrent); 06091 } 06092 06093 /* 06094 * Each thread has its own cursor level, which is a count of the number 06095 * of times that app has called show/hide cursor. This gets added into 06096 * the queue's count for a completely accurate count every time this 06097 * queue recalculation is done. 06098 */ 06099 /* 06100 * LATER 06101 * We need to adjust the iCursorLevel of the old queue to reflect 06102 * the fact that a thread is departing. 06103 * FritzS 06104 */ 06105 pqAttach->iCursorLevel += pti->iCursorLevel; 06106 06107 /* 06108 * Pump up the new queue with the right input variables. 06109 */ 06110 pqAttach->ptiMouse = pti; 06111 pqAttach->ptiKeyboard = pti; 06112 06113 pqDestroy = pti->pq; 06114 06115 /* 06116 * Don't increment the thread count here because we already incremented 06117 * it when we put it in pti->pqAttach. Since we're moving it from pqAttach 06118 * to pq, we don't mess with the reference count. 06119 */ 06120 pti->pq = pqAttach; 06121 06122 /* 06123 * If the thread is using the journal queue, leave the message list 06124 * alone. Otherwise, redistribute the messages. 06125 */ 06126 if (pqDestroy != pqJournal) { 06127 06128 /* 06129 * Remember the current message list so it can get redistributed taking 06130 * into account ptiAttach's new queue. 06131 */ 06132 pqmsgT = pqDestroy->mlInput.pqmsgRead; 06133 pqDestroy->mlInput.pqmsgRead = NULL; 06134 pqDestroy->mlInput.pqmsgWriteLast = NULL; 06135 pqDestroy->mlInput.cMsgs = 0; 06136 06137 /* 06138 * Now redistribute the input messages from the old queue they go into the 06139 * right queues. 06140 * 06141 * Preserve the 'idSysPeek' when redistributing the queue 06142 */ 06143 RedistributeInput(pqmsgT, pqDestroy); 06144 06145 /* 06146 * Officially attach the new queue to this thread. Note that zzzDestroyQueue() 06147 * doesn't actually destroy anything until the thread reference count goes 06148 * to 0. 06149 */ 06150 zzzDestroyQueue(pqDestroy, pti); 06151 06152 } else { 06153 UserAssert(pqDestroy->cThreads); 06154 pqDestroy->cThreads--; 06155 } 06156 }

void zzzCalcStartCursorHide PW32PROCESS  Process,
DWORD  timeAdd
 

Definition at line 591 of file queue.c.

References ComputeTickDelta(), DWORD, gpwpCalcFirst, gtimeStartCursorHide, NtGetTickCount(), NULL, and zzzUpdateCursorImage().

Referenced by DestroyProcessInfo(), xxxCreateThreadInfo(), xxxHungAppDemon(), xxxInternalGetMessage(), xxxSetProcessInitState(), zzzChangeStates(), zzzInitTask(), zzzShowStartGlass(), and zzzWakeInputIdle().

00594 { 00595 DWORD timeNow; 00596 PW32PROCESS pwpT; 00597 PW32PROCESS *ppwpT; 00598 00599 00600 timeNow = NtGetTickCount(); 00601 00602 if (pwp != NULL) { 00603 00604 /* 00605 * We were passed in a timeout. Recalculate when we timeout 00606 * and add the pwp to the starting list. 00607 */ 00608 if (!(pwp->W32PF_Flags & W32PF_STARTGLASS)) { 00609 00610 /* 00611 * Add it to the list only if it is not already in the list 00612 */ 00613 for (pwpT = gpwpCalcFirst; pwpT != NULL; pwpT = pwpT->NextStart) { 00614 if (pwpT == pwp) 00615 break; 00616 } 00617 00618 if (pwpT != pwp) { 00619 pwp->NextStart = gpwpCalcFirst; 00620 gpwpCalcFirst = pwp; 00621 } 00622 } 00623 pwp->StartCursorHideTime = timeAdd + timeNow; 00624 pwp->W32PF_Flags |= W32PF_STARTGLASS; 00625 } 00626 00627 gtimeStartCursorHide = 0; 00628 for (ppwpT = &gpwpCalcFirst; (pwpT = *ppwpT) != NULL; ) { 00629 00630 /* 00631 * If the app isn't starting or feedback is forced off, remove 00632 * it from the list so we don't look at it again. 00633 */ 00634 if (!(pwpT->W32PF_Flags & W32PF_STARTGLASS) || 00635 (pwpT->W32PF_Flags & W32PF_FORCEOFFFEEDBACK)) { 00636 *ppwpT = pwpT->NextStart; 00637 continue; 00638 } 00639 00640 /* 00641 * Find the greatest hide cursor timeout value. 00642 */ 00643 if (gtimeStartCursorHide < pwpT->StartCursorHideTime) 00644 gtimeStartCursorHide = pwpT->StartCursorHideTime; 00645 00646 /* 00647 * If this app has timed out, it isn't starting anymore! 00648 * Remove it from the list. 00649 */ 00650 if (ComputeTickDelta(timeNow, pwpT->StartCursorHideTime) > 0) { 00651 pwpT->W32PF_Flags &= ~W32PF_STARTGLASS; 00652 *ppwpT = pwpT->NextStart; 00653 continue; 00654 } 00655 00656 /* 00657 * Step to the next pwp in the list. 00658 */ 00659 ppwpT = &pwpT->NextStart; 00660 } 00661 00662 /* 00663 * If the hide time is still less than the current time, then turn off 00664 * the app starting cursor. 00665 */ 00666 if (gtimeStartCursorHide <= timeNow) 00667 gtimeStartCursorHide = 0; 00668 00669 /* 00670 * Update the cursor image with the new info (doesn't do anything unless 00671 * the cursor is really changing). 00672 */ 00673 zzzUpdateCursorImage(); 00674 }

void zzzCancelJournalling void   ) 
 

Definition at line 404 of file hooks.c.

References _PostThreadMessage(), ClrWF, CMSWAITTOKILLTIMEOUT, DeferWinEventNotify, gppiLockSFW, gptiRit, grpdeskRitInput, gwMouseOwnerButton, tagHOOK::head, InterQueueMsgCleanup(), NULL, tagDESKTOP::pDeskInfo, tagTHREADINFO::pDeskInfo, PhkFirstGlobalValid(), PhkNextValid(), SendMsgCleanup(), tagDESKTOPINFO::spwnd, TestWF, WFDISABLED, zzzEndDeferWinEventNotify, and zzzUnhookWindowsHookEx().

Referenced by xxxDoHotKeyStuff(), and xxxSwitchDesktop().

00405 { 00406 PTHREADINFO ptiCancelJournal; 00407 PHOOK phook; 00408 PHOOK phookNext; 00409 00410 /* 00411 * Mouse buttons sometimes get stuck down due to hardware glitches, 00412 * usually due to input concentrator switchboxes or faulty serial 00413 * mouse COM ports, so clear the global button state here just in case, 00414 * otherwise we may not be able to change focus with the mouse. 00415 * Also do this in Alt-Tab processing. 00416 */ 00417 #if DBG 00418 if (gwMouseOwnerButton) 00419 RIPMSG1(RIP_WARNING, 00420 "gwMouseOwnerButton=%x, being cleared forcibly\n", 00421 gwMouseOwnerButton); 00422 #endif 00423 gwMouseOwnerButton = 0; 00424 00425 /* 00426 * Remove journal hooks. This'll cause threads to associate with 00427 * different queues. 00428 * DeferWinEventNotify() so we can traverse the phook list safely 00429 */ 00430 DeferWinEventNotify(); 00431 UserAssert(gptiRit->pDeskInfo == grpdeskRitInput->pDeskInfo); 00432 phook = PhkFirstGlobalValid(gptiRit, WH_JOURNALPLAYBACK); 00433 while (phook != NULL) { 00434 ptiCancelJournal = phook->head.pti; 00435 00436 if (ptiCancelJournal != NULL) { 00437 /* 00438 * Let the thread that set the journal hook know this is happening. 00439 */ 00440 _PostThreadMessage(ptiCancelJournal, WM_CANCELJOURNAL, 0, 0); 00441 00442 /* 00443 * If there was an app waiting for a response back from the journal 00444 * application, cancel that request so the app can continue running 00445 * (for example, we don't want winlogon or console to wait for an 00446 * app that may be hung!) 00447 */ 00448 SendMsgCleanup(ptiCancelJournal); 00449 } 00450 00451 phookNext = PhkNextValid(phook); 00452 zzzUnhookWindowsHookEx(phook); // May free phook memory 00453 phook = phookNext; 00454 } 00455 zzzEndDeferWinEventNotify(); 00456 00457 /* 00458 * DeferWinEventNotify() so we can traverse the phook list safely 00459 */ 00460 DeferWinEventNotify(); 00461 UserAssert(gptiRit->pDeskInfo == grpdeskRitInput->pDeskInfo); 00462 phook = PhkFirstGlobalValid(gptiRit, WH_JOURNALRECORD); 00463 while (phook != NULL) { 00464 ptiCancelJournal = phook->head.pti; 00465 00466 if (ptiCancelJournal != NULL) { 00467 /* 00468 * Let the thread that set the journal hook know this is happening. 00469 */ 00470 _PostThreadMessage(ptiCancelJournal, WM_CANCELJOURNAL, 0, 0); 00471 00472 /* 00473 * If there was an app waiting for a response back from the journal 00474 * application, cancel that request so the app can continue running 00475 * (for example, we don't want winlogon or console to wait for an 00476 * app that may be hung!) 00477 */ 00478 SendMsgCleanup(ptiCancelJournal); 00479 } 00480 00481 phookNext = PhkNextValid(phook); 00482 zzzUnhookWindowsHookEx(phook); // May free phook memory 00483 phook = phookNext; 00484 } 00485 zzzEndDeferWinEventNotify(); 00486 00487 00488 /* 00489 * Make sure journalling ssync mode didn't hose any one 00490 */ 00491 InterQueueMsgCleanup(CMSWAITTOKILLTIMEOUT); 00492 00493 /* 00494 * Unlock SetForegroundWindow (if locked) 00495 */ 00496 gppiLockSFW = NULL; 00497 00498 /* 00499 * NT5's last minute hack for evil applications, who disables the desktop window 00500 * (perhaps by accidents though) leaving the system pretty unusable. 00501 * See Raid #423704. 00502 */ 00503 if (grpdeskRitInput && grpdeskRitInput->pDeskInfo) { 00504 PWND pwndDesktop = grpdeskRitInput->pDeskInfo->spwnd; 00505 00506 if (pwndDesktop && TestWF(pwndDesktop, WFDISABLED)) { 00507 ClrWF(pwndDesktop, WFDISABLED); 00508 } 00509 } 00510 }

BOOL zzzClipCursor LPCRECT  prcClip  ) 
 

Definition at line 216 of file ntuser/kernel/cursor.c.

References BOOL, CheckWinstaWriteAttributesAccess(), FALSE, gpDispInfo, gpepCSRSS, gpqForeground, gpsi, grcCursorClip, IsRectEmpty(), max, min, NULL, PsGetCurrentProcess, PtiCurrent, PtInRect(), tagDISPLAYINFO::rcScreen, TRUE, and zzzInternalSetCursorPos().

Referenced by NtUserClipCursor(), xxxDWP_DoCancelMode(), xxxMoveSize(), xxxMS_TrackMove(), xxxProcessEventMessage(), xxxResetDisplayDevice(), xxxSetForegroundWindow2(), and xxxTrackInitSize().

00218 { 00219 PEPROCESS Process = PsGetCurrentProcess(); 00220 00221 /* 00222 * Don't let this happen if it doesn't have access. 00223 */ 00224 if (Process != gpepCSRSS && !CheckWinstaWriteAttributesAccess()) { 00225 return FALSE; 00226 } 00227 00228 /* 00229 * The comment from NT 3.51: 00230 * Non-foreground threads can only set the clipping rectangle 00231 * if it was empty, or if they are restoring it to the whole screen. 00232 * 00233 * But the code from NT 3.51 says "IsRectEmpty" instead of 00234 * "!IsRectEmpty", as would follow from the comment. We leave 00235 * the code as it was, as following the comment appears to 00236 * break apps. 00237 * 00238 * CONSIDER: Removing this test altogether after NT4.0 ships. 00239 */ 00240 if ( PtiCurrent()->pq != gpqForeground && 00241 prcClip != NULL && 00242 IsRectEmpty(&grcCursorClip)) { 00243 RIPERR0(ERROR_ACCESS_DENIED, RIP_WARNING, "Access denied in _ClipCursor"); 00244 return FALSE; 00245 } 00246 00247 if (prcClip == NULL) { 00248 00249 grcCursorClip = gpDispInfo->rcScreen; 00250 00251 } else { 00252 00253 /* 00254 * Never let our cursor leave the screen. Can't use IntersectRect() 00255 * because it doesn't allow rects with 0 width or height. 00256 */ 00257 grcCursorClip.left = max(gpDispInfo->rcScreen.left , prcClip->left); 00258 grcCursorClip.right = min(gpDispInfo->rcScreen.right , prcClip->right); 00259 grcCursorClip.top = max(gpDispInfo->rcScreen.top , prcClip->top); 00260 grcCursorClip.bottom = min(gpDispInfo->rcScreen.bottom, prcClip->bottom); 00261 00262 /* 00263 * Check for invalid clip rect. 00264 */ 00265 if (grcCursorClip.left > grcCursorClip.right || 00266 grcCursorClip.top > grcCursorClip.bottom) { 00267 00268 grcCursorClip = gpDispInfo->rcScreen; 00269 } 00270 } 00271 00272 /* 00273 * Update the cursor position if it's currently outside the 00274 * cursor clip-rect. 00275 */ 00276 if (!PtInRect(&grcCursorClip, gpsi->ptCursor)) { 00277 zzzInternalSetCursorPos(gpsi->ptCursor.x, gpsi->ptCursor.y); 00278 } 00279 00280 return TRUE; 00281 }

BOOL zzzDestroyCaret VOID   ) 
 

void zzzDestroyQueue PQ  pq,
PTHREADINFO  pti
 

Definition at line 2211 of file queue.c.

References BOOL, tagQ::caret, CheckSysLock, tagQ::cLockCount, tagQ::cThreads, DebugValidateMLIST, FALSE, FreeMessageList(), FreeQueue(), tagCLIENTTHREADINFO::fsWakeBits, gpqCursor, gpqForeground, gpqForegroundPrev, LockQCursor, tagQ::mlInput, NULL, tagTHREADINFO::pcti, tagTHREADINFO::pq, tagQ::ptiKeyboard, tagDESKTOP::PtiList, tagQ::ptiMouse, tagQ::ptiSysLock, tagQ::QF_flags, QF_INDESTROY, tagTHREADINFO::rpdesk, SetWakeBit(), tagCARET::spwnd, tagQ::spwndActive, tagQ::spwndActivePrev, tagQ::spwndFocus, tagTHREADINFO::TIF_flags, TIF_INCLEANUP, TRUE, Unlock, UnlockCaptureWindow(), USHORT, and zzzSetFMouseMoved().

Referenced by xxxDesktopThread(), xxxDestroyThreadInfo(), zzzAddAttachment(), zzzAttachToQueue(), and zzzReattachThreads().

02214 { 02215 PTHREADINFO ptiT; 02216 PTHREADINFO ptiAny, ptiBestMouse, ptiBestKey; 02217 PLIST_ENTRY pHead, pEntry; 02218 02219 #if DBG 02220 USHORT cDying = 0; 02221 #endif 02222 02223 BOOL fSetFMouseMoved = FALSE; 02224 02225 DebugValidateMLIST(&pq->mlInput); 02226 02227 UserAssert(pq->cThreads); 02228 pq->cThreads--; 02229 02230 if (pq->cThreads != 0) { 02231 02232 /* 02233 * Since we aren't going to destroy this queue, make sure 02234 * it isn't pointing to the THREADINFO that's going away. 02235 */ 02236 if (pq->ptiSysLock == pti) { 02237 CheckSysLock(6, pq, NULL); 02238 pq->ptiSysLock = NULL; 02239 } 02240 02241 if ((pq->ptiKeyboard == pti) || (pq->ptiMouse == pti)) { 02242 02243 /* 02244 * Run through THREADINFOs looking for one pointing to pq. 02245 */ 02246 ptiAny = NULL; 02247 ptiBestMouse = NULL; 02248 ptiBestKey = NULL; 02249 02250 pHead = &pti->rpdesk->PtiList; 02251 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 02252 ptiT = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 02253 02254 /* 02255 * Skip threads that are going away or belong to a 02256 * different queue. 02257 */ 02258 if ((ptiT->TIF_flags & TIF_INCLEANUP) || (ptiT->pq != pq)) { 02259 #if DBG 02260 if (ptiT->pq == pq && (ptiT->TIF_flags & TIF_INCLEANUP)) 02261 cDying++; 02262 #endif 02263 continue; 02264 } 02265 02266 ptiAny = ptiT; 02267 02268 if (pti->pcti->fsWakeBits & QS_MOUSE) { 02269 if (ptiT->pcti->fsWakeMask & QS_MOUSE) 02270 ptiBestMouse = ptiT; 02271 } 02272 02273 if (pti->pcti->fsWakeBits & QS_KEY) { 02274 if (ptiT->pcti->fsWakeMask & QS_KEY) 02275 ptiBestKey = ptiT; 02276 } 02277 } 02278 02279 if (ptiBestMouse == NULL) 02280 ptiBestMouse = ptiAny; 02281 if (ptiBestKey == NULL) 02282 ptiBestKey = ptiAny; 02283 02284 /* 02285 * Transfer any wake-bits to this new queue. This 02286 * is a common problem for QS_MOUSEMOVE which doesn't 02287 * get set on coalesced WM_MOUSEMOVE events, so we 02288 * need to make sure the new thread tries to process 02289 * any input waiting in the queue. 02290 */ 02291 if (ptiBestMouse != NULL) 02292 SetWakeBit(ptiBestMouse, pti->pcti->fsWakeBits & QS_MOUSE); 02293 if (ptiBestKey != NULL) 02294 SetWakeBit(ptiBestKey, pti->pcti->fsWakeBits & QS_KEY); 02295 02296 if (pq->ptiKeyboard == pti) 02297 pq->ptiKeyboard = ptiBestKey; 02298 02299 if (pq->ptiMouse == pti) 02300 pq->ptiMouse = ptiBestMouse; 02301 02302 #if DBG 02303 /* 02304 * Bad things happen if ptiKeyboard or ptiMouse are NULL 02305 */ 02306 if (pq->cThreads != cDying && (pq->ptiKeyboard == NULL || pq->ptiMouse == NULL)) { 02307 RIPMSG6(RIP_ERROR, 02308 "pq %#p pq->cThreads %x cDying %x pti %#p ptiK %#p ptiM %#p", 02309 pq, pq->cThreads, cDying, pti, pq->ptiKeyboard, pq->ptiMouse); 02310 } 02311 #endif 02312 } 02313 02314 return; 02315 } 02316 02317 /* 02318 * Unlock any potentially locked globals now that we know absolutely 02319 * that this queue is going away. 02320 */ 02321 UnlockCaptureWindow(pq); 02322 Unlock(&pq->spwndFocus); 02323 Unlock(&pq->spwndActive); 02324 Unlock(&pq->spwndActivePrev); 02325 Unlock(&pq->caret.spwnd); 02326 LockQCursor(pq, NULL); 02327 02328 #if DBG 02329 /* 02330 * Mark this queue as being in the destruction process. This is 02331 * cleared in FreeQueue() once we have determined it's safe to 02332 * place in the free-list, or destroy the handle. We use this 02333 * to track cases where someone will lock a cursor into the queue 02334 * while it's in the middle of being destroyed. 02335 */ 02336 pq->QF_flags |= QF_INDESTROY; 02337 #endif 02338 02339 /* 02340 * Free everything else that was allocated/created by AllocQueue. 02341 */ 02342 FreeMessageList(&pq->mlInput); 02343 02344 /* 02345 * If this queue is in the foreground, set gpqForeground 02346 * to NULL so no input is routed. At some point we'll want 02347 * to do slightly more clever assignment of gpqForeground here. 02348 */ 02349 if (gpqForeground == pq) { 02350 gpqForeground = NULL; 02351 } 02352 02353 if (gpqForegroundPrev == pq) { 02354 gpqForegroundPrev = NULL; 02355 } 02356 02357 if (gpqCursor == pq) { 02358 gpqCursor = NULL; 02359 fSetFMouseMoved = TRUE; 02360 } 02361 02362 if (pq->cLockCount == 0) { 02363 FreeQueue(pq); 02364 } 02365 02366 if (fSetFMouseMoved) { 02367 zzzSetFMouseMoved(); 02368 } 02369 02370 }

BOOL zzzHideCaret PWND   ) 
 

Definition at line 434 of file caret.c.

References BOOL, FALSE, TRUE, UT_CaretSet(), and zzzInternalHideCaret().

Referenced by NtUserHideCaret(), and xxxSBWndProc().

00436 { 00437 if (UT_CaretSet(pwnd)) { 00438 zzzInternalHideCaret(); 00439 return TRUE; 00440 } 00441 return FALSE; 00442 }

void zzzHideCursorNoCapture void   ) 
 

Definition at line 701 of file ntuser/kernel/cursor.c.

References GetAppCompatFlags2(), NULL, tagTHREADINFO::pq, PtiCurrentShared, tagQ::spwndCapture, VER40, and zzzSetCursor().

00702 { 00703 PTHREADINFO ptiCurrent = PtiCurrentShared(); 00704 00705 if (!ptiCurrent->pq->spwndCapture && (GetAppCompatFlags2(VER40) & GACF2_EDITNOMOUSEHIDE) == 0) { 00706 zzzSetCursor(NULL); 00707 } 00708 }

NTSTATUS zzzInitTask UINT  dwExpWinVer,
DWORD  dwAppCompatFlags,
PUNICODE_STRING  pstrModName,
PUNICODE_STRING  pstrBaseFileName,
DWORD  hTaskWow,
DWORD  dwHotkey,
DWORD  idTask,
DWORD  dwX,
DWORD  dwY,
DWORD  dwXSize,
DWORD  dwYSize
 

Definition at line 1147 of file queue.c.

References tagUSERSTARTUPINFO::cb, CW2_USEDEFAULT, DeferWinEventNotify, _CLIENTINFO::dwCompatFlags, tagTHREADINFO::dwCompatFlags, _CLIENTINFO::dwExpWinVer, tagTHREADINFO::dwExpWinVer, tagUSERSTARTUPINFO::dwFlags, tagPROCESSINFO::dwHotkey, DWORD, _CLIENTINFO::dwTIFlags, tagUSERSTARTUPINFO::dwX, tagUSERSTARTUPINFO::dwXSize, tagUSERSTARTUPINFO::dwY, tagUSERSTARTUPINFO::dwYSize, EnterWowCritSect(), FALSE, FJOURNALPLAYBACK, FJOURNALRECORD, gpwtiFirst, tagTDB::hTaskWow, tagWOWTHREADINFO::idTask, InsertTask(), tagTDB::nEvents, NORMAL_PRIORITY_TASK, tagTDB::nPriority, NTSTATUS(), NULL, tagTHREADINFO::pClientInfo, tagTHREADINFO::ppi, tagTHREADINFO::pstrAppName, tagTHREADINFO::ptdb, tagTDB::ptdbNext, tagTDB::pti, PtiCurrent, tagPROCESSINFO::ptiList, tagTDB::pwti, tagWOWTHREADINFO::pwtiNext, SetAppImeCompatFlags(), SetAppStarting(), TDB, tagTDB::TDB_Flags, TDBF_SETUP, TIF_16BIT, TIF_FIRSTIDLE, tagTHREADINFO::TIF_flags, TIF_SHAREDWOW, tagPROCESSINFO::usi, zzzCalcStartCursorHide(), zzzEndDeferWinEventNotify, zzzReattachThreads(), and zzzShowStartGlass().

Referenced by NtUserInitTask().

01159 { 01160 PTHREADINFO ptiCurrent; 01161 PTDB ptdb; 01162 PPROCESSINFO ppi; 01163 PWOWTHREADINFO pwti; 01164 01165 ptiCurrent = PtiCurrent(); 01166 ppi = ptiCurrent->ppi; 01167 01168 /* 01169 * Set the real name of the module. (Instead of 'NTVDM') 01170 * We've already probed pstrModName->Buffer for Length+sizeof(WCHAR) so 01171 * we can copy the UNICODE_NULL terminator as well. 01172 */ 01173 if (ptiCurrent->pstrAppName != NULL) 01174 UserFreePool(ptiCurrent->pstrAppName); 01175 ptiCurrent->pstrAppName = UserAllocPoolWithQuota(sizeof(UNICODE_STRING) + 01176 pstrModName->Length + sizeof(WCHAR), TAG_TEXT); 01177 if (ptiCurrent->pstrAppName != NULL) { 01178 ptiCurrent->pstrAppName->Buffer = (PWCHAR)(ptiCurrent->pstrAppName + 1); 01179 try { 01180 RtlCopyMemory(ptiCurrent->pstrAppName->Buffer, pstrModName->Buffer, 01181 pstrModName->Length); 01182 ptiCurrent->pstrAppName->Buffer[pstrModName->Length / sizeof(WCHAR)] = 0; 01183 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01184 UserFreePool(ptiCurrent->pstrAppName); 01185 ptiCurrent->pstrAppName = NULL; 01186 return STATUS_OBJECT_NAME_INVALID; 01187 } 01188 ptiCurrent->pstrAppName->MaximumLength = pstrModName->Length + sizeof(WCHAR); 01189 ptiCurrent->pstrAppName->Length = pstrModName->Length; 01190 } else 01191 return STATUS_OBJECT_NAME_INVALID; 01192 01193 /* 01194 * An app is starting! 01195 */ 01196 if (!(ppi->W32PF_Flags & W32PF_APPSTARTING)) { 01197 SetAppStarting(ppi); 01198 } 01199 01200 /* 01201 * We never want to use the ShowWindow defaulting mechanism for WOW 01202 * apps. If STARTF_USESHOWWINDOW was set in the client-side 01203 * STARTUPINFO structure, WOW has already picked it up and used 01204 * it for the first (command-line) app. 01205 */ 01206 ppi->usi.dwFlags &= ~STARTF_USESHOWWINDOW; 01207 01208 /* 01209 * If WOW passed us a hotkey for this app, save it for CreateWindow's use. 01210 */ 01211 if (dwHotkey != 0) { 01212 ppi->dwHotkey = dwHotkey; 01213 } 01214 01215 /* 01216 * If WOW passed us a non-default window position use it, otherwise clear it. 01217 */ 01218 ppi->usi.cb = sizeof(ppi->usi); 01219 01220 if (dwX == CW_USEDEFAULT || dwX == CW2_USEDEFAULT) { 01221 ppi->usi.dwFlags &= ~STARTF_USEPOSITION; 01222 } else { 01223 ppi->usi.dwFlags |= STARTF_USEPOSITION; 01224 ppi->usi.dwX = dwX; 01225 ppi->usi.dwY = dwY; 01226 } 01227 01228 /* 01229 * If WOW passed us a non-default window size use it, otherwise clear it. 01230 */ 01231 if (dwXSize == CW_USEDEFAULT || dwXSize == CW2_USEDEFAULT) { 01232 ppi->usi.dwFlags &= ~STARTF_USESIZE; 01233 } else { 01234 ppi->usi.dwFlags |= STARTF_USESIZE; 01235 ppi->usi.dwXSize = dwXSize; 01236 ppi->usi.dwYSize = dwYSize; 01237 } 01238 01239 /* 01240 * Alloc and Link in new task into the task list 01241 */ 01242 if ((ptdb = (PTDB)UserAllocPoolWithQuota(sizeof(TDB), TAG_WOWTDB)) == NULL) 01243 return STATUS_NO_MEMORY; 01244 ptiCurrent->ptdb = ptdb; 01245 01246 /* 01247 * Set the flags to say this is a 16-bit thread - before attaching 01248 * queues! 01249 */ 01250 ptiCurrent->TIF_flags |= TIF_16BIT | TIF_FIRSTIDLE; 01251 01252 /* 01253 * If this task is running in the shared WOW VDM, we handle 01254 * WaitForInputIdle a little differently than separate WOW 01255 * VDMs. This is because CreateProcess returns a real process 01256 * handle when you start a separate WOW VDM, so the "normal" 01257 * WaitForInputIdle works. For the shared WOW VDM, CreateProcess 01258 * returns an event handle. 01259 */ 01260 ptdb->pwti = NULL; 01261 if (idTask) { 01262 ptiCurrent->TIF_flags |= TIF_SHAREDWOW; 01263 01264 /* 01265 * Look for a matching thread in the WOW thread info list. 01266 */ 01267 if (idTask != (DWORD)-1) { 01268 for (pwti = gpwtiFirst; pwti != NULL; pwti = pwti->pwtiNext) { 01269 if (pwti->idTask == idTask) { 01270 ptdb->pwti = pwti; 01271 break; 01272 } 01273 } 01274 #if DBG 01275 if (pwti == NULL) { 01276 RIPMSG0(RIP_WARNING, "InitTask couldn't find WOW struct\n"); 01277 } 01278 #endif 01279 } 01280 } 01281 ptiCurrent->pClientInfo->dwTIFlags |= ptiCurrent->TIF_flags; 01282 01283 /* 01284 * We need this thread to share the queue of other win16 apps. 01285 * If we're journalling, all apps are sharing a queue, so we wouldn't 01286 * want to interrupt that - so only cause queue recalculation 01287 * if we aren't journalling. 01288 * ptdb may be freed by DestroyTask during a callback, so defer WinEvent 01289 * notifications until we don't need ptdb any more. 01290 */ 01291 DeferWinEventNotify(); 01292 if (!FJOURNALRECORD() && !FJOURNALPLAYBACK()) 01293 zzzReattachThreads(FALSE); 01294 01295 /* 01296 * Save away the 16 bit task handle: we use this later when calling 01297 * wow back to close a WOW task. 01298 */ 01299 ptdb->hTaskWow = LOWORD(hTaskWow); 01300 01301 /* 01302 * Setup the app start cursor for 5 second timeout. 01303 */ 01304 zzzCalcStartCursorHide((PW32PROCESS)ppi, 5000); 01305 01306 /* 01307 * HIWORD: != 0 if wants proportional font 01308 * LOWORD: Expected windows version (3.00 [300], 3.10 [30A], etc) 01309 */ 01310 ptiCurrent->dwExpWinVer = dwExpWinVer; 01311 ptiCurrent->pClientInfo->dwExpWinVer = dwExpWinVer; 01312 01313 /* 01314 * Mark this guy and add him to the global task list so he can run. 01315 */ 01316 #define NORMAL_PRIORITY_TASK 10 01317 01318 /* 01319 * To be Compatible it super important that the new task run immediately 01320 * Set its priority accordingly. No other task should ever be set to 01321 * CREATION priority 01322 */ 01323 ptdb->nPriority = NORMAL_PRIORITY_TASK; 01324 ptdb->nEvents = 0; 01325 ptdb->pti = ptiCurrent; 01326 ptdb->ptdbNext = NULL; 01327 ptdb->TDB_Flags = 0; 01328 01329 InsertTask(ppi, ptdb); 01330 zzzEndDeferWinEventNotify(); 01331 01332 ptiCurrent->dwCompatFlags = dwAppCompatFlags; 01333 ptiCurrent->pClientInfo->dwCompatFlags = dwAppCompatFlags; 01334 01335 UserAssert(ptiCurrent->ppi->ptiList); 01336 /* 01337 * We haven't captured pstrBaseFileName's buffer, we 01338 * may fault touching it in SetAppImeCompatFlags. If 01339 * so the IME flags have been set already and we 01340 * can safely assume it's not a setup app. 01341 */ 01342 01343 try { 01344 if (SetAppImeCompatFlags(ptiCurrent, ptiCurrent->pstrAppName, 01345 pstrBaseFileName)) { 01346 /* 01347 * Flag task as a setup app. 01348 */ 01349 ptdb->TDB_Flags = TDBF_SETUP; 01350 ppi->W32PF_Flags |= W32PF_SETUPAPP; 01351 } 01352 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) { 01353 } 01354 01355 /* 01356 * Force this new task to be the active task (WOW will ensure the 01357 * currently running task does a Yield which will put it into the 01358 * non preemptive scheduler. 01359 */ 01360 ppi->pwpi->ptiScheduled = ptiCurrent; 01361 ppi->pwpi->CSLockCount = -1; 01362 01363 EnterWowCritSect(ptiCurrent, ppi->pwpi); 01364 01365 /* 01366 * ensure app gets focus 01367 */ 01368 zzzShowStartGlass(10000); 01369 01370 return STATUS_SUCCESS; 01371 }

VOID zzzInternalDestroyCaret  ) 
 

Definition at line 189 of file caret.c.

References _KillSystemTimer(), tagQ::caret, FWINABLE, tagCARET::hBitmap, tagCARET::hTimer, IDSYS_CARET, tagCARET::iHideLevel, NULL, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, ThreadLockWithPti, ThreadUnlock, Unlock, zzzInternalHideCaret(), and zzzWindowEvent.

Referenced by xxxCreateCaret(), xxxDestroyWindow(), and zzzDestroyCaret().

00190 { 00191 PQ pq; 00192 PTHREADINFO ptiCurrent = PtiCurrent(); 00193 PWND pwndCaret; 00194 TL tlpwndCaret; 00195 00196 /* 00197 * Hide the caret, kill the timer, and null out the caret structure. 00198 */ 00199 zzzInternalHideCaret(); 00200 pq = ptiCurrent->pq; 00201 _KillSystemTimer(pq->caret.spwnd, IDSYS_CARET); 00202 00203 pq->caret.hTimer = 0; 00204 pq->caret.hBitmap = NULL; 00205 pq->caret.iHideLevel = 0; 00206 00207 pwndCaret = pq->caret.spwnd; 00208 if (pwndCaret != NULL) { 00209 /* 00210 * Threadlock caret's spwnd for WinEvent notification below 00211 */ 00212 ThreadLockWithPti(ptiCurrent, pwndCaret, &tlpwndCaret); 00213 Unlock(&pq->caret.spwnd); 00214 00215 if (FWINABLE()) { 00216 zzzWindowEvent(EVENT_OBJECT_DESTROY, pwndCaret, OBJID_CARET, INDEXID_CONTAINER, 0); 00217 } 00218 00219 ThreadUnlock(&tlpwndCaret); 00220 } 00221 }

VOID zzzInternalHideCaret  ) 
 

Definition at line 376 of file caret.c.

References tagQ::caret, FALSE, tagCARET::fVisible, FWINABLE, tagCARET::iHideLevel, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, UT_InvertCaret(), and zzzWindowEvent.

Referenced by xxxBeginPaint(), xxxScrollWindowEx(), zzzHideCaret(), and zzzInternalDestroyCaret().

00377 { 00378 PQ pq; 00379 PTHREADINFO ptiCurrent = PtiCurrent(); 00380 00381 pq = ptiCurrent->pq; 00382 00383 /* 00384 * If the caret is physically visible, invert it to turn off the bits. 00385 * Adjust the hide count upwards to remember this hide level. 00386 */ 00387 if (pq->caret.fVisible) 00388 UT_InvertCaret(); 00389 00390 pq->caret.fVisible = FALSE; 00391 pq->caret.iHideLevel++; 00392 00393 /* 00394 * Is the caret transitioning to being hidden? If so, iHideLevel is 00395 * going from 0 to 1. 00396 */ 00397 if (FWINABLE() && (pq->caret.iHideLevel == 1)) { 00398 zzzWindowEvent(EVENT_OBJECT_HIDE, pq->caret.spwnd, OBJID_CARET, INDEXID_CONTAINER, 0); 00399 } 00400 }

VOID zzzInternalSetCursorPos int  x,
int  y
 

Definition at line 114 of file ntuser/kernel/cursor.c.

References BoundCursor(), gpDispInfo, gpsi, gptCursorAsync, tagDISPLAYINFO::hDev, VOID(), and zzzSetFMouseMoved().

Referenced by ResetSharedDesktops(), xxxCallJournalPlaybackHook(), xxxMakeWindowForegroundWithState(), xxxMoveSize(), xxxMS_TrackMove(), xxxSwitchDesktop(), xxxUserResetDisplayDevice(), zzzActiveCursorTracking(), zzzClipCursor(), and zzzSetCursorPos().

00118 { 00119 00120 gptCursorAsync.x = x; 00121 gptCursorAsync.y = y; 00122 00123 BoundCursor(&gptCursorAsync); 00124 gpsi->ptCursor = gptCursorAsync; 00125 GreMovePointer(gpDispInfo->hDev, gpsi->ptCursor.x, gpsi->ptCursor.y); 00126 00127 /* 00128 * Cursor has changed position, so generate a mouse event so the 00129 * window underneath the new location knows it's there and sets the 00130 * shape accordingly. 00131 */ 00132 zzzSetFMouseMoved(); 00133 }

VOID zzzInternalShowCaret  ) 
 

Definition at line 331 of file caret.c.

References tagQ::caret, tagCARET::fOn, tagCARET::fVisible, FWINABLE, tagCARET::iHideLevel, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, UT_InvertCaret(), and zzzWindowEvent.

Referenced by xxxEndPaint(), xxxScrollWindowEx(), and zzzShowCaret().

00332 { 00333 PQ pq; 00334 PTHREADINFO ptiCurrent = PtiCurrent(); 00335 00336 pq = ptiCurrent->pq; 00337 00338 /* 00339 * If the caret hide level is aleady 0 (meaning it's ok to show) and the 00340 * caret is not physically on, try to invert now if it's turned on. 00341 */ 00342 if (pq->caret.iHideLevel == 0) { 00343 if (!pq->caret.fVisible) { 00344 if ((pq->caret.fVisible = pq->caret.fOn) != 0) { 00345 UT_InvertCaret(); 00346 } 00347 } 00348 return; 00349 } 00350 00351 /* 00352 * Adjust the hide caret hide count. If we hit 0, we can show the 00353 * caret. Try to invert it if it's turned on. 00354 */ 00355 00356 if (--pq->caret.iHideLevel == 0) { 00357 if ((pq->caret.fVisible = pq->caret.fOn) != 0) 00358 UT_InvertCaret(); 00359 00360 if (FWINABLE()) { 00361 zzzWindowEvent(EVENT_OBJECT_SHOW, pq->caret.spwnd, OBJID_CARET, INDEXID_CONTAINER, 0); 00362 } 00363 } 00364 }

BOOL zzzInvalidateDCCache PWND  pwndInvalid,
DWORD  flags
 

Definition at line 1812 of file dc.c.

References BOOL, tagDCE::DCX_flags, gcountPWO, gpDispInfo, tagDISPLAYINFO::hDev, IDC_CHILDRENONLY, IDC_CLIENTONLY, IDC_DEFAULT, IDC_MOVEBLT, IDC_NOMOUSE, InvalidateDce(), InvalidateGDIWindows(), IsGlobalHooked, NULL, tagDISPLAYINFO::pdceFirst, tagDCE::pdceNext, PtiCurrent, tagDCE::pwndClip, PWNDDESKTOP, tagDCE::pwndOrg, tagWND::spwndParent, TestWF, ThreadLockAlwaysWithPti, ThreadUnlock, tagTHREADINFO::TIF_flags, TIF_MOVESIZETRACKING, TRUE, WFCLIPCHILDREN, WFCLIPSIBLINGS, WFMINIMIZED, WHF_FROM_WH, and zzzSetFMouseMoved().

Referenced by LockWindowUpdate2(), ResetSharedDesktops(), UnsetLayeredWindow(), xxxDWP_SetRedraw(), xxxMinimizeHungWindow(), xxxScrollWindowEx(), xxxSetLayeredWindow(), xxxSetParent(), xxxSetWindowStyle(), and zzzBltValidBits().

01815 { 01816 PWND pwnd; 01817 PDCE pdce; 01818 PTHREADINFO ptiCurrent = PtiCurrent(); 01819 TL tlpwndInvalid; 01820 FLONG fl; 01821 01822 /* 01823 * Invalidation implies screen real estate is changing so we must 01824 * jiggle the mouse, because a different window may be underneath 01825 * the mouse, which needs to get a mouse move in order to change the 01826 * mouse pointer. 01827 * 01828 * The check for the tracking is added for full-drag-windows. In doing 01829 * full-drag, zzzBltValidBits() is called from setting the window-pos. 01830 * This resulted in an extra-mousemove being queued from this routine. 01831 * So, when we're tracking, don't queue a mousemove. This pointer is 01832 * null when tracking is off, so it won't effect the normal case. 01833 */ 01834 ThreadLockAlwaysWithPti(ptiCurrent, pwndInvalid, &tlpwndInvalid); 01835 01836 if (!(ptiCurrent->TIF_flags & TIF_MOVESIZETRACKING) && 01837 !(flags & IDC_NOMOUSE)) { 01838 01839 #ifdef REDIRECTION 01840 if (!IsGlobalHooked(ptiCurrent, WHF_FROM_WH(WH_HITTEST))) 01841 #endif // REDIRECTION 01842 01843 zzzSetFMouseMoved(); 01844 } 01845 01846 /* 01847 * The visrgn of pwnd is changing. First see if a change to this 01848 * visrgn will also affect other window's visrgns: 01849 * 01850 * 1) if parent is clipchildren, we need to invalidate parent 01851 * 2) if clipsiblings, we need to invalidate our sibling's visrgns. 01852 * 01853 * We don't optimize the case where we're NOT clipsiblings, and our 01854 * parent is clipchildren: very rare case. 01855 * We also don't optimize the fact that a clipsiblings window visrgn 01856 * change only affects the visrgns of windows BELOW it. 01857 */ 01858 if (flags & IDC_DEFAULT) { 01859 01860 flags = 0; 01861 01862 if ((pwndInvalid->spwndParent != NULL) && 01863 (pwndInvalid != PWNDDESKTOP(pwndInvalid))) { 01864 01865 /* 01866 * If the parent is a clip-children window, then 01867 * a change to our visrgn will affect his visrgn, and 01868 * possibly those of our siblings. So, invalidate starting 01869 * from our parent. Note that we don't need to invalidate 01870 * any window DCs associated with our parent. 01871 */ 01872 if (TestWF(pwndInvalid->spwndParent, WFCLIPCHILDREN)) { 01873 01874 flags = IDC_CLIENTONLY; 01875 pwndInvalid = pwndInvalid->spwndParent; 01876 01877 } else if (TestWF(pwndInvalid, WFCLIPSIBLINGS)) { 01878 01879 /* 01880 * If we are clip-siblings, chances are that our siblings are 01881 * too. A change to our visrgn might affect our siblings, 01882 * so invalidate all of our siblings. 01883 * 01884 * NOTE! This code assumes that if pwndInvalid is NOT 01885 * CLIPSIBLINGs, that either it does not overlap other 01886 * CLIPSIBLINGs windows, or that none of the siblings are 01887 * CLIPSIBLINGs. This is a reasonable assumption, because 01888 * mixing CLIPSIBLINGs and non CLIPSIBLINGs windows that 01889 * overlap is generally unpredictable anyhow. 01890 */ 01891 flags = IDC_CHILDRENONLY; 01892 pwndInvalid = pwndInvalid->spwndParent; 01893 } 01894 } 01895 } 01896 01897 /* 01898 * Go through the list of DCE's, looking for any that need to be 01899 * invalidated or recalculated. Basically, any DCE that contains 01900 * a window handle that is equal to pwndInvalid or a child of pwndInvalid 01901 * needs to be invalidated. 01902 */ 01903 for (pdce = gpDispInfo->pdceFirst; pdce; pdce = pdce->pdceNext) { 01904 01905 if (pdce->DCX_flags & (DCX_INVALID | DCX_DESTROYTHIS)) 01906 continue; 01907 01908 /* 01909 * HACK ALERT 01910 * 01911 * A minimized client DC must never exclude its children, even if 01912 * its WS_CLIPCHILDREN bit is set. For CS_OWNDC windows we must 01913 * update the flags of the DCE to reflect the change in window state 01914 * when the visrgn is eventually recomputed. 01915 */ 01916 if (!(pdce->DCX_flags & (DCX_CACHE | DCX_WINDOW))) { 01917 01918 if (TestWF(pdce->pwndOrg, WFCLIPCHILDREN)) 01919 pdce->DCX_flags |= DCX_CLIPCHILDREN; 01920 01921 if (TestWF(pdce->pwndOrg, WFMINIMIZED)) 01922 pdce->DCX_flags &= ~DCX_CLIPCHILDREN; 01923 } 01924 01925 /* 01926 * This code assumes that if pdce->pwndClip != pdce->pwndOrg, 01927 * that pdce->pwndClip == pdce->pwndOrg->spwndParent. To ensure 01928 * that both windows are visited, we start the walk upwards from 01929 * the lower of the two, or pwndOrg. 01930 */ 01931 UserAssert((pdce->pwndClip == pdce->pwndOrg) || 01932 (pdce->pwndClip == pdce->pwndOrg->spwndParent)); 01933 01934 /* 01935 * Walk upwards from pdce->pwndOrg, to see if we encounter 01936 * pwndInvalid. 01937 */ 01938 for (pwnd = pdce->pwndOrg; pwnd; pwnd = pwnd->spwndParent) { 01939 01940 if (pwnd == pwndInvalid) { 01941 01942 if (pwndInvalid == pdce->pwndOrg) { 01943 01944 /* 01945 * Ignore DCEs for pwndInvalid if IDC_CHILDRENONLY. 01946 */ 01947 if (flags & IDC_CHILDRENONLY) 01948 break; 01949 01950 /* 01951 * Ignore window DCEs for pwndInvalid if IDC_CLIENTONLY 01952 */ 01953 if ((flags & IDC_CLIENTONLY) && (pdce->DCX_flags & DCX_WINDOW)) 01954 break; 01955 } 01956 01957 InvalidateDce(pdce); 01958 break; 01959 } 01960 } 01961 } 01962 01963 /* 01964 * Update WNDOBJs in gdi if they exist. 01965 */ 01966 GreLockDisplay(gpDispInfo->hDev); 01967 01968 fl = (flags & IDC_MOVEBLT) ? GCR_DELAYFINALUPDATE : 0; 01969 01970 if (gcountPWO != 0) { 01971 InvalidateGDIWindows(pwndInvalid); 01972 fl |= GCR_WNDOBJEXISTS; 01973 } 01974 01975 GreClientRgnUpdated(fl); 01976 01977 GreUpdateSpriteVisRgn(gpDispInfo->hDev); 01978 01979 GreUnlockDisplay(gpDispInfo->hDev); 01980 01981 ThreadUnlock(&tlpwndInvalid); 01982 01983 return TRUE; 01984 }

BOOL zzzReattachThreads BOOL  fJournalAttach  ) 
 

Definition at line 6158 of file ntuser/kernel/input.c.

References _GetNextQueueWindow(), BEGINATOMICCHECK, BOOL, tagQ::cLockCount, tagMLIST::cMsgs, tagQ::cThreads, DBGValidateQueueStates(), DeferWinEventNotify, ENDATOMICCHECK, EXITATOMICCHECK, FALSE, GETPTI, gpqForeground, gpqForegroundPrev, grpdeskRitInput, HWq, tagQ::mlInput, NULL, tagDESKTOP::pDeskInfo, PostEventMessage(), tagTHREADINFO::pq, tagTHREADINFO::pqAttach, tagMLIST::pqmsgRead, tagMLIST::pqmsgWriteLast, PtiCurrent, tagQ::ptiKeyboard, tagDESKTOP::PtiList, tagQ::ptiMouse, QEVENT_ACTIVATE, RedistributeInput(), tagTHREADINFO::rpdesk, tagDESKTOPINFO::spwnd, tagQ::spwndActive, tagQ::spwndActivePrev, tagWND::spwndChild, TRUE, zzzAttachToQueue(), zzzDestroyQueue(), zzzEndDeferWinEventNotify, zzzRecalcThreadAttachment(), and zzzSetFMouseMoved().

Referenced by xxxInternalGetMessage(), zzzAttachThreadInput(), zzzInitTask(), and zzzJournalAttach().

06160 { 06161 PTHREADINFO ptiCurrent = PtiCurrent(); 06162 PTHREADINFO pti; 06163 PQ pqForegroundPrevNew; 06164 PQ pqForegroundNew; 06165 PQ pqAttach; 06166 PQ pqJournal; 06167 PLIST_ENTRY pHead, pEntry; 06168 BOOL bHadAnActiveForegroundWindow; 06169 06170 /* 06171 * In all cases, do not leave do any send messages or any callbacks! 06172 * This is because this code is called from 06173 * SetWindowsHook(WH_JOURNALPLAYBACK | WH_JOURNALRECORD). No app currently 06174 * calling this routine expects to be called before this routine returns. 06175 * (If you do callback before it returns, you'll break at least Access 06176 * for Windows). - scottlu 06177 */ 06178 06179 #if DBG 06180 DBGValidateQueueStates(ptiCurrent->rpdesk); 06181 #endif 06182 06183 /* 06184 * Defer Win Event notifications so we can traverse PtiList with impunity 06185 * Also, we don't want to callback while we're half way attached 06186 */ 06187 DeferWinEventNotify(); 06188 BEGINATOMICCHECK(); 06189 06190 /* 06191 * Don't recalc attach info if this is a journal attach, because 06192 * the journal attach code has already done this for us. 06193 */ 06194 if (!fJournalAttach) { 06195 06196 /* 06197 * Now recalculate all the different queue groups, based on the 06198 * attach requests. This fills in the pqAttach of each thread info 06199 * with the new queue this thread belongs to. Always takes into 06200 * account all attachment requests. 06201 */ 06202 zzzRecalcThreadAttachment(); 06203 06204 /* 06205 * Make a guess about which queue is the journal queue. 06206 */ 06207 pqJournal = gpqForeground; 06208 if (pqJournal == NULL) 06209 pqJournal = ptiCurrent->pq; 06210 06211 /* 06212 * If the queue is only used by one thread, perform normal processing. 06213 */ 06214 if (pqJournal->cThreads == 1) { 06215 pqJournal = NULL; 06216 } else { 06217 06218 /* 06219 * Lock the queue to ensure that it stays valid 06220 * until we have redistributed the input. 06221 */ 06222 (pqJournal->cLockCount)++; 06223 } 06224 } else { 06225 pqJournal = NULL; 06226 } 06227 06228 /* 06229 * What will be the new foreground queue? 06230 */ 06231 pqForegroundNew = NULL; 06232 06233 /* 06234 * Remember if there is a foreground window so we don't force one 06235 * at the end if there wasn't one before the attach 06236 */ 06237 if (gpqForeground != NULL && gpqForeground->spwndActive != NULL) { 06238 bHadAnActiveForegroundWindow = TRUE; 06239 pqForegroundNew = GETPTI(gpqForeground->spwndActive)->pqAttach; 06240 } else { 06241 bHadAnActiveForegroundWindow = FALSE; 06242 } 06243 06244 pqForegroundPrevNew = NULL; 06245 if (gpqForegroundPrev != NULL && gpqForegroundPrev->spwndActivePrev != NULL) { 06246 pqForegroundPrevNew = GETPTI(gpqForegroundPrev->spwndActivePrev)->pqAttach; 06247 } 06248 06249 06250 pHead = &ptiCurrent->rpdesk->PtiList; 06251 for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) { 06252 pti = CONTAINING_RECORD(pEntry, THREADINFO, PtiLink); 06253 06254 if (pti->pqAttach == pti->pq) { 06255 pti->pqAttach = NULL; 06256 } else if(pti->pqAttach != NULL) { 06257 /* 06258 * It is crucial that we NULL out pqAttach for this queue once 06259 * we have it in a local variable because the NULL-ness of this 06260 * field is checked in attach operations. 06261 */ 06262 pqAttach = pti->pqAttach; 06263 pti->pqAttach = NULL; 06264 06265 zzzAttachToQueue(pti, pqAttach, pqJournal, pqForegroundNew == pqAttach); 06266 } 06267 06268 } 06269 06270 /* 06271 * If we are doing a journal detach, redistribute the input messages 06272 * from the old queue. 06273 */ 06274 if (pqJournal != NULL) { 06275 PQMSG pqmsgRedist; 06276 06277 UserAssert(pqJournal->cLockCount); 06278 (pqJournal->cLockCount)--; 06279 pqmsgRedist = pqJournal->mlInput.pqmsgRead; 06280 06281 pqJournal->mlInput.pqmsgRead = NULL; 06282 pqJournal->mlInput.pqmsgWriteLast = NULL; 06283 pqJournal->mlInput.cMsgs = 0; 06284 RedistributeInput(pqmsgRedist, pqJournal); 06285 06286 /* 06287 * Only destroy the queue if it is no longer is use. 06288 */ 06289 if (pqJournal->cThreads == 0) { 06290 pqJournal->cThreads = 1; // prevent underflow 06291 zzzDestroyQueue(pqJournal, pti); // DeferWinEventNotify() ?? IANJA ?? 06292 } else { 06293 /* 06294 * Make sure that this queue doesn't point to a pti 06295 * no longer attached to it. 06296 * Hopefully we'll go to zzzDestroyQueue only once 06297 * Increment cThreads so the queue won't be destroyed 06298 * but we'll simply reassign the pti fields. 06299 */ 06300 if ((pqJournal->ptiMouse != NULL) 06301 && (pqJournal != pqJournal->ptiMouse->pq)) { 06302 pqJournal->cThreads++; 06303 zzzDestroyQueue(pqJournal, pqJournal->ptiMouse); 06304 } 06305 if ((pqJournal->ptiKeyboard != NULL) 06306 && (pqJournal != pqJournal->ptiKeyboard->pq)) { 06307 pqJournal->cThreads++; 06308 zzzDestroyQueue(pqJournal, pqJournal->ptiKeyboard); 06309 } 06310 } 06311 } 06312 06313 #if DBG 06314 DBGValidateQueueStates(ptiCurrent->rpdesk); 06315 #endif 06316 06317 /* 06318 * If the current thread is not on the active desktop, do not 06319 * change the global foreground state. 06320 */ 06321 if (PtiCurrent()->rpdesk != grpdeskRitInput) { 06322 EXITATOMICCHECK(); 06323 zzzEndDeferWinEventNotify(); 06324 return TRUE; 06325 } 06326 06327 /* 06328 * We're done attaching. gptiForeground hasn't changed... but 06329 * gpqForeground has! Try not to leave NULL as the foreground. 06330 */ 06331 #if DBG 06332 DBGValidateQueue(pqForegroundNew); 06333 #endif 06334 gpqForeground = pqForegroundNew; 06335 // So we can Alt-Esc xxxNextWindow without an AV 06336 // If we have a non-NULL gpqForeground, its kbd input thread better have an rpdesk! 06337 UserAssert(!gpqForeground || (gpqForeground->ptiKeyboard && gpqForeground->ptiKeyboard->rpdesk)); 06338 gpqForegroundPrev = pqForegroundPrevNew; 06339 06340 ENDATOMICCHECK(); 06341 zzzEndDeferWinEventNotify(); 06342 06343 if ((gpqForeground == NULL) && (bHadAnActiveForegroundWindow)) { 06344 PWND pwndNewForeground; 06345 PTHREADINFO pti = PtiCurrent(); 06346 06347 pwndNewForeground = _GetNextQueueWindow(pti->rpdesk->pDeskInfo->spwnd->spwndChild, 0, FALSE); 06348 06349 /* 06350 * Don't use xxxSetForegroundWindow2 because we must not leave 06351 * the critical section. There is no currently active foreground 06352 * so all that is needed is to post an activate event to the 06353 * new foreground queue. 06354 */ 06355 if (pwndNewForeground != NULL) { 06356 PostEventMessage(GETPTI(pwndNewForeground), 06357 GETPTI(pwndNewForeground)->pq, QEVENT_ACTIVATE, NULL, 0, 06358 0, (LPARAM)HWq(pwndNewForeground)); 06359 } 06360 } 06361 zzzSetFMouseMoved(); 06362 UserAssert((gpqForeground == NULL) || (gpqForeground->ptiMouse->rpdesk == grpdeskRitInput)); 06363 06364 return TRUE; 06365 }

VOID zzzRegisterSystemThread DWORD  flags,
DWORD  reserved
 

Definition at line 2318 of file hooks.c.

References dwFlags, FALSE, FJOURNALPLAYBACK, FJOURNALRECORD, PtiCurrent, TIF_DONTATTACHQUEUE, TIF_DONTJOURNALATTACH, tagTHREADINFO::TIF_flags, TRUE, VOID(), and zzzJournalAttach().

02319 { 02320 PTHREADINFO ptiCurrent; 02321 02322 UserAssert(dwReserved == 0); 02323 02324 if (dwReserved != 0) 02325 return; 02326 02327 ptiCurrent = PtiCurrent(); 02328 02329 if (dwFlags & RST_DONTATTACHQUEUE) 02330 ptiCurrent->TIF_flags |= TIF_DONTATTACHQUEUE; 02331 02332 if (dwFlags & RST_DONTJOURNALATTACH) { 02333 ptiCurrent->TIF_flags |= TIF_DONTJOURNALATTACH; 02334 02335 /* 02336 * If we are already journaling, then this queue was already 02337 * journal attached. We need to unattach and reattach journaling 02338 * so that we are removed from the journal attached queues. 02339 */ 02340 if (FJOURNALPLAYBACK() || FJOURNALRECORD()) { 02341 zzzJournalAttach(ptiCurrent, FALSE); 02342 zzzJournalAttach(ptiCurrent, TRUE); 02343 } 02344 } 02345 }

BOOL zzzSetCaretPos int  ,
int 
 

Definition at line 550 of file caret.c.

References _KillSystemTimer(), _SetSystemTimer(), BOOL, tagQ::caret, CaretBlinkProc(), FALSE, tagCARET::fOn, tagCARET::fVisible, FWINABLE, gpsi, tagCARET::hTimer, IDSYS_CARET, tagCARET::iHideLevel, NULL, tagTHREADINFO::pq, PtiCurrent, tagCARET::spwnd, TRUE, UT_CaretSet(), UT_InvertCaret(), tagCARET::x, tagCARET::y, and zzzWindowEvent.

Referenced by zzzSetSBCaretPos().

00553 { 00554 PQ pq; 00555 PTHREADINFO ptiCurrent = PtiCurrent(); 00556 00557 /* 00558 * If this thread does not have the caret set, return FALSE. 00559 */ 00560 if (!UT_CaretSet(NULL)) { 00561 RIPERR0(ERROR_ACCESS_DENIED, RIP_VERBOSE, "Access denied in zzzSetCaretPos"); 00562 return FALSE; 00563 } 00564 00565 /* 00566 * If the caret isn't changing position, do nothing (but return success). 00567 */ 00568 pq = ptiCurrent->pq; 00569 if (pq->caret.x == x && pq->caret.y == y) 00570 return TRUE; 00571 00572 /* 00573 * If the caret is visible, turn it off while we move it. 00574 */ 00575 if (pq->caret.fVisible) 00576 UT_InvertCaret(); 00577 00578 /* 00579 * Adjust to the new position. 00580 */ 00581 pq->caret.x = x; 00582 pq->caret.y = y; 00583 00584 /* 00585 * Set a new timer so it'll blink in the new position dtCaretBlink 00586 * milliseconds from now. 00587 */ 00588 _KillSystemTimer(pq->caret.spwnd, IDSYS_CARET); 00589 pq->caret.hTimer = _SetSystemTimer(pq->caret.spwnd, IDSYS_CARET, 00590 gpsi->dtCaretBlink, CaretBlinkProc); 00591 00592 pq->caret.fOn = TRUE; 00593 00594 /* 00595 * Draw it immediately now if the hide level permits it. 00596 */ 00597 pq->caret.fVisible = FALSE; 00598 if (pq->caret.iHideLevel == 0) { 00599 pq->caret.fVisible = TRUE; 00600 UT_InvertCaret(); 00601 } 00602 00603 if (FWINABLE()) { 00604 zzzWindowEvent(EVENT_OBJECT_LOCATIONCHANGE, pq->caret.spwnd, OBJID_CARET, INDEXID_CONTAINER, 0); 00605 } 00606 00607 return TRUE; 00608 }

PCURSOR zzzSetCursor PCURSOR  pcur  ) 
 

Definition at line 28 of file ntuser/kernel/cursor.c.

References gpqCursor, LockQCursor, NULL, tagTHREADINFO::pq, PtiCurrent, tagQ::spcurCurrent, ThreadLockWithPti, ThreadUnlock, and zzzUpdateCursorImage().

Referenced by NtUserSetCursor(), xxxDragObject(), xxxDWP_SetCursor(), xxxHelpLoop(), xxxMoveSize(), xxxScanSysQueue(), xxxSwitchWndProc(), xxxTrackInitSize(), and zzzHideCursorNoCapture().

00030 { 00031 PQ pq; 00032 PCURSOR pcurPrev; 00033 PTHREADINFO ptiCurrent = PtiCurrent(); 00034 00035 pq = ptiCurrent->pq; 00036 00037 pcurPrev = pq->spcurCurrent; 00038 00039 if (pq->spcurCurrent != pcur) { 00040 00041 /* 00042 * Lock() returns pobjOld - if it is still valid. Don't want to 00043 * return a pcurPrev that is an invalid pointer. 00044 */ 00045 pcurPrev = LockQCursor(pq, pcur); 00046 00047 /* 00048 * If no thread 'owns' the cursor, we must be in initialization 00049 * so go ahead and assign it to ourself. 00050 */ 00051 if (gpqCursor == NULL) 00052 gpqCursor = pq; 00053 00054 /* 00055 * If we're changing the local-cursor for the thread currently 00056 * representing the global-cursor, update the cursor image now. 00057 */ 00058 if (pq == gpqCursor) { 00059 TL tlpcur; 00060 ThreadLockWithPti(ptiCurrent, pcurPrev, &tlpcur); 00061 zzzUpdateCursorImage(); 00062 pcurPrev = ThreadUnlock(&tlpcur); 00063 } 00064 } 00065 00066 return pcurPrev; 00067 }

BOOL zzzSetCursorPos int  x,
int  y
 

Definition at line 80 of file ntuser/kernel/cursor.c.

References BOOL, CheckWinstaWriteAttributesAccess(), FALSE, NtGetTickCount(), SAVEPOINT, SYSMET, TRUE, and zzzInternalSetCursorPos().

00083 { 00084 /* 00085 * Blow it off if the caller doesn't have the proper access rights 00086 */ 00087 if (!CheckWinstaWriteAttributesAccess()) { 00088 return FALSE; 00089 } 00090 00091 zzzInternalSetCursorPos(x, y); 00092 00093 /* 00094 * Save the absolute coordinates in the global array 00095 * for GetMouseMovePointsEx. 00096 */ 00097 SAVEPOINT(x, y, 00098 SYSMET(CXVIRTUALSCREEN) - 1, 00099 SYSMET(CYVIRTUALSCREEN) - 1, 00100 NtGetTickCount(), 0); 00101 00102 return TRUE; 00103 }

VOID zzzSetDesktop PTHREADINFO  pti,
PDESKTOP  pdesk,
HDESK  hdesk
 

Definition at line 3823 of file desktop.c.

References tagTHREADINFO::amdesk, CheckHandleFlag(), CLIENTTHREADINFO, tagQ::cThreads, tagTHREADINFO::cWindows, DesktopAllocAlways, DesktopFree, DF_DESKWNDDESTROYED, DF_DYING, diStatic, DTAG_CLIENTTHREADINFO, tagDESKTOP::dwConsoleThreadId, tagDESKTOP::dwDTFlags, tagDESKTOP::dwSessionId, ExDesktopObjectType, FALSE, GetDesktopView(), GetJournallingQueue(), _OBJECT_HANDLE_INFORMATION::GrantedAccess, gSessionId, GTERMF_MOUSE, tagTHREADINFO::hdesk, HF_DESKTOPHOOK, HF_PROTECTED, ISATOMICCHECK, KernelMode, LockDesktop, LogDesktop, NT_SUCCESS, NULL, ObDereferenceObject, OBJECT_HANDLE_INFORMATION, ObReferenceObjectByHandle(), PBYTE, tagTHREADINFO::pcti, tagDESKTOP::pDeskInfo, tagTHREADINFO::pq, PtiCurrent, tagTHREADINFO::PtiLink, tagDESKTOP::PtiList, tagTHREADINFO::rpdesk, SetHandleFlag(), TEST_GTERMF, ThreadLockDesktop, ThreadUnlockDesktop, TIDq, TIF_ALLOWOTHERACCOUNTHOOK, tagTHREADINFO::TIF_flags, TRUE, VOID(), and zzzAttachToQueue().

Referenced by xxxCreateDesktop(), xxxCreateThreadInfo(), xxxCreateWindowStation(), xxxSetThreadDesktop(), and xxxSwitchDesktop().

03827 { 03828 PTEB pteb; 03829 OBJECT_HANDLE_INFORMATION ohi; 03830 PDESKTOP pdeskRef; 03831 PDESKTOP pdeskOld; 03832 PCLIENTTHREADINFO pctiOld; 03833 TL tlpdesk; 03834 PTHREADINFO ptiCurrent = PtiCurrent(); 03835 03836 if (pti == NULL) { 03837 UserAssert(pti); 03838 return; 03839 } 03840 03841 /* 03842 * A handle without an object pointer is bad news. 03843 */ 03844 UserAssert(pdesk != NULL || hdesk == NULL); 03845 03846 /* 03847 * This desktop must not be destroyed 03848 */ 03849 if (pdesk != NULL && (pdesk->dwDTFlags & (DF_DESKWNDDESTROYED | DF_DYING)) && 03850 pdesk != pti->rpdesk) { 03851 RIPMSG2(RIP_ERROR, "Assigning pti %#p to a dying desktop %#p", 03852 pti, pdesk); 03853 return; 03854 } 03855 03856 #if DBG 03857 /* 03858 * Catch reset of important desktops 03859 */ 03860 if (pti->rpdesk && pti->rpdesk->dwConsoleThreadId == TIDq(pti) && 03861 pti->cWindows != 0) { 03862 RIPMSG0(RIP_ERROR, "Reset of console desktop"); 03863 } 03864 #endif 03865 03866 /* 03867 * Clear hook flag 03868 */ 03869 pti->TIF_flags &= ~TIF_ALLOWOTHERACCOUNTHOOK; 03870 03871 /* 03872 * Get granted access 03873 */ 03874 pti->hdesk = hdesk; 03875 if (hdesk != NULL) { 03876 if (NT_SUCCESS(ObReferenceObjectByHandle(hdesk, 03877 0, 03878 *ExDesktopObjectType, 03879 KernelMode, 03880 &pdeskRef, 03881 &ohi))) { 03882 03883 UserAssert(pdesk->dwSessionId == gSessionId); 03884 03885 LogDesktop(pdeskRef, LD_REF_FN_SETDESKTOP, TRUE, (ULONG_PTR)PtiCurrent()); 03886 03887 UserAssert(pdeskRef == pdesk); 03888 LogDesktop(pdesk, LD_DEREF_FN_SETDESKTOP, FALSE, (ULONG_PTR)PtiCurrent()); 03889 ObDereferenceObject(pdeskRef); 03890 pti->amdesk = ohi.GrantedAccess; 03891 if (CheckHandleFlag(hdesk, HF_DESKTOPHOOK)) 03892 pti->TIF_flags |= TIF_ALLOWOTHERACCOUNTHOOK; 03893 03894 SetHandleFlag(hdesk, HF_PROTECTED, TRUE); 03895 03896 } else { 03897 pti->amdesk = 0; 03898 } 03899 03900 } else { 03901 pti->amdesk = 0; 03902 } 03903 03904 /* 03905 * Do nothing else if the thread has initialized and the desktop 03906 * is not changing. 03907 */ 03908 if ((pdesk != NULL) && (pdesk == pti->rpdesk)) 03909 return; 03910 03911 /* 03912 * Save old pointers for later. Locking the old desktop ensures 03913 * that we will be able to free the CLIENTTHREADINFO structure. 03914 */ 03915 pdeskOld = pti->rpdesk; 03916 ThreadLockDesktop(ptiCurrent, pdeskOld, &tlpdesk, LDLT_FN_SETDESKTOP); 03917 pctiOld = pti->pcti; 03918 03919 /* 03920 * Remove the pti from the current desktop. 03921 */ 03922 if (pti->rpdesk) { 03923 UserAssert(ISATOMICCHECK() || pti->pq == NULL || pti->pq->cThreads == 1); 03924 RemoveEntryList(&pti->PtiLink); 03925 } 03926 03927 LockDesktop(&pti->rpdesk, pdesk, LDL_PTI_DESK, (ULONG_PTR)pti); 03928 03929 03930 /* 03931 * If there is no desktop, we need to fake a desktop info 03932 * structure so that the IsHooked() macro can test a "valid" 03933 * fsHooks value. Also link the pti to the desktop. 03934 */ 03935 if (pdesk != NULL) { 03936 pti->pDeskInfo = pdesk->pDeskInfo; 03937 InsertHeadList(&pdesk->PtiList, &pti->PtiLink); 03938 } else { 03939 pti->pDeskInfo = &diStatic; 03940 } 03941 03942 // UserAssert((pti->ppi != NULL) || (pti->ppi == PpiCurrent())); // can't access TEB/pClientInfo of other process 03943 03944 pteb = pti->pEThread->Tcb.Teb; 03945 if (pteb) { 03946 PDESKTOPVIEW pdv; 03947 if (pdesk && (pdv = GetDesktopView(pti->ppi, pdesk))) { 03948 03949 pti->pClientInfo->pDeskInfo = 03950 (PDESKTOPINFO)((PBYTE)pti->pDeskInfo - pdv->ulClientDelta); 03951 03952 pti->pClientInfo->ulClientDelta = pdv->ulClientDelta; 03953 03954 } else { 03955 03956 pti->pClientInfo->pDeskInfo = NULL; 03957 pti->pClientInfo->ulClientDelta = 0; 03958 03959 /* 03960 * Reset the cursor level to its orginal state. 03961 */ 03962 pti->iCursorLevel = TEST_GTERMF(GTERMF_MOUSE) ? 0 : -1; 03963 if (pti->pq) 03964 pti->pq->iCursorLevel = pti->iCursorLevel; 03965 } 03966 } 03967 03968 /* 03969 * Allocate thread information visible from client, then copy and free 03970 * any old info we have lying around. 03971 */ 03972 if (pdesk != NULL) { 03973 03974 /* 03975 * Do not use DesktopAlloc here because the desktop might 03976 * have DF_DESTROYED set. 03977 */ 03978 pti->pcti = DesktopAllocAlways(pdesk, 03979 sizeof(CLIENTTHREADINFO), 03980 DTAG_CLIENTTHREADINFO); 03981 } 03982 03983 if (pdesk == NULL || pti->pcti == NULL) { 03984 pti->pcti = &(pti->cti); 03985 pti->pClientInfo->pClientThreadInfo = NULL; 03986 } else { 03987 pti->pClientInfo->pClientThreadInfo = 03988 (PCLIENTTHREADINFO)((PBYTE)pti->pcti - pti->pClientInfo->ulClientDelta); 03989 } 03990 03991 if (pctiOld != NULL) { 03992 03993 if (pctiOld != pti->pcti) { 03994 RtlCopyMemory(pti->pcti, pctiOld, sizeof(CLIENTTHREADINFO)); 03995 } 03996 03997 if (pctiOld != &(pti->cti)) { 03998 DesktopFree(pdeskOld, pctiOld); 03999 } 04000 04001 } else { 04002 RtlZeroMemory(pti->pcti, sizeof(CLIENTTHREADINFO)); 04003 } 04004 04005 /* 04006 * If journalling is occuring on the new desktop, attach to 04007 * the journal queue. 04008 * Assert that the pti and the pdesk point to the same deskinfo 04009 * if not, we will check the wrong hooks. 04010 */ 04011 UserAssert((pdesk == NULL ) || (pti->pDeskInfo == pdesk->pDeskInfo)); 04012 UserAssert(pti->rpdesk == pdesk); 04013 if (pti->pq != NULL) { 04014 PQ pq = GetJournallingQueue(pti); 04015 if (pq != NULL) { 04016 pq->cThreads++; 04017 zzzAttachToQueue(pti, pq, NULL, FALSE); 04018 } 04019 } 04020 04021 ThreadUnlockDesktop(ptiCurrent, &tlpdesk, LDUT_FN_SETDESKTOP); 04022 }

VOID zzzSetFMouseMoved  ) 
 

Definition at line 1363 of file ntuser/kernel/input.c.

References DeferWinEventNotify, DF_MOUSEMOVETRK, tagDESKTOP::dwDTFlags, gdwMouseMoveExtraInfo, GETPDESK, GETPTI, gpqCursor, gpsi, grpdeskRitInput, gspwndCursor, gspwndInternalCapture, gspwndMouseOwner, gspwndScreenCapture, tagDESKTOP::htEx, Lock, NULL, tagDESKTOP::pDeskInfo, PostEventMessage(), tagTHREADINFO::pq, tagQ::ptiMouse, PtoHq, QEVENT_CANCELMOUSEMOVETRK, tagQ::QF_flags, QF_MOUSEMOVED, SetWakeBit(), SpeedHitTest(), tagDESKTOPINFO::spwnd, tagQ::spwndCapture, tagDESKTOP::spwndTrack, VOID(), WakeSomeone(), zzzEndDeferWinEventNotify, and zzzUpdateCursorImage().

Referenced by ProcessQueuedMouseEvents(), xxxCapture(), xxxDestroyThreadInfo(), xxxMoveSize(), zzzDestroyQueue(), zzzInternalSetCursorPos(), zzzInvalidateDCCache(), zzzReattachThreads(), and zzzSetWindowsHookEx().

01364 { 01365 PWND pwnd; 01366 PWND pwndOldCursor; 01367 PQ pq; 01368 01369 #ifdef REDIRECTION 01370 PWND pwndStart; 01371 POINT ptMouse = gpsi->ptCursor; 01372 #endif // REDIRECTION 01373 01374 /* 01375 * Need to first figure out what queue this mouse event is in. Do NOT 01376 * check for mouse capture here !! Talk to scottlu. 01377 */ 01378 if ((pwnd = gspwndScreenCapture) == NULL) { 01379 01380 #ifdef REDIRECTION 01381 /* 01382 * Call the speed hit test hook 01383 */ 01384 pwndStart = xxxCallSpeedHitTestHook(&ptMouse); 01385 #endif // REDIRECTION 01386 01387 if ((pwnd = gspwndMouseOwner) == NULL) { 01388 if ((pwnd = gspwndInternalCapture) == NULL) { 01389 01390 UserAssert(grpdeskRitInput != NULL); 01391 01392 #ifdef REDIRECTION 01393 if (pwndStart == NULL) { 01394 pwndStart = grpdeskRitInput->pDeskInfo->spwnd; 01395 } 01396 pwnd = SpeedHitTest(pwndStart, ptMouse); 01397 #else 01398 pwnd = SpeedHitTest(grpdeskRitInput->pDeskInfo->spwnd, gpsi->ptCursor); 01399 #endif // REDIRECTION 01400 01401 } 01402 } 01403 } 01404 01405 if (pwnd == NULL) 01406 return; 01407 01408 /* 01409 * This is apparently needed by the attach/unattach code for some 01410 * reason. I'd like to get rid of it - scottlu. 01411 */ 01412 pwndOldCursor = Lock(&gspwndCursor, pwnd); 01413 01414 /* 01415 * If we're giving a mouse move to a new queue, be sure the cursor 01416 * image represents what this queue thinks it should be. 01417 */ 01418 pq = GETPTI(pwnd)->pq; 01419 01420 /* 01421 * Protect pq by deferring WinEvent notification 01422 */ 01423 DeferWinEventNotify(); 01424 01425 if (pq != gpqCursor) { 01426 /* 01427 * If the old queue had the mouse captured, let him know that 01428 * the mouse moved first. Need this to fix tooltips in 01429 * WordPerfect Office. Do the same for mouse tracking. 01430 */ 01431 if (gpqCursor != NULL) { 01432 01433 if (gpqCursor->spwndCapture != NULL) { 01434 gpqCursor->QF_flags |= QF_MOUSEMOVED; 01435 SetWakeBit(GETPTI(gpqCursor->spwndCapture), QS_MOUSEMOVE); 01436 01437 #ifdef REDIRECTION 01438 PushMouseMove(gpqCursor, ptMouse); 01439 #endif // REDIRECTION 01440 01441 } 01442 01443 if ((pwndOldCursor != NULL) && (PtoHq(pwndOldCursor) != PtoHq(pwnd))) { 01444 PDESKTOP pdesk = GETPDESK(pwndOldCursor); 01445 if (pdesk->dwDTFlags & DF_MOUSEMOVETRK) { 01446 PTHREADINFO pti = GETPTI(pdesk->spwndTrack); 01447 PostEventMessage(pti, pti->pq, QEVENT_CANCELMOUSEMOVETRK, 01448 pdesk->spwndTrack, pdesk->dwDTFlags, pdesk->htEx, 01449 DF_MOUSEMOVETRK); 01450 pdesk->dwDTFlags &= ~DF_MOUSEMOVETRK; 01451 } 01452 } 01453 } 01454 01455 /* 01456 * First re-assign gpqCursor so any zzzSetCursor() calls 01457 * will only take effect if done by the thread that 01458 * owns the window the mouse is currently over. 01459 */ 01460 gpqCursor = pq; 01461 01462 /* 01463 * Call zzzUpdateCursorImage() so the new gpqCursor's 01464 * notion of the current cursor is represented. 01465 */ 01466 zzzUpdateCursorImage(); 01467 01468 } 01469 01470 /* 01471 * Set the mouse moved bit for this queue so we know later to post 01472 * a move message to this queue. 01473 */ 01474 pq->QF_flags |= QF_MOUSEMOVED; 01475 01476 #ifdef REDIRECTION 01477 PushMouseMove(pq, ptMouse); 01478 #endif // REDIRECTION 01479 01480 01481 /* 01482 * Reassign mouse input to this thread - this indicates which thread 01483 * to wake up when new input comes in. 01484 */ 01485 pq->ptiMouse = GETPTI(pwnd); 01486 01487 /* 01488 * Wake some thread within this queue to process this mouse event. 01489 */ 01490 WakeSomeone(pq, WM_MOUSEMOVE, NULL); 01491 01492 /* 01493 * We're possibly generating a fake mouse move message - it has no 01494 * extra info associated with it - so 0 it out. 01495 */ 01496 gdwMouseMoveExtraInfo = 0; 01497 01498 zzzEndDeferWinEventNotify(); 01499 }

BOOL zzzSetSystemCursor PCURSOR  pcur,
DWORD  id
 

Definition at line 28 of file kernel/acons.c.

References BOOL, CheckWinstaWriteAttributesAccess(), FALSE, gasyscur, tagSYSCFGICO::Id, and zzzSetSystemImage().

Referenced by NtUserSetSystemCursor().

00031 { 00032 int i; 00033 00034 if (!CheckWinstaWriteAttributesAccess()) { 00035 return FALSE; 00036 } 00037 00038 UserAssert(pcur); 00039 00040 /* 00041 * Check if this cursor is one of the replaceable ones. 00042 */ 00043 for (i = 0; i < COCR_CONFIGURABLE; i++) 00044 if (gasyscur[i].Id == (WORD)id) 00045 break; 00046 00047 /* 00048 * Not replaceable, bail out. 00049 */ 00050 if (i == COCR_CONFIGURABLE) { 00051 RIPMSG1(RIP_WARNING, "_SetSystemCursor: called with bad id %x.\n", id); 00052 return FALSE; 00053 } 00054 00055 return zzzSetSystemImage(pcur, gasyscur[i].spcur); 00056 }

BOOL zzzSetSystemImage PCURSOR  pcur,
PCURSOR  pcurOld
 

Definition at line 69 of file kernel/acons.c.

References _DestroyCursor(), ACON, atomUSER32, BOOL, CBCOPY, CURSOR, CURSOR_THREADCLEANUP, CURSORF_ACON, gpcurLogCurrent, gpcurPhysCurrent, HMChangeOwnerProcess, HMPheFromObject, IS_PTR, NULL, pacon, PHE, _HANDLEENTRY::pOwner, PPROCESSINFO, PtiCurrent, TRUE, UINT, and zzzUpdateCursorImage().

Referenced by xxxUpdateSystemCursorsFromRegistry(), xxxUpdateSystemIconsFromRegistry(), and zzzSetSystemCursor().

00072 { 00073 #define CBCOPY (max(sizeof(CURSOR), sizeof(ACON)) - FIELD_OFFSET(CURSOR, CI_COPYSTART)) 00074 #define pacon ((PACON)pcur) 00075 00076 char cbT[CBCOPY]; 00077 UINT CURSORF_flags; 00078 00079 UserAssert(pcurSys); 00080 00081 if (pcurSys == pcur) 00082 return(TRUE); 00083 00084 /* 00085 * All ssytem images being replaced should have ordinal names 00086 * and reference the USER module and be unowned. 00087 */ 00088 UserAssert(!IS_PTR(pcurSys->strName.Buffer)); 00089 UserAssert(pcurSys->atomModName == atomUSER32); 00090 00091 /* 00092 * if pcur was an acon, transfer frame ownerships to pcurSys. 00093 */ 00094 UserAssert(pcurSys->head.ppi == NULL); 00095 if (pcur->CURSORF_flags & CURSORF_ACON && 00096 pcur->head.ppi != NULL) { 00097 00098 int i; 00099 PHE phe = HMPheFromObject(pcurSys); 00100 PTHREADINFO ptiOwner = ((PPROCESSINFO)phe->pOwner)->ptiList; 00101 00102 for (i = 0; i < pacon->cpcur; i++) { 00103 HMChangeOwnerProcess(pacon->aspcur[i], ptiOwner); 00104 pacon->aspcur[i]->head.ppi = NULL; 00105 } 00106 } 00107 00108 /* 00109 * If this assert fails, the CURSOR and ACON structures were changed 00110 * incorrectly - read the comments in user.h and wingdi.w around 00111 * tagCURSOR, tagACON, and CURSINFO. 00112 */ 00113 UserAssert(FIELD_OFFSET(CURSOR, CI_FIRST) == FIELD_OFFSET(ACON, CI_FIRST)); 00114 00115 /* 00116 * swap everything starting from CI_COPYSTART. 00117 */ 00118 RtlCopyMemory(&cbT, &pcur->CI_COPYSTART, CBCOPY); 00119 RtlCopyMemory(&pcur->CI_COPYSTART, &pcurSys->CI_COPYSTART, CBCOPY); 00120 RtlCopyMemory(&pcurSys->CI_COPYSTART, &cbT, CBCOPY); 00121 /* 00122 * Swap the CURSORF_ACON flags since they go with the swapped data. 00123 */ 00124 CURSORF_flags = pcur->CURSORF_flags & CURSORF_ACON; 00125 pcur->CURSORF_flags = 00126 (pcur->CURSORF_flags & ~CURSORF_ACON) | 00127 (pcurSys->CURSORF_flags & CURSORF_ACON); 00128 pcurSys->CURSORF_flags = 00129 (pcurSys->CURSORF_flags & ~CURSORF_ACON) | CURSORF_flags; 00130 00131 /* 00132 * If we swapped acons into pcur, then we need to change the ownerhsip to 00133 * make sure they can get destroyed 00134 */ 00135 if (pcur->CURSORF_flags & CURSORF_ACON) { 00136 int i; 00137 PTHREADINFO ptiCurrent = PtiCurrent(); 00138 for (i = 0; i < pacon->cpcur; i++) { 00139 HMChangeOwnerProcess(pacon->aspcur[i], ptiCurrent); 00140 } 00141 } 00142 00143 /* 00144 * Use THREADCLEANUP so system cursors are not destroyed. 00145 */ 00146 _DestroyCursor(pcur, CURSOR_THREADCLEANUP); 00147 00148 00149 /* 00150 * If the current logical current is changing the force the current physical 00151 * cursor to change. 00152 */ 00153 if (gpcurLogCurrent == pcurSys) { 00154 gpcurLogCurrent = NULL; 00155 gpcurPhysCurrent = NULL; 00156 zzzUpdateCursorImage(); 00157 } 00158 00159 /* 00160 * Mark the cursor as a system cursor that can be shadowed by GDI. 00161 */ 00162 pcurSys->CURSORF_flags |= CURSORF_SYSTEM; 00163 00164 return TRUE; 00165 #undef pacon 00166 #undef CBCOPY 00167 }

PROC zzzSetWindowsHookAW int  nFilterType,
PROC  pfnFilterProc,
DWORD  dwFlags
 

Definition at line 528 of file hooks.c.

References abHookFlags, dwFlags, HKF_NZRET, NULL, tagHOOK::phkNext, PtiCurrent, and zzzSetWindowsHookEx().

Referenced by NtUserSetWindowsHookAW().

00532 { 00533 PHOOK phk; 00534 00535 phk = zzzSetWindowsHookEx(NULL, NULL, PtiCurrent(), 00536 nFilterType, pfnFilterProc, dwFlags); 00537 00538 /* 00539 * If we get an error from zzzSetWindowsHookEx() then we return 00540 * -1 to be compatible with older version of Windows. 00541 */ 00542 if (phk == NULL) { 00543 return (PROC)-1; 00544 } 00545 00546 /* 00547 * Handle the backwards compatibility return value cases for 00548 * SetWindowsHook. If this was the first hook in the chain, 00549 * then return NULL, else return something non-zero. HKF_NZRET 00550 * is a special case where SetWindowsHook would always return 00551 * something because there was a default hook installed. Some 00552 * apps relied on a non-zero return value in those cases. 00553 */ 00554 if ((phk->phkNext != NULL) || (abHookFlags[nFilterType + 1] & HKF_NZRET)) { 00555 return (PROC)phk; 00556 } 00557 00558 return NULL; 00559 }

PHOOK zzzSetWindowsHookEx HANDLE  hmod,
PUNICODE_STRING  pstrLib,
PTHREADINFO  ptiThread,
int  nFilterType,
PROC  pfnFilterProc,
DWORD  dwFlags
 

Definition at line 576 of file hooks.c.

References abHookFlags, AddHmodDependency(), tagTHREADINFO::amdesk, tagDESKTOPINFO::aphkStart, tagTHREADINFO::aphkStart, BOOL, DbgValidateHooks, dwFlags, tagWINDOWSTATION::dwWSF_Flags, FALSE, tagHOOK::flags, tagDESKTOPINFO::fsHooks, _CLIENTINFO::fsHooks, tagTHREADINFO::fsHooks, GetHmodTableIndex(), gppiInputProvider, HF_ANSI, HF_GLOBAL, HF_WX86KNOWNDLL, HKF_INTERSENDABLE, HKF_JOURNAL, HKF_TASK, HMAllocObject(), HMFreeObject(), tagHOOK::ihmod, tagHOOK::iHook, KeAttachProcess(), KeDetachProcess(), KeSetPriorityThread(), tagPROCESSINFO::luidSession, NULL, tagHOOK::offPfn, tagTHREADINFO::pClientInfo, tagTHREADINFO::pDeskInfo, tagHOOK::phkNext, tagTHREADINFO::ppi, PtiCurrent, tagHOOK::ptiHooked, tagTHREADINFO::rpdesk, tagDESKTOP::rpwinstaParent, RtlAreAllAccessesGranted(), RtlEqualLuid(), THREAD_TO_PROCESS, ThreadLockAlwaysWithPti, ThreadUnlock, TIF_ALLOWOTHERACCOUNTHOOK, TIF_CSRSSTHREAD, tagTHREADINFO::TIF_flags, TIF_GLOBALHOOKER, TIF_SYSTEMTHREAD, TRUE, TYPE_HOOK, WHF_FROM_WH, WSF_NOIO, zzzJournalAttach(), zzzSetFMouseMoved(), and zzzUnhookWindowsHookEx().

Referenced by NtUserSetWindowsHookEx(), and zzzSetWindowsHookAW().

00583 { 00584 ACCESS_MASK amDesired; 00585 PHOOK phkNew; 00586 TL tlphkNew; 00587 PHOOK *pphkStart; 00588 PTHREADINFO ptiCurrent; 00589 00590 /* 00591 * Check to see if filter type is valid. 00592 */ 00593 if ((nFilterType < WH_MIN) || (nFilterType > WH_MAX)) { 00594 RIPERR0(ERROR_INVALID_HOOK_FILTER, RIP_VERBOSE, ""); 00595 return NULL; 00596 } 00597 00598 /* 00599 * Check to see if filter proc is valid. 00600 */ 00601 if (pfnFilterProc == NULL) { 00602 RIPERR0(ERROR_INVALID_FILTER_PROC, RIP_VERBOSE, ""); 00603 return NULL; 00604 } 00605 00606 ptiCurrent = PtiCurrent(); 00607 00608 if (ptiThread == NULL) { 00609 /* 00610 * Is the app trying to set a global hook without a library? 00611 * If so return an error. 00612 */ 00613 if (hmod == NULL) { 00614 RIPERR0(ERROR_HOOK_NEEDS_HMOD, RIP_VERBOSE, ""); 00615 return NULL; 00616 } 00617 } else { 00618 /* 00619 * Is the app trying to set a local hook that is global-only? 00620 * If so return an error. 00621 */ 00622 if (!(abHookFlags[nFilterType + 1] & HKF_TASK)) { 00623 RIPERR0(ERROR_GLOBAL_ONLY_HOOK, RIP_VERBOSE, ""); 00624 return NULL; 00625 } 00626 00627 /* 00628 * Can't hook outside our own desktop. 00629 */ 00630 if (ptiThread->rpdesk != ptiCurrent->rpdesk) { 00631 RIPERR0(ERROR_ACCESS_DENIED, 00632 RIP_WARNING, 00633 "Access denied to desktop in zzzSetWindowsHookEx - can't hook other desktops"); 00634 00635 return NULL; 00636 } 00637 00638 if (ptiCurrent->ppi != ptiThread->ppi) { 00639 /* 00640 * Is the app trying to set hook in another process without a library? 00641 * If so return an error. 00642 */ 00643 if (hmod == NULL) { 00644 RIPERR0(ERROR_HOOK_NEEDS_HMOD, RIP_VERBOSE, ""); 00645 return NULL; 00646 } 00647 00648 /* 00649 * Is the app hooking another user without access? 00650 * If so return an error. Note that this check is done 00651 * for global hooks every time the hook is called. 00652 */ 00653 if ((!RtlEqualLuid(&ptiThread->ppi->luidSession, 00654 &ptiCurrent->ppi->luidSession)) && 00655 !(ptiThread->TIF_flags & TIF_ALLOWOTHERACCOUNTHOOK)) { 00656 00657 RIPERR0(ERROR_ACCESS_DENIED, 00658 RIP_WARNING, 00659 "Access denied to other user in zzzSetWindowsHookEx"); 00660 00661 return NULL; 00662 } 00663 00664 if ((ptiThread->TIF_flags & (TIF_CSRSSTHREAD | TIF_SYSTEMTHREAD)) && 00665 !(abHookFlags[nFilterType + 1] & HKF_INTERSENDABLE)) { 00666 00667 /* 00668 * Can't hook console or GUI system thread if inter-thread 00669 * calling isn't implemented for this hook type. 00670 */ 00671 RIPERR1(ERROR_HOOK_TYPE_NOT_ALLOWED, 00672 RIP_WARNING, 00673 "nFilterType (%ld) not allowed in zzzSetWindowsHookEx", 00674 nFilterType); 00675 00676 return NULL; 00677 } 00678 } 00679 } 00680 00681 /* 00682 * Check if this thread has access to hook its desktop. 00683 */ 00684 switch( nFilterType ) { 00685 case WH_JOURNALRECORD: 00686 amDesired = DESKTOP_JOURNALRECORD; 00687 break; 00688 00689 case WH_JOURNALPLAYBACK: 00690 amDesired = DESKTOP_JOURNALPLAYBACK; 00691 break; 00692 00693 default: 00694 amDesired = DESKTOP_HOOKCONTROL; 00695 break; 00696 } 00697 00698 if (!RtlAreAllAccessesGranted(ptiCurrent->amdesk, amDesired)) { 00699 RIPERR0(ERROR_ACCESS_DENIED, 00700 RIP_WARNING, 00701 "Access denied to desktop in zzzSetWindowsHookEx"); 00702 00703 return NULL; 00704 } 00705 00706 if (amDesired != DESKTOP_HOOKCONTROL && 00707 (ptiCurrent->rpdesk->rpwinstaParent->dwWSF_Flags & WSF_NOIO)) { 00708 RIPERR0(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION, 00709 RIP_WARNING, 00710 "Journal hooks invalid on a desktop belonging to a non-interactive WindowStation."); 00711 00712 return NULL; 00713 } 00714 00715 #if 0 00716 /* 00717 * Is this a journal hook? 00718 */ 00719 if (abHookFlags[nFilterType + 1] & HKF_JOURNAL) { 00720 /* 00721 * Is a journal hook of this type already installed? 00722 * If so it's an error. 00723 * If this code is enabled, use PhkFirstGlobalValid instead 00724 * of checking phkStart directly 00725 */ 00726 if (ptiCurrent->pDeskInfo->asphkStart[nFilterType + 1] != NULL) { 00727 RIPERR0(ERROR_JOURNAL_HOOK_SET, RIP_VERBOSE, ""); 00728 return NULL; 00729 } 00730 } 00731 #endif 00732 00733 /* 00734 * Allocate the new HOOK structure. 00735 */ 00736 phkNew = (PHOOK)HMAllocObject(ptiCurrent, ptiCurrent->rpdesk, 00737 TYPE_HOOK, sizeof(HOOK)); 00738 if (phkNew == NULL) { 00739 return NULL; 00740 } 00741 00742 /* 00743 * If a DLL is required for this hook, register the library with 00744 * the library management routines so we can assure it's loaded 00745 * into all the processes necessary. 00746 */ 00747 phkNew->ihmod = -1; 00748 if (hmod != NULL) { 00749 00750 #if defined(WX86) 00751 00752 phkNew->flags |= (dwFlags & HF_WX86KNOWNDLL); 00753 00754 #endif 00755 00756 phkNew->ihmod = GetHmodTableIndex(pstrLib); 00757 00758 if (phkNew->ihmod == -1) { 00759 RIPERR0(ERROR_MOD_NOT_FOUND, RIP_VERBOSE, ""); 00760 HMFreeObject((PVOID)phkNew); 00761 return NULL; 00762 } 00763 00764 /* 00765 * Add a dependency on this module - meaning, increment a count 00766 * that simply counts the number of hooks set into this module. 00767 */ 00768 if (phkNew->ihmod >= 0) { 00769 AddHmodDependency(phkNew->ihmod); 00770 } 00771 } 00772 00773 /* 00774 * Depending on whether we're setting a global or local hook, 00775 * get the start of the appropriate linked-list of HOOKs. Also 00776 * set the HF_GLOBAL flag if it's a global hook. 00777 */ 00778 if (ptiThread != NULL) { 00779 pphkStart = &ptiThread->aphkStart[nFilterType + 1]; 00780 00781 /* 00782 * Set the WHF_* in the THREADINFO so we know it's hooked. 00783 */ 00784 ptiThread->fsHooks |= WHF_FROM_WH(nFilterType); 00785 00786 /* 00787 * Set the flags in the thread's TEB 00788 */ 00789 if (ptiThread->pClientInfo) { 00790 BOOL fAttached; 00791 00792 /* 00793 * If the thread being hooked is in another process, attach 00794 * to that process so that we can access its ClientInfo. 00795 */ 00796 if (ptiThread->ppi != ptiCurrent->ppi) { 00797 KeAttachProcess(&ptiThread->ppi->Process->Pcb); 00798 fAttached = TRUE; 00799 } else 00800 fAttached = FALSE; 00801 00802 ptiThread->pClientInfo->fsHooks = ptiThread->fsHooks; 00803 00804 if (fAttached) 00805 KeDetachProcess(); 00806 } 00807 00808 /* 00809 * Remember which thread we're hooking. 00810 */ 00811 phkNew->ptiHooked = ptiThread; 00812 00813 } else { 00814 pphkStart = &ptiCurrent->pDeskInfo->aphkStart[nFilterType + 1]; 00815 phkNew->flags |= HF_GLOBAL; 00816 00817 /* 00818 * Set the WHF_* in the SERVERINFO so we know it's hooked. 00819 */ 00820 ptiCurrent->pDeskInfo->fsHooks |= WHF_FROM_WH(nFilterType); 00821 00822 phkNew->ptiHooked = NULL; 00823 } 00824 00825 /* 00826 * Does the hook function expect ANSI or Unicode text? 00827 */ 00828 phkNew->flags |= (dwFlags & HF_ANSI); 00829 00830 /* 00831 * Initialize the HOOK structure. Unreferenced parameters are assumed 00832 * to be initialized to zero by LocalAlloc(). 00833 */ 00834 phkNew->iHook = nFilterType; 00835 00836 /* 00837 * Libraries are loaded at different linear addresses in different 00838 * process contexts. For this reason, we need to convert the filter 00839 * proc address into an offset while setting the hook, and then convert 00840 * it back to a real per-process function pointer when calling a 00841 * hook. Do this by subtracting the 'hmod' (which is a pointer to the 00842 * linear and contiguous .exe header) from the function index. 00843 */ 00844 phkNew->offPfn = ((ULONG_PTR)pfnFilterProc) - ((ULONG_PTR)hmod); 00845 00846 #ifdef HOOKBATCH 00847 phkNew->cEventMessages = 0; 00848 phkNew->iCurrentEvent = 0; 00849 phkNew->CacheTimeOut = 0; 00850 phkNew->aEventCache = NULL; 00851 #endif //HOOKBATCH 00852 00853 /* 00854 * Link this hook into the front of the hook-list. 00855 */ 00856 phkNew->phkNext = *pphkStart; 00857 *pphkStart = phkNew; 00858 00859 /* 00860 * If this is a journal hook, setup synchronized input processing 00861 * AFTER we set the hook - so this synchronization can be cancelled 00862 * with control-esc. 00863 */ 00864 if (abHookFlags[nFilterType + 1] & HKF_JOURNAL) { 00865 /* 00866 * Attach everyone to us so journal-hook processing 00867 * will be synchronized. 00868 * No need to DeferWinEventNotify() here, since we lock phkNew. 00869 */ 00870 ThreadLockAlwaysWithPti(ptiCurrent, phkNew, &tlphkNew); 00871 if (!zzzJournalAttach(ptiCurrent, TRUE)) { 00872 RIPMSG1(RIP_WARNING, "zzzJournalAttach failed, so abort hook %#p", phkNew); 00873 if (ThreadUnlock(&tlphkNew) != NULL) { 00874 zzzUnhookWindowsHookEx(phkNew); 00875 } 00876 return NULL; 00877 } 00878 if ((phkNew = ThreadUnlock(&tlphkNew)) == NULL) { 00879 return NULL; 00880 } 00881 } 00882 00883 UserAssert(phkNew != NULL); 00884 00885 /* 00886 * Later 5.0 GerardoB: The old code just to check this but 00887 * I think it's some left over stuff from server side days. 00888 .* Let's assert on it for a while 00889 * Also, I added the assertions in the else's below because I reorganized 00890 * the code and want to make sure we don't change behavior 00891 */ 00892 UserAssert(ptiCurrent->pEThread && THREAD_TO_PROCESS(ptiCurrent->pEThread)); 00893 00894 /* 00895 * Can't allow a process that has set a global hook that works 00896 * on server-side winprocs to run at background priority! Bump 00897 * up it's dynamic priority and mark it so it doesn't get reset. 00898 */ 00899 if ((phkNew->flags & HF_GLOBAL) && 00900 (abHookFlags[nFilterType + 1] & HKF_INTERSENDABLE)) { 00901 00902 ptiCurrent->TIF_flags |= TIF_GLOBALHOOKER; 00903 KeSetPriorityThread(&ptiCurrent->pEThread->Tcb, LOW_REALTIME_PRIORITY-2); 00904 00905 if (abHookFlags[nFilterType + 1] & HKF_JOURNAL) { 00906 ThreadLockAlwaysWithPti(ptiCurrent, phkNew, &tlphkNew); 00907 /* 00908 * If we're changing the journal hooks, jiggle the mouse. 00909 * This way the first event will always be a mouse move, which 00910 * will ensure that the cursor is set properly. 00911 */ 00912 zzzSetFMouseMoved(); 00913 phkNew = ThreadUnlock(&tlphkNew); 00914 /* 00915 * If setting a journal playback hook, this process is the input 00916 * provider. This gives it the right to call SetForegroundWindow 00917 */ 00918 if (nFilterType == WH_JOURNALPLAYBACK) { 00919 gppiInputProvider = ptiCurrent->ppi; 00920 } 00921 } else { 00922 UserAssert(nFilterType != WH_JOURNALPLAYBACK); 00923 } 00924 } else { 00925 UserAssert(!(abHookFlags[nFilterType + 1] & HKF_JOURNAL)); 00926 UserAssert(nFilterType != WH_JOURNALPLAYBACK); 00927 } 00928 00929 00930 00931 00932 /* 00933 * Return pointer to our internal hook structure so we know 00934 * which hook to call next in CallNextHookEx(). 00935 */ 00936 DbgValidateHooks(phkNew, phkNew->iHook); 00937 return phkNew; 00938 }

BOOL zzzShowCaret PWND   ) 
 

Definition at line 413 of file caret.c.

References BOOL, FALSE, TRUE, UT_CaretSet(), and zzzInternalShowCaret().

Referenced by NtUserShowCaret(), xxxEndScroll(), xxxSBTrackInit(), and xxxSBWndProc().

00415 { 00416 if (UT_CaretSet(pwnd)) { 00417 zzzInternalShowCaret(); 00418 return TRUE; 00419 } 00420 return FALSE; 00421 }

int zzzShowCursor BOOL  fShow  ) 
 

Definition at line 170 of file ntuser/kernel/cursor.c.

References DecCursorLevel(), DeferWinEventNotify, gpqCursor, tagQ::iCursorLevel, IncCursorLevel(), tagTHREADINFO::pq, PtiCurrent, zzzEndDeferWinEventNotify, and zzzUpdateCursorImage().

Referenced by xxxDragObject(), and xxxMoveSize().

00172 { 00173 PTHREADINFO pti = PtiCurrent(); 00174 PQ pq; 00175 int iCursorLevel; 00176 00177 pq = pti->pq; 00178 /* 00179 * To preserve pq 00180 */ 00181 DeferWinEventNotify(); 00182 00183 if (fShow) { 00184 00185 IncCursorLevel(pti); 00186 00187 if ((pq == gpqCursor) && (pq->iCursorLevel == 0)) 00188 zzzUpdateCursorImage(); 00189 00190 } else { 00191 00192 DecCursorLevel(pti); 00193 00194 if ((pq == gpqCursor) && (pq->iCursorLevel == -1)) 00195 zzzUpdateCursorImage(); 00196 } 00197 00198 iCursorLevel = pq->iCursorLevel; 00199 zzzEndDeferWinEventNotify(); 00200 00201 return iCursorLevel; 00202 }

void zzzShowStartGlass DWORD  dwTimeout  ) 
 

Definition at line 1382 of file queue.c.

References PpiCurrent, PUDF_ALLOWFOREGROUNDACTIVATE, SET_PUDF, and zzzCalcStartCursorHide().

Referenced by zzzInitTask().

01384 { 01385 PPROCESSINFO ppi; 01386 01387 /* 01388 * If this is the first call to zzzShowStartGlass(), then the 01389 * W32PF_ALLOWFOREGROUNDACTIVATE bit has already been set in the process 01390 * info - we don't want to set it again because it may have been 01391 * purposefully cleared when the user hit a key or mouse clicked. 01392 */ 01393 ppi = PpiCurrent(); 01394 if (ppi->W32PF_Flags & W32PF_SHOWSTARTGLASSCALLED) { 01395 /* 01396 * Allow this wow app to come to the foreground. This'll be cancelled 01397 * if the user mouse clicks or hits any keys. 01398 */ 01399 SET_PUDF(PUDF_ALLOWFOREGROUNDACTIVATE); 01400 TAGMSG0(DBGTAG_FOREGROUND, "zzzShowStartGlass set PUDF"); 01401 ppi->W32PF_Flags |= W32PF_ALLOWFOREGROUNDACTIVATE; 01402 TAGMSG1(DBGTAG_FOREGROUND, "zzzShowStartGlass set W32PF %#p", ppi); 01403 } 01404 ppi->W32PF_Flags |= W32PF_SHOWSTARTGLASSCALLED; 01405 01406 /* 01407 * Show the start glass cursor for this much longer. 01408 */ 01409 zzzCalcStartCursorHide((PW32PROCESS)ppi, dwTimeout); 01410 }

BOOL zzzUnhookWindowsHook int  nFilterType,
PROC  pfnFilterProc
 

Definition at line 1068 of file hooks.c.

References BOOL, FALSE, GETPTI, NULL, PFNHOOK, PhkFirstValid(), PhkNextValid(), PtiCurrent, and zzzUnhookWindowsHookEx().

01071 { 01072 PHOOK phk; 01073 PTHREADINFO ptiCurrent; 01074 01075 if ((nFilterType < WH_MIN) || (nFilterType > WH_MAX)) { 01076 RIPERR0(ERROR_INVALID_HOOK_FILTER, RIP_VERBOSE, ""); 01077 return FALSE; 01078 } 01079 01080 ptiCurrent = PtiCurrent(); 01081 01082 for (phk = PhkFirstValid(ptiCurrent, nFilterType); phk != NULL; phk = PhkNextValid(phk)) { 01083 /* 01084 * Is this the hook we're looking for? 01085 */ 01086 if (PFNHOOK(phk) == pfnFilterProc) { 01087 01088 /* 01089 * Are we on the thread that set the hook? 01090 * If not return an error. 01091 */ 01092 if (GETPTI(phk) != ptiCurrent) { 01093 RIPERR0(ERROR_ACCESS_DENIED, 01094 RIP_WARNING, 01095 "Access denied in zzzUnhookWindowsHook: " 01096 "this thread is not the same as that which set the hook"); 01097 01098 return FALSE; 01099 } 01100 01101 return zzzUnhookWindowsHookEx( phk ); 01102 } 01103 } 01104 01105 /* 01106 * Didn't find the hook we were looking for so return FALSE. 01107 */ 01108 RIPERR0(ERROR_HOOK_NOT_INSTALLED, RIP_VERBOSE, ""); 01109 return FALSE; 01110 }

BOOL zzzUnhookWindowsHookEx PHOOK  phk  ) 
 

Definition at line 1126 of file hooks.c.

References abHookFlags, BOOL, FALSE, tagHOOK::flags, FreeHook(), GETPTI, HF_DESTROYED, HKF_INTERSENDABLE, HKF_JOURNAL, tagHOOK::iHook, NULL, PhkFirstGlobalValid(), PhkNextValid(), tagTHREADINFO::TIF_flags, TIF_GLOBALHOOKER, TRUE, and zzzJournalAttach().

Referenced by NtUserUnhookWindowsHookEx(), zzzCancelJournalling(), zzzSetWindowsHookEx(), and zzzUnhookWindowsHook().

01128 { 01129 PTHREADINFO pti; 01130 01131 pti = GETPTI(phkFree); 01132 01133 /* 01134 * If this hook is already destroyed, bail 01135 */ 01136 if (phkFree->flags & HF_DESTROYED) { 01137 RIPMSG1(RIP_WARNING, "_UnhookWindowsHookEx(%#p) already destroyed", phkFree); 01138 return FALSE; 01139 } 01140 01141 /* 01142 * Clear the journaling flags in all the queues. 01143 */ 01144 if (abHookFlags[phkFree->iHook + 1] & HKF_JOURNAL) { 01145 zzzJournalAttach(pti, FALSE); 01146 /* 01147 * If someone got stuck because of the hook, let him go 01148 * 01149 * I want to get some performance numbers before checking this in. 01150 * MSTest hooks and unhooks all the time when running a script. 01151 * This code has never been in. 5/22/96. GerardoB 01152 */ 01153 // InterQueueMsgCleanup(3 * CMSWAITTOKILLTIMEOUT); 01154 } 01155 01156 /* 01157 * If no one is currently calling this hook, 01158 * go ahead and free it now. 01159 */ 01160 FreeHook(phkFree); 01161 01162 /* 01163 * If this thread has no more global hooks that are able to hook 01164 * server-side window procs, we must clear it's TIF_GLOBALHOOKER bit. 01165 */ 01166 if (pti->TIF_flags & TIF_GLOBALHOOKER) { 01167 int iHook; 01168 PHOOK phk; 01169 for (iHook = WH_MIN ; iHook <= WH_MAX ; ++iHook) { 01170 /* 01171 * Ignore those that can't hook server-side winprocs 01172 */ 01173 if (!(abHookFlags[iHook + 1] & HKF_INTERSENDABLE)) { 01174 continue; 01175 } 01176 01177 /* 01178 * Scan the global hooks 01179 */ 01180 for (phk = PhkFirstGlobalValid(pti, iHook); 01181 phk != NULL; phk = PhkNextValid(phk)) { 01182 01183 if (GETPTI(phk) == pti) { 01184 goto StillHasGlobalHooks; 01185 } 01186 } 01187 } 01188 pti->TIF_flags &= ~TIF_GLOBALHOOKER; 01189 } 01190 01191 StillHasGlobalHooks: 01192 /* 01193 * Success, return TRUE. 01194 */ 01195 return TRUE; 01196 }

VOID zzzUpdateCursorImage  ) 
 

Definition at line 496 of file ntuser/kernel/cursor.c.

References CURSORF_ACON, DWORD, FALSE, FCursorShadowed(), FWINABLE, gdwLastAniTick, GETPCI, gpcurLogCurrent, gpcurPhysCurrent, gpDispInfo, gpqCursor, gtimeStartCursorHide, gtmridAniCursor, tagDISPLAYINFO::hDev, tagQ::iCursorLevel, InternalSetTimer(), KILLRITTIMER, NtGetTickCount(), NULL, pacon, SetPointer(), tagQ::spcurCurrent, SYSCUR, VOID(), WEF_USEPWNDTHREAD, zzzAnimateCursor(), and zzzWindowEvent.

Referenced by xxxUserChangeDisplaySettings(), zzzAnimateCursor(), zzzCalcStartCursorHide(), zzzSetCursor(), zzzSetFMouseMoved(), zzzSetSystemImage(), and zzzShowCursor().

00497 { 00498 PCURSOR pcurLogNew; 00499 PCURSOR pcurPhysNew; 00500 PACON pacon; 00501 PCURSOR pcurPhysOld; 00502 00503 if (gpqCursor == NULL) 00504 return; 00505 00506 if ((gpqCursor->iCursorLevel < 0) || (gpqCursor->spcurCurrent == NULL)) { 00507 00508 pcurLogNew = NULL; 00509 00510 } else { 00511 00512 /* 00513 * Assume we're using the current cursor. 00514 */ 00515 pcurLogNew = gpqCursor->spcurCurrent; 00516 00517 /* 00518 * Check to see if we should use the "app starting" cursor. 00519 */ 00520 if (gtimeStartCursorHide != 0) { 00521 00522 if (gpqCursor->spcurCurrent == SYSCUR(ARROW) || 00523 gpqCursor->spcurCurrent == SYSCUR(APPSTARTING)) { 00524 00525 pcurLogNew = SYSCUR(APPSTARTING); 00526 } 00527 } 00528 } 00529 00530 /* 00531 * If the logical cursor is changing then start/stop the cursor 00532 * animation timer as appropriate. 00533 */ 00534 if (pcurLogNew != gpcurLogCurrent) { 00535 00536 /* 00537 * If the old cursor was animating, shut off the animation timer. 00538 */ 00539 if (gtmridAniCursor != 0) { 00540 /* 00541 * Disable animation. 00542 */ 00543 KILLRITTIMER(NULL, gtmridAniCursor); 00544 gtmridAniCursor = 0; 00545 } 00546 00547 /* 00548 * If the new cursor is animated, start the animation timer. 00549 */ 00550 if ((pcurLogNew != NULL) && (pcurLogNew->CURSORF_flags & CURSORF_ACON)) { 00551 00552 /* 00553 * Start the animation over from the beginning. 00554 */ 00555 pacon = (PACON)pcurLogNew; 00556 pacon->iicur = 0; 00557 00558 gdwLastAniTick = NtGetTickCount(); 00559 00560 /* 00561 * Use the rate table to keep the timer on track. 00562 * 1 Jiffy = 1/60 sec = 100/6 ms 00563 */ 00564 gtmridAniCursor = InternalSetTimer(NULL, gtmridAniCursor, 00565 pacon->ajifRate[0] * 100 / 6, zzzAnimateCursor, TMRF_RIT | TMRF_ONESHOT); 00566 } 00567 } 00568 00569 /* 00570 * If this is an animated cursor, find and use the current frame 00571 * of the animation. NOTE: this is done AFTER the AppStarting 00572 * business so the AppStarting cursor itself can be animated. 00573 */ 00574 if (pcurLogNew != NULL && pcurLogNew->CURSORF_flags & CURSORF_ACON) { 00575 00576 pcurPhysNew = ((PACON)pcurLogNew)->aspcur[((PACON)pcurLogNew)-> 00577 aicur[((PACON)pcurLogNew)->iicur]]; 00578 } else { 00579 00580 pcurPhysNew = pcurLogNew; 00581 } 00582 00583 /* 00584 * Remember the new logical cursor. 00585 */ 00586 gpcurLogCurrent = pcurLogNew; 00587 00588 /* 00589 * If the physical cursor is changing then update screen. 00590 */ 00591 if (pcurPhysNew != gpcurPhysCurrent) { 00592 00593 pcurPhysOld = gpcurPhysCurrent; 00594 00595 gpcurPhysCurrent = pcurPhysNew; 00596 00597 if (pcurPhysNew == NULL) { 00598 00599 SetPointer(FALSE); 00600 00601 } else { 00602 ULONG fl = 0; 00603 00604 if (pcurLogNew->CURSORF_flags & CURSORF_ACON) { 00605 fl |= SPS_ANIMATEUPDATE; 00606 } 00607 if (FCursorShadowed(GETPCI(pcurLogNew))) { 00608 fl |= SPS_ALPHA; 00609 } 00610 GreSetPointer(gpDispInfo->hDev, GETPCI(pcurPhysNew), fl); 00611 } 00612 00613 /* 00614 * Notify anyone who cares about the change 00615 * This can happen on the RIT, so we need to pass on the real 00616 * thread/process ID. Hence we use hwndCursor. 00617 * This comment is from WIn'95 so it may not be true - IanJa. 00618 */ 00619 if (FWINABLE()) { 00620 DWORD event; 00621 /* 00622 * These are the events we send: 00623 * hcurPhys now NULL -> EVENT_OBJECT_HIDE 00624 * hcurPhys was NULL -> EVENT_OBJECT_SHOW 00625 * hcurPhys changing -> EVENT_OBJECT_NAMECHANGE 00626 * Since we only go through this code if hcurPhys is actually 00627 * changing, these checks are simple. 00628 */ 00629 if (!pcurPhysNew) { 00630 event = EVENT_OBJECT_HIDE; 00631 } else if (!pcurPhysOld) { 00632 event = EVENT_OBJECT_SHOW; 00633 } else { 00634 event = EVENT_OBJECT_NAMECHANGE; 00635 } 00636 zzzWindowEvent(event, NULL, OBJID_CURSOR, INDEXID_CONTAINER, WEF_USEPWNDTHREAD); 00637 } 00638 } 00639 }

VOID zzzWakeInputIdle PTHREADINFO  pti  ) 
 

Definition at line 5200 of file ntuser/kernel/input.c.

References NULL, tagWOWTHREADINFO::pIdleEvent, tagTHREADINFO::ppi, tagTHREADINFO::ptdb, tagPROCESSINFO::ptiMainThread, tagTDB::pwti, SET_PSEUDO_EVENT, TIF_16BIT, TIF_FIRSTIDLE, tagTHREADINFO::TIF_flags, TIF_SHAREDWOW, and zzzCalcStartCursorHide().

Referenced by xxxGetInputEvent(), xxxInternalGetMessage(), xxxMsgWaitForMultipleObjects(), xxxSleepTask(), and xxxSleepThread().

05202 { 05203 PW32PROCESS W32Process = W32GetCurrentProcess(); 05204 05205 /* 05206 * clear out the TIF_FIRSTIDLE since here we are 05207 */ 05208 pti->TIF_flags &= ~TIF_FIRSTIDLE; 05209 05210 05211 /* 05212 * Shared Wow Apps use the per thread idle event for synchronization. 05213 * Separate Wow VDMs use the regular mechanism. 05214 */ 05215 if (pti->TIF_flags & TIF_SHAREDWOW) { 05216 UserAssert(pti->TIF_flags & TIF_16BIT); 05217 if (pti->ptdb->pwti) { 05218 SET_PSEUDO_EVENT(&pti->ptdb->pwti->pIdleEvent); 05219 } 05220 } else { 05221 /* 05222 * If the main thread is NULL, set it to this queue: it is calling 05223 * GetMessage(). 05224 */ 05225 if (pti->ppi->ptiMainThread == NULL) 05226 pti->ppi->ptiMainThread = pti; 05227 05228 /* 05229 * Wake up anyone waiting on this event. 05230 */ 05231 if (pti->ppi->ptiMainThread == pti) { 05232 SET_PSEUDO_EVENT(&W32Process->InputIdleEvent); 05233 } 05234 } 05235 05236 /* 05237 * Check to see if the startglass is on, and if so turn it off and update. 05238 */ 05239 if (W32Process->W32PF_Flags & W32PF_STARTGLASS) { 05240 /* 05241 * This app is no longer in "starting" mode. Recalc when to hide 05242 * the app starting cursor. 05243 */ 05244 W32Process->W32PF_Flags &= ~W32PF_STARTGLASS; 05245 zzzCalcStartCursorHide(NULL, 0); 05246 } 05247 }


Variable Documentation

PMENU _CreateMenu(VOID)
 

PMENU _CreatePopupMenu(VOID)
 

PWND _GetActiveWindow(VOID)
 

PCURSOR _GetCursor(VOID)
 

PWINDOWSTATION _GetProcessWindowStation(HWINSTA *)
 

PTHREADINFO _ptiCrit(VOID)
 

PTHREADINFO _ptiCritShared(VOID)
 

DEVICE_TEMPLATE aDeviceTemplate[]
 

Definition at line 1953 of file userk.h.

Referenced by CreateDeviceInfo(), DeviceClassNotify(), InputApc(), OpenMultiplePortDevice(), QueryDeviceInfo(), RawInputThread(), RequestDeviceChange(), StartDeviceRead(), Win32kNtUserCleanup(), xxxDesktopThread(), and xxxRegisterForDeviceClassNotifications().

POBJECT_TYPE* ExDesktopObjectType
 

Definition at line 136 of file userk.h.

Referenced by _GetUserObjectInformation(), _SetUserObjectInformation(), ExpWin32Initialization(), FreeDesktop(), LockObjectAssignment(), MapDesktop(), NtUserOpenInputDesktop(), OkayToCloseDesktop(), ParseDesktop(), ParseWindowStation(), UnlockObjectAssignment(), UnmapDesktop(), ValidateHdesk(), xxxCloseDesktop(), xxxConsoleControl(), xxxCreateDesktop(), xxxCreateDesktop2(), xxxCreateThreadInfo(), xxxGetThreadDesktop(), xxxOpenDesktop(), xxxResolveDesktop(), xxxSetCsrssThreadDesktop(), and zzzSetDesktop().

POBJECT_TYPE* ExEventObjectType
 

Definition at line 137 of file userk.h.

POBJECT_TYPE* ExWindowStationObjectType
 

Definition at line 135 of file userk.h.

Referenced by _GetUserObjectInformation(), _OpenWindowStation(), _SetUserObjectInformation(), DestroyWindowStation(), ExpWin32Initialization(), FreeWindowStation(), OkayToCloseWindowStation(), ParseDesktop(), ParseWindowStation(), ReferenceWindowStation(), ValidateHwinsta(), xxxCreateDesktop(), xxxCreateWindowStation(), xxxResolveDesktop(), and xxxSetProcessWindowStation().

ATOM gaFlashWState
 

Definition at line 5657 of file userk.h.

Referenced by RemoveFlashWindowState(), and SetupClassAtoms().

PWND GetLastTopMostWindow(VOID)
 

HANDLE ghCanActivateForegroundPIDs[ACTIVATE_ARRAY_SIZE]
 

Definition at line 6336 of file userk.h.

Referenced by CheckAppStarting(), GiveForegroundActivateRight(), and HasForegroundActivateRight().

PWIN32HEAP gpvSharedAlloc
 

Definition at line 2134 of file userk.h.

Referenced by HMAllocObject(), HMFreeObject(), HMGrowHandleTable(), InitCreateSharedSection(), SharedAlloc(), SharedFree(), UserCommitSharedMemory(), and Win32KDriverUnload().

ULONG gSessionId
 

Definition at line 4489 of file userk.h.

PWND HotKeyToWindow(DWORD)
 

PWND PwndForegroundCapture(VOID)
 


Generated on Sat May 15 19:46:05 2004 for test by doxygen 1.3.7