Author: hbelusca
Date: Wed Dec 16 00:26:27 2015
New Revision: 70355
URL:
http://svn.reactos.org/svn/reactos?rev=70355&view=rev
Log:
[WIN32K:CLIPBOARD]
- When cleaning the clipboard, cancel any pending delayed rendering and increment all the
sequence&serial numbers.
- Fix the clipboard access check when performing a delay rendering. This fixes VBox host
<-> guest copy/paste amongst others...
CORE-5512 CORE-9620
CORE-8367 CORE-8627 #comment Please retest with revision >= 70355.
Modified:
trunk/reactos/win32ss/user/ntuser/clipboard.c
Modified: trunk/reactos/win32ss/user/ntuser/clipboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/clipbo…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/clipboard.c [iso-8859-1] Wed Dec 16 00:26:27 2015
@@ -628,10 +628,12 @@
co_IntSendMessageNoWait(pWinStaObj->spwndClipOwner->head.h,
WM_DESTROYCLIPBOARD, 0, 0);
}
- pWinStaObj->spwndClipOwner = pWinStaObj->spwndClipOpen;
-
- pWinStaObj->iClipSequenceNumber++;
- pWinStaObj->fClipboardChanged = TRUE;
+ pWinStaObj->spwndClipOwner = pWinStaObj->spwndClipOpen;
+
+ pWinStaObj->iClipSerialNumber++;
+ pWinStaObj->iClipSequenceNumber++;
+ pWinStaObj->fClipboardChanged = TRUE;
+ pWinStaObj->fInDelayedRendering = FALSE;
bRet = TRUE;
@@ -930,10 +932,15 @@
if (!pWinStaObj)
goto cleanup;
- /* If it's delayed rendering we don't have to open clipboard */
- if ((pWinStaObj->fInDelayedRendering &&
- pWinStaObj->spwndClipOwner->head.pti != PsGetCurrentThreadWin32Thread())
||
- !IntIsClipboardOpenByMe(pWinStaObj))
+ /*
+ * Check if the clipboard is correctly opened:
+ * - in case of normal rendering, we must have opened the clipboard;
+ * - in case of delayed rendering, the clipboard must be already opened
+ * by another application, but we need to be the clipboard owner.
+ */
+ if ((!pWinStaObj->fInDelayedRendering &&
!IntIsClipboardOpenByMe(pWinStaObj)) ||
+ (pWinStaObj->fInDelayedRendering && !(pWinStaObj->ptiClipLock
&&
+ pWinStaObj->spwndClipOwner->head.pti ==
PsGetCurrentThreadWin32Thread())))
{
ERR("Access denied!\n");
EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
@@ -957,7 +964,10 @@
IntAddFormatedData(pWinStaObj, fmt, hData, scd->fGlobalHandle, FALSE);
TRACE("hData stored\n");
- pWinStaObj->iClipSequenceNumber++;
+ /* If the serial number was increased, increase also the sequence number */
+ if (scd->fIncSerialNumber)
+ pWinStaObj->iClipSequenceNumber++;
+
pWinStaObj->fClipboardChanged = TRUE;
/* Note: Synthesized formats are added in NtUserCloseClipboard */