ReactOS 0.4.16-dev-1305-ge26ad0d
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 14 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 45 of file userfuncs.h.

Function Documentation

◆ _scwprintf()

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

Definition at line 13 of file _scwprintf.c.

16{
17 int len;
19
22 va_end(args);
23
24 return len;
25}
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_ _CRTIMP int __cdecl _vscwprintf(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
#define args
Definition: format.c:66
Definition: match.c:390
Definition: format.c:58

Referenced by UserpFormatMessages().

◆ AllocInputContextObject()

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

Definition at line 1501 of file ime.c.

1506{
1507 PTHRDESKHEAD ObjHead;
1508
1509 ASSERT(Size > sizeof(*ObjHead));
1510 ASSERT(pti != NULL);
1511
1512 if (!pDesk)
1513 pDesk = pti->rpdesk;
1514
1515 ObjHead = DesktopHeapAlloc(pDesk, Size);
1516 if (!ObjHead)
1517 return NULL;
1518
1519 RtlZeroMemory(ObjHead, Size);
1520
1521 ObjHead->pSelf = ObjHead;
1522 ObjHead->rpdesk = pDesk;
1523 ObjHead->pti = pti;
1525 *HandleOwner = pti;
1526 pti->ppi->UserHandleCount++;
1527
1528 return ObjHead;
1529}
#define NULL
Definition: types.h:112
#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:4533
#define IntReferenceThreadInfo(pti)
Definition: win32.h:167
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204

◆ co_DestroyThreadWindows()

VOID FASTCALL co_DestroyThreadWindows ( struct _ETHREAD Thread)

◆ co_UserDestroyWindow()

BOOLEAN co_UserDestroyWindow ( PVOID  Object)

Definition at line 2870 of file window.c.

2871{
2872 HWND hWnd;
2873 PWND pwndTemp;
2874 PTHREADINFO ti;
2875 MSG msg;
2876 PWND Window = Object;
2877
2878 ASSERT_REFS_CO(Window); // FIXME: Temp HACK?
2879
2880 /* NtUserDestroyWindow does check if the window has already been destroyed
2881 but co_UserDestroyWindow can be called from more paths which means
2882 that it can also be called for a window that has already been destroyed. */
2884 {
2885 TRACE("Tried to destroy a window twice\n");
2886 return TRUE;
2887 }
2888
2891
2892 TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
2893
2894 /* Check for owner thread */
2895 if (Window->head.pti != ti)
2896 {
2897 /* Check if we are destroying the desktop window */
2898 if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
2899 {
2901 return FALSE;
2902 }
2903 }
2904
2905 /* If window was created successfully and it is hooked */
2906 if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
2907 {
2909 {
2910 ERR("Destroy Window WH_CBT Call Hook return!\n");
2911 return FALSE;
2912 }
2913 }
2914
2915 if (Window->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME])
2916 {
2917 if ((Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2918 {
2919 if (Window->spwndOwner)
2920 {
2921 //ERR("DestroyWindow Owner out.\n");
2922 UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE);
2923 }
2924 }
2925 }
2926
2927 /* Inform the parent */
2928 if (Window->style & WS_CHILD)
2929 {
2931 }
2932
2933 if (!Window->spwndOwner && !IntGetParent(Window))
2934 {
2936 }
2937
2938 /* Hide the window */
2939 if (Window->style & WS_VISIBLE)
2940 {
2941 if (Window->style & WS_CHILD)
2942 {
2943 /* Only child windows receive WM_SHOWWINDOW in DestroyWindow() */
2945 }
2946 else
2947 {
2949 }
2950 }
2951
2952 /* Adjust last active */
2953 if ((pwndTemp = Window->spwndOwner))
2954 {
2955 while (pwndTemp->spwndOwner)
2956 pwndTemp = pwndTemp->spwndOwner;
2957
2958 if (pwndTemp->spwndLastActive == Window)
2959 WndSetLastActive(pwndTemp, Window->spwndOwner);
2960 }
2961
2962 if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
2963 {
2964 if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
2965 {
2967 {
2968 //ERR("DestroyWindow Parent out.\n");
2969 UserAttachThreadInput(Window->head.pti, Window->spwndParent->head.pti, FALSE);
2970 }
2971 }
2972 }
2973
2974 if (Window->head.pti->MessageQueue->spwndActive == Window)
2975 Window->head.pti->MessageQueue->spwndActive = NULL;
2976 if (Window->head.pti->MessageQueue->spwndFocus == Window)
2977 Window->head.pti->MessageQueue->spwndFocus = NULL;
2978 if (Window->head.pti->MessageQueue->spwndActivePrev == Window)
2979 Window->head.pti->MessageQueue->spwndActivePrev = NULL;
2980 if (Window->head.pti->MessageQueue->spwndCapture == Window)
2981 Window->head.pti->MessageQueue->spwndCapture = NULL;
2982
2983 /*
2984 * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL
2985 */
2986
2987 if (ti->pDeskInfo != NULL)
2988 {
2989 if (ti->pDeskInfo->hShellWindow == hWnd)
2990 {
2991 ERR("Destroying the ShellWindow!\n");
2992 ti->pDeskInfo->hShellWindow = NULL;
2993 }
2994 }
2995
2997
2999 {
3000 return TRUE;
3001 }
3002
3003 /* Recursively destroy owned windows */
3004 if (!(Window->style & WS_CHILD))
3005 {
3007 }
3008
3009 /* Generate mouse move message for the next window */
3010 msg.message = WM_MOUSEMOVE;
3011 msg.wParam = UserGetMouseButtonsState();
3012 msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
3013 msg.pt = gpsi->ptCursor;
3015
3016 IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
3017
3018 /* Send destroy messages */
3020
3021 /* Destroy the default IME window if necessary */
3022 if (IS_IMM_MODE() && !(ti->TIF_flags & TIF_INCLEANUP) &&
3023 ti->spwndDefaultIme && (ti->spwndDefaultIme != Window) &&
3024 !(Window->state & WNDS_DESTROYED) && !IS_WND_IMELIKE(Window))
3025 {
3026 if (IS_WND_CHILD(Window))
3027 {
3030 }
3031 else
3032 {
3035 }
3036 }
3037
3039 {
3040 return TRUE;
3041 }
3042
3043 /* Destroy the window storage */
3045
3046 return TRUE;
3047}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: precomp.h:57
#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
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:2113
BOOL FASTCALL IntImeCanDestroyDefIME(_In_ PWND pImeWnd, _In_ PWND pwndTarget)
Definition: ime.c:2160
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:2594
#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:14
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1709
#define DF_DESTROYED
Definition: desktop.h:50
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:480
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:206
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:576
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:361
static void IntSendDestroyMsg(HWND hWnd)
Definition: window.c:463
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2870
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:178
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1695
VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
Definition: window.c:2834
#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 OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
#define WOC_DELETE
Definition: winddi.h:1269
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define MAKELPARAM(l, h)
Definition: winuser.h:4084
#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:1794
#define WH_CBT
Definition: winuser.h:35
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define WM_DESTROY
Definition: winuser.h:1628
#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 1317 of file focus.c.

1318{
1319 HWND hWndPrev = 0;
1320 PWND pwndTop;
1321 PTHREADINFO pti;
1322 PUSER_MESSAGE_QUEUE ThreadQueue;
1323
1324 if (Window)
1326
1328 ThreadQueue = pti->MessageQueue;
1329 ASSERT(ThreadQueue != 0);
1330
1331 TRACE("Enter SetFocus hWnd 0x%p pti 0x%p\n",Window ? UserHMGetHandle(Window) : 0, pti );
1332
1333 hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1334
1335 if (Window != 0)
1336 {
1337 if (hWndPrev == UserHMGetHandle(Window))
1338 {
1339 return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0; /* Nothing to do */
1340 }
1341
1342 if (Window->head.pti->MessageQueue != ThreadQueue)
1343 {
1344 ERR("SetFocus Must have the same Q!\n");
1345 return 0;
1346 }
1347
1348 /* Check if we can set the focus to this window */
1350 for (pwndTop = Window; pwndTop; pwndTop = pwndTop->spwndParent)
1351 {
1352 if (pwndTop->style & (WS_MINIMIZED|WS_DISABLED)) return 0;
1353 if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break;
1354 if (pwndTop->spwndParent == NULL) break;
1355 }
1358 {
1359 ERR("SetFocus 1 WH_CBT Call Hook return!\n");
1360 return 0;
1361 }
1362
1363 /* Activate pwndTop if needed. */
1364 if (pwndTop != ThreadQueue->spwndActive)
1365 {
1366 PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); // Keep it based on desktop.
1367 if (ThreadQueue != ForegroundQueue && IsAllowedFGActive(pti, pwndTop)) // Rule 2 & 3.
1368 {
1369 //ERR("SetFocus: Set Foreground!\n");
1370 if (!(pwndTop->style & WS_VISIBLE))
1371 {
1372 pti->ppi->W32PF_flags |= W32PF_ALLOWFOREGROUNDACTIVATE;
1373 }
1375 {
1376 ERR("SetFocus: Set Foreground and Focus Failed!\n");
1377 return 0;
1378 }
1379 }
1380
1381 /* Set Active when it is needed. */
1382 if (pwndTop != ThreadQueue->spwndActive)
1383 {
1384 //ERR("SetFocus: Set Active! %p\n",pwndTop?UserHMGetHandle(pwndTop):0);
1385 if (!co_IntSetActiveWindow(pwndTop, FALSE, FALSE, FALSE))
1386 {
1387 ERR("SetFocus: Set Active Failed!\n");
1388 return 0;
1389 }
1390 }
1391
1392 /* Abort if window destroyed */
1393 if (Window->state2 & WNDS2_INDESTROY) return 0;
1394 /* Do not change focus if the window is no longer active */
1395 if (pwndTop != ThreadQueue->spwndActive)
1396 {
1397 ERR("SetFocus: Top window did not go active!\n");
1398 return 0;
1399 }
1400 }
1401
1402 // Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
1403 hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1404
1406
1407 TRACE("Focus: %p -> %p\n", hWndPrev, UserHMGetHandle(Window));
1408 }
1409 else /* NULL hwnd passed in */
1410 {
1411 if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)0, (LPARAM)hWndPrev))
1412 {
1413 ERR("SetFocus: 2 WH_CBT Call Hook return!\n");
1414 return 0;
1415 }
1416 //ERR("SetFocus: Set Focus NULL\n");
1417 /* set the current thread focus window null */
1419 }
1420 return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0;
1421}
BOOL FASTCALL IsAllowedFGActive(PTHREADINFO pti, PWND Wnd)
Definition: focus.c:733
VOID FASTCALL IntSendFocusMessages(PTHREADINFO pti, PWND pWnd)
Definition: focus.c:618
BOOL FASTCALL co_IntSetActiveWindow(_In_ PWND Wnd, _In_ BOOL bMouse, _In_ BOOL bFocus, _In_ BOOL Async)
Definition: focus.c:1027
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:927
#define WNDS2_INDESTROY
Definition: ntuser.h:648
#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:1324
LONG_PTR LPARAM
Definition: windef.h:208
#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 4390 of file window.c.

4391{
4393 BOOL Ret = FALSE;
4394
4395 RtlInitUnicodeString(&UnicodeString, WindowText);
4396
4397 if (UnicodeString.Length != 0)
4398 {
4399 if (Wnd->strName.MaximumLength > 0 &&
4400 UnicodeString.Length <= Wnd->strName.MaximumLength - sizeof(UNICODE_NULL))
4401 {
4402 ASSERT(Wnd->strName.Buffer != NULL);
4403
4404 Wnd->strName.Length = UnicodeString.Length;
4405 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4407 UnicodeString.Buffer,
4408 UnicodeString.Length);
4409 }
4410 else
4411 {
4412 PWCHAR buf;
4413 Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4414 buf = Wnd->strName.Buffer;
4415 Wnd->strName.Buffer = NULL;
4416 if (buf != NULL)
4417 {
4419 }
4420
4422 UnicodeString.Length + sizeof(UNICODE_NULL));
4423 if (Wnd->strName.Buffer != NULL)
4424 {
4425 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4427 UnicodeString.Buffer,
4428 UnicodeString.Length);
4429 Wnd->strName.MaximumLength = UnicodeString.Length + sizeof(UNICODE_NULL);
4430 Wnd->strName.Length = UnicodeString.Length;
4431 }
4432 else
4433 {
4435 goto Exit;
4436 }
4437 }
4438 }
4439 else
4440 {
4441 Wnd->strName.Length = 0;
4442 if (Wnd->strName.Buffer != NULL)
4443 Wnd->strName.Buffer[0] = L'\0';
4444 }
4445
4446 // FIXME: HAX! Windows does not do this in here!
4447 // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4448 // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4449 /* Send shell notifications */
4450 if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4451 {
4452 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) UserHMGetHandle(Wnd), FALSE); // FIXME Flashing?
4453 }
4454
4455 Ret = TRUE;
4456Exit:
4458 return Ret;
4459}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
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
#define L(x)
Definition: ntvdm.h:50
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
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
__wchar_t WCHAR
Definition: xmlstorage.h:180

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:300
#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 254 of file nonclient.c.

255{
256 MSG msg;
257 RECT sizingRect, mouseRect, origRect, unmodRect, snapPreviewRect;
258 PRECT pFrameRect = &sizingRect;
259 HDC hdc;
260 LONG hittest = (LONG)(wParam & 0x0f);
261 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
262 POINT minTrack, maxTrack;
263 POINT capturePoint, pt;
265 UINT orgSnap = IntGetWindowSnapEdge(pwnd), snap = orgSnap;
266 BOOL thickframe;
267 BOOL iconic;
268 BOOL moved = FALSE;
269 BOOL DragFullWindows = FALSE;
270 PWND pWndParent = NULL;
271 WPARAM syscommand = (wParam & 0xfff0);
273 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
274 // The task bar can grow in size and can not reduce due to the change
275 // in the work area.
276
277 Style = pwnd->style;
278 ExStyle = pwnd->ExStyle;
279 iconic = (Style & WS_MINIMIZE) != 0;
280
281 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
282 if ((Style & (WS_MAXIMIZE | WS_CHILD)) == WS_MAXIMIZE)
283 orgSnap = snap = HTTOP;
284
285 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
286
287 //
288 // Show window contents while dragging the window, get flag from registry data.
289 //
290 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
291
292 pt.x = pti->ptLast.x;
293 pt.y = pti->ptLast.y;
294 capturePoint = pt;
296
297 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
298 pwnd, syscommand, hittest, pt.x, pt.y);
299
300 if (syscommand == SC_MOVE)
301 {
302 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
303 if (!hittest) return;
304 }
305 else /* SC_SIZE */
306 {
307 if (!thickframe) return;
308 if (hittest && (syscommand != SC_MOUSEMENU))
309 {
310 hittest += (HTLEFT - WMSZ_LEFT);
311 }
312 else
313 {
315 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
316 if (!hittest)
317 {
319 return;
320 }
321 }
322 }
323
324 /* Get min/max info */
325
326 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
327 sizingRect = pwnd->rcWindow;
328 origRect = sizingRect;
329 if (Style & WS_CHILD)
330 {
331 pWndParent = IntGetParent(pwnd);
332 IntGetClientRect( pWndParent, &mouseRect );
333 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
334 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
335 unmodRect = sizingRect;
336 }
337 else
338 {
339 if (!(ExStyle & WS_EX_TOPMOST))
340 {
341 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
342 }
343 else
344 {
346 }
347 unmodRect = sizingRect;
348 }
349
350 if (ON_LEFT_BORDER(hittest))
351 {
352 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
353 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
354 }
355 else if (ON_RIGHT_BORDER(hittest))
356 {
357 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
358 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
359 }
360 if (ON_TOP_BORDER(hittest))
361 {
362 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
363 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
364 }
365 else if (ON_BOTTOM_BORDER(hittest))
366 {
367 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
368 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
369 }
370
371 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
372 if (iconic)
373 {
374 DragCursor = pwnd->pcls->spicn;
375 if (DragCursor)
376 {
377 UserReferenceObject(DragCursor);
378 }
379 else
380 {
381 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
382 if (CursorHandle)
383 {
384 DragCursor = UserGetCurIconObject(CursorHandle);
385 }
386 else
387 {
388 iconic = FALSE;
389 }
390 }
391 }
392
393 /* repaint the window before moving it around */
395
396 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
397
399
401
403
404 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
405
406 for(;;)
407 {
408 int dx = 0, dy = 0;
409
410 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
411 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
412
413 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
414 break; // Exit on Return or Esc
415
416 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
417 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
418 { // If no WindowSnapEnabled: Exit on button-up immediately
419 break;
420 }
421 else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP ||
422 (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0)))
423 { // If WindowSnapEnabled: Decide whether to snap before exiting
424 if (hittest == HTCAPTION && thickframe && /* Check for snapping if was moved by caption */
426 {
427 BOOLEAN wasSnap = IntIsWindowSnapped(pwnd); /* Need the live snap state, not orgSnap nor maximized state */
428 UINT snapTo = iconic ? HTNOWHERE : GetSnapActivationPoint(pwnd, pt);
429 if (snapTo)
430 {
431 if (DragFullWindows)
432 {
433 co_IntSnapWindow(pwnd, snapTo);
434 if (!wasSnap)
435 pwnd->InternalPos.NormalRect = origRect;
436 }
437 snap = snapTo;
438 }
439 }
440 break;
441 }
442
443 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
444 {
447 continue; /* We are not interested in other messages */
448 }
449
450 pt = msg.pt;
451
452 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
453 {
454 case VK_UP: pt.y -= 8; break;
455 case VK_DOWN: pt.y += 8; break;
456 case VK_LEFT: pt.x -= 8; break;
457 case VK_RIGHT: pt.x += 8; break;
458 }
459
460 pt.x = max( pt.x, mouseRect.left );
461 pt.x = min( pt.x, mouseRect.right - 1 );
462 pt.y = max( pt.y, mouseRect.top );
463 pt.y = min( pt.y, mouseRect.bottom - 1 );
464
465 dx = pt.x - capturePoint.x;
466 dy = pt.y - capturePoint.y;
467
468 if (dx || dy)
469 {
470 if (!moved)
471 {
472 moved = TRUE;
473 if (iconic) /* ok, no system popup tracking */
474 {
475 OldCursor = UserSetCursor(DragCursor, FALSE);
477 }
478 else if (!DragFullWindows)
479 UserDrawMovingFrame(hdc, &sizingRect, thickframe);
480 }
481
482 if (msg.message == WM_KEYDOWN)
483 {
484 UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
485 }
486 else
487 {
488 RECT newRect = unmodRect;
489
490 if (!iconic && !DragFullWindows)
491 {
492 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
493 pFrameRect = &sizingRect;
494 }
495 if (hittest == HTCAPTION)
496 {
497 /* Restore window size if it is snapped */
498 PRECT pr = &newRect;
499 LONG width, height, capcy, snapTo;
500 if (snap && syscommand == SC_MOVE && !iconic &&
501 !RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect))
502 {
503 *pr = pwnd->InternalPos.NormalRect;
504 origRect = *pr; /* Save normal size - is required when window unsnapped from one side and snapped to another holding mouse down */
505
506 /* Try to position the center of the caption where the mouse is horizontally */
507 capcy = UserGetSystemMetrics((ExStyle & WS_EX_TOPMOST) ? SM_CYSMCAPTION : SM_CYCAPTION); /* No border, close enough */
508 width = pr->right - pr->left;
509 height = pr->bottom - pr->top;
510 pr->left = pt.x - width / 2;
511 pr->right = pr->left + width;
512 pr->top = mouseRect.top;
513 pr->bottom = pr->top + height;
514 if (pr->left < mouseRect.left)
515 {
516 pr->left = mouseRect.left;
517 pr->right = pr->left + width;
518 }
519 if ((pwnd->ExStyle & WS_EX_LAYOUTRTL) && pr->right > mouseRect.right)
520 {
521 pr->left = mouseRect.right - width;
522 pr->right = pr->left + width;
523 }
524 UserSetCursorPos(pt.x, pr->top + capcy / 2, 0, 0, FALSE);
525 snap = FALSE;
526 dx = dy = 0; /* Don't offset this move */
527 if (DragFullWindows)
528 {
529 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
531
532 /* Have to move and size it now because we don't want SWP_NOSIZE */
534 }
535 }
536 else if (!snap && syscommand == SC_MOVE && !iconic)
537 {
538 if ((snapTo = GetSnapActivationPoint(pwnd, pt)) != 0)
539 {
540 co_IntCalculateSnapPosition(pwnd, snapTo, &snapPreviewRect);
541 if (DragFullWindows)
542 {
543 /* TODO: Show preview of snap */
544 }
545 else
546 {
547 pFrameRect = &snapPreviewRect;
548 UserDrawMovingFrame(hdc, pFrameRect, thickframe);
549 continue;
550 }
551 }
552 }
553
554 /* regular window moving */
555 RECTL_vOffsetRect(&newRect, dx, dy);
556 }
557 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
558 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
559 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
560 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
561
562 capturePoint = pt;
563
564 //
565 // Save the new position to the unmodified rectangle. This allows explorer task bar
566 // sizing. Explorer will forces back the position unless a certain amount of sizing
567 // has occurred.
568 //
569 unmodRect = newRect;
570
571 /* Determine the hit location */
572 if (syscommand == SC_SIZE)
573 {
574 WPARAM wpSizingHit = 0;
575
576 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
577 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
578 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
579 }
580 else
581 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
582
583 if (!iconic)
584 {
585 if (!DragFullWindows)
586 UserDrawMovingFrame( hdc, &newRect, thickframe );
587 else
588 { // Moving the whole window now!
589 HRGN hrgnNew;
590 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
591
592 if (pwnd->hrgnClip != NULL)
593 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
594
596 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
598 NULL,
599 newRect.left,
600 newRect.top,
601 newRect.right - newRect.left,
602 newRect.bottom - newRect.top,
603 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
604
605 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
606 if (pwnd->hrgnClip != NULL)
607 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
608
609 if (hrgnNew)
610 {
611 if (hrgnOrig)
612 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
613 }
614 else
615 {
616 if (hrgnOrig)
617 {
618 GreDeleteObject(hrgnOrig);
619 hrgnOrig = 0;
620 }
621 }
622
623 // Update all the windows after the move or size, including this window.
624 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
625
626 if (hrgnOrig) GreDeleteObject(hrgnOrig);
627 if (hrgnNew) GreDeleteObject(hrgnNew);
628 }
629 }
630 sizingRect = newRect;
631 }
632 }
633 }
634
635 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
636
638
639 if ( iconic )
640 {
641 if ( moved ) /* restore cursors, show icon title later on */
642 {
644 OldCursor = UserSetCursor(OldCursor, FALSE);
645 }
646
647 /* It could be that the cursor was already changed while we were proceeding,
648 * so we must unreference whatever cursor was current at the time we restored the old one.
649 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
650 */
651 if (OldCursor) UserDereferenceObject(OldCursor);
652 }
653 else
654 {
655 UINT eraseFinalFrame = moved && !DragFullWindows;
656 if (eraseFinalFrame)
657 UserDrawMovingFrame(hdc, pFrameRect, thickframe); // Undo the XOR drawing
658 }
659
661
663 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
664
666 {
667 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
668 moved = FALSE;
669 }
670
671 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
672
674
679 /* window moved or resized */
680 if (moved)
681 {
682 BOOL forceSizing = !iconic && hittest == HTCAPTION && (!!orgSnap != !!snap);
683 UINT swp = (!forceSizing && hittest == HTCAPTION) ? SWP_NOSIZE : 0;
684
685 /* if the moving/resizing isn't canceled call SetWindowPos
686 * with the new position or the new size of the window
687 */
688 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
689 {
690 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
691 if (!DragFullWindows || iconic)
692 {
693 if (snap)
694 {
695 co_IntSnapWindow(pwnd, snap);
696 }
697 else
698 {
699 if (orgSnap && !snap)
700 {
701 IntSetStyle(pwnd, 0, WS_MAXIMIZE);
703 }
704 co_WinPosSetWindowPos(pwnd, HWND_TOP, sizingRect.left, sizingRect.top,
705 sizingRect.right - sizingRect.left,
706 sizingRect.bottom - sizingRect.top, swp);
707 }
708 }
709 }
710 else
711 {
712 /* restore previous size/position */
713 if (orgSnap)
714 {
715 co_IntSnapWindow(pwnd, orgSnap);
716 }
717 else if (DragFullWindows)
718 {
719 co_WinPosSetWindowPos(pwnd, HWND_TOP, origRect.left, origRect.top,
720 origRect.right - origRect.left,
721 origRect.bottom - origRect.top, swp);
722 }
723 }
724 }
725
726 if (IntIsWindow(UserHMGetHandle(pwnd)))
727 {
728 /* Single click brings up the system menu when iconized */
729 if (iconic && !moved && (Style & WS_SYSMENU))
730 {
732 }
733 }
734}
unsigned char BOOLEAN
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:1460
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1443
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1532
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3609
#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
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
unsigned int UINT
Definition: ndis.h:50
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4014
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3942
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3912
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:3904
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3989
#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
#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::@5309 InternalPos
RECT rcWindow
Definition: ntuser.h:716
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#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:895
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1100
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:1158
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:700
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1276
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:210
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:644
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2116
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:145
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:191
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
HICON HCURSOR
Definition: windef.h:299
#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:2614
#define WM_SYSCOMMAND
Definition: winuser.h:1760
#define DCX_CACHE
Definition: winuser.h:2133
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2495
#define VK_UP
Definition: winuser.h:2244
#define RDW_UPDATENOW
Definition: winuser.h:1231
#define WM_QUERYDRAGICON
Definition: winuser.h:1673
#define WMSZ_LEFT
Definition: winuser.h:2483
#define SC_SIZE
Definition: winuser.h:2603
#define VK_RETURN
Definition: winuser.h:2220
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1843
#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:2514
#define HTNOWHERE
Definition: winuser.h:2493
#define SC_MOVE
Definition: winuser.h:2604
#define WM_LBUTTONUP
Definition: winuser.h:1796
#define MSGF_SIZE
Definition: winuser.h:1188
#define VK_LEFT
Definition: winuser.h:2243
#define WM_SIZING
Definition: winuser.h:1826
#define VK_RIGHT
Definition: winuser.h:2245
#define HTTOP
Definition: winuser.h:2509
#define VK_DOWN
Definition: winuser.h:2246
#define MK_LBUTTON
Definition: winuser.h:2386
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1734
#define WM_MOVING
Definition: winuser.h:1828
#define HTSYSMENU
Definition: winuser.h:2496
#define HTLEFT
Definition: winuser.h:2506
#define VK_ESCAPE
Definition: winuser.h:2233
#define SM_CYCAPTION
Definition: winuser.h:974
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1842

Referenced by DefWndHandleSysCommand().

◆ DWP_GetEnabledPopup()

PWND FASTCALL DWP_GetEnabledPopup ( PWND  pWnd)

Definition at line 499 of file defwnd.c.

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

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

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

◆ GetControlColor()

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

Definition at line 154 of file misc.c.

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

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 815 of file misc.c.

819{
824
825 if (Thread && Process)
827
828 /* If nothing has been specified, use the current thread */
829 if (!Thread && !Process)
831
832 if (Thread)
833 {
834 /* Use a thread token */
835 ASSERT(!Process);
837 &CopyOnOpen,
840
841 /* If we don't have a thread token, use a process token */
842 if (!Token)
844 }
845 if (!Token && Process)
846 {
847 /* Use a process token */
849
850 /* If we don't have a token, fail */
851 if (!Token)
852 return STATUS_NO_TOKEN;
853 }
854 ASSERT(Token);
855
856 /* Query the LUID */
858
859 /* Get rid of the token and return */
861 return Status;
862}
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:25
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:2036
#define STATUS_NO_TOKEN
Definition: ntstatus.h:360
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ObDereferenceObject
Definition: obfuncs.h:203
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:156

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

◆ InitMetrics()

BOOL NTAPI InitMetrics ( VOID  )

Definition at line 41 of file metric.c.

42{
43 INT *piSysMet = gpsi->aiSysMet;
45
46 /* Note: used for the SM_CLEANBOOT metric */
47 DWORD dwValue = 0;
48 HKEY hKey = 0;
49
50 /* Clean boot */
51 piSysMet[SM_CLEANBOOT] = 0; // Fallback value of 0 (normal mode)
52 if(NT_SUCCESS(RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", &hKey)))
53 {
54 if(RegReadDWORD(hKey, L"OptionValue", &dwValue)) piSysMet[SM_CLEANBOOT] = (INT)dwValue;
56 }
57
58 /* FIXME: HACK, due to missing MDEV on first init */
59 if (!gpmdev)
60 {
61 Width = 640;
62 Height = 480;
63 }
64 else
65 {
68 }
69
70 /* Screen sizes */
71 piSysMet[SM_CXSCREEN] = Width;
72 piSysMet[SM_CYSCREEN] = Height;
73 piSysMet[SM_XVIRTUALSCREEN] = 0;
74 piSysMet[SM_YVIRTUALSCREEN] = 0;
75 piSysMet[SM_CXVIRTUALSCREEN] = Width;
76 piSysMet[SM_CYVIRTUALSCREEN] = Height;
77
78 /* NC area sizes */
79 piSysMet[SM_CYCAPTION] = gspv.ncm.iCaptionHeight + 1; // 19
80 piSysMet[SM_CYSMCAPTION] = gspv.ncm.iSmCaptionHeight + 1; // 15;
81 piSysMet[SM_CXSIZE] = gspv.ncm.iCaptionHeight; // 18;
82 piSysMet[SM_CYSIZE] = gspv.ncm.iCaptionHeight; // 18;
83 piSysMet[SM_CXSMSIZE] = gspv.ncm.iSmCaptionWidth; // 12; XP: piSysMet(SM_CYSMCAPTION) - 1
84 piSysMet[SM_CYSMSIZE] = gspv.ncm.iSmCaptionHeight; // 14;
85 piSysMet[SM_CXBORDER] = 1; // Seems to be hardcoded
86 piSysMet[SM_CYBORDER] = 1; // Seems to be hardcoded
87 piSysMet[SM_CXFOCUSBORDER] = 1;
88 piSysMet[SM_CYFOCUSBORDER] = 1;
89 piSysMet[SM_CXDLGFRAME] = 3;
90 piSysMet[SM_CYDLGFRAME] = 3;
91 piSysMet[SM_CXEDGE] = 2;
92 piSysMet[SM_CYEDGE] = 2;
93 piSysMet[SM_CXFRAME] = piSysMet[SM_CXDLGFRAME] + gspv.ncm.iBorderWidth; // 4
94 piSysMet[SM_CYFRAME] = piSysMet[SM_CYDLGFRAME] + gspv.ncm.iBorderWidth; // 4
95#if (_WIN32_WINNT >= 0x0600)
96 piSysMet[SM_CXPADDEDBORDER] = 0;
97#endif
98
99 /* Window sizes */
100 TRACE("ncm.iCaptionWidth=%d,GetSystemMetrics(SM_CYSIZE)=%d,GetSystemMetrics(SM_CXFRAME)=%d,avcwCaption=%d \n",
101 gspv.ncm.iCaptionWidth, piSysMet[SM_CYSIZE],piSysMet[SM_CXFRAME], gspv.tmCaptionFont.tmAveCharWidth);
102
103 piSysMet[SM_CXMIN] = 3 * max(gspv.ncm.iCaptionWidth, 8) // 112
104 + piSysMet[SM_CYSIZE] + 4
106 + 2 * piSysMet[SM_CXFRAME];
107 piSysMet[SM_CYMIN] = piSysMet[SM_CYCAPTION] + 2 * piSysMet[SM_CYFRAME]; // 27
108 piSysMet[SM_CXMAXIMIZED] = piSysMet[SM_CXSCREEN] + 2 * piSysMet[SM_CXFRAME];
109 piSysMet[SM_CYMAXIMIZED] = piSysMet[SM_CYSCREEN] - 20;
110 piSysMet[SM_CXFULLSCREEN] = piSysMet[SM_CXSCREEN];
111 piSysMet[SM_CYFULLSCREEN] = piSysMet[SM_CYMAXIMIZED] - piSysMet[SM_CYMIN];
112 piSysMet[SM_CYKANJIWINDOW] = 0;
113 piSysMet[SM_CXMINIMIZED] = gspv.mm.iWidth + 6;
114 piSysMet[SM_CYMINIMIZED] = piSysMet[SM_CYCAPTION] + 5;
115 piSysMet[SM_CXMINSPACING] = piSysMet[SM_CXMINIMIZED] + gspv.mm.iHorzGap;
116 piSysMet[SM_CYMINSPACING] = piSysMet[SM_CYMINIMIZED] + gspv.mm.iVertGap;
117 piSysMet[SM_CXMAXTRACK] = piSysMet[SM_CXVIRTUALSCREEN] + 4
118 + 2 * piSysMet[SM_CXFRAME];
119 piSysMet[SM_CYMAXTRACK] = piSysMet[SM_CYVIRTUALSCREEN] + 4
120 + 2 * piSysMet[SM_CYFRAME];
121
122 /* Icon */
123 piSysMet[SM_CXVSCROLL] = gspv.ncm.iScrollWidth; // 16;
124 piSysMet[SM_CYVTHUMB] = gspv.ncm.iScrollHeight; // 16;
125 piSysMet[SM_CYHSCROLL] = gspv.ncm.iScrollWidth; // 16;
126 piSysMet[SM_CXHTHUMB] = gspv.ncm.iScrollHeight; // 16;
127 piSysMet[SM_CYVSCROLL] = gspv.ncm.iScrollHeight; // 16
128 piSysMet[SM_CXHSCROLL] = gspv.ncm.iScrollHeight; // 16;
129 piSysMet[SM_CXICON] = 32;
130 piSysMet[SM_CYICON] = 32;
131 piSysMet[SM_CXSMICON] = 16;
132 piSysMet[SM_CYSMICON] = 16;
133 piSysMet[SM_CXICONSPACING] = gspv.im.iHorzSpacing; // 64;
134 piSysMet[SM_CYICONSPACING] = gspv.im.iVertSpacing; // 64;
135 piSysMet[SM_CXCURSOR] = 32;
136 piSysMet[SM_CYCURSOR] = 32;
137 piSysMet[SM_CXMINTRACK] = piSysMet[SM_CXMIN]; // 117
138 piSysMet[SM_CYMINTRACK] = piSysMet[SM_CYMIN]; // 27
139 piSysMet[SM_CXDRAG] = 4;
140 piSysMet[SM_CYDRAG] = 4;
141 piSysMet[SM_ARRANGE] = gspv.mm.iArrange; // 8;
142
143 /* Menu */
144 piSysMet[SM_CYMENU] = gspv.ncm.iMenuHeight + 1; // 19;
146 piSysMet[SM_CXMENUCHECK] = ((1 + gspv.tmMenuFont.tmHeight +
147 gspv.tmMenuFont.tmExternalLeading) & ~1) - 1; // 13;
148 piSysMet[SM_CYMENUCHECK] = piSysMet[SM_CXMENUCHECK];
149 piSysMet[SM_CXMENUSIZE] = gspv.ncm.iMenuWidth; // 18;
150 piSysMet[SM_CYMENUSIZE] = gspv.ncm.iMenuHeight; // 18;
151
152 /* Mouse */
153 piSysMet[SM_MOUSEPRESENT] = 1;
154 piSysMet[SM_MOUSEWHEELPRESENT] = 1;
155 piSysMet[SM_CMOUSEBUTTONS] = 2;
156 piSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap ? 1 : 0;
159#if (_WIN32_WINNT >= 0x0600)
160 piSysMet[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
161#endif
162
163 /* Version info */
164 piSysMet[SM_TABLETPC] = 0;
165 piSysMet[SM_MEDIACENTER] = 0;
166 piSysMet[SM_STARTER] = 0;
167 piSysMet[SM_SERVERR2] = 0;
168 piSysMet[SM_PENWINDOWS] = 0;
169
170 /* Other */
171 piSysMet[SM_DEBUG] = 0;
172 piSysMet[SM_NETWORK] = 3;
173 piSysMet[SM_SLOWMACHINE] = 0;
174 piSysMet[SM_SECURE] = 0;
176 piSysMet[SM_SHOWSOUNDS] = gspv.bShowSounds;
177 piSysMet[SM_MIDEASTENABLED] = 0;
178 piSysMet[SM_CMONITORS] = 1;
179 piSysMet[SM_SAMEDISPLAYFORMAT] = 1;
180 piSysMet[SM_IMMENABLED] = NLS_MB_CODE_PAGE_TAG;
181
182 /* Reserved */
183 piSysMet[SM_RESERVED1] = 0;
184 piSysMet[SM_RESERVED2] = 0;
185 piSysMet[SM_RESERVED3] = 0;
186 piSysMet[SM_RESERVED4] = 0;
187 piSysMet[64] = 0;
188 piSysMet[65] = 0;
189 piSysMet[66] = 0;
190#if (_WIN32_WINNT >= 0x0600)
191 piSysMet[90] = 0;
192#endif
193
194 if (UserIsDBCSEnabled())
195 gpsi->dwSRVIFlags |= SRVINFO_DBCSENABLED; /* DBCS Support */
196
198 gpsi->dwSRVIFlags |= SRVINFO_IMM32; /* IME Support */
199
201 gpsi->dwSRVIFlags |= SRVINFO_CTFIME_ENABLED; /* CTF IME support */
202
203 Setup = TRUE;
204
205 return TRUE;
206}
#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:2388
LONG tmExternalLeading
Definition: wingdi.h:2387
LONG tmHeight
Definition: wingdi.h:2383
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:31
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:519
#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:79
#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
#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:1635
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation)
Definition: winsta.c:1393
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
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:494
#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:1129
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:685
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:1254
NTSTATUS FASTCALL IntResolveDesktop(IN PEPROCESS Process, IN PUNICODE_STRING DesktopPath, IN BOOL bInherit, OUT HWINSTA *phWinSta, OUT HDESK *phDesktop)
Definition: desktop.c:568
BOOL IntSetThreadDesktop(IN HDESK hDesktop, IN BOOL FreeOnFailure)
Definition: desktop.c:3298
PTHREADINFO gptiForeground
Definition: focus.c:15
PKL W32kGetDefaultKeyLayout(VOID)
Definition: kbdlayout.c:512
NTSTATUS NTAPI ExitThreadCallback(PETHREAD Thread)
Definition: main.c:730
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:839
#define WINVER_WINNT4
Definition: window.h:57

Referenced by Win32kThreadCallback().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 618 of file misc.c.

619{
620 UINT bit;
621 if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
622 bit = 1 << LOWORD(Flag);
623 TRACE("CWS %x\n",bit);
624 switch(HIWORD(Flag))
625 {
626 case 0:
627 pWnd->state &= ~bit;
628 break;
629 case 1:
630 pWnd->state2 &= ~bit;
631 break;
632 case 2:
633 pWnd->ExStyle2 &= ~bit;
634 break;
635 }
636}
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define LOWORD(l)
Definition: pedump.c:82
Definition: xml2sdb.h:80
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
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
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:3191
HWND hwnd
Definition: winuser.h:3190
WPARAM wParam
Definition: winuser.h:3192
LPARAM lParam
Definition: winuser.h:3193
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
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
#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
struct @1710 Msg[]
LPARAM lParam
Definition: combotst.c:139
#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:1261
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 440 of file window.c.

441{
442 DWORD HelpId;
443
444 do
445 {
447 if (!HelpId) break;
448 pWnd = IntGetParent(pWnd);
449 }
450 while (pWnd && pWnd->fnid != FNID_DESKTOP);
451 return HelpId;
452}
#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:124

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

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 597 of file misc.c.

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

Referenced by NtUserCallHwndParam().

◆ IntTID2PTI()

PTHREADINFO FASTCALL IntTID2PTI ( HANDLE  id)

Definition at line 42 of file misc.c.

43{
46 PTHREADINFO pti;
48 if (!NT_SUCCESS(Status))
49 {
50 return NULL;
51 }
53 {
55 return NULL;
56 }
58 if (!pti)
59 {
61 return NULL;
62 }
63 // Validate and verify!
65 {
66 if (pti->TIF_flags & TIF_INCLEANUP) pti = NULL;
67 if (pti && !(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) pti = NULL;
68 if (PsGetThreadId(Thread) != id) pti = NULL;
69 }
71 {
72 pti = NULL;
73 }
76 return pti;
77}
#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:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71

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

◆ NC_DoNCPaint()

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

Definition at line 1097 of file nonclient.c.

1098{
1100 PWND Parent;
1101 RECT WindowRect, CurrentRect, TempRect;
1102 BOOL Active = FALSE;
1103
1104 if (!IntIsWindowVisible(pWnd) ||
1105 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1106 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1107 return 0;
1108
1109 Style = pWnd->style;
1110
1111 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1112
1113 Parent = IntGetParent(pWnd);
1114 ExStyle = pWnd->ExStyle;
1115
1116 if (Flags == -1) // NC paint mode.
1117 {
1118 if (ExStyle & WS_EX_MDICHILD)
1119 {
1121
1122 if (Active)
1124 }
1125 else
1126 {
1127 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1128 }
1129 Flags = DC_NC; // Redraw everything!
1130 }
1131 else
1132 Flags |= DC_NC;
1133
1134
1135 IntGetWindowRect(pWnd, &WindowRect);
1136
1137 CurrentRect.top = CurrentRect.left = 0;
1138 CurrentRect.right = WindowRect.right - WindowRect.left;
1139 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1140
1141 /* Draw outer edge */
1142 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1143 {
1144 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1145 }
1146 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1147 {
1148#if 0
1149 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1150#else
1152 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1153 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1154
1156 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1157 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1158
1159 RECTL_vInflateRect(&CurrentRect, -1, -1);
1160#endif
1161 }
1162
1163 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1164
1165 /* Draw caption */
1166 if ((Style & WS_CAPTION) == WS_CAPTION)
1167 {
1168 HPEN PreviousPen;
1169 BOOL Gradient = FALSE;
1170
1171 if (Flags & DC_REDRAWHUNGWND)
1172 {
1173 Flags &= ~DC_REDRAWHUNGWND;
1175 }
1176
1177 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1178 {
1179 Flags |= DC_GRADIENT;
1180 }
1181
1182 if (Active)
1183 {
1184 if (pWnd->state & WNDS_ACTIVEFRAME)
1185 Flags |= DC_ACTIVE;
1186 else
1187 {
1188 ERR("Wnd is active and not set active!\n");
1189 }
1190 }
1191
1192 TempRect = CurrentRect;
1193
1195 {
1196 Flags |= DC_SMALLCAP;
1197 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1198 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1199 }
1200 else
1201 {
1202 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1203 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1204 }
1205
1206 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1207
1208 /* Draw buttons */
1209 if (Style & WS_SYSMENU)
1210 {
1213 {
1216 }
1217 }
1218 if (!(Style & WS_MINIMIZE))
1219 {
1220 /* Line under caption */
1221 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1222
1226
1227 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1228
1229 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1230
1231 NtGdiSelectPen(hDC, PreviousPen);
1232 }
1233 }
1234
1235 if (!(Style & WS_MINIMIZE))
1236 {
1237 /* Draw menu bar */
1238 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1239 {
1240 if (!(Flags & DC_NOSENDMSG))
1241 {
1242 PMENU menu;
1243 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1244 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1245 {
1246 TempRect = CurrentRect;
1247 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1248 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1249 }
1250 }
1251 }
1252
1254 {
1255 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1256 }
1257
1258 /* Draw the scrollbars */
1259 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1261 {
1262 RECT ParentClientRect;
1263
1264 TempRect = CurrentRect;
1265
1267 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1268 else
1269 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1270
1271 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1272
1274
1275 if (Parent)
1276 {
1277 IntGetClientRect(Parent, &ParentClientRect);
1278
1279 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1280 {
1282 }
1283 }
1284
1287 }
1288 else
1289 {
1291 {
1293 }
1295 {
1297 }
1298 }
1299 }
1300 return 0; // For WM_NCPAINT message, return 0.
1301}
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:97
#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
__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:990
__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)
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
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1072
RECT rcClient
Definition: ntuser.h:717
UINT_PTR IDMenu
Definition: ntuser.h:731
ULONG cyMenu
Definition: ntuser.h:423
#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:2192
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#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:790
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:808
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:909
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:930
#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:1840
#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:561

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 909 of file nonclient.c.

910{
911 /* Firstly the "thick" frame */
912 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
913 {
914 LONG Width =
917
918 LONG Height =
921
923
924 /* Draw frame */
925 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
926 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
927 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
928 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
929
930 RECTL_vInflateRect(CurrentRect, -Width, -Height);
931 }
932
933 /* Now the other bit of the frame */
935 {
938
944
945 /* Draw frame */
946 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
947 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
948 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
949 NtGdiPatBlt(hDC, CurrentRect->right, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
950
951 RECTL_vInflateRect(CurrentRect, -Width, -Height);
952 }
953}
#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}
#define WS_ICONIC
Definition: pedump.c:641
& rect
Definition: startmenu.cpp:1413
#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 1438 of file nonclient.c.

1439{
1440 INT Flags;
1441 /* Lotus Notes draws menu descriptions in the caption of its main
1442 * window. When it wants to restore original "system" view, it just
1443 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1444 * attempt to minimize redrawings lead to a not restored caption.
1445 */
1446 if (wParam & DC_ACTIVE)
1447 {
1450 }
1451 else
1452 {
1453 Wnd->state &= ~WNDS_ACTIVEFRAME;
1455 }
1456
1457 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1458 return TRUE;
1459
1460 /* This isn't documented but is reproducible in at least XP SP2 and
1461 * Outlook 2007 depends on it
1462 */
1463 // MSDN:
1464 // If this parameter is set to -1, DefWindowProc does not repaint the
1465 // nonclient area to reflect the state change.
1466 if ( lParam != -1 &&
1467 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1468 {
1469 HDC hDC;
1470 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1471
1473 {
1474 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1475 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1476 {
1477 GreDeleteObject(hRgnTemp);
1478 hRgnTemp = NULL;
1479 }
1480 }
1481
1482 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1483 {
1484 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1485 UserReleaseDC(Wnd, hDC, FALSE);
1486 }
1487 else
1488 GreDeleteObject(hRgnTemp);
1489 }
1490
1491 return TRUE;
1492}
#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:33
__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:1097
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1420
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2132
#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 1304 of file nonclient.c.

1305{
1306 LRESULT Result = 0;
1307 SIZE WindowBorders;
1308 RECT OrigRect;
1309 LONG Style = Wnd->style;
1310 LONG exStyle = Wnd->ExStyle;
1311
1312 if (Rect == NULL)
1313 {
1314 return Result;
1315 }
1316 OrigRect = *Rect;
1317
1318 Wnd->state &= ~WNDS_HASCAPTION;
1319
1320 if (wparam)
1321 {
1322 if (Wnd->pcls->style & CS_VREDRAW)
1323 {
1325 }
1326 if (Wnd->pcls->style & CS_HREDRAW)
1327 {
1329 }
1331 }
1332
1333 if (!(Wnd->style & WS_MINIMIZE))
1334 {
1335 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1336 {
1337 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1338 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1339 }
1340 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1341 {
1342 RECTL_vInflateRect(Rect, -1, -1);
1343 }
1344
1345 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1346 {
1347 Wnd->state |= WNDS_HASCAPTION;
1348
1349 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1351 else
1353 }
1354
1355 if (HAS_MENU(Wnd, Style))
1356 {
1358
1359 Wnd->state |= WNDS_HASMENU;
1360
1361 if (hDC)
1362 {
1363 RECT CliRect = *Rect;
1364 CliRect.bottom -= OrigRect.top;
1365 CliRect.right -= OrigRect.left;
1366 CliRect.left -= OrigRect.left;
1367 CliRect.top -= OrigRect.top;
1368 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1369 UserReleaseDC(Wnd, hDC, FALSE);
1370 }
1371 }
1372
1373 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1374 {
1376 }
1377
1378 if (Style & WS_VSCROLL)
1379 {
1380 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1381 {
1382 Wnd->state |= WNDS_HASVERTICALSCROOLLBAR;
1383
1384 /* rectangle is in screen coords when wparam is false */
1385 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1386
1387 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1389 else
1391 }
1392 }
1393
1394 if (Style & WS_HSCROLL)
1395 {
1396 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1397 {
1398 Wnd->state |= WNDS_HASHORIZONTALSCROLLBAR;
1399
1401 }
1402 }
1403
1404 if (Rect->top > Rect->bottom)
1405 Rect->bottom = Rect->top;
1406
1407 if (Rect->left > Rect->right)
1408 Rect->right = Rect->left;
1409 }
1410 else
1411 {
1412 Rect->right = Rect->left;
1413 Rect->bottom = Rect->top;
1414 }
1415
1416 return Result;
1417}
@ wparam
Definition: SystemMenu.c:30
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:607
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:606
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
LONG_PTR LRESULT
Definition: windef.h:209
#define CS_VREDRAW
Definition: winuser.h:666
#define WVR_VALIDRECTS
Definition: winuser.h:2541
#define CS_HREDRAW
Definition: winuser.h:661
#define WVR_VREDRAW
Definition: winuser.h:2539
#define WVR_HREDRAW
Definition: winuser.h:2538
_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:420

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1667 of file nonclient.c.

1668{
1669 ULONG Style;
1670
1671 Style = pWnd->style;
1672 switch(wParam)
1673 {
1674 case HTCAPTION:
1675 {
1676 /* Maximize/Restore the window */
1678 {
1680 }
1681 break;
1682 }
1683 case HTSYSMENU:
1684 {
1685 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1687
1688 /* If the close item of the sysmenu is disabled or not present do nothing */
1689 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1690 break;
1691
1693 break;
1694 }
1695 case HTTOP:
1696 case HTBOTTOM:
1697 {
1698 RECT sizingRect = pWnd->rcWindow, mouseRect;
1699
1700 if (pWnd->ExStyle & WS_EX_MDICHILD)
1701 break;
1702
1703 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1704
1706 NULL,
1707 sizingRect.left,
1708 mouseRect.top,
1709 sizingRect.right - sizingRect.left,
1710 mouseRect.bottom - mouseRect.top,
1711 0);
1712 break;
1713 }
1714 default:
1715 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1716 }
1717 return(0);
1718}
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:1575
#define MF_BYCOMMAND
Definition: winuser.h:202
#define HTBOTTOM
Definition: winuser.h:2512
#define SC_CLOSE
Definition: winuser.h:2611
#define SC_RESTORE
Definition: winuser.h:2617
#define SC_MAXIMIZE
Definition: winuser.h:2607
#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 1575 of file nonclient.c.

1576{
1577 switch (wParam)
1578 {
1579 case HTCAPTION:
1580 {
1581 PWND TopWnd = pWnd, parent;
1582 while(1)
1583 {
1584 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1585 break;
1586 parent = UserGetAncestor( TopWnd, GA_PARENT );
1587 if (!parent || UserIsDesktopWindow(parent)) break;
1588 TopWnd = parent;
1589 }
1590
1591 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1593 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1595 {
1597 }
1598 break;
1599 }
1600 case HTSYSMENU:
1601 {
1602 LONG style = pWnd->style;
1603 if (style & WS_SYSMENU)
1604 {
1605 if(!(style & WS_MINIMIZE) )
1606 {
1607 RECT rect;
1608 HDC hDC = UserGetWindowDC(pWnd);
1609 NC_GetInsideRect(pWnd, &rect);
1611 UserReleaseDC( pWnd, hDC, FALSE );
1612 }
1614 }
1615 break;
1616 }
1617 case HTMENU:
1618 {
1620 break;
1621 }
1622 case HTHSCROLL:
1623 {
1625 break;
1626 }
1627 case HTVSCROLL:
1628 {
1630 break;
1631 }
1632 case HTMINBUTTON:
1633 case HTMAXBUTTON:
1634 case HTCLOSE:
1635 {
1636 NC_DoButton(pWnd, wParam, lParam);
1637 break;
1638 }
1639 case HTLEFT:
1640 case HTRIGHT:
1641 case HTTOP:
1642 case HTBOTTOM:
1643 case HTTOPLEFT:
1644 case HTTOPRIGHT:
1645 case HTBOTTOMLEFT:
1646 case HTBOTTOMRIGHT:
1647 {
1648 /* Old comment:
1649 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1650 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1651 */
1652 /* But that is not what WinNT does. Instead it sends this. This
1653 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1654 * SC_MOUSEMENU into wParam.
1655 */
1657 break;
1658 }
1659 case HTBORDER:
1660 break;
1661 }
1662 return(0);
1663}
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1563
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1432
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:767
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1495
#define SC_HSCROLL
Definition: winuser.h:2613
#define HTTOPRIGHT
Definition: winuser.h:2511
#define HTCLOSE
Definition: winuser.h:2518
#define HTTOPLEFT
Definition: winuser.h:2510
#define HTBORDER
Definition: winuser.h:2516
#define SC_VSCROLL
Definition: winuser.h:2612
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define HTVSCROLL
Definition: winuser.h:2501
#define HTHSCROLL
Definition: winuser.h:2500
#define GA_PARENT
Definition: winuser.h:2864
#define HTMAXBUTTON
Definition: winuser.h:2503
#define HTMENU
Definition: winuser.h:2499
#define HTRIGHT
Definition: winuser.h:2508
#define HTBOTTOMLEFT
Definition: winuser.h:2513
#define HTMINBUTTON
Definition: winuser.h:2502

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1725 of file nonclient.c.

1726{
1727 MSG msg;
1728 INT hittest = wParam;
1729
1730 switch (hittest)
1731 {
1732 case HTCAPTION:
1733 case HTSYSMENU:
1734 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1735
1737 for (;;)
1738 {
1740 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1741 if (msg.message == WM_RBUTTONUP)
1742 {
1743 hittest = GetNCHitEx( pwnd, msg.pt );
1744 break;
1745 }
1746 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1747 }
1749
1750 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1751 {
1752 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1754 }
1755 break;
1756 }
1757 return 0;
1758}
#define WM_CONTEXTMENU
Definition: richedit.h:64
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1985
#define WM_MOUSEFIRST
Definition: winuser.h:1793
#define WM_MOUSELAST
Definition: winuser.h:1820
#define WM_RBUTTONUP
Definition: winuser.h:1799
#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 1635 of file ime.c.

1636{
1637 PIMC pIMC;
1639 PDESKTOP pdesk = pti->rpdesk;
1640
1641 if (!IS_IMM_MODE() || (pti->TIF_flags & TIF_DISABLEIME)) // Disabled?
1642 {
1643 ERR("IME is disabled\n");
1644 return NULL;
1645 }
1646
1647 if (!pdesk) // No desktop?
1648 return NULL;
1649
1650 // pti->spDefaultImc should be already set if non-first time.
1651 if (dwClientImcData && !pti->spDefaultImc)
1652 return NULL;
1653
1654 // Create an input context user object.
1655 pIMC = UserCreateObject(gHandleTable, pdesk, pti, NULL, TYPE_INPUTCONTEXT, sizeof(IMC));
1656 if (!pIMC)
1657 return NULL;
1658
1659 // Release the extra reference (UserCreateObject added 2 references).
1661 ASSERT(pIMC->head.cLockObj == 1);
1662
1663 if (dwClientImcData) // Non-first time.
1664 {
1665 // Insert pIMC to the second position (non-default) of the list.
1666 pIMC->pImcNext = pti->spDefaultImc->pImcNext;
1667 pti->spDefaultImc->pImcNext = pIMC;
1668 }
1669 else // First time. It's the default IMC.
1670 {
1671 // Add the first one (default) to the list.
1672 UserAssignmentLock((PVOID*)&pti->spDefaultImc, pIMC);
1673 pIMC->pImcNext = NULL;
1674 ASSERT(pIMC->head.cLockObj == 2); // UserAssignmentUnlock'ed at ExitThreadCallback
1675 }
1676
1677 pIMC->dwClientImcData = dwClientImcData; // Set it.
1678 return pIMC;
1679}
#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}
ULONG Handle
Definition: gdb_input.c:15
struct _PROCESSINFO * GetW32ProcessInfo(VOID)
Definition: misc.c:801
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:807
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
NTSTATUS FASTCALL IntValidateWindowStationHandle(HWINSTA WindowStation, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PWINSTATION_OBJECT *Object, POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
Definition: winsta.c:232
PVOID Win32WindowStation
Definition: pstypes.h:1309
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
PROCDESKHEAD head
Definition: ntuser.h:417
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
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 1560 of file ime.c.

1561{
1562 PIMC pIMC = Object;
1563 if (!pIMC)
1564 return TRUE;
1565
1568 return TRUE;
1569}
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:621
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717

◆ UserDestroyMenu()

BOOL FASTCALL UserDestroyMenu ( HMENU  hMenu)

Definition at line 5822 of file menu.c.

5823{
5824 PMENU Menu;
5826
5827 if(!(Menu = UserGetMenuObject(hMenu)))
5828 {
5829 return FALSE;
5830 }
5831
5832 if (Menu->head.rpdesk != pti->rpdesk)
5833 {
5835 return FALSE;
5836 }
5837 return IntDestroyMenuObject(Menu, FALSE);
5838}
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 955 of file nonclient.c.

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

768{
769 PCURICON_OBJECT WindowIcon;
770 BOOL Ret = FALSE;
771
772 if ((WindowIcon = NC_IconForWindow(pWnd)))
773 {
774 UserReferenceObject(WindowIcon);
775
776 Ret = UserDrawIconEx(hDC,
777 Rect->left + 2,
778 Rect->top + 2,
779 WindowIcon,
782 0, NULL, DI_NORMAL);
783
784 UserDereferenceObject(WindowIcon);
785 }
786 return Ret;
787}
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
#define DI_NORMAL
Definition: wingdi.h:72

Referenced by MENU_DrawMenuItem(), and NC_HandleNCLButtonDown().

◆ UserFreeInputContext()

VOID UserFreeInputContext ( _In_opt_ PVOID  Object)

Definition at line 1532 of file ime.c.

1533{
1534 PTHRDESKHEAD ObjHead = Object;
1535 PDESKTOP pDesk = ObjHead->rpdesk;
1536 PIMC pNode, pIMC = Object;
1537 PTHREADINFO pti;
1538
1539 if (!pIMC)
1540 return;
1541
1542 // Remove pIMC from the list except spDefaultImc
1543 pti = pIMC->head.pti;
1544 for (pNode = pti->spDefaultImc; pNode; pNode = pNode->pImcNext)
1545 {
1546 if (pNode->pImcNext == pIMC)
1547 {
1548 pNode->pImcNext = pIMC->pImcNext;
1549 break;
1550 }
1551 }
1552
1553 DesktopHeapFree(pDesk, Object);
1554
1555 pti->ppi->UserHandleCount--;
1557}
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:172

◆ UserGetActiveWindow()

HWND FASTCALL UserGetActiveWindow ( VOID  )

Definition at line 1432 of file focus.c.

1433{
1434 PTHREADINFO pti;
1435 PUSER_MESSAGE_QUEUE ThreadQueue;
1436
1438 ThreadQueue = pti->MessageQueue;
1439 return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
1440}

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

◆ UserGetAncestor()

◆ UserGetDCEx()

◆ UserGetForegroundWindow()

HWND FASTCALL UserGetForegroundWindow ( VOID  )

Definition at line 1424 of file focus.c.

1425{
1426 PUSER_MESSAGE_QUEUE ForegroundQueue;
1427
1428 ForegroundQueue = IntGetFocusMessageQueue();
1429 return( ForegroundQueue ? (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : 0) : 0);
1430}

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 1684 of file keyboard.c.

1686{
1687 switch (dwTypeFlag)
1688 {
1689 case 0: /* Keyboard type */
1691 case 1: /* Keyboard Subtype */
1693 case 2: /* Number of F-keys */
1695 default:
1696 ERR("Unknown type!\n");
1697 return 0; /* Note: we don't have to set last error here */
1698 }
1699}
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:103
#define IS_KEY_LOCKED(ks, vk)
Definition: input.h:104

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

◆ UserGetMenuObject()

◆ UserGetProcessWindowStation()

HWINSTA FASTCALL UserGetProcessWindowStation ( VOID  )

Definition at line 1364 of file winsta.c.

1365{
1367
1368 return ppi->hwinsta;
1369}
HWINSTA hwinsta
Definition: win32.h:268

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

◆ UserGetShellWindow()

HWND FASTCALL UserGetShellWindow ( VOID  )

Definition at line 3697 of file window.c.

3698{
3699 PWINSTATION_OBJECT WinStaObject;
3700 HWND Ret;
3701
3703 UserMode,
3704 0,
3705 &WinStaObject,
3706 0);
3707
3708 if (!NT_SUCCESS(Status))
3709 {
3711 return NULL;
3712 }
3713
3714 Ret = (HWND)WinStaObject->ShellWindow;
3715
3716 ObDereferenceObject(WinStaObject);
3717 return Ret;
3718}
HANDLE ShellWindow
Definition: winsta.h:43

Referenced by co_WinPosSetWindowPos(), and SpiSetWallpaper().

◆ UserGetSystemMetrics()

LONG NTAPI UserGetSystemMetrics ( ULONG  Index)

Definition at line 210 of file metric.c.

211{
212 ASSERT(gpsi);
213 ASSERT(Setup);
214 TRACE("UserGetSystemMetrics(%lu)\n", Index);
215
216 if (Index == SM_DBCSENABLED)
218
219 if (Index == SM_IMMENABLED)
220 return !!(gpsi->dwSRVIFlags & SRVINFO_IMM32);
221
222 /* Get metrics from array */
223 if (Index < SM_CMETRICS)
224 {
225 return gpsi->aiSysMet[Index];
226 }
227
228 /* Handle special values */
229 switch (Index)
230 {
231 case SM_REMOTESESSION:
232 return 0; // FIXME
233
234 case SM_SHUTTINGDOWN:
235 return 0; // FIXME
236
237 case SM_REMOTECONTROL:
238 return 0; // FIXME
239 }
240
241 ERR("UserGetSystemMetrics() called with invalid index %lu\n", Index);
242 return 0;
243}
_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 124 of file window.c.

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

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 31 of file metric.c.

32{
33 if (RegGetSectionDWORD(L"IMM", L"DontLoadCTFIME", FALSE))
34 return FALSE;
35
36 return UserIsIMMEnabled();
37}
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 /* "LoadIMM" means Cicero despite its name */
28 return !!RegGetSectionDWORD(L"IMM", L"LoadIMM", FALSE);
29}

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

◆ UserPaintCaption()

BOOL UserPaintCaption ( PWND  pWnd,
INT  Flags 
)

Definition at line 398 of file defwnd.c.

399{
400 BOOL Ret = FALSE;
401
402 if ( (pWnd->style & WS_VISIBLE) && ((pWnd->style & WS_CAPTION) == WS_CAPTION) )
403 {
404 if (pWnd->state & WNDS_HASCAPTION && pWnd->head.pti->MessageQueue == gpqForeground)
405 Flags |= DC_ACTIVE;
406 /*
407 * When themes are not enabled we can go on and paint the non client area.
408 * However if we do that with themes enabled we will draw a classic frame.
409 * This is solved by sending a themes specific message to notify the themes
410 * engine that the caption needs to be redrawn.
411 */
413 {
414 /*
415 * This will cause uxtheme to either paint the themed caption or call
416 * RealUserDrawCaption in order to draw the classic caption when themes
417 * are disabled but the themes service is enabled.
418 */
419 TRACE("UDCB Flags %08x\n", Flags);
421 }
422 else
423 {
425 UserDrawCaptionBar(pWnd, hDC, Flags | DC_FRAME); // DCFRAME added as fix for CORE-10855.
426 UserReleaseDC(pWnd, hDC, FALSE);
427 }
428 Ret = TRUE;
429 }
430 // Support window tray
431 return Ret;
432}
#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:955

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;
1421 ULONG i;
1422
1423 if (!is_message_broadcastable(Msg)) return TRUE;
1424
1427
1428 if (List != NULL)
1429 {
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
Implementation of the Explorer desktop window.
Definition: desktop.h:52
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:276
#define ERROR_MESSAGE_SYNC_ONLY
Definition: winerror.h:681
#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 IntSetMenuItemInfo(), MENU_GetSystemMenu(), MENU_InitSysMenuPopup(), and NtUserSetMenuDefaultItem().

◆ UserSystemParametersInfo()

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

Definition at line 2116 of file sysparams.c.

2121{
2122 ULONG_PTR ulResult;
2124
2125 ASSERT(ppi);
2126
2127 if (!gbSpiInitialized)
2128 {
2130 //ASSERT(FALSE);
2131 return FALSE;
2132 }
2133
2134 /* Get a pointer to the current Windowstation */
2135 if (!ppi->prpwinsta)
2136 {
2137 ERR("UserSystemParametersInfo called without active window station.\n");
2138 //ASSERT(FALSE);
2139 //return FALSE;
2140 }
2141
2142 if ((fWinIni & SPIF_PROTECT) && !SpiGetSetProbeBuffer(uiAction, uiParam, pvParam))
2143 {
2145 return FALSE;
2146 }
2147
2148 /* Do the actual operation */
2149 ulResult = SpiGetSet(uiAction, uiParam, pvParam, fWinIni);
2150
2151 /* Did we change something? */
2152 if (ulResult > 1)
2153 {
2155
2156 /* Update system metrics */
2157 InitMetrics();
2158
2159 /* Send notification to toplevel windows, if requested */
2160 if (fWinIni & SPIF_SENDCHANGE)
2161 {
2162 /* Send WM_SETTINGCHANGE to all toplevel windows */
2165 (WPARAM)uiAction,
2166 (LPARAM)ulResult,
2168 100,
2169 &ulResult);
2170 }
2171 ulResult = 1;
2172 }
2173
2174 return ulResult;
2175}
#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:41
static VOID SpiFixupValues(VOID)
Definition: sysparams.c:202
BOOL gbSpiInitialized
Definition: sysparams.c:18
static UINT_PTR SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl)
Definition: sysparams.c:816
static BOOL SpiGetSetProbeBuffer(UINT uiAction, UINT uiParam, PVOID pvParam)
Definition: sysparams.c:1845
#define ERROR_NOACCESS
Definition: winerror.h:578
#define SPIF_SENDCHANGE
Definition: winuser.h:1591
#define WM_SETTINGCHANGE
Definition: winuser.h:1648
#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