ReactOS  0.4.14-dev-593-g1793dcc
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 SHCreateFromDesktop(), and NotifyArea::WndProc().

◆ AnimateWindow()

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

Definition at line 1652 of file window.c.

1655 {
1656  /* FIXME Add animation code */
1657 
1658  /* If trying to show/hide and it's already *
1659  * shown/hidden or invalid window, fail with *
1660  * invalid parameter */
1661 
1662  BOOL visible;
1663  visible = IsWindowVisible(hwnd);
1664  if(!IsWindow(hwnd) ||
1665  (visible && !(dwFlags & AW_HIDE)) ||
1666  (!visible && (dwFlags & AW_HIDE)))
1667  {
1669  return FALSE;
1670  }
1671 
1672  ShowWindow(hwnd, (dwFlags & AW_HIDE) ? SW_HIDE : ((dwFlags & AW_ACTIVATE) ? SW_SHOW : SW_SHOWNA));
1673 
1674  return TRUE;
1675 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI IsWindowVisible(HWND hWnd)
Definition: window.c:1577
#define SW_SHOW
Definition: winuser.h:769
BOOL WINAPI IsWindow(HWND hWnd)
Definition: window.c:1543
#define SetLastError(x)
Definition: compat.h:417
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SW_SHOWNA
Definition: winuser.h:772

◆ AnyPopup()

BOOL WINAPI AnyPopup ( VOID  )

Definition at line 2006 of file window.c.

2007 {
2008  int i;
2009  BOOL retvalue;
2011 
2012  if (!list) return FALSE;
2013  for (i = 0; list[i]; i++)
2014  {
2015  if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break;
2016  }
2017  retvalue = (list[i] != 0);
2018  HeapFree( GetProcessHeap(), 0, list );
2019  return retvalue;
2020 }
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
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND WINAPI GetDesktopWindow(VOID)
Definition: window.c:652
BOOL WINAPI IsWindowVisible(HWND hWnd)
Definition: window.c:1577
HWND WINAPI GetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:1119
#define GetProcessHeap()
Definition: compat.h:403
Definition: _list.h:228
#define GW_OWNER
Definition: winuser.h:761
HWND * WIN_ListChildren(HWND hWndparent)
Definition: mdi.c:140
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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 {
71  return NtUserSetWindowPos(hWnd,
72  HWND_TOP,
73  0,
74  0,
75  0,
76  0,
78 }
HWND hWnd
Definition: settings.c:17
#define HWND_TOP
Definition: winuser.h:1193
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL NTAPI NtUserSetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
Definition: winpos.c:3406
#define SWP_NOMOVE
Definition: winuser.h:1229

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

◆ ChildWindowFromPointEx()

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

Definition at line 103 of file window.c.

106 {
108 }
#define pt(x, y)
Definition: drawing.c:79
HWND NTAPI NtUserChildWindowFromPointEx(HWND Parent, LONG x, LONG y, UINT Flags)
Definition: winpos.c:3124
UINT uFlags
Definition: api.c:59
static HWND hwndParent
Definition: cryptui.c:300

◆ 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 = 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 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5272
LPCWSTR is_comctl32_class(const WCHAR *name)
Definition: class.c:46
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5743
unsigned char BYTE
Definition: mem.h:68
uint32_t DWORD_PTR
Definition: typedefs.h:63
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IS_ATOM(x)
Definition: class.h:3
#define LOWORD(l)
Definition: pedump.c:82
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

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 }
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOWMINIMIZED
Definition: winuser.h:765
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 378 of file window.c.

390 {
391  MDICREATESTRUCTA mdi;
392  HWND hwnd;
393 
395  {
396  TRACE("CreateWindowExA RegisterSystemControls\n");
398  }
399 
400  if (dwExStyle & WS_EX_MDICHILD)
401  {
402  POINT mPos[2];
403  UINT id = 0;
404  HWND top_child;
405  PWND pWndParent;
406 
407  pWndParent = ValidateHwnd(hWndParent);
408 
409  if (!pWndParent) return NULL;
410 
411  if (pWndParent->fnid != FNID_MDICLIENT) // wine uses WIN_ISMDICLIENT
412  {
413  WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
414  return NULL;
415  }
416 
417  /* lpParams of WM_[NC]CREATE is different for MDI children.
418  * MDICREATESTRUCT members have the originally passed values.
419  */
420  mdi.szClass = lpClassName;
421  mdi.szTitle = lpWindowName;
422  mdi.hOwner = hInstance;
423  mdi.x = x;
424  mdi.y = y;
425  mdi.cx = nWidth;
426  mdi.cy = nHeight;
427  mdi.style = dwStyle;
428  mdi.lParam = (LPARAM)lpParam;
429 
430  lpParam = (LPVOID)&mdi;
431 
432  if (pWndParent->style & MDIS_ALLCHILDSTYLES)
433  {
434  if (dwStyle & WS_POPUP)
435  {
436  WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
437  return(0);
438  }
439  dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
440  }
441  else
442  {
443  dwStyle &= ~WS_POPUP;
444  dwStyle |= (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION |
446  }
447 
448  top_child = GetWindow(hWndParent, GW_CHILD);
449 
450  if (top_child)
451  {
452  /* Restore current maximized child */
453  if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
454  {
455  TRACE("Restoring current maximized child %p\n", top_child);
456  SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
457  ShowWindow(top_child, SW_RESTORE);
458  SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
459  }
460  }
461 
462  MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
463 
464  if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
465 
466  if (dwStyle & (WS_CHILD | WS_POPUP))
467  {
468  if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
469  {
470  x = mPos[0].x;
471  y = mPos[0].y;
472  }
473  if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
474  nWidth = mPos[1].x;
475  if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
476  nHeight = mPos[1].y;
477  }
478  }
479 
480  hwnd = User32CreateWindowEx(dwExStyle,
481  lpClassName,
482  lpWindowName,
483  dwStyle,
484  x,
485  y,
486  nWidth,
487  nHeight,
488  hWndParent,
489  hMenu,
490  hInstance,
491  lpParam,
492  NUCWE_ANSI);
493  return hwnd;
494 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_THICKFRAME
Definition: pedump.c:630
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define GW_CHILD
Definition: winuser.h:758
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define WARN(fmt,...)
Definition: debug.h:111
#define WM_SETREDRAW
Definition: winuser.h:1598
#define CW_USEDEFAULT16
Definition: undocuser.h:167
#define NUCWE_ANSI
Definition: undocuser.h:74
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_RESTORE
Definition: winuser.h:773
BOOL WINAPI IsZoomed(HWND hWnd)
Definition: window.c:1632
void MDI_CalcDefaultChildPos(HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
Definition: mdi.c:309
HINSTANCE hInstance
Definition: charmap.c:20
#define WS_EX_MDICHILD
Definition: winuser.h:394
DWORD fnid
Definition: ntuser.h:673
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:1119
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define FNID_MDICLIENT
Definition: ntuser.h:834
#define WS_CAPTION
Definition: pedump.c:624
#define TRACE(s)
Definition: solgame.cpp:4
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define LPVOID
Definition: nt_native.h:45
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:178
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
#define WS_MINIMIZEBOX
Definition: pedump.c:631
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
DWORD style
Definition: ntuser.h:670

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

515 {
516  MDICREATESTRUCTW mdi;
517  HWND hwnd;
518 
520  {
521  ERR("CreateWindowExW RegisterSystemControls\n");
523  }
524 
525  if (dwExStyle & WS_EX_MDICHILD)
526  {
527  POINT mPos[2];
528  UINT id = 0;
529  HWND top_child;
530  PWND pWndParent;
531 
532  pWndParent = ValidateHwnd(hWndParent);
533 
534  if (!pWndParent) return NULL;
535 
536  if (pWndParent->fnid != FNID_MDICLIENT)
537  {
538  WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent);
539  return NULL;
540  }
541 
542  /* lpParams of WM_[NC]CREATE is different for MDI children.
543  * MDICREATESTRUCT members have the originally passed values.
544  */
545  mdi.szClass = lpClassName;
546  mdi.szTitle = lpWindowName;
547  mdi.hOwner = hInstance;
548  mdi.x = x;
549  mdi.y = y;
550  mdi.cx = nWidth;
551  mdi.cy = nHeight;
552  mdi.style = dwStyle;
553  mdi.lParam = (LPARAM)lpParam;
554 
555  lpParam = (LPVOID)&mdi;
556 
557  if (pWndParent->style & MDIS_ALLCHILDSTYLES)
558  {
559  if (dwStyle & WS_POPUP)
560  {
561  WARN("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
562  return(0);
563  }
564  dwStyle |= (WS_CHILD | WS_CLIPSIBLINGS);
565  }
566  else
567  {
568  dwStyle &= ~WS_POPUP;
569  dwStyle |= (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION |
571  }
572 
573  top_child = GetWindow(hWndParent, GW_CHILD);
574 
575  if (top_child)
576  {
577  /* Restore current maximized child */
578  if((dwStyle & WS_VISIBLE) && IsZoomed(top_child))
579  {
580  TRACE("Restoring current maximized child %p\n", top_child);
581  SendMessageW( top_child, WM_SETREDRAW, FALSE, 0 );
582  ShowWindow(top_child, SW_RESTORE);
583  SendMessageW( top_child, WM_SETREDRAW, TRUE, 0 );
584  }
585  }
586 
587  MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
588 
589  if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
590 
591  if (dwStyle & (WS_CHILD | WS_POPUP))
592  {
593  if (x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
594  {
595  x = mPos[0].x;
596  y = mPos[0].y;
597  }
598  if (nWidth == CW_USEDEFAULT || nWidth == CW_USEDEFAULT16 || !nWidth)
599  nWidth = mPos[1].x;
600  if (nHeight == CW_USEDEFAULT || nHeight == CW_USEDEFAULT16 || !nHeight)
601  nHeight = mPos[1].y;
602  }
603  }
604 
605  hwnd = User32CreateWindowEx(dwExStyle,
606  (LPCSTR)lpClassName,
607  (LPCSTR)lpWindowName,
608  dwStyle,
609  x,
610  y,
611  nWidth,
612  nHeight,
613  hWndParent,
614  hMenu,
615  hInstance,
616  lpParam,
617  0);
618  return hwnd;
619 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_THICKFRAME
Definition: pedump.c:630
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define GW_CHILD
Definition: winuser.h:758
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define WARN(fmt,...)
Definition: debug.h:111
#define WM_SETREDRAW
Definition: winuser.h:1598
#define CW_USEDEFAULT16
Definition: undocuser.h:167
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_RESTORE
Definition: winuser.h:773
BOOL WINAPI IsZoomed(HWND hWnd)
Definition: window.c:1632
void MDI_CalcDefaultChildPos(HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id)
Definition: mdi.c:309
HINSTANCE hInstance
Definition: charmap.c:20
#define WS_EX_MDICHILD
Definition: winuser.h:394
DWORD fnid
Definition: ntuser.h:673
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:1119
const char * LPCSTR
Definition: xmlstorage.h:183
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define FNID_MDICLIENT
Definition: ntuser.h:834
#define WS_CAPTION
Definition: pedump.c:624
#define TRACE(s)
Definition: solgame.cpp:4
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define LPVOID
Definition: nt_native.h:45
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:178
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define WS_MINIMIZEBOX
Definition: pedump.c:631
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_SYSMENU
Definition: pedump.c:629
DWORD style
Definition: ntuser.h:670

Referenced by BaseWindowImpl_PrepareWindow().

◆ DeferWindowPos()

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

Definition at line 625 of file window.c.

633 {
634  return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
635 }
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
UINT uFlags
Definition: api.c:59
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
HDWP NTAPI NtUserDeferWindowPos(HDWP WinPosInfo, HWND Wnd, HWND WndInsertAfter, int x, int y, int cx, int cy, UINT Flags)
Definition: winpos.c:3161
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581

◆ DisableProcessWindowsGhosting()

VOID WINAPI DisableProcessWindowsGhosting ( VOID  )

Definition at line 2039 of file window.c.

2040 {
2042 }
EXTINLINE VOID NtUserxEnableProcessWindowGhosting(BOOL bEnable)
Definition: ntwrapper.h:801

◆ EndDeferWindowPos()

BOOL WINAPI EndDeferWindowPos ( HDWP  hWinPosInfo)

Definition at line 642 of file window.c.

643 {
644  return NtUserEndDeferWindowPosEx(hWinPosInfo, 0);
645 }
BOOL NTAPI NtUserEndDeferWindowPosEx(HDWP WinPosInfo, DWORD Unknown1)
Definition: winpos.c:3145

◆ EnumChildWindows()

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

Definition at line 766 of file window.c.

769 {
770  if (!hWndParent)
771  {
772  return EnumWindows(lpEnumFunc, lParam);
773  }
774  return User32EnumWindows(NULL, hWndParent, lpEnumFunc, lParam, 0, TRUE);
775 }
#define TRUE
Definition: types.h:120
BOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam)
Definition: window.c:796
smooth NULL
Definition: ftsmooth.c:416
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:674
LPARAM lParam
Definition: combotst.c:139

◆ EnumDesktopWindows()

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

Definition at line 807 of file window.c.

810 {
811  return User32EnumWindows(hDesktop, NULL, lpfn, lParam, 0, FALSE);
812 }
smooth NULL
Definition: ftsmooth.c:416
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:674
LPARAM lParam
Definition: combotst.c:139

◆ EnumThreadWindows()

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

Definition at line 782 of file window.c.

785 {
786  if (!dwThreadId)
788  return User32EnumWindows(NULL, NULL, lpfn, lParam, dwThreadId, FALSE);
789 }
smooth NULL
Definition: ftsmooth.c:416
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:674
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
DWORD dwThreadId
Definition: fdebug.c:31
LPARAM lParam
Definition: combotst.c:139

◆ EnumWindows()

BOOL WINAPI EnumWindows ( WNDENUMPROC  lpEnumFunc,
LPARAM  lParam 
)

Definition at line 796 of file window.c.

798 {
799  return User32EnumWindows(NULL, NULL, lpEnumFunc, lParam, 0, FALSE);
800 }
smooth NULL
Definition: ftsmooth.c:416
static BOOL User32EnumWindows(HDESK hDesktop, HWND hWndparent, WNDENUMPROC lpfn, LPARAM lParam, DWORD dwThreadId, BOOL bChildren)
Definition: window.c:674
LPARAM lParam
Definition: combotst.c:139

Referenced by EnumChildWindows().

◆ FindWindowA()

HWND WINAPI FindWindowA ( LPCSTR  lpClassName,
LPCSTR  lpWindowName 
)

Definition at line 894 of file window.c.

895 {
896  //FIXME: FindWindow does not search children, but FindWindowEx does.
897  // what should we do about this?
898  return FindWindowExA (NULL, NULL, lpClassName, lpWindowName);
899 }
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
Definition: window.c:819

◆ FindWindowExA()

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

Definition at line 819 of file window.c.

823 {
824  LPWSTR titleW = NULL;
825  HWND hwnd = 0;
826 
827  if (lpszWindow)
828  {
829  DWORD len = MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, NULL, 0 );
830  if (!(titleW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return 0;
831  MultiByteToWideChar( CP_ACP, 0, lpszWindow, -1, titleW, len );
832  }
833 
834  if (!IS_INTRESOURCE(lpszClass))
835  {
836  WCHAR classW[256];
837  if (MultiByteToWideChar( CP_ACP, 0, lpszClass, -1, classW, sizeof(classW)/sizeof(WCHAR) ))
838  hwnd = FindWindowExW( hwndParent, hwndChildAfter, classW, titleW );
839  }
840  else
841  {
842  hwnd = FindWindowExW( hwndParent, hwndChildAfter, (LPCWSTR)lpszClass, titleW );
843  }
844 
845  HeapFree( GetProcessHeap(), 0, titleW );
846  return hwnd;
847 }
static const WCHAR classW[]
Definition: lex.c:40
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR titleW[]
Definition: htmlelem.c:1067
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
HWND WINAPI FindWindowExW(HWND hwndParent, HWND hwndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow)
Definition: window.c:854
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by FindWindowA().

◆ FindWindowExW()

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

Definition at line 854 of file window.c.

858 {
859  UNICODE_STRING ucClassName, *pucClassName = NULL;
860  UNICODE_STRING ucWindowName, *pucWindowName = NULL;
861 
862  if (IS_ATOM(lpszClass))
863  {
864  ucClassName.Length = 0;
865  ucClassName.Buffer = (LPWSTR)lpszClass;
866  pucClassName = &ucClassName;
867  }
868  else if (lpszClass != NULL)
869  {
870  RtlInitUnicodeString(&ucClassName,
871  lpszClass);
872  pucClassName = &ucClassName;
873  }
874 
875  if (lpszWindow != NULL)
876  {
877  RtlInitUnicodeString(&ucWindowName,
878  lpszWindow);
879  pucWindowName = &ucWindowName;
880  }
881 
883  hwndChildAfter,
884  pucClassName,
885  pucWindowName,
886  0);
887 }
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
HWND APIENTRY NtUserFindWindowEx(HWND hwndParent, HWND hwndChildAfter, PUNICODE_STRING ucClassName, PUNICODE_STRING ucWindowName, DWORD dwUnknown)
Definition: window.c:2947
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IS_ATOM(x)
Definition: class.h:3
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by FindWindowExA(), and FindWindowW().

◆ FindWindowW()

HWND WINAPI FindWindowW ( LPCWSTR  lpClassName,
LPCWSTR  lpWindowName 
)

Definition at line 906 of file window.c.

907 {
908  /*
909 
910  There was a FIXME here earlier, but I think it is just a documentation unclarity.
911 
912  FindWindow only searches top level windows. What they mean is that child
913  windows of other windows than the desktop can be searched.
914  FindWindowExW never does a recursive search.
915 
916  / Joakim
917  */
918 
919  return FindWindowExW(NULL, NULL, lpClassName, lpWindowName);
920 }
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI FindWindowExW(HWND hwndParent, HWND hwndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow)
Definition: window.c:854

◆ GetAltTabInfoA()

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

Definition at line 928 of file window.c.

933 {
934  return NtUserGetAltTabInfo(hwnd,iItem,pati,(LPWSTR)pszItemText,cchItemText,TRUE);
935 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
BOOL NTAPI NtUserGetAltTabInfo(HWND hwnd, INT iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText, BOOL Ansi)
Definition: ntstubs.c:109
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetAltTabInfoW()

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

Definition at line 942 of file window.c.

947 {
948  return NtUserGetAltTabInfo(hwnd,iItem,pati,pszItemText,cchItemText,FALSE);
949 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL NTAPI NtUserGetAltTabInfo(HWND hwnd, INT iItem, PALTTABINFO pati, LPWSTR pszItemText, UINT cchItemText, BOOL Ansi)
Definition: ntstubs.c:109

◆ GetAncestor()

HWND WINAPI GetAncestor ( HWND  hwnd,
UINT  gaFlags 
)

Definition at line 956 of file window.c.

957 {
958  HWND Ret = NULL;
959  PWND Ancestor, Wnd;
960 
961  Wnd = ValidateHwnd(hwnd);
962  if (!Wnd)
963  return NULL;
964 
965  _SEH2_TRY
966  {
967  Ancestor = NULL;
968  switch (gaFlags)
969  {
970  case GA_PARENT:
971  if (Wnd->spwndParent != NULL)
972  Ancestor = DesktopPtrToUser(Wnd->spwndParent);
973  break;
974 
975  default:
976  /* FIXME: Call win32k for now */
977  Wnd = NULL;
978  break;
979  }
980 
981  if (Ancestor != NULL)
982  Ret = UserHMGetHandle(Ancestor);
983  }
985  {
986  /* Do nothing */
987  }
988  _SEH2_END;
989 
990  if (!Wnd) /* Fall back */
991  Ret = NtUserGetAncestor(hwnd, gaFlags);
992 
993  return Ret;
994 }
HWND APIENTRY NtUserGetAncestor(HWND hWnd, UINT Type)
Definition: window.c:3217
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
#define GA_PARENT
Definition: winuser.h:2763
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
struct _WND * spwndParent
Definition: ntuser.h:677
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

◆ GetClientRect()

BOOL WINAPI GetClientRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 1001 of file window.c.

1002 {
1003  PWND Wnd = ValidateHwnd(hWnd);
1004 
1005  if (!Wnd) return FALSE;
1006  if (Wnd->style & WS_MINIMIZED)
1007  {
1008  lpRect->left = lpRect->top = 0;
1011  return TRUE;
1012  }
1013  if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
1014  {
1015 /* lpRect->left = lpRect->top = 0;
1016  lpRect->right = Wnd->rcClient.right - Wnd->rcClient.left;
1017  lpRect->bottom = Wnd->rcClient.bottom - Wnd->rcClient.top;
1018 */
1019  *lpRect = Wnd->rcClient;
1020  OffsetRect(lpRect, -Wnd->rcClient.left, -Wnd->rcClient.top);
1021  }
1022  else
1023  {
1024  lpRect->left = lpRect->top = 0;
1025  lpRect->right = Wnd->rcClient.right;
1026  lpRect->bottom = Wnd->rcClient.bottom;
1027 /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
1028  lpRect->right = GetSystemMetrics(SM_CXSCREEN);
1029  lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1030 */ }
1031  return TRUE;
1032 }
#define TRUE
Definition: types.h:120
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CXMINIMIZED
Definition: winuser.h:1010
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HWND WINAPI GetDesktopWindow(VOID)
Definition: window.c:652
#define WS_MINIMIZED
Definition: undocuser.h:18
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CYMINIMIZED
Definition: winuser.h:1011
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
LONG bottom
Definition: windef.h:309
DWORD style
Definition: ntuser.h:670

◆ GetDesktopWindow()

HWND WINAPI GetDesktopWindow ( VOID  )

Definition at line 652 of file window.c.

653 {
654  PWND Wnd;
655  HWND Ret = NULL;
656 
657  _SEH2_TRY
658  {
659  Wnd = GetThreadDesktopWnd();
660  if (Wnd != NULL)
661  Ret = UserHMGetHandle(Wnd);
662  }
664  {
665  /* Do nothing */
666  }
667  _SEH2_END;
668 
669  return Ret;
670 }
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
PWND FASTCALL GetThreadDesktopWnd(VOID)
Definition: misc.c:407
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by _tWinMain(), AnyPopup(), 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(), DoAction(), 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(), load_graphics_driver(), MapWindowPoints(), MCIAVI_mciWhere(), MCICDA_Play(), MCIQTZ_mciWhere(), CTrayWindow::MinimizeAll(), CZipExtract::CExtractSettingsPage::OnSetActive(), OnTimer(), CNotifyToolbar::OnTooltipShow(), OnTrayInitDialog(), OSK_DlgProc(), CMenuDeskBar::Popup(), queue_event(), Run(), RunControlPanel(), running_on_visible_desktop(), ScreenToClient(), set_clipboard_thread(), shellbrowser_GetWindow(), ShowStatusMessageThread(), 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(), WinMain(), WINTRUST_CertVerify(), WINTRUST_DefaultVerify(), WndProc(), and wWinMain().

◆ GetFocus()

HWND WINAPI GetFocus ( VOID  )

Definition at line 1905 of file window.c.

1906 {
1908 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231

Referenced by _CmdWndProc(), _tWinMain(), check_active_state_(), check_wnd_state_(), ChildWndProc(), Client_get_accState(), COMBOEX_ComboWndProc(), FileChildWindow::Command(), CredDialogInit(), DEFDLG_Proc(), DEFDLG_SaveFocus(), delayFocusDlgWinProc(), DlgMainProc(), edit_dialog_proc(), edit_singleline_dialog_proc(), edit_wantreturn_dialog_proc(), EDIT_WM_NCPaint(), EndDialog(), CBrandBand::HasFocusIO(), CAddressBand::HasFocusIO(), ImmCreateContext(), ImmInternalPostIMEMessage(), ImmInternalSendIMEMessage(), ImmInternalSendIMENotify(), IntDrawScrollBar(), IntScrollHandleScrollEvent(), IPADDRESS_Draw(), is_doc_child_focus(), IsDialogMessageW(), IShellBrowserImpl_BrowseObject(), make_new_folder_timer_callback(), MsgCheckProcA(), MSIDialog_WndProc(), multi_edit_dialog_proc(), CDefView::OnContextMenu(), OnTimer(), PROPSHEET_SetWizButtons(), SCROLL_HandleScrollEvent(), set_focus_on_activate_proc(), 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(), ThreadMgr_AssociateFocus(), ThreadMgr_IsThreadFocus(), TreeListKeyDown(), TreeListMouseClick(), TREEVIEW_DrawItem(), FileChildWindow::WndProc(), StartMenuButton::WndProc(), and WndProc().

◆ GetLastActivePopup()

HWND WINAPI GetLastActivePopup ( HWND  hWnd)

Definition at line 1039 of file window.c.

1040 {
1041  PWND Wnd;
1042  HWND Ret = hWnd;
1043 
1044  Wnd = ValidateHwnd(hWnd);
1045  if (Wnd != NULL)
1046  {
1047  _SEH2_TRY
1048  {
1049  if (Wnd->spwndLastActive)
1050  {
1051  PWND LastActive = DesktopPtrToUser(Wnd->spwndLastActive);
1052  Ret = UserHMGetHandle(LastActive);
1053  }
1054  }
1056  {
1057  /* Do nothing */
1058  }
1059  _SEH2_END;
1060  }
1061  return Ret;
1062 }
HWND hWnd
Definition: settings.c:17
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
struct _WND * spwndLastActive
Definition: ntuser.h:703
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

◆ GetParent()

HWND WINAPI GetParent ( HWND  hWnd)

Definition at line 1069 of file window.c.

1070 {
1071  PWND Wnd, WndParent;
1072  HWND Ret = NULL;
1073 
1074  Wnd = ValidateHwnd(hWnd);
1075  if (Wnd != NULL)
1076  {
1077  _SEH2_TRY
1078  {
1079  WndParent = NULL;
1080  if (Wnd->style & WS_POPUP)
1081  {
1082  if (Wnd->spwndOwner != NULL)
1083  WndParent = DesktopPtrToUser(Wnd->spwndOwner);
1084  }
1085  else if (Wnd->style & WS_CHILD)
1086  {
1087  if (Wnd->spwndParent != NULL)
1088  WndParent = DesktopPtrToUser(Wnd->spwndParent);
1089  }
1090 
1091  if (WndParent != NULL)
1092  Ret = UserHMGetHandle(WndParent);
1093  }
1095  {
1096  /* Do nothing */
1097  }
1098  _SEH2_END;
1099  }
1100 
1101  return Ret;
1102 }
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
struct _WND * spwndOwner
Definition: ntuser.h:679
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
#define WS_POPUP
Definition: pedump.c:616
struct _WND * spwndParent
Definition: ntuser.h:677
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
DWORD style
Definition: ntuser.h:670

◆ GetProcessDefaultLayout()

BOOL WINAPI GetProcessDefaultLayout ( DWORD pdwDefaultLayout)

Definition at line 1109 of file window.c.

1110 {
1112 }
DWORD_PTR NTAPI NtUserCallOneParam(DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:145
unsigned int BOOL
Definition: ntddk_ex.h:94
uint32_t DWORD_PTR
Definition: typedefs.h:63

◆ GetProgmanWindow()

HWND WINAPI GetProgmanWindow ( VOID  )

Definition at line 1938 of file window.c.

1939 {
1941 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231

◆ GetRealWindowOwner()

DWORD WINAPI GetRealWindowOwner ( HWND  hwnd)

Definition at line 1911 of file window.c.

1912 {
1914 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define QUERY_WINDOW_REAL_ID
Definition: ntuser.h:2801
DWORD_PTR APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4001

Referenced by ResetUserApiHook().

◆ GetTaskmanWindow()

HWND WINAPI GetTaskmanWindow ( VOID  )

Definition at line 1947 of file window.c.

1948 {
1950 }
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:231

Referenced by UserpShowInformationBalloon().

◆ GetTopWindow()

HWND WINAPI GetTopWindow ( HWND  hWnd)

Definition at line 1190 of file window.c.

1191 {
1192  if (!hWnd) hWnd = GetDesktopWindow();
1193  return GetWindow(hWnd, GW_CHILD);
1194 }
#define GW_CHILD
Definition: winuser.h:758
HWND hWnd
Definition: settings.c:17
HWND WINAPI GetDesktopWindow(VOID)
Definition: window.c:652
HWND WINAPI GetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:1119

◆ GetWindow()

HWND WINAPI GetWindow ( HWND  hWnd,
UINT  uCmd 
)

Definition at line 1119 of file window.c.

1121 {
1122  PWND Wnd, FoundWnd;
1123  HWND Ret = NULL;
1124 
1125  Wnd = ValidateHwnd(hWnd);
1126  if (!Wnd)
1127  return NULL;
1128 
1129  _SEH2_TRY
1130  {
1131  FoundWnd = NULL;
1132  switch (uCmd)
1133  {
1134  case GW_OWNER:
1135  if (Wnd->spwndOwner != NULL)
1136  FoundWnd = DesktopPtrToUser(Wnd->spwndOwner);
1137  break;
1138 
1139  case GW_HWNDFIRST:
1140  if(Wnd->spwndParent != NULL)
1141  {
1142  FoundWnd = DesktopPtrToUser(Wnd->spwndParent);
1143  if (FoundWnd->spwndChild != NULL)
1144  FoundWnd = DesktopPtrToUser(FoundWnd->spwndChild);
1145  }
1146  break;
1147  case GW_HWNDNEXT:
1148  if (Wnd->spwndNext != NULL)
1149  FoundWnd = DesktopPtrToUser(Wnd->spwndNext);
1150  break;
1151 
1152  case GW_HWNDPREV:
1153  if (Wnd->spwndPrev != NULL)
1154  FoundWnd = DesktopPtrToUser(Wnd->spwndPrev);
1155  break;
1156 
1157  case GW_CHILD:
1158  if (Wnd->spwndChild != NULL)
1159  FoundWnd = DesktopPtrToUser(Wnd->spwndChild);
1160  break;
1161 
1162  case GW_HWNDLAST:
1163  FoundWnd = Wnd;
1164  while ( FoundWnd->spwndNext != NULL)
1165  FoundWnd = DesktopPtrToUser(FoundWnd->spwndNext);
1166  break;
1167 
1168  default:
1169  Wnd = NULL;
1170  break;
1171  }
1172 
1173  if (FoundWnd != NULL)
1174  Ret = UserHMGetHandle(FoundWnd);
1175  }
1177  {
1178  /* Do nothing */
1179  }
1180  _SEH2_END;
1181 
1182  return Ret;
1183 }
#define GW_HWNDNEXT
Definition: winuser.h:756
#define GW_CHILD
Definition: winuser.h:758
HWND hWnd
Definition: settings.c:17
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
struct _WND * spwndOwner
Definition: ntuser.h:679
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define GW_HWNDLAST
Definition: winuser.h:760
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
#define GW_HWNDFIRST
Definition: winuser.h:759
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
#define GW_OWNER
Definition: winuser.h:761
struct _WND * spwndParent
Definition: ntuser.h:677
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
struct _WND * spwndChild
Definition: ntuser.h:678
#define GW_HWNDPREV
Definition: winuser.h:757
struct _WND * spwndPrev
Definition: ntuser.h:676

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

◆ GetWindowContextHelpId()

DWORD WINAPI GetWindowContextHelpId ( HWND  hwnd)

Definition at line 1851 of file window.c.

1852 {
1854 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
EXTINLINE DWORD NtUserxGetWindowContextHelpId(HWND hwnd)
Definition: ntwrapper.h:726

◆ GetWindowInfo()

BOOL WINAPI DECLSPEC_HOTPATCH GetWindowInfo ( HWND  hWnd,
PWINDOWINFO  pwi 
)

Definition at line 1203 of file window.c.

1205 {
1206  PWND pWnd;
1207  PCLS pCls = NULL;
1208  SIZE Size = {0,0};
1209  BOOL Ret = FALSE;
1210 
1211  if ( !pwi || pwi->cbSize != sizeof(WINDOWINFO))
1212  SetLastError(ERROR_INVALID_PARAMETER); // Just set the error and go!
1213 
1214  pWnd = ValidateHwnd(hWnd);
1215  if (!pWnd)
1216  return Ret;
1217 
1218  UserGetWindowBorders(pWnd->style, pWnd->ExStyle, &Size, FALSE);
1219 
1220  _SEH2_TRY
1221  {
1222  pCls = DesktopPtrToUser(pWnd->pcls);
1223  pwi->rcWindow = pWnd->rcWindow;
1224  pwi->rcClient = pWnd->rcClient;
1225  pwi->dwStyle = pWnd->style;
1226  pwi->dwExStyle = pWnd->ExStyle;
1227  pwi->cxWindowBorders = Size.cx;
1228  pwi->cyWindowBorders = Size.cy;
1229  pwi->dwWindowStatus = 0;
1230  if (pWnd->state & WNDS_ACTIVEFRAME || (GetActiveWindow() == hWnd))
1232  pwi->atomWindowType = (pCls ? pCls->atomClassName : 0 );
1233 
1234  if ( pWnd->state2 & WNDS2_WIN50COMPAT )
1235  {
1236  pwi->wCreatorVersion = 0x500;
1237  }
1238  else if ( pWnd->state2 & WNDS2_WIN40COMPAT )
1239  {
1240  pwi->wCreatorVersion = 0x400;
1241  }
1242  else if ( pWnd->state2 & WNDS2_WIN31COMPAT )
1243  {
1244  pwi->wCreatorVersion = 0x30A;
1245  }
1246  else
1247  {
1248  pwi->wCreatorVersion = 0x300;
1249  }
1250 
1251  Ret = TRUE;
1252  }
1254  {
1255  /* Do nothing */
1256  }
1257  _SEH2_END;
1258 
1259  return Ret;
1260 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD ExStyle
Definition: ntuser.h:668
#define TRUE
Definition: types.h:120
DWORD cbSize
Definition: winuser.h:3741
#define WS_ACTIVECAPTION
Definition: winuser.h:2634
DWORD dwStyle
Definition: winuser.h:3744
UINT cxWindowBorders
Definition: winuser.h:3747
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: winpos.c:885
HWND hWnd
Definition: settings.c:17
UINT cyWindowBorders
Definition: winuser.h:3748
WORD wCreatorVersion
Definition: winuser.h:3750
RECT rcClient
Definition: ntuser.h:681
ATOM atomWindowType
Definition: winuser.h:3749
RTL_ATOM atomClassName
Definition: ntuser.h:536
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:533
RECT rcWindow
Definition: winuser.h:3742
DWORD dwExStyle
Definition: winuser.h:3745
DWORD dwWindowStatus
Definition: winuser.h:3746
#define SetLastError(x)
Definition: compat.h:417
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:619
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:579
RECT rcWindow
Definition: ntuser.h:680
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
DWORD state
Definition: ntuser.h:665
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:617
DWORD state2
Definition: ntuser.h:666
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
RECT rcClient
Definition: winuser.h:3743
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:618
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
PCLS pcls
Definition: ntuser.h:684
DWORD style
Definition: ntuser.h:670

◆ GetWindowModuleFileNameA()

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

Definition at line 1267 of file window.c.

1270 {
1271  PWND Wnd = ValidateHwnd(hwnd);
1272 
1273  if (!Wnd)
1274  return 0;
1275 
1276  return GetModuleFileNameA(Wnd->hModule, lpszFileName, cchFileNameMax);
1277 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HINSTANCE hModule
Definition: ntuser.h:672
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:548
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657

◆ GetWindowModuleFileNameW()

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

Definition at line 1284 of file window.c.

1287 {
1288  PWND Wnd = ValidateHwnd(hwnd);
1289 
1290  if (!Wnd)
1291  return 0;
1292 
1293  return GetModuleFileNameW( Wnd->hModule, lpszFileName, cchFileNameMax );
1294 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HINSTANCE hModule
Definition: ntuser.h:672
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657

◆ GetWindowRect()

BOOL WINAPI GetWindowRect ( HWND  hWnd,
LPRECT  lpRect 
)

Definition at line 1300 of file window.c.

1302 {
1303  PWND Wnd = ValidateHwnd(hWnd);
1304 
1305  if (!Wnd) return FALSE;
1306  if ( hWnd != GetDesktopWindow()) // Wnd->fnid != FNID_DESKTOP )
1307  {
1308  *lpRect = Wnd->rcWindow;
1309  }
1310  else
1311  {
1312  lpRect->left = lpRect->top = 0;
1313  lpRect->right = Wnd->rcWindow.right;
1314  lpRect->bottom = Wnd->rcWindow.bottom;
1315 /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
1316  lpRect->right = GetSystemMetrics(SM_CXSCREEN);
1317  lpRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1318 */ }
1319  return TRUE;
1320 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HWND WINAPI GetDesktopWindow(VOID)
Definition: window.c:652
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
RECT rcWindow
Definition: ntuser.h:680
Definition: ntuser.h:657
LONG bottom
Definition: windef.h:309

Referenced by BaseControlWindowImpl_get_Left(), BaseControlWindowImpl_get_Top(), BaseControlWindowImpl_GetWindowPosition(), BaseControlWindowImpl_put_Left(), and BaseControlWindowImpl_put_Top().

◆ GetWindowTextA()

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

Definition at line 1326 of file window.c.

1327 {
1328  PWND Wnd;
1329  INT Length = 0;
1330 
1331  if (lpString == NULL || nMaxCount == 0)
1332  return 0;
1333 
1334  Wnd = ValidateHwnd(hWnd);
1335  if (!Wnd)
1336  return 0;
1337 
1338  lpString[0] = '\0';
1339 
1340  if (!TestWindowProcess(Wnd))
1341  {
1342  _SEH2_TRY
1343  {
1345  }
1347  {
1348  Length = 0;
1349  }
1350  _SEH2_END;
1351  }
1352  else
1353  {
1355  }
1356  //ERR("GWTA Len %d : %s\n",Length,lpString);
1357  return Length;
1358 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
int32_t INT
Definition: typedefs.h:56
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_In_ int nMaxCount
Definition: winuser.h:4852

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

1365 {
1366  PWND Wnd;
1367 
1368  Wnd = ValidateHwnd(hWnd);
1369  if (!Wnd)
1370  return 0;
1371 
1372  if (!TestWindowProcess(Wnd))
1373  {
1374  return DefWindowProcA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1375  }
1376  else
1377  {
1378  return SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
1379  }
1380 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: ntuser.h:657

◆ GetWindowTextLengthW()

int WINAPI GetWindowTextLengthW ( HWND  hWnd)

Definition at line 1386 of file window.c.

1387 {
1388  PWND Wnd;
1389 
1390  Wnd = ValidateHwnd(hWnd);
1391  if (!Wnd)
1392  return 0;
1393 
1394  if (!TestWindowProcess(Wnd))
1395  {
1396  return DefWindowProcW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1397  }
1398  else
1399  {
1400  return SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0);
1401  }
1402 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ GetWindowTextW()

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

Definition at line 1408 of file window.c.

1409 {
1410  PWND Wnd;
1411  INT Length = 0;
1412 
1413  if (lpString == NULL || nMaxCount == 0)
1414  return 0;
1415 
1416  Wnd = ValidateHwnd(hWnd);
1417  if (!Wnd)
1418  return 0;
1419 
1420  lpString[0] = L'\0';
1421 
1422  if (!TestWindowProcess(Wnd))
1423  {
1424  _SEH2_TRY
1425  {
1427  }
1429  {
1430  Length = 0;
1431  }
1432  _SEH2_END;
1433  }
1434  else
1435  {
1437  }
1438  //ERR("GWTW Len %d : %S\n",Length,lpString);
1439  return Length;
1440 }
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
int32_t INT
Definition: typedefs.h:56
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_In_ int nMaxCount
Definition: winuser.h:4852

Referenced by AboutDlgProc(), CAutoComplete::ACEditSubclassProc(), AddressBarProc(), AtlAxWin_wndproc(), BaseControlWindowImpl_get_Caption(), CBUpdateLBox(), CMP_RegisterNotification(), COMBOEX_ComboWndProc(), COMBOEX_Command(), COMBOEX_DrawItem(), COMBOEX_EditWndProc(), CompleteSwitch(), CredDialogCommandOk(), DestinationDlgProc(), DIALOG_IsAccelerator(), DialogProc(), CDownloadManager::DownloadDlgProc(), EnableOkButtonFromEditContents(), EndNowDlgProc(), EnumWindowsProc(), ExportRegistryFile_OFNHookProc(), FILEDLG95_FILENAME_GetFileNames(), FilterDialogDlgProc(), find_control(), find_top_window(), find_window_callback(), FindDialogProc(), FontProc(), FontSizeList_GetSelectedFontSize(), FontWndProc(), get_button_text(), CSearchBar::GetAddressEditBoxPath(), GetDlgItemTextW(), GetStringFromDialog(), GetTextboxText(), CUiWindow< CStatusBar >::GetWindowTextW(), hyperlink_dlgproc(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), ie_dialog_open_proc(), InitializeChkDskDialog(), InitializeFormatDriveDlg(), IPADDRESS_ConstrainField(), IPADDRESS_GetAddress(), IPADDRESS_SubclassProc(), IPADDRESS_UpdateText(), IsThereAnyEffectiveWindow(), 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(), OnPaint(), CAddressBand::OnTipText(), paraformat_proc(), PrepareFoldersToScan(), prompt_dlgproc(), promptdisk_ok(), PropertiesDialogDlgProc(), 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 1443 of file window.c.

1445 {
1446  DWORD Ret = 0;
1447  PTHREADINFO ti;
1448  PWND pWnd = ValidateHwnd(hWnd);
1449 
1450  if (!pWnd) return Ret;
1451 
1452  ti = pWnd->head.pti;
1453 
1454  if (ti)
1455  {
1456  if (ti == GetW32ThreadInfo())
1457  { // We are current.
1458  //FIXME("Current!\n");
1459  if (lpdwProcessId)
1460  *lpdwProcessId = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
1461  Ret = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueThread;
1462  }
1463  else
1464  { // Ask kernel for info.
1465  //FIXME("Kernel call!\n");
1466  if (lpdwProcessId)
1469  }
1470  }
1471  return Ret;
1472 }
#define QUERY_WINDOW_UNIQUE_THREAD_ID
Definition: ntuser.h:2797
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2796
#define DWORD_PTR
Definition: treelist.c:76
HWND hWnd
Definition: settings.c:17
DWORD_PTR APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4001
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
THRDESKHEAD head
Definition: ntuser.h:659
unsigned long DWORD
Definition: ntddk_ex.h:95
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ InternalGetWindowText()

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

Definition at line 1860 of file window.c.

1861 {
1862  INT Ret = NtUserInternalGetWindowText(hWnd, lpString, nMaxCount);
1863  if (Ret == 0 && lpString)
1864  *lpString = L'\0';
1865  return Ret;
1866 }
HWND hWnd
Definition: settings.c:17
int32_t INT
Definition: typedefs.h:56
INT APIENTRY NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount)
Definition: window.c:4383
static const WCHAR L[]
Definition: oid.c:1250
_In_ int nMaxCount
Definition: winuser.h:4852

◆ IsChild()

BOOL WINAPI IsChild ( HWND  hWndParent,
HWND  hWnd 
)

Definition at line 1479 of file window.c.

1481 {
1482  PWND WndParent, DesktopWnd, Wnd;
1483  BOOL Ret = FALSE;
1484 
1485  WndParent = ValidateHwnd(hWndParent);
1486  if (!WndParent)
1487  return FALSE;
1488  Wnd = ValidateHwnd(hWnd);
1489  if (!Wnd)
1490  return FALSE;
1491 
1492  DesktopWnd = GetThreadDesktopWnd();
1493  if (!DesktopWnd)
1494  return FALSE;
1495 
1496  _SEH2_TRY
1497  {
1498  while (Wnd != NULL && ((Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD))
1499  {
1500  if (Wnd->spwndParent != NULL)
1501  {
1502  Wnd = DesktopPtrToUser(Wnd->spwndParent);
1503 
1504  if (Wnd == WndParent)
1505  {
1506  Ret = TRUE;
1507  break;
1508  }
1509  }
1510  else
1511  break;
1512  }
1513  }
1515  {
1516  /* Do nothing */
1517  }
1518  _SEH2_END;
1519 
1520  return Ret;
1521 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define WS_CHILD
Definition: pedump.c:617
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
#define WS_POPUP
Definition: pedump.c:616
PWND FASTCALL GetThreadDesktopWnd(VOID)
Definition: misc.c:407
struct _WND * spwndParent
Definition: ntuser.h:677
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
DWORD style
Definition: ntuser.h:670

◆ IsHungAppWindow()

BOOL WINAPI IsHungAppWindow ( HWND  hwnd)

Definition at line 1872 of file window.c.

1873 {
1874  PWND Window;
1875  UNICODE_STRING ClassName;
1876  WCHAR szClass[16];
1877  static const UNICODE_STRING GhostClass = RTL_CONSTANT_STRING(L"Ghost");
1878 
1879  /* Ghost is a hung window */
1880  RtlInitEmptyUnicodeString(&ClassName, szClass, sizeof(szClass));
1882  if (Window && Window->fnid == FNID_GHOST &&
1883  NtUserGetClassName(hwnd, FALSE, &ClassName) &&
1884  RtlEqualUnicodeString(&ClassName, &GhostClass, TRUE))
1885  {
1886  return TRUE;
1887  }
1888 
1889  return (NtUserQueryWindow(hwnd, QUERY_WINDOW_ISHUNG) != 0);
1890 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
DWORD_PTR APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4001
Definition: window.c:28
__wchar_t WCHAR
Definition: xmlstorage.h:180
int Window
Definition: x11stubs.h:26
#define QUERY_WINDOW_ISHUNG
Definition: ntuser.h:2800
static const WCHAR L[]
Definition: oid.c:1250
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
#define FNID_GHOST
Definition: ntuser.h:837
INT NTAPI NtUserGetClassName(HWND hWnd, BOOL Real, PUNICODE_STRING ClassName)
static UNICODE_STRING GhostClass
Definition: ghost.c:16
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

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

◆ IsIconic()

BOOL WINAPI IsIconic ( HWND  hWnd)

Definition at line 1528 of file window.c.

1529 {
1530  PWND Wnd = ValidateHwnd(hWnd);
1531 
1532  if (Wnd != NULL)
1533  return (Wnd->style & WS_MINIMIZE) != 0;
1534 
1535  return FALSE;
1536 }
HWND hWnd
Definition: settings.c:17
#define WS_MINIMIZE
Definition: pedump.c:622
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
DWORD style
Definition: ntuser.h:670

◆ IsWindow()

BOOL WINAPI IsWindow ( HWND  hWnd)

Definition at line 1543 of file window.c.

1544 {
1545  PWND Wnd = ValidateHwndNoErr(hWnd);
1546  if (Wnd != NULL)
1547  {
1548  if (Wnd->state & WNDS_DESTROYED ||
1549  Wnd->state2 & WNDS2_INDESTROY)
1550  return FALSE;
1551  return TRUE;
1552  }
1553 
1554  return FALSE;
1555 }
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:657
DWORD state
Definition: ntuser.h:665
DWORD state2
Definition: ntuser.h:666
#define WNDS_DESTROYED
Definition: ntuser.h:604
#define WNDS2_INDESTROY
Definition: ntuser.h:616

Referenced by AnimateWindow(), and create_window_object().

◆ IsWindowEnabled()

BOOL WINAPI IsWindowEnabled ( HWND  hWnd)

Definition at line 1618 of file window.c.

1619 {
1620  // AG: I don't know if child windows are affected if the parent is
1621  // disabled. I think they stop processing messages but stay appearing
1622  // as enabled.
1623 
1625 }
#define WS_DISABLED
Definition: pedump.c:621
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define GWL_STYLE
Definition: winuser.h:846

◆ IsWindowInDestroy()

BOOL WINAPI IsWindowInDestroy ( HWND  hWnd)

Definition at line 2026 of file window.c.

2027 {
2028  PWND pwnd;
2029  pwnd = ValidateHwnd(hWnd);
2030  if (!pwnd)
2031  return FALSE;
2032  return ((pwnd->state2 & WNDS2_INDESTROY) == WNDS2_INDESTROY);
2033 }
HWND hWnd
Definition: settings.c:17
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
DWORD state2
Definition: ntuser.h:666
#define WNDS2_INDESTROY
Definition: ntuser.h:616

◆ IsWindowUnicode()

BOOL WINAPI IsWindowUnicode ( HWND  hWnd)

Definition at line 1562 of file window.c.

1563 {
1564  PWND Wnd = ValidateHwnd(hWnd);
1565 
1566  if (Wnd != NULL)
1567  return Wnd->Unicode;
1568 
1569  return FALSE;
1570 }
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
UINT Unicode
Definition: ntuser.h:720

◆ IsWindowVisible()

BOOL WINAPI IsWindowVisible ( HWND  hWnd)

Definition at line 1577 of file window.c.

1578 {
1579  BOOL Ret = FALSE;
1580  PWND Wnd = ValidateHwnd(hWnd);
1581 
1582  if (Wnd != NULL)
1583  {
1584  _SEH2_TRY
1585  {
1586  Ret = TRUE;
1587 
1588  do
1589  {
1590  if (!(Wnd->style & WS_VISIBLE))
1591  {
1592  Ret = FALSE;
1593  break;
1594  }
1595 
1596  if (Wnd->spwndParent != NULL)
1597  Wnd = DesktopPtrToUser(Wnd->spwndParent);
1598  else
1599  break;
1600 
1601  } while (Wnd != NULL);
1602  }
1604  {
1605  Ret = FALSE;
1606  }
1607  _SEH2_END;
1608  }
1609 
1610  return Ret;
1611 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
_SEH2_TRY
Definition: create.c:4250
static __inline PVOID DesktopPtrToUser(PVOID Ptr)
Definition: user_x.h:12
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
_SEH2_END
Definition: create.c:4424
struct _WND * spwndParent
Definition: ntuser.h:677
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:670

Referenced by AnimateWindow(), AnyPopup(), and BaseControlWindowImpl_get_Visible().

◆ IsZoomed()

BOOL WINAPI IsZoomed ( HWND  hWnd)

Definition at line 1632 of file window.c.

1633 {
1634  return (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_MAXIMIZE) != 0;
1635 }
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4804
#define GWL_STYLE
Definition: winuser.h:846
#define WS_MAXIMIZE
Definition: pedump.c:623

Referenced by CreateWindowExA(), and CreateWindowExW().

◆ LockSetForegroundWindow()

BOOL WINAPI LockSetForegroundWindow ( UINT  uLockCode)

Definition at line 1642 of file window.c.

1643 {
1644  return NtUserxLockSetForegroundWindow(uLockCode);
1645 }
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 309 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));
331 }
static MDICLIENTINFO * get_client_info(HWND client)
Definition: mdi.c:225
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define SM_CYFRAME
Definition: winuser.h:986
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
#define TRACE(s)
Definition: solgame.cpp:4
#define SM_CYCAPTION
Definition: winuser.h:953
UINT nTotalCreated
Definition: mdi.c:123
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
UINT idFirstChild
Definition: mdi.c:121
UINT nActiveChildren
Definition: mdi.c:115

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

◆ OpenIcon()

BOOL WINAPI OpenIcon ( HWND  hWnd)

Definition at line 1682 of file window.c.

1683 {
1685  return FALSE;
1686 
1688  return TRUE;
1689 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_RESTORE
Definition: winuser.h:773
#define WS_MINIMIZE
Definition: pedump.c:622
#define GWL_STYLE
Definition: winuser.h:846

◆ RealChildWindowFromPoint()

HWND WINAPI RealChildWindowFromPoint ( HWND  hwndParent,
POINT  ptParentClientCoords 
)

Definition at line 1696 of file window.c.

1698 {
1699  return NtUserRealChildWindowFromPoint(hwndParent, ptParentClientCoords.x, ptParentClientCoords.y);
1700 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
static HWND hwndParent
Definition: cryptui.c:300
HWND NTAPI NtUserRealChildWindowFromPoint(HWND Parent, LONG x, LONG y)
Definition: winpos.c:3386

◆ 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:606
#define GetProcessHeap()
Definition: compat.h:403
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

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 
159  if ( hModule && !((ULONG_PTR)hModule >> 16))
160  {
161  pinth = RtlImageNtHeader( hModule );
162 
163  dwMajorVersion = pinth->OptionalHeader.MajorSubsystemVersion;
164 
165  if ( dwMajorVersion == 1 )
166  {
167  dwMajorVersion = 3;
168  }
169  else
170  {
171  dwMinorVersion = pinth->OptionalHeader.MinorSubsystemVersion;
172  }
173  }
174  return MAKELONG(MAKEWORD(dwMinorVersion, dwMajorVersion), 0);
175 }
#define MAKEWORD(a, b)
Definition: typedefs.h:247
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define MAKELONG(a, b)
Definition: typedefs.h:248
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RtlImageNtHeader
Definition: compat.h:465
HMODULE hModule
Definition: animate.c:44

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 RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
uint16_t * PWSTR
Definition: typedefs.h:54
VOID NTAPI RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING, IN PCSZ, IN INT)
Definition: rtlstr.c:17
signed char * PSTR
Definition: retypes.h:7

Referenced by User32CreateWindowEx().

◆ ScrollWindow()

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

Definition at line 1956 of file window.c.

1961 {
1962  return NtUserScrollWindowEx(hWnd,
1963  dx,
1964  dy,
1965  lpRect,
1966  prcClip,
1967  0,
1968  NULL,
1970 }
#define ERROR(name)
Definition: error_private.h:53
GLint dy
Definition: linetemp.h:97
HWND hWnd
Definition: settings.c:17
#define SW_ERASE
Definition: winuser.h:2555
smooth NULL
Definition: ftsmooth.c:416
DWORD NTAPI NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect, const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
Definition: scrollex.c:567
#define SW_SCROLLWNDDCE
Definition: undocuser.h:90
#define SW_INVALIDATE
Definition: winuser.h:2554
#define SW_SCROLLCHILDREN
Definition: winuser.h:2553
GLint dx
Definition: linetemp.h:97

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

1986 {
1987  if (flags & SW_SMOOTHSCROLL)
1988  {
1989  FIXME("SW_SMOOTHSCROLL not supported.");
1990  // Fall through....
1991  }
1992  return NtUserScrollWindowEx(hWnd,
1993  dx,
1994  dy,
1995  prcScroll,
1996  prcClip,
1997  hrgnUpdate,
1998  prcUpdate,
1999  flags);
2000 }
GLint dy
Definition: linetemp.h:97
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD NTAPI NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect, const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate, UINT flags)
Definition: scrollex.c:567
GLbitfield flags
Definition: glext.h:7161
GLint dx
Definition: linetemp.h:97

◆ SetForegroundWindow()

BOOL WINAPI SetForegroundWindow ( HWND  hWnd)

Definition at line 1706 of file window.c.

1707 {
1709 }
HWND hWnd
Definition: settings.c:17
EXTINLINE BOOL NtUserxSetForegroundWindow(HWND hWnd)
Definition: ntwrapper.h:788

Referenced by BaseControlWindowImpl_SetWindowForeground().

◆ SetLastErrorEx()

VOID WINAPI SetLastErrorEx ( DWORD  dwErrCode,
DWORD  dwType 
)

Definition at line 1896 of file window.c.

1897 {
1898  SetLastError(dwErrCode);
1899 }
#define SetLastError(x)
Definition: compat.h:417

◆ SetProcessDefaultLayout()

BOOL WINAPI SetProcessDefaultLayout ( DWORD  dwDefaultLayout)

Definition at line 1716 of file window.c.

1717 {
1719 }
DWORD_PTR NTAPI NtUserCallOneParam(DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:145
uint32_t DWORD_PTR
Definition: typedefs.h:63

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

◆ SetProgmanWindow()

HWND WINAPI SetProgmanWindow ( HWND  hWnd)

Definition at line 1929 of file window.c.

1930 {
1931  return NtUserxSetProgmanWindow(hWnd);
1932 }
HWND hWnd
Definition: settings.c:17
EXTINLINE HWND NtUserxSetProgmanWindow(HWND hWnd)
Definition: ntwrapper.h:763

◆ SetTaskmanWindow()

HWND WINAPI SetTaskmanWindow ( HWND  hWnd)

Definition at line 1920 of file window.c.

1921 {
1922  return NtUserxSetTaskmanWindow(hWnd);
1923 }
HWND hWnd
Definition: settings.c:17
EXTINLINE HWND NtUserxSetTaskmanWindow(HWND hWnd)
Definition: ntwrapper.h:758

Referenced by RegisterShellHook().

◆ SetWindowContextHelpId()

BOOL WINAPI SetWindowContextHelpId ( HWND  hwnd,
DWORD  dwContextHelpId 
)

Definition at line 1841 of file window.c.

1843 {
1844  return NtUserxSetWindowContextHelpId(hwnd, dwContextHelpId);
1845 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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 1728 of file window.c.

1730 {
1731  PWND pwnd;
1732 
1733  pwnd = ValidateHwnd(hWnd);
1734  if (pwnd)
1735  {
1736  if (!TestWindowProcess(pwnd))
1737  {
1738  /* do not send WM_GETTEXT messages to other processes */
1739  return (DefWindowProcA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1740  }
1741  return (SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1742  }
1743  return FALSE;
1744 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: ntuser.h:657

◆ SetWindowTextW()

BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextW ( HWND  hWnd,
LPCWSTR  lpString 
)

Definition at line 1753 of file window.c.

1755 {
1756  PWND pwnd;
1757 
1758  pwnd = ValidateHwnd(hWnd);
1759  if (pwnd)
1760  {
1761  if (!TestWindowProcess(pwnd))
1762  {
1763  /* do not send WM_GETTEXT messages to other processes */
1764  return (DefWindowProcW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1765  }
1766  return (SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)lpString) >= 0);
1767  }
1768  return FALSE;
1769 }
HWND hWnd
Definition: settings.c:17
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:176
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
Definition: ntuser.h:657
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by BaseControlWindowImpl_put_Caption().

◆ ShowOwnedPopups()

BOOL WINAPI ShowOwnedPopups ( HWND  hWnd,
BOOL  fShow 
)

Definition at line 1776 of file window.c.

1777 {
1778  return NtUserxShowOwnedPopups(hWnd, fShow);
1779 }
HWND hWnd
Definition: settings.c:17
EXTINLINE BOOL NtUserxShowOwnedPopups(HWND hWnd, BOOL fShow)
Definition: ntwrapper.h:696

◆ SwitchToThisWindow()

VOID WINAPI SwitchToThisWindow ( HWND  hwnd,
BOOL  fAltTab 
)

Definition at line 82 of file window.c.

83 {
85 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
EXTINLINE VOID NtUserxSwitchToThisWindow(HWND hWnd, BOOL fAltTab)
Definition: ntwrapper.h:691

Referenced by ApplicationPage_OnSwitchTo(), CTaskSwitchWnd::HandleTaskItemClick(), and OnTimer().

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

1795 {
1796  if (dwFlags & ULW_EX_NORESIZE) /* only valid for UpdateLayeredWindowIndirect */
1797  {
1799  return FALSE;
1800  }
1802  hdcDst,
1803  pptDst,
1804  psize,
1805  hdcSrc,
1806  pptSrc,
1807  crKey,
1808  pbl,
1809  dwFlags,
1810  NULL);
1811 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_Must_inspect_result_ _Out_ LPSIZE psize
Definition: ntgdi.h:1569
static HDC hdcSrc
Definition: xlate.c:32
#define ULW_EX_NORESIZE
Definition: winuser.h:2762
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
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:417
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static HDC hdcDst
Definition: xlate.c:32

Referenced by init_procs().

◆ UpdateLayeredWindowIndirect()

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

Definition at line 1817 of file window.c.

1819 {
1820  if (info && info->cbSize == sizeof(*info))
1821  {
1823  info->hdcDst,
1824  (POINT *)info->pptDst,
1825  (SIZE *)info->psize,
1826  info->hdcSrc,
1827  (POINT *)info->pptSrc,
1828  info->crKey,
1829  (BLENDFUNCTION *)info->pblend,
1830  info->dwFlags,
1831  (RECT *)info->prcDirty);
1832  }
1834  return FALSE;
1835 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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
#define SetLastError(x)
Definition: compat.h:417

◆ 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_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define TRACE(s)
Definition: solgame.cpp:4
return STATUS_SUCCESS
Definition: btrfs.c:2938
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 178 of file window.c.

191 {
192  LARGE_STRING WindowName;
193  LARGE_STRING lstrClassName, *plstrClassName;
194  LARGE_STRING lstrClassVersion, *plstrClassVersion;
195  UNICODE_STRING ClassName;
196  UNICODE_STRING ClassVersion;
197  WNDCLASSEXA wceA;
198  WNDCLASSEXW wceW;
200  DWORD dwLastError;
201  BOOL Unicode, ClassFound = FALSE;
202  HWND Handle = NULL;
203  LPCWSTR lpszClsVersion;
204  LPCWSTR lpLibFileName = NULL;
205  HANDLE pCtx = NULL;
206  DWORD dwFlagsVer;
207 
208 #if 0
209  DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
210 #endif
211 
213  TRACE("Module Version %x\n",dwFlagsVer);
214 
216  {
217  TRACE("RegisterSystemControls\n");
219  }
220 
221  Unicode = !(dwFlags & NUCWE_ANSI);
222 
223  if (IS_ATOM(lpClassName))
224  {
225  plstrClassName = (PVOID)lpClassName;
226  }
227  else
228  {
229  if (Unicode)
230  {
231  RtlInitUnicodeString(&ClassName, (PCWSTR)lpClassName);
232  }
233  else
234  {
235  if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, (PCSZ)lpClassName))
236  {
238  return NULL;
239  }
240  }
241 
242  /* Copy it to a LARGE_STRING */
243  lstrClassName.Buffer = ClassName.Buffer;
244  lstrClassName.Length = ClassName.Length;
245  lstrClassName.MaximumLength = ClassName.MaximumLength;
246  plstrClassName = &lstrClassName;
247  }
248 
249  /* Initialize a LARGE_STRING */
250  RtlInitLargeString(&WindowName, lpWindowName, Unicode);
251 
252  // HACK: The current implementation expects the Window name to be UNICODE
253  if (!Unicode)
254  {
256  PSTR AnsiBuffer = WindowName.Buffer;
257  ULONG AnsiLength = WindowName.Length;
258 
259  WindowName.Length = 0;
260  WindowName.MaximumLength = AnsiLength * sizeof(WCHAR);
261  WindowName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
262  0,
263  WindowName.MaximumLength);
264  if (!WindowName.Buffer)
265  {
267  goto cleanup;
268  }
269 
270  Status = RtlMultiByteToUnicodeN(WindowName.Buffer,
271  WindowName.MaximumLength,
272  &WindowName.Length,
273  AnsiBuffer,
274  AnsiLength);
275  if (!NT_SUCCESS(Status))
276  {
277  goto cleanup;
278  }
279  }
280 
281  if (!hMenu && (dwStyle & (WS_OVERLAPPEDWINDOW | WS_POPUP)))
282  {
283  if (Unicode)
284  {
285  wceW.cbSize = sizeof(wceW);
286  if (GetClassInfoExW(hInstance, (LPCWSTR)lpClassName, &wceW) && wceW.lpszMenuName)
287  {
288  hMenu = LoadMenuW(hInstance, wceW.lpszMenuName);
289  }
290  }
291  else
292  {
293  wceA.cbSize = sizeof(wceA);
294  if (GetClassInfoExA(hInstance, lpClassName, &wceA) && wceA.lpszMenuName)
295  {
296  hMenu = LoadMenuA(hInstance, wceA.lpszMenuName);
297  }
298  }
299  }
300 
301  if (!Unicode) dwExStyle |= WS_EX_SETANSICREATOR;
302 
303  lpszClsVersion = ClassNameToVersion(lpClassName, NULL, &lpLibFileName, &pCtx, !Unicode);
304  if (!lpszClsVersion)
305  {
306  plstrClassVersion = plstrClassName;
307  }
308  else
309  {
310  RtlInitUnicodeString(&ClassVersion, lpszClsVersion);
311  lstrClassVersion.Buffer = ClassVersion.Buffer;
312  lstrClassVersion.Length = ClassVersion.Length;
313  lstrClassVersion.MaximumLength = ClassVersion.MaximumLength;
314  plstrClassVersion = &lstrClassVersion;
315  }
316 
317  for (;;)
318  {
319  Handle = NtUserCreateWindowEx(dwExStyle,
320  plstrClassName,
321  plstrClassVersion,
322  &WindowName,
323  dwStyle,
324  x,
325  y,
326  nWidth,
327  nHeight,
328  hWndParent,
329  hMenu,
330  hInstance,
331  lpParam,
332  dwFlagsVer,
333  pCtx );
334  if (Handle) break;
335  if (!lpLibFileName) break;
336  if (!ClassFound)
337  {
338  dwLastError = GetLastError();
339  if (dwLastError == ERROR_CANNOT_FIND_WND_CLASS)
340  {
341  ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule);
342  if (ClassFound) continue;
343  }
344  }
345  if (hLibModule)
346  {
347  dwLastError = GetLastError();
349  SetLastError(dwLastError);
350  hLibModule = NULL;
351  }
352  break;
353  }
354 
355 #if 0
356  DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle);
357 #endif
358 
359 cleanup:
360  if (!Unicode)
361  {
362  if (!IS_ATOM(lpClassName))
363  RtlFreeUnicodeString(&ClassName);
364 
365  RtlFreeLargeString(&WindowName);
366  }
367 
368  return Handle;
369 }
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:2495
CONST char * PCSZ
Definition: umtypes.h:125
const uint16_t * PCWSTR
Definition: typedefs.h:55
HINSTANCE hLibModule
Definition: sfc.c:23
VOID NTAPI RtlFreeLargeString(IN PLARGE_STRING LargeString)
Definition: window.c:141
LPCSTR lpszMenuName
Definition: winuser.h:3185
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
LPCWSTR FASTCALL ClassNameToVersion(const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi)
Definition: class.c:85
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define DbgPrint
Definition: loader.c:25
USHORT MaximumLength
Definition: env_spec_w32.h:370
PVOID Buffer
Definition: ntuser.h:97
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
HMENU WINAPI LoadMenuA(_In_opt_ HINSTANCE, _In_ LPCSTR)
LONG NTSTATUS
Definition: precomp.h:26
#define NUCWE_ANSI
Definition: undocuser.h:74
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HINSTANCE hInstance
Definition: charmap.c:20
LPCWSTR lpszMenuName
Definition: winuser.h:3200
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3176
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
void * PVOID
Definition: retypes.h:9
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
_In_ HANDLE Handle
Definition: extypes.h:390
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
UINT cbSize
Definition: winuser.h:3191
ULONG Length
Definition: ntuser.h:94
CHAR AnsiBuffer[1024]
Definition: debug.c:15
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:417
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
Status
Definition: gdiplustypes.h:24
#define WS_EX_SETANSICREATOR
Definition: undocuser.h:28
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
signed char * PSTR
Definition: retypes.h:7
#define WS_POPUP
Definition: pedump.c:616
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
FORCEINLINE VOID RtlInitLargeString(OUT PLARGE_STRING plstr, LPCVOID psz, BOOL bUnicode)
Definition: window.c:124
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
char * cleanup(char *str)
Definition: wpickclick.c:99
#define IS_ATOM(x)
Definition: class.h:3
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
DWORD FASTCALL RtlGetExpWinVer(HMODULE hModule)
Definition: window.c:153
ULONG MaximumLength
Definition: ntuser.h:95
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
BOOL FASTCALL VersionRegisterClass(PCWSTR, LPCWSTR, HANDLE, HMODULE *)
Definition: class.c:195
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:888

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

680 {
681  DWORD i, dwCount = 0;
682  HWND* pHwnd = NULL;
683  HANDLE hHeap;
685 
686  if (!lpfn)
687  {
689  return FALSE;
690  }
691 
692  /* FIXME instead of always making two calls, should we use some
693  sort of persistent buffer and only grow it ( requiring a 2nd
694  call ) when the buffer wasn't already big enough? */
695  /* first get how many window entries there are */
696  Status = NtUserBuildHwndList(hDesktop,
697  hWndparent,
698  bChildren,
699  dwThreadId,
700  lParam,
701  NULL,
702  &dwCount);
703  if (!NT_SUCCESS(Status))
704  return FALSE;
705 
706  if (!dwCount)
707  {
708  if (!dwThreadId)
709  return FALSE;
710  else
711  return TRUE;
712  }
713 
714  /* allocate buffer to receive HWND handles */
715  hHeap = GetProcessHeap();
716  pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1));
717  if (!pHwnd)
718  {
720  return FALSE;
721  }
722 
723  /* now call kernel again to fill the buffer this time */
724  Status = NtUserBuildHwndList(hDesktop,
725  hWndparent,
726  bChildren,
727  dwThreadId,
728  lParam,
729  pHwnd,
730  &dwCount);
731  if (!NT_SUCCESS(Status))
732  {
733  if (pHwnd)
734  HeapFree(hHeap, 0, pHwnd);
735  return FALSE;
736  }
737 
738  /* call the user's callback function until we're done or
739  they tell us to quit */
740  for ( i = 0; i < dwCount; i++ )
741  {
742  /* FIXME I'm only getting NULLs from Thread Enumeration, and it's
743  * probably because I'm not doing it right in NtUserBuildHwndList.
744  * Once that's fixed, we shouldn't have to check for a NULL HWND
745  * here
746  * This is now fixed in revision 50205. (jt)
747  */
748  if (!pHwnd[i]) /* don't enumerate a NULL HWND */
749  continue;
750  if (!(*lpfn)(pHwnd[i], lParam))
751  {
752  HeapFree ( hHeap, 0, pHwnd );
753  return FALSE;
754  }
755  }
756  if (pHwnd)
757  HeapFree(hHeap, 0, pHwnd);
758  return TRUE;
759 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
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
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NTSTATUS APIENTRY NtUserBuildHwndList(HDESK hDesktop, HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, ULONG lParam, HWND *pWnd, ULONG *pBufSize)
Definition: window.c:1338
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
DWORD dwThreadId
Definition: fdebug.c:31
Status
Definition: gdiplustypes.h:24
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:402

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

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )