Commit 25d6c1a3 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

user32: GetClipboardData() should set last error when the format is not found.

This has the benefit of indicating why GetClipboardData() failed and of matching the Windows 11 behavior. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54190
parent e8c79209
......@@ -986,7 +986,9 @@ static void test_synthesized(void)
SetLastError(0xdeadbeef);
data = GetClipboardData( CF_TEXT );
ok(GetLastError() == 0xdeadbeef, "bad last error %ld\n", GetLastError());
ok(GetLastError() == ERROR_NOT_FOUND /* win11 */ ||
broken(GetLastError() == 0xdeadbeef),
"bad last error %ld\n", GetLastError());
ok(!data, "GetClipboardData() should have returned NULL\n");
r = CloseClipboard();
......@@ -1587,7 +1589,9 @@ static void test_handles( HWND hwnd )
SetLastError( 0xdeadbeef );
data = GetClipboardData( CF_RIFF );
ok( GetLastError() == 0xdeadbeef, "unexpected last error %ld\n", GetLastError() );
ok( GetLastError() == ERROR_NOT_FOUND /* win11 */ ||
broken(GetLastError() == 0xdeadbeef),
"unexpected last error %ld\n", GetLastError() );
ok( !data, "wrong data %p\n", data );
h = SetClipboardData( CF_PRIVATEFIRST + 7, htext4 );
......
......@@ -720,7 +720,11 @@ HANDLE WINAPI NtUserGetClipboardData( UINT format, struct get_clipboard_params *
params->data_size = size;
return 0;
}
if (status == STATUS_OBJECT_NAME_NOT_FOUND) return 0; /* no such format */
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
{
RtlSetLastWin32Error( ERROR_NOT_FOUND ); /* no such format */
return 0;
}
if (status)
{
RtlSetLastWin32Error( RtlNtStatusToDosError( status ));
......
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