mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- 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) svn path=/trunk/; revision=33610
This commit is contained in:
parent
7347f5ab15
commit
0b0ec52a01
1 changed files with 9 additions and 14 deletions
|
@ -93,7 +93,7 @@ GetClipboardData(UINT uFormat)
|
|||
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 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
|||
{
|
||||
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 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue