mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 08:53:02 +00:00
fixed NtUserGetClipboardFormatName()
svn path=/trunk/; revision=7020
This commit is contained in:
parent
df4f47d0df
commit
87bff663cd
2 changed files with 85 additions and 4 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: clipboard.c,v 1.7 2003/12/14 13:26:20 weiden Exp $
|
/* $Id: clipboard.c,v 1.8 2003/12/14 13:55:01 weiden Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/input.c
|
* FILE: lib/user32/windows/input.c
|
||||||
|
@ -106,6 +106,9 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RtlInitUnicodeString(&FormatName, lpBuffer);
|
RtlInitUnicodeString(&FormatName, lpBuffer);
|
||||||
|
FormatName.Length = 0;
|
||||||
|
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||||
|
FormatName.Buffer = lpBuffer;
|
||||||
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||||
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
|
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
|
||||||
HEAP_free(lpBuffer);
|
HEAP_free(lpBuffer);
|
||||||
|
@ -121,7 +124,9 @@ GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
|
||||||
{
|
{
|
||||||
UNICODE_STRING FormatName;
|
UNICODE_STRING FormatName;
|
||||||
|
|
||||||
RtlInitUnicodeString(&FormatName, lpszFormatName);
|
FormatName.Length = 0;
|
||||||
|
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||||
|
FormatName.Buffer = (PWSTR)lpszFormatName;
|
||||||
return NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
return NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,14 @@
|
||||||
* PROGRAMER: Filip Navara <xnavara@volny.cz>
|
* PROGRAMER: Filip Navara <xnavara@volny.cz>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include <ddk/ntddmou.h>
|
||||||
|
#include <win32k/win32k.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <internal/safe.h>
|
||||||
#include <include/clipboard.h>
|
#include <include/clipboard.h>
|
||||||
|
#include <include/cleanup.h>
|
||||||
|
#include <include/error.h>
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
@ -33,6 +40,13 @@ PW32THREAD ClipboardThread;
|
||||||
HWND ClipboardWindow;
|
HWND ClipboardWindow;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
INT FASTCALL
|
||||||
|
IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntEnumClipboardFormats(UINT format)
|
IntEnumClipboardFormats(UINT format)
|
||||||
{
|
{
|
||||||
|
@ -118,8 +132,70 @@ INT STDCALL
|
||||||
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||||
INT cchMaxCount)
|
INT cchMaxCount)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
INT Ret;
|
||||||
return 0;
|
NTSTATUS Status;
|
||||||
|
PWSTR Buf;
|
||||||
|
UNICODE_STRING SafeFormatName, BufFormatName;
|
||||||
|
|
||||||
|
if((cchMaxCount < 1) || !FormatName)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy the FormatName UNICODE_STRING structure */
|
||||||
|
Status = MmCopyFromCaller(&SafeFormatName, FormatName, sizeof(UNICODE_STRING));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate memory for the string */
|
||||||
|
Buf = ExAllocatePool(NonPagedPool, cchMaxCount * sizeof(WCHAR));
|
||||||
|
if(!Buf)
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup internal unicode string */
|
||||||
|
BufFormatName.Length = 0;
|
||||||
|
BufFormatName.MaximumLength = min(cchMaxCount * sizeof(WCHAR), SafeFormatName.MaximumLength);
|
||||||
|
BufFormatName.Buffer = Buf;
|
||||||
|
|
||||||
|
if(BufFormatName.MaximumLength < sizeof(WCHAR))
|
||||||
|
{
|
||||||
|
ExFreePool(Buf);
|
||||||
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = IntGetClipboardFormatName(format, &BufFormatName);
|
||||||
|
|
||||||
|
/* copy the UNICODE_STRING buffer back to the user */
|
||||||
|
Status = MmCopyToCaller(SafeFormatName.Buffer, BufFormatName.Buffer, BufFormatName.MaximumLength);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ExFreePool(Buf);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BufFormatName.MaximumLength = SafeFormatName.MaximumLength;
|
||||||
|
BufFormatName.Buffer = SafeFormatName.Buffer;
|
||||||
|
|
||||||
|
/* update the UNICODE_STRING structure (only the Length member should change) */
|
||||||
|
Status = MmCopyToCaller(FormatName, &BufFormatName, sizeof(UNICODE_STRING));
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ExFreePool(Buf);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExFreePool(Buf);
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue