Author: jimtabor Date: Fri Sep 11 02:34:11 2015 New Revision: 69179
URL: http://svn.reactos.org/svn/reactos?rev=69179&view=rev Log: [Win32SS] - Hackplement Layered Window Support from wine. - See CORE-1576 for more information. Three days work, ReactOS needs more support for playing with GDI bits.
Added: trunk/reactos/win32ss/user/ntuser/layered.c - copied, changed from r69117, trunk/reactos/win32ss/user/ntuser/ntstubs.c Modified: trunk/reactos/win32ss/CMakeLists.txt trunk/reactos/win32ss/user/ntuser/msgqueue.c trunk/reactos/win32ss/user/ntuser/ntstubs.c trunk/reactos/win32ss/user/ntuser/userfuncs.h trunk/reactos/win32ss/user/ntuser/window.c trunk/reactos/win32ss/user/user32/windows/window.c
Modified: trunk/reactos/win32ss/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/CMakeLists.txt?rev=... ============================================================================== --- trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -122,6 +122,7 @@ user/ntuser/ime.c user/ntuser/keyboard.c user/ntuser/kbdlayout.c + user/ntuser/layered.c user/ntuser/menu.c user/ntuser/message.c user/ntuser/metric.c
Copied: trunk/reactos/win32ss/user/ntuser/layered.c (from r69117, trunk/reactos/win32ss/user/ntuser/ntstubs.c) URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/layered... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/layered.c [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -1,954 +1,216 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Win32k subsystem - * PURPOSE: Native User stubs - * FILE: win32ss/user/ntuser/ntstubs.c - * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net) + * PURPOSE: Layered window support + * FILE: win32ss/user/ntuser/layered.c + * PROGRAMER: */
#include <win32k.h> DBG_DEFAULT_CHANNEL(UserMisc);
-DWORD -APIENTRY -NtUserAssociateInputContext( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) -{ - STUB - return 0; -} - -// -// Works like BitBlt, http://msdn.microsoft.com/en-us/library/ms532278(VS.85).aspx -// -BOOL -APIENTRY -NtUserBitBltSysBmp( - HDC hdc, - INT nXDest, - INT nYDest, - INT nWidth, - INT nHeight, - INT nXSrc, - INT nYSrc, - DWORD dwRop ) -{ - BOOL Ret = FALSE; - UserEnterExclusive(); - - Ret = NtGdiBitBlt( hdc, - nXDest, - nYDest, - nWidth, - nHeight, - hSystemBM, - nXSrc, - nYSrc, - dwRop, - 0, - 0); - - UserLeave(); - return Ret; -} - -DWORD -APIENTRY -NtUserBuildHimcList( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3, - DWORD dwUnknown4) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserDragObject( - HWND hwnd1, - HWND hwnd2, - UINT u1, - DWORD dw1, - HCURSOR hc1 -) -{ - STUB - - return 0; -} - -BOOL -APIENTRY -NtUserDrawAnimatedRects( - HWND hwnd, - INT idAni, - RECT *lprcFrom, - RECT *lprcTo) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserEvent( - DWORD Unknown0) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserExcludeUpdateRgn( - HDC hDC, - HWND hWnd) -{ - STUB - - return 0; -} - -BOOL -APIENTRY -NtUserGetAltTabInfo( - HWND hwnd, - INT iItem, - PALTTABINFO pati, - LPWSTR pszItemText, - UINT cchItemText, - BOOL Ansi) -{ - STUB - - return 0; -} - -NTSTATUS -APIENTRY -NtUserInitializeClientPfnArrays( - PPFNCLIENT pfnClientA, - PPFNCLIENT pfnClientW, - PPFNCLIENTWORKER pfnClientWorker, - HINSTANCE hmodUser) -{ - NTSTATUS Status = STATUS_SUCCESS; - TRACE("Enter NtUserInitializeClientPfnArrays User32 0x%p\n", hmodUser); - - if (ClientPfnInit) return Status; - - UserEnterExclusive(); - - _SEH2_TRY - { - ProbeForRead( pfnClientA, sizeof(PFNCLIENT), 1); - ProbeForRead( pfnClientW, sizeof(PFNCLIENT), 1); - ProbeForRead( pfnClientWorker, sizeof(PFNCLIENTWORKER), 1); - RtlCopyMemory(&gpsi->apfnClientA, pfnClientA, sizeof(PFNCLIENT)); - RtlCopyMemory(&gpsi->apfnClientW, pfnClientW, sizeof(PFNCLIENT)); - RtlCopyMemory(&gpsi->apfnClientWorker, pfnClientWorker, sizeof(PFNCLIENTWORKER)); - - //// FIXME: HAX! Temporary until server side is finished. - //// Copy the client side procs for now. - RtlCopyMemory(&gpsi->aStoCidPfn, pfnClientW, sizeof(gpsi->aStoCidPfn)); - - hModClient = hmodUser; - ClientPfnInit = TRUE; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status =_SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - ERR("Failed reading Client Pfns from user space.\n"); - SetLastNtError(Status); - } - - UserLeave(); - return Status; -} - -DWORD -APIENTRY -NtUserInitTask( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5, - DWORD Unknown6, - DWORD Unknown7, - DWORD Unknown8, - DWORD Unknown9, - DWORD Unknown10, - DWORD Unknown11) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserMNDragLeave(VOID) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserMNDragOver( - DWORD Unknown0, - DWORD Unknown1) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserModifyUserStartupInfoFlags( - DWORD Unknown0, - DWORD Unknown1) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserQueryUserCounters( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserRegisterTasklist( - DWORD Unknown0) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserSetConsoleReserveKeys( - DWORD Unknown0, - DWORD Unknown1) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserSetDbgTag( - DWORD Unknown0, - DWORD Unknown1) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserSetRipFlags( - DWORD Unknown0, - DWORD Unknown1) -{ - STUB - - return 0; -} - -BOOL -APIENTRY -NtUserSetSysColors( - int cElements, - IN CONST INT *lpaElements, - IN CONST COLORREF *lpaRgbValues, - FLONG Flags) -{ - DWORD Ret = TRUE; - - if (cElements == 0) + +typedef struct _LRD_PROP +{ + COLORREF Key; + BYTE Alpha; + BYTE is_Layered; + BYTE NoUsed[2]; + DWORD Flags; +} LRD_PROP, *PLRD_PROP; + +BOOL FASTCALL +GetLayeredStatus(PWND pWnd) +{ + PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer); + if (pLrdProp) + { + return pLrdProp->is_Layered; + } + return FALSE; +} + +BOOL FASTCALL +SetLayeredStatus(PWND pWnd, BYTE set) +{ + PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer); + if (pLrdProp) + { + pLrdProp->is_Layered = set; return TRUE; - - /* We need this check to prevent overflow later */ - if ((ULONG)cElements >= 0x40000000) - { - EngSetLastError(ERROR_NOACCESS); + } + return FALSE; +} + +BOOL FASTCALL +IntSetLayeredWindowAttributes(PWND pWnd, + COLORREF crKey, + BYTE bAlpha, + DWORD dwFlags) +{ + PLRD_PROP pLrdProp; + INT was_Layered; + + if (!(pWnd->ExStyle & WS_EX_LAYERED) ) + { + ERR("Not a Layered Window!\n"); return FALSE; }
- UserEnterExclusive(); - - _SEH2_TRY - { - ProbeForRead(lpaElements, cElements * sizeof(INT), 1); - ProbeForRead(lpaRgbValues, cElements * sizeof(COLORREF), 1); - - IntSetSysColors(cElements, lpaElements, lpaRgbValues); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastNtError(_SEH2_GetExceptionCode()); - Ret = FALSE; - } - _SEH2_END; - - if (Ret) - { - UserSendNotifyMessage(HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0); - - UserRedrawDesktop(); - } - - UserLeave(); - return Ret; -} - -DWORD -APIENTRY -NtUserUpdateInputContext( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserUpdateInstance( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) -{ - STUB - - return 0; -} - -BOOL -APIENTRY -NtUserUserHandleGrantAccess( - IN HANDLE hUserHandle, - IN HANDLE hJob, - IN BOOL bGrant) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserWaitForMsgAndEvent( - DWORD Unknown0) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserWin32PoolAllocationStats( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserYieldTask(VOID) -{ - STUB - - return 0; -} - -DWORD -APIENTRY -NtUserCreateInputContext( - DWORD dwUnknown1) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserDestroyInputContext( - DWORD dwUnknown1) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserGetRawInputBuffer( - PRAWINPUT pData, - PUINT pcbSize, - UINT cbSizeHeader) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserGetRawInputData( - HRAWINPUT hRawInput, - UINT uiCommand, - LPVOID pData, - PUINT pcbSize, - UINT cbSizeHeader) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserGetRawInputDeviceInfo( - HANDLE hDevice, - UINT uiCommand, - LPVOID pData, - PUINT pcbSize -) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserGetRawInputDeviceList( - PRAWINPUTDEVICELIST pRawInputDeviceList, - PUINT puiNumDevices, - UINT cbSize) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserGetRegisteredRawInputDevices( - PRAWINPUTDEVICE pRawInputDevices, - PUINT puiNumDevices, - UINT cbSize) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserHardErrorControl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) -{ - STUB; - return 0; -} - -BOOL -NTAPI -NtUserNotifyProcessCreate( - HANDLE NewProcessId, - HANDLE ParentThreadId, - ULONG dwUnknown, - ULONG CreateFlags) -{ - // STUB; - TRACE("NtUserNotifyProcessCreate is UNIMPLEMENTED\n"); - return FALSE; -} - -NTSTATUS -APIENTRY -NtUserProcessConnect( - IN HANDLE ProcessHandle, - OUT PUSERCONNECT pUserConnect, - IN ULONG Size) -{ - NTSTATUS Status; - PEPROCESS Process = NULL; - PPROCESSINFO W32Process; - - TRACE("NtUserProcessConnect\n"); - - if ( pUserConnect == NULL || - Size != sizeof(*pUserConnect) ) - { - return STATUS_UNSUCCESSFUL; - } - - /* Get the process object the user handle was referencing */ - Status = ObReferenceObjectByHandle(ProcessHandle, - PROCESS_VM_OPERATION, - *PsProcessType, - UserMode, - (PVOID*)&Process, - NULL); - if (!NT_SUCCESS(Status)) return Status; - - UserEnterShared(); - - /* Get Win32 process information */ - W32Process = PsGetProcessWin32Process(Process); - - _SEH2_TRY - { - // FIXME: Check that pUserConnect->ulVersion == USER_VERSION; - - ProbeForWrite(pUserConnect, sizeof(*pUserConnect), sizeof(PVOID)); - pUserConnect->siClient.psi = gpsi; - pUserConnect->siClient.aheList = gHandleTable; - pUserConnect->siClient.ulSharedDelta = - (ULONG_PTR)W32Process->HeapMappings.KernelMapping - - (ULONG_PTR)W32Process->HeapMappings.UserMapping; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - SetLastNtError(Status); - - UserLeave(); - - /* Dereference the process object */ - ObDereferenceObject(Process); - - return Status; -} - -NTSTATUS -APIENTRY -NtUserQueryInformationThread(IN HANDLE ThreadHandle, - IN USERTHREADINFOCLASS ThreadInformationClass, - OUT PVOID ThreadInformation, - IN ULONG ThreadInformationLength) -{ - NTSTATUS Status = STATUS_SUCCESS; - PETHREAD Thread; - - /* Allow only CSRSS to perform this operation */ - if (PsGetCurrentProcess() != gpepCSRSS) - return STATUS_ACCESS_DENIED; - - UserEnterExclusive(); - - /* Get the Thread */ - Status = ObReferenceObjectByHandle(ThreadHandle, - THREAD_QUERY_INFORMATION, - *PsThreadType, - UserMode, - (PVOID)&Thread, - NULL); - if (!NT_SUCCESS(Status)) goto Quit; - - switch (ThreadInformationClass) - { - default: - { - STUB; - Status = STATUS_NOT_IMPLEMENTED; - break; - } - } - - ObDereferenceObject(Thread); - -Quit: - UserLeave(); - return Status; -} - -DWORD -APIENTRY -NtUserQueryInputContext( - DWORD dwUnknown1, - DWORD dwUnknown2) -{ - STUB; - return 0; -} - -BOOL -APIENTRY -NtUserRealInternalGetMessage( - LPMSG lpMsg, - HWND hWnd, - UINT wMsgFilterMin, - UINT wMsgFilterMax, - UINT wRemoveMsg, - BOOL bGMSG) -{ - STUB; - return 0; -} - -BOOL -APIENTRY -NtUserRealWaitMessageEx( - DWORD dwWakeMask, - UINT uTimeout) -{ - STUB; - return 0; -} - -BOOL -APIENTRY -NtUserRegisterRawInputDevices( - IN PCRAWINPUTDEVICE pRawInputDevices, - IN UINT uiNumDevices, - IN UINT cbSize) -{ - STUB; - return 0; -} - -DWORD APIENTRY -NtUserResolveDesktopForWOW(DWORD Unknown0) -{ - STUB - return 0; -} - -DWORD -APIENTRY -NtUserSetInformationProcess( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3, - DWORD dwUnknown4) -{ - STUB; - return 0; -} - -NTSTATUS -APIENTRY -NtUserSetInformationThread(IN HANDLE ThreadHandle, - IN USERTHREADINFOCLASS ThreadInformationClass, - IN PVOID ThreadInformation, - IN ULONG ThreadInformationLength) -{ - NTSTATUS Status = STATUS_SUCCESS; - PETHREAD Thread; - - /* Allow only CSRSS to perform this operation */ - if (PsGetCurrentProcess() != gpepCSRSS) - return STATUS_ACCESS_DENIED; - - UserEnterExclusive(); - - /* Get the Thread */ - Status = ObReferenceObjectByHandle(ThreadHandle, - THREAD_SET_INFORMATION, - *PsThreadType, - UserMode, - (PVOID)&Thread, - NULL); - if (!NT_SUCCESS(Status)) goto Quit; - - switch (ThreadInformationClass) - { - case UserThreadInitiateShutdown: - { - ULONG CapturedFlags = 0; - - ERR("Shutdown initiated\n"); - - if (ThreadInformationLength != sizeof(ULONG)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - break; - } - - /* Capture the caller value */ - Status = STATUS_SUCCESS; - _SEH2_TRY - { - ProbeForWrite(ThreadInformation, sizeof(CapturedFlags), sizeof(PVOID)); - CapturedFlags = *(PULONG)ThreadInformation; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - _SEH2_YIELD(break); - } - _SEH2_END; - - Status = UserInitiateShutdown(Thread, &CapturedFlags); - - /* Return the modified value to the caller */ - _SEH2_TRY - { - *(PULONG)ThreadInformation = CapturedFlags; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - break; - } - - case UserThreadEndShutdown: - { - NTSTATUS ShutdownStatus; - - ERR("Shutdown ended\n"); - - if (ThreadInformationLength != sizeof(ShutdownStatus)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - break; - } - - /* Capture the caller value */ - Status = STATUS_SUCCESS; - _SEH2_TRY - { - ProbeForRead(ThreadInformation, sizeof(ShutdownStatus), sizeof(PVOID)); - ShutdownStatus = *(NTSTATUS*)ThreadInformation; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - _SEH2_YIELD(break); - } - _SEH2_END; - - Status = UserEndShutdown(Thread, ShutdownStatus); - break; - } - - case UserThreadCsrApiPort: - { - HANDLE CsrPortHandle; - - ERR("Set CSR API Port for Win32k\n"); - - if (ThreadInformationLength != sizeof(CsrPortHandle)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - break; - } - - /* Capture the caller value */ - Status = STATUS_SUCCESS; - _SEH2_TRY - { - ProbeForRead(ThreadInformation, sizeof(CsrPortHandle), sizeof(PVOID)); - CsrPortHandle = *(PHANDLE)ThreadInformation; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - _SEH2_YIELD(break); - } - _SEH2_END; - - Status = InitCsrApiPort(CsrPortHandle); - break; - } - - default: - { - STUB; - Status = STATUS_NOT_IMPLEMENTED; - break; - } - } - - ObDereferenceObject(Thread); - -Quit: - UserLeave(); - return Status; -} - -DWORD -APIENTRY -NtUserSetThreadLayoutHandles( - DWORD dwUnknown1, - DWORD dwUnknown2) -{ - STUB; - return 0; -} - -BOOL -APIENTRY -NtUserSoundSentry(VOID) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserTestForInteractiveUser( - DWORD dwUnknown1) -{ - STUB; - return 0; -} - -/* http://www.cyber-ta.org/releases/malware-analysis/public/SOURCES/b47155634cc... */ -DWORD -APIENTRY -NtUserCalcMenuBar( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3, - DWORD dwUnknown4, - DWORD dwUnknown5) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserPaintMenuBar( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3, - DWORD dwUnknown4, - DWORD dwUnknown5, - DWORD dwUnknown6) -{ - STUB; - return 0; -} - - -DWORD -APIENTRY -NtUserRemoteConnect( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserRemoteRedrawRectangle( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3, - DWORD dwUnknown4) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserRemoteRedrawScreen(VOID) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserRemoteStopScreenUpdates(VOID) -{ - STUB; - return 0; -} - -DWORD -APIENTRY -NtUserCtxDisplayIOCtl( - DWORD dwUnknown1, - DWORD dwUnknown2, - DWORD dwUnknown3) -{ - STUB; - return 0; -} + pLrdProp = UserGetProp(pWnd, AtomLayer); + + if (!pLrdProp) + { + pLrdProp = ExAllocatePoolWithTag(PagedPool, sizeof(LRD_PROP), USERTAG_REDIRECT); + if (pLrdProp == NULL) + { + ERR("failed to allocate LRD_PROP\n"); + return FALSE; + } + RtlZeroMemory(pLrdProp, sizeof(LRD_PROP)); + IntSetProp(pWnd, AtomLayer, (HANDLE)pLrdProp); + } + + if (pLrdProp) + { + was_Layered = pLrdProp->is_Layered; + + pLrdProp->Key = crKey; + + if (dwFlags & LWA_ALPHA) + { + pLrdProp->Alpha = bAlpha; + } + else + { + if (!pLrdProp->is_Layered) pLrdProp->Alpha = 0; + } + + pLrdProp->Flags = dwFlags; + + pLrdProp->is_Layered = 1; + + if (!was_Layered) + co_UserRedrawWindow(pWnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME ); + } + // FIXME: Now set some bits to the Window DC!!!! + return TRUE; +} + +BOOL FASTCALL +IntUpdateLayeredWindowI( PWND pWnd, + UPDATELAYEREDWINDOWINFO *info ) +{ + PWND Parent; + RECT Window, Client; + SIZE Offset; + BOOL ret = FALSE; + DWORD flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW; + + Window = pWnd->rcWindow; + Client = pWnd->rcClient; + + Parent = pWnd->spwndParent; + if (pWnd->style & WS_CHILD && Parent) + { + RECTL_vOffsetRect(&Window, - Parent->rcClient.left, - Parent->rcClient.top); + RECTL_vOffsetRect(&Client, - Parent->rcClient.left, - Parent->rcClient.top); + } + + if (info->pptDst) + { + Offset.cx = info->pptDst->x - Window.left; + Offset.cy = info->pptDst->y - Window.top; + RECTL_vOffsetRect( &Client, Offset.cx, Offset.cy ); + RECTL_vOffsetRect( &Window, Offset.cx, Offset.cy ); + flags &= ~SWP_NOMOVE; + } + if (info->psize) + { + Offset.cx = info->psize->cx - (Window.right - Window.left); + Offset.cy = info->psize->cy - (Window.bottom - Window.top); + if (info->psize->cx <= 0 || info->psize->cy <= 0) + { + ERR("Update Layered Invalid Parameters\n"); + EngSetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + if ((info->dwFlags & ULW_EX_NORESIZE) && (Offset.cx || Offset.cy)) + { + ERR("Wrong Size\n"); + EngSetLastError( ERROR_INCORRECT_SIZE ); + return FALSE; + } + Client.right += Offset.cx; + Client.bottom += Offset.cy; + Window.right += Offset.cx; + Window.bottom += Offset.cy; + flags &= ~SWP_NOSIZE; + } + + if (info->hdcSrc) + { + HBRUSH hBr; + HDC hdc; + RECT Rect; + BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; + COLORREF color_key = (info->dwFlags & ULW_COLORKEY) ? info->crKey : CLR_INVALID; + + Rect = Window; + + RECTL_vOffsetRect( &Rect, -Window.left, -Window.top ); + + TRACE("H %d W %d\n",Rect.bottom - Rect.top,Rect.right - Rect.left); + + if (!info->hdcDst) hdc = UserGetDCEx(pWnd, NULL, DCX_USESTYLE); + else hdc = info->hdcDst; + + hBr = NtGdiCreateSolidBrush(color_key, NULL); + if (hBr) + { + TRACE("Fill Color Key %x\n",color_key); + FillRect(hdc, &Rect, hBr); + } + + if (info->prcDirty) + { + ERR("prcDirty\n"); + RECTL_bIntersectRect( &Rect, &Rect, info->prcDirty ); + NtGdiPatBlt( hdc, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, BLACKNESS ); + } + + if (info->dwFlags & ULW_ALPHA) + { + blend = *info->pblend; + TRACE("ULW_ALPHA bop %d scA %d aF %d\n", blend.BlendOp, blend.SourceConstantAlpha, blend.AlphaFormat); + } + + ret = NtGdiAlphaBlend( hdc, + Rect.left, + Rect.top, + Rect.right - Rect.left, + Rect.bottom - Rect.top, + info->hdcSrc, + Rect.left + (info->pptSrc ? info->pptSrc->x : 0), + Rect.top + (info->pptSrc ? info->pptSrc->y : 0), + Rect.right - Rect.left, Rect.bottom - Rect.top, + blend, + 0); + + if (hBr) GreDeleteObject(hBr); + if (!info->hdcDst) UserReleaseDC(pWnd, hdc, FALSE); + } + else + ret = TRUE; + + co_WinPosSetWindowPos(pWnd, 0, Window.left, Window.top, Window.right - Window.left, Window.bottom - Window.top, flags); + return ret; +} +
/* - * FillWindow: Called from User; Dialog, Edit and ListBox procs during a WM_ERASEBKGND. + * @implemented */ -/* - * @unimplemented - */ -BOOL APIENTRY -NtUserFillWindow(HWND hWndPaint, - HWND hWndPaint1, - HDC hDC, - HBRUSH hBrush) -{ - STUB - - return 0; -} - -/* - * @unimplemented - */ -BOOL APIENTRY -NtUserLockWindowUpdate(HWND hWnd) -{ - STUB - - return 0; -} - BOOL APIENTRY NtUserGetLayeredWindowAttributes( @@ -957,12 +219,56 @@ BYTE *pbAlpha, DWORD *pdwFlags) { - STUB; - return 0; + PLRD_PROP pLrdProp; + PWND pWnd; + BOOL Ret = FALSE; + + TRACE("Enter NtUserGetLayeredWindowAttributes\n"); + + if (!(pWnd = UserGetWindowObject(hwnd)) || + !(pWnd->ExStyle & WS_EX_LAYERED) ) + { + return FALSE; + } + + UserEnterExclusive(); + + pLrdProp = UserGetProp(pWnd, AtomLayer); + + if (!pLrdProp) + { + TRACE("No Prop!\n"); + goto Exit; + } + + if (pLrdProp->is_Layered == 0) + { + goto Exit; + } + + _SEH2_TRY + { + if (pcrKey) *pcrKey = pLrdProp->Key; + if (pbAlpha) *pbAlpha = pLrdProp->Alpha; + if (pdwFlags) *pdwFlags = pLrdProp->Flags; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + _SEH2_YIELD(goto Exit); + } + _SEH2_END; + + Ret = TRUE; + +Exit: + TRACE("Leave NtUserGetLayeredWindowAttributes, ret=%i\n", Ret); + UserLeave(); + return Ret; }
/* - * @unimplemented + * @implemented */ BOOL APIENTRY NtUserSetLayeredWindowAttributes(HWND hwnd, @@ -970,12 +276,28 @@ BYTE bAlpha, DWORD dwFlags) { - STUB; - return FALSE; + PWND pWnd; + BOOL Ret = FALSE; + + TRACE("Enter NtUserSetLayeredWindowAttributes\n"); + UserEnterExclusive(); + + if (!(pWnd = UserGetWindowObject(hwnd)) || + !(pWnd->ExStyle & WS_EX_LAYERED) ) + { + ERR("Not a Layered Window!\n"); + goto Exit; + } + + Ret = IntSetLayeredWindowAttributes(pWnd, crKey, bAlpha, dwFlags); +Exit: + TRACE("Leave NtUserSetLayeredWindowAttributes, ret=%i\n", Ret); + UserLeave(); + return Ret; }
/* - * @unimplemented + * @implemented */ BOOL APIENTRY @@ -991,43 +313,79 @@ DWORD dwFlags, RECT *prcDirty) { - STUB - - return 0; -} - -DWORD APIENTRY -NtUserQuerySendMessage(DWORD Unknown0) -{ - STUB; - - return 0; -} - -BOOL APIENTRY NtUserAddClipboardFormatListener( - HWND hwnd -) -{ - STUB; - return FALSE; -} - -BOOL APIENTRY NtUserRemoveClipboardFormatListener( - HWND hwnd -) -{ - STUB; - return FALSE; -} - -BOOL APIENTRY NtUserGetUpdatedClipboardFormats( - PUINT lpuiFormats, - UINT cFormats, - PUINT pcFormatsOut -) -{ - STUB; - return FALSE; + UPDATELAYEREDWINDOWINFO info; + POINT Dst, Src; + SIZE Size; + RECT Dirty; + BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; + PWND pWnd; + BOOL Ret = FALSE; + + TRACE("Enter NtUserUpdateLayeredWindow\n"); + + if (!(pWnd = UserGetWindowObject(hwnd))) + { + return FALSE; + } + + _SEH2_TRY + { + if (pptDst) + { + ProbeForRead(pptDst, sizeof(POINT), 1); + Dst = *pptDst; + } + if (pptSrc) + { + ProbeForRead(pptSrc, sizeof(POINT), 1); + Src = *pptSrc; + } + ProbeForRead(psize, sizeof(SIZE), 1); + Size = *psize; + if (pblend) + { + ProbeForRead(pblend, sizeof(BLENDFUNCTION), 1); + blend = *pblend; + } + if (prcDirty) + { + ProbeForRead(prcDirty, sizeof(RECT), 1); + Dirty = *prcDirty; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + EngSetLastError( ERROR_INVALID_PARAMETER ); + _SEH2_YIELD(return FALSE); + } + _SEH2_END; + + UserEnterExclusive(); + + if ( GetLayeredStatus(pWnd) || + dwFlags & ~(ULW_COLORKEY | ULW_ALPHA | ULW_OPAQUE | ULW_EX_NORESIZE) || + !(pWnd->ExStyle & WS_EX_LAYERED) ) + { + ERR("Layered Window Invalid Parameters\n"); + EngSetLastError( ERROR_INVALID_PARAMETER ); + goto Exit; + } + + info.cbSize = sizeof(info); + info.hdcDst = hdcDst; + info.pptDst = pptDst? &Dst : 0; + info.psize = &Size; + info.hdcSrc = hdcSrc; + info.pptSrc = pptSrc ? &Src : 0; + info.crKey = crKey; + info.pblend = &blend; + info.dwFlags = dwFlags; + info.prcDirty = prcDirty ? &Dirty : 0; + Ret = IntUpdateLayeredWindowI( pWnd, &info ); +Exit: + TRACE("Leave NtUserUpdateLayeredWindow, ret=%i\n", Ret); + UserLeave(); + return Ret; }
/* EOF */
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgqueu... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -62,7 +62,7 @@ }
if ((pWnd->style & WS_VISIBLE) && - (pWnd->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) == 0 && + (pWnd->ExStyle & (WS_EX_LAYERED|WS_EX_TRANSPARENT)) != (WS_EX_LAYERED|WS_EX_TRANSPARENT) && IntPtInWindow(pWnd, x, y)) return pWnd; }
Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstubs... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -980,53 +980,6 @@ return 0; }
-BOOL -APIENTRY -NtUserGetLayeredWindowAttributes( - HWND hwnd, - COLORREF *pcrKey, - BYTE *pbAlpha, - DWORD *pdwFlags) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL APIENTRY -NtUserSetLayeredWindowAttributes(HWND hwnd, - COLORREF crKey, - BYTE bAlpha, - DWORD dwFlags) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -APIENTRY -NtUserUpdateLayeredWindow( - HWND hwnd, - HDC hdcDst, - POINT *pptDst, - SIZE *psize, - HDC hdcSrc, - POINT *pptSrc, - COLORREF crKey, - BLENDFUNCTION *pblend, - DWORD dwFlags, - RECT *prcDirty) -{ - STUB - - return 0; -} - DWORD APIENTRY NtUserQuerySendMessage(DWORD Unknown0) {
Modified: trunk/reactos/win32ss/user/ntuser/userfuncs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/userfun... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -145,4 +145,9 @@ BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down); BOOL UserPaintCaption(PWND pWnd, INT Flags);
+/************** LAYERED **************/ + +BOOL FASTCALL SetLayeredStatus(PWND pWnd, BYTE set); +BOOL FASTCALL GetLayeredStatus(PWND pWnd); + /* EOF */
Modified: trunk/reactos/win32ss/user/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -3546,6 +3546,11 @@ else Style.styleNew &= ~WS_EX_WINDOWEDGE;
+ if (!(Window->ExStyle & WS_EX_LAYERED)) + { + SetLayeredStatus(Window, 0); + } + Window->ExStyle = (DWORD)Style.styleNew;
co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style);
Modified: trunk/reactos/win32ss/user/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows... ============================================================================== --- trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] Fri Sep 11 02:34:11 2015 @@ -1713,8 +1713,11 @@ BLENDFUNCTION *pbl, DWORD dwFlags) { - if ( dwFlags & ULW_EX_NORESIZE) - dwFlags = ~(ULW_EX_NORESIZE|ULW_OPAQUE|ULW_ALPHA|ULW_COLORKEY); + if (dwFlags & ULW_EX_NORESIZE) /* only valid for UpdateLayeredWindowIndirect */ + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } return NtUserUpdateLayeredWindow( hwnd, hdcDst, pptDst,