ReactOS 0.4.16-dev-1204-gb627a42
window.c File Reference
#include <user32.h>
Include dependency graph for window.c:

Go to the source code of this file.

Macros

#define DEBUG
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
void MDI_CalcDefaultChildPos (HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
 
LPCWSTR FASTCALL ClassNameToVersion (const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi)
 
NTSTATUS WINAPI User32CallSendAsyncProcForKernel (PVOID Arguments, ULONG ArgumentLength)
 
BOOL WINAPI AllowSetForegroundWindow (DWORD dwProcessId)
 
HDWP WINAPI BeginDeferWindowPos (int nNumWindows)
 
BOOL WINAPI BringWindowToTop (HWND hWnd)
 
VOID WINAPI SwitchToThisWindow (HWND hwnd, BOOL fAltTab)
 
HWND WINAPI ChildWindowFromPoint (HWND hWndParent, POINT Point)
 
HWND WINAPI ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
 
BOOL WINAPI CloseWindow (HWND hWnd)
 
FORCEINLINE VOID RtlInitLargeString (OUT PLARGE_STRING plstr, LPCVOID psz, BOOL bUnicode)
 
VOID NTAPI RtlFreeLargeString (IN PLARGE_STRING LargeString)
 
HWND WINAPI User32CreateWindowEx (DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, DWORD dwFlags)
 
HWND WINAPI DECLSPEC_HOTPATCH CreateWindowExA (DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
 
HWND WINAPI DECLSPEC_HOTPATCH CreateWindowExW (DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
 
HDWP WINAPI DeferWindowPos (HDWP hWinPosInfo, HWND hWnd, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
 
BOOL WINAPI EndDeferWindowPos (HDWP hWinPosInfo)
 
HWND WINAPI GetDesktopWindow (VOID)
 
static BOOL User32EnumWindows (HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
 
BOOL WINAPI EnumChildWindows (HWND hWndParent, WNDENUMPROC lpEnumFunc, LPARAM lParam)
 
BOOL WINAPI EnumThreadWindows (DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
 
BOOL WINAPI EnumWindows (WNDENUMPROC lpEnumFunc, LPARAM lParam)
 
BOOL WINAPI EnumDesktopWindows (HDESK hDesktop, WNDENUMPROC lpfn, LPARAM lParam)
 
HWND WINAPI FindWindowExA (HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
 
HWND WINAPI FindWindowExW (HWND hwndParent, HWND hwndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow)
 
HWND WINAPI FindWindowA (LPCSTR lpClassName, LPCSTR lpWindowName)
 
HWND WINAPI FindWindowW (LPCWSTR lpClassName, LPCWSTR lpWindowName)
 
BOOL WINAPI GetAltTabInfoA (HWND hwnd, int iItem, PALTTABINFO pati, LPSTR pszItemText, UINT cchItemText)
 
BOOL WINAPI GetAltTabInfoW (HWND hwnd, int iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText)
 
HWND WINAPI GetAncestor (_In_ HWND hwnd, _In_ UINT uType)
 
BOOL WINAPI GetClientRect (HWND hWnd, LPRECT lpRect)
 
HWND WINAPI GetLastActivePopup (HWND hWnd)
 
HWND WINAPI GetParent (HWND hWnd)
 
BOOL WINAPI GetProcessDefaultLayout (DWORD *pdwDefaultLayout)
 
HWND WINAPI GetWindow (HWND hWnd, UINT uCmd)
 
HWND WINAPI GetTopWindow (HWND hWnd)
 
BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo (HWND hWnd, PWINDOWINFO pwi)
 
UINT WINAPI GetWindowModuleFileNameA (HWND hwnd, LPSTR lpszFileName, UINT cchFileNameMax)
 
UINT WINAPI GetWindowModuleFileNameW (HWND hwnd, LPWSTR lpszFileName, UINT cchFileNameMax)
 
BOOL WINAPI GetWindowRect (HWND hWnd, LPRECT lpRect)
 
int WINAPI GetWindowTextA (HWND hWnd, LPSTR lpString, int nMaxCount)
 
int WINAPI GetWindowTextLengthA (HWND hWnd)
 
int WINAPI GetWindowTextLengthW (HWND hWnd)
 
int WINAPI GetWindowTextW (HWND hWnd, LPWSTR lpString, int nMaxCount)
 
DWORD WINAPI GetWindowThreadProcessId (HWND hWnd, LPDWORD lpdwProcessId)
 
BOOL WINAPI IsChild (HWND hWndParent, HWND hWnd)
 
BOOL WINAPI IsIconic (HWND hWnd)
 
BOOL WINAPI IsWindow (HWND hWnd)
 
BOOL WINAPI IsWindowUnicode (HWND hWnd)
 
BOOL WINAPI IsWindowVisible (HWND hWnd)
 
BOOL WINAPI IsWindowEnabled (HWND hWnd)
 
BOOL WINAPI IsZoomed (HWND hWnd)
 
BOOL WINAPI LockSetForegroundWindow (UINT uLockCode)
 
BOOL WINAPI AnimateWindow (HWND hwnd, DWORD dwTime, DWORD dwFlags)
 
BOOL WINAPI OpenIcon (HWND hWnd)
 
HWND WINAPI RealChildWindowFromPoint (HWND hwndParent, POINT ptParentClientCoords)
 
BOOL WINAPI SetForegroundWindow (HWND hWnd)
 
BOOL WINAPI SetProcessDefaultLayout (DWORD dwDefaultLayout)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextA (HWND hWnd, LPCSTR lpString)
 
BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextW (HWND hWnd, LPCWSTR lpString)
 
BOOL WINAPI ShowOwnedPopups (HWND hWnd, BOOL fShow)
 
BOOL WINAPI UpdateLayeredWindow (HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pbl, DWORD dwFlags)
 
BOOL WINAPI UpdateLayeredWindowIndirect (HWND hwnd, const UPDATELAYEREDWINDOWINFO *info)
 
BOOL WINAPI SetWindowContextHelpId (HWND hwnd, DWORD dwContextHelpId)
 
DWORD WINAPI GetWindowContextHelpId (HWND hwnd)
 
int WINAPI InternalGetWindowText (HWND hWnd, LPWSTR lpString, int nMaxCount)
 
BOOL WINAPI IsHungAppWindow (HWND hwnd)
 
VOID WINAPI SetLastErrorEx (DWORD dwErrCode, DWORD dwType)
 
HWND WINAPI GetFocus (VOID)
 
DWORD WINAPI GetRealWindowOwner (HWND hwnd)
 
HWND WINAPI SetTaskmanWindow (HWND hWnd)
 
HWND WINAPI SetProgmanWindow (HWND hWnd)
 
HWND WINAPI GetProgmanWindow (VOID)
 
HWND WINAPI GetTaskmanWindow (VOID)
 
BOOL WINAPI ScrollWindow (HWND hWnd, int dx, int dy, CONST RECT *lpRect, CONST RECT *prcClip)
 
INT WINAPI ScrollWindowEx (HWND hWnd, int dx, int dy, CONST RECT *prcScroll, CONST RECT *prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags)
 
BOOL WINAPI AnyPopup (VOID)
 
BOOL WINAPI IsWindowInDestroy (HWND hWnd)
 
VOID WINAPI DisableProcessWindowsGhosting (VOID)
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG

Definition at line 12 of file window.c.

Function Documentation

◆ AllowSetForegroundWindow()

BOOL WINAPI AllowSetForegroundWindow ( DWORD  dwProcessId)

Definition at line 49 of file window.c.

50{
51 return NtUserxAllowSetForegroundWindow(dwProcessId);
52}
EXTINLINE BOOL NtUserxAllowSetForegroundWindow(DWORD dwProcessId)
Definition: ntwrapper.h:836

Referenced by Activate_RunDLL(), SHCreateFromDesktop(), and NotifyArea::WndProc().

◆ AnimateWindow()

BOOL WINAPI AnimateWindow ( HWND  hwnd,
DWORD  dwTime,
DWORD  dwFlags 
)

Definition at line 1625 of file window.c.

1628{
1629 /* FIXME Add animation code */
1630
1631 /* If trying to show/hide and it's already *
1632 * shown/hidden or invalid window, fail with *
1633 * invalid parameter */
1634
1635 BOOL visible;
1636 visible = IsWindowVisible(hwnd);
1637 if(!IsWindow(hwnd) ||
1638 (visible && !(dwFlags & AW_HIDE)) ||
1639 (!visible && (dwFlags & AW_HIDE)))
1640 {
1642 return FALSE;
1643 }
1644
1645 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1646
1647 return TRUE;
1648}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:779
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOWNA
Definition: winuser.h:789
#define SW_SHOW
Definition: winuser.h:786
BOOL WINAPI IsWindowVisible(_In_ HWND)

◆ AnyPopup()

BOOL WINAPI AnyPopup ( VOID  )

Definition at line 1964 of file window.c.

1965{
1966 int i;
1967 BOOL retvalue;
1969
1970 if (!list) return FALSE;
1971 for (i = 0; list[i]; i++)
1972 {
1973 if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break;
1974 }
1975 retvalue = (list[i] != 0);
1976 HeapFree( GetProcessHeap(), 0, list );
1977 return retvalue;
1978}
Definition: list.h:37
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
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
HWND * WIN_ListChildren(HWND hWndparent)
Definition: mdi.c:139
HWND WINAPI GetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:1083
#define GW_OWNER
Definition: winuser.h:777
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628

◆ BeginDeferWindowPos()

HDWP WINAPI BeginDeferWindowPos ( int  nNumWindows)

Definition at line 59 of file window.c.

60{
61 return NtUserxBeginDeferWindowPos(nNumWindows);
62}
EXTINLINE HDWP NtUserxBeginDeferWindowPos(INT nNumWindows)
Definition: ntwrapper.h:651

◆ BringWindowToTop()

BOOL WINAPI BringWindowToTop ( HWND  hWnd)

Definition at line 69 of file window.c.

70{
73 0,
74 0,
75 0,
76 0,
78}
HWND hWnd
Definition: settings.c:17
BOOL NTAPI NtUserSetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
Definition: winpos.c:3533
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOSIZE
Definition: winuser.h:1256
#define HWND_TOP
Definition: winuser.h:1218

◆ ChildWindowFromPoint()

HWND WINAPI ChildWindowFromPoint ( HWND  hWndParent,
POINT  Point 
)

Definition at line 92 of file window.c.

94{
96}
HWND NTAPI NtUserChildWindowFromPointEx(HWND Parent, LONG x, LONG y, UINT Flags)
Definition: winpos.c:3252

◆ ChildWindowFromPointEx()

HWND WINAPI ChildWindowFromPointEx ( HWND  hwndParent,
POINT  pt,
UINT  uFlags 
)

Definition at line 103 of file window.c.

106{
108}
static HWND hwndParent
Definition: cryptui.c:300
UINT uFlags
Definition: api.c:59
#define pt(x, y)
Definition: drawing.c:79

◆ ClassNameToVersion()

LPCWSTR FASTCALL ClassNameToVersion ( const void lpszClass,
LPCWSTR  lpszMenuName,
LPCWSTR plpLibFileName,
HANDLE pContext,
BOOL  bAnsi 
)

Definition at line 85 of file class.c.

91{
92 LPCWSTR VersionedClass = NULL;
93#ifdef USE_VERSIONED_CLASSES
95#endif
96 UNICODE_STRING SectionName;
97 WCHAR SectionNameBuf[MAX_PATH] = {0};
98 ACTCTX_SECTION_KEYED_DATA KeyedData = { sizeof(KeyedData) };
99
100 if (!lpszClass)
101 {
102 ERR("Null class given !\n");
103 return NULL;
104 }
105
106 if (IS_ATOM(lpszClass))
107 {
108 RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf));
109 if(!NtUserGetAtomName(LOWORD((DWORD_PTR)lpszClass), &SectionName))
110 {
111 ERR("Couldn't get atom name for atom %x !\n", LOWORD((DWORD_PTR)lpszClass));
112 return NULL;
113 }
114 SectionName.Length = (USHORT)wcslen(SectionNameBuf) * sizeof(WCHAR);
115 TRACE("ClassNameToVersion got name %wZ from atom\n", &SectionName);
116 }
117 else
118 {
119 if (bAnsi)
120 {
122 RtlInitAnsiString(&AnsiString, lpszClass);
123 RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf));
125 }
126 else
127 {
128 RtlInitUnicodeString(&SectionName, lpszClass);
129 }
130 }
131#ifdef USE_VERSIONED_CLASSES
132 Status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
133 NULL,
134 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
135 &SectionName,
136 &KeyedData );
137
138 if (NT_SUCCESS(Status) && KeyedData.ulDataFormatVersion == 1)
139 {
140 struct strsection_header *SectionHeader = KeyedData.lpSectionBase;
141
142 /* Find activation context */
143 if(SectionHeader && SectionHeader->count > 0)
144 {
145 struct wndclass_redirect_data *WindowRedirectionData = KeyedData.lpData;
146 if(WindowRedirectionData && WindowRedirectionData->module_len)
147 {
148 LPCWSTR lpLibFileName;
149
150 VersionedClass = (WCHAR*)((BYTE*)WindowRedirectionData + WindowRedirectionData->name_offset);
151 lpLibFileName = (WCHAR*)((BYTE*)KeyedData.lpSectionBase + WindowRedirectionData->module_offset);
152 TRACE("Returning VersionedClass=%S, plpLibFileName=%S for class %S\n", VersionedClass, lpLibFileName, SectionName.Buffer);
153
154 if (pContext) *pContext = KeyedData.hActCtx;
155 if (plpLibFileName) *plpLibFileName = lpLibFileName;
156
157 }
158 }
159 }
160
161 if (KeyedData.hActCtx)
162 RtlReleaseActivationContext(KeyedData.hActCtx);
163#endif
164
165#ifndef DEFAULT_ACTIVATION_CONTEXTS_SUPPORTED
166 /* This block is a hack! */
167 if (!VersionedClass)
168 {
169 /*
170 * In windows the default activation context always contains comctl32v5
171 * In reactos we don't have a default activation context so we
172 * mimic wine here.
173 */
174 VersionedClass = is_comctl32_class(SectionName.Buffer);
175 if (VersionedClass)
176 {
177 if (pContext) *pContext = 0;
178 if (plpLibFileName) *plpLibFileName = L"comctl32";
179 }
180 }
181#endif
182
183 /*
184 * The returned strings are pointers in the activation context and
185 * will get freed when the activation context gets freed
186 */
187 return VersionedClass;
188}
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
#define IS_ATOM(x)
Definition: class.h:3
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define MAX_PATH
Definition: compat.h:34
@ AnsiString
Definition: dnslib.h:19
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5874
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5384
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
unsigned short USHORT
Definition: pedump.c:61
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t DWORD_PTR
Definition: typedefs.h:65
LPCWSTR is_comctl32_class(const WCHAR *name)
Definition: class.c:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193

Referenced by GetClassInfoExA(), GetClassInfoExW(), RegisterClassExWOWW(), UnregisterClassA(), UnregisterClassW(), and User32CreateWindowEx().

◆ CloseWindow()

BOOL WINAPI CloseWindow ( HWND  hWnd)

Definition at line 115 of file window.c.

116{
117 /* NOTE: CloseWindow does minimizes, and doesn't close. */
120}
#define SW_SHOWMINIMIZED
Definition: winuser.h:782
HWND WINAPI SetActiveWindow(_In_ HWND)

◆ CreateWindowExA()

HWND WINAPI DECLSPEC_HOTPATCH CreateWindowExA ( DWORD  dwExStyle,
LPCSTR  lpClassName,
LPCSTR  lpWindowName,
DWORD  dwStyle,
int  x,
int  y,
int  nWidth,
int  nHeight,
HWND  hWndParent,
HMENU  hMenu,
HINSTANCE  hInstance,
LPVOID  lpParam 
)

Definition at line 352 of file window.c.

364{
366 HWND hwnd;
367
369 {
370 TRACE("CreateWindowExA RegisterSystemControls\n");
372 }
373
374 if (dwExStyle & WS_EX_MDICHILD)
375 {
376 POINT mPos[2];
377 UINT id = 0;
378 HWND top_child;
379 PWND pWndParent;
380
381 pWndParent = ValidateHwnd(hWndParent);
382
383 if (!pWndParent) return NULL;
384
385 if (pWndParent->fnid != FNID_MDICLIENT) // wine uses WIN_ISMDICLIENT
386 {
387 WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
388 goto skip_mdi;
389 }
390
391 /* lpParams of WM_[NC]CREATE is different for MDI children.
392 * MDICREATESTRUCT members have the originally passed values.
393 */
394 mdi.szClass = lpClassName;
395 mdi.szTitle = lpWindowName;
396 mdi.hOwner = hInstance;
397 mdi.x = x;
398 mdi.y = y;
399 mdi.cx = nWidth;
400 mdi.cy = nHeight;
401 mdi.style = dwStyle;
402 mdi.lParam = (LPARAM)lpParam;
403
404 lpParam = (LPVOID)&mdi;
405
406 if (pWndParent->style & MDIS_ALLCHILDSTYLES)
407 {
408 if (dwStyle & WS_POPUP)
409 {
410 WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
411 return(0);
412 }
413 dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
414 }
415 else
416 {
417 dwStyle &= ~WS_POPUP;
420 }
421
422 top_child = GetWindow(hWndParent, GW_CHILD);
423
424 if (top_child)
425 {
426 /* Restore current maximized child */
427 if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
428 {
429 TRACE("Restoring current maximized child %p\n", top_child);
430 SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
431 ShowWindow(top_child, SW_RESTORE);
432 SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
433 }
434 }
435
436 MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
437
438 if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
439
440 if (dwStyle & (WS_CHILD | WS_POPUP))
441 {
442 if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
443 {
444 x = mPos[0].x;
445 y = mPos[0].y;
446 }
447 if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
448 nWidth = mPos[1].x;
449 if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
450 nHeight = mPos[1].y;
451 }
452 }
453
454skip_mdi:
455 hwnd = User32CreateWindowEx(dwExStyle,
456 lpClassName,
457 lpWindowName,
458 dwStyle,
459 x,
460 y,
461 nWidth,
462 nHeight,
464 hMenu,
465 hInstance,
466 lpParam,
467 NUCWE_ANSI);
468 return hwnd;
469}
#define CW_USEDEFAULT16
Definition: resource.h:7
#define WARN(fmt,...)
Definition: precomp.h:61
#define UlongToHandle(ul)
Definition: basetsd.h:97
HINSTANCE hInstance
Definition: charmap.c:19
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define FNID_MDICLIENT
Definition: ntuser.h:872
unsigned int UINT
Definition: ndis.h:50
#define LPVOID
Definition: nt_native.h:45
#define WS_CHILD
Definition: pedump.c:617
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define WS_THICKFRAME
Definition: pedump.c:630
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
Definition: ntuser.h:694
DWORD style
Definition: ntuser.h:706
DWORD fnid
Definition: ntuser.h:709
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define NUCWE_ANSI
Definition: undocuser.h:78
#define ValidateHwnd(hwnd)
Definition: precomp.h:110
BOOL WINAPI IsZoomed(HWND hWnd)
Definition: window.c:1605
void MDI_CalcDefaultChildPos(HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
Definition: mdi.c:308
HWND WINAPI User32CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, DWORD dwFlags)
Definition: window.c:152
LONG_PTR LPARAM
Definition: windef.h:208
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_RESTORE
Definition: winuser.h:790
#define GW_CHILD
Definition: winuser.h:774
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1635

◆ CreateWindowExW()

HWND WINAPI DECLSPEC_HOTPATCH CreateWindowExW ( DWORD  dwExStyle,
LPCWSTR  lpClassName,
LPCWSTR  lpWindowName,
DWORD  dwStyle,
int  x,
int  y,
int  nWidth,
int  nHeight,
HWND  hWndParent,
HMENU  hMenu,
HINSTANCE  hInstance,
LPVOID  lpParam 
)

Definition at line 478 of file window.c.

490{
492 HWND hwnd;
493
495 {
496 ERR("CreateWindowExW RegisterSystemControls\n");
498 }
499
500 if (dwExStyle & WS_EX_MDICHILD)
501 {
502 POINT mPos[2];
503 UINT id = 0;
504 HWND top_child;
505 PWND pWndParent;
506
507 pWndParent = ValidateHwnd(hWndParent);
508
509 if (!pWndParent) return NULL;
510
511 if (pWndParent->fnid != FNID_MDICLIENT)
512 {
513 WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
514 goto skip_mdi;
515 }
516
517 /* lpParams of WM_[NC]CREATE is different for MDI children.
518 * MDICREATESTRUCT members have the originally passed values.
519 */
520 mdi.szClass = lpClassName;
521 mdi.szTitle = lpWindowName;
522 mdi.hOwner = hInstance;
523 mdi.x = x;
524 mdi.y = y;
525 mdi.cx = nWidth;
526 mdi.cy = nHeight;
527 mdi.style = dwStyle;
528 mdi.lParam = (LPARAM)lpParam;
529
530 lpParam = (LPVOID)&mdi;
531
532 if (pWndParent->style & MDIS_ALLCHILDSTYLES)
533 {
534 if (dwStyle & WS_POPUP)
535 {
536 WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
537 return(0);
538 }
539 dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
540 }
541 else
542 {
543 dwStyle &= ~WS_POPUP;
546 }
547
548 top_child = GetWindow(hWndParent, GW_CHILD);
549
550 if (top_child)
551 {
552 /* Restore current maximized child */
553 if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
554 {
555 TRACE("Restoring current maximized child %p\n", top_child);
556 SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
557 ShowWindow(top_child, SW_RESTORE);
558 SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
559 }
560 }
561
562 MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
563
564 if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
565
566 if (dwStyle & (WS_CHILD | WS_POPUP))
567 {
568 if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
569 {
570 x = mPos[0].x;
571 y = mPos[0].y;
572 }
573 if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
574 nWidth = mPos[1].x;
575 if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
576 nHeight = mPos[1].y;
577 }
578 }
579
580skip_mdi:
581 hwnd = User32CreateWindowEx(dwExStyle,
582 (LPCSTR)lpClassName,
583 (LPCSTR)lpWindowName,
584 dwStyle,
585 x,
586 y,
587 nWidth,
588 nHeight,
590 hMenu,
591 hInstance,
592 lpParam,
593 0);
594 return hwnd;
595}
const char * LPCSTR
Definition: xmlstorage.h:183

◆ DeferWindowPos()

HDWP WINAPI DeferWindowPos ( HDWP  hWinPosInfo,
HWND  hWnd,
HWND  hWndInsertAfter,
int  x,
int  y,
int  cx,
int  cy,
UINT  uFlags 
)

Definition at line 601 of file window.c.

609{
610 return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
611}
HDWP NTAPI NtUserDeferWindowPos(HDWP WinPosInfo, HWND Wnd, HWND WndInsertAfter, int x, int y, int cx, int cy, UINT Flags)
Definition: winpos.c:3289
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

◆ DisableProcessWindowsGhosting()

VOID WINAPI DisableProcessWindowsGhosting ( VOID  )

Definition at line 1997 of file window.c.

1998{
2000}
EXTINLINE VOID NtUserxEnableProcessWindowGhosting(BOOL bEnable)
Definition: ntwrapper.h:801

◆ EndDeferWindowPos()

BOOL WINAPI EndDeferWindowPos ( HDWP  hWinPosInfo)

Definition at line 618 of file window.c.

619{
620 return NtUserEndDeferWindowPosEx(hWinPosInfo, FALSE);
621}
BOOL NTAPI NtUserEndDeferWindowPosEx(HDWP WinPosInfo, BOOL bAsync)
Definition: winpos.c:3273

◆ EnumChildWindows()

BOOL WINAPI EnumChildWindows ( HWND  hWndParent,
WNDENUMPROC  lpEnumFunc,
LPARAM  lParam 
)

Definition at line 742 of file window.c.

745{
746 if (!hWndParent)
747 {
748 return EnumWindows(lpEnumFunc, lParam);
749 }
750 return User32EnumWindows(NULL, hWndParent, lpEnumFunc, lParam, 0, TRUE);
751}
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
Definition: window.c:772
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:650

◆ EnumDesktopWindows()

BOOL WINAPI EnumDesktopWindows ( HDESK  hDesktop,
WNDENUMPROC  lpfn,
LPARAM  lParam 
)

Definition at line 783 of file window.c.

786{
787 return User32EnumWindows(hDesktop, NULL, lpfn, lParam, 0, FALSE);
788}

◆ EnumThreadWindows()

BOOL WINAPI EnumThreadWindows ( DWORD  dwThreadId,
WNDENUMPROC  lpfn,
LPARAM  lParam 
)

Definition at line 758 of file window.c.

761{
762 if (!dwThreadId)
765}
DWORD dwThreadId
Definition: fdebug.c:31
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

◆ EnumWindows()

BOOL WINAPI EnumWindows ( WNDENUMPROC  lpEnumFunc,
LPARAM  lParam 
)

Definition at line 772 of file window.c.

774{
775 return User32EnumWindows(NULL, NULL, lpEnumFunc, lParam, 0, FALSE);
776}

Referenced by EnumChildWindows().

◆ FindWindowA()

HWND WINAPI FindWindowA ( LPCSTR  lpClassName,
LPCSTR  lpWindowName 
)

Definition at line 870 of file window.c.

871{
872 //FIXME: FindWindow does not search children, but FindWindowEx does.
873 // what should we do about this?
874 return FindWindowExA (NULL, NULL, lpClassName, lpWindowName);
875}
HWND WINAPI FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
Definition: window.c:795

◆ FindWindowExA()

HWND WINAPI FindWindowExA ( HWND  hwndParent,
HWND  hwndChildAfter,
LPCSTR  lpszClass,
LPCSTR  lpszWindow 
)

Definition at line 795 of file window.c.

799{
801 HWND hwnd = 0;
802
803 if (lpszWindow)
804 {
805 DWORD len = MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, NULL, 0 );
806 if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return 0;
807 MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, titleW, len );
808 }
809
810 if (!IS_INTRESOURCE(lpszClass))
811 {
812 WCHAR classW[256];
813 if (MultiByteToWideChar( CP_ACP, 0, lpszClass, -1, classW, sizeof(classW)/sizeof(WCHAR) ))
814 hwnd = FindWindowExW( hwndParent, hwndChildAfter, classW, titleW );
815 }
816 else
817 {
818 hwnd = FindWindowExW( hwndParent, hwndChildAfter, (LPCWSTR)lpszClass, titleW );
819 }
820
822 return hwnd;
823}
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR titleW[]
Definition: htmlelem.c:1067
static const WCHAR classW[]
Definition: lex.c:40
HWND WINAPI FindWindowExW(HWND hwndParent, HWND hwndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow)
Definition: window.c:830
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FindWindowA().

