1 #pragma once 2 3 extern ATOM AtomMessage; 4 extern ATOM AtomWndObj; /* WNDOBJ list */ 5 extern ATOM AtomLayer; 6 extern ATOM AtomFlashWndState; 7 extern BOOL g_bWindowSnapEnabled; 8 9 #define HAS_DLGFRAME(Style, ExStyle) \ 10 (((ExStyle) & WS_EX_DLGMODALFRAME) || \ 11 (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME)))) 12 13 #define HAS_THICKFRAME(Style, ExStyle) \ 14 (((Style) & WS_THICKFRAME) && \ 15 (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME))) 16 17 #define HAS_THINFRAME(Style, ExStyle) \ 18 (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP)))) 19 20 #define HAS_CLIENTFRAME(Style, ExStyle) \ 21 (((ExStyle) & WS_EX_CLIENTEDGE) || (!((Style) & (WS_CHILD | WS_POPUP)))) 22 23 #define HAS_MENU(pWnd,style) ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (pWnd->IDMenu) && IntIsMenu(UlongToHandle(pWnd->IDMenu))) 24 25 #define IntIsDesktopWindow(WndObj) \ 26 (WndObj->spwndParent == NULL) 27 28 #define IntIsBroadcastHwnd(hWnd) \ 29 (hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST) 30 31 32 #define IntWndBelongsToThread(WndObj, W32Thread) \ 33 ((WndObj->head.pti) && (WndObj->head.pti == W32Thread)) 34 35 #define IntGetWndThreadId(WndObj) \ 36 PsGetThreadId(WndObj->head.pti->pEThread) 37 38 #define IntGetWndProcessId(WndObj) \ 39 PsGetProcessId(WndObj->head.pti->ppi->peProcess) 40 41 PWND FASTCALL ValidateHwndNoErr(HWND); 42 BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam); 43 BOOL FASTCALL IntIsWindow(HWND hWnd); 44 HWND* FASTCALL IntWinListChildren(PWND Window); 45 HWND* FASTCALL IntWinListOwnedPopups(PWND Window); 46 VOID FASTCALL IntGetClientRect (PWND WindowObject, RECTL *Rect); 47 INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints); 48 BOOL FASTCALL IntIsChildWindow (PWND Parent, PWND Child); 49 VOID FASTCALL IntUnlinkWindow(PWND Wnd); 50 VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev); 51 PWND FASTCALL IntGetParent(PWND Wnd); 52 VOID FASTCALL IntGetWindowBorderMeasures(PWND WindowObject, UINT *cx, UINT *cy); 53 BOOL FASTCALL IntShowOwnedPopups( PWND owner, BOOL fShow ); 54 LRESULT FASTCALL IntDefWindowProc( PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi); 55 VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG, DWORD); 56 #define WINVER_WIN2K _WIN32_WINNT_WIN2K 57 #define WINVER_WINNT4 _WIN32_WINNT_NT4 58 #define WINVER_WIN31 0x30A 59 PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs, 60 PLARGE_STRING WindowName, 61 PCLS Class, 62 PWND ParentWindow, 63 PWND OwnerWindow, 64 PVOID acbiBuffer, 65 PDESKTOP pdeskCreated, 66 DWORD dwVer ); 67 PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW* Cs, 68 PUNICODE_STRING ClassName, 69 PLARGE_STRING WindowName, 70 PVOID acbiBuffer, 71 DWORD dwVer ); 72 BOOL FASTCALL IntEnableWindow(HWND,BOOL); 73 BOOL FASTCALL IntIsWindowVisible(PWND); 74 DWORD FASTCALL GetNCHitEx(PWND,POINT); 75 ULONG FASTCALL IntSetStyle(PWND,ULONG,ULONG); 76 PWND FASTCALL VerifyWnd(PWND); 77 PWND FASTCALL IntGetNonChildAncestor(PWND); 78 LONG FASTCALL co_UserSetWindowLong(HWND,DWORD,LONG,BOOL); 79 LONG_PTR FASTCALL co_UserSetWindowLongPtr(HWND, DWORD, LONG_PTR, BOOL); 80 HWND FASTCALL IntGetWindow(HWND,UINT); 81 LRESULT co_UserFreeWindow(PWND,PPROCESSINFO,PTHREADINFO,BOOLEAN); 82 83 #define HWND_TERMINATOR ((HWND)(ULONG_PTR)1) 84 85 typedef struct tagWINDOWLIST 86 { 87 struct tagWINDOWLIST *pNextList; 88 HWND *phwndLast; 89 HWND *phwndEnd; 90 PTHREADINFO pti; 91 HWND ahwnd[ANYSIZE_ARRAY]; /* Terminated by HWND_TERMINATOR */ 92 } WINDOWLIST, *PWINDOWLIST; 93 94 extern PWINDOWLIST gpwlList; 95 extern PWINDOWLIST gpwlCache; 96 97 #define WL_IS_BAD(pwl) ((pwl)->phwndEnd <= (pwl)->phwndLast) 98 #define WL_CAPACITY(pwl) ((pwl)->phwndEnd - &((pwl)->ahwnd[0])) 99 100 PWINDOWLIST FASTCALL IntBuildHwndList(PWND pwnd, DWORD dwFlags, PTHREADINFO pti); 101 VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget); 102 HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, 103 PUNICODE_STRING WindowName); 104 105 /* Undocumented dwFlags for IntBuildHwndList */ 106 #define IACE_LIST 0x0002 107 108 #define IS_WND_CHILD(pWnd) ((pWnd)->style & WS_CHILD) 109 #define IS_WND_MENU(pWnd) ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_MENU]) 110 111 // The IME-like windows are the IME windows and the IME UI windows. 112 // The IME window's class name is "IME". 113 // The IME UI window behaves the User Interface of IME for the user. 114 #define IS_WND_IMELIKE(pWnd) \ 115 (((pWnd)->pcls->style & CS_IME) || \ 116 ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME])) 117 118 extern BOOL gfIMEShowStatus; 119 120 BOOL FASTCALL IntWantImeWindow(PWND pwndTarget); 121 PWND FASTCALL co_IntCreateDefaultImeWindow(PWND pwndTarget, HINSTANCE hInst); 122 BOOL FASTCALL IntImeCanDestroyDefIMEforChild(PWND pImeWnd, PWND pwndTarget); 123 BOOL FASTCALL IntImeCanDestroyDefIME(PWND pImeWnd, PWND pwndTarget); 124 BOOL FASTCALL IntBroadcastImeShowStatusChange(PWND pImeWnd, BOOL bShow); 125 VOID FASTCALL IntNotifyImeShowStatus(PWND pImeWnd); 126 VOID FASTCALL IntCheckImeShowStatusInThread(PWND pImeWnd); 127 128 static inline 129 VOID 130 WndSetOwner(_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner) 131 { 132 /* First reference the new owner window */ 133 if (pwndOwner != NULL) 134 { 135 UserReferenceObject(pwndOwner); 136 } 137 138 /* Now dereference the previous owner window */ 139 if (pwnd->spwndOwner != NULL) 140 { 141 UserDereferenceObject(pwnd->spwndOwner); 142 } 143 144 pwnd->spwndOwner = pwndOwner; 145 } 146 147 /* EOF */ 148