ReactOS 0.4.15-dev-6073-g59e7458
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 UserIsCiceroEnabled (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)
 
BOOL FASTCALL SetLayeredStatus (PWND pWnd, BYTE set)
 
BOOL FASTCALL GetLayeredStatus (PWND pWnd)
 
PIMC FASTCALL UserCreateInputContext (ULONG_PTR dwClientImcData)
 
VOID UserFreeInputContext (PVOID Object)
 
BOOLEAN UserDestroyInputContext (PVOID Object)
 
PVOID AllocInputContextObject (PDESKTOP pDesk, PTHREADINFO pti, SIZE_T Size, 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
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
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

Referenced by UserpFormatMessages().

◆ AllocInputContextObject()

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

Definition at line 1428 of file ime.c.

1432{
1433 PTHRDESKHEAD ObjHead;
1434
1435 ASSERT(Size > sizeof(*ObjHead));
1436 ASSERT(pti != NULL);
1437
1438 if (!pDesk)
1439 pDesk = pti->rpdesk;
1440
1441 ObjHead = DesktopHeapAlloc(pDesk, Size);
1442 if (!ObjHead)
1443 return NULL;
1444
1445 RtlZeroMemory(ObjHead, Size);
1446
1447 ObjHead->pSelf = ObjHead;
1448 ObjHead->rpdesk = pDesk;
1449 ObjHead->pti = pti;
1451 *HandleOwner = pti;
1452 pti->ppi->UserHandleCount++;
1453
1454 return ObjHead;
1455}
#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
PPROCESSINFO ppi
Definition: win32.h:88
struct _DESKTOP * rpdesk
Definition: win32.h:92
#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:166
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 2838 of file window.c.

2839{
2840 HWND hWnd;
2841 PWND pwndTemp;
2842 PTHREADINFO ti;
2843 MSG msg;
2844 PWND Window = Object;
2845
2846 ASSERT_REFS_CO(Window); // FIXME: Temp HACK?
2847
2848 /* NtUserDestroyWindow does check if the window has already been destroyed
2849 but co_UserDestroyWindow can be called from more paths which means
2850 that it can also be called for a window that has already been destroyed. */
2852 {
2853 TRACE("Tried to destroy a window twice\n");
2854 return TRUE;
2855 }
2856
2857 hWnd = Window->head.h;
2859
2860 TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
2861
2862 /* Check for owner thread */
2863 if (Window->head.pti != ti)
2864 {
2865 /* Check if we are destroying the desktop window */
2866 if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
2867 {
2869 return FALSE;
2870 }
2871 }
2872
2873 /* If window was created successfully and it is hooked */
2874 if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
2875 {
2877 {
2878 ERR("Destroy Window WH_CBT Call Hook return!\n");
2879 return FALSE;
2880 }
2881 }
2882
2883 if (Window->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME])
2884 {
2885 if ((Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2886 {
2887 if (Window->spwndOwner)
2888 {
2889 //ERR("DestroyWindow Owner out.\n");
2890 UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE);
2891 }
2892 }
2893 }
2894
2895 /* Inform the parent */
2896 if (Window->style & WS_CHILD)
2897 {
2899 }
2900
2901 if (!Window->spwndOwner && !IntGetParent(Window))
2902 {
2904 }
2905
2906 /* Hide the window */
2907 if (Window->style & WS_VISIBLE)
2908 {
2909 if (Window->style & WS_CHILD)
2910 {
2911 /* Only child windows receive WM_SHOWWINDOW in DestroyWindow() */
2913 }
2914 else
2915 {
2917 }
2918 }
2919
2920 /* Adjust last active */
2921 if ((pwndTemp = Window->spwndOwner))
2922 {
2923 while (pwndTemp->spwndOwner)
2924 pwndTemp = pwndTemp->spwndOwner;
2925
2926 if (pwndTemp->spwndLastActive == Window)
2927 pwndTemp->spwndLastActive = Window->spwndOwner;
2928 }
2929
2930 if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
2931 {
2932 if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
2933 {
2935 {
2936 //ERR("DestroyWindow Parent out.\n");
2937 UserAttachThreadInput(Window->head.pti, Window->spwndParent->head.pti, FALSE);
2938 }
2939 }
2940 }
2941
2942 if (Window->head.pti->MessageQueue->spwndActive == Window)
2943 Window->head.pti->MessageQueue->spwndActive = NULL;
2944 if (Window->head.pti->MessageQueue->spwndFocus == Window)
2945 Window->head.pti->MessageQueue->spwndFocus = NULL;
2946 if (Window->head.pti->MessageQueue->spwndActivePrev == Window)
2947 Window->head.pti->MessageQueue->spwndActivePrev = NULL;
2948 if (Window->head.pti->MessageQueue->spwndCapture == Window)
2949 Window->head.pti->MessageQueue->spwndCapture = NULL;
2950
2951 /*
2952 * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL
2953 */
2954
2955 if (ti->pDeskInfo != NULL)
2956 {
2957 if (ti->pDeskInfo->hShellWindow == hWnd)
2958 {
2959 ERR("Destroying the ShellWindow!\n");
2960 ti->pDeskInfo->hShellWindow = NULL;
2961 }
2962 }
2963
2965
2967 {
2968 return TRUE;
2969 }
2970
2971 /* Recursively destroy owned windows */
2972 if (!(Window->style & WS_CHILD))
2973 {
2975 }
2976
2977 /* Generate mouse move message for the next window */
2978 msg.message = WM_MOUSEMOVE;
2979 msg.wParam = UserGetMouseButtonsState();
2980 msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
2981 msg.pt = gpsi->ptCursor;
2983
2984 IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2985
2986 /* Send destroy messages */
2988
2989 /* Destroy the default IME window if necessary */
2990 if (IS_IMM_MODE() && !(ti->TIF_flags & TIF_INCLEANUP) &&
2991 ti->spwndDefaultIme && (ti->spwndDefaultIme != Window) &&
2992 !(Window->state & WNDS_DESTROYED) && !IS_WND_IMELIKE(Window))
2993 {
2994 if (IS_WND_CHILD(Window))
2995 {
2998 }
2999 else
3000 {
3003 }
3004 }
3005
3007 {
3008 return TRUE;
3009 }
3010
3011 /* Destroy the window storage */
3013
3014 return TRUE;
3015}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: debug.h:110
#define TRUE
Definition: types.h:120
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
PSERVERINFO gpsi
Definition: imm.c:18
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
#define ICLS_IME
Definition: ntuser.h:922
#define TIF_INCLEANUP
Definition: ntuser.h:262
#define WNDS_DESTROYED
Definition: ntuser.h:631
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:665
#define IS_IMM_MODE()
Definition: ntuser.h:1232
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
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1787
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2567
#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:689
struct _WND * spwndOwner
Definition: ntuser.h:710
struct _WND * spwndLastActive
Definition: ntuser.h:734
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1055
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:1692
#define DF_DESTROYED
Definition: desktop.h:50
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
BOOL FASTCALL IntImeCanDestroyDefIME(PWND pImeWnd, PWND pwndTarget)
Definition: ime.c:2065
BOOL FASTCALL IntImeCanDestroyDefIMEforChild(PWND pImeWnd, PWND pwndTarget)
Definition: ime.c:2020
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:204
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:574
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:359
static void IntSendDestroyMsg(HWND hWnd)
Definition: window.c:461
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2838
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:176
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1678
VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
Definition: window.c:2802
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
#define IS_WND_CHILD(pWnd)
Definition: window.h:108
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define WOC_DELETE
Definition: winddi.h:1269
UINT_PTR WPARAM
Definition: windef.h:207
#define SW_HIDE
Definition: winuser.h:762
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1246
#define SWP_NOMOVE
Definition: winuser.h:1234
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define SWP_NOSIZE
Definition: winuser.h:1235
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define WH_CBT
Definition: winuser.h:35
#define SWP_HIDEWINDOW
Definition: winuser.h:1231
#define WM_DESTROY
Definition: winuser.h:1599
#define SWP_NOZORDER
Definition: winuser.h:1237

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 1314 of file focus.c.

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

4382{
4384 BOOL Ret = FALSE;
4385
4386 RtlInitUnicodeString(&UnicodeString, WindowText);
4387
4388 if (UnicodeString.Length != 0)
4389 {
4390 if (Wnd->strName.MaximumLength > 0 &&
4391 UnicodeString.Length <= Wnd->strName.MaximumLength - sizeof(UNICODE_NULL))
4392 {
4393 ASSERT(Wnd->strName.Buffer != NULL);
4394
4395 Wnd->strName.Length = UnicodeString.Length;
4396 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4398 UnicodeString.Buffer,
4399 UnicodeString.Length);
4400 }
4401 else
4402 {
4403 PWCHAR buf;
4404 Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4405 buf = Wnd->strName.Buffer;
4406 Wnd->strName.Buffer = NULL;
4407 if (buf != NULL)
4408 {
4410 }
4411
4413 UnicodeString.Length + sizeof(UNICODE_NULL));
4414 if (Wnd->strName.Buffer != NULL)
4415 {
4416 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4418 UnicodeString.Buffer,
4419 UnicodeString.Length);
4420 Wnd->strName.MaximumLength = UnicodeString.Length + sizeof(UNICODE_NULL);
4421 Wnd->strName.Length = UnicodeString.Length;
4422 }
4423 else
4424 {
4426 goto Exit;
4427 }
4428 }
4429 }
4430 else
4431 {
4432 Wnd->strName.Length = 0;
4433 if (Wnd->strName.Buffer != NULL)
4434 Wnd->strName.Buffer[0] = L'\0';
4435 }
4436
4437 // FIXME: HAX! Windows does not do this in here!
4438 // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4439 // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4440 /* Send shell notifications */
4441 if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4442 {
4443 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) UserHMGetHandle(Wnd), FALSE); // FIXME Flashing?
4444 }
4445
4446 Ret = TRUE;
4447Exit:
4449 return Ret;
4450}
#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:690
LARGE_UNICODE_STRING strName
Definition: ntuser.h:731
#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:950
#define COLOR_WINDOW
Definition: winuser.h:912
#define COLOR_SCROLLBAR
Definition: winuser.h:906
#define COLOR_WINDOWTEXT
Definition: winuser.h:915
#define CTLCOLOR_LISTBOX
Definition: winuser.h:947
#define CTLCOLOR_EDIT
Definition: winuser.h:946
#define COLOR_3DHILIGHT
Definition: winuser.h:931
#define COLOR_3DFACE
Definition: winuser.h:923

◆ DefWndDoSizeMove()

VOID FASTCALL DefWndDoSizeMove ( PWND  pwnd,
WORD  wParam 
)

Definition at line 239 of file nonclient.c.

240{
241 MSG msg;
242 RECT sizingRect, mouseRect, origRect, unmodRect;
243 HDC hdc;
244 LONG hittest = (LONG)(wParam & 0x0f);
245 PCURICON_OBJECT DragCursor = NULL, OldCursor = NULL;
246 POINT minTrack, maxTrack;
247 POINT capturePoint, pt;
249 BOOL thickframe;
250 BOOL iconic;
251 BOOL moved = FALSE;
252 BOOL DragFullWindows = FALSE;
253 PWND pWndParent = NULL;
254 WPARAM syscommand = (wParam & 0xfff0);
256 //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
257 // The task bar can grow in size and can not reduce due to the change
258 // in the work area.
259
260 Style = pwnd->style;
261 ExStyle = pwnd->ExStyle;
262 iconic = (Style & WS_MINIMIZE) != 0;
263
264 if (((Style & WS_MAXIMIZE) && syscommand != SC_MOVE) || !IntIsWindowVisible(pwnd)) return;
265
266 thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
267
268 //
269 // Show window contents while dragging the window, get flag from registry data.
270 //
271 UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
272
273 pt.x = pti->ptLast.x;
274 pt.y = pti->ptLast.y;
275 capturePoint = pt;
277
278 TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
279 pwnd, syscommand, hittest, pt.x, pt.y);
280
281 if (syscommand == SC_MOVE)
282 {
283 if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
284 if (!hittest) return;
285 }
286 else /* SC_SIZE */
287 {
288 if (!thickframe) return;
289 if (hittest && (syscommand != SC_MOUSEMENU))
290 {
291 hittest += (HTLEFT - WMSZ_LEFT);
292 }
293 else
294 {
296 hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
297 if (!hittest)
298 {
300 return;
301 }
302 }
303 }
304
305 /* Get min/max info */
306
307 co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
308 sizingRect = pwnd->rcWindow;
309 origRect = sizingRect;
310 if (Style & WS_CHILD)
311 {
312 pWndParent = IntGetParent(pwnd);
313 IntGetClientRect( pWndParent, &mouseRect );
314 IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
315 IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
316 unmodRect = sizingRect;
317 }
318 else
319 {
320 if (!(ExStyle & WS_EX_TOPMOST))
321 {
322 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
323 }
324 else
325 {
327 }
328 unmodRect = sizingRect;
329 }
330
331 if (ON_LEFT_BORDER(hittest))
332 {
333 mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
334 mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
335 }
336 else if (ON_RIGHT_BORDER(hittest))
337 {
338 mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
339 mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
340 }
341 if (ON_TOP_BORDER(hittest))
342 {
343 mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
344 mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
345 }
346 else if (ON_BOTTOM_BORDER(hittest))
347 {
348 mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
349 mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
350 }
351
352 hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
353 if (iconic)
354 {
355 DragCursor = pwnd->pcls->spicn;
356 if (DragCursor)
357 {
358 UserReferenceObject(DragCursor);
359 }
360 else
361 {
362 HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
363 if (CursorHandle)
364 {
365 DragCursor = UserGetCurIconObject(CursorHandle);
366 }
367 else
368 {
369 iconic = FALSE;
370 }
371 }
372 }
373
374 /* repaint the window before moving it around */
376
377 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
378
380
382
384
385 pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
386
387 for(;;)
388 {
389 int dx = 0, dy = 0;
390
391 if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
392 if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
393
394 if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
395 break; // Exit on Return or Esc
396
397 if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP))
398 { // If no WindowSnapEnabled: Exit on button-up immediately
399 break;
400 }
401 else if (g_bWindowSnapEnabled && msg.message == WM_LBUTTONUP)
402 { // If WindowSnapEnabled: Decide whether to snap before exiting
403 DWORD ExStyleTB, StyleTB;
404 BOOL IsTaskBar;
405
406 // We want to forbid snapping operations on the TaskBar
407 // We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
408 ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
410 IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
411 && (ExStyleTB == WS_EX_TOOLWINDOW);
412 TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
413
414 // check for snapping if was moved by caption
415 if (!IsTaskBar && hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
416 {
417 RECT snapRect;
418 BOOL doSideSnap = FALSE;
419 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
420
421 // snap to left
422 if (pt.x <= snapRect.left)
423 {
424 snapRect.right = (snapRect.right - snapRect.left) / 2 + snapRect.left;
425 doSideSnap = TRUE;
426 }
427 // snap to right
428 if (pt.x >= snapRect.right-1)
429 {
430 snapRect.left = (snapRect.right - snapRect.left) / 2 + snapRect.left;
431 doSideSnap = TRUE;
432 }
433
434 if (doSideSnap)
435 {
437 NULL,
438 snapRect.left,
439 snapRect.top,
440 snapRect.right - snapRect.left,
441 snapRect.bottom - snapRect.top,
443 pwnd->InternalPos.NormalRect = origRect;
444 }
445 else
446 {
447 // maximize if on dragged to top
448 if (pt.y <= snapRect.top)
449 {
451 pwnd->InternalPos.NormalRect = origRect;
452 }
453 }
454 }
455 break;
456 }
457
458 if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
459 {
462 continue; /* We are not interested in other messages */
463 }
464
465 pt = msg.pt;
466
467 if (msg.message == WM_KEYDOWN) switch(msg.wParam)
468 {
469 case VK_UP: pt.y -= 8; break;
470 case VK_DOWN: pt.y += 8; break;
471 case VK_LEFT: pt.x -= 8; break;
472 case VK_RIGHT: pt.x += 8; break;
473 }
474
475 pt.x = max( pt.x, mouseRect.left );
476 pt.x = min( pt.x, mouseRect.right - 1 );
477 pt.y = max( pt.y, mouseRect.top );
478 pt.y = min( pt.y, mouseRect.bottom - 1 );
479
480 dx = pt.x - capturePoint.x;
481 dy = pt.y - capturePoint.y;
482
483 if (dx || dy)
484 {
485 if ( !moved )
486 {
487 moved = TRUE;
488 if ( iconic ) /* ok, no system popup tracking */
489 {
490 OldCursor = UserSetCursor(DragCursor, FALSE);
492 }
493 else if(!DragFullWindows)
494 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
495 }
496
497 if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
498 else
499 {
500 RECT newRect = unmodRect;
501
502 if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
503 if (hittest == HTCAPTION)
504 {
505 /* Restore window size if it is snapped */
506 if (!RECTL_bIsEmptyRect(&pwnd->InternalPos.NormalRect) &&
507 !IntEqualRect(&pwnd->InternalPos.NormalRect, &pwnd->rcWindow))
508 {
509 UserSetCursorPos(max(0, pwnd->InternalPos.NormalRect.left) + pt.x, pwnd->InternalPos.NormalRect.top + pt.y, 0, 0, FALSE);
510
511 /* Save normal size - it required when window unsnapped from one side and snapped to another holding mouse down */
512 origRect = pwnd->InternalPos.NormalRect;
513
514 /* Restore from maximized state */
515 if (Style & WS_MAXIMIZE)
516 {
518 }
519 /* Restore snapped to left/right place */
520 else
521 {
523 NULL,
524 pwnd->InternalPos.NormalRect.left,
525 pwnd->InternalPos.NormalRect.top,
526 pwnd->InternalPos.NormalRect.right - pwnd->InternalPos.NormalRect.left,
527 pwnd->InternalPos.NormalRect.bottom - pwnd->InternalPos.NormalRect.top,
528 0);
529 }
530 RECTL_vSetEmptyRect(&pwnd->InternalPos.NormalRect);
531 continue;
532 }
533
534 /* regular window moving */
535 RECTL_vOffsetRect(&newRect, dx, dy);
536 }
537 if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
538 else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
539 if (ON_TOP_BORDER(hittest)) newRect.top += dy;
540 else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
541 capturePoint = pt;
542
543 //
544 // Save the new position to the unmodified rectangle. This allows explorer task bar
545 // sizing. Explorer will forces back the position unless a certain amount of sizing
546 // has occurred.
547 //
548 unmodRect = newRect;
549
550 /* determine the hit location */
551 if (syscommand == SC_SIZE)
552 {
553 WPARAM wpSizingHit = 0;
554
555 if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
556 wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
557 co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
558 }
559 else
560 co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
561
562 if (!iconic)
563 {
564 if (!DragFullWindows)
565 UserDrawMovingFrame( hdc, &newRect, thickframe );
566 else
567 { // Moving the whole window now!
568 HRGN hrgnNew;
569 HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
570
571 if (pwnd->hrgnClip != NULL)
572 NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
573
575 //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
577 NULL,
578 newRect.left,
579 newRect.top,
580 newRect.right - newRect.left,
581 newRect.bottom - newRect.top,
582 SWP_NOACTIVATE | ((hittest == HTCAPTION) ? SWP_NOSIZE : 0));
583
584 hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
585 if (pwnd->hrgnClip != NULL)
586 NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
587
588 if (hrgnNew)
589 {
590 if (hrgnOrig)
591 NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
592 }
593 else
594 {
595 if (hrgnOrig)
596 {
597 GreDeleteObject(hrgnOrig);
598 hrgnOrig = 0;
599 }
600 }
601
602 // Update all the windows after the move or size, including this window.
603 UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
604
605 if (hrgnOrig) GreDeleteObject(hrgnOrig);
606 if (hrgnNew) GreDeleteObject(hrgnNew);
607 }
608 }
609 sizingRect = newRect;
610 }
611 }
612 }
613
614 pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
615
617
618 if ( iconic )
619 {
620 if ( moved ) /* restore cursors, show icon title later on */
621 {
623 OldCursor = UserSetCursor(OldCursor, FALSE);
624 }
625
626 /* It could be that the cursor was already changed while we were proceeding,
627 * so we must unreference whatever cursor was current at the time we restored the old one.
628 * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
629 */
630 if (OldCursor) UserDereferenceObject(OldCursor);
631 }
632 else if ( moved && !DragFullWindows )
633 UserDrawMovingFrame( hdc, &sizingRect, thickframe );
634
636
638 //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
639
641 {
642 ERR("DoSizeMove : WH_CBT Call Hook return!\n");
643 moved = FALSE;
644 }
645
646 IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
647
649
654 /* window moved or resized */
655 if (moved)
656 {
657 /* if the moving/resizing isn't canceled call SetWindowPos
658 * with the new position or the new size of the window
659 */
660 if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
661 {
662 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
663 if (!DragFullWindows || iconic )
664 {
666 0,
667 sizingRect.left,
668 sizingRect.top,
669 sizingRect.right - sizingRect.left,
670 sizingRect.bottom - sizingRect.top,
671 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
672 }
673 }
674 else
675 { /* restore previous size/position */
676 if ( DragFullWindows )
677 {
679 0,
680 origRect.left,
681 origRect.top,
682 origRect.right - origRect.left,
683 origRect.bottom - origRect.top,
684 ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
685 }
686 }
687 }
688
689 if ( IntIsWindow(UserHMGetHandle(pwnd)) )
690 {
691 if ( iconic )
692 {
693 /* Single click brings up the system menu when iconized */
694 if ( !moved )
695 {
696 if( Style & WS_SYSMENU )
698 }
699 }
700 }
701}
const DWORD Style
Definition: appswitch.c:71
const DWORD ExStyle
Definition: appswitch.c:72
WPARAM wParam
Definition: combotst.c:138
#define pt(x, y)
Definition: drawing.c:79
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1458
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1440
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3708
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:277
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define min(a, b)
Definition: monoChain.cc:55
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2553
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:935
#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 WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:580
POINT ptLast
Definition: win32.h:129
DWORD ExStyle
Definition: ntuser.h:699
HRGN hrgnClip
Definition: ntuser.h:728
PCLS pcls
Definition: ntuser.h:715
struct _WND::@4899 InternalPos
RECT rcWindow
Definition: ntuser.h:711
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:31
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:888
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1093
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
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
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:1386
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1152
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:2137
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:841
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1177
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#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:140
#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:2104
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:189
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:145
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:93
HICON HCURSOR
Definition: windef.h:299
#define RGN_DIFF
Definition: wingdi.h:358
#define RGN_AND
Definition: wingdi.h:356
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define SC_MOUSEMENU
Definition: winuser.h:2585
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define DCX_CACHE
Definition: winuser.h:2104
#define SM_CYSCREEN
Definition: winuser.h:954
#define HTCAPTION
Definition: winuser.h:2466
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define VK_UP
Definition: winuser.h:2215
#define RDW_UPDATENOW
Definition: winuser.h:1210
#define WM_QUERYDRAGICON
Definition: winuser.h:1644
#define WMSZ_LEFT
Definition: winuser.h:2454
#define SC_SIZE
Definition: winuser.h:2574
#define VK_RETURN
Definition: winuser.h:2191
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WM_EXITSIZEMOVE
Definition: winuser.h:1814
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define PM_REMOVE
Definition: winuser.h:1186
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define SC_MOVE
Definition: winuser.h:2575
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define MSGF_SIZE
Definition: winuser.h:1167
#define VK_LEFT
Definition: winuser.h:2214
#define WM_SIZING
Definition: winuser.h:1797
#define VK_RIGHT
Definition: winuser.h:2216
#define VK_DOWN
Definition: winuser.h:2217
#define SM_CXSCREEN
Definition: winuser.h:953
#define WM_KEYDOWN
Definition: winuser.h:1705
#define WM_MOVING
Definition: winuser.h:1799
#define HTSYSMENU
Definition: winuser.h:2467
#define HTLEFT
Definition: winuser.h:2477
#define VK_ESCAPE
Definition: winuser.h:2204
#define SC_RESTORE
Definition: winuser.h:2588
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1813

Referenced by DefWndHandleSysCommand().

◆ GetControlBrush()

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

Definition at line 172 of file misc.c.

176{
177 PWND pwndParent = IntGetParent(pwnd);
178 return GetControlColor( pwndParent, pwnd, hdc, ctlType);
179}
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:146

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

◆ GetControlColor()

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

Definition at line 146 of file misc.c.

151{
152 HBRUSH hBrush;
153
154 if (!pwndParent) pwndParent = pwnd;
155
156 if ( pwndParent->head.pti->ppi != PsGetCurrentProcessWin32Process())
157 {
158 return (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
159 }
160
161 hBrush = (HBRUSH)co_IntSendMessage( UserHMGetHandle(pwndParent), CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd));
162
163 if (!hBrush || !GreIsHandleValid(hBrush))
164 {
165 hBrush = (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
166 }
167 return hBrush;
168}
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:536
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 809 of file misc.c.

813{
818
819 if (Thread && Process)
821
822 /* If nothing has been specified, use the current thread */
823 if (!Thread && !Process)
825
826 if (Thread)
827 {
828 /* Use a thread token */
829 ASSERT(!Process);
831 &CopyOnOpen,
834
835 /* If we don't have a thread token, use a process token */
836 if (!Token)
838 }
839 if (!Token && Process)
840 {
841 /* Use a process token */
843
844 /* If we don't have a token, fail */
845 if (!Token)
846 return STATUS_NO_TOKEN;
847 }
848 ASSERT(Token);
849
850 /* Query the LUID */
852
853 /* Get rid of the token and return */
855 return Status;
856}
unsigned char BOOLEAN
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:403
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:2034
#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 39 of file metric.c.

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

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 457 of file main.c.

458{
460 PCLIENTINFO pci;
461 PTHREADINFO ptiCurrent;
462 int i;
464 PTEB pTeb;
465 PRTL_USER_PROCESS_PARAMETERS ProcessParams;
466 PKL pDefKL;
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
492 /* Mark the process as having threads */
493 ptiCurrent->ppi->W32PF_flags |= W32PF_THREADCONNECTED;
494
499 InitializeListHead(&ptiCurrent->PtiLink);
500 for (i = 0; i < NB_HOOKS; i++)
501 {
502 InitializeListHead(&ptiCurrent->aphkStart[i]);
503 }
504 ptiCurrent->ptiSibling = ptiCurrent->ppi->ptiList;
505 ptiCurrent->ppi->ptiList = ptiCurrent;
506 ptiCurrent->ppi->cThreads++;
507
508 ptiCurrent->hEventQueueClient = NULL;
509 Status = ZwCreateEvent(&ptiCurrent->hEventQueueClient, EVENT_ALL_ACCESS,
511 if (!NT_SUCCESS(Status))
512 {
513 ERR_CH(UserThread, "Event creation failed, Status 0x%08x.\n", Status);
514 goto error;
515 }
518 (PVOID*)&ptiCurrent->pEventQueueServer, NULL);
519 if (!NT_SUCCESS(Status))
520 {
521 ERR_CH(UserThread, "Failed referencing the event object, Status 0x%08x.\n", Status);
523 ptiCurrent->hEventQueueClient = NULL;
524 goto error;
525 }
526
527 ptiCurrent->pcti->timeLastRead = EngGetTickCount32();
528
529 ptiCurrent->MessageQueue = MsqCreateMessageQueue(ptiCurrent);
530 if (ptiCurrent->MessageQueue == NULL)
531 {
532 ERR_CH(UserThread, "Failed to allocate message loop\n");
534 goto error;
535 }
536
537 pDefKL = W32kGetDefaultKeyLayout();
538 UserAssignmentLock((PVOID*)&(ptiCurrent->KeyboardLayout), pDefKL);
539
540 ptiCurrent->TIF_flags &= ~TIF_INCLEANUP;
541
542 // FIXME: Flag SYSTEM threads with... TIF_SYSTEMTHREAD !!
543
544 /* CSRSS threads have some special features */
545 if (Process == gpepCSRSS || !gpepCSRSS)
547
548 /* Initialize the CLIENTINFO */
549 pci = (PCLIENTINFO)pTeb->Win32ClientInfo;
550 RtlZeroMemory(pci, sizeof(*pci));
551 pci->ppi = ptiCurrent->ppi;
552 pci->fsHooks = ptiCurrent->fsHooks;
553 pci->dwTIFlags = ptiCurrent->TIF_flags;
554 if (pDefKL)
555 {
556 pci->hKL = pDefKL->hkl;
557 pci->CodePage = pDefKL->CodePage;
558 }
559
560 /* Need to pass the user Startup Information to the current process. */
561 if ( ProcessParams )
562 {
563 if ( ptiCurrent->ppi->usi.cb == 0 ) // Not initialized yet.
564 {
565 if ( ProcessParams->WindowFlags != 0 ) // Need window flags set.
566 {
567 ptiCurrent->ppi->usi.cb = sizeof(USERSTARTUPINFO);
568 ptiCurrent->ppi->usi.dwX = ProcessParams->StartingX;
569 ptiCurrent->ppi->usi.dwY = ProcessParams->StartingY;
570 ptiCurrent->ppi->usi.dwXSize = ProcessParams->CountX;
571 ptiCurrent->ppi->usi.dwYSize = ProcessParams->CountY;
572 ptiCurrent->ppi->usi.dwFlags = ProcessParams->WindowFlags;
573 ptiCurrent->ppi->usi.wShowWindow = (WORD)ProcessParams->ShowWindowFlags;
574 }
575 }
576 }
577
578 /*
579 * Assign a default window station and desktop to the process.
580 * Do not try to open a desktop or window station before the very first
581 * (interactive) window station has been created by Winlogon.
582 */
583 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) &&
584 ptiCurrent->ppi->hdeskStartup == NULL &&
586 {
587 HWINSTA hWinSta = NULL;
588 HDESK hDesk = NULL;
589 UNICODE_STRING DesktopPath;
590 PDESKTOP pdesk;
591
592 /*
593 * Inherit the thread desktop and process window station (if not yet inherited)
594 * from the process startup info structure. See documentation of CreateProcess().
595 */
597 if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)
598 {
599 Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo);
600 }
601 if (!NT_SUCCESS(Status))
602 {
603 RtlInitUnicodeString(&DesktopPath, NULL);
604 }
605
607 &DesktopPath,
608 !!(ProcessParams->WindowFlags & STARTF_INHERITDESKTOP),
609 &hWinSta,
610 &hDesk);
611
612 if (DesktopPath.Buffer)
613 ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING);
614
615 if (!NT_SUCCESS(Status))
616 {
617 ERR_CH(UserThread, "Failed to assign default desktop and winsta to process\n");
618 goto error;
619 }
620
621 if (!UserSetProcessWindowStation(hWinSta))
622 {
624 ERR_CH(UserThread, "Failed to set initial process winsta\n");
625 goto error;
626 }
627
628 /* Validate the new desktop */
629 Status = IntValidateDesktopHandle(hDesk, UserMode, 0, &pdesk);
630 if (!NT_SUCCESS(Status))
631 {
632 ERR_CH(UserThread, "Failed to validate initial desktop handle\n");
633 goto error;
634 }
635
636 /* Store the parsed desktop as the initial desktop */
637 ASSERT(ptiCurrent->ppi->hdeskStartup == NULL);
638 ASSERT(Process->UniqueProcessId != gpidLogon);
639 ptiCurrent->ppi->hdeskStartup = hDesk;
640 ptiCurrent->ppi->rpdeskStartup = pdesk;
641 }
642
643 if (ptiCurrent->ppi->hdeskStartup != NULL)
644 {
645 if (!IntSetThreadDesktop(ptiCurrent->ppi->hdeskStartup, FALSE))
646 {
647 ERR_CH(UserThread, "Failed to set thread desktop\n");
649 goto error;
650 }
651 }
652
653 /* Mark the thread as fully initialized */
654 ptiCurrent->TIF_flags |= TIF_GUITHREADINITIALIZED;
655
656 if (!(ptiCurrent->ppi->W32PF_flags & (W32PF_ALLOWFOREGROUNDACTIVATE | W32PF_APPSTARTING)) &&
657 (gptiForeground && gptiForeground->ppi == ptiCurrent->ppi ))
658 {
660 }
661 ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
662
663 /* Create the default input context */
664 if (IS_IMM_MODE())
665 {
667 }
668
669 /* Last things to do only if we are not a SYSTEM or CSRSS thread */
670 if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)))
671 {
672 /* Callback to User32 Client Thread Setup */
673 TRACE_CH(UserThread, "Call co_IntClientThreadSetup...\n");
675 if (!NT_SUCCESS(Status))
676 {
677 ERR_CH(UserThread, "ClientThreadSetup failed with Status 0x%08lx\n", Status);
678 goto error;
679 }
680 TRACE_CH(UserThread, "co_IntClientThreadSetup succeeded!\n");
681 }
682 else
683 {
684 TRACE_CH(UserThread, "co_IntClientThreadSetup cannot be called...\n");
685 }
686
687 TRACE_CH(UserThread, "UserCreateW32Thread pti 0x%p\n", ptiCurrent);
688 return STATUS_SUCCESS;
689
690error:
691 ERR_CH(UserThread, "InitThreadCallback failed! Freeing pti 0x%p for TID:0x%lx\n",
692 ptiCurrent, HandleToUlong(Thread->Cid.UniqueThread));
694 return Status;
695}
#define VOID
Definition: acefi.h:82
#define HandleToUlong(h)
Definition: basetsd.h:79
#define ERR_CH(ch, fmt,...)
Definition: debug.h:105
#define TRACE_CH(ch, fmt,...)
Definition: debug.h:108
PEPROCESS gpepCSRSS
Definition: csr.c:15
#define EngGetTickCount32()
Definition: eng.h:43
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TIF_CSRSSTHREAD
Definition: ntuser.h:265
#define TIF_DONTATTACHQUEUE
Definition: ntuser.h:268
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:286
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:264
struct _CLIENTINFO * PCLIENTINFO
#define NB_HOOKS
Definition: ntuser.h:127
#define TIF_ALLOWFOREGROUNDACTIVATE
Definition: ntuser.h:267
#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:2442
#define UserMode
Definition: asm.h:35
@ SynchronizationEvent
POBJECT_TYPE ExEventObjectType
Definition: event.c:18
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation)
Definition: winsta.c:1382
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 STATUS_SUCCESS
Definition: shellext.h:65
HANDLE gpidLogon
Definition: simplecall.c:15
USHORT CodePage
Definition: ntuser.h:335
HKL hKL
Definition: ntuser.h:334
ULONG fsHooks
Definition: ntuser.h:323
DWORD dwTIFlags
Definition: ntuser.h:319
struct _PROCESSINFO * ppi
Definition: ntuser.h:341
HANDLE UniqueThread
Definition: compat.h:826
CLIENT_ID Cid
Definition: pstypes.h:1128
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
INT cThreads
Definition: win32.h:262
USERSTARTUPINFO usi
Definition: win32.h:278
HDESK hdeskStartup
Definition: win32.h:263
PTHREADINFO ptiList
Definition: win32.h:256
struct _DESKTOP * rpdeskStartup
Definition: win32.h:258
UNICODE_STRING DesktopInfo
Definition: rtltypes.h:1555
Definition: compat.h:836
ULONG Win32ClientInfo[31]
Definition: compat.h:847
PVOID Win32ThreadInfo
Definition: compat.h:846
PPEB ProcessEnvironmentBlock
Definition: ntddk_ex.h:337
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:219
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STARTF_INHERITDESKTOP
Definition: undocuser.h:164
#define W32PF_APPSTARTING
Definition: win32.h:10
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:181
struct tagUSERSTARTUPINFO USERSTARTUPINFO
#define W32PF_THREADCONNECTED
Definition: win32.h:18
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:679
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:1237
NTSTATUS FASTCALL IntResolveDesktop(IN PEPROCESS Process, IN PUNICODE_STRING DesktopPath, IN BOOL bInherit, OUT HWINSTA *phWinSta, OUT HDESK *phDesktop)
Definition: desktop.c:551
BOOL IntSetThreadDesktop(IN HDESK hDesktop, IN BOOL FreeOnFailure)
Definition: desktop.c:3260
PTHREADINFO gptiForeground
Definition: focus.c:15
PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
Definition: ime.c:1558
PKL W32kGetDefaultKeyLayout(VOID)
Definition: kbdlayout.c:514
NTSTATUS NTAPI ExitThreadCallback(PETHREAD Thread)
Definition: main.c:703
NTSTATUS AllocW32Thread(IN PETHREAD Thread, OUT PTHREADINFO *W32Thread)
Definition: main.c:373
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:840

Referenced by Win32kThreadCallback().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 612 of file misc.c.

613{
614 UINT bit;
615 if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
616 bit = 1 << LOWORD(Flag);
617 TRACE("CWS %x\n",bit);
618 switch(HIWORD(Flag))
619 {
620 case 0:
621 pWnd->state &= ~bit;
622 break;
623 case 1:
624 pWnd->state2 &= ~bit;
625 break;
626 case 2:
627 pWnd->ExStyle2 &= ~bit;
628 break;
629 }
630}
unsigned int UINT
Definition: ndis.h:50
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define LOWORD(l)
Definition: pedump.c:82
Definition: xml2sdb.h:80
DWORD ExStyle2
Definition: ntuser.h:740
DWORD state2
Definition: ntuser.h:697
DWORD state
Definition: ntuser.h:696
#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:3105
HWND hwnd
Definition: winuser.h:3104
WPARAM wParam
Definition: winuser.h:3106
LPARAM lParam
Definition: winuser.h:3107
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
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 @1609 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:1255
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:3310

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 438 of file window.c.

439{
440 DWORD HelpId;
441
442 do
443 {
445 if (!HelpId) break;
446 pWnd = IntGetParent(pWnd);
447 }
448 while (pWnd && pWnd->fnid != FNID_DESKTOP);
449 return HelpId;
450}
#define FNID_DESKTOP
Definition: ntuser.h:857
#define DWORD
Definition: nt_native.h:44
DWORD fnid
Definition: ntuser.h:704
ATOM atomContextHelpIdProp
Definition: ntuser.h:1062
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by IntDefWindowProc().

◆ IntGetWindowObject()

PWND FASTCALL IntGetWindowObject ( HWND  hWnd)

Definition at line 73 of file window.c.

74{
76
77 if (!hWnd) return NULL;
78
80 if (Window)
81 Window->head.cLockObj++;
82
83 return Window;
84}
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122

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

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  pWnd,
UINT  Flag 
)

Definition at line 591 of file misc.c.

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

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 _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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:34

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

◆ NC_DoNCPaint()

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

Definition at line 1064 of file nonclient.c.

1065{
1067 PWND Parent;
1068 RECT WindowRect, CurrentRect, TempRect;
1069 BOOL Active = FALSE;
1070
1071 if (!IntIsWindowVisible(pWnd) ||
1072 (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1073 IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1074 return 0;
1075
1076 Style = pWnd->style;
1077
1078 TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1079
1080 Parent = IntGetParent(pWnd);
1081 ExStyle = pWnd->ExStyle;
1082
1083 if (Flags == -1) // NC paint mode.
1084 {
1085 if (ExStyle & WS_EX_MDICHILD)
1086 {
1088
1089 if (Active)
1091 }
1092 else
1093 {
1094 Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1095 }
1096 Flags = DC_NC; // Redraw everything!
1097 }
1098 else
1099 Flags |= DC_NC;
1100
1101
1102 IntGetWindowRect(pWnd, &WindowRect);
1103
1104 CurrentRect.top = CurrentRect.left = 0;
1105 CurrentRect.right = WindowRect.right - WindowRect.left;
1106 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1107
1108 /* Draw outer edge */
1109 if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1110 {
1111 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1112 }
1113 else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1114 {
1115#if 0
1116 DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1117#else
1119 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1120 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1121
1123 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1124 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1125
1126 RECTL_vInflateRect(&CurrentRect, -1, -1);
1127#endif
1128 }
1129
1130 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1131
1132 /* Draw caption */
1133 if ((Style & WS_CAPTION) == WS_CAPTION)
1134 {
1135 HPEN PreviousPen;
1136 BOOL Gradient = FALSE;
1137
1138 if (Flags & DC_REDRAWHUNGWND)
1139 {
1140 Flags &= ~DC_REDRAWHUNGWND;
1142 }
1143
1144 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1145 {
1146 Flags |= DC_GRADIENT;
1147 }
1148
1149 if (Active)
1150 {
1151 if (pWnd->state & WNDS_ACTIVEFRAME)
1152 Flags |= DC_ACTIVE;
1153 else
1154 {
1155 ERR("Wnd is active and not set active!\n");
1156 }
1157 }
1158
1159 TempRect = CurrentRect;
1160
1162 {
1163 Flags |= DC_SMALLCAP;
1164 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1165 CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1166 }
1167 else
1168 {
1169 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1170 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1171 }
1172
1173 UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1174
1175 /* Draw buttons */
1176 if (Style & WS_SYSMENU)
1177 {
1180 {
1183 }
1184 }
1185 if (!(Style & WS_MINIMIZE))
1186 {
1187 /* Line under caption */
1188 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1189
1193
1194 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1195
1196 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1197
1198 NtGdiSelectPen(hDC, PreviousPen);
1199 }
1200 }
1201
1202 if (!(Style & WS_MINIMIZE))
1203 {
1204 /* Draw menu bar */
1205 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1206 {
1207 if (!(Flags & DC_NOSENDMSG))
1208 {
1209 PMENU menu;
1210 // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1211 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1212 {
1213 TempRect = CurrentRect;
1214 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1215 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1216 }
1217 }
1218 }
1219
1221 {
1222 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1223 }
1224
1225 /* Draw the scrollbars */
1226 if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1228 {
1229 RECT ParentClientRect;
1230
1231 TempRect = CurrentRect;
1232
1234 TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1235 else
1236 TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1237
1238 TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1239
1241
1242 if (Parent)
1243 {
1244 IntGetClientRect(Parent, &ParentClientRect);
1245
1246 if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1247 {
1249 }
1250 }
1251
1254 }
1255 else
1256 {
1258 {
1260 }
1262 {
1264 }
1265 }
1266 }
1267 return 0; // For WM_NCPAINT message, return 0.
1268}
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
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:41
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:606
#define WNDS_NONCPAINT
Definition: ntuser.h:608
#define WNDS_HASMENU
Definition: ntuser.h:600
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:615
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
__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:984
__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:122
#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:712
UINT_PTR IDMenu
Definition: ntuser.h:726
ULONG cyMenu
Definition: ntuser.h:418
#define DC_NOSENDMSG
Definition: undocuser.h:148
#define DC_REDRAWHUNGWND
Definition: undocuser.h:152
#define DC_FRAME
Definition: undocuser.h:149
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2197
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: uxthemep.h:216
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:2744
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:757
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:775
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:876
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:922
#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)
#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:913
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 DC_ACTIVE
Definition: winuser.h:427
#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:924
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WM_MDIGETACTIVE
Definition: winuser.h:1811
#define DC_SMALLCAP
Definition: winuser.h:428
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:929
#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:922
_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 876 of file nonclient.c.

877{
878 /* Firstly the "thick" frame */
879 if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
880 {
881 LONG Width =
884
885 LONG Height =
888
890
891 /* Draw frame */
892 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
893 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
894 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
895 NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
896
897 RECTL_vInflateRect(CurrentRect, -Width, -Height);
898 }
899
900 /* Now the other bit of the frame */
902 {
905
911
912 /* Draw frame */
913 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
914 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
915 NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
916 NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
917
918 RECTL_vInflateRect(CurrentRect, -Width, -Height);
919 }
920}
#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:917
#define COLOR_INACTIVEBORDER
Definition: winuser.h:918

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:200
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 1405 of file nonclient.c.

1406{
1407 INT Flags;
1408 /* Lotus Notes draws menu descriptions in the caption of its main
1409 * window. When it wants to restore original "system" view, it just
1410 * sends WM_NCACTIVATE message to itself. Any optimizations here in
1411 * attempt to minimize redrawings lead to a not restored caption.
1412 */
1413 if (wParam & DC_ACTIVE)
1414 {
1417 }
1418 else
1419 {
1420 Wnd->state &= ~WNDS_ACTIVEFRAME;
1422 }
1423
1424 if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1425 return TRUE;
1426
1427 /* This isn't documented but is reproducible in at least XP SP2 and
1428 * Outlook 2007 depends on it
1429 */
1430 // MSDN:
1431 // If this parameter is set to -1, DefWindowProc does not repaint the
1432 // nonclient area to reflect the state change.
1433 if ( lParam != -1 &&
1434 ( Flags = NC_DoNCActive(Wnd)) != 0 )
1435 {
1436 HDC hDC;
1437 HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1438
1440 {
1441 hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1442 if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1443 {
1444 GreDeleteObject(hRgnTemp);
1445 hRgnTemp = NULL;
1446 }
1447 }
1448
1449 if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1450 {
1451 NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1452 UserReleaseDC(Wnd, hDC, FALSE);
1453 }
1454 else
1455 GreDeleteObject(hRgnTemp);
1456 }
1457
1458 return TRUE;
1459}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define ERROR(name)
Definition: error_private.h:53
#define WNDS_HASCAPTION
Definition: ntuser.h:603
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:1064
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1387
#define RGN_COPY
Definition: wingdi.h:357
#define DCX_WINDOW
Definition: winuser.h:2103
#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 1271 of file nonclient.c.

1272{
1273 LRESULT Result = 0;
1274 SIZE WindowBorders;
1275 RECT OrigRect;
1276 LONG Style = Wnd->style;
1277 LONG exStyle = Wnd->ExStyle;
1278
1279 if (Rect == NULL)
1280 {
1281 return Result;
1282 }
1283 OrigRect = *Rect;
1284
1285 Wnd->state &= ~WNDS_HASCAPTION;
1286
1287 if (wparam)
1288 {
1289 if (Wnd->pcls->style & CS_VREDRAW)
1290 {
1292 }
1293 if (Wnd->pcls->style & CS_HREDRAW)
1294 {
1296 }
1298 }
1299
1300 if (!(Wnd->style & WS_MINIMIZE))
1301 {
1302 if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1303 {
1304 UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1305 RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1306 }
1307 else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1308 {
1309 RECTL_vInflateRect(Rect, -1, -1);
1310 }
1311
1312 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1313 {
1314 Wnd->state |= WNDS_HASCAPTION;
1315
1316 if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1318 else
1320 }
1321
1322 if (HAS_MENU(Wnd, Style))
1323 {
1325
1326 Wnd->state |= WNDS_HASMENU;
1327
1328 if (hDC)
1329 {
1330 RECT CliRect = *Rect;
1331 CliRect.bottom -= OrigRect.top;
1332 CliRect.right -= OrigRect.left;
1333 CliRect.left -= OrigRect.left;
1334 CliRect.top -= OrigRect.top;
1335 if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1336 UserReleaseDC(Wnd, hDC, FALSE);
1337 }
1338 }
1339
1340 if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1341 {
1343 }
1344
1345 if (Style & WS_VSCROLL)
1346 {
1347 if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1348 {
1349 Wnd->state |= WNDS_HASVERTICALSCROOLLBAR;
1350
1351 /* rectangle is in screen coords when wparam is false */
1352 if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1353
1354 if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1356 else
1358 }
1359 }
1360
1361 if (Style & WS_HSCROLL)
1362 {
1363 if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1364 {
1365 Wnd->state |= WNDS_HASHORIZONTALSCROLLBAR;
1366
1368 }
1369 }
1370
1371 if (Rect->top > Rect->bottom)
1372 Rect->bottom = Rect->top;
1373
1374 if (Rect->left > Rect->right)
1375 Rect->right = Rect->left;
1376 }
1377 else
1378 {
1379 Rect->right = Rect->left;
1380 Rect->bottom = Rect->top;
1381 }
1382
1383 return Result;
1384}
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:602
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:601
static UINT WPARAM wparam
Definition: combo.c:716
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:889
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define CS_VREDRAW
Definition: winuser.h:653
#define WVR_VALIDRECTS
Definition: winuser.h:2512
#define CS_HREDRAW
Definition: winuser.h:648
#define WVR_VREDRAW
Definition: winuser.h:2510
#define WVR_HREDRAW
Definition: winuser.h:2509
_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:426
@ Suspended
Definition: ketypes.h:408

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1634 of file nonclient.c.

1635{
1636 ULONG Style;
1637
1638 Style = pWnd->style;
1639 switch(wParam)
1640 {
1641 case HTCAPTION:
1642 {
1643 /* Maximize/Restore the window */
1645 {
1647 }
1648 break;
1649 }
1650 case HTSYSMENU:
1651 {
1652 PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1654
1655 /* If the close item of the sysmenu is disabled or not present do nothing */
1656 if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1657 break;
1658
1660 break;
1661 }
1662 case HTTOP:
1663 case HTBOTTOM:
1664 {
1665 RECT sizingRect = pWnd->rcWindow, mouseRect;
1666
1667 if (pWnd->ExStyle & WS_EX_MDICHILD)
1668 break;
1669
1670 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1671
1673 NULL,
1674 sizingRect.left,
1675 mouseRect.top,
1676 sizingRect.right - sizingRect.left,
1677 mouseRect.bottom - mouseRect.top,
1678 0);
1679 break;
1680 }
1681 default:
1682 return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1683 }
1684 return(0);
1685}
static int state
Definition: maze.c:121
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4975
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1542
#define MF_BYCOMMAND
Definition: winuser.h:202
#define HTBOTTOM
Definition: winuser.h:2483
#define SC_CLOSE
Definition: winuser.h:2582
#define HTTOP
Definition: winuser.h:2480
#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 1542 of file nonclient.c.