◆ FindWindowExW()

HWND WINAPI FindWindowExW ( HWND  hwndParent,
HWND  hwndChildAfter,
LPCWSTR  lpszClass,
LPCWSTR  lpszWindow 
)

Definition at line 830 of file window.c.

834{
835 UNICODE_STRING ucClassName, *pucClassName = NULL;
836 UNICODE_STRING ucWindowName, *pucWindowName = NULL;
837
838 if (IS_ATOM(lpszClass))
839 {
840 ucClassName.Length = 0;
841 ucClassName.Buffer = (LPWSTR)lpszClass;
842 pucClassName = &ucClassName;
843 }
844 else if (lpszClass != NULL)
845 {
846 RtlInitUnicodeString(&ucClassName,
847 lpszClass);
848 pucClassName = &ucClassName;
849 }
850
851 if (lpszWindow != NULL)
852 {
853 RtlInitUnicodeString(&ucWindowName,
854 lpszWindow);
855 pucWindowName = &ucWindowName;
856 }
857
859 hwndChildAfter,
860 pucClassName,
861 pucWindowName,
862 0);
863}
HWND NTAPI NtUserFindWindowEx(HWND hwndParent, HWND hwndChildAfter, PUNICODE_STRING ucClassName, PUNICODE_STRING ucWindowName, DWORD dwUnknown)
Definition: window.c:3160

Referenced by FindWindowExA(), and FindWindowW().

◆ FindWindowW()

HWND WINAPI FindWindowW ( LPCWSTR  lpClassName,
LPCWSTR  lpWindowName 
)

Definition at line 882 of file window.c.

883{
884 /*
885
886 There was a FIXME here earlier, but I think it is just a documentation unclarity.
887
888 FindWindow only searches top level windows. What they mean is that child
889 windows of other windows than the desktop can be searched.
890 FindWindowExW never does a recursive search.
891
892 / Joakim
893 */
894
895 return FindWindowExW(NULL, NULL, lpClassName, lpWindowName);
896}

◆ GetAltTabInfoA()

BOOL WINAPI GetAltTabInfoA ( HWND  hwnd,
int  iItem,
PALTTABINFO  pati,
LPSTR  pszItemText,
UINT  cchItemText 
)

Definition at line 904 of file window.c.

909{
910 return NtUserGetAltTabInfo(hwnd,iItem,pati,(LPWSTR)pszItemText,cchItemText,TRUE);
911}
BOOL NTAPI NtUserGetAltTabInfo(HWND hwnd, INT iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText, BOOL Ansi)
Definition: ntstubs.c:86

◆ GetAltTabInfoW()

BOOL WINAPI GetAltTabInfoW ( HWND  hwnd,
int  iItem,
PALTTABINFO  pati,
LPWSTR  pszItemText,
UINT  cchItemText 
)

Definition at line 918 of file window.c.

923{
924 return NtUserGetAltTabInfo(hwnd,iItem,pati,pszItemText,cchItemText,FALSE);
925}

◆ GetAncestor()

HWND WINAPI GetAncestor ( _In_ HWND  hwnd,
_In_ UINT  uType 
)

Definition at line 929 of file window.c.

930{
931 PWND pWnd = ValidateHwnd(hwnd);
932 if (!pWnd || pWnd == GetThreadDesktopWnd())
933 return NULL;
934
935 /* Special handling optimized for speed */
936 if (uType == GA_PARENT)
937 {
938 HWND hwndAncestor = NULL;
939
941 {
942 if (pWnd->spwndParent && pWnd->fnid != FNID_MESSAGEWND)
943 {
944 PWND pwndAncestor = DesktopPtrToUser(pWnd->spwndParent);
945 if (pwndAncestor)
946 hwndAncestor = UserHMGetHandle(pwndAncestor);
947 }
948 }
950 {
951 /* Do nothing */
952 }
953 _SEH2_END;
954
955 return hwndAncestor;
956 }
957
958 return NtUserGetAncestor(hwnd, uType);
959}
HWND NTAPI NtUserGetAncestor(_In_ HWND hWnd, _In_ UINT uType)
Definition: window.c:3420
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define FNID_MESSAGEWND
Definition: ntuser.h:864
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
struct _WND * spwndParent
Definition: ntuser.h:713
PWND FASTCALL GetThreadDesktopWnd(VOID)
Definition: misc.c:397
static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
Definition: utils.c:189
#define GA_PARENT
Definition: winuser.h:2864

Referenced by CheckListWndProc(), DIALOG_CreateIndirect(), EndDialog(), HardwareDlgProc(), init_procs(), IntGetWindowLong(), MonitorSelWndProc(), MonthCalReload(), MonthCalWndProc(), CSysPagerWnd::OnCreate(), CMenuFocusManager::ProcessMouseMove(), RememberLastActive(), SHELL32_FileOperation(), CProgressDialog::StartProgressDialog(), test_CShellMenu_with_DeskBar(), test_dpi_mapping(), and ThemePreWindowProc().

◆ GetClientRect()

BOOL WINAPI GetClientRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 965 of file window.c.

966{
967 PWND Wnd = ValidateHwnd(hWnd);
968
969 if (!Wnd) return FALSE;
970 if (Wnd->style & WS_MINIMIZED)
971 {
972 lpRect->left = lpRect->top = 0;
975 return TRUE;
976 }
977 if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
978 {
979/* lpRect->left = lpRect->top = 0;
980 lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left;
981 lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top;
982*/
983 *lpRect = Wnd->rcClient;
984 OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top);
985 }
986 else
987 {
988 lpRect->left = lpRect->top = 0;
989 lpRect->right = Wnd->rcClient.right;
990 lpRect->bottom = Wnd->rcClient.bottom;
991/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
992 lpRect->right = GetSystemMetrics(SM_CXSCREEN);
993 lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
994*/ }
995 return TRUE;
996}
RECT rcClient
Definition: ntuser.h:717
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define WS_MINIMIZED
Definition: undocuser.h:20
#define SM_CXMINIMIZED
Definition: winuser.h:1031
#define SM_CYMINIMIZED
Definition: winuser.h:1032
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)

◆ GetDesktopWindow()

HWND WINAPI GetDesktopWindow ( VOID  )

Definition at line 628 of file window.c.

629{
630 PWND Wnd;
631 HWND Ret = NULL;
632
634 {
635 Wnd = GetThreadDesktopWnd();
636 if (Wnd != NULL)
637 Ret = UserHMGetHandle(Wnd);
638 }
640 {
641 /* Do nothing */
642 }
643 _SEH2_END;
644
645 return Ret;
646}

◆ GetFocus()

HWND WINAPI GetFocus ( VOID  )

Definition at line 1863 of file window.c.

1864{
1866}
@ THREADSTATE_FOCUSWINDOW
Definition: ntuser.h:2477
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:240

◆ GetLastActivePopup()

HWND WINAPI GetLastActivePopup ( HWND  hWnd)

Definition at line 1003 of file window.c.

1004{
1005 PWND Wnd;
1006 HWND Ret = hWnd;
1007
1008 Wnd = ValidateHwnd(hWnd);
1009 if (Wnd != NULL)
1010 {
1011 _SEH2_TRY
1012 {
1013 if (Wnd->spwndLastActive)
1014 {
1015 PWND LastActive = DesktopPtrToUser(Wnd->spwndLastActive);
1016 Ret = UserHMGetHandle(LastActive);
1017 }
1018 }
1020 {
1021 /* Do nothing */
1022 }
1023 _SEH2_END;
1024 }
1025 return Ret;
1026}
struct _WND * spwndLastActive
Definition: ntuser.h:739

◆ GetParent()

HWND WINAPI GetParent ( HWND  hWnd)

Definition at line 1033 of file window.c.

1034{
1035 PWND Wnd, WndParent;
1036 HWND Ret = NULL;
1037
1038 Wnd = ValidateHwnd(hWnd);
1039 if (Wnd != NULL)
1040 {
1041 _SEH2_TRY
1042 {
1043 WndParent = NULL;
1044 if (Wnd->style & WS_POPUP)
1045 {
1046 if (Wnd->spwndOwner != NULL)
1047 WndParent = DesktopPtrToUser(Wnd->spwndOwner);
1048 }
1049 else if (Wnd->style & WS_CHILD)
1050 {
1051 if (Wnd->spwndParent != NULL)
1052 WndParent = DesktopPtrToUser(Wnd->spwndParent);
1053 }
1054
1055 if (WndParent != NULL)
1056 Ret = UserHMGetHandle(WndParent);
1057 }
1059 {
1060 /* Do nothing */
1061 }
1062 _SEH2_END;
1063 }
1064
1065 return Ret;
1066}
struct _WND * spwndOwner
Definition: ntuser.h:715

◆ GetProcessDefaultLayout()

BOOL WINAPI GetProcessDefaultLayout ( DWORD pdwDefaultLayout)

Definition at line 1073 of file window.c.

1074{
1076}
DWORD_PTR NTAPI NtUserCallOneParam(DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:153
@ ONEPARAM_ROUTINE_GETPROCDEFLAYOUT
Definition: ntuser.h:1573

◆ GetProgmanWindow()

HWND WINAPI GetProgmanWindow ( VOID  )

Definition at line 1896 of file window.c.

1897{
1899}
@ THREADSTATE_PROGMANWINDOW
Definition: ntuser.h:2496

◆ GetRealWindowOwner()

DWORD WINAPI GetRealWindowOwner ( HWND  hwnd)

Definition at line 1869 of file window.c.

1870{
1872}
#define QUERY_WINDOW_REAL_ID
Definition: ntuser.h:2837
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4207

Referenced by ResetUserApiHook().

◆ GetTaskmanWindow()

HWND WINAPI GetTaskmanWindow ( VOID  )

Definition at line 1905 of file window.c.

1906{
1908}
@ THREADSTATE_TASKMANWINDOW
Definition: ntuser.h:2497

◆ GetTopWindow()

HWND WINAPI GetTopWindow ( HWND  hWnd)

Definition at line 1164 of file window.c.

1165{
1166 if (!hWnd) hWnd = GetDesktopWindow();
1167 return GetWindow(hWnd, GW_CHILD);
1168}

◆ GetWindow()

HWND WINAPI GetWindow ( HWND  hWnd,
UINT  uCmd 
)

Definition at line 1083 of file window.c.

1085{
1086 PWND Wnd, FoundWnd;
1087 HWND Ret = NULL;
1088
1089 Wnd = ValidateHwnd(hWnd);
1090 if (!Wnd)
1091 return NULL;
1092
1093 _SEH2_TRY
1094 {
1095 FoundWnd = NULL;
1096 switch (uCmd)
1097 {
1098 case GW_OWNER:
1099 if (Wnd->spwndOwner != NULL)
1100 FoundWnd = DesktopPtrToUser(Wnd->spwndOwner);
1101 break;
1102
1103 case GW_HWNDFIRST:
1104 if(Wnd->spwndParent != NULL)
1105 {
1106 FoundWnd = DesktopPtrToUser(Wnd->spwndParent);
1107 if (FoundWnd->spwndChild != NULL)
1108 FoundWnd = DesktopPtrToUser(FoundWnd->spwndChild);
1109 }
1110 break;
1111 case GW_HWNDNEXT:
1112 if (Wnd->spwndNext != NULL)
1113 FoundWnd = DesktopPtrToUser(Wnd->spwndNext);
1114 break;
1115
1116 case GW_HWNDPREV:
1117 if (Wnd->spwndPrev != NULL)
1118 FoundWnd = DesktopPtrToUser(Wnd->spwndPrev);
1119 break;
1120
1121 case GW_CHILD:
1122 if (Wnd->spwndChild != NULL)
1123 FoundWnd = DesktopPtrToUser(Wnd->spwndChild);
1124 break;
1125
1126 case GW_HWNDLAST:
1127 FoundWnd = Wnd;
1128 while ( FoundWnd->spwndNext != NULL)
1129 FoundWnd = DesktopPtrToUser(FoundWnd->spwndNext);
1130 break;
1131
1132 case GW_ENABLEDPOPUP:
1133 {
1135 if (pwndPopup)
1136 FoundWnd = DesktopPtrToUser(pwndPopup);
1137 break;
1138 }
1139
1140 default:
1141 {
1143 break;
1144 }
1145 }
1146
1147 if (FoundWnd != NULL)
1148 Ret = UserHMGetHandle(FoundWnd);
1149 }
1151 {
1152 /* Do nothing */
1153 }
1154 _SEH2_END;
1155
1156 return Ret;
1157}
struct _WND * PWND
@ HWND_ROUTINE_DWP_GETENABLEDPOPUP
Definition: ntuser.h:1618
DWORD_PTR NTAPI NtUserCallHwnd(HWND hWnd, DWORD Routine)
Definition: simplecall.c:711
struct _WND * spwndPrev
Definition: ntuser.h:712
struct _WND * spwndChild
Definition: ntuser.h:714
struct _WND * spwndNext
Definition: ntuser.h:711
VOID WINAPI UserSetLastError(IN DWORD dwErrCode)
Definition: misc.c:13
#define ERROR_INVALID_GW_COMMAND
Definition: winerror.h:924
#define GW_HWNDFIRST
Definition: winuser.h:775
#define GW_HWNDLAST
Definition: winuser.h:776
#define GW_ENABLEDPOPUP
Definition: winuser.h:778
#define GW_HWNDNEXT
Definition: winuser.h:772
#define GW_HWNDPREV
Definition: winuser.h:773

Referenced by AnyPopup(), CreateWindowExA(), CreateWindowExW(), and GetTopWindow().

◆ GetWindowContextHelpId()

DWORD WINAPI GetWindowContextHelpId ( HWND  hwnd)

Definition at line 1824 of file window.c.

1825{
1827}
EXTINLINE DWORD NtUserxGetWindowContextHelpId(HWND hwnd)
Definition: ntwrapper.h:726

◆ GetWindowInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo ( HWND  hWnd,
PWINDOWINFO  pwi 
)

Definition at line 1177 of file window.c.

1179{
1180 PWND pWnd;
1181 PCLS pCls = NULL;
1182 SIZE Size = {0,0};
1183 BOOL Ret = FALSE;
1184
1185 if ( !pwi || pwi->cbSize != sizeof(WINDOWINFO))
1186 SetLastError(ERROR_INVALID_PARAMETER); // Just set the error and go!
1187
1188 pWnd = ValidateHwnd(hWnd);
1189 if (!pWnd)
1190 return Ret;
1191
1192 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &Size, FALSE);
1193
1194 _SEH2_TRY
1195 {
1196 pCls = DesktopPtrToUser(pWnd->pcls);
1197 pwi->rcWindow = pWnd->rcWindow;
1198 pwi->rcClient = pWnd->rcClient;
1199 pwi->dwStyle = pWnd->style;
1200 pwi->dwExStyle = pWnd->ExStyle;
1201 pwi->cxWindowBorders = Size.cx;
1202 pwi->cyWindowBorders = Size.cy;
1203 pwi->dwWindowStatus = 0;
1204 if (pWnd->state & WNDS_ACTIVEFRAME || (GetActiveWindow() == hWnd))
1206 pwi->atomWindowType = (pCls ? pCls->atomClassName : 0 );
1207
1208 if ( pWnd->state2 & WNDS2_WIN50COMPAT )
1209 {
1210 pwi->wCreatorVersion = 0x500;
1211 }
1212 else if ( pWnd->state2 & WNDS2_WIN40COMPAT )
1213 {
1214 pwi->wCreatorVersion = 0x400;
1215 }
1216 else if ( pWnd->state2 & WNDS2_WIN31COMPAT )
1217 {
1218 pwi->wCreatorVersion = 0x30A;
1219 }
1220 else
1221 {
1222 pwi->wCreatorVersion = 0x300;
1223 }
1224
1225 Ret = TRUE;
1226 }
1228 {
1229 /* Do nothing */
1230 }
1231 _SEH2_END;
1232
1233 return Ret;
1234}
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:649
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:650
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:611
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:651
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:894
Definition: ntuser.h:566
RTL_ATOM atomClassName
Definition: ntuser.h:568
DWORD ExStyle
Definition: ntuser.h:704
PCLS pcls
Definition: ntuser.h:720
DWORD state2
Definition: ntuser.h:702
DWORD state
Definition: ntuser.h:701
RECT rcWindow
Definition: ntuser.h:716
RECT rcClient
Definition: winuser.h:3844
DWORD dwWindowStatus
Definition: winuser.h:3847
ATOM atomWindowType
Definition: winuser.h:3850
DWORD cbSize
Definition: winuser.h:3842
DWORD dwExStyle
Definition: winuser.h:3846
DWORD dwStyle
Definition: winuser.h:3845
WORD wCreatorVersion
Definition: winuser.h:3851
UINT cxWindowBorders
Definition: winuser.h:3848
UINT cyWindowBorders
Definition: winuser.h:3849
RECT rcWindow
Definition: winuser.h:3843
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
#define WS_ACTIVECAPTION
Definition: winuser.h:2678

◆ GetWindowModuleFileNameA()

UINT WINAPI GetWindowModuleFileNameA ( HWND  hwnd,
LPSTR  lpszFileName,
UINT  cchFileNameMax 
)

Definition at line 1241 of file window.c.

1244{
1245 PWND Wnd = ValidateHwnd(hwnd);
1246
1247 if (!Wnd)
1248 return 0;
1249
1250 return GetModuleFileNameA(Wnd->hModule, lpszFileName, cchFileNameMax);
1251}
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
HINSTANCE hModule
Definition: ntuser.h:708

◆ GetWindowModuleFileNameW()

UINT WINAPI GetWindowModuleFileNameW ( HWND  hwnd,
LPWSTR  lpszFileName,
UINT  cchFileNameMax 
)

Definition at line 1258 of file window.c.

1261{
1262 PWND Wnd = ValidateHwnd(hwnd);
1263
1264 if (!Wnd)
1265 return 0;
1266
1267 return GetModuleFileNameW( Wnd->hModule, lpszFileName, cchFileNameMax );
1268}
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600

◆ GetWindowRect()

BOOL WINAPI GetWindowRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 1274 of file window.c.

1276{
1277 PWND Wnd = ValidateHwnd(hWnd);
1278
1279 if (!Wnd) return FALSE;
1280 if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
1281 {
1282 *lpRect = Wnd->rcWindow;
1283 }
1284 else
1285 {
1286 lpRect->left = lpRect->top = 0;
1287 lpRect->right = Wnd->rcWindow.right;
1288 lpRect->bottom = Wnd->rcWindow.bottom;
1289/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
1290 lpRect->right = GetSystemMetrics(SM_CXSCREEN);
1291 lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1292*/ }
1293 return TRUE;
1294}

◆ GetWindowTextA()

int WINAPI GetWindowTextA ( HWND  hWnd,
LPSTR  lpString,
int  nMaxCount 
)

Definition at line 1300 of file window.c.

1301{
1302 PWND Wnd;
1303 INT Length = 0;
1304
1305 if (lpString == NULL || nMaxCount == 0)
1306 return 0;
1307
1308 Wnd = ValidateHwnd(hWnd);
1309 if (!Wnd)
1310 return 0;
1311
1312 lpString[0] = '\0';
1313
1314 if (!TestWindowProcess(Wnd))
1315 {
1316 _SEH2_TRY
1317 {
1319 }
1321 {
1322 Length = 0;
1323 }
1324 _SEH2_END;
1325 }
1326 else
1327 {
1329 }
1330 //ERR("GWTA Len %d : %s\n",Length,lpString);
1331 return Length;
1332}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
int32_t INT
Definition: typedefs.h:58
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:166
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1637
_In_ int nMaxCount
Definition: winuser.h:4953

Referenced by CC_CheckDigitsInEdit(), Child_WndProc(), ET2_check_change(), formatopts_proc(), GetDlgItemTextA(), gettext_msg_thread(), LISTVIEW_EndEditLabelT(), msgbox_hook_proc(), NPS_ProxyPasswordDialog(), page_dlg_proc(), set_foreground(), sheet_callback(), test_aw_conversion_dlgproc(), test_aw_conversion_dlgproc2(), test_create(), test_defwinproc(), test_desktop_winproc(), test_dtm_set_format(), test_edit_control_2(), test_fontsize(), test_foregroundwindow(), test_get_set_text(), test_gettext(), test_ImmDefaultHwnd(), test_itemedit(), test_params(), test_set_text(), test_UDS_SETBUDDYINT(), test_updown_base(), test_updown_create(), test_WM_CREATE(), TestControlStyleDlgProc(), TREEVIEW_EndEditLabelNow(), WinMain(), and WorkerThread().

◆ GetWindowTextLengthA()

int WINAPI GetWindowTextLengthA ( HWND  hWnd)

Definition at line 1338 of file window.c.

1339{
1340 PWND Wnd;
1341
1342 Wnd = ValidateHwnd(hWnd);
1343 if (!Wnd)
1344 return 0;
1345
1346 if (!TestWindowProcess(Wnd))
1347 {
1348 return DefWindowProcA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1349 }
1350 else
1351 {
1352 return SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1353 }
1354}
#define WM_GETTEXTLENGTH
Definition: winuser.h:1638

◆ GetWindowTextLengthW()

int WINAPI GetWindowTextLengthW ( HWND  hWnd)

Definition at line 1360 of file window.c.

1361{
1362 PWND Wnd;
1363
1364 Wnd = ValidateHwnd(hWnd);
1365 if (!Wnd)
1366 return 0;
1367
1368 if (!TestWindowProcess(Wnd))
1369 {
1370 return DefWindowProcW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1371 }
1372 else
1373 {
1374 return SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1375 }
1376}
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ GetWindowTextW()

int WINAPI GetWindowTextW ( HWND  hWnd,
LPWSTR  lpString,
int  nMaxCount 
)

Definition at line 1382 of file window.c.

1383{
1384 PWND Wnd;
1385 INT Length = 0;
1386
1387 if (lpString == NULL || nMaxCount == 0)
1388 return 0;
1389
1390 Wnd = ValidateHwnd(hWnd);
1391 if (!Wnd)
1392 return 0;
1393
1394 lpString[0] = L'\0';
1395
1396 if (!TestWindowProcess(Wnd))
1397 {
1398 _SEH2_TRY
1399 {
1401 }
1403 {
1404 Length = 0;
1405 }
1406 _SEH2_END;
1407 }
1408 else
1409 {
1411 }
1412 //ERR("GWTW Len %d : %S\n",Length,lpString);
1413 return Length;
1414}

Referenced by AboutDlgProc(), AddressBarProc(), AddToFavoritesDlgProc(), AtlAxWin_wndproc(), BaseControlWindowImpl_get_Caption(), CBUpdateLBox(), ChooseFolder(), CHSourceDlgProc(), CMP_RegisterNotification(), COMBOEX_ComboWndProc(), CompleteSwitch(), CredDialogCommandOk(), DIALOG_IsAccelerator(), DialogProc(), DoTestCaseB(), EnableOkButtonFromEditContents(), EndNowDlgProc(), EnumWindowsProc(), ExportRegistryFile_OFNHookProc(), FILEDLG95_FILENAME_GetFileNames(), find_control(), find_top_window(), find_window_callback(), FindDialogProc(), FontProc(), FontSizeList_GetSelectedFontSize(), FontWndProc(), CDrvDefExt::GeneralPageProc(), get_button_text(), get_window_text(), CSearchBar::GetAddressEditBoxLocations(), GetDlgItemTextW(), CAutoComplete::GetEditText(), GetStringFromDialog(), GetTextboxText(), ATL::CWindow::GetWindowText(), hyperlink_dlgproc(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), ie_dialog_open_proc(), InitializeChkDskDialog(), InitializeFormatDriveDlg(), IPADDRESS_ConstrainField(), IPADDRESS_GetAddress(), IPADDRESS_SubclassProc(), IPADDRESS_UpdateText(), LabelWndProc(), LISTVIEW_Command(), LISTVIEW_EditLabelT(), LISTVIEW_EndEditLabelT(), mask_control_change(), MDI_UpdateFrameText(), MessageBoxTextToClipboard(), modify_dword_dlgproc(), modify_multi_string_dlgproc(), modify_string_dlgproc(), MoreOptDlgProc(), OnCommand(), CFontsDialog::OnFontSize(), CSelectDriveDlg::OnInitDialog(), CShellLink::OnNotify(), OnPaint(), CAddressBand::OnTipText(), CZipExtract::CExtractSettingsPage::OnWizardNext(), paraformat_proc(), PrepareFoldersToScan(), prompt_dlgproc(), promptdisk_ok(), PROPSHEET_DialogProc(), CDownloadManager::RealDlgProc(), RunDlgProc(), BtrfsBalance::SaveBalanceOpts(), SaveCustomPath(), anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc(), SetWelcomeText(), tabstops_proc(), taskdialog_get_label_size(), TcpipFilterPortDlg(), test_aw_conversion_dlgproc(), test_aw_conversion_dlgproc2(), test_gettext(), test_mouse_keyboard(), TREEVIEW_Command(), TREEVIEW_EndEditLabelNow(), UPDOWN_GetBuddyInt(), UPDOWN_SetBuddyInt(), UserpFormatMessages(), ValidateEditContents(), WININET_GetSetPassword(), WININET_PasswordDialog(), WININET_ProxyPasswordDialog(), and WinMain().

◆ GetWindowThreadProcessId()

DWORD WINAPI GetWindowThreadProcessId ( HWND  hWnd,
LPDWORD  lpdwProcessId 
)

Definition at line 1417 of file window.c.

1419{
1420 DWORD Ret = 0;
1421 PTHREADINFO ti;
1422 PWND pWnd = ValidateHwnd(hWnd);
1423
1424 if (!pWnd) return Ret;
1425
1426 ti = pWnd->head.pti;
1427
1428 if (ti)
1429 {
1430 if (ti == GetW32ThreadInfo())
1431 { // We are current.
1432 //FIXME("Current!\n");
1433 if (lpdwProcessId)
1434 *lpdwProcessId = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
1435 Ret = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueThread;
1436 }
1437 else
1438 { // Ask kernel for info.
1439 //FIXME("Kernel call!\n");
1440 if (lpdwProcessId)
1443 }
1444 }
1445 return Ret;
1446}
#define QUERY_WINDOW_UNIQUE_THREAD_ID
Definition: ntuser.h:2833
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:807
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2832
#define NtCurrentTeb
THRDESKHEAD head
Definition: ntuser.h:695
#define DWORD_PTR
Definition: treelist.c:76

◆ InternalGetWindowText()

int WINAPI InternalGetWindowText ( HWND  hWnd,
LPWSTR  lpString,
int  nMaxCount 
)

Definition at line 1833 of file window.c.

1834{
1836 if (Ret == 0 && lpString)
1837 *lpString = L'\0';
1838 return Ret;
1839}
INT NTAPI NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount)
Definition: window.c:4605

◆ IsChild()

BOOL WINAPI IsChild ( HWND  hWndParent,
HWND  hWnd 
)

Definition at line 1453 of file window.c.

1455{
1456 PWND WndParent, DesktopWnd, Wnd;
1457 BOOL Ret = FALSE;
1458
1459 WndParent = ValidateHwnd(hWndParent);
1460 if (!WndParent)
1461 return FALSE;
1462 Wnd = ValidateHwnd(hWnd);
1463 if (!Wnd)
1464 return FALSE;
1465
1466 DesktopWnd = GetThreadDesktopWnd();
1467 if (!DesktopWnd)
1468 return FALSE;
1469
1470 _SEH2_TRY
1471 {
1472 while (Wnd != NULL && ((Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD))
1473 {
1474 if (Wnd->spwndParent != NULL)
1475 {
1476 Wnd = DesktopPtrToUser(Wnd->spwndParent);
1477
1478 if (Wnd == WndParent)
1479 {
1480 Ret = TRUE;
1481 break;
1482 }
1483 }
1484 else
1485 break;
1486 }
1487 }
1489 {
1490 /* Do nothing */
1491 }
1492 _SEH2_END;
1493
1494 return Ret;
1495}

◆ IsHungAppWindow()

BOOL WINAPI IsHungAppWindow ( HWND  hwnd)

Definition at line 1845 of file window.c.

1846{
1848}
#define QUERY_WINDOW_ISHUNG
Definition: ntuser.h:2836

Referenced by CanBeMinimized(), EnumWindowsProc(), Ghost_OnCreate(), Ghost_OnTimer(), and CTaskSwitchWnd::HandleTaskItemClick().

◆ IsIconic()

BOOL WINAPI IsIconic ( HWND  hWnd)

Definition at line 1502 of file window.c.

1503{
1504 PWND Wnd = ValidateHwnd(hWnd);
1505
1506 if (Wnd != NULL)
1507 return (Wnd->style & WS_MINIMIZE) != 0;
1508
1509 return FALSE;
1510}
#define WS_MINIMIZE
Definition: pedump.c:622

◆ IsWindow()

BOOL WINAPI IsWindow ( HWND  hWnd)

Definition at line 1517 of file window.c.

1518{
1520 if (Wnd != NULL)
1521 {
1522 if (Wnd->state & WNDS_DESTROYED)
1523 return FALSE;
1524 return TRUE;
1525 }
1526
1527 return FALSE;
1528}
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:109

◆ IsWindowEnabled()

BOOL WINAPI IsWindowEnabled ( HWND  hWnd)

Definition at line 1591 of file window.c.

1592{
1593 // AG: I don't know if child windows are affected if the parent is
1594 // disabled. I think they stop processing messages but stay appearing
1595 // as enabled.
1596
1598}
#define WS_DISABLED
Definition: pedump.c:621
#define GetWindowLongPtrW
Definition: winuser.h:4905
#define GWL_STYLE
Definition: winuser.h:863

◆ IsWindowInDestroy()

BOOL WINAPI IsWindowInDestroy ( HWND  hWnd)

Definition at line 1984 of file window.c.

1985{
1986 PWND pwnd;
1987 pwnd = ValidateHwnd(hWnd);
1988 if (!pwnd)
1989 return FALSE;
1990 return ((pwnd->state2 & WNDS2_INDESTROY) == WNDS2_INDESTROY);
1991}
#define WNDS2_INDESTROY
Definition: ntuser.h:648

◆ IsWindowUnicode()

BOOL WINAPI IsWindowUnicode ( HWND  hWnd)

Definition at line 1535 of file window.c.

1536{
1537 PWND Wnd = ValidateHwnd(hWnd);
1538
1539 if (Wnd != NULL)
1540 return Wnd->Unicode;
1541
1542 return FALSE;
1543}
UINT Unicode
Definition: ntuser.h:756

◆ IsWindowVisible()

BOOL WINAPI IsWindowVisible ( HWND  hWnd)

Definition at line 1550 of file window.c.

1551{
1552 BOOL Ret = FALSE;
1553 PWND Wnd = ValidateHwnd(hWnd);
1554
1555 if (Wnd != NULL)
1556 {
1557 _SEH2_TRY
1558 {
1559 Ret = TRUE;
1560
1561 do
1562 {
1563 if (!(Wnd->style & WS_VISIBLE))
1564 {
1565 Ret = FALSE;
1566 break;
1567 }
1568
1569 if (Wnd->spwndParent != NULL)
1570 Wnd = DesktopPtrToUser(Wnd->spwndParent);
1571 else
1572 break;
1573
1574 } while (Wnd != NULL);
1575 }
1577 {
1578 Ret = FALSE;
1579 }
1580 _SEH2_END;
1581 }
1582
1583 return Ret;
1584}

◆ IsZoomed()

BOOL WINAPI IsZoomed ( HWND  hWnd)

Definition at line 1605 of file window.c.

1606{
1607 return (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_MAXIMIZE) != 0;
1608}
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by CreateWindowExA(), and CreateWindowExW().

◆ LockSetForegroundWindow()

BOOL WINAPI LockSetForegroundWindow ( UINT  uLockCode)

Definition at line 1615 of file window.c.

1616{
1617 return NtUserxLockSetForegroundWindow(uLockCode);
1618}
EXTINLINE BOOL NtUserxLockSetForegroundWindow(UINT uLockCode)
Definition: ntwrapper.h:841

Referenced by CredDialogProc().

◆ MDI_CalcDefaultChildPos()

void MDI_CalcDefaultChildPos ( HWND  hwndClient,
INT  total,
LPPOINT  lpPos,
INT  delta,
UINT id 
)

Definition at line 308 of file mdi.c.

310{
311 INT nstagger;
312 RECT rect;
314
315 if (total < 0) /* we are called from CreateWindow */
316 {
317 MDICLIENTINFO *ci = get_client_info(hwndClient);
318 total = ci ? ci->nTotalCreated : 0; // Do not portsync wine
319 *id = ci ? ci->idFirstChild + ci->nActiveChildren : 0; // Do not portsync wine
320 TRACE("MDI child id %04x\n", *id);
321 }
322
323 GetClientRect( hwndClient, &rect );
324 if( rect.bottom - rect.top - delta >= spacing )
325 rect.bottom -= delta;
326
327 nstagger = (rect.bottom - rect.top)/(3 * spacing);
328 lpPos[1].x = (rect.right - rect.left - nstagger * spacing);
329 lpPos[1].y = (rect.bottom - rect.top - nstagger * spacing);
330 lpPos[0].x = lpPos[0].y = spacing * (total%(nstagger+1));
size_t total
& rect
Definition: startmenu.cpp:1413
UINT nTotalCreated
Definition: mdi.c:122
UINT idFirstChild
Definition: mdi.c:120
UINT nActiveChildren
Definition: mdi.c:114
static MDICLIENTINFO * get_client_info(HWND client)
Definition: mdi.c:224
#define SM_CYFRAME
Definition: winuser.h:1007
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SM_CYCAPTION
Definition: winuser.h:974

Referenced by CreateWindowExA(), CreateWindowExW(), MDICascade(), and WIN_CreateWindowEx().

◆ OpenIcon()

BOOL WINAPI OpenIcon ( HWND  hWnd)

Definition at line 1655 of file window.c.

1656{
1658 return FALSE;
1659
1661 return TRUE;
1662}

◆ RealChildWindowFromPoint()

HWND WINAPI RealChildWindowFromPoint ( HWND  hwndParent,
POINT  ptParentClientCoords 
)

Definition at line 1669 of file window.c.

1671{
1672 return NtUserRealChildWindowFromPoint(hwndParent, ptParentClientCoords.x, ptParentClientCoords.y);
1673}
HWND NTAPI NtUserRealChildWindowFromPoint(HWND Parent, LONG x, LONG y)
Definition: winpos.c:3513

◆ RtlFreeLargeString()

VOID NTAPI RtlFreeLargeString ( IN PLARGE_STRING  LargeString)

Definition at line 141 of file window.c.

143{
144 if (LargeString->Buffer)
145 {
146 RtlFreeHeap(GetProcessHeap(), 0, LargeString->Buffer);
147 RtlZeroMemory(LargeString, sizeof(LARGE_STRING));
148 }
149}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by User32CreateWindowEx().

◆ RtlInitLargeString()

FORCEINLINE VOID RtlInitLargeString ( OUT PLARGE_STRING  plstr,
LPCVOID  psz,
BOOL  bUnicode 
)

Definition at line 124 of file window.c.

128{
129 if(bUnicode)
130 {
132 }
133 else
134 {
136 }
137}
VOID NTAPI RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING, IN PCSZ, IN INT)
Definition: rtlstr.c:17
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51

Referenced by User32CreateWindowEx().

◆ ScrollWindow()

BOOL WINAPI ScrollWindow ( HWND  hWnd,
int  dx,
int  dy,
CONST RECT lpRect,
CONST RECT prcClip 
)

Definition at line 1914 of file window.c.

1919{
1921 dx,
1922 dy,
1923 lpRect,
1924 prcClip,
1925 0,
1926 NULL,
1928}
#define ERROR(name)
Definition: error_private.h:53
DWORD NTAPI NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect, const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
Definition: scrollex.c:571
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define SW_SCROLLWNDDCE
Definition: undocuser.h:94
#define SW_SCROLLCHILDREN
Definition: winuser.h:2597
#define SW_INVALIDATE
Definition: winuser.h:2598
#define SW_ERASE
Definition: winuser.h:2599

◆ ScrollWindowEx()

INT WINAPI ScrollWindowEx ( HWND  hWnd,
int  dx,
int  dy,
CONST RECT prcScroll,
CONST RECT prcClip,
HRGN  hrgnUpdate,
LPRECT  prcUpdate,
UINT  flags 
)

Definition at line 1936 of file window.c.

1944{
1945 if (flags & SW_SMOOTHSCROLL)
1946 {
1947 FIXME("SW_SMOOTHSCROLL not supported.\n");
1948 // Fall through....
1949 }
1951 dx,
1952 dy,
1953 prcScroll,
1954 prcClip,
1955 hrgnUpdate,
1956 prcUpdate,
1957 flags);
1958}
#define FIXME(fmt,...)
Definition: precomp.h:53
GLbitfield flags
Definition: glext.h:7161

◆ SetForegroundWindow()

BOOL WINAPI SetForegroundWindow ( HWND  hWnd)

Definition at line 1679 of file window.c.

1680{
1682}
EXTINLINE BOOL NtUserxSetForegroundWindow(HWND hWnd)
Definition: ntwrapper.h:788

◆ SetLastErrorEx()

VOID WINAPI SetLastErrorEx ( DWORD  dwErrCode,
DWORD  dwType 
)

Definition at line 1854 of file window.c.

1855{
1856 SetLastError(dwErrCode);
1857}

◆ SetProcessDefaultLayout()

BOOL WINAPI SetProcessDefaultLayout ( DWORD  dwDefaultLayout)

Definition at line 1689 of file window.c.

1690{
1692}
@ ONEPARAM_ROUTINE_SETPROCDEFLAYOUT
Definition: ntuser.h:1606

Referenced by _tWinMain(), LPK_ApplyMirroring(), START_TEST(), WinMain(), and wWinMain().

◆ SetProgmanWindow()

HWND WINAPI SetProgmanWindow ( HWND  hWnd)

Definition at line 1887 of file window.c.

1888{
1890}
EXTINLINE HWND NtUserxSetProgmanWindow(HWND hWnd)
Definition: ntwrapper.h:763

◆ SetTaskmanWindow()

HWND WINAPI SetTaskmanWindow ( HWND  hWnd)

Definition at line 1878 of file window.c.

1879{
1881}
EXTINLINE HWND NtUserxSetTaskmanWindow(HWND hWnd)
Definition: ntwrapper.h:758

◆ SetWindowContextHelpId()

BOOL WINAPI SetWindowContextHelpId ( HWND  hwnd,
DWORD  dwContextHelpId 
)

Definition at line 1814 of file window.c.

1816{
1817 return NtUserxSetWindowContextHelpId(hwnd, dwContextHelpId);
1818}
EXTINLINE BOOL NtUserxSetWindowContextHelpId(HWND hWnd, DWORD_PTR dwContextHelpId)
Definition: ntwrapper.h:706

◆ SetWindowTextA()

BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextA ( HWND  hWnd,
LPCSTR  lpString 
)

Definition at line 1701 of file window.c.

1703{
1704 PWND pwnd;
1705
1706 pwnd = ValidateHwnd(hWnd);
1707 if (pwnd)
1708 {
1709 if (!TestWindowProcess(pwnd))
1710 {
1711 /* do not send WM_GETTEXT messages to other processes */
1712 return (DefWindowProcA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1713 }
1714 return (SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1715 }
1716 return FALSE;
1717}
#define WM_SETTEXT
Definition: winuser.h:1636

◆ SetWindowTextW()

BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextW ( HWND  hWnd,
LPCWSTR  lpString 
)

Definition at line 1726 of file window.c.

1728{
1729 PWND pwnd;
1730
1731 pwnd = ValidateHwnd(hWnd);
1732 if (pwnd)
1733 {
1734 if (!TestWindowProcess(pwnd))
1735 {
1736 /* do not send WM_GETTEXT messages to other processes */
1737 return (DefWindowProcW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1738 }
1739 return (SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1740 }
1741 return FALSE;
1742}

◆ ShowOwnedPopups()

BOOL WINAPI ShowOwnedPopups ( HWND  hWnd,
BOOL  fShow 
)

Definition at line 1749 of file window.c.

1750{
1751 return NtUserxShowOwnedPopups(hWnd, fShow);
1752}
EXTINLINE BOOL NtUserxShowOwnedPopups(HWND hWnd, BOOL fShow)
Definition: ntwrapper.h:696

◆ SwitchToThisWindow()

◆ UpdateLayeredWindow()

BOOL WINAPI UpdateLayeredWindow ( HWND  hwnd,
HDC  hdcDst,
POINT pptDst,
SIZE psize,
HDC  hdcSrc,
POINT pptSrc,
COLORREF  crKey,
BLENDFUNCTION pbl,
DWORD  dwFlags 
)

Definition at line 1759 of file window.c.

1768{
1769 if (dwFlags & ULW_EX_NORESIZE) /* only valid for UpdateLayeredWindowIndirect */
1770 {
1772 return FALSE;
1773 }
1775 hdcDst,
1776 pptDst,
1777 psize,
1778 hdcSrc,
1779 pptSrc,
1780 crKey,
1781 pbl,
1782 dwFlags,
1783 NULL);
1784}
BOOL NTAPI NtUserUpdateLayeredWindow(HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags, RECT *prcDirty)
Definition: layered.c:341
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
#define ULW_EX_NORESIZE
Definition: winuser.h:2863
static HDC hdcSrc
Definition: xlate.c:32
static HDC hdcDst
Definition: xlate.c:32

Referenced by init_procs().

◆ UpdateLayeredWindowIndirect()

BOOL WINAPI UpdateLayeredWindowIndirect ( HWND  hwnd,
const UPDATELAYEREDWINDOWINFO *  info 
)

Definition at line 1790 of file window.c.

1792{
1793 if (info && info->cbSize == sizeof(*info))
1794 {
1796 info->hdcDst,
1797 (POINT *)info->pptDst,
1798 (SIZE *)info->psize,
1799 info->hdcSrc,
1800 (POINT *)info->pptSrc,
1801 info->crKey,
1802 (BLENDFUNCTION *)info->pblend,
1803 info->dwFlags,
1804 (RECT *)info->prcDirty);
1805 }
1807 return FALSE;
1808}

◆ User32CallSendAsyncProcForKernel()

NTSTATUS WINAPI User32CallSendAsyncProcForKernel ( PVOID  Arguments,
ULONG  ArgumentLength 
)

Definition at line 24 of file window.c.

25{
27
28 TRACE("User32CallSendAsyncProcKernel()\n");
29
30 CallbackArgs = (PSENDASYNCPROC_CALLBACK_ARGUMENTS)Arguments;
31
32 if (ArgumentLength != sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS))
33 {
35 }
36
37 CallbackArgs->Callback(CallbackArgs->Wnd,
38 CallbackArgs->Msg,
39 CallbackArgs->Context,
40 CallbackArgs->Result);
41 return(STATUS_SUCCESS);
42}
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _SENDASYNCPROC_CALLBACK_ARGUMENTS * PSENDASYNCPROC_CALLBACK_ARGUMENTS

◆ User32CreateWindowEx()

HWND WINAPI User32CreateWindowEx ( DWORD  dwExStyle,
LPCSTR  lpClassName,
LPCSTR  lpWindowName,
DWORD  dwStyle,
int  x,
int  y,
int  nWidth,
int  nHeight,
HWND  hWndParent,
HMENU  hMenu,
HINSTANCE  hInstance,
LPVOID  lpParam,
DWORD  dwFlags 
)

Definition at line 152 of file window.c.

165{
166 LARGE_STRING WindowName;
167 LARGE_STRING lstrClassName, *plstrClassName;
168 LARGE_STRING lstrClassVersion, *plstrClassVersion;
169 UNICODE_STRING ClassName;
170 UNICODE_STRING ClassVersion;
171 WNDCLASSEXA wceA;
172 WNDCLASSEXW wceW;
174 DWORD dwLastError;
175 BOOL Unicode, ClassFound = FALSE;
176 HWND Handle = NULL;
177 LPCWSTR lpszClsVersion;
178 LPCWSTR lpLibFileName = NULL;
179 HANDLE pCtx = NULL;
180 DWORD dwFlagsVer;
181
182#if 0
183 DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
184#endif
185
187 TRACE("Module Version %x\n",dwFlagsVer);
188
190 {
191 TRACE("RegisterSystemControls\n");
193 }
194
195 Unicode = !(dwFlags & NUCWE_ANSI);
196
197 if (IS_ATOM(lpClassName))
198 {
199 plstrClassName = (PVOID)lpClassName;
200 }
201 else
202 {
203 if (Unicode)
204 {
205 RtlInitUnicodeString(&ClassName, (PCWSTR)lpClassName);
206 }
207 else
208 {
209 if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, (PCSZ)lpClassName))
210 {
212 return NULL;
213 }
214 }
215
216 /* Copy it to a LARGE_STRING */
217 lstrClassName.Buffer = ClassName.Buffer;
218 lstrClassName.Length = ClassName.Length;
219 lstrClassName.MaximumLength = ClassName.MaximumLength;
220 plstrClassName = &lstrClassName;
221 }
222
223 /* Initialize a LARGE_STRING */
224 RtlInitLargeString(&WindowName, lpWindowName, Unicode);
225
226 // HACK: The current implementation expects the Window name to be UNICODE
227 if (!Unicode)
228 {
230 PSTR AnsiBuffer = WindowName.Buffer;
231 ULONG AnsiLength = WindowName.Length;
232
233 WindowName.Length = 0;
234 WindowName.MaximumLength = AnsiLength * sizeof(WCHAR);
235 WindowName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
236 0,
237 WindowName.MaximumLength);
238 if (!WindowName.Buffer)
239 {
241 goto cleanup;
242 }
243
245 WindowName.MaximumLength,
246 &WindowName.Length,
248 AnsiLength);
249 if (!NT_SUCCESS(Status))
250 {
251 goto cleanup;
252 }
253 }
254
255 if (!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
256 {
257 if (Unicode)
258 {
259 wceW.cbSize = sizeof(wceW);
260 if (GetClassInfoExW(hInstance, (LPCWSTR)lpClassName, &wceW) && wceW.lpszMenuName)
261 {
262 hMenu = LoadMenuW(hInstance, wceW.lpszMenuName);
263 }
264 }
265 else
266 {
267 wceA.cbSize = sizeof(wceA);
268 if (GetClassInfoExA(hInstance, lpClassName, &wceA) && wceA.lpszMenuName)
269 {
270 hMenu = LoadMenuA(hInstance, wceA.lpszMenuName);
271 }
272 }
273 }
274
275 if (!Unicode) dwExStyle |= WS_EX_SETANSICREATOR;
276
277 lpszClsVersion = ClassNameToVersion(lpClassName, NULL, &lpLibFileName, &pCtx, !Unicode);
278 if (!lpszClsVersion)
279 {
280 plstrClassVersion = plstrClassName;
281 }
282 else
283 {
284 RtlInitUnicodeString(&ClassVersion, lpszClsVersion);
285 lstrClassVersion.Buffer = ClassVersion.Buffer;
286 lstrClassVersion.Length = ClassVersion.Length;
287 lstrClassVersion.MaximumLength = ClassVersion.MaximumLength;
288 plstrClassVersion = &lstrClassVersion;
289 }
290
291 for (;;)
292 {
293 Handle = NtUserCreateWindowEx(dwExStyle,
294 plstrClassName,
295 plstrClassVersion,
296 &WindowName,
297 dwStyle,
298 x,
299 y,
300 nWidth,
301 nHeight,
303 hMenu,
304 hInstance,
305 lpParam,
306 dwFlagsVer,
307 pCtx );
308 if (Handle) break;
309 if (!lpLibFileName) break;
310 if (!ClassFound)
311 {
312 dwLastError = GetLastError();
313 if (dwLastError == ERROR_CANNOT_FIND_WND_CLASS)
314 {
315 ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule);
316 if (ClassFound) continue;
317 }
318 }
319 if (hLibModule)
320 {
321 dwLastError = GetLastError();
323 SetLastError(dwLastError);
325 }
326 break;
327 }
328
329#if 0
330 DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
331#endif
332
333cleanup:
334 if (!Unicode)
335 {
336 if (!IS_ATOM(lpClassName))
337 RtlFreeUnicodeString(&ClassName);
338
339 RtlFreeLargeString(&WindowName);
340 }
341
342 return Handle;
343}
CHAR AnsiBuffer[1024]
Definition: debug.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define FreeLibrary(x)
Definition: compat.h:748
static void cleanup(void)
Definition: main.c:1335
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
ULONG Handle
Definition: gdb_input.c:15
#define DbgPrint
Definition: hal.h:12
HWND NTAPI NtUserCreateWindowEx(DWORD dwExStyle, PLARGE_STRING plstrClassName, PLARGE_STRING plstrClsVersion, PLARGE_STRING plstrWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, DWORD dwFlags, PVOID acbiBuffer)
Definition: window.c:2683
ULONG RtlGetExpWinVer(_In_ PVOID BaseAddress)
Definition: image.c:20
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeN(_Out_ PWCH UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH MbString, _In_ ULONG MbSize)
Definition: nlsboot.c:62
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
BOOL FASTCALL VersionRegisterClass(PCWSTR, LPCWSTR, HANDLE, HMODULE *)
Definition: class.c:195
HINSTANCE hLibModule
Definition: sfc.c:23
ULONG Length
Definition: ntuser.h:91
ULONG MaximumLength
Definition: ntuser.h:92
PVOID Buffer
Definition: ntuser.h:94
USHORT MaximumLength
Definition: env_spec_w32.h:370
LPCSTR lpszMenuName
Definition: winuser.h:3286
UINT cbSize
Definition: winuser.h:3277
LPCWSTR lpszMenuName
Definition: winuser.h:3301
UINT cbSize
Definition: winuser.h:3292
const uint16_t * PCWSTR
Definition: typedefs.h:57
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG
Definition: typedefs.h:59
CONST char * PCSZ
Definition: umtypes.h:125
#define WS_EX_SETANSICREATOR
Definition: undocuser.h:30
FORCEINLINE VOID RtlInitLargeString(OUT PLARGE_STRING plstr, LPCVOID psz, BOOL bUnicode)
Definition: window.c:124
VOID NTAPI RtlFreeLargeString(IN PLARGE_STRING LargeString)
Definition: window.c:141
LPCWSTR FASTCALL ClassNameToVersion(const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi)
Definition: class.c:85
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:888
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
HMENU WINAPI LoadMenuA(_In_opt_ HINSTANCE, _In_ LPCSTR)

Referenced by CreateWindowExA(), and CreateWindowExW().

◆ User32EnumWindows()

static BOOL User32EnumWindows ( HDESK  hDesktop,
HWND  hWndparent,
WNDENUMPROC  lpfn,
LPARAM  lParam,
DWORD  dwThreadId,
BOOL  bChildren 
)
static

Definition at line 650 of file window.c.

656{
657 DWORD i, dwCount = 0;
658 HWND* pHwnd = NULL;
659 HANDLE hHeap;
661
662 if (!lpfn)
663 {
665 return FALSE;
666 }
667
668 /* FIXME instead of always making two calls, should we use some
669 sort of persistent buffer and only grow it ( requiring a 2nd
670 call ) when the buffer wasn't already big enough? */
671 /* first get how many window entries there are */
672 Status = NtUserBuildHwndList(hDesktop,
673 hWndparent,
674 bChildren,
676 dwCount,
677 NULL,
678 &dwCount);
679 if (!NT_SUCCESS(Status))
680 return FALSE;
681
682 if (!dwCount)
683 {
684 if (!dwThreadId)
685 return FALSE;
686 else
687 return TRUE;
688 }
689
690 /* allocate buffer to receive HWND handles */
691 hHeap = GetProcessHeap();
692 pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1));
693 if (!pHwnd)
694 {
696 return FALSE;
697 }
698
699 /* now call kernel again to fill the buffer this time */
700 Status = NtUserBuildHwndList(hDesktop,
701 hWndparent,
702 bChildren,
704 dwCount,
705 pHwnd,
706 &dwCount);
707 if (!NT_SUCCESS(Status))
708 {
709 if (pHwnd)
710 HeapFree(hHeap, 0, pHwnd);
711 return FALSE;
712 }
713
714 /* call the user's callback function until we're done or
715 they tell us to quit */
716 for ( i = 0; i < dwCount; i++ )
717 {
718 /* FIXME I'm only getting NULLs from Thread Enumeration, and it's
719 * probably because I'm not doing it right in NtUserBuildHwndList.
720 * Once that's fixed, we shouldn't have to check for a NULL HWND
721 * here
722 * This is now fixed in revision 50205. (jt)
723 */
724 if (!pHwnd[i]) /* don't enumerate a NULL HWND */
725 continue;
726 if (!(*lpfn)(pHwnd[i], lParam))
727 {
728 HeapFree ( hHeap, 0, pHwnd );
729 return FALSE;
730 }
731 }
732 if (pHwnd)
733 HeapFree(hHeap, 0, pHwnd);
734 return TRUE;
735}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
NTSTATUS NTAPI NtUserBuildHwndList(HDESK hDesktop, HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, ULONG cHwnd, HWND *phwndList, ULONG *pcHwndNeeded)
Definition: window.c:1521

Referenced by EnumChildWindows(), EnumDesktopWindows(), EnumThreadWindows(), and EnumWindows().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )