Author: hbelusca
Date: Wed Dec 16 00:10:58 2015
New Revision: 70354
URL:
http://svn.reactos.org/svn/reactos?rev=70354&view=rev
Log:
[WIN32SS:CLIPBOARD]
- Reduce indentation level of some code.
- No need to initialize pWinStaObj when it is reinitialized just after.
- Fix some comments.
Modified:
trunk/reactos/win32ss/user/ntuser/clipboard.c
trunk/reactos/win32ss/user/user32/windows/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:10:58 2015
@@ -125,13 +125,8 @@
IntIsClipboardOpenByMe(PWINSTATION_OBJECT pWinSta)
{
/* Check if current thread has opened the clipboard */
- if (pWinSta->ptiClipLock &&
- pWinSta->ptiClipLock == PsGetCurrentThreadWin32Thread())
- {
- return TRUE;
- }
-
- return FALSE;
+ return (pWinSta->ptiClipLock &&
+ pWinSta->ptiClipLock == PsGetCurrentThreadWin32Thread());
}
static VOID NTAPI
@@ -385,7 +380,7 @@
{
UINT Ret = 0;
PCLIP pElement;
- PWINSTATION_OBJECT pWinStaObj = NULL;
+ PWINSTATION_OBJECT pWinStaObj;
pWinStaObj = IntGetWinStaForCbAccess();
if (!pWinStaObj)
@@ -440,11 +435,11 @@
if (pWinStaObj->ptiClipLock)
{
- /* Clipboard is already open */
+ /* Clipboard is already opened */
if (pWinStaObj->spwndClipOpen != pWindow)
{
+ ERR("Access denied!\n");
EngSetLastError(ERROR_ACCESS_DENIED);
- ERR("Access denied!\n");
goto cleanup;
}
}
@@ -477,12 +472,13 @@
UserCloseClipboard(VOID)
{
BOOL bRet = FALSE;
- PWINSTATION_OBJECT pWinStaObj = NULL;
-
- pWinStaObj = IntGetWinStaForCbAccess();
- if (!pWinStaObj)
- goto cleanup;
-
+ PWINSTATION_OBJECT pWinStaObj;
+
+ pWinStaObj = IntGetWinStaForCbAccess();
+ if (!pWinStaObj)
+ goto cleanup;
+
+ /* Check if clipboard has been opened */
if (!IntIsClipboardOpenByMe(pWinStaObj))
{
EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
@@ -589,7 +585,7 @@
NtUserCountClipboardFormats(VOID)
{
DWORD cFormats = 0;
- PWINSTATION_OBJECT pWinStaObj = NULL;
+ PWINSTATION_OBJECT pWinStaObj;
UserEnterShared();
@@ -617,30 +613,31 @@
if (!pWinStaObj)
return FALSE;
- if (IntIsClipboardOpenByMe(pWinStaObj))
- {
- UserEmptyClipboardData(pWinStaObj);
-
- if (pWinStaObj->spwndClipOwner)
- {
- TRACE("Clipboard: WM_DESTROYCLIPBOARD to %p\n",
pWinStaObj->spwndClipOwner->head.h);
- co_IntSendMessageNoWait(pWinStaObj->spwndClipOwner->head.h,
WM_DESTROYCLIPBOARD, 0, 0);
- }
+ /* Check if clipboard has been opened */
+ if (!IntIsClipboardOpenByMe(pWinStaObj))
+ {
+ EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
+ goto cleanup;
+ }
+
+ UserEmptyClipboardData(pWinStaObj);
+
+ if (pWinStaObj->spwndClipOwner)
+ {
+ TRACE("Clipboard: WM_DESTROYCLIPBOARD to %p\n",
pWinStaObj->spwndClipOwner->head.h);
+ co_IntSendMessageNoWait(pWinStaObj->spwndClipOwner->head.h,
WM_DESTROYCLIPBOARD, 0, 0);
+ }
pWinStaObj->spwndClipOwner = pWinStaObj->spwndClipOpen;
pWinStaObj->iClipSequenceNumber++;
pWinStaObj->fClipboardChanged = TRUE;
- bRet = TRUE;
- }
- else
- {
- EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
- ERR("Access denied!\n");
- }
-
- ObDereferenceObject(pWinStaObj);
+ bRet = TRUE;
+
+cleanup:
+ if (pWinStaObj)
+ ObDereferenceObject(pWinStaObj);
return bRet;
}
@@ -825,7 +822,7 @@
{
HANDLE hRet = NULL;
PCLIP pElement;
- PWINSTATION_OBJECT pWinStaObj = NULL;
+ PWINSTATION_OBJECT pWinStaObj;
TRACE("NtUserGetClipboardData(%x, %p)\n", fmt, pgcd);
@@ -835,6 +832,7 @@
if (!pWinStaObj)
goto cleanup;
+ /* Check if clipboard has been opened */
if (!IntIsClipboardOpenByMe(pWinStaObj))
{
EngSetLastError(ERROR_CLIPBOARD_NOT_OPEN);
@@ -855,7 +853,6 @@
if (!pElement || IS_DATA_DELAYED(pElement))
goto cleanup;
-
if (IS_DATA_SYNTHESIZED(pElement))
{
@@ -927,7 +924,7 @@
UserSetClipboardData(UINT fmt, HANDLE hData, PSETCLIPBDATA scd)
{
HANDLE hRet = NULL;
- PWINSTATION_OBJECT pWinStaObj = NULL;
+ PWINSTATION_OBJECT pWinStaObj;
pWinStaObj = IntGetWinStaForCbAccess();
if (!pWinStaObj)
@@ -946,7 +943,7 @@
if (scd->fIncSerialNumber)
pWinStaObj->iClipSerialNumber++;
- /* Is it a delayed render? */
+ /* Is it a delayed rendering? */
if (hData)
{
/* Is it a bitmap? */
@@ -967,7 +964,7 @@
}
else
{
- /* This is a delayed render */
+ /* This is a delayed rendering */
IntAddFormatedData(pWinStaObj, fmt, DATA_DELAYED, FALSE, FALSE);
TRACE("SetClipboardData delayed format: %u\n", fmt);
}
@@ -1018,7 +1015,7 @@
NtUserSetClipboardViewer(HWND hWndNewViewer)
{
HWND hWndNext = NULL;
- PWINSTATION_OBJECT pWinStaObj = NULL;
+ PWINSTATION_OBJECT pWinStaObj;
PWND pWindow;
UserEnterExclusive();
Modified: trunk/reactos/win32ss/user/user32/windows/clipboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/clipboard.c [iso-8859-1] Wed Dec 16 00:10:58
2015
@@ -17,8 +17,6 @@
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
-
-#define QUERY_SIZE 0
/* FUNCTIONS *****************************************************************/
@@ -263,7 +261,7 @@
pData = pNewData;
}
- /* Save synthesized format in clibboard */
+ /* Save synthesized format in clipboard */
if (pData)
{
HANDLE hMem;
@@ -296,7 +294,7 @@
HANDLE hRet = NULL;
SETCLIPBDATA scd = {FALSE, FALSE};
- /* Check if this is delayed render */
+ /* Check if this is a delayed rendering */
if (hMem == NULL)
return NtUserSetClipboardData(uFormat, NULL, &scd);
@@ -308,7 +306,10 @@
/* Meta files are probably checked for validity */
else if (uFormat == CF_DSPMETAFILEPICT || uFormat == CF_METAFILEPICT ||
uFormat == CF_DSPENHMETAFILE || uFormat == CF_ENHMETAFILE)
+ {
+ UNIMPLEMENTED;
hRet = NULL; // not supported yet
+ }
else
{
/* Some formats accept only global handles, other accept global handles or
integer values */