1543{
1544 switch (wParam)
1545 {
1546 case HTCAPTION:
1547 {
1548 PWND TopWnd = pWnd, parent;
1549 while(1)
1550 {
1551 if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1552 break;
1553 parent = UserGetAncestor( TopWnd, GA_PARENT );
1554 if (!parent || UserIsDesktopWindow(parent)) break;
1555 TopWnd = parent;
1556 }
1557
1558 if ( (pWnd && (pWnd->ExStyle & WS_EX_NOACTIVATE)) ||
1560 //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1562 {
1564 }
1565 break;
1566 }
1567 case HTSYSMENU:
1568 {
1569 LONG style = pWnd->style;
1570 if (style & WS_SYSMENU)
1571 {
1572 if(!(style & WS_MINIMIZE) )
1573 {
1574 RECT rect;
1575 HDC hDC = UserGetWindowDC(pWnd);
1576 NC_GetInsideRect(pWnd, &rect);
1578 UserReleaseDC( pWnd, hDC, FALSE );
1579 }
1581 }
1582 break;
1583 }
1584 case HTMENU:
1585 {
1587 break;
1588 }
1589 case HTHSCROLL:
1590 {
1592 break;
1593 }
1594 case HTVSCROLL:
1595 {
1597 break;
1598 }
1599 case HTMINBUTTON:
1600 case HTMAXBUTTON:
1601 case HTCLOSE:
1602 {
1603 NC_DoButton(pWnd, wParam, lParam);
1604 break;
1605 }
1606 case HTLEFT:
1607 case HTRIGHT:
1608 case HTTOP:
1609 case HTBOTTOM:
1610 case HTTOPLEFT:
1611 case HTTOPRIGHT:
1612 case HTBOTTOMLEFT:
1613 case HTBOTTOMRIGHT:
1614 {
1615 /* Old comment:
1616 * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1617 * This was previously done by setting wParam=SC_SIZE + wParam - 2
1618 */
1619 /* But that is not what WinNT does. Instead it sends this. This
1620 * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1621 * SC_MOUSEMENU into wParam.
1622 */
1624 break;
1625 }
1626 case HTBORDER:
1627 break;
1628 }
1629 return(0);
1630}
Arabic default style
Definition: afstyles.h:94
r parent
Definition: btrfs.c:3010
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1561
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3334
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:734
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1462
#define SC_HSCROLL
Definition: winuser.h:2584
#define HTTOPRIGHT
Definition: winuser.h:2482
#define HTCLOSE
Definition: winuser.h:2489
#define HTTOPLEFT
Definition: winuser.h:2481
#define HTBORDER
Definition: winuser.h:2487
#define SC_VSCROLL
Definition: winuser.h:2583
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define HTVSCROLL
Definition: winuser.h:2472
#define HTHSCROLL
Definition: winuser.h:2471
#define GA_PARENT
Definition: winuser.h:2778
#define HTMAXBUTTON
Definition: winuser.h:2474
#define HTMENU
Definition: winuser.h:2470
#define HTRIGHT
Definition: winuser.h:2479
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define HTMINBUTTON
Definition: winuser.h:2473

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1692 of file nonclient.c.

1693{
1694 MSG msg;
1695 INT hittest = wParam;
1696
1697 switch (hittest)
1698 {
1699 case HTCAPTION:
1700 case HTSYSMENU:
1701 if (!IntGetSystemMenu( pwnd, FALSE )) break;
1702
1704 for (;;)
1705 {
1707 if (IntCallMsgFilter( &msg, MSGF_MAX )) continue;
1708 if (msg.message == WM_RBUTTONUP)
1709 {
1710 hittest = GetNCHitEx( pwnd, msg.pt );
1711 break;
1712 }
1713 if (UserHMGetHandle(pwnd) != IntGetCapture()) return 0;
1714 }
1716
1717 if (hittest == HTCAPTION || hittest == HTSYSMENU || hittest == HTHSCROLL || hittest == HTVSCROLL)
1718 {
1719 TRACE("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
1721 }
1722 break;
1723 }
1724 return 0;
1725}
#define WM_CONTEXTMENU
Definition: richedit.h:64
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1952
#define WM_MOUSEFIRST
Definition: winuser.h:1764
#define WM_MOUSELAST
Definition: winuser.h:1791
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define MSGF_MAX
Definition: winuser.h:1172

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 ( ULONG_PTR  dwClientImcData)

Definition at line 1558 of file ime.c.

1559{
1560 PIMC pIMC;
1562 PDESKTOP pdesk = pti->rpdesk;
1563
1564 if (!IS_IMM_MODE() || (pti->TIF_flags & TIF_DISABLEIME)) // Disabled?
1565 {
1566 ERR("IME is disabled\n");
1567 return NULL;
1568 }
1569
1570 if (!pdesk) // No desktop?
1571 return NULL;
1572
1573 // pti->spDefaultImc should be already set if non-first time.
1574 if (dwClientImcData && !pti->spDefaultImc)
1575 return NULL;
1576
1577 // Create an input context user object.
1578 pIMC = UserCreateObject(gHandleTable, pdesk, pti, NULL, TYPE_INPUTCONTEXT, sizeof(IMC));
1579 if (!pIMC)
1580 return NULL;
1581
1582 // Release the extra reference (UserCreateObject added 2 references).
1584 ASSERT(pIMC->head.cLockObj == 1);
1585
1586 if (dwClientImcData) // Non-first time.
1587 {
1588 // Insert pIMC to the second position (non-default) of the list.
1589 pIMC->pImcNext = pti->spDefaultImc->pImcNext;
1590 pti->spDefaultImc->pImcNext = pIMC;
1591 }
1592 else // First time. It's the default IMC.
1593 {
1594 // Add the first one (default) to the list.
1595 UserAssignmentLock((PVOID*)&pti->spDefaultImc, pIMC);
1596 pIMC->pImcNext = NULL;
1597 ASSERT(pIMC->head.cLockObj == 2); // UserAssignmentUnlock'ed at ExitThreadCallback
1598 }
1599
1600 pIMC->dwClientImcData = dwClientImcData; // Set it.
1601 return pIMC;
1602}
#define TIF_DISABLEIME
Definition: ntuser.h:287
@ TYPE_INPUTCONTEXT
Definition: ntuser.h:57
struct tagIMC * spDefaultImc
Definition: win32.h:132
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 5032 of file menu.c.

5033{
5034 PWINSTATION_OBJECT WinStaObject;
5035 HANDLE Handle;
5036 PMENU Menu;
5038 PEPROCESS CurrentProcess = PsGetCurrentProcess();
5039
5040 if (gpepCSRSS != CurrentProcess)
5041 {
5042 /*
5043 * gpepCSRSS does not have a Win32WindowStation
5044 */
5045
5047 UserMode,
5048 0,
5049 &WinStaObject,
5050 0);
5051
5052 if (!NT_SUCCESS(Status))
5053 {
5054 ERR("Validation of window station handle (%p) failed\n",
5055 CurrentProcess->Win32WindowStation);
5057 return (HMENU)0;
5058 }
5059 Menu = IntCreateMenu(&Handle, !PopupMenu, Desktop, GetW32ProcessInfo());
5060 if (Menu && Menu->head.rpdesk->rpwinstaParent != WinStaObject)
5061 {
5062 ERR("Desktop Window Station does not match Process one!\n");
5063 }
5064 ObDereferenceObject(WinStaObject);
5065 }
5066 else
5067 {
5068 Menu = IntCreateMenu(&Handle, !PopupMenu, GetW32ThreadInfo()->rpdesk, GetW32ProcessInfo());
5069 }
5070
5071 if (Menu) UserDereferenceObject(Menu);
5072 return (HMENU)Handle;
5073}
ULONG Handle
Definition: gdb_input.c:15
struct _PROCESSINFO * GetW32ProcessInfo(VOID)
Definition: misc.c:795
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:801
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
NTSTATUS FASTCALL IntValidateWindowStationHandle(HWINSTA WindowStation, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PWINSTATION_OBJECT *Object, POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
Definition: winsta.c:232
PVOID Win32WindowStation
Definition: pstypes.h:1308
struct _DESKTOP * rpdesk
Definition: ntuser.h:219
PROCDESKHEAD head
Definition: ntuser.h:412
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
PMENU FASTCALL IntCreateMenu(_Out_ PHANDLE Handle, _In_ BOOL IsMenuBar, _In_ PDESKTOP Desktop, _In_ PPROCESSINFO ppi)
Definition: menu.c:731
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Referenced by MENU_GetSystemMenu(), and NtUserCallNoParam().

◆ UserDestroyInputContext()

BOOLEAN UserDestroyInputContext ( PVOID  Object)

Definition at line 1484 of file ime.c.

1485{
1486 PIMC pIMC = Object;
1487 if (!pIMC)
1488 return TRUE;
1489
1492 return TRUE;
1493}
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 5807 of file menu.c.

5808{
5809 PMENU Menu;
5811
5812 if(!(Menu = UserGetMenuObject(hMenu)))
5813 {
5814 return FALSE;
5815 }
5816
5817 if (Menu->head.rpdesk != pti->rpdesk)
5818 {
5820 return FALSE;
5821 }
5822 return IntDestroyMenuObject(Menu, FALSE);
5823}
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:319

Referenced by MENU_GetSystemMenu().

◆ UserDrawCaptionBar()

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

Definition at line 922 of file nonclient.c.

926{
928 RECT WindowRect, CurrentRect, TempRect;
929 HPEN PreviousPen;
930 BOOL Gradient = FALSE;
931 PCURICON_OBJECT pIcon = NULL;
932
933 if (!(Flags & DC_NOVISIBLE) && !IntIsWindowVisible(pWnd)) return;
934
935 TRACE("UserDrawCaptionBar: pWnd %p, hDc %p, Flags 0x%x.\n", pWnd, hDC, Flags);
936
937 Style = pWnd->style;
938 ExStyle = pWnd->ExStyle;
939
940 IntGetWindowRect(pWnd, &WindowRect);
941
942 CurrentRect.top = CurrentRect.left = 0;
943 CurrentRect.right = WindowRect.right - WindowRect.left;
944 CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
945
946 /* Draw outer edge */
948 {
949 DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
950 }
951 else if (ExStyle & WS_EX_STATICEDGE)
952 {
953#if 0
955#else
957 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
958 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
959
961 NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
962 NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
963
964 RECTL_vInflateRect(&CurrentRect, -1, -1);
965#endif
966 }
967
968 if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, (Flags & DC_ACTIVE), Style, ExStyle);
969
970 /* Draw caption */
971 if ((Style & WS_CAPTION) == WS_CAPTION)
972 {
973 TempRect = CurrentRect;
974
975 Flags |= DC_TEXT|DC_BUTTONS; // Icon will be checked if not already set.
976
977 if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
978 {
979 Flags |= DC_GRADIENT;
980 }
981
983 {
985 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
987 }
988 else
989 {
990 TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
991 CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
992 }
993
994 if (!(Flags & DC_ICON) &&
995 !(Flags & DC_SMALLCAP) &&
996 (Style & WS_SYSMENU) &&
998 {
999 pIcon = NC_IconForWindow(pWnd); // Force redraw of caption with icon if DC_ICON not flaged....
1000 }
1001 UserDrawCaption(pWnd, hDC, &TempRect, NULL, pIcon ? UserHMGetHandle(pIcon) : NULL, NULL, Flags);
1002
1003 /* Draw buttons */
1004 if (Style & WS_SYSMENU)
1005 {
1008 {
1011 }
1012 }
1013
1014 if (!(Style & WS_MINIMIZE))
1015 {
1016 /* Line under caption */
1017 PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1018
1021
1022 GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1023
1024 NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1025
1026 NtGdiSelectPen(hDC, PreviousPen);
1027 }
1028 }
1029
1030 if (!(Style & WS_MINIMIZE))
1031 {
1032 /* Draw menu bar */
1033 if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1034 {
1035 PMENU menu;
1036 if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1037 {
1038 TempRect = CurrentRect;
1039 TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1040 CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1041 }
1042 }
1043
1045 {
1046 DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1047 }
1048 }
1049}
#define DC_NOVISIBLE
Definition: undocuser.h:147
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:703
#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 734 of file nonclient.c.

735{
736 PCURICON_OBJECT WindowIcon;
737 BOOL Ret = FALSE;
738
739 if ((WindowIcon = NC_IconForWindow(pWnd)))
740 {
741 UserReferenceObject(WindowIcon);
742
743 Ret = UserDrawIconEx(hDC,
744 Rect->left + 2,
745 Rect->top + 2,
746 WindowIcon,
749 0, NULL, DI_NORMAL);
750
751 UserDereferenceObject(WindowIcon);
752 }
753 return Ret;
754}
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
#define DI_NORMAL
Definition: wingdi.h:72

Referenced by MENU_DrawMenuItem(), and NC_HandleNCLButtonDown().

◆ UserFreeInputContext()

VOID UserFreeInputContext ( PVOID  Object)

Definition at line 1457 of file ime.c.

1458{
1459 PTHRDESKHEAD ObjHead = Object;
1460 PDESKTOP pDesk = ObjHead->rpdesk;
1461 PIMC pNode, pIMC = Object;
1462 PTHREADINFO pti;
1463
1464 if (!pIMC)
1465 return;
1466
1467 // Remove pIMC from the list except spDefaultImc
1468 pti = pIMC->head.pti;
1469 for (pNode = pti->spDefaultImc; pNode; pNode = pNode->pImcNext)
1470 {
1471 if (pNode->pImcNext == pIMC)
1472 {
1473 pNode->pImcNext = pIMC->pImcNext;
1474 break;
1475 }
1476 }
1477
1478 DesktopHeapFree(pDesk, Object);
1479
1480 pti->ppi->UserHandleCount--;
1482}
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:171

◆ UserGetActiveWindow()

HWND FASTCALL UserGetActiveWindow ( VOID  )

Definition at line 1429 of file focus.c.

1430{
1431 PTHREADINFO pti;
1432 PUSER_MESSAGE_QUEUE ThreadQueue;
1433
1435 ThreadQueue = pti->MessageQueue;
1436 return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
1437}

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

◆ UserGetAncestor()

PWND FASTCALL UserGetAncestor ( PWND  Wnd,
UINT  Type 
)

Definition at line 3334 of file window.c.

3335{
3336 PWND WndAncestor, Parent;
3337
3338 if (Wnd->head.h == IntGetDesktopWindow())
3339 {
3340 return NULL;
3341 }
3342
3343 switch (Type)
3344 {
3345 case GA_PARENT:
3346 {
3347 WndAncestor = Wnd->spwndParent;
3348 break;
3349 }
3350
3351 case GA_ROOT:
3352 {
3353 WndAncestor = Wnd;
3354 Parent = NULL;
3355
3356 for(;;)
3357 {
3358 if(!(Parent = WndAncestor->spwndParent))
3359 {
3360 break;
3361 }
3363 {
3364 break;
3365 }
3366
3367 WndAncestor = Parent;
3368 }
3369 break;
3370 }
3371
3372 case GA_ROOTOWNER:
3373 {
3374 WndAncestor = Wnd;
3375
3376 for (;;)
3377 {
3378 Parent = IntGetParent(WndAncestor);
3379
3380 if (!Parent)
3381 {
3382 break;
3383 }
3384
3385 WndAncestor = Parent;
3386 }
3387 break;
3388 }
3389
3390 default:
3391 {
3392 return NULL;
3393 }
3394 }
3395
3396 return WndAncestor;
3397}
Type
Definition: Type.h:7
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1374
#define IntIsDesktopWindow(WndObj)
Definition: window.h:25
#define GA_ROOT
Definition: winuser.h:2779
#define GA_ROOTOWNER
Definition: winuser.h:2780

Referenced by co_WinPosActivateOtherWindow(), co_WinPosSetWindowPos(), IntDefWindowProc(), MENU_TrackKbdMenuBar(), MENU_TrackMouseMenuBar(), NC_HandleNCLButtonDown(), NtUserGetAncestor(), and WinPosFixupFlags().

◆ UserGetDCEx()

◆ UserGetForegroundWindow()

HWND FASTCALL UserGetForegroundWindow ( VOID  )

Definition at line 1421 of file focus.c.

1422{
1423 PUSER_MESSAGE_QUEUE ForegroundQueue;
1424
1425 ForegroundQueue = IntGetFocusMessageQueue();
1426 return( ForegroundQueue ? (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : 0) : 0);
1427}

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

◆ UserGetKeyboardLayout()

HKL FASTCALL UserGetKeyboardLayout ( DWORD  dwThreadId)

Definition at line 1032 of file kbdlayout.c.

1034{
1035 PTHREADINFO pti;
1036 PLIST_ENTRY ListEntry;
1037 PKL pKl;
1038
1040
1041 if (!dwThreadId)
1042 {
1043 pKl = pti->KeyboardLayout;
1044 return pKl ? pKl->hkl : NULL;
1045 }
1046
1047 ListEntry = pti->rpdesk->PtiList.Flink;
1048
1049 //
1050 // Search the Desktop Thread list for related Desktop active Threads.
1051 //
1052 while(ListEntry != &pti->rpdesk->PtiList)
1053 {
1054 pti = CONTAINING_RECORD(ListEntry, THREADINFO, PtiLink);
1055
1056 if (PsGetThreadId(pti->pEThread) == UlongToHandle(dwThreadId))
1057 {
1058 pKl = pti->KeyboardLayout;
1059 return pKl ? pKl->hkl : NULL;
1060 }
1061
1062 ListEntry = ListEntry->Flink;
1063 }
1064
1065 return NULL;
1066}
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 1560 of file keyboard.c.

1562{
1563 switch (dwTypeFlag)
1564 {
1565 case 0: /* Keyboard type */
1567 case 1: /* Keyboard Subtype */
1569 case 2: /* Number of F-keys */
1570 return (