Commit 70f8330d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetClipboardFormatName implementation from user32.

parent 665ebe2a
......@@ -82,7 +82,7 @@ static const char *debugstr_format( UINT id )
{
WCHAR buffer[256];
DWORD le = GetLastError();
BOOL r = GetClipboardFormatNameW( id, buffer, 256 );
BOOL r = NtUserGetClipboardFormatName( id, buffer, 256 );
SetLastError(le);
if (r)
......@@ -659,16 +659,6 @@ UINT WINAPI RegisterClipboardFormatA( LPCSTR name )
/**************************************************************************
* GetClipboardFormatNameW (USER32.@)
*/
INT WINAPI GetClipboardFormatNameW( UINT format, LPWSTR buffer, INT maxlen )
{
if (format < MAXINTATOM || format > 0xffff) return 0;
return GlobalGetAtomNameW( format, buffer, maxlen );
}
/**************************************************************************
* GetClipboardFormatNameA (USER32.@)
*/
INT WINAPI GetClipboardFormatNameA( UINT format, LPSTR buffer, INT maxlen )
......
......@@ -276,7 +276,7 @@
@ stdcall GetClipCursor(ptr)
@ stdcall GetClipboardData(long)
@ stdcall GetClipboardFormatNameA(long ptr long)
@ stdcall GetClipboardFormatNameW(long ptr long)
@ stdcall GetClipboardFormatNameW(long ptr long) NtUserGetClipboardFormatName
@ stdcall GetClipboardOwner()
@ stdcall GetClipboardSequenceNumber ()
@ stdcall GetClipboardViewer()
......
......@@ -53,3 +53,28 @@ INT WINAPI NtUserCountClipboardFormats(void)
TRACE( "returning %d\n", count );
return count;
}
/**************************************************************************
* 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;
}
......@@ -105,6 +105,7 @@ static void * const syscalls[] =
NtUserCloseWindowStation,
NtUserCreateDesktopEx,
NtUserCreateWindowStation,
NtUserGetClipboardFormatName,
NtUserGetLayeredWindowAttributes,
NtUserGetObjectInformation,
NtUserGetProcessWindowStation,
......
......@@ -903,7 +903,7 @@
@ stub NtUserGetClipCursor
@ stub NtUserGetClipboardAccessToken
@ stub NtUserGetClipboardData
@ stub NtUserGetClipboardFormatName
@ stdcall -syscall NtUserGetClipboardFormatName(long ptr long)
@ stub NtUserGetClipboardOwner
@ stub NtUserGetClipboardSequenceNumber
@ stub NtUserGetClipboardViewer
......
......@@ -232,6 +232,12 @@ extern ULONG query_reg_ascii_value( HKEY hkey, const char *name,
extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
static inline BOOL set_ntstatus( NTSTATUS status )
{
if (status) SetLastError( RtlNtStatusToDosError( status ));
return !status;
}
static inline WCHAR *win32u_wcsrchr( const WCHAR *str, WCHAR ch )
{
WCHAR *ret = NULL;
......
......@@ -92,6 +92,7 @@
SYSCALL_ENTRY( NtUserCloseWindowStation ) \
SYSCALL_ENTRY( NtUserCreateDesktopEx ) \
SYSCALL_ENTRY( NtUserCreateWindowStation ) \
SYSCALL_ENTRY( NtUserGetClipboardFormatName ) \
SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
SYSCALL_ENTRY( NtUserGetObjectInformation ) \
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
......
......@@ -190,3 +190,12 @@ NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
return NtUserGetLayeredWindowAttributes( hwnd, key, alpha, flags );
}
NTSTATUS WINAPI wow64_NtUserGetClipboardFormatName( UINT *args )
{
UINT format = get_ulong( &args );
WCHAR *buffer = get_ptr( &args );
INT maxlen = get_ulong( &args );
return NtUserGetClipboardFormatName( format, buffer, maxlen );
}
......@@ -31,6 +31,7 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d
ULONG heap_size );
HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen );
BOOL WINAPI NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *key, BYTE *alpha, DWORD *flags );
BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info,
DWORD len, DWORD *needed );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment