ReactOS  0.4.14-dev-115-g4576127
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)
 
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)
 

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); \
} \
}
Definition: send.c:47
struct _HEAD * PHEAD

Definition at line 13 of file userfuncs.h.

◆ DUMP_REFS

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

Definition at line 44 of file userfuncs.h.

Function Documentation

◆ _scwprintf()

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

Definition at line 13 of file _scwprintf.c.

16 {
17  int len;
18  va_list args;
19 
22  va_end(args);
23 
24  return len;
25 }
Definition: match.c:390
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
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 va_start(ap, A)
Definition: acmsvcex.h:91
#define args
Definition: format.c:66

Referenced by UserpFormatMessages().

◆ co_DestroyThreadWindows()

VOID FASTCALL co_DestroyThreadWindows ( struct _ETHREAD Thread)

◆ co_UserDestroyWindow()

BOOLEAN co_UserDestroyWindow ( PVOID  Object)

Definition at line 2644 of file window.c.

2645 {
2646  HWND hWnd;
2647  PWND pwndTemp;
2648  PTHREADINFO ti;
2649  MSG msg;
2650  PWND Window = Object;
2651 
2652  ASSERT_REFS_CO(Window); // FIXME: Temp HACK?
2653 
2654  hWnd = Window->head.h;
2656 
2657  TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
2658 
2659  /* Check for owner thread */
2660  if ( Window->head.pti != PsGetCurrentThreadWin32Thread())
2661  {
2662  /* Check if we are destroying the desktop window */
2663  if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
2664  {
2666  return FALSE;
2667  }
2668  }
2669 
2670  /* If window was created successfully and it is hooked */
2671  if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
2672  {
2674  {
2675  ERR("Destroy Window WH_CBT Call Hook return!\n");
2676  return FALSE;
2677  }
2678  }
2679 
2680  if (Window->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME])
2681  {
2682  if ((Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2683  {
2684  if (Window->spwndOwner)
2685  {
2686  //ERR("DestroyWindow Owner out.\n");
2687  UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE);
2688  }
2689  }
2690  }
2691 
2692  /* Inform the parent */
2693  if (Window->style & WS_CHILD)
2694  {
2696  }
2697 
2698  if (!Window->spwndOwner && !IntGetParent(Window))
2699  {
2701  }
2702 
2703  /* Hide the window */
2704  if (Window->style & WS_VISIBLE)
2705  {
2706  if (Window->style & WS_CHILD)
2707  {
2708  /* Only child windows receive WM_SHOWWINDOW in DestroyWindow() */
2710  }
2711  else
2712  {
2714  }
2715  }
2716 
2717  /* Adjust last active */
2718  if ((pwndTemp = Window->spwndOwner))
2719  {
2720  while (pwndTemp->spwndOwner)
2721  pwndTemp = pwndTemp->spwndOwner;
2722 
2723  if (pwndTemp->spwndLastActive == Window)
2724  pwndTemp->spwndLastActive = Window->spwndOwner;
2725  }
2726 
2727  if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
2728  {
2729  if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
2730  {
2732  {
2733  //ERR("DestroyWindow Parent out.\n");
2734  UserAttachThreadInput(Window->head.pti, Window->spwndParent->head.pti, FALSE);
2735  }
2736  }
2737  }
2738 
2739  if (Window->head.pti->MessageQueue->spwndActive == Window)
2740  Window->head.pti->MessageQueue->spwndActive = NULL;
2741  if (Window->head.pti->MessageQueue->spwndFocus == Window)
2742  Window->head.pti->MessageQueue->spwndFocus = NULL;
2743  if (Window->head.pti->MessageQueue->spwndActivePrev == Window)
2744  Window->head.pti->MessageQueue->spwndActivePrev = NULL;
2745  if (Window->head.pti->MessageQueue->spwndCapture == Window)
2746  Window->head.pti->MessageQueue->spwndCapture = NULL;
2747 
2748  /*
2749  * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL
2750  */
2751 
2752  if ((ti != NULL) && (ti->pDeskInfo != NULL))
2753  {
2754  if (ti->pDeskInfo->hShellWindow == hWnd)
2755  {
2756  ERR("Destroying the ShellWindow!\n");
2757  ti->pDeskInfo->hShellWindow = NULL;
2758  }
2759  }
2760 
2762 
2764  {
2765  return TRUE;
2766  }
2767 
2768  /* Recursively destroy owned windows */
2769  if (!(Window->style & WS_CHILD))
2770  {
2771  HWND* List;
2772  HWND* phWnd;
2773  PWND pWnd;
2774 
2776  if (List)
2777  {
2778  for (phWnd = List; *phWnd; ++phWnd)
2779  {
2780  pWnd = ValidateHwndNoErr(*phWnd);
2781  if (pWnd == NULL)
2782  continue;
2783  ASSERT(pWnd->spwndOwner == Window);
2784  ASSERT(pWnd != Window);
2785 
2786  pWnd->spwndOwner = NULL;
2788  {
2790  UserRefObjectCo(pWnd, &Ref); // Temp HACK?
2791  co_UserDestroyWindow(pWnd);
2792  UserDerefObjectCo(pWnd); // Temp HACK?
2793  }
2794  else
2795  {
2796  ERR("IntWndBelongsToThread(0x%p) is FALSE, ignoring.\n", pWnd);
2797  }
2798  }
2799 
2801  }
2802  }
2803 
2804  /* Generate mouse move message for the next window */
2805  msg.message = WM_MOUSEMOVE;
2806  msg.wParam = UserGetMouseButtonsState();
2807  msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
2808  msg.pt = gpsi->ptCursor;
2810 
2811  IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2812 
2813  /* Send destroy messages */
2815 
2817  {
2818  return TRUE;
2819  }
2820 
2821  /* Destroy the window storage */
2823 
2824  return TRUE;
2825 }
#define TRUE
Definition: types.h:120
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:546
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:479
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:31
#define SW_HIDE
Definition: winuser.h:762
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
#define OBJID_WINDOW
Definition: winable.h:15
HWND hWnd
Definition: settings.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
HWND *FASTCALL IntWinListOwnedPopups(PWND Window)
Definition: window.c:287
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define SWP_NOZORDER
Definition: winuser.h:1232
PSERVERINFO gpsi
Definition: main.c:27
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
#define SWP_HIDEWINDOW
Definition: winuser.h:1226
Definition: window.c:29
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define WOC_DELETE
Definition: winddi.h:1269
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define CHILDID_SELF
Definition: winable.h:14
struct _WND * spwndOwner
Definition: ntuser.h:679
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
#define WH_CBT
Definition: winuser.h:35
#define WM_DESTROY
Definition: winuser.h:1591
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2644
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static void IntSendDestroyMsg(HWND hWnd)
Definition: window.c:433
LIST_ENTRY List
Definition: psmgr.c:57
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:638
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
static IUnknown Object
Definition: main.c:512
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:331
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
#define ICLS_IME
Definition: ntuser.h:888
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1241
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
struct _WND * spwndLastActive
Definition: ntuser.h:703
#define DF_DESTROYED
Definition: desktop.h:50
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
#define WS_POPUP
Definition: pedump.c:616
#define WM_MOUSEMOVE
Definition: winuser.h:1757
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
#define msg(x)
Definition: auth_time.c:54
#define SWP_NOMOVE
Definition: winuser.h:1229
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USERTAG_WINDOWLIST
Definition: tags.h:297
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:92
#define WS_VISIBLE
Definition: pedump.c:620
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1503
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1013

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

◆ co_UserSetFocus()

HWND FASTCALL co_UserSetFocus ( PWND  Window)

Definition at line 1196 of file focus.c.

1197 {
1198  HWND hWndPrev = 0;
1199  PWND pwndTop;
1200  PTHREADINFO pti;
1201  PUSER_MESSAGE_QUEUE ThreadQueue;
1202 
1203  if (Window)
1205 
1207  ThreadQueue = pti->MessageQueue;
1208  ASSERT(ThreadQueue != 0);
1209 
1210  TRACE("Enter SetFocus hWnd 0x%p pti 0x%p\n",Window ? UserHMGetHandle(Window) : 0, pti );
1211 
1212  hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1213 
1214  if (Window != 0)
1215  {
1216  if (hWndPrev == UserHMGetHandle(Window))
1217  {
1218  return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0; /* Nothing to do */
1219  }
1220 
1221  if (Window->head.pti->MessageQueue != ThreadQueue)
1222  {
1223  ERR("SetFocus Must have the same Q!\n");
1224  return 0;
1225  }
1226 
1227  /* Check if we can set the focus to this window */
1229  for (pwndTop = Window; pwndTop; pwndTop = pwndTop->spwndParent)
1230  {
1231  if (pwndTop->style & (WS_MINIMIZED|WS_DISABLED)) return 0;
1232  if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break;
1233  if (pwndTop->spwndParent == NULL) break;
1234  }
1236  if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)Window->head.h, (LPARAM)hWndPrev))
1237  {
1238  ERR("SetFocus 1 WH_CBT Call Hook return!\n");
1239  return 0;
1240  }
1241 
1242  /* Activate pwndTop if needed. */
1243  if (pwndTop != ThreadQueue->spwndActive)
1244  {
1245  PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); // Keep it based on desktop.
1246  if (ThreadQueue != ForegroundQueue && IsAllowedFGActive(pti, pwndTop)) // Rule 2 & 3.
1247  {
1248  //ERR("SetFocus: Set Foreground!\n");
1249  if (!(pwndTop->style & WS_VISIBLE))
1250  {
1251  pti->ppi->W32PF_flags |= W32PF_ALLOWFOREGROUNDACTIVATE;
1252  }
1254  {
1255  ERR("SetFocus: Set Foreground and Focus Failed!\n");
1256  return 0;
1257  }
1258  }
1259 
1260  /* Set Active when it is needed. */
1261  if (pwndTop != ThreadQueue->spwndActive)
1262  {
1263  //ERR("SetFocus: Set Active! %p\n",pwndTop?UserHMGetHandle(pwndTop):0);
1264  if (!co_IntSetActiveWindow(pwndTop, FALSE, FALSE, FALSE))
1265  {
1266  ERR("SetFocus: Set Active Failed!\n");
1267  return 0;
1268  }
1269  }
1270 
1271  /* Abort if window destroyed */
1272  if (Window->state2 & WNDS2_INDESTROY) return 0;
1273  /* Do not change focus if the window is no longer active */
1274  if (pwndTop != ThreadQueue->spwndActive)
1275  {
1276  ERR("SetFocus: Top window did not go active!\n");
1277  return 0;
1278  }
1279  }
1280 
1281  // Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
1282  hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
1283 
1285 
1286  TRACE("Focus: %p -> %p\n", hWndPrev, Window->head.h);
1287  }
1288  else /* NULL hwnd passed in */
1289  {
1290  if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)0, (LPARAM)hWndPrev))
1291  {
1292  ERR("SetFocus: 2 WH_CBT Call Hook return!\n");
1293  return 0;
1294  }
1295  //ERR("SetFocus: Set Focus NULL\n");
1296  /* set the current thread focus window null */
1297  IntSendFocusMessages( pti, NULL);
1298  }
1299  return hWndPrev ? (IntIsWindow(hWndPrev) ? hWndPrev : 0) : 0;
1300 }
#define WS_DISABLED
Definition: pedump.c:621
#define TRUE
Definition: types.h:120
BOOL FASTCALL co_IntSetActiveWindow(_In_ PWND Wnd, _In_ BOOL bMouse, _In_ BOOL bFocus, _In_ BOOL Async)
Definition: focus.c:912
VOID FASTCALL IntSendFocusMessages(PTHREADINFO pti, PWND pWnd)
Definition: focus.c:524
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define HCBT_SETFOCUS
Definition: winuser.h:64
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1271
PPROCESSINFO ppi
Definition: win32.h:87
Definition: window.c:29
#define W32PF_ALLOWFOREGROUNDACTIVATE
Definition: win32.h:12
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
#define WS_MINIMIZED
Definition: undocuser.h:18
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:812
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
#define WS_POPUP
Definition: pedump.c:616
struct _WND * spwndParent
Definition: ntuser.h:677
BOOL FASTCALL IsAllowedFGActive(PTHREADINFO pti, PWND Wnd)
Definition: focus.c:618
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS2_INDESTROY
Definition: ntuser.h:616
DWORD style
Definition: ntuser.h:670

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

◆ DefSetText()

BOOL APIENTRY DefSetText ( PWND  Wnd,
PCWSTR  WindowText 
)

Definition at line 4164 of file window.c.

4165 {
4167  BOOL Ret = FALSE;
4168 
4169  RtlInitUnicodeString(&UnicodeString, WindowText);
4170 
4171  if (UnicodeString.Length != 0)
4172  {
4173  if (Wnd->strName.MaximumLength > 0 &&
4174  UnicodeString.Length <= Wnd->strName.MaximumLength - sizeof(UNICODE_NULL))
4175  {
4176  ASSERT(Wnd->strName.Buffer != NULL);
4177 
4178  Wnd->strName.Length = UnicodeString.Length;
4179  Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4181  UnicodeString.Buffer,
4182  UnicodeString.Length);
4183  }
4184  else
4185  {
4186  PWCHAR buf;
4187  Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4188  buf = Wnd->strName.Buffer;
4189  Wnd->strName.Buffer = NULL;
4190  if (buf != NULL)
4191  {
4192  DesktopHeapFree(Wnd->head.rpdesk, buf);
4193  }
4194 
4196  UnicodeString.Length + sizeof(UNICODE_NULL));
4197  if (Wnd->strName.Buffer != NULL)
4198  {
4199  Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4201  UnicodeString.Buffer,
4202  UnicodeString.Length);
4203  Wnd->strName.MaximumLength = UnicodeString.Length + sizeof(UNICODE_NULL);
4204  Wnd->strName.Length = UnicodeString.Length;
4205  }
4206  else
4207  {
4209  goto Exit;
4210  }
4211  }
4212  }
4213  else
4214  {
4215  Wnd->strName.Length = 0;
4216  if (Wnd->strName.Buffer != NULL)
4217  Wnd->strName.Buffer[0] = L'\0';
4218  }
4219 
4220  // FIXME: HAX! Windows does not do this in here!
4221  // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4222  // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4223  /* Send shell notifications */
4224  if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4225  {
4226  co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) UserHMGetHandle(Wnd), FALSE); // FIXME Flashing?
4227  }
4228 
4229  Ret = TRUE;
4230 Exit:
4232  return Ret;
4233 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
struct _DESKTOP * rpdesk
Definition: ntuser.h:189
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
UINT_PTR WPARAM
Definition: windef.h:207
uint16_t * PWCHAR
Definition: typedefs.h:54
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:230
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _WND * spwndOwner
Definition: ntuser.h:679
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
LARGE_UNICODE_STRING strName
Definition: ntuser.h:700
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void Exit(void)
Definition: sock.c:1331
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:239
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ DefWndControlColor()

HBRUSH FASTCALL DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 33 of file defwnd.c.

34 {
35  if (ctlType == CTLCOLOR_SCROLLBAR)
36  {
40  IntGdiSetBkColor(hDC, bk);
41 
42  /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
43  * we better use 0x55aa bitmap brush to make scrollbar's background
44  * look different from the window background.
45  */
46  if ( bk == IntGetSysColor(COLOR_WINDOW))
47  return gpsi->hbrGray;
48 
50  return hb;
51  }
52 
54 
55  if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
56  {
58  }
59  else
60  {
63  }
64 
66 }
#define COLOR_3DHILIGHT
Definition: winuser.h:927
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:946
#define COLOR_WINDOW
Definition: winuser.h:908
PSERVERINFO gpsi
Definition: main.c:27
#define COLOR_3DFACE
Definition: winuser.h:919
#define COLOR_SCROLLBAR
Definition: winuser.h:902
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
__kernel_entry W32KAPI BOOL APIENTRY NtGdiUnrealizeObject(_In_ HANDLE h)
DWORD COLORREF
Definition: windef.h:285
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define CTLCOLOR_EDIT
Definition: winuser.h:942
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define CTLCOLOR_LISTBOX
Definition: winuser.h:943
static HDC hDC
Definition: 3dtext.c:33

◆ 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  DWORD ExStyleTB, StyleTB;
260  BOOL IsTaskBar;
261 
262  Style = pwnd->style;
263  ExStyle = pwnd->ExStyle;
264  iconic = (Style & WS_MINIMIZE) != 0;
265 
266  if ((Style & WS_MAXIMIZE) || !IntIsWindowVisible(pwnd)) return;
267 
268  thickframe = UserHasThickFrameStyle(Style, ExStyle) && !iconic;
269 
270  //
271  // Show window contents while dragging the window, get flag from registry data.
272  //
273  UserSystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &DragFullWindows, 0);
274 
275  pt.x = pti->ptLast.x;
276  pt.y = pti->ptLast.y;
277  capturePoint = pt;
278  UserClipCursor( NULL );
279 
280  TRACE("pwnd %p command %04lx, hittest %d, pos %d,%d\n",
281  pwnd, syscommand, hittest, pt.x, pt.y);
282 
283  if (syscommand == SC_MOVE)
284  {
285  if (!hittest) hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
286  if (!hittest) return;
287  }
288  else /* SC_SIZE */
289  {
290  if (!thickframe) return;
291  if (hittest && (syscommand != SC_MOUSEMENU))
292  {
293  hittest += (HTLEFT - WMSZ_LEFT);
294  }
295  else
296  {
298  hittest = DefWndStartSizeMove(pwnd, wParam, &capturePoint);
299  if (!hittest)
300  {
302  return;
303  }
304  }
305  }
306 
307  /* Get min/max info */
308 
309  co_WinPosGetMinMaxInfo(pwnd, NULL, NULL, &minTrack, &maxTrack);
310  sizingRect = pwnd->rcWindow;
311  origRect = sizingRect;
312  if (Style & WS_CHILD)
313  {
314  pWndParent = IntGetParent(pwnd);
315  IntGetClientRect( pWndParent, &mouseRect );
316  IntMapWindowPoints( pWndParent, 0, (LPPOINT)&mouseRect, 2 );
317  IntMapWindowPoints( 0, pWndParent, (LPPOINT)&sizingRect, 2 );
318  unmodRect = sizingRect;
319  }
320  else
321  {
322  if (!(ExStyle & WS_EX_TOPMOST))
323  {
324  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
325  }
326  else
327  {
329  }
330  unmodRect = sizingRect;
331  }
332 
333  if (ON_LEFT_BORDER(hittest))
334  {
335  mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
336  mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
337  }
338  else if (ON_RIGHT_BORDER(hittest))
339  {
340  mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
341  mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
342  }
343  if (ON_TOP_BORDER(hittest))
344  {
345  mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
346  mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
347  }
348  else if (ON_BOTTOM_BORDER(hittest))
349  {
350  mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
351  mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
352  }
353 
354  hdc = UserGetDCEx( pWndParent, 0, DCX_CACHE );
355  if (iconic)
356  {
357  DragCursor = pwnd->pcls->spicn;
358  if (DragCursor)
359  {
360  UserReferenceObject(DragCursor);
361  }
362  else
363  {
364  HCURSOR CursorHandle = (HCURSOR)co_IntSendMessage( UserHMGetHandle(pwnd), WM_QUERYDRAGICON, 0, 0 );
365  if (CursorHandle)
366  {
367  DragCursor = UserGetCurIconObject(CursorHandle);
368  }
369  else
370  {
371  iconic = FALSE;
372  }
373  }
374  }
375 
376  /* repaint the window before moving it around */
378 
379  IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZESTART, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
380 
382 
384 
386 
387  pwnd->head.pti->TIF_flags |= TIF_MOVESIZETRACKING;
388 
389  for(;;)
390  {
391  int dx = 0, dy = 0;
392 
393  if (!co_IntGetPeekMessage(&msg, 0, 0, 0, PM_REMOVE, TRUE)) break;
394  if (IntCallMsgFilter( &msg, MSGF_SIZE )) continue;
395 
396  /* Exit on button-up */
397  if (msg.message == WM_LBUTTONUP)
398  {
399  /* Test for typical TaskBar ExStyle Values */
400  ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
401  TRACE("ExStyle is '%x'.\n", ExStyleTB);
402 
403  /* Test for typical TaskBar Style Values */
404  StyleTB = (Style & (WS_POPUP | WS_VISIBLE |
406  TRACE("Style is '%x'.\n", StyleTB);
407 
408  /* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
409  IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
410  && (ExStyleTB == WS_EX_TOOLWINDOW);
411  TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");
412 
413  // check for snapping if was moved by caption
414  if (hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
415  {
416  RECT snapRect;
417  BOOL doSideSnap = FALSE;
418  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
419 
420  /* if this is the taskbar, then we want to just exit */
421  if (IsTaskBar)
422  {
423  break;
424  }
425  // snap to left
426  if (pt.x <= snapRect.left)
427  {
428  snapRect.right = (snapRect.right - snapRect.left) / 2 + snapRect.left;
429  doSideSnap = TRUE;
430  }
431  // snap to right
432  if (pt.x >= snapRect.right-1)
433  {
434  snapRect.left = (snapRect.right - snapRect.left) / 2 + snapRect.left;
435  doSideSnap = TRUE;
436  }
437 
438  if (doSideSnap)
439  {
441  0,
442  snapRect.left,
443  snapRect.top,
444  snapRect.right - snapRect.left,
445  snapRect.bottom - snapRect.top,
446  0);
447  pwnd->InternalPos.NormalRect = origRect;
448  }
449  else
450  {
451  // maximize if on dragged to top
452  if (pt.y <= snapRect.top)
453  {
455  pwnd->InternalPos.NormalRect = origRect;
456  }
457  }
458  }
459  break;
460  }
461 
462  /* Exit on Return or Esc */
463  if (msg.message == WM_KEYDOWN &&
464  (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE))
465  {
466  break;
467  }
468 
469  if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE))
470  {
471  IntTranslateKbdMessage( &msg , 0 );
473  continue; /* We are not interested in other messages */
474  }
475 
476  pt = msg.pt;
477 
478  if (msg.message == WM_KEYDOWN) switch(msg.wParam)
479  {
480  case VK_UP: pt.y -= 8; break;
481  case VK_DOWN: pt.y += 8; break;
482  case VK_LEFT: pt.x -= 8; break;
483  case VK_RIGHT: pt.x += 8; break;
484  }
485 
486  pt.x = max( pt.x, mouseRect.left );
487  pt.x = min( pt.x, mouseRect.right - 1 );
488  pt.y = max( pt.y, mouseRect.top );
489  pt.y = min( pt.y, mouseRect.bottom - 1 );
490 
491  dx = pt.x - capturePoint.x;
492  dy = pt.y - capturePoint.y;
493 
494  if (dx || dy)
495  {
496  if ( !moved )
497  {
498  moved = TRUE;
499  if ( iconic ) /* ok, no system popup tracking */
500  {
501  OldCursor = UserSetCursor(DragCursor, FALSE);
502  UserShowCursor( TRUE );
503  }
504  else if(!DragFullWindows)
505  UserDrawMovingFrame( hdc, &sizingRect, thickframe );
506  }
507 
508  if (msg.message == WM_KEYDOWN) UserSetCursorPos(pt.x, pt.y, 0, 0, FALSE);
509  else
510  {
511  RECT newRect = unmodRect;
512 
513  if (!iconic && !DragFullWindows) UserDrawMovingFrame( hdc, &sizingRect, thickframe );
514  if (hittest == HTCAPTION) RECTL_vOffsetRect( &newRect, dx, dy );
515  if (ON_LEFT_BORDER(hittest)) newRect.left += dx;
516  else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx;
517  if (ON_TOP_BORDER(hittest)) newRect.top += dy;
518  else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
519  capturePoint = pt;
520 
521  //
522  // Save the new position to the unmodified rectangle. This allows explorer task bar
523  // sizing. Explorer will forces back the position unless a certain amount of sizing
524  // has occurred.
525  //
526  unmodRect = newRect;
527 
528  /* determine the hit location */
529  if (syscommand == SC_SIZE)
530  {
531  WPARAM wpSizingHit = 0;
532 
533  if (hittest >= HTLEFT && hittest <= HTBOTTOMRIGHT)
534  wpSizingHit = WMSZ_LEFT + (hittest - HTLEFT);
535  co_IntSendMessage( UserHMGetHandle(pwnd), WM_SIZING, wpSizingHit, (LPARAM)&newRect );
536  }
537  else
538  co_IntSendMessage( UserHMGetHandle(pwnd), WM_MOVING, 0, (LPARAM)&newRect );
539 
540  if (!iconic)
541  {
542  if (!DragFullWindows)
543  UserDrawMovingFrame( hdc, &newRect, thickframe );
544  else
545  { // Moving the whole window now!
546  HRGN hrgnNew;
547  HRGN hrgnOrig = GreCreateRectRgnIndirect(&pwnd->rcWindow);
548 
549  if (pwnd->hrgnClip != NULL)
550  NtGdiCombineRgn(hrgnOrig, hrgnOrig, pwnd->hrgnClip, RGN_AND);
551 
553  //IntMapWindowPoints( 0, pWndParent, (POINT *)&rect, 2 );
554  co_WinPosSetWindowPos( pwnd,
555  0,
556  newRect.left,
557  newRect.top,
558  newRect.right - newRect.left,
559  newRect.bottom - newRect.top,
560  ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
561 
562  hrgnNew = GreCreateRectRgnIndirect(&pwnd->rcWindow);
563  if (pwnd->hrgnClip != NULL)
564  NtGdiCombineRgn(hrgnNew, hrgnNew, pwnd->hrgnClip, RGN_AND);
565 
566  if (hrgnNew)
567  {
568  if (hrgnOrig)
569  NtGdiCombineRgn(hrgnOrig, hrgnOrig, hrgnNew, RGN_DIFF);
570  }
571  else
572  {
573  if (hrgnOrig)
574  {
575  GreDeleteObject(hrgnOrig);
576  hrgnOrig = 0;
577  }
578  }
579 
580  // Update all the windows after the move or size, including this window.
581  UpdateThreadWindows(UserGetDesktopWindow()->spwndChild, pti, hrgnOrig);
582 
583  if (hrgnOrig) GreDeleteObject(hrgnOrig);
584  if (hrgnNew) GreDeleteObject(hrgnNew);
585  }
586  }
587  sizingRect = newRect;
588  }
589  }
590  }
591 
592  pwnd->head.pti->TIF_flags &= ~TIF_MOVESIZETRACKING;
593 
595 
596  if ( iconic )
597  {
598  if ( moved ) /* restore cursors, show icon title later on */
599  {
601  OldCursor = UserSetCursor(OldCursor, FALSE);
602  }
603 
604  /* It could be that the cursor was already changed while we were proceeding,
605  * so we must unreference whatever cursor was current at the time we restored the old one.
606  * Maybe it is DragCursor, but maybe it is another one and DragCursor got already freed.
607  */
608  if (OldCursor) UserDereferenceObject(OldCursor);
609  }
610  else if ( moved && !DragFullWindows )
611  UserDrawMovingFrame( hdc, &sizingRect, thickframe );
612 
614 
616  //if (pWndParent) IntMapWindowPoints( 0, pWndParent, (POINT *)&sizingRect, 2 );
617 
619  {
620  ERR("DoSizeMove : WH_CBT Call Hook return!\n");
621  moved = FALSE;
622  }
623 
624  IntNotifyWinEvent( EVENT_SYSTEM_MOVESIZEEND, pwnd, OBJID_WINDOW, CHILDID_SELF, 0);
625 
627 
632  /* window moved or resized */
633  if (moved)
634  {
635  /* if the moving/resizing isn't canceled call SetWindowPos
636  * with the new position or the new size of the window
637  */
638  if (!((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
639  {
640  /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
641  if (!DragFullWindows || iconic )
642  {
643  co_WinPosSetWindowPos( pwnd,
644  0,
645  sizingRect.left,
646  sizingRect.top,
647  sizingRect.right - sizingRect.left,
648  sizingRect.bottom - sizingRect.top,
649  ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
650  }
651  }
652  else
653  { /* restore previous size/position */
654  if ( DragFullWindows )
655  {
656  co_WinPosSetWindowPos( pwnd,
657  0,
658  origRect.left,
659  origRect.top,
660  origRect.right - origRect.left,
661  origRect.bottom - origRect.top,
662  ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
663  }
664  }
665  }
666 
667  if ( IntIsWindow(UserHMGetHandle(pwnd)) )
668  {
669  if ( iconic )
670  {
671  /* Single click brings up the system menu when iconized */
672  if ( !moved )
673  {
674  if( Style & WS_SYSMENU )
676  }
677  }
678  }
679 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define HTLEFT
Definition: winuser.h:2462
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3548
#define max(a, b)
Definition: svc.c:63
DWORD ExStyle
Definition: ntuser.h:668
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
#define TIF_MOVESIZETRACKING
Definition: ntuser.h:255
long y
Definition: polytest.cpp:48
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
LRESULT FASTCALL IntDispatchMessage(PMSG pMsg)
Definition: message.c:682
long x
Definition: polytest.cpp:48
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1412
#define pt(x, y)
Definition: drawing.c:79
BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags)
Definition: keyboard.c:1136
GLint dy
Definition: linetemp.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
static HDC
Definition: imagelist.c:92
#define OBJID_WINDOW
Definition: winable.h:15
LONG top
Definition: windef.h:292
#define VK_LEFT
Definition: winuser.h:2199
#define WM_EXITSIZEMOVE
Definition: winuser.h:1806
int UserShowCursor(BOOL bShow)
Definition: msgqueue.c:168
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define SC_MOUSEMENU
Definition: winuser.h:2570
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
BOOL FASTCALL IntCallMsgFilter(LPMSG lpmsg, INT code)
Definition: message.c:1974
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_DOWN
Definition: winuser.h:2202
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
HICON HCURSOR
Definition: windef.h:284
#define VK_ESCAPE
Definition: winuser.h:2189
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
BOOL UserSetCursorPos(INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: cursoricon.c:238
#define VK_RETURN
Definition: winuser.h:2176
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:553
WPARAM wParam
Definition: combotst.c:138
#define RGN_AND
Definition: wingdi.h:355
#define WM_QUERYDRAGICON
Definition: winuser.h:1636
#define SM_CXSCREEN
Definition: winuser.h:949
#define ON_RIGHT_BORDER(hit)
Definition: nonclient.c:27
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define HTSYSMENU
Definition: winuser.h:2452
#define VK_UP
Definition: winuser.h:2200
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define MSGF_SIZE
Definition: winuser.h:1163
#define CHILDID_SELF
Definition: winable.h:14
#define SC_MAXIMIZE
Definition: winuser.h:2563
#define GreCreateRectRgnIndirect(prc)
Definition: region.h:96
#define WM_SIZING
Definition: winuser.h:1789
THRDESKHEAD head
Definition: ntuser.h:659
#define MAKELONG(a, b)
Definition: typedefs.h:248
VOID FASTCALL UserDrawMovingFrame(HDC hdc, RECTL *rect, BOOL thickframe)
Definition: nonclient.c:56
smooth NULL
Definition: ftsmooth.c:416
HRGN hrgnClip
Definition: ntuser.h:697
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define WH_CBT
Definition: winuser.h:35
BOOL APIENTRY UserClipCursor(RECTL *prcl)
Definition: cursoricon.c:700
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:931
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define SM_CYSCREEN
Definition: winuser.h:950
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2533
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1340
#define ON_BOTTOM_BORDER(hit)
Definition: nonclient.c:31
LONG FASTCALL DefWndStartSizeMove(PWND Wnd, WPARAM wParam, POINT *capturePoint)
Definition: nonclient.c:140
const DWORD Style
Definition: appswitch.c:71
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:157
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:170
#define WM_MOVING
Definition: winuser.h:1791
static const WCHAR L[]
Definition: oid.c:1250
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HDC hdc
Definition: main.c:9
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WM_SETVISIBLE
Definition: undocuser.h:31
RECT rcWindow
Definition: ntuser.h:680
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
HWND APIENTRY IntGetCapture(VOID)
Definition: focus.c:1322
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
POINT ptLast
Definition: win32.h:127
#define VK_RIGHT
Definition: winuser.h:2201
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
#define HTCAPTION
Definition: winuser.h:2451
Definition: ntuser.h:657
VOID FASTCALL UpdateThreadWindows(PWND pWnd, PTHREADINFO pti, HRGN hRgn)
Definition: painting.c:1081
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
FORCEINLINE VOID RECTL_vSetRect(_Out_ RECTL *prcl, _In_ LONG left, _In_ LONG top, _In_ LONG right, _In_ LONG bottom)
Definition: rect.h:5
#define DCX_CACHE
Definition: winuser.h:2096
BOOL APIENTRY co_IntGetPeekMessage(PMSG pMsg, HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, UINT RemoveMsg, BOOL bGMSG)
Definition: message.c:1015
#define RGN_DIFF
Definition: wingdi.h:357
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define SC_SIZE
Definition: winuser.h:2559
#define WM_LBUTTONUP
Definition: winuser.h:1759
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:143
#define ON_TOP_BORDER(hit)
Definition: nonclient.c:29
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
#define WM_MOUSEMOVE
Definition: winuser.h:1757
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
GLint dx
Definition: linetemp.h:97
#define msg(x)
Definition: auth_time.c:54
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define SC_MOVE
Definition: winuser.h:2560
#define HCBT_MOVESIZE
Definition: winuser.h:55
unsigned int ULONG
Definition: retypes.h:1
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
LONG bottom
Definition: windef.h:294
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
#define PM_REMOVE
Definition: winuser.h:1182
struct _WND::@4119 InternalPos
PCURICON_OBJECT FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange)
Definition: msgqueue.c:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define WM_ENTERSIZEMOVE
Definition: winuser.h:1805
#define WMSZ_LEFT
Definition: winuser.h:2439
#define ON_LEFT_BORDER(hit)
Definition: nonclient.c:25
const DWORD ExStyle
Definition: appswitch.c:72
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697
PCLS pcls
Definition: ntuser.h:684
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:670

Referenced by DefWndHandleSysCommand().

◆ GetControlBrush()

HBRUSH FASTCALL GetControlBrush ( PWND  ,
HDC  ,
UINT   
)

Definition at line 171 of file misc.c.

175 {
176  PWND pwndParent = IntGetParent(pwnd);
177  return GetControlColor( pwndParent, pwnd, hdc, ctlType);
178 }
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
HDC hdc
Definition: main.c:9
Definition: ntuser.h:657
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185

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

◆ GetControlColor()

HBRUSH FASTCALL GetControlColor ( PWND  ,
PWND  ,
HDC  ,
UINT   
)

Definition at line 145 of file misc.c.

150 {
151  HBRUSH hBrush;
152 
153  if (!pwndParent) pwndParent = pwnd;
154 
155  if ( pwndParent->head.pti->ppi != PsGetCurrentProcessWin32Process())
156  {
157  return (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
158  }
159 
160  hBrush = (HBRUSH)co_IntSendMessage( UserHMGetHandle(pwndParent), CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd));
161 
162  if (!hBrush || !GreIsHandleValid(hBrush))
163  {
164  hBrush = (HBRUSH)IntDefWindowProc( pwndParent, CtlMsg, (WPARAM)hdc, (LPARAM)UserHMGetHandle(pwnd), FALSE);
165  }
166  return hBrush;
167 }
LRESULT FASTCALL IntDefWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
Definition: defwnd.c:532
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
UINT_PTR WPARAM
Definition: windef.h:207
LONG_PTR LPARAM
Definition: windef.h:208
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HDC hdc
Definition: main.c:9
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183

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 }
#define TRUE
Definition: types.h:120
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
BYTE is_Layered
Definition: layered.c:17
ATOM AtomLayer
Definition: ntuser.c:21

Referenced by NtUserUpdateLayeredWindow().

◆ GetProcessLuid()

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

Definition at line 789 of file misc.c.

793 {
798 
799  if (Thread && Process)
801 
802  /* If nothing has been specified, use the current thread */
803  if (!Thread && !Process)
805 
806  if (Thread)
807  {
808  /* Use a thread token */
809  ASSERT(!Process);
811  &CopyOnOpen,
812  &EffectiveOnly,
814 
815  /* If we don't have a thread token, use a process token */
816  if (!Token)
818  }
819  if (!Token && Process)
820  {
821  /* Use a process token */
823 
824  /* If we don't have a token, fail */
825  if (!Token)
826  return STATUS_NO_TOKEN;
827  }
828  ASSERT(Token);
829 
830  /* Query the LUID */
832 
833  /* Get rid of the token and return */
835  return Status;
836 }
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI SeQueryAuthenticationIdToken(IN PACCESS_TOKEN Token, OUT PLUID LogonId)
Definition: token.c:1752
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
PEPROCESS PsGetThreadProcess(_In_ PETHREAD Thread)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
#define STATUS_NO_TOKEN
Definition: ntstatus.h:346
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
Status
Definition: gdiplustypes.h:24
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:782
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN EffectiveOnly
Definition: sefuncs.h:417

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

◆ InitMetrics()

BOOL NTAPI InitMetrics ( VOID  )

Definition at line 19 of file metric.c.

20 {
21  INT *piSysMet = gpsi->aiSysMet;
22  ULONG Width, Height;
23 
24  /* Note: used for the SM_CLEANBOOT metric */
25  DWORD dwValue = 0;
26  HKEY hKey = 0;
27 
28  /* Clean boot */
29  piSysMet[SM_CLEANBOOT] = 0; // Fallback value of 0 (normal mode)
30  if(NT_SUCCESS(RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", &hKey)))
31  {
32  if(RegReadDWORD(hKey, L"OptionValue", &dwValue)) piSysMet[SM_CLEANBOOT] = (INT)dwValue;
33  ZwClose(hKey);
34  }
35 
36  /* FIXME: HACK, due to missing PDEV on first init */
37  if (!gppdevPrimary)
38  {
39  Width = 640;
40  Height = 480;
41  }
42  else
43  {
46  }
47 
48  /* Screen sizes */
49  piSysMet[SM_CXSCREEN] = Width;
50  piSysMet[SM_CYSCREEN] = Height;
51  piSysMet[SM_XVIRTUALSCREEN] = 0;
52  piSysMet[SM_YVIRTUALSCREEN] = 0;
53  piSysMet[SM_CXVIRTUALSCREEN] = Width;
54  piSysMet[SM_CYVIRTUALSCREEN] = Height;
55 
56  /* NC area sizes */
57  piSysMet[SM_CYCAPTION] = gspv.ncm.iCaptionHeight + 1; // 19
58  piSysMet[SM_CYSMCAPTION] = gspv.ncm.iSmCaptionHeight + 1; // 15;
59  piSysMet[SM_CXSIZE] = gspv.ncm.iCaptionHeight; // 18;
60  piSysMet[SM_CYSIZE] = gspv.ncm.iCaptionHeight; // 18;
61  piSysMet[SM_CXSMSIZE] = gspv.ncm.iSmCaptionWidth; // 12; XP: piSysMet(SM_CYSMCAPTION) - 1
62  piSysMet[SM_CYSMSIZE] = gspv.ncm.iSmCaptionHeight; // 14;
63  piSysMet[SM_CXBORDER] = 1; // Seems to be hardcoded
64  piSysMet[SM_CYBORDER] = 1; // Seems to be hardcoded
65  piSysMet[SM_CXFOCUSBORDER] = 1;
66  piSysMet[SM_CYFOCUSBORDER] = 1;
67  piSysMet[SM_CXDLGFRAME] = 3;
68  piSysMet[SM_CYDLGFRAME] = 3;
69  piSysMet[SM_CXEDGE] = 2;
70  piSysMet[SM_CYEDGE] = 2;
71  piSysMet[SM_CXFRAME] = piSysMet[SM_CXDLGFRAME] + gspv.ncm.iBorderWidth; // 4
72  piSysMet[SM_CYFRAME] = piSysMet[SM_CYDLGFRAME] + gspv.ncm.iBorderWidth; // 4
73 #if (_WIN32_WINNT >= 0x0600)
74  piSysMet[SM_CXPADDEDBORDER] = 0;
75 #endif
76 
77  /* Window sizes */
78  TRACE("ncm.iCaptionWidth=%d,GetSystemMetrics(SM_CYSIZE)=%d,GetSystemMetrics(SM_CXFRAME)=%d,avcwCaption=%d \n",
79  gspv.ncm.iCaptionWidth, piSysMet[SM_CYSIZE],piSysMet[SM_CXFRAME], gspv.tmCaptionFont.tmAveCharWidth);
80 
81  piSysMet[SM_CXMIN] = 3 * max(gspv.ncm.iCaptionWidth, 8) // 112
82  + piSysMet[SM_CYSIZE] + 4
84  + 2 * piSysMet[SM_CXFRAME];
85  piSysMet[SM_CYMIN] = piSysMet[SM_CYCAPTION] + 2 * piSysMet[SM_CYFRAME]; // 27
86  piSysMet[SM_CXMAXIMIZED] = piSysMet[SM_CXSCREEN] + 2 * piSysMet[SM_CXFRAME];
87  piSysMet[SM_CYMAXIMIZED] = piSysMet[SM_CYSCREEN] - 20;
88  piSysMet[SM_CXFULLSCREEN] = piSysMet[SM_CXSCREEN];
89  piSysMet[SM_CYFULLSCREEN] = piSysMet[SM_CYMAXIMIZED] - piSysMet[SM_CYMIN];
90  piSysMet[SM_CYKANJIWINDOW] = 0;
91  piSysMet[SM_CXMINIMIZED] = gspv.mm.iWidth + 6;
92  piSysMet[SM_CYMINIMIZED] = piSysMet[SM_CYCAPTION] + 5;
93  piSysMet[SM_CXMINSPACING] = piSysMet[SM_CXMINIMIZED] + gspv.mm.iHorzGap;
94  piSysMet[SM_CYMINSPACING] = piSysMet[SM_CYMINIMIZED] + gspv.mm.iVertGap;
95  piSysMet[SM_CXMAXTRACK] = piSysMet[SM_CXVIRTUALSCREEN] + 4
96  + 2 * piSysMet[SM_CXFRAME];
97  piSysMet[SM_CYMAXTRACK] = piSysMet[SM_CYVIRTUALSCREEN] + 4
98  + 2 * piSysMet[SM_CYFRAME];
99 
100  /* Icon */
101  piSysMet[SM_CXVSCROLL] = gspv.ncm.iScrollWidth; // 16;
102  piSysMet[SM_CYVTHUMB] = gspv.ncm.iScrollHeight; // 16;
103  piSysMet[SM_CYHSCROLL] = gspv.ncm.iScrollWidth; // 16;
104  piSysMet[SM_CXHTHUMB] = gspv.ncm.iScrollHeight; // 16;
105  piSysMet[SM_CYVSCROLL] = gspv.ncm.iScrollHeight; // 16
106  piSysMet[SM_CXHSCROLL] = gspv.ncm.iScrollHeight; // 16;
107  piSysMet[SM_CXICON] = 32;
108  piSysMet[SM_CYICON] = 32;
109  piSysMet[SM_CXSMICON] = 16;
110  piSysMet[SM_CYSMICON] = 16;
111  piSysMet[SM_CXICONSPACING] = gspv.im.iHorzSpacing; // 64;
112  piSysMet[SM_CYICONSPACING] = gspv.im.iVertSpacing; // 64;
113  piSysMet[SM_CXCURSOR] = 32;
114  piSysMet[SM_CYCURSOR] = 32;
115  piSysMet[SM_CXMINTRACK] = piSysMet[SM_CXMIN]; // 117
116  piSysMet[SM_CYMINTRACK] = piSysMet[SM_CYMIN]; // 27
117  piSysMet[SM_CXDRAG] = 4;
118  piSysMet[SM_CYDRAG] = 4;
119  piSysMet[SM_ARRANGE] = gspv.mm.iArrange; // 8;
120 
121  /* Menu */
122  piSysMet[SM_CYMENU] = gspv.ncm.iMenuHeight + 1; // 19;
124  piSysMet[SM_CXMENUCHECK] = ((1 + gspv.tmMenuFont.tmHeight +
125  gspv.tmMenuFont.tmExternalLeading) & ~1) - 1; // 13;
126  piSysMet[SM_CYMENUCHECK] = piSysMet[SM_CXMENUCHECK];
127  piSysMet[SM_CXMENUSIZE] = gspv.ncm.iMenuWidth; // 18;
128  piSysMet[SM_CYMENUSIZE] = gspv.ncm.iMenuHeight; // 18;
129 
130  /* Mouse */
131  piSysMet[SM_MOUSEPRESENT] = 1;
132  piSysMet[SM_MOUSEWHEELPRESENT] = 1;
133  piSysMet[SM_CMOUSEBUTTONS] = 2;
134  piSysMet[SM_SWAPBUTTON] = gspv.bMouseBtnSwap ? 1 : 0;
135  piSysMet[SM_CXDOUBLECLK] = gspv.iDblClickWidth;
136  piSysMet[SM_CYDOUBLECLK] = gspv.iDblClickHeight;
137 #if (_WIN32_WINNT >= 0x0600)
138  piSysMet[SM_MOUSEHORIZONTALWHEELPRESENT] = 0;
139 #endif
140 
141  /* Version info */
142  piSysMet[SM_TABLETPC] = 0;
143  piSysMet[SM_MEDIACENTER] = 0;
144  piSysMet[SM_STARTER] = 0;
145  piSysMet[SM_SERVERR2] = 0;
146  piSysMet[SM_PENWINDOWS] = 0;
147 
148  /* Other */
149  piSysMet[SM_DEBUG] = 0;
150  piSysMet[SM_NETWORK] = 3;
151  piSysMet[SM_SLOWMACHINE] = 0;
152  piSysMet[SM_SECURE] = 0;
153  piSysMet[SM_DBCSENABLED] = 0;
154  piSysMet[SM_SHOWSOUNDS] = gspv.bShowSounds;
155  piSysMet[SM_MIDEASTENABLED] = 0;
156  piSysMet[SM_CMONITORS] = 1;
157  piSysMet[SM_SAMEDISPLAYFORMAT] = 1;
158  piSysMet[SM_IMMENABLED] = 0;
159 
160  /* Reserved */
161  piSysMet[SM_RESERVED1] = 0;
162  piSysMet[SM_RESERVED2] = 0;
163  piSysMet[SM_RESERVED3] = 0;
164  piSysMet[SM_RESERVED4] = 0;
165  piSysMet[64] = 0;
166  piSysMet[65] = 0;
167  piSysMet[66] = 0;
168 #if (_WIN32_WINNT >= 0x0600)
169  piSysMet[90] = 0;
170 #endif
171 
173  Setup = TRUE;
174 
175  return TRUE;
176 }
#define SM_CXICONSPACING
Definition: winuser.h:991
#define max(a, b)
Definition: svc.c:63
#define SM_CYDOUBLECLK
Definition: winuser.h:990
#define SM_CYHSCROLL
Definition: winuser.h:952
#define TRUE
Definition: types.h:120
#define SM_SHOWSOUNDS
Definition: winuser.h:1020
#define SM_CYSIZE
Definition: winuser.h:982
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
#define SM_CYMENUSIZE
Definition: winuser.h:1008
LONG tmExternalLeading
Definition: wingdi.h:2382
#define SM_CMONITORS
Definition: winuser.h:1030
#define SM_CYMINTRACK
Definition: winuser.h:988
#define SM_MOUSEPRESENT
Definition: winuser.h:970
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
#define SM_CXMINIMIZED
Definition: winuser.h:1010
BOOL bMouseBtnSwap
Definition: sysparams.h:82
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
GDIINFO gdiinfo
Definition: pdevobj.h:124
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
#define SM_MIDEASTENABLED
Definition: winuser.h:1024
LONG tmAveCharWidth
Definition: wingdi.h:2383
#define SM_SLOWMACHINE
Definition: winuser.h:1023
#define INT
Definition: polytest.cpp:20
#define SM_CYVSCROLL
Definition: winuser.h:971
NONCLIENTMETRICSW ncm
Definition: sysparams.h:51
#define SM_CXMENUCHECK
Definition: winuser.h:1021
#define SM_CYCURSOR
Definition: winuser.h:965
#define SM_CMOUSEBUTTONS
Definition: winuser.h:996
#define SM_CXEDGE
Definition: winuser.h:998
#define SM_CYSMICON
Definition: winuser.h:1003
#define SM_NETWORK
Definition: winuser.h:1016
#define SM_CYMAXTRACK
Definition: winuser.h:1013
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
PSERVERINFO gpsi
Definition: main.c:27
int32_t INT
Definition: typedefs.h:56
#define SM_CXMINSPACING
Definition: winuser.h:1000
#define SM_CXSCREEN
Definition: winuser.h:949
#define SM_CYMENUCHECK
Definition: winuser.h:1022
DWORD dwSRVIFlags
Definition: ntuser.h:1004
#define SM_CYMAXIMIZED
Definition: winuser.h:1015
#define SM_CYDLGFRAME
Definition: winuser.h:958
#define SM_CXICON
Definition: winuser.h:962
#define SM_RESERVED2
Definition: winuser.h:976
ULONG ulHorzRes
Definition: winddi.h:882
#define SM_CXHTHUMB
Definition: winuser.h:961
#define SM_CYEDGE
Definition: winuser.h:999
#define SM_CXDRAG
Definition: winuser.h:1018
#define SM_SECURE
Definition: winuser.h:997
#define SM_CYVTHUMB
Definition: winuser.h:960
#define SM_PENWINDOWS
Definition: winuser.h:994
#define SM_CYMIN
Definition: winuser.h:980
TEXTMETRICW tmCaptionFont
Definition: sysparams.h:139
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
#define SM_RESERVED4
Definition: winuser.h:978
#define SM_CLEANBOOT
Definition: winuser.h:1017
#define SM_CYSMSIZE
Definition: winuser.h:1006
#define SM_CYSCREEN
Definition: winuser.h:950
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CYCAPTION
Definition: winuser.h:953
#define SM_CXHSCROLL
Definition: winuser.h:972
#define SM_CXCURSOR
Definition: winuser.h:964
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SM_CXMAXIMIZED
Definition: winuser.h:1014
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define SRVINFO_METRICS
Definition: ntuser.h:912
#define SM_CXMINTRACK
Definition: winuser.h:987
BOOL NTAPI RegReadDWORD(HKEY hkey, PWSTR pwszValue, PDWORD pdwData)
Definition: registry.c:150
#define SM_CXSMSIZE
Definition: winuser.h:1005
SPIVALUES gspv
Definition: sysparams.c:17
BOOL bShowSounds
Definition: sysparams.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_CXSMICON
Definition: winuser.h:1002
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CYICON
Definition: winuser.h:963
#define SM_CYMINIMIZED
Definition: winuser.h:1011
static const WCHAR L[]
Definition: oid.c:1250
#define SM_CYICONSPACING
Definition: winuser.h:992
BOOL bMenuDropAlign
Definition: sysparams.h:130
#define SM_CXBORDER
Definition: winuser.h:954
#define SM_MENUDROPALIGNMENT
Definition: winuser.h:993
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
#define SM_CYMINSPACING
Definition: winuser.h:1001
#define SM_RESERVED3
Definition: winuser.h:977
#define SM_ARRANGE
Definition: winuser.h:1009
#define SM_DEBUG
Definition: winuser.h:973
INT iDblClickHeight
Definition: sysparams.h:89
ICONMETRICSW im
Definition: sysparams.h:53
#define SM_SAMEDISPLAYFORMAT
Definition: winuser.h:1031
#define SM_CXVSCROLL
Definition: winuser.h:951
TEXTMETRICW tmMenuFont
Definition: sysparams.h:138
#define SM_SWAPBUTTON
Definition: winuser.h:974
#define SM_CXMAXTRACK
Definition: winuser.h:1012
#define SM_CYFULLSCREEN
Definition: winuser.h:968
#define SM_CXSIZE
Definition: winuser.h:981
unsigned int ULONG
Definition: retypes.h:1
INT iDblClickWidth
Definition: sysparams.h:88
#define SM_CYKANJIWINDOW
Definition: winuser.h:969
#define SM_CXFULLSCREEN
Definition: winuser.h:967
#define SM_CYMENU
Definition: winuser.h:966
#define SM_CYDRAG
Definition: winuser.h:1019
static BOOL Setup
Definition: metric.c:13
LONG tmHeight
Definition: wingdi.h:2378
ULONG ulVertRes
Definition: winddi.h:883
#define SM_DBCSENABLED
Definition: winuser.h:995
#define RegOpenKey
Definition: winreg.h:519
#define SM_MOUSEWHEELPRESENT
Definition: winuser.h:1025
#define SM_RESERVED1
Definition: winuser.h:975
#define SM_CYSMCAPTION
Definition: winuser.h:1004
#define SM_CXDOUBLECLK
Definition: winuser.h:989
MINIMIZEDMETRICS mm
Definition: sysparams.h:52
#define SM_CXMIN
Definition: winuser.h:979
#define SM_CXMENUSIZE
Definition: winuser.h:1007

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

◆ InitSessionImpl()

NTSTATUS FASTCALL InitSessionImpl ( VOID  )

Definition at line 18 of file session.c.

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

Referenced by InitUserImpl().

◆ InitThreadCallback()

NTSTATUS NTAPI InitThreadCallback ( PETHREAD  Thread)

Definition at line 438 of file main.c.

439 {
441  PCLIENTINFO pci;
442  PTHREADINFO ptiCurrent;
443  int i;
445  PTEB pTeb;
446  PRTL_USER_PROCESS_PARAMETERS ProcessParams;
447 
448  Process = Thread->ThreadsProcess;
449 
450  pTeb = NtCurrentTeb();
451  ASSERT(pTeb);
452 
453  ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
454 
455  /* Allocate a new Win32 thread info */
456  Status = AllocW32Thread(Thread, &ptiCurrent);
457  if (!NT_SUCCESS(Status))
458  {
459  ERR_CH(UserThread, "Failed to allocate pti for TID:0x%lx\n",
461  return Status;
462  }
463 
464  /* Initialize the THREADINFO */
465  ptiCurrent->pEThread = Thread;
466  ptiCurrent->ppi = PsGetProcessWin32Process(Process);
467  IntReferenceProcessInfo(ptiCurrent->ppi);
468  pTeb->Win32ThreadInfo = ptiCurrent;
469  ptiCurrent->pClientInfo = (PCLIENTINFO)pTeb->Win32ClientInfo;
470 
471  /* Mark the process as having threads */
472  ptiCurrent->ppi->W32PF_flags |= W32PF_THREADCONNECTED;
473 
474  InitializeListHead(&ptiCurrent->WindowListHead);
478  InitializeListHead(&ptiCurrent->PtiLink);
479  for (i = 0; i < NB_HOOKS; i++)
480  {
481  InitializeListHead(&ptiCurrent->aphkStart[i]);
482  }
483  ptiCurrent->ptiSibling = ptiCurrent->ppi->ptiList;
484  ptiCurrent->ppi->ptiList = ptiCurrent;
485  ptiCurrent->ppi->cThreads++;
486 
487  ptiCurrent->hEventQueueClient = NULL;
488  Status = ZwCreateEvent(&ptiCurrent->hEventQueueClient, EVENT_ALL_ACCESS,
490  if (!NT_SUCCESS(Status))
491  {
492  ERR_CH(UserThread, "Event creation failed, Status 0x%08x.\n", Status);
493  goto error;
494  }
497  (PVOID*)&ptiCurrent->pEventQueueServer, NULL);
498  if (!NT_SUCCESS(Status))
499  {
500  ERR_CH(UserThread, "Failed referencing the event object, Status 0x%08x.\n", Status);
502  ptiCurrent->hEventQueueClient = NULL;
503  goto error;
504  }
505 
506  ptiCurrent->timeLast = EngGetTickCount32();
507  ptiCurrent->MessageQueue = MsqCreateMessageQueue(ptiCurrent);
508  if (ptiCurrent->MessageQueue == NULL)
509  {
510  ERR_CH(UserThread, "Failed to allocate message loop\n");
512  goto error;
513  }
514 
515  ptiCurrent->KeyboardLayout = W32kGetDefaultKeyLayout();
516  if (ptiCurrent->KeyboardLayout)
517  UserReferenceObject(ptiCurrent->KeyboardLayout);
518 
519  ptiCurrent->TIF_flags &= ~TIF_INCLEANUP;
520 
521  // FIXME: Flag SYSTEM threads with... TIF_SYSTEMTHREAD !!
522 
523  /* CSRSS threads have some special features */
524  if (Process == gpepCSRSS || !gpepCSRSS)
526 
527  ptiCurrent->pcti = &ptiCurrent->cti;
528 
529  /* Initialize the CLIENTINFO */
530  pci = (PCLIENTINFO)pTeb->Win32ClientInfo;
531  RtlZeroMemory(pci, sizeof(*pci));
532  pci->ppi = ptiCurrent->ppi;
533  pci->fsHooks = ptiCurrent->fsHooks;
534  pci->dwTIFlags = ptiCurrent->TIF_flags;
535  if (ptiCurrent->KeyboardLayout)
536  {
537  pci->hKL = ptiCurrent->KeyboardLayout->hkl;
538  pci->CodePage = ptiCurrent->KeyboardLayout->CodePage;
539  }
540 
541  /* Need to pass the user Startup Information to the current process. */
542  if ( ProcessParams )
543  {
544  if ( ptiCurrent->ppi->usi.cb == 0 ) // Not initialized yet.
545  {
546  if ( ProcessParams->WindowFlags != 0 ) // Need window flags set.
547  {
548  ptiCurrent->ppi->usi.cb = sizeof(USERSTARTUPINFO);
549  ptiCurrent->ppi->usi.dwX = ProcessParams->StartingX;
550  ptiCurrent->ppi->usi.dwY = ProcessParams->StartingY;
551  ptiCurrent->ppi->usi.dwXSize = ProcessParams->CountX;
552  ptiCurrent->ppi->usi.dwYSize = ProcessParams->CountY;
553  ptiCurrent->ppi->usi.dwFlags = ProcessParams->WindowFlags;
554  ptiCurrent->ppi->usi.wShowWindow = (WORD)ProcessParams->ShowWindowFlags;
555  }
556  }
557  }
558 
559  /*
560  * Assign a default window station and desktop to the process.
561  * Do not try to open a desktop or window station before the very first
562  * (interactive) window station has been created by Winlogon.
563  */
564  if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) &&
565  ptiCurrent->ppi->hdeskStartup == NULL &&
567  {
568  HWINSTA hWinSta = NULL;
569  HDESK hDesk = NULL;
570  UNICODE_STRING DesktopPath;
571  PDESKTOP pdesk;
572 
573  /*
574  * Inherit the thread desktop and process window station (if not yet inherited)
575  * from the process startup info structure. See documentation of CreateProcess().
576  */
578  if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)
579  {
580  Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo);
581  }
582  if (!NT_SUCCESS(Status))
583  {
584  RtlInitUnicodeString(&DesktopPath, NULL);
585  }
586 
588  &DesktopPath,
589  !!(ProcessParams->WindowFlags & STARTF_INHERITDESKTOP),
590  &hWinSta,
591  &hDesk);
592 
593  if (DesktopPath.Buffer)
594  ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING);
595 
596  if (!NT_SUCCESS(Status))
597  {
598  ERR_CH(UserThread, "Failed to assign default desktop and winsta to process\n");
599  goto error;
600  }
601 
602  if (!UserSetProcessWindowStation(hWinSta))
603  {
605  ERR_CH(UserThread, "Failed to set initial process winsta\n");
606  goto error;
607  }
608 
609  /* Validate the new desktop */
610  Status = IntValidateDesktopHandle(hDesk, UserMode, 0, &pdesk);
611  if (!NT_SUCCESS(Status))
612  {
613  ERR_CH(UserThread, "Failed to validate initial desktop handle\n");
614  goto error;
615  }
616 
617  /* Store the parsed desktop as the initial desktop */
618  ASSERT(ptiCurrent->ppi->hdeskStartup == NULL);
619  ASSERT(Process->UniqueProcessId != gpidLogon);
620  ptiCurrent->ppi->hdeskStartup = hDesk;
621  ptiCurrent->ppi->rpdeskStartup = pdesk;
622  }
623 
624  if (ptiCurrent->ppi->hdeskStartup != NULL)
625  {
626  if (!IntSetThreadDesktop(ptiCurrent->ppi->hdeskStartup, FALSE))
627  {
628  ERR_CH(UserThread, "Failed to set thread desktop\n");
630  goto error;
631  }
632  }
633 
634  /* Mark the thread as fully initialized */
635  ptiCurrent->TIF_flags |= TIF_GUITHREADINITIALIZED;
636 
637  if (!(ptiCurrent->ppi->W32PF_flags & (W32PF_ALLOWFOREGROUNDACTIVATE | W32PF_APPSTARTING)) &&
638  (gptiForeground && gptiForeground->ppi == ptiCurrent->ppi ))
639  {
640  ptiCurrent->TIF_flags |= TIF_ALLOWFOREGROUNDACTIVATE;
641  }
642  ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
643 
644  /* Last things to do only if we are not a SYSTEM or CSRSS thread */
645  if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)))
646  {
647  /* Callback to User32 Client Thread Setup */
648  TRACE_CH(UserThread, "Call co_IntClientThreadSetup...\n");
650  if (!NT_SUCCESS(Status))
651  {
652  ERR_CH(UserThread, "ClientThreadSetup failed with Status 0x%08lx\n", Status);
653  goto error;
654  }
655  TRACE_CH(UserThread, "co_IntClientThreadSetup succeeded!\n");
656  }
657  else
658  {
659  TRACE_CH(UserThread, "co_IntClientThreadSetup cannot be called...\n");
660  }
661 
662  TRACE_CH(UserThread, "UserCreateW32Thread pti 0x%p\n", ptiCurrent);
663  return STATUS_SUCCESS;
664 
665 error:
666  ERR_CH(UserThread, "InitThreadCallback failed! Freeing pti 0x%p for TID:0x%lx\n",
667  ptiCurrent, HandleToUlong(Thread->Cid.UniqueThread));
669  return Status;
670 }
ULONG fsHooks
Definition: ntuser.h:296
USERSTARTUPINFO usi
Definition: win32.h:269
ULONG Win32ClientInfo[31]
Definition: compat.h:496
PPEB ProcessEnvironmentBlock
Definition: ntddk_ex.h:337
#define error(str)
Definition: mkdosfs.c:1605
PVOID Win32ThreadInfo
Definition: compat.h:495
LIST_ENTRY WindowListHead
Definition: win32.h:149
PTHREADINFO ptiSibling
Definition: win32.h:115
#define TIF_DONTATTACHQUEUE
Definition: ntuser.h:246
#define EngGetTickCount32()
Definition: eng.h:43
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
FLONG TIF_flags
Definition: win32.h:94
PWINSTATION_OBJECT InputWindowStation
Definition: winsta.c:21
PEPROCESS gpepCSRSS
Definition: csr.c:15
LONG NTSTATUS
Definition: precomp.h:26
#define HandleToUlong(h)
Definition: basetsd.h:79
LIST_ENTRY PtiLink
Definition: win32.h:125
UNICODE_STRING DesktopInfo
Definition: rtltypes.h:1526
#define TIF_SYSTEMTHREAD
Definition: ntuser.h:242
POBJECT_TYPE ExEventObjectType
Definition: event.c:22
PPROCESSINFO ppi
Definition: win32.h:87
PTHREADINFO gptiForeground
Definition: focus.c:14
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 W32PF_ALLOWFOREGROUNDACTIVATE
Definition: win32.h:12
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:496
HDESK hdeskStartup
Definition: win32.h:254
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:657
#define TIF_CSRSSTHREAD
Definition: ntuser.h:243
#define TAG_STRING
Definition: oslist.h:22
LIST_ENTRY SentMessagesListHead
Definition: win32.h:99
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
NTSTATUS AllocW32Thread(IN PETHREAD Thread, OUT PTHREADINFO *W32Thread)
Definition: main.c:365
#define STARTF_INHERITDESKTOP
Definition: undocuser.h:162
smooth NULL
Definition: ftsmooth.c:416
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:177
LIST_ENTRY W32CallbackListHead
Definition: win32.h:150
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:264
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:90
#define TIF_ALLOWFOREGROUNDACTIVATE
Definition: ntuser.h:245
INT cThreads
Definition: win32.h:253
ULONG fsHooks
Definition: win32.h:116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(PTHREADINFO pti)
Definition: msgqueue.c:2422
CLIENT_ID Cid
Definition: pstypes.h:1059
struct _DESKTOP * rpdeskStartup
Definition: win32.h:249
PKEVENT pEventQueueServer
Definition: win32.h:124
unsigned short WORD
Definition: ntddk_ex.h:93
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
struct _CLIENTINFO * pClientInfo
Definition: win32.h:93
HKL hKL
Definition: ntuser.h:307
HANDLE UniqueThread
Definition: compat.h:475
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
LONG timeLast
Definition: win32.h:101
struct _CLIENTINFO * PCLIENTINFO
BOOL FASTCALL UserSetProcessWindowStation(HWINSTA hWindowStation)
Definition: winsta.c:1346
#define NB_HOOKS
Definition: ntuser.h:130
LIST_ENTRY aphkStart[NB_HOOKS]
FIXME!
Definition: win32.h:137
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1817
CLIENTTHREADINFO cti
Definition: win32.h:138
NTSTATUS NTAPI ExitThreadCallback(PETHREAD Thread)
Definition: main.c:677
struct tagKL * KeyboardLayout
Definition: win32.h:89
Status
Definition: gdiplustypes.h:24
HANDLE hEventQueueClient
Definition: win32.h:122
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
Definition: compat.h:484
USHORT CodePage
Definition: ntuser.h:308
#define TRACE_CH(ch, fmt,...)
Definition: debug.h:107
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
LIST_ENTRY PostedMessagesListHead
Definition: win32.h:131
BOOL IntSetThreadDesktop(IN HDESK hDesktop, IN BOOL FreeOnFailure)
Definition: desktop.c:3211
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct tagUSERSTARTUPINFO USERSTARTUPINFO
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
PKL W32kGetDefaultKeyLayout(VOID)
Definition: kbdlayout.c:343
NTSTATUS FASTCALL IntResolveDesktop(IN PEPROCESS Process, IN PUNICODE_STRING DesktopPath, IN BOOL bInherit, OUT HWINSTA *phWinSta, OUT HDESK *phDesktop)
Definition: desktop.c:535
NTSTATUS FASTCALL IntValidateDesktopHandle(HDESK Desktop, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PDESKTOP *Object)
Definition: desktop.c:1200
NTSTATUS APIENTRY co_IntClientThreadSetup(VOID)
Definition: callback.c:948
#define W32PF_APPSTARTING
Definition: win32.h:10
#define ERR_CH(ch, fmt,...)
Definition: debug.h:104
WORD wShowWindow
Definition: win32.h:214
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PTHREADINFO ptiList
Definition: win32.h:247
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _PROCESSINFO * ppi
Definition: ntuser.h:314
return STATUS_SUCCESS
Definition: btrfs.c:2966
DWORD dwTIFlags
Definition: ntuser.h:292
#define TIF_INCLEANUP
Definition: ntuser.h:240
#define W32PF_THREADCONNECTED
Definition: win32.h:18
HANDLE gpidLogon
Definition: simplecall.c:15
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697

Referenced by Win32kThreadCallback().

◆ IntClearWindowState()

VOID FASTCALL IntClearWindowState ( PWND  ,
UINT   
)

Definition at line 590 of file misc.c.

591 {
592  UINT bit;
593  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
594  bit = 1 << LOWORD(Flag);
595  TRACE("CWS %x\n",bit);
596  switch(HIWORD(Flag))
597  {
598  case 0:
599  pWnd->state &= ~bit;
600  break;
601  case 1:
602  pWnd->state2 &= ~bit;
603  break;
604  case 2:
605  pWnd->ExStyle2 &= ~bit;
606  break;
607  }
608 }
PPROCESSINFO ppi
Definition: win32.h:87
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: xml2sdb.h:79
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NtUserCallHwndParam().

◆ IntDdeGetMessageHook()

BOOL APIENTRY IntDdeGetMessageHook ( PMSG  ,
LONG_PTR   
)

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 
352  ExFreePoolWithTag(pddeProp, USERTAG_DDE1);
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 
374  ExFreePoolWithTag(pddeData, USERTAG_DDE5);
375 
376  return Ret;
377  }
378  TRACE("DDE Get No DDE Data found!\n");
379  return TRUE;
380 }
struct _DDE_DATA * PDDE_DATA
#define TRUE
Definition: types.h:120
PVOID pvBuffer
Definition: dde.c:32
#define USERTAG_DDE
Definition: tags.h:222
#define USERTAG_DDE1
Definition: tags.h:210
#define USERTAG_DDE5
Definition: tags.h:213
LPARAM lParam
Definition: dde.c:30
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_DDE_TERMINATE
Definition: dde.h:38
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define TRACE(s)
Definition: solgame.cpp:4
struct _DDE_PROP * PDDE_PROP
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
Definition: dde.c:35
ATOM AtomDDETrack
Definition: ntuser.c:23
BOOL APIENTRY IntDDEGetCallback(IN PWND pWnd, IN OUT PMSG pMsg, IN PVOID Buffer, IN int size)
Definition: dde.c:111
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
Definition: dde.c:28
int cbSize
Definition: dde.c:31
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
HANDLE FASTCALL UserRemoveProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)

Referenced by co_IntGetPeekMessage().

◆ IntDdePostMessageHook()

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

Definition at line 172 of file dde.c.

178 {
179  PWND pWndClient;
180  PDDE_DATA pddeData;
181  int size;
182  HGDIOBJ Object = NULL;
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 LONG_PTR
Definition: treelist.c:79
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1252
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define WM_DDE_UNADVISE
Definition: dde.h:40
PVOID pvBuffer
Definition: dde.c:32
#define USERTAG_DDE
Definition: tags.h:222
Definition: dde.h:71
int APIENTRY IntDDEPostCallback(IN PWND pWnd, IN UINT Msg, IN WPARAM wParam, IN OUT LPARAM *lParam, IN OUT PVOID *Buffer)
Definition: dde.c:48
short cfFormat
Definition: dde.h:59
#define WM_DDE_REQUEST
Definition: dde.h:43
WPARAM wParam
Definition: combotst.c:138
short cfFormat
Definition: dde.h:74
#define USERTAG_DDE5
Definition: tags.h:213
PPROCESSINFO ppi
Definition: win32.h:87
LPARAM lParam
Definition: dde.c:30
#define WM_DDE_TERMINATE
Definition: dde.h:38
#define WM_DDE_DATA
Definition: dde.h:42
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: bufpool.h:45
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
BYTE Value[1]
Definition: dde.h:75
Definition: dde.h:56
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static IUnknown Object
Definition: main.c:512
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define WM_DDE_POKE
Definition: dde.h:44
#define CF_PALETTE
Definition: constants.h:404
struct @1580 Msg[]
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
Definition: dde.c:28
#define WM_DDE_INITIATE
Definition: dde.h:37
int cbSize
Definition: dde.c:31
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define WM_DDE_EXECUTE
Definition: dde.h:45
LPARAM lParam
Definition: combotst.c:139
#define NT_ASSERT
Definition: rtlfuncs.h:3312
BYTE Value[1]
Definition: dde.h:60
#define CF_DIB
Definition: constants.h:403

Referenced by UserPostMessage().

◆ IntDdeSendMessageHook()

BOOL FASTCALL IntDdeSendMessageHook ( PWND  ,
UINT  ,
WPARAM  ,
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 TRUE
Definition: types.h:120
#define USERTAG_DDE1
Definition: tags.h:210
WPARAM wParam
Definition: combotst.c:138
PPROCESSINFO ppi
Definition: win32.h:87
smooth NULL
Definition: ftsmooth.c:416
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dde.c:35
ATOM AtomDDETrack
Definition: ntuser.c:23
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct @1580 Msg[]
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define WM_DDE_INITIATE
Definition: dde.h:37
#define WM_DDE_ACK
Definition: dde.h:41
PWND spwndPartner
Definition: dde.c:38
PWND spwnd
Definition: dde.c:37

Referenced by co_IntSendMessageTimeoutSingle().

◆ IntGetWindowContextHelpId()

DWORD FASTCALL IntGetWindowContextHelpId ( PWND  pWnd)

Definition at line 410 of file window.c.

411 {
412  DWORD HelpId;
413 
414  do
415  {
417  if (!HelpId) break;
418  pWnd = IntGetParent(pWnd);
419  }
420  while (pWnd && pWnd->fnid != FNID_DESKTOP);
421  return HelpId;
422 }
#define TRUE
Definition: types.h:120
ATOM atomContextHelpIdProp
Definition: ntuser.h:1020
#define DWORD
Definition: nt_native.h:44
PSERVERINFO gpsi
Definition: main.c:27
DWORD fnid
Definition: ntuser.h:673
#define FNID_DESKTOP
Definition: ntuser.h:824
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:63
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185

Referenced by IntDefWindowProc().

◆ IntGetWindowObject()

PWND FASTCALL IntGetWindowObject ( HWND  hWnd)

Definition at line 51 of file window.c.

52 {
53  PWND Window;
54 
55  if (!hWnd) return NULL;
56 
58  if (Window)
59  Window->head.cLockObj++;
60 
61  return Window;
62 }
HWND hWnd
Definition: settings.c:17
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:657
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103

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

◆ IntSetWindowState()

VOID FASTCALL IntSetWindowState ( PWND  ,
UINT   
)

Definition at line 569 of file misc.c.

570 {
571  UINT bit;
572  if (gptiCurrent->ppi != pWnd->head.pti->ppi) return;
573  bit = 1 << LOWORD(Flag);
574  TRACE("SWS %x\n",bit);
575  switch(HIWORD(Flag))
576  {
577  case 0:
578  pWnd->state |= bit;
579  break;
580  case 1:
581  pWnd->state2 |= bit;
582  break;
583  case 2:
584  pWnd->ExStyle2 |= bit;
585  break;
586  }
587 }
PPROCESSINFO ppi
Definition: win32.h:87
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
#define TRACE(s)
Definition: solgame.cpp:4
Definition: xml2sdb.h:79
unsigned int UINT
Definition: ndis.h:50
#define HIWORD(l)
Definition: typedefs.h:246
#define LOWORD(l)
Definition: pedump.c:82

Referenced by NtUserCallHwndParam().

◆ IntTID2PTI()

PTHREADINFO FASTCALL IntTID2PTI ( HANDLE  )

Definition at line 41 of file misc.c.

42 {
45  PTHREADINFO pti;
47  if (!NT_SUCCESS(Status))
48  {
49  return NULL;
50  }
52  {
54  return NULL;
55  }
57  if (!pti)
58  {
60  return NULL;
61  }
62  // Validate and verify!
63  _SEH2_TRY
64  {
65  if (pti->TIF_flags & TIF_INCLEANUP) pti = NULL;
66  if (pti && !(pti->TIF_flags & TIF_GUITHREADINITIALIZED)) pti = NULL;
67  if (PsGetThreadId(Thread) != id) pti = NULL;
68  }
70  {
71  pti = NULL;
72  }
73  _SEH2_END
75  return pti;
76 }
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
FLONG TIF_flags
Definition: win32.h:94
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define TIF_GUITHREADINITIALIZED
Definition: ntuser.h:264
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define TIF_INCLEANUP
Definition: ntuser.h:240

Referenced by NtUserAttachThreadInput(), NtUserGetThreadDesktop(), and NtUserSetWindowsHookEx().

◆ NC_DoNCPaint()

LRESULT NC_DoNCPaint ( PWND  ,
HDC  ,
INT   
)

Definition at line 1042 of file nonclient.c.

1043 {
1044  DWORD Style, ExStyle;
1045  PWND Parent;
1046  RECT WindowRect, CurrentRect, TempRect;
1047  BOOL Active = FALSE;
1048 
1049  if (!IntIsWindowVisible(pWnd) ||
1050  (pWnd->state & WNDS_NONCPAINT && !(pWnd->state & WNDS_FORCEMENUDRAW)) ||
1051  IntEqualRect(&pWnd->rcWindow, &pWnd->rcClient) )
1052  return 0;
1053 
1054  Style = pWnd->style;
1055 
1056  TRACE("DefWndNCPaint: pWnd %p, hDc %p, Active %s.\n", pWnd, hDC, Flags & DC_ACTIVE ? "TRUE" : "FALSE");
1057 
1058  Parent = IntGetParent(pWnd);
1059  ExStyle = pWnd->ExStyle;
1060 
1061  if (Flags == -1) // NC paint mode.
1062  {
1063  if (ExStyle & WS_EX_MDICHILD)
1064  {
1066 
1067  if (Active)
1069  }
1070  else
1071  {
1072  Active = (gpqForeground == pWnd->head.pti->MessageQueue);
1073  }
1074  Flags = DC_NC; // Redraw everything!
1075  }
1076  else
1077  Flags |= DC_NC;
1078 
1079 
1080  IntGetWindowRect(pWnd, &WindowRect);
1081 
1082  CurrentRect.top = CurrentRect.left = 0;
1083  CurrentRect.right = WindowRect.right - WindowRect.left;
1084  CurrentRect.bottom = WindowRect.bottom - WindowRect.top;
1085 
1086  /* Draw outer edge */
1087  if (UserHasWindowEdge(pWnd->style, pWnd->ExStyle))
1088  {
1089  DrawEdge(hDC, &CurrentRect, EDGE_RAISED, BF_RECT | BF_ADJUST);
1090  }
1091  else if (pWnd->ExStyle & WS_EX_STATICEDGE)
1092  {
1093 #if 0
1094  DrawEdge(hDC, &CurrentRect, BDR_SUNKENINNER, BF_RECT | BF_ADJUST | BF_FLAT);
1095 #else
1097  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1098  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1099 
1101  NtGdiPatBlt(hDC, CurrentRect.left, CurrentRect.bottom - 1, CurrentRect.right - CurrentRect.left, 1, PATCOPY);
1102  NtGdiPatBlt(hDC, CurrentRect.right - 1, CurrentRect.top, 1, CurrentRect.bottom - CurrentRect.top, PATCOPY);
1103 
1104  RECTL_vInflateRect(&CurrentRect, -1, -1);
1105 #endif
1106  }
1107 
1108  if (Flags & DC_FRAME) NC_DrawFrame(hDC, &CurrentRect, Active ? Active : (Flags & DC_ACTIVE), Style, ExStyle);
1109 
1110  /* Draw caption */
1111  if ((Style & WS_CAPTION) == WS_CAPTION)
1112  {
1113  HPEN PreviousPen;
1114  BOOL Gradient = FALSE;
1115 
1116  if (Flags & DC_REDRAWHUNGWND)
1117  {
1118  Flags &= ~DC_REDRAWHUNGWND;
1119  Flags |= DC_NOSENDMSG;
1120  }
1121 
1122  if (UserSystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &Gradient, 0) && Gradient)
1123  {
1124  Flags |= DC_GRADIENT;
1125  }
1126 
1127  if (Active)
1128  {
1129  if (pWnd->state & WNDS_ACTIVEFRAME)
1130  Flags |= DC_ACTIVE;
1131  else
1132  {
1133  ERR("Wnd is active and not set active!\n");
1134  }
1135  }
1136 
1137  TempRect = CurrentRect;
1138 
1139  if (ExStyle & WS_EX_TOOLWINDOW)
1140  {
1141  Flags |= DC_SMALLCAP;
1142  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
1143  CurrentRect.top += UserGetSystemMetrics(SM_CYSMCAPTION);
1144  }
1145  else
1146  {
1147  TempRect.bottom = TempRect.top + UserGetSystemMetrics(SM_CYCAPTION) - 1;
1148  CurrentRect.top += UserGetSystemMetrics(SM_CYCAPTION);
1149  }
1150 
1151  UserDrawCaption(pWnd, hDC, &TempRect, NULL, NULL, NULL, Flags);
1152 
1153  /* Draw buttons */
1154  if (Style & WS_SYSMENU)
1155  {
1158  {
1161  }
1162  }
1163  if (!(Style & WS_MINIMIZE))
1164  {
1165  /* Line under caption */
1166  PreviousPen = NtGdiSelectPen(hDC, NtGdiGetStockObject(DC_PEN));
1167 
1171 
1172  GreMoveTo(hDC, TempRect.left, TempRect.bottom, NULL);
1173 
1174  NtGdiLineTo(hDC, TempRect.right, TempRect.bottom);
1175 
1176  NtGdiSelectPen(hDC, PreviousPen);
1177  }
1178  }
1179 
1180  if (!(Style & WS_MINIMIZE))
1181  {
1182  /* Draw menu bar */
1183  if (pWnd->state & WNDS_HASMENU && pWnd->IDMenu) // Should be pWnd->spmenu
1184  {
1185  if (!(Flags & DC_NOSENDMSG))
1186  {
1187  PMENU menu;
1188  // Fix crash in test_menu_locked_by_window, should use pWnd->spmenu....
1189  if ((menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)))) // FIXME! Use pWnd->spmenu,
1190  {
1191  TempRect = CurrentRect;
1192  TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu;
1193  CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE);
1194  }
1195  }
1196  }
1197 
1198  if (ExStyle & WS_EX_CLIENTEDGE)
1199  {
1200  DrawEdge(hDC, &CurrentRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
1201  }
1202 
1203  /* Draw the scrollbars */
1204  if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
1206  {
1207  RECT ParentClientRect;
1208 
1209  TempRect = CurrentRect;
1210 
1212  TempRect.right = TempRect.left + UserGetSystemMetrics(SM_CXVSCROLL);
1213  else
1214  TempRect.left = TempRect.right - UserGetSystemMetrics(SM_CXVSCROLL);
1215 
1216  TempRect.top = TempRect.bottom - UserGetSystemMetrics(SM_CYHSCROLL);
1217 
1219 
1220  if (Parent)
1221  {
1222  IntGetClientRect(Parent, &ParentClientRect);
1223 
1224  if (HASSIZEGRIP(Style, ExStyle, Parent->style, WindowRect, ParentClientRect))
1225  {
1227  }
1228  }
1229 
1230  IntDrawScrollBar(pWnd, hDC, SB_VERT);
1231  IntDrawScrollBar(pWnd, hDC, SB_HORZ);
1232  }
1233  else
1234  {
1236  {
1237  IntDrawScrollBar(pWnd, hDC, SB_VERT);
1238  }
1239  else if (Style & WS_HSCROLL && IntIsScrollBarVisible(pWnd, OBJID_HSCROLL))
1240  {
1241  IntDrawScrollBar(pWnd, hDC, SB_HORZ);
1242  }
1243  }
1244  }
1245  return 0; // For WM_NCPAINT message, return 0.
1246 }
#define BF_FLAT
Definition: winuser.h:471
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
#define SM_CYHSCROLL
Definition: winuser.h:952
void IntDrawScrollBar(PWND, HDC, INT)
Definition: scrollbar.c:1073
#define COLOR_WINDOWFRAME
Definition: winuser.h:909
__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:919
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
#define SB_VERT
Definition: winuser.h:553
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
BOOL IntIsScrollBarVisible(PWND pWnd, INT hBar)
Definition: nonclient.c:735
#define SB_HORZ
Definition: winuser.h:552
__kernel_entry W32KAPI HANDLE APIENTRY NtGdiGetStockObject(_In_ INT iObject)
LONG top
Definition: windef.h:292
HANDLE HWND
Definition: compat.h:13
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:925
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:722
LONG left
Definition: windef.h:291
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2742
LONG right
Definition: windef.h:293
VOID UserDrawCaptionButton(PWND pWnd, LPRECT Rect, DWORD Style, DWORD ExStyle, HDC hDC, BOOL bDown, ULONG Type)
Definition: nonclient.c:753
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define BF_ADJUST
Definition: winuser.h:470
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define BF_RECT
Definition: winuser.h:462
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__kernel_entry W32KAPI BOOL APIENTRY NtGdiLineTo(_In_ HDC hdc, _In_ INT x, _In_ INT y)
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define COLOR_3DFACE
Definition: winuser.h:919
#define BDR_SUNKENINNER
Definition: winuser.h:445
#define DC_NC
Definition: winuser.h:440
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DC_REDRAWHUNGWND
Definition: undocuser.h:150
ULONG cyMenu
Definition: ntuser.h:391
smooth NULL
Definition: ftsmooth.c:416
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
Definition: sacdrv.h:287
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define DC_ACTIVE
Definition: winuser.h:427
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define WS_CAPTION
Definition: pedump.c:624
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CYCAPTION
Definition: winuser.h:953
const DWORD Style
Definition: appswitch.c:71
#define OBJID_HSCROLL
Definition: winable.h:21
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define DFCS_SCROLLSIZEGRIP
Definition: winuser.h:494
#define DC_FRAME
Definition: undocuser.h:147
#define DFCS_CAPTIONCLOSE
Definition: winuser.h:480
VOID NC_DrawFrame(HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle)
Definition: nonclient.c:854
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define OBJID_VSCROLL
Definition: winable.h:20
#define WS_HSCROLL
Definition: pedump.c:628
#define WM_MDIGETACTIVE
Definition: winuser.h:1803
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:170
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define COLOR_BTNFACE
Definition: winuser.h:918
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
BOOL FASTCALL GreMoveTo(HDC hdc, INT x, INT y, LPPOINT pptOut)
Definition: line.c:108
#define PATCOPY
Definition: wingdi.h:334
#define EDGE_RAISED
Definition: winuser.h:450
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
static HDC hDC
Definition: 3dtext.c:33
#define DC_NOSENDMSG
Definition: undocuser.h:146
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define DC_SMALLCAP
Definition: winuser.h:428
#define WS_MINIMIZEBOX
Definition: pedump.c:631
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define COLOR_BTNSHADOW
Definition: winuser.h:920
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
#define WS_VSCROLL
Definition: pedump.c:627
#define DFCS_CAPTIONMAX
Definition: winuser.h:482
#define WNDS_NONCPAINT
Definition: ntuser.h:581
#define SM_CXVSCROLL
Definition: winuser.h:951
#define DFC_SCROLL
Definition: winuser.h:475
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
Definition: nonclient.c:34
LONG bottom
Definition: windef.h:294
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:588
#define EDGE_SUNKEN
Definition: winuser.h:451
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:882
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
#define WNDS_HASMENU
Definition: ntuser.h:573
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1004
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DFCS_CAPTIONMIN
Definition: winuser.h:481
const DWORD ExStyle
Definition: appswitch.c:72
BOOL UserDrawCaption(PWND pWnd, HDC hDc, RECTL *lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING Str, UINT uFlags)
Definition: painting.c:2182
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

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

855 {
856  /* Firstly the "thick" frame */
857  if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
858  {
859  LONG Width =
862 
863  LONG Height =
866 
868 
869  /* Draw frame */
870  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
871  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
872  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
873  NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
874 
875  RECTL_vInflateRect(CurrentRect, -Width, -Height);
876  }
877 
878  /* Now the other bit of the frame */
880  {
883 
889 
890  /* Draw frame */
891  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, CurrentRect->right - CurrentRect->left, Height, PATCOPY);
892  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->top, Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
893  NtGdiPatBlt(hDC, CurrentRect->left, CurrentRect->bottom - 1, CurrentRect->right - CurrentRect->left, -Height, PATCOPY);
894  NtGdiPatBlt(hDC, CurrentRect->right - 1, CurrentRect->top, -Width, CurrentRect->bottom - CurrentRect->top, PATCOPY);
895 
896  RECTL_vInflateRect(CurrentRect, -Width, -Height);
897  }
898 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define COLOR_WINDOWFRAME
Definition: winuser.h:909
__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:919
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
LONG top
Definition: windef.h:292
#define COLOR_INACTIVEBORDER
Definition: winuser.h:914
#define WS_DLGFRAME
Definition: pedump.c:626
LONG left
Definition: windef.h:291
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
LONG right
Definition: windef.h:293
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
#define COLOR_3DFACE
Definition: winuser.h:919
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
#define SM_CYDLGFRAME
Definition: winuser.h:958
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
Definition: sacdrv.h:287
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
const DWORD Style
Definition: appswitch.c:71
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define COLOR_ACTIVEBORDER
Definition: winuser.h:913
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
#define PATCOPY
Definition: wingdi.h:334
static HDC hDC
Definition: 3dtext.c:33
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LONG bottom
Definition: windef.h:294
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72

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 {
73  ULONG Style;
74  ULONG ExStyle;
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 }
DWORD ExStyle
Definition: ntuser.h:668
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
LONG top
Definition: windef.h:292
#define SM_CXEDGE
Definition: winuser.h:998
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SM_CYDLGFRAME
Definition: winuser.h:958
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define SM_CYEDGE
Definition: winuser.h:999
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
const DWORD Style
Definition: appswitch.c:71
#define WS_ICONIC
Definition: pedump.c:641
#define UserHasDlgFrameStyle(Style, ExStyle)
Definition: nonclient.c:14
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define SM_CYBORDER
Definition: winuser.h:955
#define UserHasThinFrameStyle(Style, ExStyle)
Definition: nonclient.c:22
#define SM_CXBORDER
Definition: winuser.h:954
RECT rcWindow
Definition: ntuser.h:680
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
unsigned int ULONG
Definition: retypes.h:1
#define UserHasThickFrameStyle(Style, ExStyle)
Definition: nonclient.c:18
LONG bottom
Definition: windef.h:294
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72
DWORD style
Definition: ntuser.h:670

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

◆ NC_GetSysPopupPos()

void FASTCALL NC_GetSysPopupPos ( PWND  ,
RECT  
)

Definition at line 117 of file nonclient.c.

118 {
119  RECT WindowRect;
120 
121  if ((Wnd->style & WS_MINIMIZE) != 0)
122  {
123  IntGetWindowRect(Wnd, Rect);
124  }
125  else
126  {
127  NC_GetInsideRect(Wnd, Rect);
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:198
LONG top
Definition: windef.h:292
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:291
#define WS_MINIMIZE
Definition: pedump.c:622
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define SM_CYCAPTION
Definition: winuser.h:953
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

Referenced by MENU_ShowSubPopup().

◆ NC_HandleNCActivate()

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

Definition at line 1382 of file nonclient.c.

1383 {
1384  INT Flags;
1385  /* Lotus Notes draws menu descriptions in the caption of its main
1386  * window. When it wants to restore original "system" view, it just
1387  * sends WM_NCACTIVATE message to itself. Any optimizations here in
1388  * attempt to minimize redrawings lead to a not restored caption.
1389  */
1390  if (wParam & DC_ACTIVE)
1391  {
1394  }
1395  else
1396  {
1397  Wnd->state &= ~WNDS_ACTIVEFRAME;
1398  wParam = DC_CAPTION;
1399  }
1400 
1401  if ((Wnd->state & WNDS_NONCPAINT) || !(Wnd->style & WS_VISIBLE))
1402  return TRUE;
1403 
1404  /* This isn't documented but is reproducible in at least XP SP2 and
1405  * Outlook 2007 depends on it
1406  */
1407  // MSDN:
1408  // If this parameter is set to -1, DefWindowProc does not repaint the
1409  // nonclient area to reflect the state change.
1410  if ( lParam != -1 &&
1411  ( Flags = NC_DoNCActive(Wnd)) != 0 )
1412  {
1413  HDC hDC;
1414  HRGN hRgnTemp = NULL, hRgn = (HRGN)lParam;
1415 
1416  if (GreIsHandleValid(hRgn))
1417  {
1418  hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0);
1419  if (NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY) == ERROR)
1420  {
1421  GreDeleteObject(hRgnTemp);
1422  hRgnTemp = NULL;
1423  }
1424  }
1425 
1426  if ((hDC = UserGetDCEx(Wnd, hRgnTemp, DCX_WINDOW|DCX_USESTYLE)))
1427  {
1428  NC_DoNCPaint(Wnd, hDC, wParam | Flags); // Redraw MENUs.
1429  UserReleaseDC(Wnd, hDC, FALSE);
1430  }
1431  else
1432  GreDeleteObject(hRgnTemp);
1433  }
1434 
1435  return TRUE;
1436 }
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
#define ERROR(name)
Definition: error_private.h:53
static HDC
Definition: imagelist.c:92
static HRGN hRgn
Definition: mapping.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
#define DCX_WINDOW
Definition: winuser.h:2095
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
smooth NULL
Definition: ftsmooth.c:416
#define DC_ACTIVE
Definition: winuser.h:427
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
__kernel_entry W32KAPI INT APIENTRY NtGdiCombineRgn(_In_ HRGN hrgnDst, _In_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ INT iMode)
#define RGN_COPY
Definition: wingdi.h:356
static HDC hDC
Definition: 3dtext.c:33
DWORD state
Definition: ntuser.h:665
static INT NC_DoNCActive(PWND Wnd)
Definition: nonclient.c:1364
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WNDS_NONCPAINT
Definition: ntuser.h:581
#define WS_VISIBLE
Definition: pedump.c:620
#define DC_CAPTION
Definition: winuser.h:439
LPARAM lParam
Definition: combotst.c:139
#define WNDS_HASCAPTION
Definition: ntuser.h:576
DWORD style
Definition: ntuser.h:670

Referenced by IntDefWindowProc().

◆ NC_HandleNCCalcSize()

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

Definition at line 1248 of file nonclient.c.

1249 {
1250  LRESULT Result = 0;
1251  SIZE WindowBorders;
1252  RECT OrigRect;
1253  LONG Style = Wnd->style;
1254  LONG exStyle = Wnd->ExStyle;
1255 
1256  if (Rect == NULL)
1257  {
1258  return Result;
1259  }
1260  OrigRect = *Rect;
1261 
1262  Wnd->state &= ~WNDS_HASCAPTION;
1263 
1264  if (wparam)
1265  {
1266  if (Wnd->pcls->style & CS_VREDRAW)
1267  {
1268  Result |= WVR_VREDRAW;
1269  }
1270  if (Wnd->pcls->style & CS_HREDRAW)
1271  {
1272  Result |= WVR_HREDRAW;
1273  }
1275  }
1276 
1277  if (!(Wnd->style & WS_MINIMIZE))
1278  {
1279  if (UserHasWindowEdge(Wnd->style, Wnd->ExStyle))
1280  {
1281  UserGetWindowBorders(Wnd->style, Wnd->ExStyle, &WindowBorders, FALSE);
1282  RECTL_vInflateRect(Rect, -WindowBorders.cx, -WindowBorders.cy);
1283  }
1284  else if ((Wnd->ExStyle & WS_EX_STATICEDGE) || (Wnd->style & WS_BORDER))
1285  {
1286  RECTL_vInflateRect(Rect, -1, -1);
1287  }
1288 
1289  if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
1290  {
1291  Wnd->state |= WNDS_HASCAPTION;
1292 
1293  if (Wnd->ExStyle & WS_EX_TOOLWINDOW)
1295  else
1297  }
1298 
1299  if (HAS_MENU(Wnd, Style))
1300  {
1301  HDC hDC = UserGetDCEx(Wnd, 0, DCX_USESTYLE | DCX_WINDOW);
1302 
1303  Wnd->state |= WNDS_HASMENU;
1304 
1305  if (hDC)
1306  {
1307  RECT CliRect = *Rect;
1308  CliRect.bottom -= OrigRect.top;
1309  CliRect.right -= OrigRect.left;
1310  CliRect.left -= OrigRect.left;
1311  CliRect.top -= OrigRect.top;
1312  if (!Suspended) Rect->top += MENU_DrawMenuBar(hDC, &CliRect, Wnd, TRUE);
1313  UserReleaseDC(Wnd, hDC, FALSE);
1314  }
1315  }
1316 
1317  if (Wnd->ExStyle & WS_EX_CLIENTEDGE)
1318  {
1320  }
1321 
1322  if (Style & WS_VSCROLL)
1323  {
1324  if (Rect->right - Rect->left >= UserGetSystemMetrics(SM_CXVSCROLL))
1325  {
1326  Wnd->state |= WNDS_HASVERTICALSCROOLLBAR;
1327 
1328  /* rectangle is in screen coords when wparam is false */
1329  if (!wparam && (exStyle & WS_EX_LAYOUTRTL)) exStyle ^= WS_EX_LEFTSCROLLBAR;
1330 
1331  if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
1333  else
1335  }
1336  }
1337 
1338  if (Style & WS_HSCROLL)
1339  {
1340  if( Rect->bottom - Rect->top > UserGetSystemMetrics(SM_CYHSCROLL))
1341  {
1342  Wnd->state |= WNDS_HASHORIZONTALSCROLLBAR;
1343 
1345  }
1346  }
1347 
1348  if (Rect->top > Rect->bottom)
1349  Rect->bottom = Rect->top;
1350 
1351  if (Rect->left > Rect->right)
1352  Rect->right = Rect->left;
1353  }
1354  else
1355  {
1356  Rect->right = Rect->left;
1357  Rect->bottom = Rect->top;
1358  }
1359 
1360  return Result;
1361 }
#define SM_CYHSCROLL
Definition: winuser.h:952
#define TRUE
Definition: types.h:120
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
#define WNDS_HASHORIZONTALSCROLLBAR
Definition: ntuser.h:575
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define CS_HREDRAW
Definition: winuser.h:648
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
LONG left
Definition: windef.h:291
UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, PWND pWnd, BOOL suppress_draw)
Definition: menu.c:2742
LONG right
Definition: windef.h:293
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define DCX_WINDOW
Definition: winuser.h:2095
#define WNDS_HASVERTICALSCROOLLBAR
Definition: ntuser.h:574
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_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
LONG cx
Definition: windef.h:319
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: nonclient.c:53
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WS_CAPTION
Definition: pedump.c:624
#define CS_VREDRAW
Definition: winuser.h:653
#define SM_CYCAPTION
Definition: winuser.h:953
const DWORD Style
Definition: appswitch.c:71
#define WVR_VALIDRECTS
Definition: winuser.h:2497
#define WS_HSCROLL
Definition: pedump.c:628
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
static HDC hDC
Definition: 3dtext.c:33
#define WS_BORDER
Definition: pedump.c:625
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WVR_HREDRAW
Definition: winuser.h:2494
#define WS_VSCROLL
Definition: pedump.c:627
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WVR_VREDRAW
Definition: winuser.h:2495
#define SM_CXVSCROLL
Definition: winuser.h:951
LONG bottom
Definition: windef.h:294
#define WNDS_HASMENU
Definition: ntuser.h:573
LONG_PTR LRESULT
Definition: windef.h:209
#define SM_CYSMCAPTION
Definition: winuser.h:1004
LONG cy
Definition: windef.h:320
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define WNDS_HASCAPTION
Definition: ntuser.h:576
struct Rect Rect
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDblClk()

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

Definition at line 1610 of file nonclient.c.

1611 {
1612  ULONG Style;
1613 
1614  Style = pWnd->style;
1615  switch(wParam)
1616  {
1617  case HTCAPTION:
1618  {
1619  /* Maximize/Restore the window */
1620  if((Style & WS_CAPTION) == WS_CAPTION && (Style & WS_MAXIMIZEBOX))
1621  {
1623  }
1624  break;
1625  }
1626  case HTSYSMENU:
1627  {
1628  PMENU SysMenu = IntGetSystemMenu(pWnd, FALSE);
1630 
1631  /* If the close item of the sysmenu is disabled or not present do nothing */
1632  if ((state & (MF_DISABLED | MF_GRAYED)) || (state == 0xFFFFFFFF))
1633  break;
1634 
1636  break;
1637  }
1638  case HTTOP:
1639  case HTBOTTOM:
1640  {
1641  RECT sizingRect = pWnd->rcWindow, mouseRect;
1642 
1643  if (pWnd->ExStyle & WS_EX_MDICHILD)
1644  break;
1645 
1646  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &mouseRect, 0);
1647 
1648  co_WinPosSetWindowPos(pWnd,
1649  0,
1650  sizingRect.left,
1651  mouseRect.top,
1652  sizingRect.right - sizingRect.left,
1653  mouseRect.bottom - mouseRect.top,
1654  0);
1655  break;
1656  }
1657  default:
1658  return NC_HandleNCLButtonDown(pWnd, wParam, lParam);
1659  }
1660  return(0);
1661 }
#define HTTOP
Definition: winuser.h:2465
#define MF_DISABLED
Definition: winuser.h:130
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SC_RESTORE
Definition: winuser.h:2573
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
WPARAM wParam
Definition: combotst.c:138
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define HTSYSMENU
Definition: winuser.h:2452
#define WS_MINIMIZE
Definition: pedump.c:622
#define SC_MAXIMIZE
Definition: winuser.h:2563
smooth NULL
Definition: ftsmooth.c:416
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define WS_CAPTION
Definition: pedump.c:624
const DWORD Style
Definition: appswitch.c:71
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5380
#define HTBOTTOM
Definition: winuser.h:2468
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
static int state
Definition: maze.c:121
#define HTCAPTION
Definition: winuser.h:2451
unsigned int UINT
Definition: ndis.h:50
#define SC_CLOSE
Definition: winuser.h:2567
unsigned int ULONG
Definition: retypes.h:1
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
#define MF_GRAYED
Definition: winuser.h:129
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1519
#define WM_SYSCOMMAND
Definition: winuser.h:1723
LPARAM lParam
Definition: combotst.c:139
UINT FASTCALL IntGetMenuState(HMENU hMenu, UINT uId, UINT uFlags)
Definition: menu.c:4972
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by IntDefWindowProc().

◆ NC_HandleNCLButtonDown()

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

Definition at line 1519 of file nonclient.c.

1520 {
1521  switch (wParam)
1522  {
1523  case HTCAPTION:
1524  {
1525  PWND TopWnd = pWnd, parent;
1526  while(1)
1527  {
1528  if ((TopWnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
1529  break;
1530  parent = UserGetAncestor( TopWnd, GA_PARENT );
1531  if (!parent || UserIsDesktopWindow(parent)) break;
1532  TopWnd = parent;
1533  }
1534 
1535  if ( co_IntSetForegroundWindowMouse(TopWnd) ||
1536  //NtUserCallHwndLock(hTopWnd, HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE) ||
1537  UserGetActiveWindow() == UserHMGetHandle(TopWnd))
1538  {
1540  }
1541  break;
1542  }
1543  case HTSYSMENU:
1544  {
1545  LONG style = pWnd->style;
1546  if (style & WS_SYSMENU)
1547  {
1548  if(!(style & WS_MINIMIZE) )
1549  {
1550  RECT rect;
1551  HDC hDC = UserGetWindowDC(pWnd);
1552  NC_GetInsideRect(pWnd, &rect);
1553  UserDrawSysMenuButton(pWnd, hDC, &rect, TRUE);
1554  UserReleaseDC( pWnd, hDC, FALSE );
1555  }
1557  }
1558  break;
1559  }
1560  case HTMENU:
1561  {
1563  break;
1564  }
1565  case HTHSCROLL:
1566  {
1568  break;
1569  }
1570  case HTVSCROLL:
1571  {
1573  break;
1574  }
1575  case HTMINBUTTON:
1576  case HTMAXBUTTON:
1577  case HTCLOSE:
1578  {
1579  NC_DoButton(pWnd, wParam, lParam);
1580  break;
1581  }
1582  case HTLEFT:
1583  case HTRIGHT:
1584  case HTTOP:
1585  case HTBOTTOM:
1586  case HTTOPLEFT:
1587  case HTTOPRIGHT:
1588  case HTBOTTOMLEFT:
1589  case HTBOTTOMRIGHT:
1590  {
1591  /* Old comment:
1592  * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
1593  * This was previously done by setting wParam=SC_SIZE + wParam - 2
1594  */
1595  /* But that is not what WinNT does. Instead it sends this. This
1596  * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
1597  * SC_MOUSEMENU into wParam.
1598  */
1600  break;
1601  }
1602  case HTBORDER:
1603  break;
1604  }
1605  return(0);
1606 }
#define HTMAXBUTTON
Definition: winuser.h:2459
#define HTTOP
Definition: winuser.h:2465
#define HTLEFT
Definition: winuser.h:2462
#define HTHSCROLL
Definition: winuser.h:2456
#define TRUE
Definition: types.h:120
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
static HDC
Definition: imagelist.c:92
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:946
#define HTBOTTOMLEFT
Definition: winuser.h:2469
#define SC_MOUSEMENU
Definition: winuser.h:2570
#define HTRIGHT
Definition: winuser.h:2464
#define WS_CHILD
Definition: pedump.c:617
#define HTMINBUTTON
Definition: winuser.h:2458
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define HTTOPLEFT
Definition: winuser.h:2466
#define HTSYSMENU
Definition: winuser.h:2452
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
#define GA_PARENT
Definition: winuser.h:2763
BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down)
Definition: nonclient.c:712
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define HTTOPRIGHT
Definition: winuser.h:2467
r parent
Definition: btrfs.c:2897
#define HTBOTTOM
Definition: winuser.h:2468
#define HTCLOSE
Definition: winuser.h:2474
void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect)
Definition: nonclient.c:71
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3144
#define HTCAPTION
Definition: winuser.h:2451
Definition: ntuser.h:657
static HDC hDC
Definition: 3dtext.c:33
#define HTMENU
Definition: winuser.h:2455
#define SC_SIZE
Definition: winuser.h:2559
#define HTBORDER
Definition: winuser.h:2472
#define WS_POPUP
Definition: pedump.c:616
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define HTVSCROLL
Definition: winuser.h:2457
#define SC_MOVE
Definition: winuser.h:2560
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window)
Definition: focus.c:1443
Arabic default style
Definition: afstyles.h:93
#define WS_SYSMENU
Definition: pedump.c:629
VOID NC_DoButton(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1439
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define SC_VSCROLL
Definition: winuser.h:2568
LPARAM lParam
Definition: combotst.c:139
#define WMSZ_LEFT
Definition: winuser.h:2439
DWORD style
Definition: ntuser.h:670
#define SC_HSCROLL
Definition: winuser.h:2569

Referenced by IntDefWindowProc(), and NC_HandleNCLButtonDblClk().

◆ NC_HandleNCRButtonDown()

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

Definition at line 1668 of file nonclient.c.

1669 {
1670  MSG msg;
1671  INT hittest = wParam;
1672 
1673  switch (hittest)
1674  {
1675  case HTCAPTION:
1676  case HTSYSMENU:
1677  if (!IntGetSystemMenu( pwnd, FALSE )) break;
1678 
1680  for (;;)