Author: janderwald
Date: Tue May 20 08:42:17 2008
New Revision: 33610
URL:
http://svn.reactos.org/svn/reactos?rev=33610&view=rev
Log:
- remove unneeded cast in GetClipboardData
- use WideCharToMultiByte instead of RtlUnicodeStringToAnsiString
- fix memory leak in GetClipboardFormatNameA
- ReactOS now passes all user32_winetest.exe clipboard test (previously 2 failures)
Modified:
trunk/reactos/dll/win32/user32/windows/clipboard.c
Modified: trunk/reactos/dll/win32/user32/windows/clipboard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/clipboard.c [iso-8859-1] Tue May 20 08:42:17
2008
@@ -93,7 +93,7 @@
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size);
pGlobal = GlobalLock(hGlobal);
- size = (DWORD)NtUserGetClipboardData(uFormat, (DWORD)pGlobal);
+ size = (DWORD)NtUserGetClipboardData(uFormat, pGlobal);
GlobalUnlock(hGlobal);
}
@@ -114,12 +114,7 @@
{
LPWSTR lpBuffer;
UNICODE_STRING FormatName;
- ANSI_STRING FormatNameA;
INT Length;
- ANSI_STRING ClassName;
-
- ClassName.MaximumLength = cchMaxCount;
- ClassName.Buffer = lpszFormatName;
lpBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, cchMaxCount * sizeof(WCHAR));
if (!lpBuffer)
@@ -137,16 +132,16 @@
if (Length != 0)
{
- FormatNameA.Length = 0;
- FormatNameA.MaximumLength = cchMaxCount;
- FormatNameA.Buffer = lpszFormatName;
-
- RtlUnicodeStringToAnsiString(&FormatNameA, &FormatName, FALSE);
-
- return FormatNameA.Length;
+ if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount,
NULL, NULL))
+ {
+ /* clear result string */
+ lpszFormatName[0] = '\0';
+ Length = 0;
+ }
}
- return 0;
+ RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
+ return Length;
}
/*