#include <win32k.h>
-#define NDEBUG
-#include <debug.h>
+DBG_DEFAULT_CHANNEL(UserWnd);
#define POINT_IN_RECT(p, r) (((r.bottom >= p.y) && (r.top <= p.y))&&((r.left <= p.x )&&( r.right >= p.x )))
-/* PRIVATE FUNCTIONS **********************************************************/
-
-/*
- * InitWindowImpl
- *
- * Initialize windowing implementation.
- */
-
-INIT_FUNCTION
-NTSTATUS
-NTAPI
-InitWindowImpl(VOID)
-{
- return STATUS_SUCCESS;
-}
-
-/*
- * CleanupWindowImpl
- *
- * Cleanup windowing implementation.
- */
-
-NTSTATUS FASTCALL
-CleanupWindowImpl(VOID)
-{
- return STATUS_SUCCESS;
-}
-
/* HELPER FUNCTIONS ***********************************************************/
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam)
List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
if(!List)
{
- DPRINT1("Failed to allocate memory for children array\n");
+ ERR("Failed to allocate memory for children array\n");
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
}
}
else
{
- DPRINT("destroyed itself while in WM_DESTROY!\n");
+ TRACE("destroyed itself while in WM_DESTROY!\n");
}
#endif
}
if(Window->state2 & WNDS2_INDESTROY)
{
- DPRINT("Tried to call IntDestroyWindow() twice\n");
+ TRACE("Tried to call IntDestroyWindow() twice\n");
return 0;
}
Window->state2 |= WNDS2_INDESTROY;
Current = WThread->WindowListHead.Flink;
Wnd = CONTAINING_RECORD(Current, WND, ThreadListEntry);
- DPRINT("thread cleanup: while destroy wnds, wnd=0x%x\n",Wnd);
+ TRACE("thread cleanup: while destroy wnds, wnd=0x%x\n",Wnd);
/* window removes itself from the list */
UserRefObjectCo(Wnd, &Ref);//faxme: temp hack??
if (!co_UserDestroyWindow(Wnd))
{
- DPRINT1("Unable to destroy window 0x%x at thread cleanup... This is _VERY_ bad!\n", Wnd);
+ ERR("Unable to destroy window 0x%x at thread cleanup... This is _VERY_ bad!\n", Wnd);
}
UserDerefObjectCo(Wnd);//faxme: temp hack??
}
return(FALSE);
}
-BOOL FASTCALL
-IntIsWindowVisible(PWND BaseWindow)
-{
- PWND Window;
-
- Window = BaseWindow;
- while(Window)
- {
- if(!(Window->style & WS_CHILD))
- {
- break;
- }
- if(!(Window->style & WS_VISIBLE))
- {
- return FALSE;
- }
-
- Window = Window->spwndParent;
- }
-
- if(Window && Window->style & WS_VISIBLE)
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-
/*
link the window into siblings list
children and parent are kept in place.
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Thread Id is not valid!\n");
+ ERR("Thread Id is not valid!\n");
return ERROR_INVALID_PARAMETER;
}
if (!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread))
{
ObDereferenceObject(Thread);
- DPRINT1("Thread is not initialized!\n");
+ ERR("Thread is not initialized!\n");
return ERROR_INVALID_PARAMETER;
}
_SEH2_END
if (!NT_SUCCESS(Status))
{
- DPRINT1("Failure to build window list!\n");
+ ERR("Failure to build window list!\n");
SetLastNtError(Status);
break;
}
*/
else if (IS_DEFAULT(Cs->cy))
{
- DPRINT("Strange use of CW_USEDEFAULT in nHeight\n");
+ TRACE("Strange use of CW_USEDEFAULT in nHeight\n");
Cs->cy = (pMonitor->rcWork.bottom - pMonitor->rcWork.top) * 3 / 4;
}
}
goto AllocError;
}
- DPRINT("Created object with handle %X\n", hWnd);
+ TRACE("Created object with handle %X\n", hWnd);
if (NULL == pti->rpdesk->DesktopWindow)
{ /*HACK! Helper for win32csr/desktopbg.c */
if (!CallProc)
{
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
- DPRINT1("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %x\n",hWnd);
+ ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %x\n",hWnd);
}
else
{
return pWnd;
AllocError:
- DPRINT1("IntCreateWindow Allocation Error.\n");
+ ERR("IntCreateWindow Allocation Error.\n");
if(pWnd)
UserDereferenceObject(pWnd);
pti = GetW32ThreadInfo();
if (pti == NULL || pti->rpdesk == NULL)
{
- DPRINT1("Thread is not attached to a desktop! Cannot create window!\n");
+ ERR("Thread is not attached to a desktop! Cannot create window!\n");
return NULL; //There is nothing to cleanup
}
WinSta = pti->rpdesk->rpwinstaParent;
Class = IntGetAndReferenceClass(ClassName, Cs->hInstance);
if(!Class)
{
- DPRINT1("Failed to find class %wZ\n", ClassName);
+ ERR("Failed to find class %wZ\n", ClassName);
goto cleanup;
}
}
else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
{
- DPRINT1("Cannot create a child window without a parrent!\n");
+ ERR("Cannot create a child window without a parrent!\n");
EngSetLastError(ERROR_TLW_WITH_WSCHILD);
goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
OwnerWindow);
if(!Window)
{
- DPRINT1("IntCreateWindow failed!\n");
+ ERR("IntCreateWindow failed!\n");
goto cleanup;
}
pCbtCreate = ExAllocatePoolWithTag(NonPagedPool, sizeof(CBT_CREATEWNDW), TAG_HOOK);
if (!pCsw || !pCbtCreate)
{
- DPRINT1("UserHeapAlloc() failed!\n");
+ ERR("UserHeapAlloc() failed!\n");
goto cleanup;
}
pszClass = UserHeapAlloc(AnsiString.MaximumLength);
if (!pszClass)
{
- DPRINT1("UserHeapAlloc() failed!\n");
+ ERR("UserHeapAlloc() failed!\n");
goto cleanup;
}
RtlZeroMemory(pszClass, AnsiString.MaximumLength);
pszClass = UserHeapAlloc(UnicodeString.MaximumLength);
if (!pszClass)
{
- DPRINT1("UserHeapAlloc() failed!\n");
+ ERR("UserHeapAlloc() failed!\n");
goto cleanup;
}
RtlZeroMemory(pszClass, UnicodeString.MaximumLength);
pszName = UserHeapAlloc(AnsiString.MaximumLength);
if (!pszName)
{
- DPRINT1("UserHeapAlloc() failed!\n");
+ ERR("UserHeapAlloc() failed!\n");
goto cleanup;
}
RtlZeroMemory(pszName, AnsiString.MaximumLength);
pszName = UserHeapAlloc(UnicodeString.MaximumLength);
if (!pszName)
{
- DPRINT1("UserHeapAlloc() failed!\n");
+ ERR("UserHeapAlloc() failed!\n");
goto cleanup;
}
RtlZeroMemory(pszName, UnicodeString.MaximumLength);
Result = co_HOOK_CallHooks(WH_CBT, HCBT_CREATEWND, (WPARAM) hWnd, (LPARAM) pCbtCreate);
if (Result != 0)
{
- DPRINT1("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
+ ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
goto cleanup;
}
// Write back changes.
Result = co_IntSendMessage(UserHMGetHandle(Window), WM_NCCREATE, 0, (LPARAM) Cs);
if (!Result)
{
- DPRINT1("co_UserCreateWindowEx(): NCCREATE message failed\n");
+ ERR("co_UserCreateWindowEx(): NCCREATE message failed\n");
goto cleanup;
}
Result = co_IntSendMessage(UserHMGetHandle(Window), WM_CREATE, 0, (LPARAM) Cs);
if (Result == (LRESULT)-1)
{
- DPRINT1("co_UserCreateWindowEx(): WM_CREATE message failed\n");
+ ERR("co_UserCreateWindowEx(): WM_CREATE message failed\n");
goto cleanup;
}
}
}
- DPRINT("co_UserCreateWindowEx(): Created window %X\n", hWnd);
+ TRACE("co_UserCreateWindowEx(): Created window %X\n", hWnd);
ret = Window;
cleanup:
if (!ret)
{
- DPRINT("co_UserCreateWindowEx(): Error Created window!\n");
+ TRACE("co_UserCreateWindowEx(): Error Created window!\n");
/* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
if (Window)
co_UserDestroyWindow(Window);
Status = ProbeAndCaptureLargeString(&lstrWindowName, plstrWindowName);
if (!NT_SUCCESS(Status))
{
- DPRINT1("NtUserCreateWindowEx: failed to capture plstrWindowName\n");
+ ERR("NtUserCreateWindowEx: failed to capture plstrWindowName\n");
SetLastNtError(Status);
return NULL;
}
Status = ProbeAndCaptureLargeString(&lstrClassName, plstrClassName);
if (!NT_SUCCESS(Status))
{
- DPRINT1("NtUserCreateWindowEx: failed to capture plstrClassName\n");
+ ERR("NtUserCreateWindowEx: failed to capture plstrClassName\n");
/* Set last error, cleanup and return */
SetLastNtError(Status);
goto cleanup;
if(!pwnd)
{
- DPRINT1("co_UserCreateWindowEx failed!\n");
+ ERR("co_UserCreateWindowEx failed!\n");
}
hwnd = pwnd ? UserHMGetHandle(pwnd) : NULL;
hWnd = Window->head.h;
- DPRINT("co_UserDestroyWindow \n");
+ TRACE("co_UserDestroyWindow \n");
/* Check for owner thread */
if ( (Window->head.pti->pEThread != PsGetCurrentThread()) ||
{
if (co_HOOK_CallHooks(WH_CBT, HCBT_DESTROYWND, (WPARAM) hWnd, 0))
{
- DPRINT1("Destroy Window WH_CBT Call Hook return!\n");
+ ERR("Destroy Window WH_CBT Call Hook return!\n");
return FALSE;
}
}
{
if (ti->pDeskInfo->hShellWindow == hWnd)
{
- DPRINT1("Destroying the ShellWindow!\n");
+ ERR("Destroying the ShellWindow!\n");
ti->pDeskInfo->hShellWindow = NULL;
}
}
BOOLEAN ret;
USER_REFERENCE_ENTRY Ref;
- DPRINT("Enter NtUserDestroyWindow\n");
+ TRACE("Enter NtUserDestroyWindow\n");
UserEnterExclusive();
if (!(Window = UserGetWindowObject(Wnd)))
RETURN(ret);
CLEANUP:
- DPRINT("Leave NtUserDestroyWindow, ret=%i\n",_ret_);
+ TRACE("Leave NtUserDestroyWindow, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
RTL_ATOM ClassAtom = (RTL_ATOM)0;
DECLARE_RETURN(HWND);
- DPRINT("Enter NtUserFindWindowEx\n");
+ TRACE("Enter NtUserFindWindowEx\n");
UserEnterShared();
if (ucClassName != NULL || ucWindowName != NULL)
RETURN( Ret);
CLEANUP:
- DPRINT("Leave NtUserFindWindowEx, ret %i\n",_ret_);
+ TRACE("Leave NtUserFindWindowEx, ret %i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PWND Window, Ancestor;
DECLARE_RETURN(HWND);
- DPRINT("Enter NtUserGetAncestor\n");
+ TRACE("Enter NtUserGetAncestor\n");
UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd)))
RETURN(Ancestor ? Ancestor->head.h : NULL);
CLEANUP:
- DPRINT("Leave NtUserGetAncestor, ret=%i\n",_ret_);
+ TRACE("Leave NtUserGetAncestor, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PWND Wnd;
DECLARE_RETURN(BOOL);
- DPRINT("Enter NtUserGetComboBoxInfo\n");
+ TRACE("Enter NtUserGetComboBoxInfo\n");
UserEnterShared();
if (!(Wnd = UserGetWindowObject(hWnd)))
RETURN( (BOOL) co_IntSendMessage( Wnd->head.h, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi));
CLEANUP:
- DPRINT("Leave NtUserGetComboBoxInfo, ret=%i\n",_ret_);
+ TRACE("Leave NtUserGetComboBoxInfo, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PWND Wnd;
DECLARE_RETURN(DWORD);
- DPRINT("Enter NtUserGetListBoxInfo\n");
+ TRACE("Enter NtUserGetListBoxInfo\n");
UserEnterShared();
if (!(Wnd = UserGetWindowObject(hWnd)))
RETURN( (DWORD) co_IntSendMessage( Wnd->head.h, LB_GETLISTBOXINFO, 0, 0 ));
CLEANUP:
- DPRINT("Leave NtUserGetListBoxInfo, ret=%i\n",_ret_);
+ TRACE("Leave NtUserGetListBoxInfo, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
{
DECLARE_RETURN(HWND);
- DPRINT("Enter NtUserSetParent\n");
+ TRACE("Enter NtUserSetParent\n");
UserEnterExclusive();
/*
RETURN( co_UserSetParent(hWndChild, hWndNewParent));
CLEANUP:
- DPRINT("Leave NtUserSetParent, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetParent, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
NTSTATUS Status;
PTHREADINFO ti;
- DPRINT("Enter NtUserSetShellWindowEx\n");
+ TRACE("Enter NtUserSetShellWindowEx\n");
UserEnterExclusive();
if (!(WndShell = UserGetWindowObject(hwndShell)))
RETURN( TRUE);
CLEANUP:
- DPRINT("Leave NtUserSetShellWindowEx, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetShellWindowEx, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PMENU_OBJECT Menu;
DECLARE_RETURN(HMENU);
- DPRINT("Enter NtUserGetSystemMenu\n");
+ TRACE("Enter NtUserGetSystemMenu\n");
UserEnterShared();
if (!(Window = UserGetWindowObject(hWnd)))
RETURN(Menu->MenuInfo.Self);
CLEANUP:
- DPRINT("Leave NtUserGetSystemMenu, ret=%i\n",_ret_);
+ TRACE("Leave NtUserGetSystemMenu, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PMENU_OBJECT Menu;
DECLARE_RETURN(BOOL);
- DPRINT("Enter NtUserSetSystemMenu\n");
+ TRACE("Enter NtUserSetSystemMenu\n");
UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd)))
RETURN( Result);
CLEANUP:
- DPRINT("Leave NtUserSetSystemMenu, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetSystemMenu, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
break;
default:
- DPRINT1("NtUserSetWindowLong(): Unsupported index %d\n", Index);
+ ERR("NtUserSetWindowLong(): Unsupported index %d\n", Index);
EngSetLastError(ERROR_INVALID_INDEX);
OldValue = 0;
break;
{
DECLARE_RETURN(LONG);
- DPRINT("Enter NtUserSetWindowLong\n");
+ TRACE("Enter NtUserSetWindowLong\n");
UserEnterExclusive();
RETURN( co_UserSetWindowLong(hWnd, Index, NewValue, Ansi));
CLEANUP:
- DPRINT("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
WORD OldValue;
DECLARE_RETURN(WORD);
- DPRINT("Enter NtUserSetWindowWord\n");
+ TRACE("Enter NtUserSetWindowWord\n");
UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd)))
RETURN( OldValue);
CLEANUP:
- DPRINT("Leave NtUserSetWindowWord, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetWindowWord, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
NTSTATUS Status;
DECLARE_RETURN(BOOL);
- DPRINT("Enter NtUserGetWindowPlacement\n");
+ TRACE("Enter NtUserGetWindowPlacement\n");
UserEnterShared();
if (!(Wnd = UserGetWindowObject(hWnd)))
RETURN( TRUE);
CLEANUP:
- DPRINT("Leave NtUserGetWindowPlacement, ret=%i\n",_ret_);
+ TRACE("Leave NtUserGetWindowPlacement, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
DWORD Result;
DECLARE_RETURN(UINT);
- DPRINT("Enter NtUserQueryWindow\n");
+ TRACE("Enter NtUserQueryWindow\n");
UserEnterShared();
if (!(pWnd = UserGetWindowObject(hWnd)))
RETURN( Result);
CLEANUP:
- DPRINT("Leave NtUserQueryWindow, ret=%i\n",_ret_);
+ TRACE("Leave NtUserQueryWindow, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
UINT Ret;
DECLARE_RETURN(UINT);
- DPRINT("Enter NtUserRegisterWindowMessage\n");
+ TRACE("Enter NtUserRegisterWindowMessage\n");
UserEnterExclusive();
if(MessageNameUnsafe == NULL)
RETURN( Ret);
CLEANUP:
- DPRINT("Leave NtUserRegisterWindowMessage, ret=%i\n",_ret_);
+ TRACE("Leave NtUserRegisterWindowMessage, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
BOOL Changed;
DECLARE_RETURN(BOOL);
- DPRINT("Enter NtUserSetMenu\n");
+ TRACE("Enter NtUserSetMenu\n");
UserEnterExclusive();
if (!(Window = UserGetWindowObject(hWnd)))
RETURN( TRUE);
CLEANUP:
- DPRINT("Leave NtUserSetMenu, ret=%i\n",_ret_);
+ TRACE("Leave NtUserSetMenu, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
PWND Wnd;
DECLARE_RETURN(BOOL);
- DPRINT("Enter NtUserSetWindowFNID\n");
+ TRACE("Enter NtUserSetWindowFNID\n");
UserEnterExclusive();
if (!(Wnd = UserGetWindowObject(hWnd)))
RETURN( TRUE);
CLEANUP:
- DPRINT("Leave NtUserSetWindowFNID\n");
+ TRACE("Leave NtUserSetWindowFNID\n");
UserLeave();
END_CLEANUP;
}
DECLARE_RETURN(HWND);
USER_REFERENCE_ENTRY Ref;
- DPRINT("Enter NtUserWindowFromPoint\n");
+ TRACE("Enter NtUserWindowFromPoint\n");
UserEnterExclusive();
if ((DesktopWindow = UserGetWindowObject(IntGetDesktopWindow())))
if (Window) UserDereferenceObject(Window);
if (DesktopWindow) UserDerefObjectCo(DesktopWindow);
- DPRINT("Leave NtUserWindowFromPoint, ret=%i\n",_ret_);
+ TRACE("Leave NtUserWindowFromPoint, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
UNICODE_STRING UnicodeString;
BOOL Ret = TRUE;
- DPRINT("Enter NtUserDefSetText\n");
+ TRACE("Enter NtUserDefSetText\n");
if (WindowText != NULL)
{
Ret = TRUE;
Exit:
if (UnicodeString.Buffer) RtlFreeUnicodeString(&UnicodeString);
- DPRINT("Leave NtUserDefSetText, ret=%i\n", Ret);
+ TRACE("Leave NtUserDefSetText, ret=%i\n", Ret);
UserLeave();
return Ret;
}
INT Result;
DECLARE_RETURN(INT);
- DPRINT("Enter NtUserInternalGetWindowText\n");
+ TRACE("Enter NtUserInternalGetWindowText\n");
UserEnterShared();
if(lpString && (nMaxCount <= 1))
RETURN( Result);
CLEANUP:
- DPRINT("Leave NtUserInternalGetWindowText, ret=%i\n",_ret_);
+ TRACE("Leave NtUserInternalGetWindowText, ret=%i\n",_ret_);
UserLeave();
END_CLEANUP;
}
return TRUE;
}
-/*
- * NtUserValidateHandleSecure
- *
- * Status
- * @implemented
- */
-
-BOOL
-APIENTRY
-NtUserValidateHandleSecure(
- HANDLE handle,
- BOOL Restricted)
-{
- if(!Restricted)
- {
- UINT uType;
- {
- PUSER_HANDLE_ENTRY entry;
- if (!(entry = handle_to_entry(gHandleTable, handle )))
- {
- EngSetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
- }
- uType = entry->type;
- }
- switch (uType)
- {
- case otWindow:
- {
- PWND Window;
- if ((Window = UserGetWindowObject((HWND) handle))) return TRUE;
- return FALSE;
- }
- case otMenu:
- {
- PMENU_OBJECT Menu;
- if ((Menu = UserGetMenuObject((HMENU) handle))) return TRUE;
- return FALSE;
- }
- case otAccel:
- {
- PACCELERATOR_TABLE Accel;
- if ((Accel = UserGetAccelObject((HACCEL) handle))) return TRUE;
- return FALSE;
- }
- case otCursorIcon:
- {
- PCURICON_OBJECT Cursor;
- if ((Cursor = UserGetCurIconObject((HCURSOR) handle))) return TRUE;
- return FALSE;
- }
- case otHook:
- {
- PHOOK Hook;
- if ((Hook = IntGetHookObject((HHOOK) handle))) return TRUE;
- return FALSE;
- }
- case otMonitor:
- {
- PMONITOR Monitor;
- if ((Monitor = UserGetMonitorObject((HMONITOR) handle))) return TRUE;
- return FALSE;
- }
- case otCallProc:
- {
- WNDPROC_INFO Proc;
- return UserGetCallProcInfo( handle, &Proc );
- }
- default:
- EngSetLastError(ERROR_INVALID_HANDLE);
- }
- }
- else
- { /* Is handle entry restricted? */
- UNIMPLEMENTED
- }
- return FALSE;
-}
-
-
/* EOF */