ReactOS 0.4.15-dev-7788-g1ad9096
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)
 
DWORD FASTCALL RtlGetExpWinVer (HMODULE hModule)
 
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 (HWND hwnd, UINT gaFlags)
 
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 1655 of file window.c.

1658{
1659 /* FIXME Add animation code */
1660
1661 /* If trying to show/hide and it's already *
1662 * shown/hidden or invalid window, fail with *
1663 * invalid parameter */
1664
1665 BOOL visible;
1666 visible = IsWindowVisible(hwnd);
1667 if(!IsWindow(hwnd) ||
1668 (visible && !(dwFlags & AW_HIDE)) ||
1669 (!visible && (dwFlags & AW_HIDE)))
1670 {
1672 return FALSE;
1673 }
1674
1675 ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1676
1677 return TRUE;
1678}
#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:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOWNA
Definition: winuser.h:778
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI IsWindowVisible(_In_ HWND)

◆ AnyPopup()

BOOL WINAPI AnyPopup ( VOID  )

Definition at line 1994 of file window.c.

1995{
1996 int i;
1997 BOOL retvalue;
1999
2000 if (!list) return FALSE;
2001 for (i = 0; list[i]; i++)
2002 {
2003 if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break;
2004 }
2005 retvalue = (list[i] != 0);
2006 HeapFree( GetProcessHeap(), 0, list );
2007 return retvalue;
2008}
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:1123
#define GW_OWNER
Definition: winuser.h:766
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656

◆ 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:3506
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
#define HWND_TOP
Definition: winuser.h:1207

◆ 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:3224

◆ 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: debug.h:110
#define IS_ATOM(x)
Definition: class.h:3
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#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:5815
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5344
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:771
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 380 of file window.c.

392{
394 HWND hwnd;
395
397 {
398 TRACE("CreateWindowExA RegisterSystemControls\n");
400 }
401
402 if (dwExStyle & WS_EX_MDICHILD)
403 {
404 POINT mPos[2];
405 UINT id = 0;
406 HWND top_child;
407 PWND pWndParent;
408
409 pWndParent = ValidateHwnd(hWndParent);
410
411 if (!pWndParent) return NULL;
412
413 if (pWndParent->fnid != FNID_MDICLIENT) // wine uses WIN_ISMDICLIENT
414 {
415 WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
416 goto skip_mdi;
417 }
418
419 /* lpParams of WM_[NC]CREATE is different for MDI children.
420 * MDICREATESTRUCT members have the originally passed values.
421 */
422 mdi.szClass = lpClassName;
423 mdi.szTitle = lpWindowName;
424 mdi.hOwner = hInstance;
425 mdi.x = x;
426 mdi.y = y;
427 mdi.cx = nWidth;
428 mdi.cy = nHeight;
429 mdi.style = dwStyle;
430 mdi.lParam = (LPARAM)lpParam;
431
432 lpParam = (LPVOID)&mdi;
433
434 if (pWndParent->style & MDIS_ALLCHILDSTYLES)
435 {
436 if (dwStyle & WS_POPUP)
437 {
438 WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
439 return(0);
440 }
441 dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
442 }
443 else
444 {
445 dwStyle &= ~WS_POPUP;
448 }
449
450 top_child = GetWindow(hWndParent, GW_CHILD);
451
452 if (top_child)
453 {
454 /* Restore current maximized child */
455 if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
456 {
457 TRACE("Restoring current maximized child %p\n", top_child);
458 SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
459 ShowWindow(top_child, SW_RESTORE);
460 SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
461 }
462 }
463
464 MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
465
466 if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
467
468 if (dwStyle & (WS_CHILD | WS_POPUP))
469 {
470 if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
471 {
472 x = mPos[0].x;
473 y = mPos[0].y;
474 }
475 if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
476 nWidth = mPos[1].x;
477 if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
478 nHeight = mPos[1].y;
479 }
480 }
481
482skip_mdi:
483 hwnd = User32CreateWindowEx(dwExStyle,
484 lpClassName,
485 lpWindowName,
486 dwStyle,
487 x,
488 y,
489 nWidth,
490 nHeight,
492 hMenu,
493 hInstance,
494 lpParam,
495 NUCWE_ANSI);
496 return hwnd;
497}
#define CW_USEDEFAULT16
Definition: resource.h:7
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WARN(fmt,...)
Definition: debug.h:112
HINSTANCE hInstance
Definition: charmap.c:19
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
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:76
BOOL WINAPI IsZoomed(HWND hWnd)
Definition: window.c:1635
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:180
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:779
#define GW_CHILD
Definition: winuser.h:763
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1616

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

518{
520 HWND hwnd;
521
523 {
524 ERR("CreateWindowExW RegisterSystemControls\n");
526 }
527
528 if (dwExStyle & WS_EX_MDICHILD)
529 {
530 POINT mPos[2];
531 UINT id = 0;
532 HWND top_child;
533 PWND pWndParent;
534
535 pWndParent = ValidateHwnd(hWndParent);
536
537 if (!pWndParent) return NULL;
538
539 if (pWndParent->fnid != FNID_MDICLIENT)
540 {
541 WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
542 goto skip_mdi;
543 }
544
545 /* lpParams of WM_[NC]CREATE is different for MDI children.
546 * MDICREATESTRUCT members have the originally passed values.
547 */
548 mdi.szClass = lpClassName;
549 mdi.szTitle = lpWindowName;
550 mdi.hOwner = hInstance;
551 mdi.x = x;
552 mdi.y = y;
553 mdi.cx = nWidth;
554 mdi.cy = nHeight;
555 mdi.style = dwStyle;
556 mdi.lParam = (LPARAM)lpParam;
557
558 lpParam = (LPVOID)&mdi;
559
560 if (pWndParent->style & MDIS_ALLCHILDSTYLES)
561 {
562 if (dwStyle & WS_POPUP)
563 {
564 WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
565 return(0);
566 }
567 dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
568 }
569 else
570 {
571 dwStyle &= ~WS_POPUP;
574 }
575
576 top_child = GetWindow(hWndParent, GW_CHILD);
577
578 if (top_child)
579 {
580 /* Restore current maximized child */
581 if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
582 {
583 TRACE("Restoring current maximized child %p\n", top_child);
584 SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
585 ShowWindow(top_child, SW_RESTORE);
586 SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
587 }
588 }
589
590 MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
591
592 if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
593
594 if (dwStyle & (WS_CHILD | WS_POPUP))
595 {
596 if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
597 {
598 x = mPos[0].x;
599 y = mPos[0].y;
600 }
601 if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
602 nWidth = mPos[1].x;
603 if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
604 nHeight = mPos[1].y;
605 }
606 }
607
608skip_mdi:
609 hwnd = User32CreateWindowEx(dwExStyle,
610 (LPCSTR)lpClassName,
611 (LPCSTR)lpWindowName,
612 dwStyle,
613 x,
614 y,
615 nWidth,
616 nHeight,
618 hMenu,
619 hInstance,
620 lpParam,
621 0);
622 return hwnd;
623}
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 629 of file window.c.

637{
638 return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
639}
HDWP NTAPI NtUserDeferWindowPos(HDWP WinPosInfo, HWND Wnd, HWND WndInsertAfter, int x, int y, int cx, int cy, UINT Flags)
Definition: winpos.c:3261
_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 2027 of file window.c.

2028{
2030}
EXTINLINE VOID NtUserxEnableProcessWindowGhosting(BOOL bEnable)
Definition: ntwrapper.h:801

◆ EndDeferWindowPos()

BOOL WINAPI EndDeferWindowPos ( HDWP  hWinPosInfo)

Definition at line 646 of file window.c.

647{
648 return NtUserEndDeferWindowPosEx(hWinPosInfo, FALSE);
649}
BOOL NTAPI NtUserEndDeferWindowPosEx(HDWP WinPosInfo, BOOL bAsync)
Definition: winpos.c:3245

◆ EnumChildWindows()

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

Definition at line 770 of file window.c.

773{
774 if (!hWndParent)
775 {
776 return EnumWindows(lpEnumFunc, lParam);
777 }
778 return User32EnumWindows(NULL, hWndParent, lpEnumFunc, lParam, 0, TRUE);
779}
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
Definition: window.c:800
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:678

◆ EnumDesktopWindows()

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

Definition at line 811 of file window.c.

814{
815 return User32EnumWindows(hDesktop, NULL, lpfn, lParam, 0, FALSE);
816}

◆ EnumThreadWindows()

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

Definition at line 786 of file window.c.

789{
790 if (!dwThreadId)
793}
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 800 of file window.c.

802{
803 return User32EnumWindows(NULL, NULL, lpEnumFunc, lParam, 0, FALSE);
804}

Referenced by EnumChildWindows().

◆ FindWindowA()

HWND WINAPI FindWindowA ( LPCSTR  lpClassName,
LPCSTR  lpWindowName 
)

Definition at line 898 of file window.c.

899{
900 //FIXME: FindWindow does not search children, but FindWindowEx does.
901 // what should we do about this?
902 return FindWindowExA (NULL, NULL, lpClassName, lpWindowName);
903}
HWND WINAPI FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
Definition: window.c:823

◆ FindWindowExA()

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

Definition at line 823 of file window.c.

827{
829 HWND hwnd = 0;
830
831 if (lpszWindow)
832 {
833 DWORD len = MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, NULL, 0 );
834 if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return 0;
835 MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, titleW, len );
836 }
837
838 if (!IS_INTRESOURCE(lpszClass))
839 {
840 WCHAR classW[256];
841 if (MultiByteToWideChar( CP_ACP, 0, lpszClass, -1, classW, sizeof(classW)/sizeof(WCHAR) ))
842 hwnd = FindWindowExW( hwndParent, hwndChildAfter, classW, titleW );
843 }
844 else
845 {
846 hwnd = FindWindowExW( hwndParent, hwndChildAfter, (LPCWSTR)lpszClass, titleW );
847 }
848
850 return hwnd;
851}
#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:858
#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 858 of file window.c.

862{
863 UNICODE_STRING ucClassName, *pucClassName = NULL;
864 UNICODE_STRING ucWindowName, *pucWindowName = NULL;
865
866 if (IS_ATOM(lpszClass))
867 {
868 ucClassName.Length = 0;
869 ucClassName.Buffer = (LPWSTR)lpszClass;
870 pucClassName = &ucClassName;
871 }
872 else if (lpszClass != NULL)
873 {
874 RtlInitUnicodeString(&ucClassName,
875 lpszClass);
876 pucClassName = &ucClassName;
877 }
878
879 if (lpszWindow != NULL)
880 {
881 RtlInitUnicodeString(&ucWindowName,
882 lpszWindow);
883 pucWindowName = &ucWindowName;
884 }
885
887 hwndChildAfter,
888 pucClassName,
889 pucWindowName,
890 0);
891}
HWND NTAPI NtUserFindWindowEx(HWND hwndParent, HWND hwndChildAfter, PUNICODE_STRING ucClassName, PUNICODE_STRING ucWindowName, DWORD dwUnknown)
Definition: window.c:3143

Referenced by FindWindowExA(), and FindWindowW().

◆ FindWindowW()

HWND WINAPI FindWindowW ( LPCWSTR  lpClassName,
LPCWSTR  lpWindowName 
)

Definition at line 910 of file window.c.

911{
912 /*
913
914 There was a FIXME here earlier, but I think it is just a documentation unclarity.
915
916 FindWindow only searches top level windows. What they mean is that child
917 windows of other windows than the desktop can be searched.
918 FindWindowExW never does a recursive search.
919
920 / Joakim
921 */
922
923 return FindWindowExW(NULL, NULL, lpClassName, lpWindowName);
924}

◆ GetAltTabInfoA()

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

Definition at line 932 of file window.c.

937{
938 return NtUserGetAltTabInfo(hwnd,iItem,pati,(LPWSTR)pszItemText,cchItemText,TRUE);
939}
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 946 of file window.c.

951{
952 return NtUserGetAltTabInfo(hwnd,iItem,pati,pszItemText,cchItemText,FALSE);
953}

◆ GetAncestor()

HWND WINAPI GetAncestor ( HWND  hwnd,
UINT  gaFlags 
)

Definition at line 960 of file window.c.

961{
962 HWND Ret = NULL;
963 PWND Ancestor, Wnd;
964
965 Wnd = ValidateHwnd(hwnd);
966 if (!Wnd)
967 return NULL;
968
970 {
971 Ancestor = NULL;
972 switch (gaFlags)
973 {
974 case GA_PARENT:
975 if (Wnd->spwndParent != NULL)
976 Ancestor = DesktopPtrToUser(Wnd->spwndParent);
977 break;
978
979 default:
980 /* FIXME: Call win32k for now */
981 Wnd = NULL;
982 break;
983 }
984
985 if (Ancestor != NULL)
986 Ret = UserHMGetHandle(Ancestor);
987 }
989 {
990 /* Do nothing */
991 }
992 _SEH2_END;
993
994 if (!Wnd) /* Fall back */
995 Ret = NtUserGetAncestor(hwnd, gaFlags);
996
997 return Ret;
998}
static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
Definition: utils.c:324
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
HWND NTAPI NtUserGetAncestor(HWND hWnd, UINT Flags)
Definition: window.c:3410
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
struct _WND * spwndParent
Definition: ntuser.h:713
#define GA_PARENT
Definition: winuser.h:2788

◆ GetClientRect()

BOOL WINAPI GetClientRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 1005 of file window.c.

1006{
1007 PWND Wnd = ValidateHwnd(hWnd);
1008
1009 if (!Wnd) return FALSE;
1010 if (Wnd->style & WS_MINIMIZED)
1011 {
1012 lpRect->left = lpRect->top = 0;
1015 return TRUE;
1016 }
1017 if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
1018 {
1019/* lpRect->left = lpRect->top = 0;
1020 lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left;
1021 lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top;
1022*/
1023 *lpRect = Wnd->rcClient;
1024 OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top);
1025 }
1026 else
1027 {
1028 lpRect->left = lpRect->top = 0;
1029 lpRect->right = Wnd->rcClient.right;
1030 lpRect->bottom = Wnd->rcClient.bottom;
1031/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
1032 lpRect->right = GetSystemMetrics(SM_CXSCREEN);
1033 lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1034*/ }
1035 return TRUE;
1036}
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:18
#define SM_CXMINIMIZED
Definition: winuser.h:1020
#define SM_CYMINIMIZED
Definition: winuser.h:1021
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)

◆ GetDesktopWindow()

HWND WINAPI GetDesktopWindow ( VOID  )

Definition at line 656 of file window.c.

657{
658 PWND Wnd;
659 HWND Ret = NULL;
660
662 {
663 Wnd = GetThreadDesktopWnd();
664 if (Wnd != NULL)
665 Ret = UserHMGetHandle(Wnd);
666 }
668 {
669 /* Do nothing */
670 }
671 _SEH2_END;
672
673 return Ret;
674}
PWND FASTCALL GetThreadDesktopWnd(VOID)
Definition: misc.c:397

Referenced by _tWinMain(), AnyPopup(), Window::AppBar_SetSide(), BackupWindowsPosProc(), CDimmedWindow::Capture(), CascadeWindows(), CenterWindow(), ClientToScreen(), clipboard_thread(), CommDlgProc(), create_dde_server(), create_dde_window(), create_directdraw(), create_parent(), create_parent_window(), createParentWindow(), DATETIME_LButtonDown(), ddraw_attach_d3d_device(), ddraw_set_swapchain_window(), DIALOG_CreateIndirect(), DIALOG_FindMsgDestination(), DlgProc(), do_wait_idle_child(), doWinMain(), DSoundRender_create(), explorer_main(), get_hwnd(), GetClientRect(), GetTopWindow(), GetWindowRect(), GUIDisplayLockedNotice(), GUIDisplaySASNotice(), GUILockedSAS(), GUILoggedOnSAS(), GUILoggedOutSAS(), HandleShutdown(), IDirectInputDevice2WImpl_SetCooperativeLevel(), ImageList_DragEnter(), ImageList_DragLeave(), init_nscontainer(), IntBroadcastSystemMessage(), IntGetWindowLong(), IsDialogMessageW(), IShellBrowserImpl_GetWindow(), IsThereAnyEffectiveWindow(), MapWindowPoints(), MCIAVI_mciWhere(), MCICDA_Play(), MCIQTZ_mciWhere(), CTrayWindow::MinimizeAll(), CZipExtract::CExtractSettingsPage::OnSetActive(), OnTimer(), CNotifyToolbar::OnTooltipShow(), OnTrayInitDialog(), CMenuDeskBar::Popup(), queue_event(), Run(), running_on_visible_desktop(), ScreenToClient(), set_clipboard_thread(), shellbrowser_GetWindow(), ShowStatusMessageThread(), SlideWindow(), START_TEST(), StartupWindowThread(), SysMouseWImpl_Acquire(), test_bad_control_class(), test_buttons(), test_clipboard_viewers(), test_ClipboardOwner(), test_create_window(), test_CreateWindow(), test_CShellMenu_with_DeskBar(), test_custom_default_button(), test_data_handles(), test_deferwindowpos(), test_DeleteDC(), test_DestroyWindow(), test_dialog_parent(), test_disableowner(), test_dpi_mapping(), test_dpi_window(), test_fullscreen(), test_GetRandomRgn(), test_gettext(), test_GetWindowModuleFileName(), test_hwnd_message(), test_ImmThreads(), test_InternetErrorDlg(), test_IsWindowUnicode(), test_killfocus(), test_marshal_HWND(), test_mdi(), test_mdi_messages(), test_messages(), test_nopage(), Test_OneParamRoutine_MapDesktopObject(), Test_OneParamRoutine_WindowFromDC(), test_paint_messages(), test_parent_owner(), test_PrintDlgExW(), test_PSM_ADDPAGE(), test_PSM_INSERTPAGE(), test_RunControlPanel(), test_SetFocus(), test_SetForegroundWindow(), test_SetParent(), test_SetWindowPos(), test_title(), test_token_security_descriptor(), test_wiznavigation(), ThemePreWindowProc(), thread(), TileWindows(), TREEVIEW_CreateDragImage(), UManStartDlg(), WinMain(), WINTRUST_CertVerify(), WINTRUST_DefaultVerify(), WndProc(), and wWinMain().

◆ GetFocus()

HWND WINAPI GetFocus ( VOID  )

Definition at line 1893 of file window.c.

1894{
1896}
@ THREADSTATE_FOCUSWINDOW
Definition: ntuser.h:2472
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:240

Referenced by _CmdWndProc(), _tWinMain(), check_active_state_(), check_wnd_state_(), Client_get_accState(), COMBOEX_ComboWndProc(), FileChildWindow::Command(), CicBridge::CreateInputContext(), CredDialogInit(), DEFDLG_Proc(), DEFDLG_SaveFocus(), delayFocusDlgWinProc(), DialogProc_0(), DialogProc_1(), DlgMainProc(), edit_dialog_proc(), edit_singleline_dialog_proc(), edit_wantreturn_dialog_proc(), EDIT_WM_NCPaint(), EndDialog(), FillGrid(), GetActiveContext(), CMainWindow::HandleTabOrder(), CAddressBand::HasFocusIO(), CBrandBand::HasFocusIO(), ImmWINNLSEnableIME(), installer_proc(), IntDrawScrollBar(), IntScrollHandleScrollEvent(), IPADDRESS_Draw(), is_doc_child_focus(), IsDialogMessageW(), IShellBrowserImpl_BrowseObject(), make_new_folder_timer_callback(), MapWndProc(), MsgCheckProcA(), MSIDialog_WndProc(), multi_edit_dialog_proc(), CDefView::OnContextMenu(), OnTimer(), PROPSHEET_SetWizButtons(), SCROLL_HandleScrollEvent(), set_focus_on_activate_proc(), CicBridge::SetActiveContextAlways(), CAutoComplete::ShowDropDown(), TAB_DrawItemInterior(), test_accelerators(), test_attach_input(), test_autoradio_kbd_move(), test_button_messages(), test_capture_2(), test_combo_editselection_focus(), test_comboex_WM_LBUTTONDOWN(), test_dialog_messages(), test_editbox(), test_editselection_focus(), test_focus(), test_IsDialogMessage(), test_keyboard_input(), test_LVN_ENDLABELEDIT(), test_mdi_messages(), test_messages(), test_SaveRestoreFocus(), test_SetFocus(), test_SetForegroundWindow(), test_wiznavigation(), test_WM_LBUTTONDOWN(), test_WM_NEXTDLGCTL(), thread_proc_0(), thread_proc_1(), thread_proc_2(), ThreadMgr_AssociateFocus(), ThreadMgr_IsThreadFocus(), TreeListKeyDown(), TreeListMouseClick(), TREEVIEW_DrawItem(), User32DefWindowProc(), WndProc(), FileChildWindow::WndProc(), and StartMenuButton::WndProc().

◆ GetLastActivePopup()

HWND WINAPI GetLastActivePopup ( HWND  hWnd)

Definition at line 1043 of file window.c.

1044{
1045 PWND Wnd;
1046 HWND Ret = hWnd;
1047
1048 Wnd = ValidateHwnd(hWnd);
1049 if (Wnd != NULL)
1050 {
1051 _SEH2_TRY
1052 {
1053 if (Wnd->spwndLastActive)
1054 {
1055 PWND LastActive = DesktopPtrToUser(Wnd->spwndLastActive);
1056 Ret = UserHMGetHandle(LastActive);
1057 }
1058 }
1060 {
1061 /* Do nothing */
1062 }
1063 _SEH2_END;
1064 }
1065 return Ret;
1066}
struct _WND * spwndLastActive
Definition: ntuser.h:739

◆ GetParent()

HWND WINAPI GetParent ( HWND  hWnd)

Definition at line 1073 of file window.c.

1074{
1075 PWND Wnd, WndParent;
1076 HWND Ret = NULL;
1077
1078 Wnd = ValidateHwnd(hWnd);
1079 if (Wnd != NULL)
1080 {
1081 _SEH2_TRY
1082 {
1083 WndParent = NULL;
1084 if (Wnd->style & WS_POPUP)
1085 {
1086 if (Wnd->spwndOwner != NULL)
1087 WndParent = DesktopPtrToUser(Wnd->spwndOwner);
1088 }
1089 else if (Wnd->style & WS_CHILD)
1090 {
1091 if (Wnd->spwndParent != NULL)
1092 WndParent = DesktopPtrToUser(Wnd->spwndParent);
1093 }
1094
1095 if (WndParent != NULL)
1096 Ret = UserHMGetHandle(WndParent);
1097 }
1099 {
1100 /* Do nothing */
1101 }
1102 _SEH2_END;
1103 }
1104
1105 return Ret;
1106}
struct _WND * spwndOwner
Definition: ntuser.h:715

◆ GetProcessDefaultLayout()

BOOL WINAPI GetProcessDefaultLayout ( DWORD pdwDefaultLayout)

Definition at line 1113 of file window.c.

1114{
1116}
DWORD_PTR NTAPI NtUserCallOneParam(DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:153
@ ONEPARAM_ROUTINE_GETPROCDEFLAYOUT
Definition: ntuser.h:1568

◆ GetProgmanWindow()

HWND WINAPI GetProgmanWindow ( VOID  )

Definition at line 1926 of file window.c.

1927{
1929}
@ THREADSTATE_PROGMANWINDOW
Definition: ntuser.h:2491

◆ GetRealWindowOwner()

DWORD WINAPI GetRealWindowOwner ( HWND  hwnd)

Definition at line 1899 of file window.c.

1900{
1902}
#define QUERY_WINDOW_REAL_ID
Definition: ntuser.h:2832
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4189

Referenced by ResetUserApiHook().

◆ GetTaskmanWindow()

HWND WINAPI GetTaskmanWindow ( VOID  )

Definition at line 1935 of file window.c.

1936{
1938}
@ THREADSTATE_TASKMANWINDOW
Definition: ntuser.h:2492

Referenced by UserpShowInformationBalloon().

◆ GetTopWindow()

HWND WINAPI GetTopWindow ( HWND  hWnd)

Definition at line 1194 of file window.c.

1195{
1196 if (!hWnd) hWnd = GetDesktopWindow();
1197 return GetWindow(hWnd, GW_CHILD);
1198}

◆ GetWindow()

HWND WINAPI GetWindow ( HWND  hWnd,
UINT  uCmd 
)

Definition at line 1123 of file window.c.

1125{
1126 PWND Wnd, FoundWnd;
1127 HWND Ret = NULL;
1128
1129 Wnd = ValidateHwnd(hWnd);
1130 if (!Wnd)
1131 return NULL;
1132
1133 _SEH2_TRY
1134 {
1135 FoundWnd = NULL;
1136 switch (uCmd)
1137 {
1138 case GW_OWNER:
1139 if (Wnd->spwndOwner != NULL)
1140 FoundWnd = DesktopPtrToUser(Wnd->spwndOwner);
1141 break;
1142
1143 case GW_HWNDFIRST:
1144 if(Wnd->spwndParent != NULL)
1145 {
1146 FoundWnd = DesktopPtrToUser(Wnd->spwndParent);
1147 if (FoundWnd->spwndChild != NULL)
1148 FoundWnd = DesktopPtrToUser(FoundWnd->spwndChild);
1149 }
1150 break;
1151 case GW_HWNDNEXT:
1152 if (Wnd->spwndNext != NULL)
1153 FoundWnd = DesktopPtrToUser(Wnd->spwndNext);
1154 break;
1155
1156 case GW_HWNDPREV:
1157 if (Wnd->spwndPrev != NULL)
1158 FoundWnd = DesktopPtrToUser(Wnd->spwndPrev);
1159 break;
1160
1161 case GW_CHILD:
1162 if (Wnd->spwndChild != NULL)
1163 FoundWnd = DesktopPtrToUser(Wnd->spwndChild);
1164 break;
1165
1166 case GW_HWNDLAST:
1167 FoundWnd = Wnd;
1168 while ( FoundWnd->spwndNext != NULL)
1169 FoundWnd = DesktopPtrToUser(FoundWnd->spwndNext);
1170 break;
1171
1172 default:
1173 Wnd = NULL;
1174 break;
1175 }
1176
1177 if (FoundWnd != NULL)
1178 Ret = UserHMGetHandle(FoundWnd);
1179 }
1181 {
1182 /* Do nothing */
1183 }
1184 _SEH2_END;
1185
1186 return Ret;
1187}
struct _WND * spwndPrev
Definition: ntuser.h:712
struct _WND * spwndChild
Definition: ntuser.h:714
struct _WND * spwndNext
Definition: ntuser.h:711
#define GW_HWNDFIRST
Definition: winuser.h:764
#define GW_HWNDLAST
Definition: winuser.h:765
#define GW_HWNDNEXT
Definition: winuser.h:761
#define GW_HWNDPREV
Definition: winuser.h:762

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

◆ GetWindowContextHelpId()

DWORD WINAPI GetWindowContextHelpId ( HWND  hwnd)

Definition at line 1854 of file window.c.

1855{
1857}
EXTINLINE DWORD NtUserxGetWindowContextHelpId(HWND hwnd)
Definition: ntwrapper.h:726

◆ GetWindowInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo ( HWND  hWnd,
PWINDOWINFO  pwi 
)

Definition at line 1207 of file window.c.

1209{
1210 PWND pWnd;
1211 PCLS pCls = NULL;
1212 SIZE Size = {0,0};
1213 BOOL Ret = FALSE;
1214
1215 if ( !pwi || pwi->cbSize != sizeof(WINDOWINFO))
1216 SetLastError(ERROR_INVALID_PARAMETER); // Just set the error and go!
1217
1218 pWnd = ValidateHwnd(hWnd);
1219 if (!pWnd)
1220 return Ret;
1221
1222 UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &Size, FALSE);
1223
1224 _SEH2_TRY
1225 {
1226 pCls = DesktopPtrToUser(pWnd->pcls);
1227 pwi->rcWindow = pWnd->rcWindow;
1228 pwi->rcClient = pWnd->rcClient;
1229 pwi->dwStyle = pWnd->style;
1230 pwi->dwExStyle = pWnd->ExStyle;
1231 pwi->cxWindowBorders = Size.cx;
1232 pwi->cyWindowBorders = Size.cy;
1233 pwi->dwWindowStatus = 0;
1234 if (pWnd->state & WNDS_ACTIVEFRAME || (GetActiveWindow() == hWnd))
1236 pwi->atomWindowType = (pCls ? pCls->atomClassName : 0 );
1237
1238 if ( pWnd->state2 & WNDS2_WIN50COMPAT )
1239 {
1240 pwi->wCreatorVersion = 0x500;
1241 }
1242 else if ( pWnd->state2 & WNDS2_WIN40COMPAT )
1243 {
1244 pwi->wCreatorVersion = 0x400;
1245 }
1246 else if ( pWnd->state2 & WNDS2_WIN31COMPAT )
1247 {
1248 pwi->wCreatorVersion = 0x30A;
1249 }
1250 else
1251 {
1252 pwi->wCreatorVersion = 0x300;
1253 }
1254
1255 Ret = TRUE;
1256 }
1258 {
1259 /* Do nothing */
1260 }
1261 _SEH2_END;
1262
1263 return Ret;
1264}
#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:888
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:3768
DWORD dwWindowStatus
Definition: winuser.h:3771
ATOM atomWindowType
Definition: winuser.h:3774
DWORD cbSize
Definition: winuser.h:3766
DWORD dwExStyle
Definition: winuser.h:3770
DWORD dwStyle
Definition: winuser.h:3769
WORD wCreatorVersion
Definition: winuser.h:3775
UINT cxWindowBorders
Definition: winuser.h:3772
UINT cyWindowBorders
Definition: winuser.h:3773
RECT rcWindow
Definition: winuser.h:3767
_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:2659

◆ GetWindowModuleFileNameA()

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

Definition at line 1271 of file window.c.

1274{
1275 PWND Wnd = ValidateHwnd(hwnd);
1276
1277 if (!Wnd)
1278 return 0;
1279
1280 return GetModuleFileNameA(Wnd->hModule, lpszFileName, cchFileNameMax);
1281}
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 1288 of file window.c.

1291{
1292 PWND Wnd = ValidateHwnd(hwnd);
1293
1294 if (!Wnd)
1295 return 0;
1296
1297 return GetModuleFileNameW( Wnd->hModule, lpszFileName, cchFileNameMax );
1298}
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600

◆ GetWindowRect()

BOOL WINAPI GetWindowRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 1304 of file window.c.

1306{
1307 PWND Wnd = ValidateHwnd(hWnd);
1308
1309 if (!Wnd) return FALSE;
1310 if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
1311 {
1312 *lpRect = Wnd->rcWindow;
1313 }
1314 else
1315 {
1316 lpRect->left = lpRect->top = 0;
1317 lpRect->right = Wnd->rcWindow.right;
1318 lpRect->bottom = Wnd->rcWindow.bottom;
1319/* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
1320 lpRect->right = GetSystemMetrics(SM_CXSCREEN);
1321 lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1322*/ }
1323 return TRUE;
1324}

◆ GetWindowTextA()

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

Definition at line 1330 of file window.c.

1331{
1332 PWND Wnd;
1333 INT Length = 0;
1334
1335 if (lpString == NULL || nMaxCount == 0)
1336 return 0;
1337
1338 Wnd = ValidateHwnd(hWnd);
1339 if (!Wnd)
1340 return 0;
1341
1342 lpString[0] = '\0';
1343
1344 if (!TestWindowProcess(Wnd))
1345 {
1346 _SEH2_TRY
1347 {
1349 }
1351 {
1352 Length = 0;
1353 }
1354 _SEH2_END;
1355 }
1356 else
1357 {
1359 }
1360 //ERR("GWTA Len %d : %s\n",Length,lpString);
1361 return Length;
1362}
_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:1618
_In_ int nMaxCount
Definition: winuser.h:4877

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

1369{
1370 PWND Wnd;
1371
1372 Wnd = ValidateHwnd(hWnd);
1373 if (!Wnd)
1374 return 0;
1375
1376 if (!TestWindowProcess(Wnd))
1377 {
1378 return DefWindowProcA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1379 }
1380 else
1381 {
1382 return SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1383 }
1384}
#define WM_GETTEXTLENGTH
Definition: winuser.h:1619

◆ GetWindowTextLengthW()

int WINAPI GetWindowTextLengthW ( HWND  hWnd)

Definition at line 1390 of file window.c.

1391{
1392 PWND Wnd;
1393
1394 Wnd = ValidateHwnd(hWnd);
1395 if (!Wnd)
1396 return 0;
1397
1398 if (!TestWindowProcess(Wnd))
1399 {
1400 return DefWindowProcW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1401 }
1402 else
1403 {
1404 return SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1405 }
1406}
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ GetWindowTextW()

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

Definition at line 1412 of file window.c.

1413{
1414 PWND Wnd;
1415 INT Length = 0;
1416
1417 if (lpString == NULL || nMaxCount == 0)
1418 return 0;
1419
1420 Wnd = ValidateHwnd(hWnd);
1421 if (!Wnd)
1422 return 0;
1423
1424 lpString[0] = L'\0';
1425
1426 if (!TestWindowProcess(Wnd))
1427 {
1428 _SEH2_TRY
1429 {
1431 }
1433 {
1434 Length = 0;
1435 }
1436 _SEH2_END;
1437 }
1438 else
1439 {
1441 }
1442 //ERR("GWTW Len %d : %S\n",Length,lpString);
1443 return Length;
1444}

Referenced by AboutDlgProc(), AddressBarProc(), AtlAxWin_wndproc(), BaseControlWindowImpl_get_Caption(), CBUpdateLBox(), CHSourceDlgProc(), CMP_RegisterNotification(), COMBOEX_ComboWndProc(), CompleteSwitch(), CredDialogCommandOk(), DIALOG_IsAccelerator(), DialogProc(), DoTestCaseB(), CDownloadManager::DownloadDlgProc(), EnableOkButtonFromEditContents(), EndNowDlgProc(), EnumWindowsProc(), ExportRegistryFile_OFNHookProc(), FILEDLG95_FILENAME_GetFileNames(), find_control(), find_top_window(), find_window_callback(), FindDialogProc(), FontProc(), FontSizeList_GetSelectedFontSize(), FontWndProc(), get_button_text(), CSearchBar::GetAddressEditBoxPath(), 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(), MDI_UpdateFrameText(), MessageBoxTextToClipboard(), modify_dword_dlgproc(), modify_multi_string_dlgproc(), modify_string_dlgproc(), msi_get_window_text(), msi_mask_control_change(), OnCommand(), CFontsDialog::OnFontSize(), OnPaint(), CAddressBand::OnTipText(), CZipExtract::CExtractSettingsPage::OnWizardNext(), paraformat_proc(), PrepareFoldersToScan(), prompt_dlgproc(), promptdisk_ok(), PROPSHEET_DialogProc(), RunDlgProc(), BtrfsBalance::SaveBalanceOpts(), SaveCustomPath(), anonymous_namespace{settingsdlg.cpp}::SettingsDlgProc(), SetWelcomeText(), tabstops_proc(), 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 1447 of file window.c.

1449{
1450 DWORD Ret = 0;
1451 PTHREADINFO ti;
1452 PWND pWnd = ValidateHwnd(hWnd);
1453
1454 if (!pWnd) return Ret;
1455
1456 ti = pWnd->head.pti;
1457
1458 if (ti)
1459 {
1460 if (ti == GetW32ThreadInfo())
1461 { // We are current.
1462 //FIXME("Current!\n");
1463 if (lpdwProcessId)
1464 *lpdwProcessId = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
1465 Ret = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueThread;
1466 }
1467 else
1468 { // Ask kernel for info.
1469 //FIXME("Kernel call!\n");
1470 if (lpdwProcessId)
1473 }
1474 }
1475 return Ret;
1476}
#define QUERY_WINDOW_UNIQUE_THREAD_ID
Definition: ntuser.h:2828
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:805
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2827
#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 1863 of file window.c.

1864{
1866 if (Ret == 0 && lpString)
1867 *lpString = L'\0';
1868 return Ret;
1869}
INT NTAPI NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount)
Definition: window.c:4587

◆ IsChild()

BOOL WINAPI IsChild ( HWND  hWndParent,
HWND  hWnd 
)

Definition at line 1483 of file window.c.

1485{
1486 PWND WndParent, DesktopWnd, Wnd;
1487 BOOL Ret = FALSE;
1488
1489 WndParent = ValidateHwnd(hWndParent);
1490 if (!WndParent)
1491 return FALSE;
1492 Wnd = ValidateHwnd(hWnd);
1493 if (!Wnd)
1494 return FALSE;
1495
1496 DesktopWnd = GetThreadDesktopWnd();
1497 if (!DesktopWnd)
1498 return FALSE;
1499
1500 _SEH2_TRY
1501 {
1502 while (Wnd != NULL && ((Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD))
1503 {
1504 if (Wnd->spwndParent != NULL)
1505 {
1506 Wnd = DesktopPtrToUser(Wnd->spwndParent);
1507
1508 if (Wnd == WndParent)
1509 {
1510 Ret = TRUE;
1511 break;
1512 }
1513 }
1514 else
1515 break;
1516 }
1517 }
1519 {
1520 /* Do nothing */
1521 }
1522 _SEH2_END;
1523
1524 return Ret;
1525}

◆ IsHungAppWindow()

BOOL WINAPI IsHungAppWindow ( HWND  hwnd)

Definition at line 1875 of file window.c.

1876{
1878}
#define QUERY_WINDOW_ISHUNG
Definition: ntuser.h:2831

Referenced by EnumWindowsProc(), Ghost_OnCreate(), and Ghost_OnTimer().

◆ IsIconic()

BOOL WINAPI IsIconic ( HWND  hWnd)

Definition at line 1532 of file window.c.

1533{
1534 PWND Wnd = ValidateHwnd(hWnd);
1535
1536 if (Wnd != NULL)
1537 return (Wnd->style & WS_MINIMIZE) != 0;
1538
1539 return FALSE;
1540}
#define WS_MINIMIZE
Definition: pedump.c:622

◆ IsWindow()

BOOL WINAPI IsWindow ( HWND  hWnd)

Definition at line 1547 of file window.c.

1548{
1550 if (Wnd != NULL)
1551 {
1552 if (Wnd->state & WNDS_DESTROYED)
1553 return FALSE;
1554 return TRUE;
1555 }
1556
1557 return FALSE;
1558}
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
#define WNDS_DESTROYED
Definition: ntuser.h:636

◆ IsWindowEnabled()

BOOL WINAPI IsWindowEnabled ( HWND  hWnd)

Definition at line 1621 of file window.c.

1622{
1623 // AG: I don't know if child windows are affected if the parent is
1624 // disabled. I think they stop processing messages but stay appearing
1625 // as enabled.
1626
1628}
#define WS_DISABLED
Definition: pedump.c:621
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define GWL_STYLE
Definition: winuser.h:852

◆ IsWindowInDestroy()

BOOL WINAPI IsWindowInDestroy ( HWND  hWnd)

Definition at line 2014 of file window.c.

2015{
2016 PWND pwnd;
2017 pwnd = ValidateHwnd(hWnd);
2018 if (!pwnd)
2019 return FALSE;
2020 return ((pwnd->state2 & WNDS2_INDESTROY) == WNDS2_INDESTROY);
2021}
#define WNDS2_INDESTROY
Definition: ntuser.h:648

◆ IsWindowUnicode()

BOOL WINAPI IsWindowUnicode ( HWND  hWnd)

Definition at line 1565 of file window.c.

1566{
1567 PWND Wnd = ValidateHwnd(hWnd);
1568
1569 if (Wnd != NULL)
1570 return Wnd->Unicode;
1571
1572 return FALSE;
1573}
UINT Unicode
Definition: ntuser.h:756

◆ IsWindowVisible()

BOOL WINAPI IsWindowVisible ( HWND  hWnd)

Definition at line 1580 of file window.c.

1581{
1582 BOOL Ret = FALSE;
1583 PWND Wnd = ValidateHwnd(hWnd);
1584
1585 if (Wnd != NULL)
1586 {
1587 _SEH2_TRY
1588 {
1589 Ret = TRUE;
1590
1591 do
1592 {
1593 if (!(Wnd->style & WS_VISIBLE))
1594 {
1595 Ret = FALSE;
1596 break;
1597 }
1598
1599 if (Wnd->spwndParent != NULL)
1600 Wnd = DesktopPtrToUser(Wnd->spwndParent);
1601 else
1602 break;
1603
1604 } while (Wnd != NULL);
1605 }
1607 {
1608 Ret = FALSE;
1609 }
1610 _SEH2_END;
1611 }
1612
1613 return Ret;
1614}

◆ IsZoomed()

BOOL WINAPI IsZoomed ( HWND  hWnd)

Definition at line 1635 of file window.c.

1636{
1637 return (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_MAXIMIZE) != 0;
1638}
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by CreateWindowExA(), and CreateWindowExW().

◆ LockSetForegroundWindow()

BOOL WINAPI LockSetForegroundWindow ( UINT  uLockCode)

Definition at line 1645 of file window.c.

1646{
1647 return NtUserxLockSetForegroundWindow(uLockCode);
1648}
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:996
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SM_CYCAPTION
Definition: winuser.h:963

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

◆ OpenIcon()

BOOL WINAPI OpenIcon ( HWND  hWnd)

Definition at line 1685 of file window.c.

1686{
1688 return FALSE;
1689
1691 return TRUE;
1692}

◆ RealChildWindowFromPoint()

HWND WINAPI RealChildWindowFromPoint ( HWND  hwndParent,
POINT  ptParentClientCoords 
)

Definition at line 1699 of file window.c.

1701{
1702 return NtUserRealChildWindowFromPoint(hwndParent, ptParentClientCoords.x, ptParentClientCoords.y);
1703}
HWND NTAPI NtUserRealChildWindowFromPoint(HWND Parent, LONG x, LONG y)
Definition: winpos.c:3486

◆ 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:608
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by User32CreateWindowEx().

◆ RtlGetExpWinVer()

DWORD FASTCALL RtlGetExpWinVer ( HMODULE  hModule)

Definition at line 153 of file window.c.

154{
155 DWORD dwMajorVersion = 3; // Set default to Windows 3.10.
156 DWORD dwMinorVersion = 10;
157 PIMAGE_NT_HEADERS pinth;
158
160 {
161 pinth = RtlImageNtHeader(hModule);
162 if (pinth)
163 {
164 dwMajorVersion = pinth->OptionalHeader.MajorSubsystemVersion;
165
166 if (dwMajorVersion == 1)
167 {
168 dwMajorVersion = 3;
169 }
170 else
171 {
172 dwMinorVersion = pinth->OptionalHeader.MinorSubsystemVersion;
173 }
174 }
175 }
176 return MAKELONG(MAKEWORD(dwMinorVersion, dwMajorVersion), 0);
177}
HMODULE hModule
Definition: animate.c:44
#define RtlImageNtHeader
Definition: compat.h:806
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define MAKEWORD(a, b)
Definition: typedefs.h:248
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249

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

1949{
1951 dx,
1952 dy,
1953 lpRect,
1954 prcClip,
1955 0,
1956 NULL,
1958}
#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:92
#define SW_SCROLLCHILDREN
Definition: winuser.h:2578
#define SW_INVALIDATE
Definition: winuser.h:2579
#define SW_ERASE
Definition: winuser.h:2580

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

1974{
1975 if (flags & SW_SMOOTHSCROLL)
1976 {
1977 FIXME("SW_SMOOTHSCROLL not supported.\n");
1978 // Fall through....
1979 }
1981 dx,
1982 dy,
1983 prcScroll,
1984 prcClip,
1985 hrgnUpdate,
1986 prcUpdate,
1987 flags);
1988}
#define FIXME(fmt,...)
Definition: debug.h:111
GLbitfield flags
Definition: glext.h:7161

◆ SetForegroundWindow()

BOOL WINAPI SetForegroundWindow ( HWND  hWnd)

Definition at line 1709 of file window.c.

1710{
1712}
EXTINLINE BOOL NtUserxSetForegroundWindow(HWND hWnd)
Definition: ntwrapper.h:788

◆ SetLastErrorEx()

VOID WINAPI SetLastErrorEx ( DWORD  dwErrCode,
DWORD  dwType 
)

Definition at line 1884 of file window.c.

1885{
1886 SetLastError(dwErrCode);
1887}

◆ SetProcessDefaultLayout()

BOOL WINAPI SetProcessDefaultLayout ( DWORD  dwDefaultLayout)

Definition at line 1719 of file window.c.

1720{
1722}
@ ONEPARAM_ROUTINE_SETPROCDEFLAYOUT
Definition: ntuser.h:1601

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

◆ SetProgmanWindow()

HWND WINAPI SetProgmanWindow ( HWND  hWnd)

Definition at line 1917 of file window.c.

1918{
1920}
EXTINLINE HWND NtUserxSetProgmanWindow(HWND hWnd)
Definition: ntwrapper.h:763

◆ SetTaskmanWindow()

HWND WINAPI SetTaskmanWindow ( HWND  hWnd)

Definition at line 1908 of file window.c.

1909{
1911}
EXTINLINE HWND NtUserxSetTaskmanWindow(HWND hWnd)
Definition: ntwrapper.h:758

Referenced by RegisterShellHook().

◆ SetWindowContextHelpId()

BOOL WINAPI SetWindowContextHelpId ( HWND  hwnd,
DWORD  dwContextHelpId 
)

Definition at line 1844 of file window.c.

1846{
1847 return NtUserxSetWindowContextHelpId(hwnd, dwContextHelpId);
1848}
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 1731 of file window.c.

1733{
1734 PWND pwnd;
1735
1736 pwnd = ValidateHwnd(hWnd);
1737 if (pwnd)
1738 {
1739 if (!TestWindowProcess(pwnd))
1740 {
1741 /* do not send WM_GETTEXT messages to other processes */
1742 return (DefWindowProcA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1743 }
1744 return (SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1745 }
1746 return FALSE;
1747}
#define WM_SETTEXT
Definition: winuser.h:1617

◆ SetWindowTextW()

BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextW ( HWND  hWnd,
LPCWSTR  lpString 
)

Definition at line 1756 of file window.c.

1758{
1759 PWND pwnd;
1760
1761 pwnd = ValidateHwnd(hWnd);
1762 if (pwnd)
1763 {
1764 if (!TestWindowProcess(pwnd))
1765 {
1766 /* do not send WM_GETTEXT messages to other processes */
1767 return (DefWindowProcW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1768 }
1769 return (SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1770 }
1771 return FALSE;
1772}

◆ ShowOwnedPopups()

BOOL WINAPI ShowOwnedPopups ( HWND  hWnd,
BOOL  fShow 
)

Definition at line 1779 of file window.c.

1780{
1781 return NtUserxShowOwnedPopups(hWnd, fShow);
1782}
EXTINLINE BOOL NtUserxShowOwnedPopups(HWND hWnd, BOOL fShow)
Definition: ntwrapper.h:696

◆ SwitchToThisWindow()

VOID WINAPI SwitchToThisWindow ( HWND  hwnd,
BOOL  fAltTab 
)

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

1798{
1799 if (dwFlags & ULW_EX_NORESIZE) /* only valid for UpdateLayeredWindowIndirect */
1800 {
1802 return FALSE;
1803 }
1805 hdcDst,
1806 pptDst,
1807 psize,
1808 hdcSrc,
1809 pptSrc,
1810 crKey,
1811 pbl,
1812 dwFlags,
1813 NULL);
1814}
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:2787
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 1820 of file window.c.

1822{
1823 if (info && info->cbSize == sizeof(*info))
1824 {
1826 info->hdcDst,
1827 (POINT *)info->pptDst,
1828 (SIZE *)info->psize,
1829 info->hdcSrc,
1830 (POINT *)info->pptSrc,
1831 info->crKey,
1832 (BLENDFUNCTION *)info->pblend,
1833 info->dwFlags,
1834 (RECT *)info->prcDirty);
1835 }
1837 return FALSE;
1838}

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

193{
194 LARGE_STRING WindowName;
195 LARGE_STRING lstrClassName, *plstrClassName;
196 LARGE_STRING lstrClassVersion, *plstrClassVersion;
197 UNICODE_STRING ClassName;
198 UNICODE_STRING ClassVersion;
199 WNDCLASSEXA wceA;
200 WNDCLASSEXW wceW;
202 DWORD dwLastError;
203 BOOL Unicode, ClassFound = FALSE;
204 HWND Handle = NULL;
205 LPCWSTR lpszClsVersion;
206 LPCWSTR lpLibFileName = NULL;
207 HANDLE pCtx = NULL;
208 DWORD dwFlagsVer;
209
210#if 0
211 DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
212#endif
213
215 TRACE("Module Version %x\n",dwFlagsVer);
216
218 {
219 TRACE("RegisterSystemControls\n");
221 }
222
223 Unicode = !(dwFlags & NUCWE_ANSI);
224
225 if (IS_ATOM(lpClassName))
226 {
227 plstrClassName = (PVOID)lpClassName;
228 }
229 else
230 {
231 if (Unicode)
232 {
233 RtlInitUnicodeString(&ClassName, (PCWSTR)lpClassName);
234 }
235 else
236 {
237 if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, (PCSZ)lpClassName))
238 {
240 return NULL;
241 }
242 }
243
244 /* Copy it to a LARGE_STRING */
245 lstrClassName.Buffer = ClassName.Buffer;
246 lstrClassName.Length = ClassName.Length;
247 lstrClassName.MaximumLength = ClassName.MaximumLength;
248 plstrClassName = &lstrClassName;
249 }
250
251 /* Initialize a LARGE_STRING */
252 RtlInitLargeString(&WindowName, lpWindowName, Unicode);
253
254 // HACK: The current implementation expects the Window name to be UNICODE
255 if (!Unicode)
256 {
258 PSTR AnsiBuffer = WindowName.Buffer;
259 ULONG AnsiLength = WindowName.Length;
260
261 WindowName.Length = 0;
262 WindowName.MaximumLength = AnsiLength * sizeof(WCHAR);
263 WindowName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
264 0,
265 WindowName.MaximumLength);
266 if (!WindowName.Buffer)
267 {
269 goto cleanup;
270 }
271
273 WindowName.MaximumLength,
274 &WindowName.Length,
276 AnsiLength);
277 if (!NT_SUCCESS(Status))
278 {
279 goto cleanup;
280 }
281 }
282
283 if (!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
284 {
285 if (Unicode)
286 {
287 wceW.cbSize = sizeof(wceW);
288 if (GetClassInfoExW(hInstance, (LPCWSTR)lpClassName, &wceW) && wceW.lpszMenuName)
289 {
290 hMenu = LoadMenuW(hInstance, wceW.lpszMenuName);
291 }
292 }
293 else
294 {
295 wceA.cbSize = sizeof(wceA);
296 if (GetClassInfoExA(hInstance, lpClassName, &wceA) && wceA.lpszMenuName)
297 {
298 hMenu = LoadMenuA(hInstance, wceA.lpszMenuName);
299 }
300 }
301 }
302
303 if (!Unicode) dwExStyle |= WS_EX_SETANSICREATOR;
304
305 lpszClsVersion = ClassNameToVersion(lpClassName, NULL, &lpLibFileName, &pCtx, !Unicode);
306 if (!lpszClsVersion)
307 {
308 plstrClassVersion = plstrClassName;
309 }
310 else
311 {
312 RtlInitUnicodeString(&ClassVersion, lpszClsVersion);
313 lstrClassVersion.Buffer = ClassVersion.Buffer;
314 lstrClassVersion.Length = ClassVersion.Length;
315 lstrClassVersion.MaximumLength = ClassVersion.MaximumLength;
316 plstrClassVersion = &lstrClassVersion;
317 }
318
319 for (;;)
320 {
321 Handle = NtUserCreateWindowEx(dwExStyle,
322 plstrClassName,
323 plstrClassVersion,
324 &WindowName,
325 dwStyle,
326 x,
327 y,
328 nWidth,
329 nHeight,
331 hMenu,
332 hInstance,
333 lpParam,
334 dwFlagsVer,
335 pCtx );
336 if (Handle) break;
337 if (!lpLibFileName) break;
338 if (!ClassFound)
339 {
340 dwLastError = GetLastError();
341 if (dwLastError == ERROR_CANNOT_FIND_WND_CLASS)
342 {
343 ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule);
344 if (ClassFound) continue;
345 }
346 }
347 if (hLibModule)
348 {
349 dwLastError = GetLastError();
351 SetLastError(dwLastError);
353 }
354 break;
355 }
356
357#if 0
358 DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
359#endif
360
361cleanup:
362 if (!Unicode)
363 {
364 if (!IS_ATOM(lpClassName))
365 RtlFreeUnicodeString(&ClassName);
366
367 RtlFreeLargeString(&WindowName);
368 }
369
370 return Handle;
371}
CHAR AnsiBuffer[1024]
Definition: debug.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#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:2666
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:3210
UINT cbSize
Definition: winuser.h:3201
LPCWSTR lpszMenuName
Definition: winuser.h:3225
UINT cbSize
Definition: winuser.h:3216
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:28
DWORD FASTCALL RtlGetExpWinVer(HMODULE hModule)
Definition: window.c:153
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 678 of file window.c.

684{
685 DWORD i, dwCount = 0;
686 HWND* pHwnd = NULL;
687 HANDLE hHeap;
689
690 if (!lpfn)
691 {
693 return FALSE;
694 }
695
696 /* FIXME instead of always making two calls, should we use some
697 sort of persistent buffer and only grow it ( requiring a 2nd
698 call ) when the buffer wasn't already big enough? */
699 /* first get how many window entries there are */
700 Status = NtUserBuildHwndList(hDesktop,
701 hWndparent,
702 bChildren,
704 dwCount,
705 NULL,
706 &dwCount);
707 if (!NT_SUCCESS(Status))
708 return FALSE;
709
710 if (!dwCount)
711 {
712 if (!dwThreadId)
713 return FALSE;
714 else
715 return TRUE;
716 }
717
718 /* allocate buffer to receive HWND handles */
719 hHeap = GetProcessHeap();
720 pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1));
721 if (!pHwnd)
722 {
724 return FALSE;
725 }
726
727 /* now call kernel again to fill the buffer this time */
728 Status = NtUserBuildHwndList(hDesktop,
729 hWndparent,
730 bChildren,
732 dwCount,
733 pHwnd,
734 &dwCount);
735 if (!NT_SUCCESS(Status))
736 {
737 if (pHwnd)
738 HeapFree(hHeap, 0, pHwnd);
739 return FALSE;
740 }
741
742 /* call the user's callback function until we're done or
743 they tell us to quit */
744 for ( i = 0; i < dwCount; i++ )
745 {
746 /* FIXME I'm only getting NULLs from Thread Enumeration, and it's
747 * probably because I'm not doing it right in NtUserBuildHwndList.
748 * Once that's fixed, we shouldn't have to check for a NULL HWND
749 * here
750 * This is now fixed in revision 50205. (jt)
751 */
752 if (!pHwnd[i]) /* don't enumerate a NULL HWND */
753 continue;
754 if (!(*lpfn)(pHwnd[i], lParam))
755 {
756 HeapFree ( hHeap, 0, pHwnd );
757 return FALSE;
758 }
759 }
760 if (pHwnd)
761 HeapFree(hHeap, 0, pHwnd);
762 return TRUE;
763}
#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:1518

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )