2021-11-11 14:13:45 +01:00
|
|
|
/*
|
|
|
|
* WIN32 clipboard implementation
|
|
|
|
*
|
|
|
|
* Copyright 1994 Martin Ayotte
|
|
|
|
* Copyright 1996 Alex Korobka
|
|
|
|
* Copyright 1999 Noel Borthwick
|
|
|
|
* Copyright 2003 Ulrich Czekalla for CodeWeavers
|
|
|
|
* Copyright 2016 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "win32u_private.h"
|
|
|
|
#include "wine/server.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* NtUserCountClipboardFormats (win32u.@)
|
|
|
|
*/
|
|
|
|
INT WINAPI NtUserCountClipboardFormats(void)
|
|
|
|
{
|
|
|
|
INT count = 0;
|
|
|
|
|
|
|
|
user_driver->pUpdateClipboard();
|
|
|
|
|
|
|
|
SERVER_START_REQ( get_clipboard_formats )
|
|
|
|
{
|
|
|
|
wine_server_call( req );
|
|
|
|
count = reply->count;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
|
|
|
TRACE( "returning %d\n", count );
|
|
|
|
return count;
|
|
|
|
}
|
2021-11-12 12:53:28 +01:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* NtUserGetClipboardFormatName (win32u.@)
|
|
|
|
*/
|
|
|
|
INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen )
|
|
|
|
{
|
|
|
|
char buf[sizeof(ATOM_BASIC_INFORMATION) + 255 * sizeof(WCHAR)];
|
|
|
|
ATOM_BASIC_INFORMATION *abi = (ATOM_BASIC_INFORMATION *)buf;
|
|
|
|
UINT length = 0;
|
|
|
|
|
|
|
|
if (format < MAXINTATOM || format > 0xffff) return 0;
|
|
|
|
if (maxlen <= 0)
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_MORE_DATA );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (!set_ntstatus( NtQueryInformationAtom( format, AtomBasicInformation,
|
|
|
|
buf, sizeof(buf), NULL )))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
length = min( abi->NameLength / sizeof(WCHAR), maxlen - 1 );
|
|
|
|
if (length) memcpy( buffer, abi->Name, length * sizeof(WCHAR) );
|
|
|
|
buffer[length] = 0;
|
|
|
|
return length;
|
|
|
|
}
|