ReactOS 0.4.17-dev-444-g71ee754
userfuncs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSERT_REFS_CO(_obj_)
 
#define DUMP_REFS(obj)   TRACE_CH(UserObj,"obj 0x%x, refs %i\n",obj, ((PHEAD)obj)->cLockObj)
 

Functions

FORCEINLINE PMENU UserGetMenuObject (HMENU hMenu)
 
PWND FASTCALL IntGetWindowObject (HWND hWnd)
 
BOOL FASTCALL IntDdeSendMessageHook (PWND, UINT, WPARAM, LPARAM)
 
BOOL APIENTRY IntDdePostMessageHook (IN PWND, IN UINT, IN WPARAM, IN OUT LPARAM *, IN OUT LONG_PTR *)
 
BOOL APIENTRY IntDdeGetMessageHook (PMSG, LONG_PTR)
 
NTSTATUS NTAPI InitThreadCallback (PETHREAD Thread)
 
HWINSTA FASTCALL UserGetProcessWindowStation (VOID)
 
HWND FASTCALL UserGetActiveWindow (VOID)
 
HWND FASTCALL UserGetForegroundWindow (VOID)
 
HWND FASTCALL co_UserSetFocus (PWND Window)
 
INT FASTCALL UserReleaseDC (PWND Window, HDC hDc, BOOL EndPaint)
 
HDC FASTCALL UserGetDCEx (PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
 
HDC FASTCALL UserGetWindowDC (PWND Wnd)
 
NTSTATUS FASTCALL InitSessionImpl (VOID)
 
BOOL NTAPI InitMetrics (VOID)
 
LONG NTAPI UserGetSystemMetrics (ULONG Index)
 
BOOL FASTCALL UserIsDBCSEnabled (VOID)
 
BOOL FASTCALL UserIsIMMEnabled (VOID)
 
BOOL FASTCALL UserIsCTFIMEEnabled (VOID)
 
DWORD FASTCALL UserGetKeyState (DWORD key)
 
DWORD FASTCALL UserGetKeyboardType (DWORD TypeFlag)
 
HKL FASTCALL UserGetKeyboardLayout (DWORD dwThreadId)
 
int __cdecl _scwprintf (const wchar_t *format,...)
 
BOOL FASTCALL UserSystemParametersInfo (UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
 
VOID FASTCALL IntSetWindowState (PWND, UINT)
 
VOID FASTCALL IntClearWindowState (PWND, UINT)
 
PTHREADINFO FASTCALL IntTID2PTI (HANDLE)
 
HBRUSH FASTCALL GetControlBrush (PWND, HDC, UINT)
 
HBRUSH FASTCALL GetControlColor (PWND, PWND, HDC, UINT)
 
NTSTATUS GetProcessLuid (IN PETHREAD Thread OPTIONAL, IN PEPROCESS Process OPTIONAL, OUT PLUID Luid)
 
BOOL FASTCALL UserPostMessage (HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
PWND FASTCALL UserGetWindowObject (HWND hWnd)
 
VOID FASTCALL co_DestroyThreadWindows (struct _ETHREAD *Thread)
 
HWND FASTCALL UserGetShellWindow (VOID)
 
BOOLEAN co_UserDestroyWindow (PVOID Object)
 
PWND FASTCALL UserGetAncestor (PWND Wnd, UINT Type)
 
BOOL APIENTRY DefSetText (PWND Wnd, PCWSTR WindowText)
 
DWORD FASTCALL IntGetWindowContextHelpId (PWND pWnd)
 
HMENU FASTCALL UserCreateMenu (PDESKTOP Desktop, BOOL PopupMenu)
 
BOOL FASTCALL UserSetMenuDefaultItem (PMENU Menu, UINT uItem, UINT fByPos)
 
BOOL FASTCALL UserDestroyMenu (HMENU hMenu)
 
VOID FASTCALL DefWndDoSizeMove (PWND pwnd, WORD wParam)
 
LRESULT NC_DoNCPaint (PWND, HDC, INT)
 
void FASTCALL NC_GetSysPopupPos (PWND, RECT *)
 
LRESULT NC_HandleNCActivate (PWND Wnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCCalcSize (PWND wnd, WPARAM wparam, RECTL *winRect, BOOL Suspended)
 
VOID NC_DrawFrame (HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
 
VOID UserDrawCaptionBar (PWND pWnd, HDC hDC, INT Flags)
 
void FASTCALL NC_GetInsideRect (PWND Wnd, RECT *rect)
 
LRESULT NC_HandleNCLButtonDown (PWND Wnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCLButtonDblClk (PWND Wnd, WPARAM wParam, LPARAM lParam)
 
LRESULT NC_HandleNCRButtonDown (PWND wnd, WPARAM wParam, LPARAM lParam)
 
HBRUSH FASTCALL DefWndControlColor (HDC hDC, UINT ctlType)
 
BOOL UserDrawSysMenuButton (PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
 
BOOL UserPaintCaption (PWND pWnd, INT Flags)
 
PWND FASTCALL DWP_GetEnabledPopup (PWND pWnd)
 
BOOL FASTCALL SetLayeredStatus (PWND pWnd, BYTE set)
 
BOOL FASTCALL GetLayeredStatus (PWND pWnd)
 
PIMC FASTCALL UserCreateInputContext (_In_ ULONG_PTR dwClientImcData)
 
VOID UserFreeInputContext (_In_opt_ PVOID Object)
 
BOOLEAN UserDestroyInputContext (_In_opt_ PVOID Object)
 
PVOID AllocInputContextObject (_In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, _In_ SIZE_T Size, _Out_ PVOID *HandleOwner)
 

Variables

PRTL_ATOM_TABLE gAtomTable
 

Macro Definition Documentation

◆ ASSERT_REFS_CO

#define ASSERT_REFS_CO (   _obj_)
Value:
{ \
LONG ref = ((PHEAD)_obj_)->cLockObj;\
if (!(ref >= 1)){ \
ERR_CH(UserObj, "ASSERT: obj 0x%p, refs %ld\n", _obj_, ref); \
ASSERT(FALSE); \
} \
}
#define FALSE
Definition: types.h:117
struct _HEAD * PHEAD
long LONG
Definition: pedump.c:60
Definition: send.c:48

Definition at line 13 of file userfuncs.h.

◆ DUMP_REFS

#define DUMP_REFS (   obj)    TRACE_CH(UserObj,"obj 0x%x, refs %i\n",obj, ((PHEAD)obj)->cLockObj)

Definition at line 44 of file userfuncs.h.

Function Documentation

◆ _scwprintf()

int __cdecl _scwprintf ( const wchar_t format,
  ... 
)

Definition at line 1678 of file wcs.c.

1679{
1680 va_list ap;
1681 int r;
1682
1683 va_start( ap, format );
1685 va_end( ap );
1686 return r;
1687}
#define NULL
Definition: types.h:112
#define INT_MAX
Definition: limits.h:26
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define _vsnwprintf
Definition: _vsnwprintf.c:28
Definition: format.c:58
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

Referenced by UserpFormatMessages().

◆ AllocInputContextObject()

PVOID AllocInputContextObject ( _In_ PDESKTOP  pDesk,
_In_ PTHREADINFO  pti,
_In_ SIZE_T  Size,
_Out_ PVOID HandleOwner 
)

Definition at line 1517 of file ime.c.

1522{
1523 PTHRDESKHEAD ObjHead;
1524
1525 ASSERT(Size > sizeof(*ObjHead));
1526 ASSERT(pti != NULL);
1527
1528 if (!pDesk)
1529 pDesk = pti->rpdesk;
1530
1531 ObjHead = DesktopHeapAlloc(pDesk, Size);
1532 if (!ObjHead)
1533 return NULL;
1534
1535 RtlZeroMemory(ObjHead, Size);
1536
1537 ObjHead->pSelf = ObjHead;
1538 ObjHead->rpdesk = pDesk;
1539 ObjHead->pti = pti;
1541 *HandleOwner = pti;
1542 pti->ppi->UserHandleCount++;
1543
1544 return ObjHead;
1545}
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define ASSERT(a)
Definition: mode.c:44
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
PVOID pSelf
Definition: ntuser.h:195
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define IntReferenceThreadInfo(pti)
Definition: win32.h:167

◆ co_DestroyThreadWindows()

VOID FASTCALL co_DestroyThreadWindows ( struct _ETHREAD Thread)

◆ co_UserDestroyWindow()

BOOLEAN co_UserDestroyWindow ( PVOID  Object)

Definition at line 2857 of file window.c.

2858{
2859 HWND hWnd;
2860 PWND pwndTemp;
2861 PTHREADINFO ti;
2862 MSG msg;
2863 PWND Window = Object;
2864
2865 ASSERT_REFS_CO(Window); // FIXME: Temp HACK?
2866
2867 /* NtUserDestroyWindow does check if the window has already been destroyed
2868 but co_UserDestroyWindow can be called from more paths which means
2869 that it can also be called for a window that has already been destroyed. */
2871 {
2872 TRACE("Tried to destroy a window twice\n");
2873 return TRUE;
2874 }
2875
2878
2879 TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
2880
2881 /* Check for owner thread */
2882 if (Window->head.pti != ti)
2883 {
2884 /* Check if we are destroying the desktop window */
2885 if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
2886 {
2888 return FALSE;
2889 }
2890 }
2891
2892 /* If window was created successfully and it is hooked */
2893 if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
2894 {
2896 {
2897 ERR("Destroy Window WH_CBT Call Hook return!\n");
2898 return FALSE;
2899 }
2900 }
2901
2902 if (Window->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME])
2903 {
2904 if ((Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2905 {
2906 if (Window->spwndOwner)
2907 {
2908 //ERR("DestroyWindow Owner out.\n");
2909 UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE);
2910 }
2911 }
2912 }
2913
2914 /* Inform the parent */
2915 if (Window->style & WS_CHILD)
2916 {
2918 }
2919
2920 if (!Window->spwndOwner && !IntGetParent(Window))
2921 {
2923 }
2924
2925 /* Hide the window */
2926 if (Window->style & WS_VISIBLE)
2927 {
2928 if (Window->style & WS_CHILD)
2929 {
2930 /* Only child windows receive WM_SHOWWINDOW in DestroyWindow() */
2932 }
2933 else
2934 {
2936 }
2937 }
2938
2939 /* Adjust last active */
2940 if ((pwndTemp = Window->spwndOwner))
2941 {
2942 while (pwndTemp->spwndOwner)
2943 pwndTemp = pwndTemp->spwndOwner;
2944
2945 if (pwndTemp->spwndLastActive == Window)
2946 WndSetLastActive(pwndTemp, Window->spwndOwner);
2947 }
2948
2949 if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
2950 {
2951 if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
2952 {
2954 {
2955 //ERR("DestroyWindow Parent out.\n");
2956 UserAttachThreadInput(Window->head.pti, Window->spwndParent->head.pti, FALSE);
2957 }
2958 }
2959 }
2960
2961 if (Window->head.pti->MessageQueue->spwndActive == Window)
2962 Window->head.pti->MessageQueue->spwndActive = NULL;
2963 if (Window->head.pti->MessageQueue->spwndFocus == Window)
2964 Window->head.pti->MessageQueue->spwndFocus = NULL;
2965 if (Window->head.pti->MessageQueue->spwndActivePrev == Window)
2966 Window->head.pti->MessageQueue->spwndActivePrev = NULL;
2967 if (Window->head.pti->MessageQueue->spwndCapture == Window)
2968 Window->head.pti->MessageQueue->spwndCapture = NULL;
2969
2970 /*
2971 * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL
2972 */
2973
2974 if (ti->pDeskInfo != NULL)
2975 {
2976 if (ti->pDeskInfo->hShellWindow == hWnd)
2977 {
2978 ERR("Destroying the ShellWindow!\n");
2979 ti->pDeskInfo->hShellWindow = NULL;
2980 }
2981 }
2982
2984
2986 {
2987 return TRUE;
2988 }
2989
2990 /* Recursively destroy owned windows */
2991 if (!(Window->style & WS_CHILD))
2992 {
2994 }
2995
2996 /* Generate mouse move message for the next window */
2997 msg.message = WM_MOUSEMOVE;
2998 msg.wParam = UserGetMouseButtonsState();
2999 msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
3000 msg.pt = gpsi->ptCursor;
3002
3003 IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
3004
3005 /* Send destroy messages */
3007
3008 /* Destroy the default IME window if necessary */
3009 if (IS_IMM_MODE() && !(ti->TIF_flags & TIF_INCLEANUP) &&
3010 ti->spwndDefaultIme && (ti->spwndDefaultIme != Window) &&
3011 !(Window->state & WNDS_DESTROYED) && !IS_WND_IMELIKE(Window))
3012 {
3013 if (IS_WND_CHILD(Window))
3014 {
3017 }
3018 else
3019 {
3022 }
3023 }
3024
3026 {
3027 return TRUE;
3028 }
3029
3030 /* Destroy the window storage */
3032
3033 return TRUE;
3034}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: precomp.h:57
#define DF_DESTROYED
Definition: desktop.h:50
#define TRUE
Definition: types.h:120
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
PSERVERINFO gpsi
Definition: imm.c:18
#define ICLS_IME
Definition: ntuser.h:927
#define TIF_INCLEANUP
Definition: ntuser.h:263
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:670
#define IS_IMM_MODE()
Definition: ntuser.h:1212
UINT_PTR WPARAM
Definition: minwindef.h:174
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
BOOL FASTCALL IntImeCanDestroyDefIMEforChild(_In_ PWND pImeWnd, _In_ PWND pwndTarget)
Definition: ime.c:2130
BOOL FASTCALL IntImeCanDestroyDefIME(_In_ PWND pImeWnd, _In_ PWND pwndTarget)
Definition: ime.c:2177
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2622
#define WS_CHILD
Definition: pedump.c:617
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define TRACE(s)
Definition: solgame.cpp:4
Definition: window.c:28
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
FLONG TIF_flags
Definition: win32.h:95
struct _WND * spwndDefaultIme
Definition: win32.h:131
Definition: ntuser.h:694
struct _WND * spwndOwner
Definition: ntuser.h:715
struct _WND * spwndLastActive
Definition: ntuser.h:739
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1060
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1707
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:495
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:205
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:575
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:360
static void IntSendDestroyMsg(HWND hWnd)
Definition: window.c:462
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2857
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:177
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1689
VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
Definition: window.c:2822
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:21
#define WOC_DELETE
Definition: winddi.h:1269
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
#define IS_WND_CHILD(pWnd)
Definition: window.h:108
static VOID WndSetLastActive(_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
Definition: window.h:185
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1267
#define SWP_NOMOVE
Definition: winuser.h:1255
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define WH_CBT
Definition: winuser.h:35
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define WM_DESTROY
Definition: winuser.h:1637
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by co_UserCreateWindowEx(), co_UserDestroyWindow(), handle_internal_message(), IntDefWindowProc(), IntDesktopObjectDelete(), IntDestroyOwnedWindows(), IntTrackPopupMenuEx(), MENU_HideSubPopups(), MENU_TrackMenu(), NtUserDestroyWindow(), and NtUserDisableThreadIme().

◆ co_UserSetFocus()

HWND FASTCALL co_UserSetFocus ( PWND  Window)

Definition at line 1311 of file focus.c.

1312{
1313 HWND hWndPrev = 0;
1314 PWND pwndTop;
1315 PTHREADINFO pti;
1316 PUSER_MESSAGE_QUEUE ThreadQueue;
1317
1318 if (Window)
1320
1322 ThreadQueue = pti->MessageQueue;
1323 ASSERT(ThreadQueue != 0);
1324
1325 TRACE("Enter SetFocus hWnd 0x%p pti 0x%p\n",Window ? UserHMGetHandle(Window) : 0, pti );
1326
1327 hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1328
1329 if (Window != 0)
1330 {
1331 if (hWndPrev == UserHMGetHandle(Window))
1332 {
1333 return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0; /* Nothing to do */
1334 }
1335
1336 if (Window->head.pti->MessageQueue != ThreadQueue)
1337 {
1338 ERR("SetFocus Must have the same Q!\n");
1339 return 0;
1340 }
1341
1342 /* Check if we can set the focus to this window */
1344 for (pwndTop = Window; pwndTop; pwndTop = pwndTop->spwndParent)
1345 {
1346 if (pwndTop->style & (WS_MINIMIZED|WS_DISABLED)) return 0;
1347 if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break;
1348 if (pwndTop->spwndParent == NULL) break;
1349 }
1352 {
1353 ERR("SetFocus 1 WH_CBT Call Hook return!\n");
1354 return 0;
1355 }
1356
1357 /* Activate pwndTop if needed. */
1358 if (pwndTop != ThreadQueue->spwndActive)
1359 {
1360 PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); // Keep it based on desktop.
1361 if (ThreadQueue != ForegroundQueue && IsAllowedFGActive(pti, pwndTop)) // Rule 2 & 3.
1362 {
1363 //ERR("SetFocus: Set Foreground!\n");
1364 if (!(pwndTop->style & WS_VISIBLE))
1365 {
1366 pti->ppi->W32PF_flags |= W32PF_ALLOWFOREGROUNDACTIVATE;
1367 }
1369 {
1370 ERR("SetFocus: Set Foreground and Focus Failed!\n");
1371 return 0;
1372 }
1373 }
1374
1375 /* Set Active when it is needed. */
1376 if (pwndTop != ThreadQueue->spwndActive)
1377 {
1378 //ERR("SetFocus: Set Active! %p\n",pwndTop?UserHMGetHandle(pwndTop):0);
1379 if (!co_IntSetActiveWindow(pwndTop, FALSE, FALSE, FALSE))
1380 {
1381 ERR("SetFocus: Set Active Failed!\n");
1382 return 0;
1383 }
1384 }
1385
1386 /* Abort if window destroyed */
1387 if (Window->state2 & WNDS2_INDESTROY) return 0;
1388 /* Do not change focus if the window is no longer active */
1389 if (pwndTop != ThreadQueue->spwndActive)
1390 {
1391 ERR("SetFocus: Top window did not go active!\n");
1392 return 0;
1393 }
1394 }
1395
1396 // Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
1397 hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1398
1400
1401 TRACE("Focus: %p -> %p\n", hWndPrev, UserHMGetHandle(Window));
1402 }
1403 else /* NULL hwnd passed in */
1404 {
1405 if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)0, (LPARAM)hWndPrev))
1406 {
1407 ERR("SetFocus: 2 WH_CBT Call Hook return!\n");
1408 return 0;
1409 }
1410 //ERR("SetFocus: Set Focus NULL\n");
1411 /* set the current thread focus window null */
1413 }
1414 return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0;
1415}
BOOL FASTCALL IsAllowedFGActive(PTHREADINFO pti, PWND Wnd)
Definition: focus.c:729
VOID FASTCALL IntSendFocusMessages(PTHREADINFO pti, PWND pWnd)
Definition: focus.c:614
BOOL FASTCALL co_IntSetActiveWindow(_In_ PWND Wnd, _In_ BOOL bMouse, _In_ BOOL bFocus, _In_ BOOL Async)
Definition: focus.c:1023
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:923
#define WNDS2_INDESTROY
Definition: ntuser.h:648
LONG_PTR LPARAM
Definition: minwindef.h:175
#define WS_DISABLED
Definition: pedump.c:621
PPROCESSINFO ppi
Definition: win32.h:88
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
DWORD style
Definition: ntuser.h:706
struct _WND * spwndParent
Definition: ntuser.h:713
#define WS_MINIMIZED
Definition: undocuser.h:20
#define W32PF_ALLOWFOREGROUNDACTIVATE
Definition: win32.h:12
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1330
#define HCBT_SETFOCUS
Definition: winuser.h:64

Referenced by co_WinPosShowWindow(), IntDefWindowProc(), IntEnableWindow(), IntSendDestroyMsg(), and NtUserSetFocus().

◆ DefSetText()

BOOL APIENTRY DefSetText ( PWND  Wnd,
PCWSTR  WindowText 
)

Definition at line 4377 of file window.c.

4378{
4380 BOOL Ret = FALSE;
4381
4382 RtlInitUnicodeString(&UnicodeString, WindowText);
4383
4384 if (UnicodeString.Length != 0)
4385 {
4386 if (Wnd->strName.MaximumLength > 0 &&
4388 {
4389 ASSERT(Wnd->strName.Buffer != NULL);
4390
4392 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4396 }
4397 else
4398 {
4399 PWCHAR buf;
4400 Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4401 buf = Wnd->strName.Buffer;
4402 Wnd->strName.Buffer = NULL;
4403 if (buf != NULL)
4404 {
4406 }
4407
4410 if (Wnd->strName.Buffer != NULL)
4411 {
4412 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4418 }
4419 else
4420 {
4422 goto Exit;
4423 }
4424 }
4425 }
4426 else
4427 {
4428 Wnd->strName.Length = 0;
4429 if (Wnd->strName.Buffer != NULL)
4430 Wnd->strName.Buffer[0] = L'\0';
4431 }
4432
4433 // FIXME: HAX! Windows does not do this in here!
4434 // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4435 // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4436 /* Send shell notifications */
4437 if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4438 {
4439 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) UserHMGetHandle(Wnd), FALSE); // FIXME Flashing?
4440 }
4441
4442 Ret = TRUE;
4443Exit:
4445 return Ret;
4446}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define UNICODE_NULL
short WCHAR
Definition: pedump.c:58
static void Exit(void)
Definition: sock.c:1330
THRDESKHEAD head
Definition: ntuser.h:695
LARGE_UNICODE_STRING strName
Definition: ntuser.h:736
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint16_t * PWCHAR
Definition: typedefs.h:56
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64

Referenced by IntDefWindowProc(), RealDefWindowProcA(), and RealDefWindowProcW().

◆ DefWndControlColor()

HBRUSH FASTCALL DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 32 of file defwnd.c.

33{
34 if (ctlType == CTLCOLOR_SCROLLBAR)
35 {
40
41 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
42 * we better use 0x55aa bitmap brush to make scrollbar's background
43 * look different from the window background.
44 */
45 if ( bk == IntGetSysColor(COLOR_WINDOW))
46 return gpsi->hbrGray;
47
49 return hb;
50 }
51
53
54 if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
55 {
57 }
58 else
59 {
62 }
63
65}
static HDC hDC
Definition: 3dtext.c:33
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
__kernel_entry W32KAPI BOOL APIENTRY NtGdiUnrealizeObject(_In_ HANDLE h)
DWORD COLORREF
Definition: windef.h:100
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:967
#define COLOR_WINDOW
Definition: winuser.h:929
#define COLOR_SCROLLBAR
Definition: winuser.h:923
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
#define CTLCOLOR_LISTBOX
Definition: winuser.h:964
#define CTLCOLOR_EDIT
Definition: winuser.h:963
#define COLOR_3DHILIGHT
Definition: winuser.h:948
#define COLOR_3DFACE
Definition: winuser.h:940

◆ DefWndDoSizeMove()

VOID FASTCALL DefWndDoSizeMove ( PWND  pwnd,
WORD  wParam 
)

Definition at line 259 of file nonclient.c.

260{
261 MSG msg;
262 RECT sizingRect, mouseRect, origRect, unmodRect, snapPreviewRect;
263 PRECT pFrameRect = &sizingRect;
264 HDC hdc;
265 LONG hittest = (LONG)(wParam & 0x0f);
266 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
267 POINT minTrack, maxTrack;
268 POINT capturePoint, pt;
270 UINT orgSnap = IntGetWindowSnapEdge(pwnd), snap = orgSnap;
271 BOOL thickframe;
272 BOOL iconic;
273 BOOL moved = FALSE;
274 BOOL DragFullWindows = FALSE;
275 PWND pWndParent = NULL;
276 WPARAM syscommand = (wParam & 0xfff0);
278 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
279 // The task bar can grow in size and can not reduce due to the change
280 // in the work area.
281
282 Style = pwnd->style;
283 ExStyle = pwnd->ExStyle;
284 iconic = (Style & WS_MINIMIZE) != 0;
285
286 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
287 if ((Style & (WS_MAXIMIZE | WS_CHILD)) == WS_MAXIMIZE)
288 orgSnap = snap = HTTOP;
289
290 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
291
292 //
293 // Show window contents while dragging the window, get flag from registry data.
294 //
295 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
296
297 pt.x = pti->ptLast.x;
298 pt.y = pti->ptLast.y;
299 capturePoint = pt;
301
302 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
303 pwnd, syscommand, hittest, pt.x, pt.y);
304
305 if (syscommand == SC_MOVE)
306 {
307 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
308 if (!hittest) return;
309 }
310 else /* SC_SIZE */
311 {
312 if (!thickframe) return;
313 if (hittest && (syscommand != SC_MOUSEMENU))
314 {
315 hittest += (HTLEFT - WMSZ_LEFT);
316 }
317 else
318 {
320 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
321 if (!hittest)
322 {
324 return;
325 }
326 }
327 }
328
329 /* Get min/max info */
330
331 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
332 sizingRect = pwnd->rcWindow;
333 origRect = sizingRect;
334 if (Style & WS_CHILD)
335 {
336 pWndParent = IntGetParent(pwnd);
337 IntGetClientRect( pWndParent, &mouseRect );
338 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
339 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
340 unmodRect = sizingRect;
341 }
342 else
343 {
344 if (!(ExStyle & WS_EX_TOPMOST))
345 {
346 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
347 }
348 else
349 {
351 }
352 unmodRect = sizingRect;
353 }
354
355 if (ON_LEFT_BORDER(hittest))
356 {
357 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
358 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
359 }
360 else if (ON_RIGHT_BORDER(hittest))
361 {
362 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
363 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
364 }
365 if (ON_TOP_BORDER(hittest))
366 {
367 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
368 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
369 }
370 else if (ON_BOTTOM_BORDER(hittest))
371 {
372 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
373 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
374 }
375
376 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
377 if (iconic)
378 {
379 DragCursor = pwnd->pcls->spicn;
380 if (DragCursor)
381 {
382 UserReferenceObject(DragCursor);
383 }
384 else
385 {
386 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
387 if (CursorHandle)
388 {
389 DragCursor = UserGetCurIconObject(CursorHandle);
390 }
391 else
392 {
393 iconic = FALSE;
394 }
395 }
396 }
397
398 /* repaint the window before moving it around */
400
401 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
402
404
406
408
409 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
410
411 for(;;)
412 {
413 int dx = 0, dy = 0;
414
415 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
416 if (msg.message == WM_QUIT)
417 {
418 MsqPostQuitMessage(pti, (ULONG)msg.wParam);
419 break;
420 }
421 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
422
423 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
424 break; // Exit on Return or Esc
425
426 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
427 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
428 { // If no WindowSnapEnabled: Exit on button-up immediately
429 break;
430 }
431 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
432 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
433 { // If WindowSnapEnabled: Decide whether to snap before exiting
434 if (hittest == HTCAPTION && thickframe && /* Check for snapping if was moved by caption */
436 {
437 BOOLEAN wasSnap = IntIsWindowSnapped(pwnd); /* Need the live snap state, not orgSnap nor maximized state */
438 UINT snapTo = iconic ? HTNOWHERE : GetSnapActivationPoint(pwnd, pt);
439 if (snapTo)
440 {
441 if (DragFullWindows)
442 {
443 co_IntSnapWindow(pwnd, snapTo);
444 if (!wasSnap)
445 pwnd->InternalPos.NormalRect = origRect;
446 }
447 snap = snapTo;
448 }
449 }
450 break;
451 }
452
453 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
454 {
457 continue; /* We are not interested in other messages */
458 }
459
460 pt = msg.pt;
461
462 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
463 {
464 case VK_UP: pt.y -= 8; break;
465 case VK_DOWN: pt.y += 8; break;
466 case VK_LEFT: pt.x -= 8; break;
467 case VK_RIGHT: pt.x += 8; break;
468 }
469
470 pt.x = max( pt.x, mouseRect.left );
471 pt.x = min( pt.x, mouseRect.right - 1 );
472 pt.y = max( pt.y, mouseRect.top );
473 pt.y = min( pt.y, mouseRect.bottom - 1 );
474
475 dx = pt.x - capturePoint.x;
476 dy = pt.y - capturePoint.y;
477
478 if (dx || dy)
479 {
480 if (!moved)
481 {
482 moved = TRUE;
483 if (iconic) /* ok, no system popup tracking */
484 {
485 OldCursor = UserSetCursor(DragCursor, FALSE);
487 }
488 else if (!DragFullWindows)
489 UserDrawMovingFrame(hdc, &sizingRect, thickframe);
490 }
491
492 if (msg.message == WM_KEYDOWN)
493 {
494 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
495 }
496 else
497 {
498 RECT newRect = unmodRect;
499
500 if (!iconic && !DragFullWindows)
501 {
502 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
503 pFrameRect = &sizingRect;
504 }
505 if (hittest == HTCAPTION)
506 {
507 /* Restore window size if it is snapped */
508 PRECT pr = &newRect;
509 LONG width, height, capcy, snapTo;
510 if (snap && syscommand == SC_MOVE && !iconic &&
511 !RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect))
512 {
513 *pr = pwnd->InternalPos.NormalRect;
514 origRect = *pr; /* Save normal size - is required when window unsnapped from one side and snapped to another holding mouse down */
515
516 /* Try to position the center of the caption where the mouse is horizontally */
517 capcy = UserGetSystemMetrics((ExStyle & WS_EX_TOPMOST) ? SM_CYSMCAPTION : SM_CYCAPTION); /* No border, close enough */
518 width = pr->right - pr->left;
519 height = pr->bottom - pr->top;
520 pr->left = pt.x - width / 2;
521 pr->right = pr->left + width;
522 pr->top = mouseRect.top;
523 pr->bottom = pr->top + height;
524 if (pr->left < mouseRect.left)
525 {
526 pr->left = mouseRect.left;
527 pr->right = pr->left + width;
528 }
529 if ((pwnd->ExStyle & WS_EX_LAYOUTRTL) && pr->right > mouseRect.right)
530 {
531 pr->left = mouseRect.right - width;
532 pr->right = pr->left + width;
533 }
534 UserSetCursorPos(pt.x, pr->top + capcy / 2, 0, 0, FALSE);
535 snap = FALSE;
536 dx = dy = 0; /* Don't offset this move */
537 if (DragFullWindows)
538 {
539 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
541
542 /* Have to move and size it now because we don't want SWP_NOSIZE */
544 }
545 }
546 else if (!snap && syscommand == SC_MOVE && !iconic)
547 {
548 if ((snapTo = GetSnapActivationPoint(pwnd, pt)) != 0)
549 {
550 co_IntCalculateSnapPosition(pwnd, snapTo, &snapPreviewRect);
551 if (DragFullWindows)
552 {
553 /* TODO: Show preview of snap */
554 }
555 else
556 {
557 pFrameRect = &snapPreviewRect;
558 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
559 continue;
560 }
561 }
562 }
563
564 /* regular window moving */
565 RECTL_vOffsetRect(&newRect, dx, dy);
566 }
567 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
568 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
569 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
570 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
571
572 capturePoint = pt;
573
574 //
575 // Save the new position to the unmodified rectangle. This allows explorer task bar
576 // sizing. Explorer will forces back the position unless a certain amount of sizing
577 // has occurred.
578 //
579 unmodRect = newRect;
580
581 /* Determine the hit location */
582 if (syscommand == SC_SIZE)
583 {
584 WPARAM wpSizingHit = 0;
585
586 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
587 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
588 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
589 }
590 else
591 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
592
593 if (!iconic)
594 {
595 if (!DragFullWindows)
596 UserDrawMovingFrame( hdc, &newRect, thickframe );
597 else
598 { // Moving the whole window now!
599 HRGN hrgnNew;
600 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
601
602 if (pwnd->hrgnClip != NULL)
603 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
604
606 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
608 NULL,
609 newRect.left,
610 newRect.top,
611 newRect.right - newRect.left,
612 newRect.bottom - newRect.top,
613 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
614
615 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
616 if (pwnd->hrgnClip != NULL)
617 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
618
619 if (hrgnNew)
620 {
621 if (hrgnOrig)
622 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
623 }
624 else
625 {
626 if (hrgnOrig)
627 {
628 GreDeleteObject(hrgnOrig);
629 hrgnOrig = 0;
630 }
631 }
632
633 // Update all the windows after the move or size, including this window.
634 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
635
636 if (hrgnOrig) GreDeleteObject(hrgnOrig);
637 if (hrgnNew) GreDeleteObject(hrgnNew);
638 }
639 }
640 sizingRect = newRect;
641 }
642 }
643 }
644
645 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
646
648
649 if ( iconic )
650 {
651 if ( moved ) /* restore cursors, show icon title later on */
652 {
654 OldCursor = UserSetCursor(OldCursor, FALSE);
655 }
656
657 /* It could be that the cursor was already changed while we were proceeding,
658 * so we must unreference whatever cursor was current at the time we restored the old one.
659 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
660 */
661 if (OldCursor) UserDereferenceObject(OldCursor);
662 }
663 else
664 {
665 UINT eraseFinalFrame = moved && !DragFullWindows;
666 if (eraseFinalFrame)
667 UserDrawMovingFrame(hdc, pFrameRect, thickframe); // Undo the XOR drawing
668 }
669
671
673 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
674
676 {
677 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
678 moved = FALSE;
679 }
680
681 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
682
684
689 /* window moved or resized */
690 if (moved)
691 {
692 BOOL forceSizing = !iconic && hittest == HTCAPTION && (!!orgSnap != !!snap);
693 UINT swp = (!forceSizing && hittest == HTCAPTION) ? SWP_NOSIZE : 0;
694
695 /* if the moving/resizing isn't canceled call SetWindowPos
696 * with the new position or the new size of the window
697 */
698 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
699 {
700 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
701 if (!DragFullWindows || iconic)
702 {
703 if (snap)
704 {
705 co_IntSnapWindow(pwnd, snap);
706 }
707 else
708 {
709 if (orgSnap && !snap)
710 {
711 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
713 }
714 co_WinPosSetWindowPos(pwnd, HWND_TOP, sizingRect.left, sizingRect.top,
715 sizingRect.right - sizingRect.left,
716 sizingRect.bottom - sizingRect.top, swp);
717 }
718 }
719 }
720 else
721 {
722 /* restore previous size/position */
723 if (orgSnap)
724 {
725 co_IntSnapWindow(pwnd, orgSnap);
726 }
727 else if (DragFullWindows)
728 {
729 co_WinPosSetWindowPos(pwnd, HWND_TOP, origRect.left, origRect.top,
730 origRect.right - origRect.left,
731 origRect.bottom - origRect.top, swp);
732 }
733 }
734 }
735
736 if (IntIsWindow(UserHMGetHandle(pwnd)))
737 {
738 /* Single click brings up the system menu when iconized */
739 if (iconic && !moved && (Style & WS_SYSMENU))
740 {
742 }
743 }
744}
unsigned char BOOLEAN
Definition: actypes.h:127
const DWORD Style
Definition: appswitch.c:72
const DWORD ExStyle
Definition: appswitch.c:73
WPARAM wParam
Definition: combotst.c:138
#define pt(x, y)
Definition: drawing.c:79
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1453
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1436
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1525
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
unsigned int UINT
Definition: sysinfo.c:13
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3613
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:278
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define min(a, b)
Definition: monoChain.cc:55
VOID FASTCALL MsqPostQuitMessage(PTHREADINFO pti, ULONG ExitCode)
Definition: msgqueue.c:1381
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2507
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4041
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3969
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3939
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3931
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:4016
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_EX_TOPMOST
Definition: pedump.c:647
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:585
POINT ptLast
Definition: win32.h:129
DWORD ExStyle
Definition: ntuser.h:704
HRGN hrgnClip
Definition: ntuser.h:733
PCLS pcls
Definition: ntuser.h:720
struct _WND::@5624 InternalPos
RECT rcWindow
Definition: ntuser.h:716
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define max(a, b)
Definition: svc.c:63
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
#define WM_SETVISIBLE
Definition: undocuser.h:33
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:897
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1102
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1165
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
BOOL APIENTRY UserClipCursor(RECTL *prcl)
Definition: cursoricon.c:702
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1408
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1499
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2190
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:890
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1226
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:209
static UINT GetSnapActivationPoint(PWND Wnd, POINT pt)
Definition: nonclient.c:140
#define ON_BOTTOM_BORDER(hit)
Definition: nonclient.c:31
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
#define ON_TOP_BORDER(hit)
Definition: nonclient.c:29
LONG FASTCALL DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint)
Definition: nonclient.c:155
#define ON_RIGHT_BORDER(hit)
Definition: nonclient.c:27
#define ON_LEFT_BORDER(hit)
Definition: nonclient.c:25
VOID FASTCALL UserDrawMovingFrame(HDC hdc, RECTL *rect, BOOL thickframe)
Definition: nonclient.c:56
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:643
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:730
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2123
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:144
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:190
HICON HCURSOR
Definition: windef.h:99
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:144
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_AND
Definition: wingdi.h:356
FORCEINLINE BOOLEAN IntIsWindowSnapped(PWND Wnd)
Definition: winpos.h:95
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SC_MOUSEMENU
Definition: winuser.h:2631
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define WM_QUIT
Definition: winuser.h:1651
#define DCX_CACHE
Definition: winuser.h:2150
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2512
#define VK_UP
Definition: winuser.h:2261
#define RDW_UPDATENOW
Definition: winuser.h:1231
#define WM_QUERYDRAGICON
Definition: winuser.h:1682
#define WMSZ_LEFT
Definition: winuser.h:2500
#define SC_SIZE
Definition: winuser.h:2620
#define VK_RETURN
Definition: winuser.h:2237
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1852
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define PM_REMOVE
Definition: winuser.h:1207
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2531
#define HTNOWHERE
Definition: winuser.h:2510
#define SC_MOVE
Definition: winuser.h:2621
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define MSGF_SIZE
Definition: winuser.h:1188
#define VK_LEFT
Definition: winuser.h:2260
#define WM_SIZING
Definition: winuser.h:1835
#define VK_RIGHT
Definition: winuser.h:2262
#define HTTOP
Definition: winuser.h:2526
#define VK_DOWN
Definition: winuser.h:2263
#define MK_LBUTTON
Definition: winuser.h:2403
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_MOVING
Definition: winuser.h:1837
#define HTSYSMENU
Definition: winuser.h:2513
#define HTLEFT
Definition: winuser.h:2523
#define VK_ESCAPE
Definition: winuser.h:2250
#define SM_CYCAPTION
Definition: winuser.h:974
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1851

Referenced by DefWndHandleSysCommand().

◆ DWP_GetEnabledPopup()

PWND FASTCALL DWP_GetEnabledPopup ( PWND  pWnd)

Definition at line 494 of file defwnd.c.

495{
496 PWND pwndNode1;
497 PTHREADINFO pti = pWnd->head.pti, ptiNode;
498 BOOL bFoundNullNode = FALSE;
499
500 for (pwndNode1 = pWnd->spwndNext; pwndNode1 != pWnd; )
501 {
502 if (!pwndNode1) /* NULL detected? */
503 {
504 if (bFoundNullNode)
505 return NULL;
506 bFoundNullNode = TRUE;
507 /* Retry with parent's first child (once only) */
508 pwndNode1 = pWnd->spwndParent->spwndChild;
509 continue;
510 }
511
512 /*
513 * 1. We want to detect the window that owns the same input target of pWnd.
514 * 2. For non-16-bit apps, we need to check the two threads' input queues to
515 * see whether they are the same, while for 16-bit apps it's sufficient to
516 * only check the thread info pointers themselves (ptiNode and pti).
517 * See also:
518 * https://devblogs.microsoft.com/oldnewthing/20060221-09/?p=32203
519 * https://github.com/reactos/reactos/pull/7700#discussion_r1939435931
520 */
521 ptiNode = pwndNode1->head.pti;
522 if ((!(pti->TIF_flags & TIF_16BIT) && ptiNode->MessageQueue == pti->MessageQueue) ||
523 ((pti->TIF_flags & TIF_16BIT) && ptiNode == pti))
524 {
525 DWORD style = pwndNode1->style;
526 if ((style & WS_VISIBLE) && !(style & WS_DISABLED)) /* Visible and enabled? */
527 {
528 /* Does pwndNode1 have a pWnd as an ancestor? */
529 PWND pwndNode2;
530 for (pwndNode2 = pwndNode1->spwndOwner; pwndNode2;
531 pwndNode2 = pwndNode2->spwndOwner)
532 {
533 if (pwndNode2 == pWnd)
534 return pwndNode1;
535 }
536 }
537 }
538
539 pwndNode1 = pwndNode1->spwndNext;
540 }
541
542 return NULL;
543}
Arabic default style
Definition: afstyles.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TIF_16BIT
Definition: ntuser.h:264
struct _WND * spwndNext
Definition: ntuser.h:711

Referenced by NtUserCallHwnd().

◆ GetControlBrush()

HBRUSH FASTCALL GetControlBrush ( PWND  pwnd,
HDC  hdc,
UINT  ctlType 
)

Definition at line 179 of file misc.c.

183{
184 PWND pwndParent = IntGetParent(pwnd);
185 return GetControlColor( pwndParent, pwnd, hdc, ctlType);
186}
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:153

Referenced by EDIT_NotifyCtlColor(), IntDrawScrollInterior(), NtUserGetControlBrush(), and STATIC_SendWmCtlColorStatic().

◆ GetControlColor()

HBRUSH FASTCALL GetControlColor ( PWND  pwndParent,
PWND  pwnd,
HDC  hdc,
UINT  CtlMsg 
)

Definition at line 153 of file misc.c.

158{
159 HBRUSH hBrush;
160
161 if (!pwndParent) pwndParent = pwnd;
162
163 if ( pwndParent->head.pti->ppi != PsGetCurrentProcessWin32Process())
164 {
165 return (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
166 }
167
168 hBrush = (HBRUSH)co_IntSendMessage( UserHMGetHandle(pwndParent), CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd));
169
170 if (!hBrush || !GreIsHandleValid(hBrush))
171 {
172 hBrush = (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
173 }
174 return hBrush;
175}
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:633
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1153

Referenced by ButtonWndProc_common(), CB_Paint(), COMBO_PrepareColors(), DEFDLG_Proc(), GB_Paint(), GetControlBrush(), IntFillWindow(), LISTBOX_Paint(), LISTBOX_RepaintItem(), ListBoxWndProc_common(), NtUserGetControlColor(), OB_Paint(), PB_Paint(), and UB_Paint().

◆ GetLayeredStatus()

BOOL FASTCALL GetLayeredStatus ( PWND  pWnd)

Definition at line 23 of file layered.c.

24{
25 PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
26 if (pLrdProp)
27 {
28 return pLrdProp->is_Layered;
29 }
30 return FALSE;
31}
ATOM AtomLayer
Definition: ntuser.c:21
BYTE is_Layered
Definition: layered.c:17
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46

Referenced by NtUserUpdateLayeredWindow().

◆ GetProcessLuid()

NTSTATUS GetProcessLuid ( IN PETHREAD Thread  OPTIONAL,
IN PEPROCESS Process  OPTIONAL,
OUT PLUID  Luid 
)

Definition at line 814 of file misc.c.

818{
823
824 if (Thread && Process)
826
827 /* If nothing has been specified, use the current thread */
828 if (!Thread && !Process)
830
831 if (Thread)
832 {
833 /* Use a thread token */
834 ASSERT(!Process);
836 &CopyOnOpen,
839
840 /* If we don't have a thread token, use a process token */
841 if (!Token)
843 }
844 if (!Token && Process)
845 {
846 /* Use a process token */
848
849 /* If we don't have a token, fail */
850 if (!Token)
851 return STATUS_NO_TOKEN;
852 }
853 ASSERT(Token);
854
855 /* Query the LUID */
857
858 /* Get rid of the token and return */
860 return Status;
861}
LONG NTSTATUS
Definition: precomp.h:26
PEPROCESS __stdcall PsGetThreadProcess(_In_ PETHREAD Thread)
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:24
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN EffectiveOnly
Definition: sefuncs.h:410
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:871
NTSTATUS NTAPI SeQueryAuthenticationIdToken(_In_ PACCESS_TOKEN Token, _Out_ PLUID LogonId)
Queries the authentication ID of an access token.
Definition: token.c:2037
#define STATUS_NO_TOKEN
Definition: ntstatus.h:454
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ObDereferenceObject
Definition: obfuncs.h:203
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:155
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:157

Referenced by BuildUserModeWindowStationName(), IntResolveDesktop(), UserEndShutdown(), and UserInitiateShutdown().

◆ InitMetrics()

BOOL NTAPI InitMetrics ( VOID  )

Definition at line 40 of file metric.c.

41{
42 INT *piSysMet = gpsi->aiSysMet;
44
45 /* Note: used for the SM_CLEANBOOT metric */
46 DWORD dwValue = 0;
47 HKEY hKey = 0;
48
49 /* Clean boot */
50 piSysMet[SM_CLEANBOOT] = 0; // Fallback value of 0 (normal mode)
51 if(NT_SUCCESS(RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", &hKey)))
52 {
53 if(RegReadDWORD(hKey, L"OptionValue", &dwValue)) piSysMet[SM_CLEANBOOT] = (INT)dwValue;
55 }
56
57 /* FIXME: HACK, due to missing MDEV on first init */
58 if (!gpmdev)
59 {
60 Width = 640;
61 Height = 480;
62 }
63 else
64 {
67 }
68
69 /* Screen sizes */
70 piSysMet[SM_CXSCREEN] = Width;
71 piSysMet[SM_CYSCREEN] = Height;
72 piSysMet[SM_XVIRTUALSCREEN] = 0;
73 piSysMet[SM_YVIRTUALSCREEN] = 0;
74 piSysMet[SM_CXVIRTUALSCREEN] = Width;
75 piSysMet[SM_CYVIRTUALSCREEN] = Height;
76
77 /* NC area sizes */
78 piSysMet[SM_CYCAPTION] = gspv.ncm.iCaptionHeight + 1; // 19
79 piSysMet[SM_CYSMCAPTION] = gspv.ncm.iSmCaptionHeight + 1; // 15;
80 piSysMet[SM_CXSIZE] = gspv.ncm.iCaptionHeight; // 18;
81 piSysMet[SM_CYSIZE] = gspv.ncm.iCaptionHeight; // 18;
82 piSysMet[SM_CXSMSIZE] = gspv.ncm.iSmCaptionWidth; // 12; XP: piSysMet(SM_CYSMCAPTION) - 1
83 piSysMet[SM_CYSMSIZE] = gspv.ncm.iSmCaptionHeight; // 14;
84 piSysMet[SM_CXBORDER] = 1; // Seems to be hardcoded
85 piSysMet[SM_CYBORDER] = 1; // Seems to be hardcoded
86 piSysMet[SM_CXFOCUSBORDER] = 1;
87 piSysMet[SM_CYFOCUSBORDER] = 1;
88 piSysMet[SM_CXDLGFRAME] = 3;
89 piSysMet[SM_CYDLGFRAME] = 3;
90 piSysMet[SM_CXEDGE] = 2;
91 piSysMet[SM_CYEDGE] = 2;
92 piSysMet[SM_CXFRAME] = piSysMet[SM_CXDLGFRAME] + gspv.ncm.iBorderWidth; // 4
93 piSysMet[SM_CYFRAME] = piSysMet[SM_CYDLGFRAME] + gspv.ncm.iBorderWidth; // 4
94#if (_WIN32_WINNT >= 0x0600)
95 piSysMet[SM_CXPADDEDBORDER] = 0;
96#endif
97
98 /* Window sizes */
99 TRACE("ncm.iCaptionWidth=%d,GetSystemMetrics(SM_CYSIZE)=%d,GetSystemMetrics(SM_CXFRAME)=%d,avcwCaption=%d \n",
100 gspv.ncm.iCaptionWidth, piSysMet[SM_CYSIZE],piSysMet[SM_CXFRAME], gspv.tmCaptionFont.tmAveCharWidth);
101
102 piSysMet[SM_CXMIN] = 3 * max(gspv.ncm.iCaptionWidth, 8) // 112
103 + piSysMet[SM_CYSIZE] + 4
105 + 2 * piSysMet[SM_CXFRAME];
106 piSysMet[SM_CYMIN] = piSysMet[SM_CYCAPTION] + 2 * piSysMet[SM_CYFRAME]; // 27
107 piSysMet[SM_CXMAXIMIZED] = piSysMet[SM_CXSCREEN] + 2 * piSysMet[SM_CXFRAME];
108 piSysMet[SM_CYMAXIMIZED] = piSysMet[SM_CYSCREEN] - 20;
109 piSysMet[SM_CXFULLSCREEN] = piSysMet[SM_CXSCREEN];
110 piSysMet[SM_CYFULLSCREEN] = piSysMet[SM_CYMAXIMIZED] - piSysMet[SM_CYMIN];
111 piSysMet[SM_CYKANJIWINDOW] = 0;
112 piSysMet[SM_CXMINIMIZED] = gspv.mm.iWidth + 6;
113 piSysMet[SM_CYMINIMIZED] = piSysMet[SM_CYCAPTION] + 5;
114 piSysMet[SM_CXMINSPACING] = piSysMet[SM_CXMINIMIZED] + gspv.mm.iHorzGap;
115 piSysMet[SM_CYMINSPACING] = piSysMet[SM_CYMINIMIZED] + gspv.mm.iVertGap;
116 piSysMet[SM_CXMAXTRACK] = piSysMet[SM_CXVIRTUALSCREEN] + 4
117 + 2 * piSysMet[SM_CXFRAME];
118 piSysMet[SM_CYMAXTRACK] = piSysMet[SM_CYVIRTUALSCREEN] + 4
119 + 2 * piSysMet[SM_CYFRAME];
120
121 /* Icon */
122 piSysMet[SM_CXVSCROLL] = gspv.ncm.iScrollWidth; // 16;
123 piSysMet[SM_CYVTHUMB] = gspv.ncm.iScrollHeight; // 16;
124 piSysMet[SM_CYHSCROLL] = gspv.ncm.iScrollWidth; // 16;
125 piSysMet[SM_CXHTHUMB] = gspv.ncm.iScrollHeight; // 16;
126 piSysMet[SM_CYVSCROLL] = gspv.ncm.iScrollHeight; // 16
127 piSysMet[SM_CXHSCROLL] = gspv.ncm.iScrollHeight; // 16;
128 piSysMet[SM_CXICON] = 32;
129 piSysMet[SM_CYICON] = 32;
130 piSysMet[SM_CXSMICON] = 16;
131 piSysMet[SM_CYSMICON] = 16;
132 piSysMet[SM_CXICONSPACING] = gspv.im.iHorzSpacing; // 64;
133 piSysMet[SM_CYICONSPACING] = gspv.im.iVertSpacing; // 64;
134 piSysMet[SM_CXCURSOR] = 32;
135 piSysMet[SM_CYCURSOR] = 32;
136 piSysMet[SM_CXMINTRACK] = piSysMet[SM_CXMIN]; // 117
137 piSysMet[SM_CYMINTRACK] = piSysMet[SM_CYMIN]; // 27
138 piSysMet[SM_CXDRAG] = 4;
139 piSysMet[SM_CYDRAG] = 4;
140 piSysMet[SM_ARRANGE] = gspv.mm.iArrange; // 8;
141
142 /* Menu */
143 piSysMet[SM_CYMENU] = gspv.ncm.iMenuHeight + 1; // 19;
145 piSysMet[SM_CXMENUCHECK] = ((1 + gspv.tmMenuFont.tmHeight +
146 gspv.tmMenuFont.tmExternalLeading) & ~1) - 1; // 13;
147 piSysMet[SM_CYMENUCHECK] = piSysMet[SM_CXMENUCHECK];
148 piSysMet[SM_CXMENUSIZE] = gspv.ncm.iMenuWidth; // 18;
149 piSysMet[SM_CYMENUSIZE] = gspv.ncm.iMenuHeight; // 18;
150
151 /* Mouse */
152 piSysMet[SM_MOUSEPRESENT] = 1;
153 piSysMet[SM_MOUSEWHEELPRESENT] = 1;
154 piSysMet[SM_CMOUSEBUTTONS] = 2;
155 piSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap ? 1 : 0;
158#if (_WIN32_WINNT >= 0x0600)
159 piSysMet[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
160#endif
161
162 /* Version info */
163 piSysMet[SM_TABLETPC] = 0;
164 piSysMet[SM_MEDIACENTER] = 0;
165 piSysMet[SM_STARTER] = 0;
166 piSysMet[SM_SERVERR2] = 0;
167 piSysMet[SM_PENWINDOWS] = 0;
168
169 /* Other */
170 piSysMet[SM_DEBUG] = 0;
171 piSysMet[SM_NETWORK] = 3;
172 piSysMet[SM_SLOWMACHINE] = 0;
173 piSysMet[SM_SECURE] = 0;
175 piSysMet[SM_SHOWSOUNDS] = gspv.bShowSounds;
176 piSysMet[SM_MIDEASTENABLED] = 0;
177 piSysMet[SM_CMONITORS] = 1;
178 piSysMet[SM_SAMEDISPLAYFORMAT] = 1;
179 piSysMet[SM_IMMENABLED] = NLS_MB_CODE_PAGE_TAG;
180
181 /* Reserved */
182 piSysMet[SM_RESERVED1] = 0;
183 piSysMet[SM_RESERVED2] = 0;
184 piSysMet[SM_RESERVED3] = 0;
185 piSysMet[SM_RESERVED4] = 0;
186 piSysMet[64] = 0;
187 piSysMet[65] = 0;
188 piSysMet[66] = 0;
189#if (_WIN32_WINNT >= 0x0600)
190 piSysMet[90] = 0;
191#endif
192
193 if (UserIsDBCSEnabled())
194 gpsi->dwSRVIFlags |= SRVINFO_DBCSENABLED; /* DBCS Support */
195
197 gpsi->dwSRVIFlags |= SRVINFO_IMM32; /* IME Support */
198
200 gpsi->dwSRVIFlags |= SRVINFO_CTFIME_ENABLED; /* CTF IME support */
201
202 Setup = TRUE;
203
204 return TRUE;
205}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
FxAutoRegKey hKey
#define SRVINFO_DBCSENABLED
Definition: ntuser.h:948
#define SRVINFO_IMM32
Definition: ntuser.h:949
#define SRVINFO_CTFIME_ENABLED
Definition: ntuser.h:951
if(dx< 0)
Definition: linetemp.h:194
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define NLS_MB_CODE_PAGE_TAG
Definition: nt_native.h:212
#define INT
Definition: polytest.cpp:20
ULONG ulVertRes
Definition: winddi.h:883
ULONG ulHorzRes
Definition: winddi.h:882
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
GDIINFO gdiinfo
Definition: pdevobj.h:123
MINIMIZEDMETRICS mm
Definition: sysparams.h:52
TEXTMETRICW tmCaptionFont
Definition: sysparams.h:139
NONCLIENTMETRICSW ncm
Definition: sysparams.h:51
INT iDblClickHeight
Definition: sysparams.h:89
BOOL bMouseBtnSwap
Definition: sysparams.h:82
TEXTMETRICW tmMenuFont
Definition: sysparams.h:138
ICONMETRICSW im
Definition: sysparams.h:53
BOOL bMenuDropAlign
Definition: sysparams.h:130
BOOL bShowSounds
Definition: sysparams.h:71
INT iDblClickWidth
Definition: sysparams.h:88
DWORD dwSRVIFlags
Definition: ntuser.h:1051
LONG tmAveCharWidth
Definition: wingdi.h:2834
LONG tmExternalLeading
Definition: wingdi.h:2833
LONG tmHeight
Definition: wingdi.h:2829
int32_t INT
Definition: typedefs.h:58
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
BOOL NTAPI RegReadDWORD(HKEY hkey, PCWSTR pwszValue, PDWORD pdwData)
Definition: registry.c:149
static BOOL Setup
Definition: metric.c:13
BOOL FASTCALL UserIsCTFIMEEnabled(VOID)
Definition: metric.c:30
BOOL FASTCALL UserIsIMMEnabled(VOID)
Definition: metric.c:22
BOOL FASTCALL UserIsDBCSEnabled(VOID)
Definition: metric.c:17
SPIVALUES gspv
Definition: sysparams.c:17
#define RegOpenKey
Definition: winreg.h:551
#define SM_MENUDROPALIGNMENT
Definition: winuser.h:1014
#define SM_CXMINIMIZED
Definition: winuser.h:1031
#define SM_NETWORK
Definition: winuser.h:1037
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1050
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_MIDEASTENABLED
Definition: winuser.h:1045
#define SM_CXDRAG
Definition: winuser.h:1039
#define SM_CXDOUBLECLK
Definition: winuser.h:1010
#define SM_CXHTHUMB
Definition: winuser.h:982
#define SM_RESERVED3
Definition: winuser.h:998
#define SM_CXEDGE
Definition: winuser.h:1019
#define SM_CYVSCROLL
Definition: winuser.h:992
#define SM_CMOUSEBUTTONS
Definition: winuser.h:1017
#define SM_CXMENUCHECK
Definition: winuser.h:1042
#define SM_CYSIZE
Definition: winuser.h:1003
#define SM_PENWINDOWS
Definition: winuser.h:1015
#define SM_CXMINTRACK
Definition: winuser.h:1008
#define SM_MOUSEPRESENT
Definition: winuser.h:991
#define SM_CXVSCROLL
Definition: winuser.h:972
#define SM_SAMEDISPLAYFORMAT
Definition: winuser.h:1052
#define SM_CYVTHUMB
Definition: winuser.h:981
#define SM_CYMINIMIZED
Definition: winuser.h:1032
#define SM_DEBUG
Definition: winuser.h:994
#define SM_CXFRAME
Definition: winuser.h:1005
#define SM_CYICONSPACING
Definition: winuser.h:1013
#define SM_MOUSEWHEELPRESENT
Definition: winuser.h:1046
#define SM_CYMENU
Definition: winuser.h:987
#define SM_CYSMICON
Definition: winuser.h:1024
#define SM_CYDOUBLECLK
Definition: winuser.h:1011
#define SM_CXSIZE
Definition: winuser.h:1002
#define SM_CYFRAME
Definition: winuser.h:1007
#define SM_CYHSCROLL
Definition: winuser.h:973
#define SM_CXFULLSCREEN
Definition: winuser.h:988
#define SM_RESERVED1
Definition: winuser.h:996
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1049
#define SM_CXMIN
Definition: winuser.h:1000
#define SM_CYBORDER
Definition: winuser.h:976
#define SM_CXSMICON
Definition: winuser.h:1023
#define SM_CYMIN
Definition: winuser.h:1001
#define SM_CYMENUCHECK
Definition: winuser.h:1043
#define SM_CYICON
Definition: winuser.h:984
#define SM_CXMAXTRACK
Definition: winuser.h:1033
#define SM_CXMAXIMIZED
Definition: winuser.h:1035
#define SM_CYMINSPACING
Definition: winuser.h:1022
#define SM_CXSMSIZE
Definition: winuser.h:1026
#define SM_CXBORDER
Definition: winuser.h:975
#define SM_RESERVED2
Definition: winuser.h:997
#define SM_CYMAXTRACK
Definition: winuser.h:1034
#define SM_CYFULLSCREEN
Definition: winuser.h:989
#define SM_DBCSENABLED
Definition: winuser.h:1016
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define SM_CYKANJIWINDOW
Definition: winuser.h:990
#define SM_CXHSCROLL
Definition: winuser.h:993
#define SM_RESERVED4
Definition: winuser.h:999
#define SM_SHOWSOUNDS
Definition: winuser.h:1041
#define SM_CXMENUSIZE
Definition: winuser.h:1028
#define SM_ARRANGE
Definition: winuser.h:1030
#define SM_CYSMSIZE
Definition: winuser.h:1027
#define SM_CYDLGFRAME
Definition: winuser.h:979
#define SM_CLEANBOOT
Definition: winuser.h:1038
#define SM_SWAPBUTTON
Definition: winuser.h:995
#define SM_SLOWMACHINE
Definition: winuser.h:1044
#define SM_CYMENUSIZE
Definition: winuser.h:1029
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1047
#define SM_CYCURSOR
Definition: winuser.h:986
#define SM_CYDRAG
Definition: winuser.h:1040
#define SM_CXICON
Definition: winuser.h:983
#define SM_CMONITORS
Definition: winuser.h:1051
#define SM_CYMAXIMIZED
Definition: winuser.h:1036
#define SM_CYMINTRACK
Definition: winuser.h:1009
#define SM_CXICONSPACING
Definition: winuser.h:1012
#define SM_CXMINSPACING
Definition: winuser.h:1021
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1048
#define SM_SECURE
Definition: winuser.h:1018
#define SM_CXCURSOR
Definition: winuser.h:985

Referenced by co_IntInitializeDesktopGraphics(), SpiUpdatePerUserSystemParameters(), UserChangeDisplaySettings(), UserRefreshDisplay(), and UserSystemParametersInfo().

◆ InitSessionImpl()

NTSTATUS FASTCALL InitSessionImpl ( VOID  )

Definition at line 18 of file session.c.

19{
20 return RtlCreateAtomTable(37, &gAtomTable);
21}
NTSYSAPI NTSTATUS NTAPI RtlCreateAtomTable(_In_ ULONG TableSize, _Inout_ PRTL_ATOM_TABLE *AtomTable)
PRTL_ATOM_TABLE gAtomTable
Definition: session.c:13

Referenced by InitUserImpl().

◆ InitThreadCallback()

NTSTATUS NTAPI InitThreadCallback ( PETHREAD  Thread)

Definition at line 456 of file main.c.

457{
459 PCLIENTINFO pci;
460 PTHREADINFO ptiCurrent;
461 int i;
463 PTEB pTeb;
464 PRTL_USER_PROCESS_PARAMETERS ProcessParams;
465 PKL pDefKL;
466 BOOLEAN bFirstThread;
467
468 Process = Thread->ThreadsProcess;
469
470 pTeb = NtCurrentTeb();
471 ASSERT(pTeb);
472
473 ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
474
475 /* Allocate a new Win32 thread info */
476 Status = AllocW32Thread(Thread, &ptiCurrent);
477 if (!NT_SUCCESS(Status))
478 {
479 ERR_CH(UserThread, "Failed to allocate pti for TID:0x%lx\n",
481 return Status;
482 }
483
484 /* Initialize the THREADINFO */
485 ptiCurrent->pEThread = Thread;
486 ptiCurrent->ppi = PsGetProcessWin32Process(Process);
487 IntReferenceProcessInfo(ptiCurrent->ppi);
488 pTeb->Win32ThreadInfo = ptiCurrent;
489 ptiCurrent->pClientInfo = (PCLIENTINFO)pTeb->Win32ClientInfo;
490 ptiCurrent->pcti = &ptiCurrent->cti;
491 bFirstThread = !(ptiCurrent->ppi->W32PF_flags & W32PF_THREADCONNECTED);
492
493 /* Mark the process as having threads */
494 ptiCurrent->ppi->W32PF_flags |= W32PF_THREADCONNECTED;
495
500 InitializeListHead(&ptiCurrent->PtiLink);
501 for (i = 0; i < NB_HOOKS; i++)
502 {
503 InitializeListHead(&ptiCurrent->aphkStart[i]);
504 }
505 ptiCurrent->ptiSibling = ptiCurrent->ppi->ptiList;
506 ptiCurrent->ppi->ptiList = ptiCurrent;
507 ptiCurrent->ppi->cThreads++;
508
509 ptiCurrent->hEventQueueClient = NULL;
510 Status = ZwCreateEvent(&ptiCurrent->hEventQueueClient, EVENT_ALL_ACCESS,
512 if (!NT_SUCCESS(Status))
513 {
514 ERR_CH(UserThread, "Event creation failed, Status 0x%08x.\n", Status);
515 goto error;
516 }
519 (PVOID*)&ptiCurrent->pEventQueueServer, NULL);
520 if (!NT_SUCCESS(Status))
521 {
522 ERR_CH(UserThread, "Failed referencing the event object, Status 0x%08x.\n", Status);
524 ptiCurrent->hEventQueueClient = NULL;
525 goto error;
526 }
527
528 ptiCurrent->pcti->timeLastRead = EngGetTickCount32();
529
530 ptiCurrent->MessageQueue = MsqCreateMessageQueue(ptiCurrent);
531 if (ptiCurrent->MessageQueue == NULL)
532 {
533 ERR_CH(UserThread, "Failed to allocate message loop\n");
535 goto error;
536 }
537
538 pDefKL = W32kGetDefaultKeyLayout();
539 UserAssignmentLock((PVOID*)&(ptiCurrent->KeyboardLayout), pDefKL);
540
541 ptiCurrent->TIF_flags &= ~TIF_INCLEANUP;
542
543 // FIXME: Flag SYSTEM threads with... TIF_SYSTEMTHREAD !!
544
545 /* CSRSS threads have some special features */
546 if (Process == gpepCSRSS || !gpepCSRSS)
548
549 /* Initialize the CLIENTINFO */
550 pci = (PCLIENTINFO)pTeb->Win32ClientInfo;
551 RtlZeroMemory(pci, sizeof(*pci));
552 pci->ppi = ptiCurrent->ppi;
553 pci->fsHooks = ptiCurrent->fsHooks;
554 pci->dwTIFlags = ptiCurrent->TIF_flags;
555 if (pDefKL)
556 {
557 pci->hKL = pDefKL->hkl;
558 pci->CodePage = pDefKL->CodePage;
559 }
560
561 /* Populate dwExpWinVer */
562 if (Process->Peb)
563 ptiCurrent->dwExpWinVer = RtlGetExpWinVer(Process->SectionBaseAddress);
564 else
565 ptiCurrent->dwExpWinVer = WINVER_WINNT4;
566 pci->dwExpWinVer = ptiCurrent->dwExpWinVer;
567
568 /* Need to pass the user Startup Information to the current process. */
569 if ( ProcessParams )
570 {
571 if ( ptiCurrent->ppi->usi.cb == 0 ) // Not initialized yet.
572 {
573 if ( ProcessParams->WindowFlags != 0 ) // Need window flags set.
574 {
575 ptiCurrent->ppi->usi.cb = sizeof(USERSTARTUPINFO);
576 ptiCurrent->ppi->usi.dwX = ProcessParams->StartingX;
577 ptiCurrent->ppi->usi.dwY = ProcessParams->StartingY;
578 ptiCurrent->ppi->usi.dwXSize = ProcessParams->CountX;
579 ptiCurrent->ppi->usi.dwYSize = ProcessParams->CountY;
580 ptiCurrent->ppi->usi.dwFlags = ProcessParams->WindowFlags;
581 ptiCurrent->ppi->usi.wShowWindow = (WORD)ProcessParams->ShowWindowFlags;
582 }
583 }
584
585 if (bFirstThread)
586 {
587 /* Note: Only initialize once so it can be set back to 0 after being used */
588 if (ProcessParams->WindowFlags & STARTF_USEHOTKEY)
589 ptiCurrent->ppi->dwHotkey = HandleToUlong(ProcessParams->StandardInput);
590 /* TODO:
591 else if (ProcessParams->ShellInfo.Buffer)
592 ..->dwHotkey = ParseShellInfo(ProcessParams->ShellInfo.Buffer, L"hotkey.");
593 */
594
595 if (ProcessParams->WindowFlags & STARTF_SHELLPRIVATE)
596 {
597 /* We need to validate this handle because it can also be a HICON */
598 HMONITOR hMonitor = (HMONITOR)ProcessParams->StandardOutput;
599 if (hMonitor && UserGetMonitorObject(hMonitor))
600 ptiCurrent->ppi->hMonitor = hMonitor;
601 }
602 }
603 }
604
605 /*
606 * Assign a default window station and desktop to the process.
607 * Do not try to open a desktop or window station before the very first
608 * (interactive) window station has been created by Winlogon.
609 */
610 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) &&
611 ptiCurrent->ppi->hdeskStartup == NULL &&
613 {
614 HWINSTA hWinSta = NULL;
615 HDESK hDesk = NULL;
616 UNICODE_STRING DesktopPath;
617 PDESKTOP pdesk;
618
619 /*
620 * Inherit the thread desktop and process window station (if not yet inherited)
621 * from the process startup info structure. See documentation of CreateProcess().
622 */
624 if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)
625 {
626 Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo);
627 }
628 if (!NT_SUCCESS(Status))
629 {
630 RtlInitUnicodeString(&DesktopPath, NULL);
631 }
632
634 &DesktopPath,
635 !!(ProcessParams->WindowFlags & STARTF_INHERITDESKTOP),
636 &hWinSta,
637 &hDesk);
638
639 if (DesktopPath.Buffer)
640 ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING);
641
642 if (!NT_SUCCESS(Status))
643 {
644 ERR_CH(UserThread, "Failed to assign default desktop and winsta to process\n");
645 goto error;
646 }
647
648 if (!UserSetProcessWindowStation(hWinSta))
649 {
651 ERR_CH(UserThread, "Failed to set initial process winsta\n");
652 goto error;
653 }
654
655 /* Validate the new desktop */
656 Status = IntValidateDesktopHandle(hDesk, UserMode, 0, &pdesk);
657 if (!NT_SUCCESS(Status))
658 {
659 ERR_CH(UserThread, "Failed to validate initial desktop handle\n");
660 goto error;
661 }
662
663 /* Store the parsed desktop as the initial desktop */
664 ASSERT(ptiCurrent->ppi->hdeskStartup == NULL);
665 ASSERT(Process->UniqueProcessId != gpidLogon);
666 ptiCurrent->ppi->hdeskStartup = hDesk;
667 ptiCurrent->ppi->rpdeskStartup = pdesk;
668 }
669
670 if (ptiCurrent->ppi->hdeskStartup != NULL)
671 {
672 if (!IntSetThreadDesktop(ptiCurrent->ppi->hdeskStartup, FALSE))
673 {
674 ERR_CH(UserThread, "Failed to set thread desktop\n");
676 goto error;
677 }
678 }
679
680 /* Mark the thread as fully initialized */
681 ptiCurrent->TIF_flags |= TIF_GUITHREADINITIALIZED;
682
683 if (!(ptiCurrent->ppi->W32PF_flags & (W32PF_ALLOWFOREGROUNDACTIVATE | W32PF_APPSTARTING)) &&
684 (gptiForeground && gptiForeground->ppi == ptiCurrent->ppi ))
685 {
687 }
688 ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
689
690 /* Create the default input context */
691 if (IS_IMM_MODE())
692 {
694 }
695
696 /* Last things to do only if we are not a SYSTEM or CSRSS thread */
697 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)))
698 {
699 /* Callback to User32 Client Thread Setup */
700 TRACE_CH(UserThread, "Call co_IntClientThreadSetup...\n");
702 if (!NT_SUCCESS(Status))
703 {
704 ERR_CH(UserThread, "ClientThreadSetup failed with Status 0x%08lx\n", Status);
705 goto error;
706 }
707 TRACE_CH(UserThread, "co_IntClientThreadSetup succeeded!\n");
708 }
709 else
710 {
711 TRACE_CH(UserThread, "co_IntClientThreadSetup cannot be called...\n");
712 }
713
714 TRACE_CH(UserThread, "UserCreateW32Thread pti 0x%p\n", ptiCurrent);
715 return STATUS_SUCCESS;
716
717error:
718 ERR_CH(UserThread, "InitThreadCallback failed! Freeing pti 0x%p for TID:0x%lx\n",
719 ptiCurrent, HandleToUlong(Thread->Cid.UniqueThread));
721 return Status;
722}
#define VOID
Definition: acefi.h:82
HANDLE HMONITOR
Definition: axextend.idl:431
#define HandleToUlong(h)
Definition: basetsd.h:73
#define ERR_CH(ch, fmt,...)
Definition: debug.h:108
#define TRACE_CH(ch, fmt,...)
Definition: debug.h:111
PEPROCESS gpepCSRSS
Definition: csr.c:15
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
PTHREADINFO gptiForeground
Definition: focus.c:15
#define EngGetTickCount32()
Definition: eng.h:43
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TIF_CSRSSTHREAD
Definition: ntuser.h:266
#define TIF_DONTATTACHQUEUE
Definition: ntuser.h:269
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:287
ULONG RtlGetExpWinVer(_In_ PVOID BaseAddress)
Definition: image.c:20
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:265
struct _CLIENTINFO * PCLIENTINFO
#define NB_HOOKS
Definition: ntuser.h:127
#define TIF_ALLOWFOREGROUNDACTIVATE
Definition: ntuser.h:268
#define NtCurrentTeb
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
#define error(str)
Definition: mkdosfs.c:1605
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO pti)
Definition: msgqueue.c:2396
#define UserMode
Definition: asm.h:39
@ SynchronizationEvent
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
PIMC FASTCALL UserCreateInputContext(_In_ ULONG_PTR dwClientImcData)
Definition: ime.c:1651
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation)
Definition: winsta.c:1386
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3388
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
#define TAG_STRING
Definition: oslist.h:22
#define STARTF_USEHOTKEY
Definition: pch.h:41
#define STATUS_SUCCESS
Definition: shellext.h:65
HANDLE gpidLogon
Definition: simplecall.c:15
USHORT CodePage
Definition: ntuser.h:340
HKL hKL
Definition: ntuser.h:339
ULONG fsHooks
Definition: ntuser.h:328
DWORD dwTIFlags
Definition: ntuser.h:324
DWORD dwExpWinVer
Definition: ntuser.h:321
struct _PROCESSINFO * ppi
Definition: ntuser.h:346
HANDLE UniqueThread
Definition: compat.h:826
CLIENT_ID Cid
Definition: pstypes.h:1211
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
INT cThreads
Definition: win32.h:263
USERSTARTUPINFO usi
Definition: win32.h:279
HDESK hdeskStartup
Definition: win32.h:264
HMONITOR hMonitor
Definition: win32.h:271
PTHREADINFO ptiList
Definition: win32.h:257
struct _DESKTOP * rpdeskStartup
Definition: win32.h:259
DWORD dwHotkey
Definition: win32.h:270
UNICODE_STRING DesktopInfo
Definition: rtltypes.h:1574
Definition: compat.h:836
ULONG Win32ClientInfo[31]
Definition: compat.h:847
PVOID Win32ThreadInfo
Definition: compat.h:846
PPEB ProcessEnvironmentBlock
Definition: ntddk_ex.h:337
DWORD dwExpWinVer
Definition: win32.h:112
PTHREADINFO ptiSibling
Definition: win32.h:116
ULONG fsHooks
Definition: win32.h:117
LIST_ENTRY PostedMessagesListHead
Definition: win32.h:137
CLIENTTHREADINFO cti
Definition: win32.h:144
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
PKEVENT pEventQueueServer
Definition: win32.h:125
LIST_ENTRY W32CallbackListHead
Definition: win32.h:156
struct tagKL * KeyboardLayout
Definition: win32.h:90
LIST_ENTRY aphkStart[NB_HOOKS]
FIXME!
Definition: win32.h:143
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
HANDLE hEventQueueClient
Definition: win32.h:123
LIST_ENTRY SentMessagesListHead
Definition: win32.h:100
LIST_ENTRY WindowListHead
Definition: win32.h:155
LIST_ENTRY PtiLink
Definition: win32.h:126
Definition: input.h:27
USHORT CodePage
Definition: input.h:36
HKL hkl
Definition: input.h:32
WORD wShowWindow
Definition: win32.h:220
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STARTF_INHERITDESKTOP
Definition: undocuser.h:166
#define W32PF_APPSTARTING
Definition: win32.h:10
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:182
struct tagUSERSTARTUPINFO USERSTARTUPINFO
#define W32PF_THREADCONNECTED
Definition: win32.h:18
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:684
NTSTATUS APIENTRY co_IntClientThreadSetup(VOID)
Definition: callback.c:959
NTSTATUS FASTCALL IntValidateDesktopHandle(HDESK Desktop, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PDESKTOP *Object)
Definition: desktop.c:1260
NTSTATUS FASTCALL IntResolveDesktop(IN PEPROCESS Process, IN PUNICODE_STRING DesktopPath, IN BOOL bInherit, OUT HWINSTA *phWinSta, OUT HDESK *phDesktop)
Definition: desktop.c:574
BOOL IntSetThreadDesktop(IN HDESK hDesktop, IN BOOL FreeOnFailure)
Definition: desktop.c:3295
PKL W32kGetDefaultKeyLayout(VOID)
Definition: kbdlayout.c:512
NTSTATUS NTAPI ExitThreadCallback(PETHREAD Thread)
Definition: main.c:729
NTSTATUS AllocW32Thread(IN PETHREAD Thread, OUT PTHREADINFO *W32Thread)
Definition: main.c:373
PMONITOR NTAPI UserGetMonitorObject(IN HMONITOR hMonitor)
Definition: monitor.c:74
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:837
#define WINVER_WINNT4
Definition: window.h:57

Referenced by Win32kThreadCallback().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 617 of file misc.c.

618{
619 UINT bit;
620 if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
621 bit = 1 << LOWORD(Flag);
622 TRACE("CWS %x\n",bit);
623 switch(HIWORD(Flag))
624 {
625 case 0:
626 pWnd->state &= ~bit;
627 break;
628 case 1:
629 pWnd->state2 &= ~bit;
630 break;
631 case 2:
632 pWnd->ExStyle2 &= ~bit;
633 break;
634 }
635}
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define LOWORD(l)
Definition: pedump.c:82
Definition: xml2sdb.h:97
DWORD ExStyle2
Definition: ntuser.h:745
DWORD state2
Definition: ntuser.h:702
DWORD state
Definition: ntuser.h:701
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by NtUserCallHwndParam().

◆ IntDdeGetMessageHook()

BOOL APIENTRY IntDdeGetMessageHook ( PMSG  pMsg,
LONG_PTR  ExtraInfo 
)

Definition at line 326 of file dde.c.

327{
328 PWND pWnd, pWndClient;
329 PDDE_DATA pddeData;
330 PDDE_PROP pddeProp;
331 BOOL Ret;
332
333 pWnd = UserGetWindowObject(pMsg->hwnd);
334 if (pWnd == NULL)
335 {
336 ERR("DDE Get Window is dead. %p\n", pMsg->hwnd);
337 return TRUE;
338 }
339
340 if (pMsg->message == WM_DDE_TERMINATE)
341 {
342 pddeProp = (PDDE_PROP)UserGetProp(pWnd, AtomDDETrack, TRUE);
343 if (pddeProp)
344 {
345 pWndClient = UserGetWindowObject((HWND)pMsg->wParam);
346 if (pWndClient == NULL)
347 {
348 ERR("DDE Get Client WM_DDE_TERMINATE\n");
349 }
350
353 }
354 return TRUE;
355 }
356
357 TRACE("DDE Get Msg 0x%x\n",pMsg->message);
358
359 pddeData = (PDDE_DATA)ExtraInfo;
360
361 if ( pddeData )
362 {
363 TRACE("DDE Get size %d lParam c=%08lx lp c=%08lx\n",pddeData->cbSize, pMsg->lParam, pddeData->lParam);
364
365 // Callback.
366 Ret = IntDDEGetCallback( pWnd, pMsg, pddeData->pvBuffer, pddeData->cbSize);
367 if (!Ret)
368 {
369 ERR("DDE Get CB failed\n");
370 }
371
372 if (pddeData->pvBuffer) ExFreePoolWithTag(pddeData->pvBuffer, USERTAG_DDE);
373
375
376 return Ret;
377 }
378 TRACE("DDE Get No DDE Data found!\n");
379 return TRUE;
380}
#define WM_DDE_TERMINATE
Definition: dde.h:38
ATOM AtomDDETrack
Definition: ntuser.c:23
Definition: dde.c:29
int cbSize
Definition: dde.c:31
PVOID pvBuffer
Definition: dde.c:32
LPARAM lParam
Definition: dde.c:30
Definition: dde.c:36
UINT message
Definition: winuser.h:3223
HWND hwnd
Definition: winuser.h:3222
WPARAM wParam
Definition: winuser.h:3224
LPARAM lParam
Definition: winuser.h:3225
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:123
struct _DDE_DATA * PDDE_DATA
struct _DDE_PROP * PDDE_PROP
BOOL APIENTRY IntDDEGetCallback(IN PWND pWnd, IN OUT PMSG pMsg, IN PVOID Buffer, IN int size)
Definition: dde.c:111
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
#define USERTAG_DDE1
Definition: tags.h:211
#define USERTAG_DDE5
Definition: tags.h:214
#define USERTAG_DDE
Definition: tags.h:223

Referenced by co_IntGetPeekMessage().

◆ IntDdePostMessageHook()

BOOL APIENTRY IntDdePostMessageHook ( IN  PWND,
IN  UINT,
IN  WPARAM,
IN OUT LPARAM lParam,
IN OUT LONG_PTR ExtraInfo 
)

Definition at line 172 of file dde.c.

178{
179 PWND pWndClient;
180 PDDE_DATA pddeData;
181 int size;
183 PVOID userBuf = NULL;
184 PVOID Buffer = NULL;
185 LPARAM lp = *lParam;
186
187 if (pWnd->head.pti->ppi != gptiCurrent->ppi)
188 {
189 TRACE("Posting long DDE 0x%x\n",Msg);
190 // Initiate is sent only across borders.
191 if (Msg == WM_DDE_INITIATE)
192 {
193 return FALSE;
194 }
195
196 pWndClient = UserGetWindowObject((HWND)wParam);
197 if (pWndClient == NULL)
198 {
199 // This is terminating so post it.
200 if ( Msg == WM_DDE_TERMINATE)
201 {
202 TRACE("DDE Posted WM_DDE_TERMINATE\n");
203 return TRUE;
204 }
205 TRACE("Invalid DDE Client Window handle\n");
206 return FALSE;
207 }
208
209 if ( Msg == WM_DDE_REQUEST || Msg == WM_DDE_UNADVISE )
210 {
211 // Do not bother to callback after validation.
212 return TRUE;
213 }
214
215 if ( Msg == WM_DDE_TERMINATE )
216 {
218
219 // Do not bother to callback.
220 return TRUE;
221 }
222
223 if ( Msg == WM_DDE_EXECUTE && *lParam == 0)
224 {
225 // Do not bother to do a callback.
226 TRACE("DDE Post EXECUTE lParam 0\n");
227 return FALSE;
228 }
229
230 // Callback.
231 if ((size = IntDDEPostCallback(pWnd, Msg, wParam, &lp, &userBuf)) == 0)
232 {
233 ERR("DDE Post Callback return 0 0x%x\n", Msg);
234 return FALSE;
235 }
236
237 // No error HACK.
238 if (size == -1)
239 {
240 size = 0;
241 }
242 else
243 {
244 // Set buffer with users data size.
246 if (Buffer == NULL)
247 {
248 ERR("Failed to allocate %i bytes.\n", size);
249 return FALSE;
250 }
251 // No SEH? Yes, the user memory is freed after the Acknowledgment or at Termination.
252 RtlCopyMemory(Buffer, userBuf, size);
253 }
254
255 TRACE("DDE Post size %d 0x%x\n",size, Msg);
256
257 switch(Msg)
258 {
259 case WM_DDE_POKE:
260 {
261 DDEPOKE *pddePoke = Buffer;
262 NT_ASSERT(pddePoke != NULL);
263 switch(pddePoke->cfFormat)
264 {
265 case CF_BITMAP:
266 case CF_DIB:
267 case CF_PALETTE:
268 RtlCopyMemory(&Object, pddePoke->Value, sizeof(HGDIOBJ));
269 break;
270 default:
271 break;
272 }
273 break;
274 }
275 case WM_DDE_DATA:
276 {
277 DDEDATA *pddeData2 = Buffer;
278 NT_ASSERT(pddeData2 != NULL);
279 switch(pddeData2->cfFormat)
280 {
281 case CF_BITMAP:
282 case CF_DIB:
283 case CF_PALETTE:
284 RtlCopyMemory(&Object, pddeData2->Value, sizeof(HGDIOBJ));
285 break;
286 default:
287 break;
288 }
289 break;
290 }
291 default:
292 break;
293 }
294
295 if (Object)
296 {
297 // Give gdi object to the other process.
298 GreSetObjectOwner(Object, pWnd->head.pti->ppi->W32Pid);
299 }
300
302 if (pddeData == NULL)
303 {
304 ERR("Failed to allocate DDE_DATA\n");
306 return FALSE;
307 }
308
309 pddeData->cbSize = size;
310 pddeData->pvBuffer = Buffer;
311 pddeData->lParam = lp;
312
313 TRACE("DDE Post lParam c=%08lx\n",lp);
314 *lParam = lp;
315
316 // Attach this data packet to the user message.
317 *ExtraInfo = (LONG_PTR)pddeData;
318 }
319 return TRUE;
320}
#define CF_BITMAP
Definition: constants.h:397
#define CF_PALETTE
Definition: constants.h:404
#define CF_DIB
Definition: constants.h:403
Definition: bufpool.h:45
LPARAM lParam
Definition: combotst.c:139
struct @1777 Msg[]
#define WM_DDE_REQUEST
Definition: dde.h:43
#define WM_DDE_DATA
Definition: dde.h:42
#define WM_DDE_POKE
Definition: dde.h:44
#define WM_DDE_EXECUTE
Definition: dde.h:45
#define WM_DDE_INITIATE
Definition: dde.h:37
#define WM_DDE_UNADVISE
Definition: dde.h:40
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
GLsizeiptr size
Definition: glext.h:5919
Definition: dde.h:57
BYTE Value[1]
Definition: dde.h:60
short cfFormat
Definition: dde.h:59
Definition: dde.h:72
short cfFormat
Definition: dde.h:74
BYTE Value[1]
Definition: dde.h:75
#define LONG_PTR
Definition: treelist.c:79
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1268
int APIENTRY IntDDEPostCallback(IN PWND pWnd, IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, IN OUT PVOID *Buffer)
Definition: dde.c:48
#define NT_ASSERT
Definition: rtlfuncs.h:3327

Referenced by UserPostMessage().

◆ IntDdeSendMessageHook()

BOOL FASTCALL IntDdeSendMessageHook ( PWND  pWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 386 of file dde.c.

387{
388 PWND pWndServer;
389 PDDE_PROP pddeProp;
390
391 if (pWnd->head.pti->ppi != gptiCurrent->ppi)
392 {
393 TRACE("Sending long DDE 0x%x\n",Msg);
394
395 // Allow only Acknowledge and Initiate to be sent across borders.
396 if (Msg != WM_DDE_ACK )
397 {
398 if (Msg == WM_DDE_INITIATE) return TRUE;
399 return FALSE;
400 }
401
402 TRACE("Sending long WM_DDE_ACK\n");
403
404 pWndServer = UserGetWindowObject((HWND)wParam);
405 if (pWndServer == NULL)
406 {
407 ERR("Invalid DDE Server Window handle\n");
408 return FALSE;
409 }
410
411 // Setup property so this conversation can be tracked.
413 if (pddeProp == NULL)
414 {
415 ERR("failed to allocate DDE_PROP\n");
416 return FALSE;
417 }
418
419 pddeProp->spwnd = pWndServer;
420 pddeProp->spwndPartner = pWnd;
421
422 UserSetProp(pWndServer, AtomDDETrack, (HANDLE)pddeProp, TRUE);
423 }
424 return TRUE;
425}
#define WM_DDE_ACK
Definition: dde.h:41
PWND spwnd
Definition: dde.c:37
PWND spwndPartner
Definition: dde.c:38

Referenced by co_IntSendMessageTimeoutSingle().

◆ IntGetWindowContextHelpId()

DWORD FASTCALL IntGetWindowContextHelpId ( PWND  pWnd)

Definition at line 439 of file window.c.

440{
441 DWORD HelpId;
442
443 do
444 {
446 if (!HelpId) break;
447 pWnd = IntGetParent(pWnd);
448 }
449 while (pWnd && pWnd->fnid != FNID_DESKTOP);
450 return HelpId;
451}
#define FNID_DESKTOP
Definition: ntuser.h:862
DWORD fnid
Definition: ntuser.h:709
ATOM atomContextHelpIdProp
Definition: ntuser.h:1067

Referenced by IntDefWindowProc().

◆ IntGetWindowObject()

PWND FASTCALL IntGetWindowObject ( HWND  hWnd)

Definition at line 75 of file window.c.

76{
78
79 if (!hWnd) return NULL;
80
82 if (Window)
83 Window->head.cLockObj++;
84
85 return Window;
86}
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:123

Referenced by co_UserFreeWindow(), IntHideDesktop(), and IntSetOwner().

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 596 of file misc.c.

597{
598 UINT bit;
599 if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
600 bit = 1 << LOWORD(Flag);
601 TRACE("SWS %x\n",bit);
602 switch(HIWORD(Flag))
603 {
604 case 0:
605 pWnd->state |= bit;
606 break;
607 case 1:
608 pWnd->state2 |= bit;
609 break;
610 case 2:
611 pWnd->ExStyle2 |= bit;
612 break;
613 }
614}

Referenced by NtUserCallHwndParam().

◆ IntTID2PTI()

PTHREADINFO FASTCALL IntTID2PTI ( HANDLE  id)

Definition at line 41 of file misc.c.

42{
45 PTHREADINFO pti;
47 if (!NT_SUCCESS(Status))
48 {
49 return NULL;
50 }
52 {
54 return NULL;
55 }
57 if (!pti)
58 {
60 return NULL;
61 }
62 // Validate and verify!
64 {
65 if (pti->TIF_flags & TIF_INCLEANUP) pti = NULL;
66 if (pti && !(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) pti = NULL;
67 if (PsGetThreadId(Thread) != id) pti = NULL;
68 }
70 {
71 pti = NULL;
72 }
75 return pti;
76}
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93

Referenced by NtUserAttachThreadInput(), NtUserBuildHimcList(), NtUserDisableThreadIme(), NtUserGetGUIThreadInfo(), NtUserGetThreadDesktop(), NtUserGetThreadState(), and NtUserSetWindowsHookEx().

◆ NC_DoNCPaint()

LRESULT NC_DoNCPaint ( PWND  pWnd,
HDC  hDC,
INT  Flags 
)

Definition at line 1107 of file nonclient.c.

1108{
1110 PWND Parent;
1111 RECT WindowRect, CurrentRect, TempRect;
1112 BOOL Active = FALSE;
1113
1114 if (!IntIsWindowVisible(pWnd) ||
1115 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1116 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1117 return 0;
1118
1119 Style = pWnd->style;
1120
1121 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1122
1123 Parent = IntGetParent(pWnd);
1124 ExStyle = pWnd->ExStyle;
1125
1126 if (Flags == -1) // NC paint mode.
1127 {
1128 if (ExStyle & WS_EX_MDICHILD)
1129 {
1131
1132 if (Active)
1134 }
1135 else
1136 {
1137 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1138 }
1139 Flags = DC_NC; // Redraw everything!
1140 }
1141 else
1142 Flags |= DC_NC;
1143
1144
1145 IntGetWindowRect(pWnd, &WindowRect);
1146
1147 CurrentRect.top = CurrentRect.left = 0;
1148 CurrentRect.right = WindowRect.right - WindowRect.left;
1149 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1150
1151 /* Draw outer edge */
1152 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1153 {
1154 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1155 }
1156 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1157 {
1158#if 0
1159 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1160#else
1162 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1163 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1164
1166 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1167 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1168
1169 RECTL_vInflateRect(&CurrentRect, -1, -1);
1170#endif
1171 }
1172
1173 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1174
1175 /* Draw caption */
1176 if ((Style & WS_CAPTION) == WS_CAPTION)
1177 {
1178 HPEN PreviousPen;
1179 BOOL Gradient = FALSE;
1180
1181 if (Flags & DC_REDRAWHUNGWND)
1182 {
1183 Flags &= ~DC_REDRAWHUNGWND;
1185 }
1186
1187 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1188 {
1189 Flags |= DC_GRADIENT;
1190 }
1191
1192 if (Active)
1193 {
1194 if (pWnd->state & WNDS_ACTIVEFRAME)
1195 Flags |= DC_ACTIVE;
1196 else
1197 {
1198 ERR("Wnd is active and not set active!\n");
1199 }
1200 }
1201
1202 TempRect = CurrentRect;
1203
1205 {
1206 Flags |= DC_SMALLCAP;
1207 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1208 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1209 }
1210 else
1211 {
1212 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1213 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1214 }
1215
1216 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1217
1218 /* Draw buttons */
1219 if (Style & WS_SYSMENU)
1220 {
1223 {
1226 }
1227 }
1228 if (!(Style & WS_MINIMIZE))
1229 {
1230 /* Line under caption */
1231 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1232
1236
1237 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1238
1239 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1240
1241 NtGdiSelectPen(hDC, PreviousPen);
1242 }
1243 }
1244
1245 if (!(Style & WS_MINIMIZE))
1246 {
1247 /* Draw menu bar */
1248 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1249 {
1250 if (!(Flags & DC_NOSENDMSG))
1251 {
1252 PMENU menu;
1253 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1254 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1255 {
1256 TempRect = CurrentRect;
1257 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1258 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1259 }
1260 }
1261 }
1262
1264 {
1265 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1266 }
1267
1268 /* Draw the scrollbars */
1269 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1271 {
1272 RECT ParentClientRect;
1273
1274 TempRect = CurrentRect;
1275
1277 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1278 else
1279 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1280
1281 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1282
1284
1285 if (Parent)
1286 {
1287 IntGetClientRect(Parent, &ParentClientRect);
1288
1289 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1290 {
1292 }
1293 }
1294
1297 }
1298 else
1299 {
1301 {
1303 }
1305 {
1307 }
1308 }
1309 }
1310 return 0; // For WM_NCPAINT message, return 0.
1311}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
#define UlongToHandle(ul)
Definition: basetsd.h:91
#define DC_ACTIVE
Definition: dc21x4.h:120
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
HANDLE HWND
Definition: compat.h:19
static BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:46
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:611
#define WNDS_NONCPAINT
Definition: ntuser.h:613
#define WNDS_HASMENU
Definition: ntuser.h:605
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:110
#define menu
Definition: input.c:3282
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:121
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_MINIMIZEBOX
Definition: pedump.c:631
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiPatBlt(_In_ HDC hdcDest, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_ DWORD dwRop)
Definition: bitblt.c:988
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1083
RECT rcClient
Definition: ntuser.h:717
UINT_PTR IDMenu
Definition: ntuser.h:731
#define DC_NOSENDMSG
Definition: undocuser.h:149
#define DC_REDRAWHUNGWND
Definition: undocuser.h:153
#define DC_FRAME
Definition: undocuser.h:150
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2191
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:242
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2742
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:800
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:818
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:919
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:929
#define OBJID_VSCROLL
Definition: winable.h:20
#define OBJID_HSCROLL
Definition: winable.h:21
#define PATCOPY
Definition: wingdi.h:335
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DFC_SCROLL
Definition: winuser.h:475
#define EDGE_SUNKEN
Definition: winuser.h:451
#define COLOR_WINDOWFRAME
Definition: winuser.h:930
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
#define SB_VERT
Definition: winuser.h:553
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define BF_ADJUST
Definition: winuser.h:470
#define BF_FLAT
Definition: winuser.h:471
#define DC_NC
Definition: winuser.h:440
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define COLOR_BTNSHADOW
Definition: winuser.h:941
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WM_MDIGETACTIVE
Definition: winuser.h:1849
#define DC_SMALLCAP
Definition: winuser.h:428
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:946
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450
#define SB_HORZ
Definition: winuser.h:552
#define COLOR_BTNFACE
Definition: winuser.h:939
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:564

Referenced by IntDefWindowProc(), NC_HandleNCActivate(), NtUserDrawCaptionTemp(), and PaintSuspendedWindow().

◆ NC_DrawFrame()

VOID NC_DrawFrame ( HDC  hDC,
RECT CurrentRect,
BOOL  Active,
DWORD  Style,
DWORD  ExStyle 
)

Definition at line 919 of file nonclient.c.

920{
921 /* Firstly the "thick" frame */
922 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
923 {
924 LONG Width =
927
928 LONG Height =
931
933
934 /* Draw frame */
935 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
936 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
937 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
938 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
939
940 RECTL_vInflateRect(CurrentRect, -Width, -Height);
941 }
942
943 /* Now the other bit of the frame */
945 {
948
954
955 /* Draw frame */
956 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
957 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
958 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
959 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
960
961 RECTL_vInflateRect(CurrentRect, -Width, -Height);
962 }
963}
#define WS_BORDER
Definition: pedump.c:625
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_THICKFRAME
Definition: pedump.c:630
#define COLOR_ACTIVEBORDER
Definition: winuser.h:934
#define COLOR_INACTIVEBORDER
Definition: winuser.h:935

Referenced by NC_DoNCPaint(), and UserDrawCaptionBar().

◆ NC_GetInsideRect()

void FASTCALL NC_GetInsideRect ( PWND  Wnd,
RECT rect 
)

Definition at line 71 of file nonclient.c.

72{
75
76 Style = Wnd->style;
77 ExStyle = Wnd->ExStyle;
78
79 rect->top = rect->left = 0;
80 rect->right = Wnd->rcWindow.right - Wnd->rcWindow.left;
81 rect->bottom = Wnd->rcWindow.bottom - Wnd->rcWindow.top;
82
83 if (Style & WS_ICONIC) return;
84
85 /* Remove frame from rectangle */
87 {
89 }
91 {
93 /* FIXME: this isn't in NC_AdjustRect? why not? */
95 RECTL_vInflateRect( rect, -1, 0 );
96 }
98 {
100 }
101
102 /* We have additional border information if the window
103 * is a child (but not an MDI child) */
104 if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD))
105 {
110 }
111}
RECT rect
Definition: combotst.c:67
#define WS_ICONIC
Definition: pedump.c:641
#define UserHasDlgFrameStyle(Style, ExStyle)
Definition: nonclient.c:14
#define UserHasThinFrameStyle(Style, ExStyle)
Definition: nonclient.c:22

Referenced by MENU_DrawMenuItem(), NC_GetSysPopupPos(), and NC_HandleNCLButtonDown().

◆ NC_GetSysPopupPos()

void FASTCALL NC_GetSysPopupPos ( PWND  Wnd,
RECT Rect 
)

Definition at line 117 of file nonclient.c.

118{
119 RECT WindowRect;
120
121 if ((Wnd->style & WS_MINIMIZE) != 0)
122 {
124 }
125 else
126 {
128 IntGetWindowRect(Wnd, &WindowRect);
129 RECTL_vOffsetRect(Rect, WindowRect.left, WindowRect.top);
130 if (Wnd->style & WS_CHILD)
131 {
133 }
134 Rect->right = Rect->left + UserGetSystemMetrics(SM_CYCAPTION) - 1;
135 Rect->bottom = Rect->top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
136 }
137}
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71

Referenced by MENU_ShowSubPopup().

◆ NC_HandleNCActivate()

LRESULT NC_HandleNCActivate ( PWND  Wnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1447 of file nonclient.c.

1448{
1449 INT Flags;
1450 /* Lotus Notes draws menu descriptions in the caption of its main
1451 * window. When it wants to restore original "system" view, it just
1452 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1453 * attempt to minimize redrawings lead to a not restored caption.
1454 */
1455 if (wParam & DC_ACTIVE)
1456 {
1459 }
1460 else
1461 {
1462 Wnd->state &= ~WNDS_ACTIVEFRAME;
1464 }
1465
1466 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1467 return TRUE;
1468
1469 /* This isn't documented but is reproducible in at least XP SP2 and
1470 * Outlook 2007 depends on it
1471 */
1472 // MSDN:
1473 // If this parameter is set to -1, DefWindowProc does not repaint the
1474 // nonclient area to reflect the state change.
1475 if ( lParam != -1 &&
1476 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1477 {
1478 HDC hDC;
1479 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1480
1482 {
1483 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1484 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1485 {
1486 GreDeleteObject(hRgnTemp);
1487 hRgnTemp = NULL;
1488 }
1489 }
1490
1491 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1492 {
1493 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1494 UserReleaseDC(Wnd, hDC, FALSE);
1495 }
1496 else
1497 GreDeleteObject(hRgnTemp);
1498 }
1499
1500 return TRUE;
1501}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_HASCAPTION
Definition: ntuser.h:608
static HRGN hRgn
Definition: mapping.c:32
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1107
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1429
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2149
#define DC_CAPTION
Definition: winuser.h:439

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

LRESULT NC_HandleNCCalcSize ( PWND  wnd,
WPARAM  wparam,
RECTL winRect,
BOOL  Suspended 
)

Definition at line 1313 of file nonclient.c.

1314{
1315 LRESULT Result = 0;
1316 SIZE WindowBorders;
1317 RECT OrigRect;
1318 LONG Style = Wnd->style;
1319 LONG exStyle = Wnd->ExStyle;
1320
1321 if (Rect == NULL)
1322 {
1323 return Result;
1324 }
1325 OrigRect = *Rect;
1326
1327 Wnd->state &= ~WNDS_HASCAPTION;
1328
1329 if (wparam)
1330 {
1331 if (Wnd->pcls->style & CS_VREDRAW)
1332 {
1334 }
1335 if (Wnd->pcls->style & CS_HREDRAW)
1336 {
1338 }
1340 }
1341
1342 if (!(Wnd->style & WS_MINIMIZE))
1343 {
1344 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1345 {
1346 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1347 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1348 }
1349 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1350 {
1351 RECTL_vInflateRect(Rect, -1, -1);
1352 }
1353
1354 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1355 {
1356 Wnd->state |= WNDS_HASCAPTION;
1357
1358 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1360 else
1362 }
1363
1364 if (HAS_MENU(Wnd, Style))
1365 {
1367
1368 Wnd->state |= WNDS_HASMENU;
1369
1370 if (hDC)
1371 {
1372 RECT CliRect = *Rect;
1373 CliRect.bottom -= OrigRect.top;
1374 CliRect.right -= OrigRect.left;
1375 CliRect.left -= OrigRect.left;
1376 CliRect.top -= OrigRect.top;
1377 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1378 UserReleaseDC(Wnd, hDC, FALSE);
1379 }
1380 }
1381
1382 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1383 {
1385 }
1386
1387 if (Style & WS_VSCROLL)
1388 {
1389 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1390 {
1391 Wnd->state |= WNDS_HASVERTICALSCROOLLBAR;
1392
1393 /* rectangle is in screen coords when wparam is false */
1394 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1395
1396 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1398 else
1400 }
1401 }
1402
1403 if (Style & WS_HSCROLL)
1404 {
1405 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1406 {
1407 Wnd->state |= WNDS_HASHORIZONTALSCROLLBAR;
1408
1410 }
1411 }
1412
1413 if (Rect->top > Rect->bottom)
1414 Rect->bottom = Rect->top;
1415
1416 if (Rect->left > Rect->right)
1417 Rect->right = Rect->left;
1418 }
1419 else
1420 {
1421 Rect->right = Rect->left;
1422 Rect->bottom = Rect->top;
1423 }
1424
1425 return Result;
1426}
@ wparam
Definition: SystemMenu.c:30
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:607
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:606
LONG_PTR LRESULT
Definition: minwindef.h:176
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:894
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:248
#define CS_VREDRAW
Definition: winuser.h:666
#define WVR_VALIDRECTS
Definition: winuser.h:2558
#define CS_HREDRAW
Definition: winuser.h:661
#define WVR_VREDRAW
Definition: winuser.h:2556
#define WVR_HREDRAW
Definition: winuser.h:2555
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
@ Suspended
Definition: ketypes.h:472

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

LRESULT NC_HandleNCLButtonDblClk ( PWND  Wnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1676 of file nonclient.c.

1677{
1678 ULONG Style;
1679
1680 Style = pWnd->style;
1681 switch(wParam)
1682 {
1683 case HTCAPTION:
1684 {
1685 /* Maximize/Restore the window */
1687 {
1689 }
1690 break;
1691 }
1692 case HTSYSMENU:
1693 {
1694 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1696
1697 /* If the close item of the sysmenu is disabled or not present do nothing */
1698 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1699 break;
1700
1702 break;
1703 }
1704 case HTTOP:
1705 case HTBOTTOM:
1706 {
1707 RECT sizingRect = pWnd->rcWindow, mouseRect;
1708
1709 if (pWnd->ExStyle & WS_EX_MDICHILD)
1710 break;
1711
1712 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1713
1715 NULL,
1716 sizingRect.left,
1717 mouseRect.top,
1718 sizingRect.right - sizingRect.left,
1719 mouseRect.bottom - mouseRect.top,
1720 0);
1721 break;
1722 }
1723 default:
1724 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1725 }
1726 return(0);
1727}
static int state
Definition: maze.c:121
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5409
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:5001
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1584
#define MF_BYCOMMAND
Definition: winuser.h:202
#define HTBOTTOM
Definition: winuser.h:2529
#define SC_CLOSE
Definition: winuser.h:2628
#define SC_RESTORE
Definition: winuser.h:2634
#define SC_MAXIMIZE
Definition: winuser.h:2624
#define MF_GRAYED
Definition: winuser.h:129
#define MF_DISABLED
Definition: winuser.h:130

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

LRESULT NC_HandleNCLButtonDown ( PWND  Wnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1584 of file nonclient.c.

1585{
1586 switch (wParam)
1587 {
1588 case HTCAPTION:
1589 {
1590 PWND TopWnd = pWnd, parent;
1591 while(1)
1592 {
1593 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1594 break;
1595 parent = UserGetAncestor( TopWnd, GA_PARENT );
1596 if (!parent || UserIsDesktopWindow(parent)) break;
1597 TopWnd = parent;
1598 }
1599
1600 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1602 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1604 {
1606 }
1607 break;
1608 }
1609 case HTSYSMENU:
1610 {
1611 LONG style = pWnd->style;
1612 if (style & WS_SYSMENU)
1613 {
1614 if(!(style & WS_MINIMIZE) )
1615 {
1616 RECT rect;
1617 HDC hDC = UserGetWindowDC(pWnd);
1618 NC_GetInsideRect(pWnd, &rect);
1620 UserReleaseDC( pWnd, hDC, FALSE );
1621 }
1623 }
1624 break;
1625 }
1626 case HTMENU:
1627 {
1629 break;
1630 }
1631 case HTHSCROLL:
1632 {
1634 break;
1635 }
1636 case HTVSCROLL:
1637 {
1639 break;
1640 }
1641 case HTMINBUTTON:
1642 case HTMAXBUTTON:
1643 case HTCLOSE:
1644 {
1645 NC_DoButton(pWnd, wParam, lParam);
1646 break;
1647 }
1648 case HTLEFT:
1649 case HTRIGHT:
1650 case HTTOP:
1651 case HTBOTTOM:
1652 case HTTOPLEFT:
1653 case HTTOPRIGHT:
1654 case HTBOTTOMLEFT:
1655 case HTBOTTOMRIGHT:
1656 {
1657 /* Old comment:
1658 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1659 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1660 */
1661 /* But that is not what WinNT does. Instead it sends this. This
1662 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1663 * SC_MOUSEMENU into wParam.
1664 */
1666 break;
1667 }
1668 case HTBORDER:
1669 break;
1670 }
1671 return(0);
1672}
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1556
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1426
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:777
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1504
#define SC_HSCROLL
Definition: winuser.h:2630
#define HTTOPRIGHT
Definition: winuser.h:2528
#define HTCLOSE
Definition: winuser.h:2535
#define HTTOPLEFT
Definition: winuser.h:2527
#define HTBORDER
Definition: winuser.h:2533
#define SC_VSCROLL
Definition: winuser.h:2629
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define HTVSCROLL
Definition: winuser.h:2518
#define HTHSCROLL
Definition: winuser.h:2517
#define GA_PARENT
Definition: winuser.h:2892
#define HTMAXBUTTON
Definition: winuser.h:2520
#define HTMENU
Definition: winuser.h:2516
#define HTRIGHT
Definition: winuser.h:2525
#define HTBOTTOMLEFT
Definition: winuser.h:2530
#define HTMINBUTTON
Definition: winuser.h:2519

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

LRESULT NC_HandleNCRButtonDown ( PWND  wnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1734 of file nonclient.c.

1735{
1736 MSG msg;
1737 INT hittest = wParam;
1738
1739 switch (hittest)
1740 {
1741 case HTCAPTION:
1742 case HTSYSMENU:
1743 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1744
1746 for (;;)
1747 {
1749 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1750 if (msg.message == WM_RBUTTONUP)
1751 {
1752 hittest = GetNCHitEx( pwnd, msg.pt );
1753 break;
1754 }
1755 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1756 }
1758
1759 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1760 {
1761 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1763 }
1764 break;
1765 }
1766 return 0;
1767}
#define WM_CONTEXTMENU
Definition: richedit.h:64
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1994
#define WM_MOUSEFIRST
Definition: winuser.h:1802
#define WM_MOUSELAST
Definition: winuser.h:1829
#define WM_RBUTTONUP
Definition: winuser.h:1808
#define MSGF_MAX
Definition: winuser.h:1193

Referenced by IntDefWindowProc().

◆ SetLayeredStatus()

BOOL FASTCALL SetLayeredStatus ( PWND  pWnd,
BYTE  set 
)

Definition at line 34 of file layered.c.

35{
36 PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
37 if (pLrdProp)
38 {
39 pLrdProp->is_Layered = set;
40 return TRUE;
41 }
42 return FALSE;
43}
Definition: _set.h:50

Referenced by co_IntSetWindowLongPtr().

◆ UserCreateInputContext()

PIMC FASTCALL UserCreateInputContext ( _In_ ULONG_PTR  dwClientImcData)

Definition at line 1651 of file ime.c.

1652{
1653 PIMC pIMC;
1655 PDESKTOP pdesk = pti->rpdesk;
1656
1657 if (!IS_IMM_MODE() || (pti->TIF_flags & TIF_DISABLEIME)) // Disabled?
1658 {
1659 ERR("IME is disabled\n");
1660 return NULL;
1661 }
1662
1663 if (!pdesk) // No desktop?
1664 return NULL;
1665
1666 // pti->spDefaultImc should be already set if non-first time.
1667 if (dwClientImcData && !pti->spDefaultImc)
1668 return NULL;
1669
1670 // Create an input context user object.
1671 pIMC = UserCreateObject(gHandleTable, pdesk, pti, NULL, TYPE_INPUTCONTEXT, sizeof(IMC));
1672 if (!pIMC)
1673 return NULL;
1674
1675 // Release the extra reference (UserCreateObject added 2 references).
1677 ASSERT(pIMC->head.cLockObj == 1);
1678
1679 if (dwClientImcData) // Non-first time.
1680 {
1681 // Insert pIMC to the second position (non-default) of the list.
1682 pIMC->pImcNext = pti->spDefaultImc->pImcNext;
1683 pti->spDefaultImc->pImcNext = pIMC;
1684 }
1685 else // First time. It's the default IMC.
1686 {
1687 // Add the first one (default) to the list.
1688 UserAssignmentLock((PVOID*)&pti->spDefaultImc, pIMC);
1689 pIMC->pImcNext = NULL;
1690 ASSERT(pIMC->head.cLockObj == 2); // UserAssignmentUnlock'ed at ExitThreadCallback
1691 }
1692
1693 pIMC->dwClientImcData = dwClientImcData; // Set it.
1694 return pIMC;
1695}
#define TIF_DISABLEIME
Definition: ntuser.h:288
@ TYPE_INPUTCONTEXT
Definition: ntuser.h:57
struct tagIMC * spDefaultImc
Definition: win32.h:132
struct _DESKTOP * rpdesk
Definition: win32.h:92
Definition: ntuser.h:199
THRDESKHEAD head
Definition: ntuser.h:200
struct tagIMC * pImcNext
Definition: ntuser.h:201
ULONG_PTR dwClientImcData
Definition: ntuser.h:202
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568

Referenced by co_IntCreateDefaultImeWindow(), InitThreadCallback(), and NtUserCreateInputContext().

◆ UserCreateMenu()

HMENU FASTCALL UserCreateMenu ( PDESKTOP  Desktop,
BOOL  PopupMenu 
)

Definition at line 5058 of file menu.c.

5059{
5060 PWINSTATION_OBJECT WinStaObject;
5061 HANDLE Handle;
5062 PMENU Menu;
5064 PEPROCESS CurrentProcess = PsGetCurrentProcess();
5065
5066 if (gpepCSRSS != CurrentProcess)
5067 {
5068 /*
5069 * gpepCSRSS does not have a Win32WindowStation
5070 */
5071
5073 UserMode,
5074 0,
5075 &WinStaObject,
5076 0);
5077
5078 if (!NT_SUCCESS(Status))
5079 {
5080 ERR("Validation of window station handle (%p) failed\n",
5081 CurrentProcess->Win32WindowStation);
5083 return (HMENU)0;
5084 }
5085 Menu = IntCreateMenu(&Handle, !PopupMenu, Desktop, GetW32ProcessInfo());
5086 if (Menu && Menu->head.rpdesk->rpwinstaParent != WinStaObject)
5087 {
5088 ERR("Desktop Window Station does not match Process one!\n");
5089 }
5090 ObDereferenceObject(WinStaObject);
5091 }
5092 else
5093 {
5094 Menu = IntCreateMenu(&Handle, !PopupMenu, GetW32ThreadInfo()->rpdesk, GetW32ProcessInfo());
5095 }
5096
5097 if (Menu) UserDereferenceObject(Menu);
5098 return (HMENU)Handle;
5099}
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
ULONG Handle
Definition: gdb_input.c:15
struct _PROCESSINFO * GetW32ProcessInfo(VOID)
Definition: misc.c:800
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:806
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
NTSTATUS FASTCALL IntValidateWindowStationHandle(HWINSTA WindowStation, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PWINSTATION_OBJECT *Object, POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
Definition: winsta.c:225
PVOID Win32WindowStation
Definition: pstypes.h:1396
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
PROCDESKHEAD head
Definition: ntuser.h:417
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:30
PMENU FASTCALL IntCreateMenu(_Out_ PHANDLE Handle, _In_ BOOL IsMenuBar, _In_ PDESKTOP Desktop, _In_ PPROCESSINFO ppi)
Definition: menu.c:729
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Referenced by MENU_GetSystemMenu(), and NtUserCallNoParam().

◆ UserDestroyInputContext()

BOOLEAN UserDestroyInputContext ( _In_opt_ PVOID  Object)

Definition at line 1576 of file ime.c.

1577{
1578 PIMC pIMC = Object;
1579 if (!pIMC)
1580 return TRUE;
1581
1584 return TRUE;
1585}
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:620
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:716

◆ UserDestroyMenu()

BOOL FASTCALL UserDestroyMenu ( HMENU  hMenu)

Definition at line 5820 of file menu.c.

5821{
5822 PMENU Menu;
5824
5825 if(!(Menu = UserGetMenuObject(hMenu)))
5826 {
5827 return FALSE;
5828 }
5829
5830 if (Menu->head.rpdesk != pti->rpdesk)
5831 {
5833 return FALSE;
5834 }
5835 return IntDestroyMenuObject(Menu, FALSE);
5836}
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:317

Referenced by MENU_GetSystemMenu().

◆ UserDrawCaptionBar()

VOID UserDrawCaptionBar ( PWND  pWnd,
HDC  hDC,
INT  Flags 
)

Definition at line 965 of file nonclient.c.

969{
971 RECT WindowRect, CurrentRect, TempRect;
972 HPEN PreviousPen;
973 BOOL Gradient = FALSE;
974 PCURICON_OBJECT pIcon = NULL;
975
976 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
977
978 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
979
980 Style = pWnd->style;
981 ExStyle = pWnd->ExStyle;
982
983 IntGetWindowRect(pWnd, &WindowRect);
984
985 CurrentRect.top = CurrentRect.left = 0;
986 CurrentRect.right = WindowRect.right - WindowRect.left;
987 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
988
989 /* Draw outer edge */
991 {
992 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
993 }
994 else if (ExStyle & WS_EX_STATICEDGE)
995 {
996#if 0
998#else
1000 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1001 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1002
1004 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1005 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1006
1007 RECTL_vInflateRect(&CurrentRect, -1, -1);
1008#endif
1009 }
1010
1011 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
1012
1013 /* Draw caption */
1014 if ((Style & WS_CAPTION) == WS_CAPTION)
1015 {
1016 TempRect = CurrentRect;
1017
1018 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
1019
1020 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1021 {
1022 Flags |= DC_GRADIENT;
1023 }
1024
1026 {
1027 Flags |= DC_SMALLCAP;
1028 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1029 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1030 }
1031 else
1032 {
1033 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1034 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1035 }
1036
1037 if (!(Flags & DC_ICON) &&
1038 !(Flags & DC_SMALLCAP) &&
1039 (Style & WS_SYSMENU) &&
1041 {
1042 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1043 }
1044 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1045
1046 /* Draw buttons */
1047 if (Style & WS_SYSMENU)
1048 {
1051 {
1054 }
1055 }
1056
1057 if (!(Style & WS_MINIMIZE))
1058 {
1059 /* Line under caption */
1060 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1061
1064
1065 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1066
1067 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1068
1069 NtGdiSelectPen(hDC, PreviousPen);
1070 }
1071 }
1072
1073 if (!(Style & WS_MINIMIZE))
1074 {
1075 /* Draw menu bar */
1076 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1077 {
1078 PMENU menu;
1079 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1080 {
1081 TempRect = CurrentRect;
1082 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1083 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1084 }
1085 }
1086
1088 {
1089 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1090 }
1091 }
1092}
#define DC_NOVISIBLE
Definition: undocuser.h:148
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:746
#define DC_TEXT
Definition: winuser.h:430
#define DC_ICON
Definition: winuser.h:429

Referenced by IntDefWindowProc(), NtUserDrawCaptionTemp(), and UserPaintCaption().

◆ UserDrawSysMenuButton()

BOOL UserDrawSysMenuButton ( PWND  pWnd,
HDC  hDC,
LPRECT  Rect,
BOOL  Down 
)

Definition at line 777 of file nonclient.c.

778{
779 PCURICON_OBJECT WindowIcon;
780 BOOL Ret = FALSE;
781
782 if ((WindowIcon = NC_IconForWindow(pWnd)))
783 {
784 UserReferenceObject(WindowIcon);
785
786 Ret = UserDrawIconEx(hDC,
787 Rect->left + 2,
788 Rect->top + 2,
789 WindowIcon,
792 0, NULL, DI_NORMAL);
793
794 UserDereferenceObject(WindowIcon);
795 }
796 return Ret;
797}
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1691
#define DI_NORMAL
Definition: wingdi.h:72

Referenced by MENU_DrawMenuItem(), and NC_HandleNCLButtonDown().

◆ UserFreeInputContext()

VOID UserFreeInputContext ( _In_opt_ PVOID  Object)

Definition at line 1548 of file ime.c.

1549{
1550 PTHRDESKHEAD ObjHead = Object;
1551 PDESKTOP pDesk = ObjHead->rpdesk;
1552 PIMC pNode, pIMC = Object;
1553 PTHREADINFO pti;
1554
1555 if (!pIMC)
1556 return;
1557
1558 // Remove pIMC from the list except spDefaultImc
1559 pti = pIMC->head.pti;
1560 for (pNode = pti->spDefaultImc; pNode; pNode = pNode->pImcNext)
1561 {
1562 if (pNode->pImcNext == pIMC)
1563 {
1564 pNode->pImcNext = pIMC->pImcNext;
1565 break;
1566 }
1567 }
1568
1569 DesktopHeapFree(pDesk, Object);
1570
1571 pti->ppi->UserHandleCount--;
1573}
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:172

◆ UserGetActiveWindow()

HWND FASTCALL UserGetActiveWindow ( VOID  )

Definition at line 1426 of file focus.c.

1427{
1429 PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue;
1430 if (!ThreadQueue)
1431 return NULL;
1432 return (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : NULL);
1433}

Referenced by co_UserCreateWindowEx(), DefWndHandleSysCommand(), IntDefWindowProc(), NC_HandleNCLButtonDown(), and NtUserGetThreadState().

◆ UserGetAncestor()

◆ UserGetDCEx()

◆ UserGetForegroundWindow()

HWND FASTCALL UserGetForegroundWindow ( VOID  )

Definition at line 1418 of file focus.c.

1419{
1420 PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
1421 if (!ForegroundQueue)
1422 return NULL;
1423 return (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : NULL);
1424}

Referenced by co_UserProcessHotKeys(), IntDefWindowProc(), NtUserGetForegroundWindow(), and WinPosFixupFlags().

◆ UserGetKeyboardLayout()

HKL FASTCALL UserGetKeyboardLayout ( DWORD  dwThreadId)

Definition at line 995 of file kbdlayout.c.

997{
998 PTHREADINFO pti;
999 PLIST_ENTRY ListEntry;
1000 PKL pKl;
1001
1003
1004 if (!dwThreadId)
1005 {
1006 pKl = pti->KeyboardLayout;
1007 return pKl ? pKl->hkl : NULL;
1008 }
1009
1010 ListEntry = pti->rpdesk->PtiList.Flink;
1011
1012 //
1013 // Search the Desktop Thread list for related Desktop active Threads.
1014 //
1015 while(ListEntry != &pti->rpdesk->PtiList)
1016 {
1017 pti = CONTAINING_RECORD(ListEntry, THREADINFO, PtiLink);
1018
1019 if (PsGetThreadId(pti->pEThread) == UlongToHandle(dwThreadId))
1020 {
1021 pKl = pti->KeyboardLayout;
1022 return pKl ? pKl->hkl : NULL;
1023 }
1024
1025 ListEntry = ListEntry->Flink;
1026 }
1027
1028 return NULL;
1029}
DWORD dwThreadId
Definition: fdebug.c:31
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by IntGetActiveKeyboardLayout(), and NtUserCallOneParam().

◆ UserGetKeyboardType()

DWORD FASTCALL UserGetKeyboardType ( DWORD  TypeFlag)

Definition at line 1907 of file keyboard.c.

1909{
1910 switch (dwTypeFlag)
1911 {
1912 case 0: /* Keyboard type */
1914 case 1: /* Keyboard Subtype */
1916 case 2: /* Number of F-keys */
1918 default:
1919 ERR("Unknown type!\n");
1920 return 0; /* Note: we don't have to set last error here */
1921 }
1922}
KEYBOARD_ID KeyboardIdentifier
Definition: ntddkbd.h:124
USHORT NumberOfFunctionKeys
Definition: ntddkbd.h:126
UCHAR Subtype
Definition: ntddkbd.h:102
UCHAR Type
Definition: ntddkbd.h:101
KEYBOARD_ATTRIBUTES gKeyboardInfo
Definition: keyboard.c:17

Referenced by NtUserCallOneParam().

◆ UserGetKeyState()

DWORD FASTCALL UserGetKeyState ( DWORD  key)

Definition at line 221 of file msgqueue.c.

222{
223 DWORD dwRet = 0;
224 PTHREADINFO pti;
225 PUSER_MESSAGE_QUEUE MessageQueue;
226
228 MessageQueue = pti->MessageQueue;
229
230 if (dwKey < 0x100)
231 {
232 if (IS_KEY_DOWN(MessageQueue->afKeyState, dwKey))
233 dwRet |= 0xFF80; // If down, windows returns 0xFF80.
234 if (IS_KEY_LOCKED(MessageQueue->afKeyState, dwKey))
235 dwRet |= 0x1;
236 }
237 else
238 {
240 }
241 return dwRet;
242}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BYTE afKeyState[256 *2/8]
Definition: msgqueue.h:84
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:102
#define IS_KEY_LOCKED(ks, vk)
Definition: input.h:103

Referenced by co_IntProcessKeyboardMessage(), co_IntTranslateAccelerator(), IntDefWindowProc(), MENU_InitPopup(), and NtUserGetKeyState().

◆ UserGetMenuObject()

◆ UserGetProcessWindowStation()

HWINSTA FASTCALL UserGetProcessWindowStation ( VOID  )

Definition at line 1357 of file winsta.c.

1358{
1360
1361 return ppi->hwinsta;
1362}
HWINSTA hwinsta
Definition: win32.h:268

Referenced by IntGetWinStaForCbAccess(), NtUserCloseWindowStation(), and NtUserGetProcessWindowStation().

◆ UserGetShellWindow()

HWND FASTCALL UserGetShellWindow ( VOID  )

Definition at line 3684 of file window.c.

3685{
3686 PWINSTATION_OBJECT WinStaObject;
3687 HWND Ret;
3688
3690 UserMode,
3691 0,
3692 &WinStaObject,
3693 0);
3694
3695 if (!NT_SUCCESS(Status))
3696 {
3698 return NULL;
3699 }
3700
3701 Ret = (HWND)WinStaObject->ShellWindow;
3702
3703 ObDereferenceObject(WinStaObject);
3704 return Ret;
3705}
HANDLE ShellWindow
Definition: winsta.h:43

Referenced by co_WinPosSetWindowPos(), and SpiSetWallpaper().

◆ UserGetSystemMetrics()

LONG NTAPI UserGetSystemMetrics ( ULONG  Index)

Definition at line 209 of file metric.c.

210{
211 ASSERT(gpsi);
212 ASSERT(Setup);
213 TRACE("UserGetSystemMetrics(%lu)\n", Index);
214
215 if (Index == SM_DBCSENABLED)
217
218 if (Index == SM_IMMENABLED)
219 return !!(gpsi->dwSRVIFlags & SRVINFO_IMM32);
220
221 /* Get metrics from array */
222 if (Index < SM_CMETRICS)
223 {
224 return gpsi->aiSysMet[Index];
225 }
226
227 /* Handle special values */
228 switch (Index)
229 {
230 case SM_REMOTESESSION:
231 return 0; // FIXME
232
233 case SM_SHUTTINGDOWN:
234 return 0; // FIXME
235
236 case SM_REMOTECONTROL:
237 return 0; // FIXME
238 }
239
240 ERR("UserGetSystemMetrics() called with invalid index %lu\n", Index);
241 return 0;
242}
_In_ WDFCOLLECTION _In_ ULONG Index
#define SM_REMOTESESSION
Definition: winuser.h:1069
#define SM_CMETRICS
Definition: winuser.h:1076

Referenced by co_IntProcessMouseMessage(), co_WinPosArrangeIconicWindows(), co_WinPosDoWinPosChanging(), co_WinPosGetMinMaxInfo(), co_WinPosMinMaximize(), DefWndDoSizeMove(), DefWndStartSizeMove(), GetNCHitEx(), IntCalculateThumb(), IntCreateDesktop(), IntCreateWindow(), IntDefWindowProc(), IntDrawMenuBarTemp(), IntFixWindowCoordinates(), IntGetClientRect(), IntGetScrollBarRect(), intGetTitleBarInfo(), IntGetWindowBorderMeasures(), IntIsWindowFullscreen(), IntPaintDesktop(), MENU_CalcItemSize(), MENU_DrawBitmapItem(), MENU_DrawMenuBar(), MENU_DrawMenuItem(), MENU_EnsureMenuItemVisible(), MENU_FindItemByCoords(), MENU_FindItemByKey(), MENU_GetBitmapItemSize(), MENU_GetMaxPopupHeight(), MENU_ShowPopup(), MENU_ShowSubPopup(), NC_DoNCPaint(), NC_DrawFrame(), NC_GetInsideRect(), NC_GetSysPopupPos(), NC_HandleNCCalcSize(), NtUserCreateCaret(), NtUserDragDetect(), NtUserGetClipCursor(), NtUserSwitchDesktop(), UserDrawCaption(), UserDrawCaptionBar(), UserDrawCaptionButton(), UserDrawCaptionText(), UserDrawIconEx(), UserDrawMovingFrame(), UserDrawSysMenuButton(), UserGetWindowBorders(), UserSendMouseInput(), UserSetClassLongPtr(), and WinPosFindIconPos().

◆ UserGetWindowDC()

HDC FASTCALL UserGetWindowDC ( PWND  Wnd)

Definition at line 947 of file windc.c.

948{
949 return UserGetDCEx(Wnd, 0, DCX_USESTYLE | DCX_WINDOW);
950}
HDC FASTCALL UserGetDCEx(PWND Wnd OPTIONAL, HANDLE ClipRegion, ULONG Flags)
Definition: windc.c:345

Referenced by DefWndScreenshot(), IntAnimatePalette(), NC_DoButton(), NC_HandleNCLButtonDown(), UserGetDesktopDC(), and UserRealizePalette().

◆ UserGetWindowObject()

PWND FASTCALL UserGetWindowObject ( HWND  hWnd)

Definition at line 123 of file window.c.

124{
125 PWND Window;
126
127 if (!hWnd)
128 {
130 return NULL;
131 }
132
134 if (!Window || 0 != (Window->state & WNDS_DESTROYED))
135 {
137 return NULL;
138 }
139
140 return Window;
141}
struct _WND * PWND
@ TYPE_WINDOW
Definition: ntuser.h:41
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:1226

Referenced by CaretSystemTimerProc(), co_IntCallHookProc(), co_IntDoSendMessage(), co_IntGetPeekMessage(), co_IntHideCaret(), co_IntPaintWindows(), co_IntSendActivateMessages(), co_IntSendMessageTimeout(), co_IntSendMessageTimeoutSingle(), co_IntSendMessageWithCallBack(), co_IntSetCaretPos(), co_IntSetWindowLongPtr(), co_MsqInsertMouseMessage(), co_UserCreateWindowEx(), co_UserHideCaret(), co_UserSetCapture(), co_UserSetParent(), DceResetActiveDCEs(), DceUpdateVisRgn(), EngCreateWnd(), EngDeleteWnd(), IntClientShutdown(), IntDdeGetMessageHook(), IntDdePostMessageHook(), IntDdeSendMessageHook(), IntDefWindowProc(), IntDispatchMessage(), IntEnableWindow(), IntFindWindow(), IntGetMenuItemRect(), IntGetWindowObject(), IntIsWindow(), IntLinkHwnd(), IntNtUserSetClassLongPtr(), IntPaintDesktop(), IntScrollWindowEx(), IntSendDestroyMsg(), IntSetOwner(), IntSetTebWndCallback(), IntTrackMouseEvent(), NtGdiUpdateColors(), NtUserBeginPaint(), NtUserBuildHwndList(), NtUserBuildPropList(), NtUserCalcMenuBar(), NtUserCallHwnd(), NtUserCallHwndLock(), NtUserCallHwndParam(), NtUserCallHwndParamLock(), NtUserCallTwoParam(), NtUserChangeClipboardChain(), NtUserChildWindowFromPointEx(), NtUserCreateCaret(), NtUserDeferWindowPos(), NtUserDefSetText(), NtUserDestroyWindow(), NtUserDrawCaptionTemp(), NtUserDrawMenuBarTemp(), NtUserEnableScrollBar(), NtUserEndPaint(), NtUserExcludeUpdateRgn(), NtUserFillWindow(), NtUserFindWindowEx(), NtUserGetAncestor(), NtUserGetClassName(), NtUserGetComboBoxInfo(), NtUserGetControlBrush(), NtUserGetControlColor(), NtUserGetCPD(), NtUserGetDCEx(), NtUserGetInternalWindowPos(), NtUserGetLayeredWindowAttributes(), NtUserGetListBoxInfo(), NtUserGetMenuBarInfo(), NtUserGetMenuItemRect(), NtUserGetScrollBarInfo(), NtUserGetSystemMenu(), NtUserGetTitleBarInfo(), NtUserGetUpdateRect(), NtUserGetUpdateRgn(), NtUserGetWindowPlacement(), NtUserHideCaret(), NtUserHiliteMenuItem(), NtUserInternalGetWindowText(), NtUserKillTimer(), NtUserMenuItemFromPoint(), NtUserMessageCall(), NtUserMinMaximize(), NtUserMonitorFromWindow(), NtUserNotifyWinEvent(), NtUserPaintMenuBar(), NtUserPrintWindow(), NtUserQueryWindow(), NtUserRealChildWindowFromPoint(), NtUserRedrawWindow(), NtUserRegisterHotKey(), NtUserRemoveProp(), NtUserSBGetParms(), NtUserScrollWindowEx(), NtUserSetActiveWindow(), NtUserSetClipboardViewer(), NtUserSetFocus(), NtUserSetInternalWindowPos(), NtUserSetLayeredWindowAttributes(), NtUserSetMenu(), NtUserSetProp(), NtUserSetScrollBarInfo(), NtUserSetScrollInfo(), NtUserSetShellWindowEx(), NtUserSetSystemMenu(), NtUserSetSystemTimer(), NtUserSetTimer(), NtUserSetWindowFNID(), NtUserSetWindowPlacement(), NtUserSetWindowPos(), NtUserSetWindowRgn(), NtUserSetWindowWord(), NtUserShowCaret(), NtUserShowScrollBar(), NtUserShowWindow(), NtUserShowWindowAsync(), NtUserTrackPopupMenuEx(), NtUserTranslateAccelerator(), NtUserTranslateMessage(), NtUserUnregisterHotKey(), NtUserUpdateLayeredWindow(), NtUserWindowFromPoint(), ScrollBarWndProc(), SnapWindow(), SpiNotifyNCMetricsChanged(), SystemTimerProc(), UserGetDesktopWindow(), UserGethWnd(), UserOpenClipboard(), UserPostMessage(), UserRealizePalette(), UserRegisterUserApiHook(), and UserSendNotifyMessage().

◆ UserIsCTFIMEEnabled()

BOOL FASTCALL UserIsCTFIMEEnabled ( VOID  )

Definition at line 30 of file metric.c.

31{
32 if (RegGetSectionDWORD(L"IMM", L"DontLoadCTFIME", FALSE))
33 return FALSE;
34
35 return UserIsIMMEnabled();
36}
DWORD NTAPI RegGetSectionDWORD(LPCWSTR pszSection, PCWSTR pszValue, DWORD dwDefault)
Definition: registry.c:172

Referenced by InitMetrics().

◆ UserIsDBCSEnabled()

BOOL FASTCALL UserIsDBCSEnabled ( VOID  )

Definition at line 17 of file metric.c.

18{
20}

Referenced by InitMetrics().

◆ UserIsIMMEnabled()

BOOL FASTCALL UserIsIMMEnabled ( VOID  )

Definition at line 22 of file metric.c.

23{
25 return TRUE;
26
27 return !!RegGetSectionDWORD(L"IMM", L"LoadIMM", FALSE);
28}

Referenced by InitMetrics(), NtUserCallNoParam(), and UserIsCTFIMEEnabled().

◆ UserPaintCaption()

BOOL UserPaintCaption ( PWND  pWnd,
INT  Flags 
)

Definition at line 395 of file defwnd.c.

396{
397 BOOL Ret = FALSE;
398
399 if ( (pWnd->style & WS_VISIBLE) && ((pWnd->style & WS_CAPTION) == WS_CAPTION) )
400 {
401 if (pWnd->state & WNDS_HASCAPTION && pWnd->head.pti->MessageQueue == gpqForeground)
402 Flags |= DC_ACTIVE;
403 /*
404 * When themes are not enabled we can go on and paint the non client area.
405 * However if we do that with themes enabled we will draw a classic frame.
406 * This is solved by sending a themes specific message to notify the themes
407 * engine that the caption needs to be redrawn.
408 */
410 {
411 /*
412 * This will cause uxtheme to either paint the themed caption or call
413 * RealUserDrawCaption in order to draw the classic caption when themes
414 * are disabled but the themes service is enabled.
415 */
416 TRACE("UDCB Flags %08x\n", Flags);
418 }
419 else
420 {
422 UserDrawCaptionBar(pWnd, hDC, Flags | DC_FRAME); // DCFRAME added as fix for CORE-10855.
423 UserReleaseDC(pWnd, hDC, FALSE);
424 }
425 Ret = TRUE;
426 }
427 // Support window tray
428 return Ret;
429}
#define SRVINFO_APIHOOK
Definition: ntuser.h:950
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:48
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:965

Referenced by DefWndSetIcon(), IntDefWindowProc(), IntEnableMenuItem(), IntNtUserSetClassLongPtr(), NtUserCallTwoParam(), RealDefWindowProcA(), and RealDefWindowProcW().

◆ UserPostMessage()

BOOL FASTCALL UserPostMessage ( HWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1395 of file message.c.

1399{
1400 PTHREADINFO pti;
1401 MSG Message;
1402 LONG_PTR ExtraInfo = 0;
1403
1404 Message.hwnd = Wnd;
1405 Message.message = Msg;
1406 Message.wParam = wParam;
1407 Message.lParam = lParam;
1408 Message.pt = gpsi->ptCursor;
1409 Message.time = EngGetTickCount32();
1410
1411 if (is_pointer_message(Message.message, Message.wParam))
1412 {
1414 return FALSE;
1415 }
1416
1417 if (Wnd == HWND_BROADCAST || Wnd == HWND_TOPMOST)
1418 {
1419 HWND *List;
1420 PWND DesktopWindow;
1421 ULONG i;
1422
1423 if (!is_message_broadcastable(Msg)) return TRUE;
1424
1425 DesktopWindow = UserGetDesktopWindow();
1426 List = IntWinListChildren(DesktopWindow);
1427
1428 if (List != NULL)
1429 {
1430 UserPostMessage(UserHMGetHandle(DesktopWindow), Msg, wParam, lParam);
1431 for (i = 0; List[i]; i++)
1432 {
1433 PWND pwnd = UserGetWindowObject(List[i]);
1434 if (!pwnd) continue;
1435
1436 if ( pwnd->fnid == FNID_MENU || // Also need pwnd->pcls->atomClassName == gaOleMainThreadWndClass
1438 continue;
1439
1441 }
1443 }
1444 }
1445 else
1446 {
1447 PWND Window;
1448
1449 if (!Wnd)
1450 {
1452 Msg,
1453 wParam,
1454 lParam);
1455 }
1456
1458 if ( !Window )
1459 {
1460 ERR("UserPostMessage: Invalid handle 0x%p Msg 0x%x!\n", Wnd, Msg);
1461 return FALSE;
1462 }
1463
1464 pti = Window->head.pti;
1465
1466 if ( pti->TIF_flags & TIF_INCLEANUP )
1467 {
1468 ERR("Attempted to post message to window %p when the thread is in cleanup!\n", Wnd);
1469 return FALSE;
1470 }
1471
1472 if ( Window->state & WNDS_DESTROYED )
1473 {
1474 ERR("Attempted to post message to window %p that is being destroyed!\n", Wnd);
1476 return FALSE;
1477 }
1478
1479 if ( Msg >= WM_DDE_FIRST && Msg <= WM_DDE_LAST )
1480 {
1481 if (!IntDdePostMessageHook(Window, Msg, wParam, &lParam, &ExtraInfo))
1482 {
1483 TRACE("Posting Exit DDE 0x%x\n",Msg);
1484 return FALSE;
1485 }
1486 Message.lParam = lParam;
1487 }
1488
1489 MsqPostMessage(pti, &Message, FALSE, QS_POSTMESSAGE, 0, ExtraInfo);
1490 }
1491 return TRUE;
1492}
#define WM_DDE_FIRST
Definition: dde.h:47
#define WM_DDE_LAST
Definition: dde.h:46
static const WCHAR Message[]
Definition: register.c:74
#define ICLS_SWITCH
Definition: ntuser.h:932
#define FNID_MENU
Definition: ntuser.h:861
VOID FASTCALL MsqPostMessage(PTHREADINFO pti, MSG *Msg, BOOLEAN HardwareMessage, DWORD MessageBits, DWORD dwQEvent, LONG_PTR ExtraInfo)
Definition: msgqueue.c:1337
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
RTL_ATOM atomClassName
Definition: ntuser.h:568
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
BOOL APIENTRY IntDdePostMessageHook(IN PWND pWnd, IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, IN OUT LONG_PTR *ExtraInfo)
Definition: dde.c:172
static int is_pointer_message(UINT message, WPARAM wparam)
Definition: message.c:120
static BOOL is_message_broadcastable(UINT msg)
Definition: message.c:617
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1395
BOOL FASTCALL UserPostThreadMessage(PTHREADINFO pti, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1358
#define USERTAG_WINDOWLIST
Definition: tags.h:298
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:275
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:1005
#define HWND_TOPMOST
Definition: winuser.h:1219
#define HWND_BROADCAST
Definition: winuser.h:1215
#define QS_POSTMESSAGE
Definition: winuser.h:888

Referenced by co_IntProcessKeyboardMessage(), co_IntShellHookNotify(), co_UserProcessHotKeys(), DefWndHandleSetCursor(), DefWndHandleSysCommand(), DoTheScreenSaver(), ExitThreadCallback(), IntDefWindowProc(), IntImmProcessKey(), IntLanguageToggle(), IntRemoveTrackMouseEvent(), IntTrackMouseEvent(), IntTrackMouseMove(), MENU_EndMenu(), MENU_ExecFocusedItem(), MENU_TrackKbdMenuBar(), MENU_TrackMenu(), NotifyLogon(), NtUserCallOneParam(), NtUserEndMenu(), NtUserLockWorkStation(), NtUserMessageCall(), NtUserPostMessage(), SystemTimerProc(), and UserPostMessage().

◆ UserReleaseDC()

INT FASTCALL UserReleaseDC ( PWND  Window,
HDC  hDc,
BOOL  EndPaint 
)

Definition at line 918 of file windc.c.

919{
920 PDCE dce;
921 PLIST_ENTRY ListEntry;
922 INT nRet = 0;
923 BOOL Hit = FALSE;
924
925 TRACE("%p %p\n", Window, hDc);
926 ListEntry = LEDce.Flink;
927 while (ListEntry != &LEDce)
928 {
929 dce = CONTAINING_RECORD(ListEntry, DCE, List);
930 ListEntry = ListEntry->Flink;
931 if (dce->hDC == hDc)
932 {
933 Hit = TRUE;
934 break;
935 }
936 }
937
938 if ( Hit && (dce->DCXFlags & DCX_DCEBUSY))
939 {
940 nRet = DceReleaseDC(dce, EndPaint);
941 }
942
943 return nRet;
944}
#define DCX_DCEBUSY
Definition: dce.h:36
Definition: dce.h:18
DWORD DCXFlags
Definition: dce.h:28
HDC hDC
Definition: dce.h:20
static LIST_ENTRY LEDce
Definition: windc.c:17
static INT FASTCALL DceReleaseDC(DCE *dce, BOOL EndPaint)
Definition: windc.c:279
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)

Referenced by co_IntDrawCaret(), co_IntPaintWindows(), co_UserGetUpdateRect(), co_WinPosSetWindowPos(), DefWndDoSizeMove(), DefWndScreenshot(), ForceNCPaintErase(), IntAnimatePalette(), IntDefWindowProc(), IntEndPaint(), IntGdiDeleteDC(), IntGetDialogBaseUnits(), IntPrintWindow(), IntRefeshScrollInterior(), IntScrollWindowEx(), IntSynthesizeBitmap(), IntSynthesizeDib(), IntUpdateLayeredWindowI(), MENU_PopupMenuCalcSize(), MENU_SelectItem(), MENU_ShowSubPopup(), NC_DoButton(), NC_HandleNCActivate(), NC_HandleNCCalcSize(), NC_HandleNCLButtonDown(), NtUserCalcMenuBar(), NtUserCallOneParam(), PaintSuspendedWindow(), SnapWindow(), UserPaintCaption(), and UserRealizePalette().

◆ UserSetMenuDefaultItem()

BOOL FASTCALL UserSetMenuDefaultItem ( PMENU  Menu,
UINT  uItem,
UINT  fByPos 
)

Definition at line 1274 of file menu.c.

1275{
1276 UINT i;
1277 PITEM MenuItem = MenuObject->rgItems;
1278
1279 if (!MenuItem) return FALSE;
1280
1281 /* reset all default-item flags */
1282 for (i = 0; i < MenuObject->cItems; i++, MenuItem++)
1283 {
1284 MenuItem->fState &= ~MFS_DEFAULT;
1285 }
1286
1287 /* no default item */
1288 if(uItem == (UINT)-1)
1289 {
1290 return TRUE;
1291 }
1292 MenuItem = MenuObject->rgItems;
1293 if ( fByPos )
1294 {
1295 if ( uItem >= MenuObject->cItems ) return FALSE;
1296 MenuItem[uItem].fState |= MFS_DEFAULT;
1297 return TRUE;
1298 }
1299 else
1300 {
1301 for (i = 0; i < MenuObject->cItems; i++, MenuItem++)
1302 {
1303 if (MenuItem->wID == uItem)
1304 {
1305 MenuItem->fState |= MFS_DEFAULT;
1306 return TRUE;
1307 }
1308 }
1309
1310 }
1311 return FALSE;
1312}
UINT wID
Definition: ntuser.h:374
UINT fState
Definition: ntuser.h:373
#define MFS_DEFAULT
Definition: winuser.h:759

Referenced by co_UserTrackSystemMenu(), IntSetMenuItemInfo(), MENU_GetSystemMenu(), MENU_InitSysMenuPopup(), and NtUserSetMenuDefaultItem().

◆ UserSystemParametersInfo()

BOOL FASTCALL UserSystemParametersInfo ( UINT  uiAction,
UINT  uiParam,
PVOID  pvParam,
UINT  fWinIni 
)

Definition at line 2123 of file sysparams.c.

2128{
2129 ULONG_PTR ulResult;
2131
2132 ASSERT(ppi);
2133
2134 if (!gbSpiInitialized)
2135 {
2137 //ASSERT(FALSE);
2138 return FALSE;
2139 }
2140
2141 /* Get a pointer to the current Windowstation */
2142 if (!ppi->prpwinsta)
2143 {
2144 ERR("UserSystemParametersInfo called without active window station.\n");
2145 //ASSERT(FALSE);
2146 //return FALSE;
2147 }
2148
2149 if ((fWinIni & SPIF_PROTECT) && !SpiGetSetProbeBuffer(uiAction, uiParam, pvParam))
2150 {
2152 return FALSE;
2153 }
2154
2155 /* Do the actual operation */
2156 ulResult = SpiGetSet(uiAction, uiParam, pvParam, fWinIni);
2157
2158 /* Did we change something? */
2159 if (ulResult > 1)
2160 {
2162
2163 /* Update system metrics */
2164 InitMetrics();
2165
2166 /* Send notification to toplevel windows, if requested */
2167 if (fWinIni & SPIF_SENDCHANGE)
2168 {
2169 /* Send WM_SETTINGCHANGE to all toplevel windows */
2172 (WPARAM)uiAction,
2173 (LPARAM)ulResult,
2175 100,
2176 &ulResult);
2177 }
2178 ulResult = 1;
2179 }
2180
2181 return ulResult;
2182}
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
struct _WINSTATION_OBJECT * prpwinsta
Definition: win32.h:267
#define SPIF_PROTECT
Definition: sysparams.h:13
uint32_t ULONG_PTR
Definition: typedefs.h:65
LRESULT FASTCALL co_IntSendMessageTimeout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult)
Definition: message.c:1707
BOOL NTAPI InitMetrics(VOID)
Definition: metric.c:40
static VOID SpiFixupValues(VOID)
Definition: sysparams.c:205
BOOL gbSpiInitialized
Definition: sysparams.c:18
static UINT_PTR SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl)
Definition: sysparams.c:823
static BOOL SpiGetSetProbeBuffer(UINT uiAction, UINT uiParam, PVOID pvParam)
Definition: sysparams.c:1852
#define ERROR_NOACCESS
Definition: winerror.h:902
#define SPIF_SENDCHANGE
Definition: winuser.h:1600
#define WM_SETTINGCHANGE
Definition: winuser.h:1657
#define SMTO_NORMAL
Definition: winuser.h:1236

Referenced by co_IntCalculateSnapPosition(), DefWndDoSizeMove(), GetSnapActivationPoint(), IntDrawMenuBarTemp(), IntPaintDesktop(), MENU_DrawBitmapItem(), MENU_DrawMenuItem(), MenuInit(), NC_DoNCPaint(), NC_HandleNCLButtonDblClk(), NtUserSystemParametersInfo(), UserDrawCaptionBar(), and UserDrawCaptionText().

Variable Documentation

◆ gAtomTable