Author: tkreuzer
Date: Tue May 6 15:09:34 2008
New Revision: 33329
URL:
http://svn.reactos.org/svn/reactos?rev=33329&view=rev
Log:
rename 2nd parameter of NtUserGetClipboardData from Unknown1 to pBuffer. Use SEH to copy
data.
Modified:
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Tue May 6 15:09:34 2008
@@ -1169,7 +1169,7 @@
NTAPI
NtUserGetClipboardData(
UINT uFormat,
- DWORD Unknown1);
+ PVOID pBuffer);
INT
NTAPI
@@ -1614,7 +1614,7 @@
#define NUMC_SENDMESSAGE 0x02B0
// Kernel has option to use TO or normal msg send, based on type of msg.
-#define NUMC_SENDMESSAGEWTOOPTION 0x02B1
+#define NUMC_SENDMESSAGEWTOOPTION 0x02B1
#define NUMC_SENDMESSAGETIMEOUT 0x02B2
#define NUMC_BROADCASTSYSTEMMESSAGE 0x02B4
#define NUMC_SENDNOTIFYMESSAGE 0x02B7
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c [iso-8859-1] Tue May 6
15:09:34 2008
@@ -598,17 +598,16 @@
}
HANDLE STDCALL
-NtUserGetClipboardData(UINT uFormat, DWORD Unknown1)
+NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
{
HANDLE ret = NULL;
- PCHAR buffer;
UserEnterShared();
if (intIsClipboardOpenByMe())
{
/* when Unknown1 is zero, we returns to user32 the data size */
- if (Unknown1 == 0)
+ if (!pBuffer)
{
PCLIPBOARDELEMENT data = intIsFormatAvailable(uFormat);
@@ -624,7 +623,7 @@
co_IntSendMessage(ClipboardOwnerWindow->hSelf,
WM_RENDERFORMAT, (WPARAM)uFormat, 0);
data = intIsFormatAvailable(uFormat);
ASSERT(data->size);
- ret = (HANDLE)data->size;
+ ret = (HANDLE)(ULONG_PTR)data->size;
}
}
else
@@ -635,7 +634,7 @@
}
}
- ret = (HANDLE)data->size;
+ ret = (HANDLE)(ULONG_PTR)data->size;
}
else
{
@@ -668,20 +667,36 @@
}
else
{
- buffer = (PCHAR)Unknown1;
- memcpy(buffer, (PCHAR)synthesizedData, synthesizedDataSize);
+ ret = (HANDLE)pBuffer;
+
+ _SEH_TRY
+ {
+ ProbeForWrite(pBuffer, synthesizedDataSize, 1);
+ memcpy(pBuffer, (PCHAR)synthesizedData,
synthesizedDataSize);
+ }
+ _SEH_HANDLE
+ {
+ ret = NULL;
+ }
+ _SEH_END
freeSynthesizedData();
-
- ret = (HANDLE)Unknown1;
}
}
else
{
- buffer = (PCHAR)Unknown1;
- memcpy(buffer, (PCHAR)data->hData, data->size);
-
- ret = (HANDLE)Unknown1;
+ ret = (HANDLE)pBuffer;
+
+ _SEH_TRY
+ {
+ ProbeForWrite(pBuffer, data->size, 1);
+ memcpy(pBuffer, (PCHAR)data->hData, data->size);
+ }
+ _SEH_HANDLE
+ {
+ ret = NULL;
+ }
+ _SEH_END
}
}