ReactOS  0.4.13-dev-257-gfabbd7c
clipboard.c File Reference
#include <stdio.h>
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
Include dependency graph for clipboard.c:

Go to the source code of this file.

Macros

#define check_messages(a, b, c, d, e, f)   check_messages_(__LINE__,a,b,c,d,e,f)
 

Functions

static BOOL (WINAPI *pAddClipboardFormatListener)(HWND hwnd)
 
static DWORD WINAPI open_clipboard_thread (LPVOID arg)
 
static DWORD WINAPI empty_clipboard_thread (LPVOID arg)
 
static DWORD WINAPI open_and_empty_clipboard_thread (LPVOID arg)
 
static DWORD WINAPI open_and_empty_clipboard_win_thread (LPVOID arg)
 
static DWORD WINAPI set_clipboard_data_thread (LPVOID arg)
 
static void set_clipboard_data_process (int arg)
 
static void grab_clipboard_process (int arg)
 
static void run_thread (LPTHREAD_START_ROUTINE func, void *arg, int line)
 
static void run_process (const char *args)
 
static LRESULT CALLBACK winproc_wrapper (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_ClipboardOwner (void)
 
static void test_RegisterClipboardFormatA (void)
 
static HGLOBAL create_textA (void)
 
static HGLOBAL create_textW (void)
 
static HANDLE create_metafile (void)
 
static HENHMETAFILE create_emf (void)
 
static HBITMAP create_bitmap (void)
 
static HBITMAP create_dib (BOOL v5)
 
static LRESULT CALLBACK renderer_winproc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_synthesized (void)
 
static DWORD WINAPI clipboard_render_data_thread (void *param)
 
static LRESULT CALLBACK clipboard_wnd_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void get_clipboard_data_process (void)
 
static void check_messages_ (int line, HWND win, UINT seq_diff, UINT draw, UINT update, UINT destroy, UINT render)
 
static DWORD WINAPI clipboard_thread (void *param)
 
static void test_messages (void)
 
static BOOL is_moveable (HANDLE handle)
 
static BOOL is_fixed (HANDLE handle)
 
static BOOL is_freed (HANDLE handle)
 
static void test_handles (HWND hwnd)
 
static DWORD WINAPI test_handles_thread (void *arg)
 
static DWORD WINAPI test_handles_thread2 (void *arg)
 
static void test_handles_process (const char *str)
 
static void test_handles_process_open (const char *str)
 
static void test_handles_process_dib (const char *str)
 
static void test_data_handles (void)
 
static void test_GetUpdatedClipboardFormats (void)
 
static void test_string_data (void)
 
static void test_string_data_process (int i)
 
 START_TEST (clipboard)
 

Variables

static UINT count
 
static UINT UINTout_count
 
static int thread_from_line
 
static charargv0
 
static WNDPROC old_proc
 
static CRITICAL_SECTION clipboard_cs
 
static HWND next_wnd
 
static UINT wm_drawclipboard
 
static UINT wm_clipboardupdate
 
static UINT wm_destroyclipboard
 
static UINT wm_renderformat
 
static UINT nb_formats
 
static BOOL cross_thread
 
static BOOL do_render_format
 
static HANDLE update_event
 
static UINT old_seq
 
static UINT format_id
 
static HBITMAP bitmap
 
static HBITMAP bitmap2
 
static HPALETTE palette
 
static const LOGPALETTE logpalette = { 0x300, 1, {{ 0x12, 0x34, 0x56, 0x78 }}}
 
struct {
   char   strA [12]
 
   WCHAR   strW [12]
 
   UINT   len
 
test_data []
 

Macro Definition Documentation

◆ check_messages

#define check_messages (   a,
  b,
  c,
  d,
  e,
  f 
)    check_messages_(__LINE__,a,b,c,d,e,f)

Definition at line 1033 of file clipboard.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pAddClipboardFormatListener)
static

◆ check_messages_()

static void check_messages_ ( int  line,
HWND  win,
UINT  seq_diff,
UINT  draw,
UINT  update,
UINT  destroy,
UINT  render 
)
static

Definition at line 1006 of file clipboard.c.

1007 {
1008  MSG msg;
1009  UINT count, fmt, seq;
1010 
1012  ok_(__FILE__, line)(seq - old_seq == seq_diff, "sequence diff %d\n", seq - old_seq);
1013  old_seq = seq;
1014 
1015  if (!cross_thread)
1016  {
1017  while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
1018  }
1019 
1020  if (update && !broken(!pAddClipboardFormatListener))
1021  ok(WaitForSingleObject(update_event, 1000) == WAIT_OBJECT_0, "wait failed\n");
1022 
1023  count = SendMessageA( win, WM_USER + 1, 0, 0 );
1024  ok_(__FILE__, line)(count == draw, "WM_DRAWCLIPBOARD %sreceived\n", draw ? "not " : "");
1025  count = SendMessageA( win, WM_USER + 2, 0, 0 );
1026  ok_(__FILE__, line)(count == update || broken(!pAddClipboardFormatListener),
1027  "WM_CLIPBOARDUPDATE %sreceived\n", update ? "not " : "");
1028  count = SendMessageA( win, WM_USER + 3, 0, 0 );
1029  ok_(__FILE__, line)(count == destroy, "WM_DESTROYCLIPBOARD %sreceived\n", destroy ? "not " : "");
1030  fmt = SendMessageA( win, WM_USER + 4, 0, 0 );
1031  ok_(__FILE__, line)(fmt == render, "WM_RENDERFORMAT received %04x, expected %04x\n", fmt, render);
1032 }
static HANDLE update_event
Definition: clipboard.c:902
static BOOL cross_thread
Definition: clipboard.c:900
#define ok_(x1, x2)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
const char * fmt
Definition: wsprintf.c:30
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define ok(value,...)
Definition: parser.c:48
#define WAIT_OBJECT_0
Definition: winbase.h:387
static UINT count
Definition: clipboard.c:35
static void render(void)
Definition: ssstars.c:272
void destroy(_Tp *__pointer)
Definition: _construct.h:278
static UINT old_seq
Definition: clipboard.c:1004
#define WM_USER
Definition: winuser.h:1856
#define broken(x)
Definition: _sntprintf.h:21
EXTINLINE DWORD WINAPI GetClipboardSequenceNumber(VOID)
Definition: ntwrapper.h:202
static real win[4][36]
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
Definition: dsound.c:943

◆ clipboard_render_data_thread()

static DWORD WINAPI clipboard_render_data_thread ( void param)
static

Definition at line 886 of file clipboard.c.

887 {
889  ok( handle != 0, "SetClipboardData failed: %d\n", GetLastError() );
890  return 0;
891 }
static HGLOBAL create_textW(void)
Definition: clipboard.c:498
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ok(value,...)
#define CF_UNICODETEXT
Definition: constants.h:408
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285

Referenced by clipboard_wnd_proc().

◆ clipboard_thread()

static DWORD WINAPI clipboard_thread ( void param)
static

Definition at line 1035 of file clipboard.c.

1036 {
1037  HWND ret, win = param;
1038  BOOL r;
1039  MSG msg;
1040  HANDLE handle;
1041  UINT count, fmt, formats;
1042 
1044  trace( "%s-threaded test\n", cross_thread ? "multi" : "single" );
1045 
1047 
1049  SetLastError(0xdeadbeef);
1051  ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError());
1053 
1054  SetLastError( 0xdeadbeef );
1055  ret = SetClipboardViewer( (HWND)0xdead );
1056  ok( !ret, "SetClipboardViewer succeeded\n" );
1057  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1058  SetLastError( 0xdeadbeef );
1059  r = ChangeClipboardChain( win, (HWND)0xdead );
1060  ok( !r, "ChangeClipboardChain succeeded\n" );
1061  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1062  SetLastError( 0xdeadbeef );
1063  r = ChangeClipboardChain( (HWND)0xdead, next_wnd );
1064  ok( !r, "ChangeClipboardChain succeeded\n" );
1065  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1066 
1067  if (pAddClipboardFormatListener)
1068  {
1069  r = pAddClipboardFormatListener(win);
1070  ok( r, "AddClipboardFormatListener failed err %d\n", GetLastError());
1071  SetLastError( 0xdeadbeef );
1072  r = pAddClipboardFormatListener( win );
1073  ok( !r, "AddClipboardFormatListener succeeded\n" );
1074  ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
1075  SetLastError( 0xdeadbeef );
1076  r = pAddClipboardFormatListener( (HWND)0xdead );
1077  ok( !r, "AddClipboardFormatListener succeeded\n" );
1078  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1079  r = pAddClipboardFormatListener( GetDesktopWindow() );
1080  ok( r, "AddClipboardFormatListener failed err %d\n", GetLastError());
1081  r = pRemoveClipboardFormatListener( GetDesktopWindow() );
1082  ok( r, "RemoveClipboardFormatListener failed err %d\n", GetLastError());
1083  }
1084 
1085  check_messages(win, 0, 1, 0, 0, 0);
1086 
1087  SetLastError( 0xdeadbeef );
1088  r = OpenClipboard( (HWND)0xdead );
1089  ok( !r, "OpenClipboard succeeded\n" );
1090  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1091 
1092  r = OpenClipboard(win);
1093  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1094 
1095  check_messages(win, 0, 0, 0, 0, 0);
1096 
1097  r = EmptyClipboard();
1098  ok(r, "EmptyClipboard failed: %d\n", GetLastError());
1099 
1100  check_messages(win, 1, 0, 0, 0, 0);
1101 
1102  r = EmptyClipboard();
1103  ok(r, "EmptyClipboard failed: %d\n", GetLastError());
1104  /* sequence changes again, even though it was already empty */
1105  check_messages(win, 1, 0, 0, 1, 0);
1106  count = SendMessageA( win, WM_USER+5, 0, 0 );
1107  ok( !count, "wrong format count %u on WM_DESTROYCLIPBOARD\n", count );
1108 
1110  ok(handle != 0, "SetClipboardData failed: %d\n", GetLastError());
1111 
1112  check_messages(win, 1, 0, 0, 0, 0);
1113 
1115 
1116  check_messages(win, 1, 0, 0, 0, 0);
1117 
1118  SetClipboardData( CF_UNICODETEXT, 0 ); /* same data again */
1119 
1120  check_messages(win, 1, 0, 0, 0, 0);
1121 
1122  ok( IsClipboardFormatAvailable( CF_TEXT ), "CF_TEXT available\n" );
1123  ok( IsClipboardFormatAvailable( CF_UNICODETEXT ), "CF_UNICODETEXT available\n" );
1124  ok( !IsClipboardFormatAvailable( CF_OEMTEXT ), "CF_OEMTEXT available\n" );
1125 
1127  r = CloseClipboard();
1128  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1130 
1131  check_messages(win, 2, 1, 1, 0, 0);
1132 
1133  r = OpenClipboard(win);
1134  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1135 
1136  check_messages(win, 0, 0, 0, 0, 0);
1137 
1138  ok( IsClipboardFormatAvailable( CF_TEXT ), "CF_TEXT available\n" );
1139  ok( IsClipboardFormatAvailable( CF_UNICODETEXT ), "CF_UNICODETEXT available\n" );
1140  ok( IsClipboardFormatAvailable( CF_OEMTEXT ), "CF_OEMTEXT available\n" );
1141 
1142  ok( GetClipboardOwner() == win, "wrong owner %p\n", GetClipboardOwner());
1144  ok( !handle, "got data for CF_UNICODETEXT\n" );
1145  fmt = SendMessageA( win, WM_USER+4, 0, 0 );
1146  ok( fmt == CF_UNICODETEXT, "WM_RENDERFORMAT received %04x\n", fmt );
1147 
1150  ok( handle != NULL, "didn't get data for CF_OEMTEXT\n" );
1151  fmt = SendMessageA( win, WM_USER+4, 0, 0 );
1152  ok( fmt == CF_UNICODETEXT, "WM_RENDERFORMAT received %04x\n", fmt );
1154 
1155  SetClipboardData( CF_WAVE, 0 );
1156  check_messages(win, 1, 0, 0, 0, 0);
1157 
1158  r = CloseClipboard();
1159  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1160  /* no synthesized format, so CloseClipboard doesn't change the sequence */
1161  check_messages(win, 0, 1, 1, 0, 0);
1162 
1163  r = OpenClipboard(win);
1164  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1165  r = CloseClipboard();
1166  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1167  /* nothing changed */
1168  check_messages(win, 0, 0, 0, 0, 0);
1169 
1171  r = OpenClipboard(0);
1172  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1173  r = EmptyClipboard();
1174  ok(r, "EmptyClipboard failed: %d\n", GetLastError());
1175  r = CloseClipboard();
1176  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1177 
1178  check_messages(win, 1, 1, 1, 1, 0);
1179  count = SendMessageA( win, WM_USER+5, 0, 0 );
1180  ok( count == formats, "wrong format count %u on WM_DESTROYCLIPBOARD\n", count );
1181 
1182  r = OpenClipboard(win);
1183  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1185  check_messages(win, 1, 0, 0, 0, 0);
1186 
1188  r = CloseClipboard();
1189  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1191 
1192  check_messages(win, 0, 1, 1, 0, 0);
1193 
1194  run_process( "grab_clipboard 0" );
1195 
1196  if (!cross_thread)
1197  {
1198  /* in this case we get a cross-thread WM_DRAWCLIPBOARD */
1199  cross_thread = TRUE;
1200  while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
1201  cross_thread = FALSE;
1202  }
1203  check_messages(win, 1, 1, 1, 0, 0);
1204 
1205  r = OpenClipboard(0);
1206  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1208  check_messages(win, 1, 0, 0, 0, 0);
1209 
1211  r = CloseClipboard();
1212  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1214 
1215  check_messages(win, 0, 1, 1, 0, 0);
1216 
1217  run_process( "grab_clipboard 1" );
1218 
1219  if (!cross_thread)
1220  {
1221  /* in this case we get a cross-thread WM_DRAWCLIPBOARD */
1222  cross_thread = TRUE;
1223  while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
1224  cross_thread = FALSE;
1225  }
1226  check_messages(win, 2, 1, 1, 0, 0);
1227 
1228  r = OpenClipboard(0);
1229  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1231  check_messages(win, 1, 0, 0, 0, 0);
1232 
1234  r = CloseClipboard();
1235  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1237 
1238  check_messages(win, 0, 1, 1, 0, 0);
1239 
1240  if (cross_thread)
1241  {
1242  r = OpenClipboard( win );
1243  ok(r, "OpenClipboard failed: %d\n", GetLastError());
1244  r = EmptyClipboard();
1245  ok(r, "EmptyClipboard failed: %d\n", GetLastError());
1246  SetClipboardData( CF_TEXT, 0 );
1247  r = CloseClipboard();
1248  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1249 
1252  run_process( "get_clipboard_data" );
1254 
1255  check_messages(win, 0, 1, 1, 0, CF_TEXT);
1256  }
1257 
1258  r = PostMessageA(win, WM_USER, 0, 0);
1259  ok(r, "PostMessage failed: %d\n", GetLastError());
1260 
1261  if (pRemoveClipboardFormatListener)
1262  {
1263  r = pRemoveClipboardFormatListener(win);
1264  ok( r, "RemoveClipboardFormatListener failed err %d\n", GetLastError());
1265  SetLastError( 0xdeadbeef );
1266  r = pRemoveClipboardFormatListener(win);
1267  ok( !r, "RemoveClipboardFormatListener succeeded\n" );
1268  ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
1269  SetLastError( 0xdeadbeef );
1270  r = pRemoveClipboardFormatListener( (HWND)0xdead );
1271  ok( !r, "RemoveClipboardFormatListener succeeded\n" );
1272  ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
1273  }
1274  return 0;
1275 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define trace(...)
Definition: kmt_test.h:217
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HWND WINAPI SetClipboardViewer(_In_ HWND)
static BOOL cross_thread
Definition: clipboard.c:900
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static const struct pixel_format_desc formats[]
Definition: util.c:57
const char * fmt
Definition: wsprintf.c:30
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define check_messages(a, b, c, d, e, f)
Definition: clipboard.c:1033
BOOL WINAPI ChangeClipboardChain(_In_ HWND, _In_ HWND)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION clipboard_cs
Definition: clipboard.c:893
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:420
#define CF_TEXT
Definition: constants.h:396
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
static HWND next_wnd
Definition: clipboard.c:894
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
static UINT count
Definition: clipboard.c:35
GLfloat param
Definition: glext.h:5796
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
int ret
static HGLOBAL create_textA(void)
Definition: clipboard.c:489
#define GMEM_FIXED
Definition: winbase.h:290
static void run_process(const char *args)
Definition: clipboard.c:166
static UINT old_seq
Definition: clipboard.c:1004
#define CF_WAVE
Definition: constants.h:407
#define WM_USER
Definition: winuser.h:1856
EXTINLINE DWORD WINAPI GetClipboardSequenceNumber(VOID)
Definition: ntwrapper.h:202
HWND WINAPI GetClipboardOwner(void)
Definition: ntwrapper.h:196
static real win[4][36]
#define CF_OEMTEXT
Definition: constants.h:402
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
int WINAPI CountClipboardFormats(void)
Definition: ntwrapper.h:184
static BOOL do_render_format
Definition: clipboard.c:901
Definition: dsound.c:943

Referenced by test_messages().

◆ clipboard_wnd_proc()

static LRESULT CALLBACK clipboard_wnd_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 904 of file clipboard.c.

905 {
906  LRESULT ret;
907  DWORD msg_flags = InSendMessageEx( NULL );
908 
909  switch(msg) {
910  case WM_DRAWCLIPBOARD:
911  ok( msg_flags == (cross_thread ? ISMEX_NOTIFY : ISMEX_NOSEND),
912  "WM_DRAWCLIPBOARD wrong flags %x\n", msg_flags );
916  break;
917  case WM_CHANGECBCHAIN:
918  ok( msg_flags == (cross_thread ? ISMEX_SEND : ISMEX_NOSEND),
919  "WM_CHANGECBCHAIN wrong flags %x\n", msg_flags );
920  if (next_wnd == (HWND)wp)
921  next_wnd = (HWND)lp;
922  else if (next_wnd)
923  SendMessageA(next_wnd, msg, wp, lp);
924  break;
925  case WM_DESTROYCLIPBOARD:
926  ok( msg_flags == (cross_thread ? ISMEX_SEND : ISMEX_NOSEND),
927  "WM_DESTROYCLIPBOARD wrong flags %x\n", msg_flags );
929  ok( GetClipboardOwner() == hwnd, "WM_DESTROYCLIPBOARD owner %p\n", GetClipboardOwner() );
931  break;
932  case WM_RENDERFORMAT:
933  ok( !wm_renderformat, "multiple WM_RENDERFORMAT %04x / %04lx\n", wm_renderformat, wp );
934  wm_renderformat = wp;
935 
936  if (do_render_format)
937  {
938  UINT seq, old_seq;
939  HANDLE handle;
940 
943  ok( handle != 0, "SetClipboardData failed: %d\n", GetLastError() );
945  ok( seq == old_seq, "sequence changed\n" );
946  old_seq = seq;
947 
949  ok( handle != NULL, "CreateThread failed: %d\n", GetLastError() );
950  ok( WaitForSingleObject(handle, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n" );
951  CloseHandle( handle );
953  ok( seq == old_seq, "sequence changed\n" );
954  }
955 
956  break;
957  case WM_CLIPBOARDUPDATE:
958  ok( msg_flags == ISMEX_NOSEND, "WM_CLIPBOARDUPDATE wrong flags %x\n", msg_flags );
963  break;
964  case WM_USER:
966  PostQuitMessage(0);
967  break;
968  case WM_USER+1:
970  wm_drawclipboard = 0;
971  return ret;
972  case WM_USER+2:
974  wm_clipboardupdate = 0;
975  return ret;
976  case WM_USER+3:
979  return ret;
980  case WM_USER+4:
982  wm_renderformat = 0;
983  return ret;
984  case WM_USER+5:
985  return nb_formats;
986  }
987 
988  return DefWindowProcA(hwnd, msg, wp, lp);
989 }
static HANDLE update_event
Definition: clipboard.c:902
#define WM_CHANGECBCHAIN
Definition: winuser.h:1835
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:398
static DWORD WINAPI clipboard_render_data_thread(void *param)
Definition: clipboard.c:886
#define WM_RENDERFORMAT
Definition: winuser.h:1827
static BOOL cross_thread
Definition: clipboard.c:900
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE HWND
Definition: compat.h:13
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI ChangeClipboardChain(_In_ HWND, _In_ HWND)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION clipboard_cs
Definition: clipboard.c:893
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define ok(value,...)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
smooth NULL
Definition: ftsmooth.c:416
static UINT wm_destroyclipboard
Definition: clipboard.c:897
#define CF_TEXT
Definition: constants.h:396
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
static HWND next_wnd
Definition: clipboard.c:894
#define WAIT_OBJECT_0
Definition: winbase.h:387
DWORD WINAPI InSendMessageEx(LPVOID lpReserved)
Definition: message.c:1390
unsigned long DWORD
Definition: ntddk_ex.h:95
static UINT nb_formats
Definition: clipboard.c:899
int ret
static HGLOBAL create_textA(void)
Definition: clipboard.c:489
#define WM_DRAWCLIPBOARD
Definition: winuser.h:1830
static UINT old_seq
Definition: clipboard.c:1004
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1856
EXTINLINE DWORD WINAPI GetClipboardSequenceNumber(VOID)
Definition: ntwrapper.h:202
HWND WINAPI GetClipboardOwner(void)
Definition: ntwrapper.h:196
unsigned int UINT
Definition: ndis.h:50
static UINT wm_renderformat
Definition: clipboard.c:898
#define msg(x)
Definition: auth_time.c:54
#define WM_DESTROYCLIPBOARD
Definition: winuser.h:1829
static UINT wm_clipboardupdate
Definition: clipboard.c:896
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
LONG_PTR LRESULT
Definition: windef.h:209
#define INFINITE
Definition: serial.h:102
int WINAPI CountClipboardFormats(void)
Definition: ntwrapper.h:184
static BOOL do_render_format
Definition: clipboard.c:901
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
static UINT wm_drawclipboard
Definition: clipboard.c:895

Referenced by test_messages().

◆ create_bitmap()

static HBITMAP create_bitmap ( void  )
static

Definition at line 534 of file clipboard.c.

535 {
536  HDC hdc = GetDC( 0 );
538  ReleaseDC( 0, hdc );
539  return CreateBitmap( 10, 10, 1, bpp, NULL );
540 }
#define BITSPIXEL
Definition: wingdi.h:719
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
unsigned int UINT
Definition: ndis.h:50
DWORD bpp
Definition: surface.c:181
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by test_synthesized().

◆ create_dib()

static HBITMAP create_dib ( BOOL  v5)
static

Definition at line 542 of file clipboard.c.

543 {
544  HANDLE ret;
546 
548  sizeof(BITMAPV5HEADER) + 256 * sizeof(RGBQUAD) + 16 * 16 * 4 );
549  hdr = GlobalLock( ret );
550  hdr->biSize = v5 ? sizeof(BITMAPV5HEADER) : sizeof(*hdr);
551  hdr->biWidth = 16;
552  hdr->biHeight = 16;
553  hdr->biPlanes = 1;
554  hdr->biBitCount = 32;
555  hdr->biCompression = BI_RGB;
556  if (v5)
557  {
558  BITMAPV5HEADER *hdr5 = (BITMAPV5HEADER *)hdr;
559  hdr5->bV5RedMask = 0x0000ff;
560  hdr5->bV5GreenMask = 0x00ff00;
561  hdr5->bV5BlueMask = 0xff0000;
562  hdr5->bV5AlphaMask = 0xff000000;
563  }
564  GlobalUnlock( ret );
565  return ret;
566 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
char hdr[14]
Definition: iptest.cpp:33
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
#define BI_RGB
Definition: precomp.h:35
#define GMEM_MOVEABLE
Definition: winbase.h:291
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by test_synthesized().

◆ create_emf()

static HENHMETAFILE create_emf ( void  )
static

Definition at line 526 of file clipboard.c.

527 {
528  const RECT rect = {0, 0, 100, 100};
529  HDC hdc = CreateEnhMetaFileA(NULL, NULL, &rect, "HENHMETAFILE Ole Clipboard Test\0Test\0\0");
530  ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rect, "Test String", strlen("Test String"), NULL);
531  return CloseEnhMetaFile(hdc);
532 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static HDC
Definition: imagelist.c:92
& rect
Definition: startmenu.cpp:1413
#define ETO_OPAQUE
Definition: wingdi.h:646
smooth NULL
Definition: ftsmooth.c:416
HDC WINAPI CreateEnhMetaFileA(_In_opt_ HDC, _In_opt_ LPCSTR, _In_opt_ LPCRECT, _In_opt_ LPCSTR)
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
HDC hdc
Definition: main.c:9
BOOL WINAPI ExtTextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)

Referenced by test_data_handles(), and test_synthesized().

◆ create_metafile()

static HANDLE create_metafile ( void  )
static

Definition at line 508 of file clipboard.c.

509 {
510  const RECT rect = {0, 0, 100, 100};
511  METAFILEPICT *pict;
512  HANDLE ret;
513  HMETAFILE mf;
515  ExtTextOutA( hdc, 0, 0, ETO_OPAQUE, &rect, "Test String", strlen("Test String"), NULL );
516  mf = CloseMetaFile( hdc );
517  ret = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(*pict) );
518  pict = GlobalLock( ret );
519  pict->mm = MM_TEXT;
520  pict->xExt = pict->yExt = 100;
521  pict->hMF = mf;
522  GlobalUnlock( ret );
523  return ret;
524 }
HMETAFILE hMF
Definition: wingdi.h:2586
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HDC WINAPI CreateMetaFileA(_In_opt_ LPCSTR)
static HDC
Definition: imagelist.c:92
& rect
Definition: startmenu.cpp:1413
#define ETO_OPAQUE
Definition: wingdi.h:646
smooth NULL
Definition: ftsmooth.c:416
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
int ret
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HDC hdc
Definition: main.c:9
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL WINAPI ExtTextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define GMEM_DDESHARE
Definition: winbase.h:295
#define MM_TEXT
Definition: wingdi.h:872
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by test_data_handles(), and test_synthesized().

◆ create_textA()

static HGLOBAL create_textA ( void  )
static

Definition at line 489 of file clipboard.c.

490 {
492  char *p = GlobalLock(h);
493  memcpy(p, "test\0\0\0\0\0", 10);
494  GlobalUnlock(h);
495  return h;
496 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
GLfloat GLfloat p
Definition: glext.h:8902
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by clipboard_thread(), clipboard_wnd_proc(), test_data_handles(), test_handles(), and test_synthesized().

◆ create_textW()

static HGLOBAL create_textW ( void  )
static

Definition at line 498 of file clipboard.c.

499 {
500  static const WCHAR testW[] = {'t','e','s','t',0,0,0,0,0,0};
502  WCHAR *p = GlobalLock(h);
503  memcpy(p, testW, sizeof(testW));
504  GlobalUnlock(h);
505  return h;
506 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
GLfloat GLfloat p
Definition: glext.h:8902
#define GMEM_MOVEABLE
Definition: winbase.h:291
static const WCHAR testW[]
Definition: jsregexp.c:44

Referenced by clipboard_render_data_thread(), and test_synthesized().

◆ empty_clipboard_thread()

static DWORD WINAPI empty_clipboard_thread ( LPVOID  arg)
static

Definition at line 47 of file clipboard.c.

48 {
49  SetLastError( 0xdeadbeef );
50  ok(!EmptyClipboard(), "%u: EmptyClipboard succeeded\n", thread_from_line );
51  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
53  return 0;
54 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ok(value,...)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
static int thread_from_line
Definition: clipboard.c:37
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CLIPBOARD_NOT_OPEN
Definition: winerror.h:899

Referenced by test_ClipboardOwner().

◆ get_clipboard_data_process()

static void get_clipboard_data_process ( void  )
static

Definition at line 991 of file clipboard.c.

992 {
993  HANDLE data;
994  BOOL r;
995 
996  r = OpenClipboard(0);
997  ok(r, "OpenClipboard failed: %d\n", GetLastError());
999  ok( data != NULL, "GetClipboardData failed: %d\n", GetLastError());
1000  r = CloseClipboard();
1001  ok(r, "CloseClipboard failed: %d\n", GetLastError());
1002 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178

Referenced by START_TEST().

◆ grab_clipboard_process()

static void grab_clipboard_process ( int  arg)
static

Definition at line 128 of file clipboard.c.

129 {
130  BOOL ret;
131 
132  SetLastError( 0xdeadbeef );
133  ret = OpenClipboard( 0 );
134  ok( ret, "OpenClipboard failed\n" );
135  ret = EmptyClipboard();
136  ok( ret, "EmptyClipboard failed\n" );
137  if (arg)
138  {
140  ok( ret != 0, "process %u: SetClipboardData failed err %u\n", arg, GetLastError() );
141  }
142 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define SetLastError(x)
Definition: compat.h:409
int ret
#define CF_WAVE
Definition: constants.h:407
#define GMEM_DDESHARE
Definition: winbase.h:295
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by START_TEST().

◆ is_fixed()

static BOOL is_fixed ( HANDLE  handle)
static

Definition at line 1331 of file clipboard.c.

1332 {
1333  void *ptr = GlobalLock( handle );
1334  if (ptr) GlobalUnlock( handle );
1335  return ptr && ptr == handle;
1336 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static PVOID ptr
Definition: dispmode.c:27
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by test_data_handles(), test_handles(), test_handles_process(), and test_handles_thread2().

◆ is_freed()

static BOOL is_freed ( HANDLE  handle)
static

Definition at line 1338 of file clipboard.c.

1339 {
1340  return !GlobalSize( handle );
1341 }
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090

Referenced by test_data_handles(), and test_handles().

◆ is_moveable()

static BOOL is_moveable ( HANDLE  handle)
static

Definition at line 1324 of file clipboard.c.

1325 {
1326  void *ptr = GlobalLock( handle );
1327  if (ptr) GlobalUnlock( handle );
1328  return ptr && ptr != handle;
1329 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static PVOID ptr
Definition: dispmode.c:27
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by test_data_handles(), test_handles(), test_handles_process_open(), and test_handles_thread2().

◆ open_and_empty_clipboard_thread()

static DWORD WINAPI open_and_empty_clipboard_thread ( LPVOID  arg)
static

Definition at line 56 of file clipboard.c.

57 {
58  HWND hWnd = arg;
59  ok(OpenClipboard(hWnd), "%u: OpenClipboard failed\n", thread_from_line);
60  ok(EmptyClipboard(), "%u: EmptyClipboard failed\n", thread_from_line );
61  return 0;
62 }
HWND hWnd
Definition: settings.c:17
void * arg
Definition: msvc.h:12
#define ok(value,...)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
static int thread_from_line
Definition: clipboard.c:37

Referenced by test_ClipboardOwner().

◆ open_and_empty_clipboard_win_thread()

static DWORD WINAPI open_and_empty_clipboard_win_thread ( LPVOID  arg)
static

Definition at line 64 of file clipboard.c.

65 {
66  HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL );
67  ok(OpenClipboard(hwnd), "%u: OpenClipboard failed\n", thread_from_line);
68  ok(EmptyClipboard(), "%u: EmptyClipboard failed\n", thread_from_line );
69  return 0;
70 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
static int thread_from_line
Definition: clipboard.c:37
#define WS_POPUP
Definition: pedump.c:616

Referenced by test_ClipboardOwner().

◆ open_clipboard_thread()

static DWORD WINAPI open_clipboard_thread ( LPVOID  arg)
static

Definition at line 40 of file clipboard.c.

41 {
42  HWND hWnd = arg;
43  ok(OpenClipboard(hWnd), "%u: OpenClipboard failed\n", thread_from_line);
44  return 0;
45 }
HWND hWnd
Definition: settings.c:17
void * arg
Definition: msvc.h:12
#define ok(value,...)
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
static int thread_from_line
Definition: clipboard.c:37

Referenced by test_ClipboardOwner().

◆ renderer_winproc()

static LRESULT CALLBACK renderer_winproc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 568 of file clipboard.c.

569 {
570  static UINT rendered;
571  UINT ret;
572 
573  switch (msg)
574  {
575  case WM_RENDERFORMAT:
576  if (wp < 32) rendered |= (1 << wp);
577  break;
578  case WM_USER:
579  ret = rendered;
580  rendered = 0;
581  return ret;
582  }
583  return DefWindowProcA( hwnd, msg, wp, lp );
584 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_RENDERFORMAT
Definition: winuser.h:1827
int ret
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1856
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54

Referenced by test_synthesized().

◆ run_process()

static void run_process ( const char args)
static

Definition at line 166 of file clipboard.c.

167 {
168  char cmd[MAX_PATH];
171 
172  sprintf( cmd, "%s clipboard %s", argv0, args );
173  memset( &startup, 0, sizeof(startup) );
174  startup.cb = sizeof(startup);
176  "CreateProcess %s failed\n", cmd );
177 
178  winetest_wait_child_process( info.hProcess );
179  CloseHandle( info.hProcess );
180  CloseHandle( info.hThread );
181 }
#define CloseHandle
Definition: compat.h:398
Definition: ftp_var.h:139
int startup(int argc, const char *argv[])
Definition: startup.c:430
Definition: match.c:390
struct _test_info info[]
Definition: SetCursorPos.c:19
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4772
#define MAX_PATH
Definition: compat.h:26
static char * argv0
Definition: clipboard.c:38
void winetest_wait_child_process(HANDLE process)
#define memset(x, y, z)
Definition: compat.h:39

Referenced by clipboard_thread(), test_ClipboardOwner(), test_data_handles(), and test_string_data().

◆ run_thread()

static void run_thread ( LPTHREAD_START_ROUTINE  func,
void arg,
int  line 
)
static

Definition at line 144 of file clipboard.c.

145 {
146  DWORD ret;
147  HANDLE thread;
148 
150  thread = CreateThread(NULL, 0, func, arg, 0, NULL);
151  ok(thread != NULL, "%u: CreateThread failed with error %d\n", line, GetLastError());
152  for (;;)
153  {
155  if (ret == WAIT_OBJECT_0 + 1)
156  {
157  MSG msg;
158  while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
159  }
160  else break;
161  }
162  ok(ret == WAIT_OBJECT_0, "%u: expected WAIT_OBJECT_0, got %u\n", line, ret);
164 }
GLenum func
Definition: glext.h:6028
#define CloseHandle
Definition: compat.h:398
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define ok(value,...)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
static int thread_from_line
Definition: clipboard.c:37
static HANDLE thread
Definition: service.c:33
int ret
char line[200]
Definition: main.c:97
#define QS_ALLINPUT
Definition: winuser.h:874
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_ClipboardOwner(), and test_data_handles().

◆ set_clipboard_data_process()

static void set_clipboard_data_process ( int  arg)
static

Definition at line 104 of file clipboard.c.

105 {
106  HANDLE ret;
107 
108  SetLastError( 0xdeadbeef );
109  if (arg)
110  {
111  ok( IsClipboardFormatAvailable( CF_WAVE ), "process %u: CF_WAVE not available\n", arg );
113  ok( ret != 0, "process %u: SetClipboardData failed err %u\n", arg, GetLastError() );
114  }
115  else
116  {
118  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "process %u: wrong error %u\n",
119  arg, GetLastError());
120  ok( !IsClipboardFormatAvailable( CF_WAVE ), "process %u: SetClipboardData succeeded\n", arg );
122  ok( !ret, "process %u: SetClipboardData succeeded\n", arg );
123  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "process %u: wrong error %u\n",
124  arg, GetLastError());
125  }
126 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ok(value,...)
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
#define SetLastError(x)
Definition: compat.h:409
int ret
#define CF_WAVE
Definition: constants.h:407
#define ERROR_CLIPBOARD_NOT_OPEN
Definition: winerror.h:899
#define GMEM_DDESHARE
Definition: winbase.h:295
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by START_TEST().

◆ set_clipboard_data_thread()

static DWORD WINAPI set_clipboard_data_thread ( LPVOID  arg)
static

Definition at line 72 of file clipboard.c.

73 {
74  HWND hwnd = arg;
75  HANDLE ret;
76 
77  SetLastError( 0xdeadbeef );
78  if (GetClipboardOwner() == hwnd)
79  {
81  ok( IsClipboardFormatAvailable( CF_WAVE ), "%u: SetClipboardData failed\n", thread_from_line );
83  ok( ret != 0, "%u: SetClipboardData failed err %u\n", thread_from_line, GetLastError() );
84  SetLastError( 0xdeadbeef );
86  ok( !ret, "%u: GetClipboardData succeeded\n", thread_from_line );
87  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
89  }
90  else
91  {
93  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
95  ok( !IsClipboardFormatAvailable( CF_WAVE ), "%u: SetClipboardData succeeded\n", thread_from_line );
97  ok( !ret, "%u: SetClipboardData succeeded\n", thread_from_line );
98  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
100  }
101  return 0;
102 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
void * arg
Definition: msvc.h:12
#define ok(value,...)
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
static int thread_from_line
Definition: clipboard.c:37
#define SetLastError(x)
Definition: compat.h:409
int ret
#define CF_WAVE
Definition: constants.h:407
#define ERROR_CLIPBOARD_NOT_OPEN
Definition: winerror.h:899
HWND WINAPI GetClipboardOwner(void)
Definition: ntwrapper.h:196
#define GMEM_DDESHARE
Definition: winbase.h:295
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by test_ClipboardOwner().

◆ START_TEST()

START_TEST ( clipboard  )

Definition at line 2150 of file clipboard.c.

2151 {
2152  char **argv;
2153  int argc = winetest_get_mainargs( &argv );
2154  HMODULE mod = GetModuleHandleA( "user32" );
2155 
2156  argv0 = argv[0];
2157  pAddClipboardFormatListener = (void *)GetProcAddress( mod, "AddClipboardFormatListener" );
2158  pRemoveClipboardFormatListener = (void *)GetProcAddress( mod, "RemoveClipboardFormatListener" );
2159  pGetUpdatedClipboardFormats = (void *)GetProcAddress( mod, "GetUpdatedClipboardFormats" );
2160 
2161  if (argc == 4 && !strcmp( argv[2], "set_clipboard_data" ))
2162  {
2164  return;
2165  }
2166  if (argc == 4 && !strcmp( argv[2], "grab_clipboard" ))
2167  {
2169  return;
2170  }
2171  if (argc == 4 && !strcmp( argv[2], "handles" ))
2172  {
2173  test_handles_process( argv[3] );
2174  return;
2175  }
2176  if (argc == 4 && !strcmp( argv[2], "handles_open" ))
2177  {
2179  return;
2180  }
2181  if (argc == 4 && !strcmp( argv[2], "handles_dib" ))
2182  {
2184  return;
2185  }
2186  if (argc == 4 && !strcmp( argv[2], "string_data" ))
2187  {
2189  return;
2190  }
2191  if (argc == 3 && !strcmp( argv[2], "get_clipboard_data" ))
2192  {
2194  return;
2195  }
2196 
2199  test_synthesized();
2200  test_messages();
2203  test_string_data();
2204 }
static void get_clipboard_data_process(void)
Definition: clipboard.c:991
static int argc
Definition: ServiceArgs.c:12
static void set_clipboard_data_process(int arg)
Definition: clipboard.c:104
static void test_synthesized(void)
Definition: clipboard.c:586
#define argv
Definition: mplay32.c:18
static void grab_clipboard_process(int arg)
Definition: clipboard.c:128
static void test_handles_process_dib(const char *str)
Definition: clipboard.c:1778
static void test_data_handles(void)
Definition: clipboard.c:1792
static void test_handles_process(const char *str)
Definition: clipboard.c:1678
static void test_GetUpdatedClipboardFormats(void)
Definition: clipboard.c:1916
static void test_messages(void)
Definition: clipboard.c:1277
static char * argv0
Definition: clipboard.c:38
int winetest_get_mainargs(char ***pargv)
static void test_handles_process_open(const char *str)
Definition: clipboard.c:1764
static void test_ClipboardOwner(void)
Definition: clipboard.c:226
static void test_string_data(void)
Definition: clipboard.c:2048
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_RegisterClipboardFormatA(void)
Definition: clipboard.c:373
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define GetProcAddress(x, y)
Definition: compat.h:410
static void test_string_data_process(int i)
Definition: clipboard.c:2093
static int mod
Definition: i386-dis.c:1273

◆ test_ClipboardOwner()

static void test_ClipboardOwner ( void  )
static

Definition at line 226 of file clipboard.c.

227 {
228  HWND hWnd1, hWnd2;
229  BOOL ret;
230 
231  SetLastError(0xdeadbeef);
232  ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef,
233  "could not perform clipboard test: clipboard already owned\n");
234 
235  hWnd1 = CreateWindowExA(0, "static", NULL, WS_POPUP,
236  0, 0, 10, 10, 0, 0, 0, NULL);
237  ok(hWnd1 != 0, "CreateWindowExA error %d\n", GetLastError());
238  trace("hWnd1 = %p\n", hWnd1);
239 
240  hWnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP,
241  0, 0, 10, 10, 0, 0, 0, NULL);
242  ok(hWnd2 != 0, "CreateWindowExA error %d\n", GetLastError());
243  trace("hWnd2 = %p\n", hWnd2);
244 
245  SetLastError(0xdeadbeef);
246  ok(!CloseClipboard(), "CloseClipboard should fail if clipboard wasn't open\n");
247  ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
248  "wrong error %u\n", GetLastError());
249 
250  ok(OpenClipboard(0), "OpenClipboard failed\n");
251  ok(!GetClipboardOwner(), "clipboard should still be not owned\n");
252  ok(!OpenClipboard(hWnd1), "OpenClipboard should fail since clipboard already opened\n");
253  ok(OpenClipboard(0), "OpenClipboard again failed\n");
254  ret = CloseClipboard();
255  ok( ret, "CloseClipboard error %d\n", GetLastError());
256 
257  ok(OpenClipboard(hWnd1), "OpenClipboard failed\n");
258  run_thread( open_clipboard_thread, hWnd1, __LINE__ );
259  run_thread( empty_clipboard_thread, 0, __LINE__ );
261  ok( !IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE available\n" );
262  ok( !GetClipboardData( CF_WAVE ), "CF_WAVE data available\n" );
263  run_process( "set_clipboard_data 0" );
264  ok(!CloseClipboard(), "CloseClipboard should fail if clipboard wasn't open\n");
265  ok(OpenClipboard(hWnd1), "OpenClipboard failed\n");
266 
267  SetLastError(0xdeadbeef);
269  ok(!ret && (GetLastError() == 0xdeadbeef || GetLastError() == ERROR_ACCESS_DENIED),
270  "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %d\n", GetLastError());
271 
272  SetLastError(0xdeadbeef);
273  ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should still be not owned\n");
274  ret = EmptyClipboard();
275  ok( ret, "EmptyClipboard error %d\n", GetLastError());
276  ok(GetClipboardOwner() == hWnd1, "clipboard should be owned by %p, not by %p\n", hWnd1, GetClipboardOwner());
277  run_thread( empty_clipboard_thread, 0, __LINE__ );
279  ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
280  ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
281  run_process( "set_clipboard_data 1" );
282 
283  SetLastError(0xdeadbeef);
285  ok(!ret && (GetLastError() == 0xdeadbeef || GetLastError() == ERROR_ACCESS_DENIED),
286  "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %d\n", GetLastError());
287 
288  ret = CloseClipboard();
289  ok( ret, "CloseClipboard error %d\n", GetLastError());
290  ok(GetClipboardOwner() == hWnd1, "clipboard should still be owned\n");
291 
292  /* any window will do, even from a different process */
294  ok( ret, "OpenClipboard error %d\n", GetLastError());
295  ret = EmptyClipboard();
296  ok( ret, "EmptyClipboard error %d\n", GetLastError());
297  ok( GetClipboardOwner() == GetDesktopWindow(), "wrong owner %p/%p\n",
300  ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
301  ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
302  run_process( "set_clipboard_data 2" );
303  ret = CloseClipboard();
304  ok( ret, "CloseClipboard error %d\n", GetLastError());
305 
306  ret = OpenClipboard( hWnd1 );
307  ok( ret, "OpenClipboard error %d\n", GetLastError());
308  ret = EmptyClipboard();
309  ok( ret, "EmptyClipboard error %d\n", GetLastError());
312  ok( GetClipboardOwner() == hWnd1, "wrong owner %p/%p\n", GetClipboardOwner(), hWnd1 );
313  ok( GetClipboardViewer() == hWnd1, "wrong viewer %p/%p\n", GetClipboardViewer(), hWnd1 );
314  ok( GetOpenClipboardWindow() == hWnd1, "wrong open win %p/%p\n", GetOpenClipboardWindow(), hWnd1 );
315  ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
316 
319  ok( ret, "DestroyWindow error %d\n", GetLastError());
321  ok( ret, "DestroyWindow error %d\n", GetLastError());
322  SetLastError(0xdeadbeef);
323  ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should not be owned\n");
324  ok(!GetClipboardViewer() && GetLastError() == 0xdeadbeef, "viewer still exists\n");
325  ok(!GetOpenClipboardWindow() && GetLastError() == 0xdeadbeef, "clipboard should not be open\n");
326  ok( !IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE available\n" );
327 
328  SetLastError( 0xdeadbeef );
329  ret = CloseClipboard();
330  ok( !ret, "CloseClipboard succeeded\n" );
331  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
332 
333  ret = OpenClipboard( 0 );
334  ok( ret, "OpenClipboard error %d\n", GetLastError());
335  run_thread( set_clipboard_data_thread, 0, __LINE__ );
336  ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
337  ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
338  run_process( "set_clipboard_data 3" );
339  ret = CloseClipboard();
340  ok( ret, "CloseClipboard error %d\n", GetLastError());
341 
343  ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
344  ok( !GetClipboardOwner(), "wrong owner window %p\n", GetClipboardOwner() );
345 
346  ret = OpenClipboard( 0 );
347  ok( ret, "OpenClipboard error %d\n", GetLastError());
348  run_thread( set_clipboard_data_thread, 0, __LINE__ );
349  ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
350  ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
351  run_process( "set_clipboard_data 4" );
352  ret = EmptyClipboard();
353  ok( ret, "EmptyClipboard error %d\n", GetLastError());
354  ret = CloseClipboard();
355  ok( ret, "CloseClipboard error %d\n", GetLastError());
356 
357  SetLastError( 0xdeadbeef );
359  "SetClipboardData succeeded\n" );
360  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
361  ok( !IsClipboardFormatAvailable( CF_WAVE ), "SetClipboardData succeeded\n" );
362 
364  ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
365  ok( GetClipboardOwner() == GetDesktopWindow(), "wrong owner window %p / %p\n",
367 
369  ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
370  ok( !GetClipboardOwner(), "wrong owner window %p\n", GetClipboardOwner() );
371 }
#define trace(...)
Definition: kmt_test.h:217
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HWND WINAPI SetClipboardViewer(_In_ HWND)
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
HWND WINAPI GetOpenClipboardWindow(void)
Definition: ntwrapper.h:214
static DWORD WINAPI open_and_empty_clipboard_thread(LPVOID arg)
Definition: clipboard.c:56
static DWORD WINAPI empty_clipboard_thread(LPVOID arg)
Definition: clipboard.c:47
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HWND hWnd1
Definition: button.c:416
BOOL WINAPI DestroyWindow(_In_ HWND)
static WNDPROC old_proc
Definition: clipboard.c:183
static void run_thread(LPTHREAD_START_ROUTINE func, void *arg, int line)
Definition: clipboard.c:144
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD WINAPI set_clipboard_data_thread(LPVOID arg)
Definition: clipboard.c:72
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
static DWORD WINAPI open_and_empty_clipboard_win_thread(LPVOID arg)
Definition: clipboard.c:64
HWND hWnd2
Definition: button.c:416
static LRESULT CALLBACK winproc_wrapper(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: clipboard.c:184
#define SetLastError(x)
Definition: compat.h:409
static DWORD WINAPI open_clipboard_thread(LPVOID arg)
Definition: clipboard.c:40
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
int ret
static void run_process(const char *args)
Definition: clipboard.c:166
#define SetWindowLongPtrA
Definition: winuser.h:5214
#define CF_WAVE
Definition: constants.h:407
#define GWLP_WNDPROC
Definition: treelist.c:66
#define broken(x)
Definition: _sntprintf.h:21
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
#define ERROR_CLIPBOARD_NOT_OPEN
Definition: winerror.h:899
HWND WINAPI GetClipboardOwner(void)
Definition: ntwrapper.h:196
HWND WINAPI GetClipboardViewer(void)
Definition: ntwrapper.h:208
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_POPUP
Definition: pedump.c:616
#define GMEM_DDESHARE
Definition: winbase.h:295
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by START_TEST().

◆ test_data_handles()

static void test_data_handles ( void  )
static

Definition at line 1792 of file clipboard.c.

1793 {
1794  BOOL r;
1795  char *ptr;
1796  HANDLE h, text;
1797  HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL );
1798  BITMAPINFO bmi;
1799  void *bits;
1800 
1801  ok( hwnd != 0, "window creation failed\n" );
1802  format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" );
1803  test_handles( 0 );
1805  test_handles( hwnd );
1806  run_thread( test_handles_thread, hwnd, __LINE__ );
1807 
1808  bitmap = CreateBitmap( 13, 17, 1, 1, NULL );
1809  bitmap2 = CreateBitmap( 10, 10, 1, 1, NULL );
1811 
1812  r = OpenClipboard( hwnd );
1813  ok( r, "gle %d\n", GetLastError() );
1814  r = EmptyClipboard();
1815  ok( r, "gle %d\n", GetLastError() );
1817  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1819  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1821  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1823  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1825  ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h );
1827  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1828  trace( "metafile %p\n", h );
1830  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1831  trace( "metafile2 %p\n", h );
1833  ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h );
1834  trace( "enhmetafile %p\n", h );
1836  ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h );
1837  trace( "enhmetafile2 %p\n", h );
1839  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1841  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1842  r = CloseClipboard();
1843  ok( r, "gle %d\n", GetLastError() );
1844 
1845  run_thread( test_handles_thread2, 0, __LINE__ );
1846  run_process( "handles test" );
1847 
1848  r = OpenClipboard( hwnd );
1849  ok( r, "gle %d\n", GetLastError() );
1850  h = GetClipboardData( CF_TEXT );
1851  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1853  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1855  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1857  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1858 
1859  r = EmptyClipboard();
1860  ok( r, "gle %d\n", GetLastError() );
1861  text = create_textA();
1863  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1864 
1865  run_process( "handles_open foobar" );
1866 
1867  ok( is_moveable( text ), "expected moveable mem %p\n", text );
1868  h = GetClipboardData( CF_TEXT );
1869  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1870  ok( is_moveable( text ), "expected moveable mem %p\n", text );
1871  ptr = GlobalLock( h );
1872  ok( !strcmp( ptr, "foobar" ), "wrong data '%.8s'\n", ptr );
1873  GlobalUnlock( h );
1874 
1875  r = EmptyClipboard();
1876  ok( r, "gle %d\n", GetLastError() );
1877  ok( is_fixed( h ), "expected free mem %p\n", h );
1878  ok( is_freed( text ) || broken( is_moveable(text) ), /* w2003, w2008 */
1879  "expected free mem %p\n", text );
1880  r = CloseClipboard();
1881  ok( r, "gle %d\n", GetLastError() );
1882 
1883  /* test CF_BITMAP with a DIB section */
1884  memset( &bmi, 0, sizeof(bmi) );
1885  bmi.bmiHeader.biSize = sizeof( bmi.bmiHeader );
1886  bmi.bmiHeader.biWidth = 29;
1887  bmi.bmiHeader.biHeight = 13;
1888  bmi.bmiHeader.biPlanes = 1;
1889  bmi.bmiHeader.biBitCount = 32;
1890  bitmap = CreateDIBSection( 0, &bmi, DIB_RGB_COLORS, &bits, 0, 0 );
1891 
1892  r = OpenClipboard( hwnd );
1893  ok( r, "gle %d\n", GetLastError() );
1894  r = EmptyClipboard();
1895  ok( r, "gle %d\n", GetLastError() );
1897  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1898  trace( "dibsection %p\n", h );
1899  r = CloseClipboard();
1900  ok( r, "gle %d\n", GetLastError() );
1901 
1902  run_process( "handles_dib dummy" );
1903 
1904  r = OpenClipboard( hwnd );
1905  ok( r, "gle %d\n", GetLastError() );
1906  ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap );
1907  r = EmptyClipboard();
1908  ok( r, "gle %d\n", GetLastError() );
1909  ok( !GetObjectType( bitmap ), "expected deleted %p\n", bitmap );
1910  r = CloseClipboard();
1911  ok( r, "gle %d\n", GetLastError() );
1912 
1913  DestroyWindow( hwnd );
1914 }
static void test_handles(HWND hwnd)
Definition: clipboard.c:1348
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const LOGPALETTE logpalette
Definition: clipboard.c:1346
#define trace(...)
Definition: kmt_test.h:217
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
#define CF_ENHMETAFILE
Definition: constants.h:409
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const WCHAR * text
Definition: package.c:1827
#define CF_DSPMETAFILEPICT
Definition: constants.h:416
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CF_METAFILEPICT
Definition: constants.h:398
BOOL WINAPI DestroyWindow(_In_ HWND)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static HANDLE create_metafile(void)
Definition: clipboard.c:508
static void run_thread(LPTHREAD_START_ROUTINE func, void *arg, int line)
Definition: clipboard.c:144
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
#define CF_GDIOBJFIRST
Definition: constants.h:420
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD WINAPI test_handles_thread(void *arg)
Definition: clipboard.c:1620
static PVOID ptr
Definition: dispmode.c:27
#define CF_DSPENHMETAFILE
Definition: constants.h:417
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define CF_TEXT
Definition: constants.h:396
Definition: uimain.c:88
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
#define CF_DSPBITMAP
Definition: constants.h:415
#define OBJ_PAL
Definition: objidl.idl:1413
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
static HGLOBAL create_textA(void)
Definition: clipboard.c:489
static BOOL is_moveable(HANDLE handle)
Definition: clipboard.c:1324
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
static void run_process(const char *args)
Definition: clipboard.c:166
#define CF_PALETTE
Definition: constants.h:404
UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat)
Definition: clipboard.c:92
static HPALETTE palette
Definition: clipboard.c:1345
#define broken(x)
Definition: _sntprintf.h:21
static BOOL is_freed(HANDLE handle)
Definition: clipboard.c:1338
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define WS_POPUP
Definition: pedump.c:616
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
static DWORD WINAPI test_handles_thread2(void *arg)
Definition: clipboard.c:1627
#define CF_PRIVATEFIRST
Definition: constants.h:418
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static HENHMETAFILE create_emf(void)
Definition: clipboard.c:526
static UINT format_id
Definition: clipboard.c:1343
#define DIB_RGB_COLORS
Definition: wingdi.h:366
static HBITMAP bitmap2
Definition: clipboard.c:1344
#define memset(x, y, z)
Definition: compat.h:39
static BOOL is_fixed(HANDLE handle)
Definition: clipboard.c:1331
#define OBJ_BITMAP
Definition: objidl.idl:1415
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_GetUpdatedClipboardFormats()

static void test_GetUpdatedClipboardFormats ( void  )
static

Definition at line 1916 of file clipboard.c.

1917 {
1918  BOOL r;
1919  UINT count, formats[256];
1920 
1921  if (!pGetUpdatedClipboardFormats)
1922  {
1923  win_skip( "GetUpdatedClipboardFormats not supported\n" );
1924  return;
1925  }
1926 
1927  count = 0xdeadbeef;
1928  r = pGetUpdatedClipboardFormats( NULL, 0, &count );
1929  ok( r, "gle %d\n", GetLastError() );
1930  ok( !count, "wrong count %u\n", count );
1931 
1932  count = 0xdeadbeef;
1933  r = pGetUpdatedClipboardFormats( NULL, 256, &count );
1934  ok( r, "gle %d\n", GetLastError() );
1935  ok( !count, "wrong count %u\n", count );
1936 
1937  SetLastError( 0xdeadbeef );
1938  r = pGetUpdatedClipboardFormats( formats, 256, NULL );
1939  ok( !r, "succeeded\n" );
1940  ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
1941 
1942  count = 0xdeadbeef;
1943  r = pGetUpdatedClipboardFormats( formats, 256, &count );
1944  ok( r, "gle %d\n", GetLastError() );
1945  ok( !count, "wrong count %u\n", count );
1946 
1947  r = OpenClipboard( 0 );
1948  ok( r, "gle %d\n", GetLastError() );
1949  r = EmptyClipboard();
1950  ok( r, "gle %d\n", GetLastError() );
1951 
1952  count = 0xdeadbeef;
1953  r = pGetUpdatedClipboardFormats( formats, 256, &count );
1954  ok( r, "gle %d\n", GetLastError() );
1955  ok( !count, "wrong count %u\n", count );
1956 
1958 
1959  count = 0xdeadbeef;
1960  memset( formats, 0xcc, sizeof(formats) );
1961  r = pGetUpdatedClipboardFormats( formats, 256, &count );
1962  ok( r, "gle %d\n", GetLastError() );
1963  ok( count == 1, "wrong count %u\n", count );
1964  ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
1965  ok( formats[1] == 0xcccccccc, "wrong format %u\n", formats[1] );
1966 
1967  SetClipboardData( CF_TEXT, 0 );
1968  count = 0xdeadbeef;
1969  memset( formats, 0xcc, sizeof(formats) );
1970  r = pGetUpdatedClipboardFormats( formats, 256, &count );
1971  ok( r, "gle %d\n", GetLastError() );
1972  ok( count == 2, "wrong count %u\n", count );
1973  ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
1974  ok( formats[1] == CF_TEXT, "wrong format %u\n", formats[1] );
1975  ok( formats[2] == 0xcccccccc, "wrong format %u\n", formats[2] );
1976 
1977  SetLastError( 0xdeadbeef );
1978  count = 0xdeadbeef;
1979  r = pGetUpdatedClipboardFormats( formats, 0, &count );
1980  ok( !r, "succeeded\n" );
1981  ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
1982  ok( count == 2, "wrong count %u\n", count );
1983 
1984  SetLastError( 0xdeadbeef );
1985  count = 0xdeadbeef;
1986  r = pGetUpdatedClipboardFormats( formats, 1, &count );
1987  ok( !r, "succeeded\n" );
1988  ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
1989  ok( count == 2, "wrong count %u\n", count );
1990 
1991  r = CloseClipboard();
1992  ok( r, "gle %d\n", GetLastError() );
1993 
1994  count = 0xdeadbeef;
1995  memset( formats, 0xcc, sizeof(formats) );
1996  r = pGetUpdatedClipboardFormats( formats, 256, &count );
1997  ok( r, "gle %d\n", GetLastError() );
1998  ok( count == 4, "wrong count %u\n", count );
1999  ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
2000  ok( formats[1] == CF_TEXT, "wrong format %u\n", formats[1] );
2001  ok( formats[2] == CF_LOCALE, "wrong format %u\n", formats[2] );
2002  ok( formats[3] == CF_OEMTEXT, "wrong format %u\n", formats[3] );
2003  ok( formats[4] == 0xcccccccc, "wrong format %u\n", formats[4] );
2004 
2005  count = 0xdeadbeef;
2006  memset( formats, 0xcc, sizeof(formats) );
2007  r = pGetUpdatedClipboardFormats( formats, 2, &count );
2008  ok( !r, "gle %d\n", GetLastError() );
2009  ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
2010  ok( count == 4, "wrong count %u\n", count );
2011  ok( formats[0] == 0xcccccccc, "wrong format %u\n", formats[0] );
2012 
2013  count = 0xdeadbeef;
2014  r = pGetUpdatedClipboardFormats( NULL, 256, &count );
2015  ok( !r, "gle %d\n", GetLastError() );
2016  ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
2017  ok( count == 4, "wrong count %u\n", count );
2018 
2019  count = 0xdeadbeef;
2020  r = pGetUpdatedClipboardFormats( NULL, 256, &count );
2021  ok( !r, "gle %d\n", GetLastError() );
2022  ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
2023  ok( count == 4, "wrong count %u\n", count );
2024 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
static const struct pixel_format_desc formats[]
Definition: util.c:57
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_NOACCESS
Definition: winerror.h:578
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
static UINT count
Definition: clipboard.c:35
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define CF_LOCALE
Definition: constants.h:411
#define CF_OEMTEXT
Definition: constants.h:402
unsigned int UINT
Definition: ndis.h:50
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_handles()

static void test_handles ( HWND  hwnd)
static

Definition at line 1348 of file clipboard.c.

1349 {
1350  HGLOBAL h, htext, htext2, htext3, htext4, htext5;
1351  HGLOBAL hfixed, hfixed2, hmoveable, empty_fixed, empty_moveable;
1352  void *ptr;
1353  UINT format_id2 = RegisterClipboardFormatA( "another format" );
1354  BOOL r;
1355  HANDLE data;
1356  HBITMAP bitmap_temp;
1357  DWORD process;
1359 
1360  trace( "hwnd %p\n", hwnd );
1361  htext = create_textA();
1362  htext2 = create_textA();
1363  htext3 = create_textA();
1364  htext4 = create_textA();
1365  htext5 = create_textA();
1366  bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
1367  bitmap2 = CreateBitmap( 10, 10, 1, 1, NULL );
1369 
1370  hfixed = GlobalAlloc( GMEM_FIXED, 17 );
1371  hfixed2 = GlobalAlloc( GMEM_FIXED, 17 );
1372  ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
1373  ok( GlobalSize( hfixed ) == 17, "wrong size %lu\n", GlobalSize( hfixed ));
1374 
1375  hmoveable = GlobalAlloc( GMEM_MOVEABLE, 23 );
1376  ok( is_moveable( hmoveable ), "expected moveable mem %p\n", hmoveable );
1377  ok( GlobalSize( hmoveable ) == 23, "wrong size %lu\n", GlobalSize( hmoveable ));
1378 
1379  empty_fixed = GlobalAlloc( GMEM_FIXED, 0 );
1380  ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
1381 
1382  empty_moveable = GlobalAlloc( GMEM_MOVEABLE, 0 );
1383  /* discarded handles can't be GlobalLock'ed */
1384  ok( is_freed( empty_moveable ), "expected free mem %p\n", empty_moveable );
1385 
1386  r = OpenClipboard( hwnd );
1387  ok( r, "gle %d\n", GetLastError() );
1388  r = EmptyClipboard();
1389  ok( r, "gle %d\n", GetLastError() );
1390 
1391  h = SetClipboardData( CF_TEXT, htext );
1392  ok( h == htext, "got %p\n", h );
1393  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1394  h = SetClipboardData( format_id, htext2 );
1395  ok( h == htext2, "got %p\n", h );
1396  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1397  bitmap_temp = CreateBitmap( 10, 10, 1, 1, NULL );
1398  h = SetClipboardData( CF_BITMAP, bitmap_temp );
1399  ok( h == bitmap_temp, "got %p\n", h );
1400  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1402  ok( h == bitmap, "got %p\n", h );
1403  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1404  ok( !GetObjectType( bitmap_temp ), "expected free object %p\n", bitmap_temp );
1406  ok( h == bitmap2, "got %p\n", h );
1407  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1409  ok( h == palette, "got %p\n", h );
1410  ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h );
1411  h = SetClipboardData( CF_GDIOBJFIRST + 3, htext3 );
1412  ok( h == htext3, "got %p\n", h );
1413  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1414  h = SetClipboardData( CF_PRIVATEFIRST + 7, htext5 );
1415  ok( h == htext5, "got %p\n", h );
1416  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1417  h = SetClipboardData( format_id2, empty_moveable );
1418  ok( !h, "got %p\n", h );
1419  GlobalFree( empty_moveable );
1420 
1421  if (0) /* crashes on vista64 */
1422  {
1423  ptr = HeapAlloc( GetProcessHeap(), 0, 0 );
1424  h = SetClipboardData( format_id2, ptr );
1425  ok( !h, "got %p\n", h );
1426  HeapFree( GetProcessHeap(), 0, ptr );
1427  }
1428 
1429  h = SetClipboardData( format_id2, empty_fixed );
1430  ok( h == empty_fixed, "got %p\n", h );
1431  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1432  h = SetClipboardData( 0xdeadbeef, hfixed2 );
1433  ok( h == hfixed2, "got %p\n", h );
1434  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1435  h = SetClipboardData( 0xdeadbabe, hmoveable );
1436  ok( h == hmoveable, "got %p\n", h );
1437  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1438 
1439  ptr = HeapAlloc( GetProcessHeap(), 0, 37 );
1440  h = SetClipboardData( 0xdeadfade, ptr );
1441  ok( h == ptr || !h, "got %p\n", h );
1442  if (!h) /* heap blocks are rejected on >= win8 */
1443  {
1444  HeapFree( GetProcessHeap(), 0, ptr );
1445  ptr = NULL;
1446  }
1447 
1449  ok( data == htext, "wrong data %p\n", data );
1450  ok( is_moveable( data ), "expected moveable mem %p\n", data );
1451 
1453  ok( data == htext2, "wrong data %p, cf %08x\n", data, format_id );
1454  ok( is_moveable( data ), "expected moveable mem %p\n", data );
1455 
1457  ok( data == htext3, "wrong data %p\n", data );
1458  ok( is_moveable( data ), "expected moveable mem %p\n", data );
1459 
1461  ok( data == htext5, "wrong data %p\n", data );
1462  ok( is_moveable( data ), "expected moveable mem %p\n", data );
1463 
1464  data = GetClipboardData( format_id2 );
1465  ok( data == empty_fixed, "wrong data %p\n", data );
1466  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1467 
1468  data = GetClipboardData( 0xdeadbeef );
1469  ok( data == hfixed2, "wrong data %p\n", data );
1470  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1471 
1472  data = GetClipboardData( 0xdeadbabe );
1473  ok( data == hmoveable, "wrong data %p\n", data );
1474  ok( is_moveable( data ), "expected moveable mem %p\n", data );
1475 
1476  data = GetClipboardData( 0xdeadfade );
1477  ok( data == ptr, "wrong data %p\n", data );
1478 
1479  h = SetClipboardData( CF_PRIVATEFIRST + 7, htext4 );
1480  ok( h == htext4, "got %p\n", h );
1481  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1482  ok( is_freed( htext5 ), "expected freed mem %p\n", htext5 );
1483 
1484  h = SetClipboardData( 0xdeadbeef, hfixed );
1485  ok( h == hfixed, "got %p\n", h );
1486  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1487  if (0) /* this test is unreliable / crashes */
1488  ok( is_freed( hfixed2 ), "expected freed mem %p\n", hfixed2 );
1489 
1490  r = CloseClipboard();
1491  ok( r, "gle %d\n", GetLastError() );
1492 
1493  /* data handles are still valid */
1494  ok( is_moveable( htext ), "expected moveable mem %p\n", htext );
1495  ok( is_moveable( htext2 ), "expected moveable mem %p\n", htext2 );
1496  ok( is_moveable( htext3 ), "expected moveable mem %p\n", htext3 );
1497  ok( is_moveable( htext4 ), "expected moveable mem %p\n", htext4 );
1498  ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap );
1499  ok( GetObjectType( bitmap2 ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap2 );
1500  ok( GetObjectType( palette ) == OBJ_PAL, "expected palette %p\n", palette );
1501  ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
1502  ok( is_moveable( hmoveable ), "expected moveable mem %p\n", hmoveable );
1503  ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
1504 
1505  r = OpenClipboard( hwnd );
1506  ok( r, "gle %d\n", GetLastError() );
1507 
1508  /* and now they are freed, unless we are the owner */
1509  if (!is_owner)
1510  {
1511  ok( is_freed( htext ), "expected freed mem %p\n", htext );
1512  ok( is_freed( htext2 ), "expected freed mem %p\n", htext2 );
1513  ok( is_freed( htext3 ), "expected freed mem %p\n", htext3 );
1514  ok( is_freed( htext4 ), "expected freed mem %p\n", htext4 );
1515  ok( is_freed( hmoveable ), "expected freed mem %p\n", hmoveable );
1516 
1518  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1519 
1521  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1522 
1524  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1525 
1527  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1528 
1529  data = GetClipboardData( format_id2 );
1530  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1531  ok( GlobalSize( data ) == 1, "wrong size %lu\n", GlobalSize( data ));
1532 
1533  data = GetClipboardData( 0xdeadbeef );
1534  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1535  ok( GlobalSize( data ) == 17, "wrong size %lu\n", GlobalSize( data ));
1536 
1537  data = GetClipboardData( 0xdeadbabe );
1538  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1539  ok( GlobalSize( data ) == 23, "wrong size %lu\n", GlobalSize( data ));
1540 
1541  data = GetClipboardData( 0xdeadfade );
1542  ok( is_fixed( data ) || !ptr, "expected fixed mem %p\n", data );
1543  if (ptr) ok( GlobalSize( data ) == 37, "wrong size %lu\n", GlobalSize( data ));
1544  }
1545  else
1546  {
1547  ok( is_moveable( htext ), "expected moveable mem %p\n", htext );
1548  ok( is_moveable( htext2 ), "expected moveable mem %p\n", htext2 );
1549  ok( is_moveable( htext3 ), "expected moveable mem %p\n", htext3 );
1550  ok( is_moveable( htext4 ), "expected moveable mem %p\n", htext4 );
1551  ok( is_moveable( hmoveable ), "expected moveable mem %p\n", hmoveable );
1552 
1554  ok( data == htext, "wrong data %p\n", data );
1555 
1557  ok( data == htext2, "wrong data %p, cf %08x\n", data, format_id );
1558 
1560  ok( data == htext3, "wrong data %p\n", data );
1561 
1563  ok( data == htext4, "wrong data %p\n", data );
1564 
1565  data = GetClipboardData( format_id2 );
1566  ok( data == empty_fixed, "wrong data %p\n", data );
1567 
1568  data = GetClipboardData( 0xdeadbeef );
1569  ok( data == hfixed, "wrong data %p\n", data );
1570 
1571  data = GetClipboardData( 0xdeadbabe );
1572  ok( data == hmoveable, "wrong data %p\n", data );
1573 
1574  data = GetClipboardData( 0xdeadfade );
1575  ok( data == ptr, "wrong data %p\n", data );
1576  }
1577 
1579  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1581  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1583  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1585  ok( data == bitmap, "expected bitmap %p\n", data );
1587  ok( data == bitmap2, "expected bitmap %p\n", data );
1589  ok( data == palette, "expected palette %p\n", data );
1591  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1592  data = GetClipboardData( CF_DIBV5 );
1593  ok( is_fixed( data ), "expected fixed mem %p\n", data );
1594 
1595  ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap );
1596  ok( GetObjectType( bitmap2 ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap2 );
1597  ok( GetObjectType( palette ) == OBJ_PAL, "expected palette %p\n", palette );
1598  ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
1599  ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
1600 
1601  r = EmptyClipboard();
1602  ok( r, "gle %d\n", GetLastError() );
1603 
1604  /* w2003, w2008 don't seem to free the data here */
1605  ok( is_freed( htext ) || broken( !is_freed( htext )), "expected freed mem %p\n", htext );
1606  ok( is_freed( htext2 ) || broken( !is_freed( htext2 )), "expected freed mem %p\n", htext2 );
1607  ok( is_freed( htext3 ) || broken( !is_freed( htext3 )), "expected freed mem %p\n", htext3 );
1608  ok( is_freed( htext4 ) || broken( !is_freed( htext4 )), "expected freed mem %p\n", htext4 );
1609  ok( is_freed( hmoveable ) || broken( !is_freed( hmoveable )), "expected freed mem %p\n", hmoveable );
1610  ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
1611  ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
1612  ok( !GetObjectType( bitmap ), "expected freed handle %p\n", bitmap );
1613  ok( !GetObjectType( bitmap2 ), "expected freed handle %p\n", bitmap2 );
1614  ok( !GetObjectType( palette ), "expected freed handle %p\n", palette );
1615 
1616  r = CloseClipboard();
1617  ok( r, "gle %d\n", GetLastError() );
1618 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const LOGPALETTE logpalette
Definition: clipboard.c:1346
#define trace(...)
Definition: kmt_test.h:217
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HANDLE process
Definition: process.c:76
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define CF_GDIOBJFIRST
Definition: constants.h:420
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
#define ok(value,...)
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
Definition: uimain.c:88
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
#define CF_DSPBITMAP
Definition: constants.h:415
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define OBJ_PAL
Definition: objidl.idl:1413
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
static HGLOBAL create_textA(void)
Definition: clipboard.c:489
static BOOL is_moveable(HANDLE handle)
Definition: clipboard.c:1324
#define GMEM_FIXED
Definition: winbase.h:290
#define CF_PALETTE
Definition: constants.h:404
UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat)
Definition: clipboard.c:92
static HPALETTE palette
Definition: clipboard.c:1345
#define CF_LOCALE
Definition: constants.h:411
#define broken(x)
Definition: _sntprintf.h:21
#define CF_OEMTEXT
Definition: constants.h:402
static BOOL is_freed(HANDLE handle)
Definition: clipboard.c:1338
unsigned int UINT
Definition: ndis.h:50
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define CF_PRIVATEFIRST
Definition: constants.h:418
static HBITMAP
Definition: button.c:44
static UINT format_id
Definition: clipboard.c:1343
static HBITMAP bitmap2
Definition: clipboard.c:1344
static BOOL is_fixed(HANDLE handle)
Definition: clipboard.c:1331
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define HeapFree(x, y, z)
Definition: compat.h:394
#define GMEM_MOVEABLE
Definition: winbase.h:291
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
#define CF_DIB
Definition: constants.h:403

Referenced by test_data_handles(), and test_handles_thread().

◆ test_handles_process()

static void test_handles_process ( const char str)
static

Definition at line 1678 of file clipboard.c.

1679 {
1680  BOOL r;
1681  HANDLE h;
1682  char *ptr;
1683  BITMAP bm;
1685  BYTE buffer[1024];
1686 
1687  format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" );
1688  r = OpenClipboard( 0 );
1689  ok( r, "gle %d\n", GetLastError() );
1690  h = GetClipboardData( CF_TEXT );
1691  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1692  ptr = GlobalLock( h );
1693  ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr );
1694  GlobalUnlock( h );
1696  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1697  ptr = GlobalLock( h );
1698  if (ptr) ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr );
1699  GlobalUnlock( h );
1701  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1702  ptr = GlobalLock( h );
1703  ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr );
1704  GlobalUnlock( h );
1705  trace( "gdiobj %p\n", h );
1707  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1708  ptr = GlobalLock( h );
1709  ok( !strcmp( str, ptr ), "wrong data '%.5s'\n", ptr );
1710  GlobalUnlock( h );
1711  trace( "private %p\n", h );
1713  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1714  ok( GetObjectW( h, sizeof(bm), &bm ) == sizeof(bm), "GetObject %p failed\n", h );
1715  ok( bm.bmWidth == 13 && bm.bmHeight == 17, "wrong bitmap %ux%u\n", bm.bmWidth, bm.bmHeight );
1716  trace( "bitmap %p\n", h );
1718  ok( !GetObjectType( h ), "expected invalid object %p\n", h );
1719  trace( "bitmap2 %p\n", h );
1721  ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h );
1722  ok( GetPaletteEntries( h, 0, 1, &entry ) == 1, "GetPaletteEntries %p failed\n", h );
1723  ok( entry.peRed == 0x12 && entry.peGreen == 0x34 && entry.peBlue == 0x56,
1724  "wrong color %02x,%02x,%02x\n", entry.peRed, entry.peGreen, entry.peBlue );
1725  trace( "palette %p\n", h );
1727  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1728 #ifdef __REACTOS__
1729  if (h != NULL)
1730 #endif
1731  ok( GetObjectType( ((METAFILEPICT *)h)->hMF ) == OBJ_METAFILE,
1732  "wrong object %p\n", ((METAFILEPICT *)h)->hMF );
1733  trace( "metafile %p\n", h );
1735  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1736 #ifdef __REACTOS__
1737  if (h != NULL)
1738 #endif
1739  ok( GetObjectType( ((METAFILEPICT *)h)->hMF ) == OBJ_METAFILE,
1740  "wrong object %p\n", ((METAFILEPICT *)h)->hMF );
1741  trace( "metafile2 %p\n", h );
1743  ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h );
1744  ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER),
1745  "GetEnhMetaFileBits failed on %p\n", h );
1746  ok( ((ENHMETAHEADER *)buffer)->nRecords == 3,
1747  "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords );
1748  trace( "enhmetafile %p\n", h );
1750  ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h );
1751  ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER),
1752  "GetEnhMetaFileBits failed on %p\n", h );
1753  ok( ((ENHMETAHEADER *)buffer)->nRecords == 3,
1754  "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords );
1755  trace( "enhmetafile2 %p\n", h );
1756  h = GetClipboardData( CF_DIB );
1757  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1758  h = GetClipboardData( CF_DIBV5 );
1759  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1760  r = CloseClipboard();
1761  ok( r, "gle %d\n", GetLastError() );
1762 }
#define trace(...)
Definition: kmt_test.h:217
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
#define CF_ENHMETAFILE
Definition: constants.h:409
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CF_DSPMETAFILEPICT
Definition: constants.h:416
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define CF_METAFILEPICT
Definition: constants.h:398
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
#define CF_GDIOBJFIRST
Definition: constants.h:420
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
#define CF_DSPENHMETAFILE
Definition: constants.h:417
#define ok(value,...)
const WCHAR * str
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
#define OBJ_METAFILE
Definition: objidl.idl:1417
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define CF_DSPBITMAP
Definition: constants.h:415
#define OBJ_PAL
Definition: objidl.idl:1413
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
uint32_t entry
Definition: isohybrid.c:63
#define CF_PALETTE
Definition: constants.h:404
unsigned char BYTE
Definition: mem.h:68
UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat)
Definition: clipboard.c:92
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define CF_PRIVATEFIRST
Definition: constants.h:418
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static UINT format_id
Definition: clipboard.c:1343
static BOOL is_fixed(HANDLE handle)
Definition: clipboard.c:1331
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define CF_DIB
Definition: constants.h:403

Referenced by START_TEST().

◆ test_handles_process_dib()

static void test_handles_process_dib ( const char str)
static

Definition at line 1778 of file clipboard.c.

1779 {
1780  BOOL r;
1781  HANDLE h;
1782 
1783  r = OpenClipboard( 0 );
1784  ok( r, "gle %d\n", GetLastError() );
1786  ok( !GetObjectType( h ), "expected invalid object %p\n", h );
1787  trace( "dibsection %p\n", h );
1788  r = CloseClipboard();
1789  ok( r, "gle %d\n", GetLastError() );
1790 }
#define trace(...)
Definition: kmt_test.h:217
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define CF_BITMAP
Definition: constants.h:397
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15

Referenced by START_TEST().

◆ test_handles_process_open()

static void test_handles_process_open ( const char str)
static

Definition at line 1764 of file clipboard.c.

1765 {
1767  char *ptr = GlobalLock( text );
1768 
1769  strcpy( ptr, str );
1770  GlobalUnlock( text );
1771 
1772  /* clipboard already open by parent process */
1774  ok( h == text, "wrong mem %p / %p\n", h, text );
1775  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1776 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const WCHAR * text
Definition: package.c:1827
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static PVOID ptr
Definition: dispmode.c:27
#define ok(value,...)
const WCHAR * str
#define CF_TEXT
Definition: constants.h:396
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
static BOOL is_moveable(HANDLE handle)
Definition: clipboard.c:1324
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by START_TEST().

◆ test_handles_thread()

static DWORD WINAPI test_handles_thread ( void arg)
static

Definition at line 1620 of file clipboard.c.

1621 {
1622  trace( "running from different thread\n" );
1623  test_handles( (HWND)arg );
1624  return 0;
1625 }
static void test_handles(HWND hwnd)
Definition: clipboard.c:1348
#define trace(...)
Definition: kmt_test.h:217

Referenced by test_data_handles().

◆ test_handles_thread2()

static DWORD WINAPI test_handles_thread2 ( void arg)
static

Definition at line 1627 of file clipboard.c.

1628 {
1629  BOOL r;
1630  HANDLE h;
1631  char *ptr;
1632 
1633  r = OpenClipboard( 0 );
1634  ok( r, "gle %d\n", GetLastError() );
1635  h = GetClipboardData( CF_TEXT );
1636  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1637  ptr = GlobalLock( h );
1638  if (ptr) ok( !strcmp( "test", ptr ), "wrong data '%.5s'\n", ptr );
1639  GlobalUnlock( h );
1641  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1642  ptr = GlobalLock( h );
1643  if (ptr) ok( !strcmp( "test", ptr ), "wrong data '%.5s'\n", ptr );
1644  GlobalUnlock( h );
1646  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1647  ptr = GlobalLock( h );
1648  if (ptr) ok( !strcmp( "test", ptr ), "wrong data '%.5s'\n", ptr );
1649  GlobalUnlock( h );
1650  trace( "gdiobj %p\n", h );
1652  ok( is_moveable( h ), "expected moveable mem %p\n", h );
1653  ptr = GlobalLock( h );
1654  if (ptr) ok( !strcmp( "test", ptr ), "wrong data '%.5s'\n", ptr );
1655  GlobalUnlock( h );
1656  trace( "private %p\n", h );
1658  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1659  ok( h == bitmap, "different bitmap %p / %p\n", h, bitmap );
1660  trace( "bitmap %p\n", h );
1662  ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
1663  ok( h == bitmap2, "different bitmap %p / %p\n", h, bitmap2 );
1664  trace( "bitmap2 %p\n", h );
1666  ok( GetObjectType( h ) == OBJ_PAL, "expected palette %p\n", h );
1667  ok( h == palette, "different palette %p / %p\n", h, palette );
1668  trace( "palette %p\n", h );
1669  h = GetClipboardData( CF_DIB );
1670  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1671  h = GetClipboardData( CF_DIBV5 );
1672  ok( is_fixed( h ), "expected fixed mem %p\n", h );
1673  r = CloseClipboard();
1674  ok( r, "gle %d\n", GetLastError() );
1675  return 0;
1676 }
#define trace(...)
Definition: kmt_test.h:217
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define CF_GDIOBJFIRST
Definition: constants.h:420
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
#define ok(value,...)
#define CF_BITMAP
Definition: constants.h:397
#define CF_TEXT
Definition: constants.h:396
Definition: uimain.c:88
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define CF_DSPBITMAP
Definition: constants.h:415
#define OBJ_PAL
Definition: objidl.idl:1413
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
static BOOL is_moveable(HANDLE handle)
Definition: clipboard.c:1324
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define CF_PALETTE
Definition: constants.h:404
static HPALETTE palette
Definition: clipboard.c:1345
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define CF_PRIVATEFIRST
Definition: constants.h:418
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static UINT format_id
Definition: clipboard.c:1343
static HBITMAP bitmap2
Definition: clipboard.c:1344
static BOOL is_fixed(HANDLE handle)
Definition: clipboard.c:1331
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define CF_DIB
Definition: constants.h:403

Referenced by test_data_handles().

◆ test_messages()

static void test_messages ( void  )
static

Definition at line 1277 of file clipboard.c.

1278 {
1279  WNDCLASSA cls;
1280  HWND win;
1281  MSG msg;
1282  HANDLE thread;
1283  DWORD tid;
1284 
1287 
1288  memset(&cls, 0, sizeof(cls));
1291  cls.lpszClassName = "clipboard_test";
1292  RegisterClassA(&cls);
1293 
1294  win = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
1295  ok(win != NULL, "CreateWindow failed: %d\n", GetLastError());
1296 
1297  thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid);
1298  ok(thread != NULL, "CreateThread failed: %d\n", GetLastError());
1299 
1300  while(GetMessageA(&msg, NULL, 0, 0))
1301  {
1302  ok( msg.message != WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD was posted\n" );
1305  }
1306 
1307  ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
1309 
1310  DestroyWindow( win );
1311 
1312  /* same tests again but inside a single thread */
1313 
1314  win = CreateWindowA( "clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0 );
1315  ok( win != NULL, "CreateWindow failed: %d\n", GetLastError() );
1316 
1317  clipboard_thread( win );
1318  DestroyWindow( win );
1319 
1320  UnregisterClassA("clipboard_test", GetModuleHandleA(NULL));
1322 }
static HANDLE update_event
Definition: clipboard.c:902
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define CloseHandle
Definition: compat.h:398
static DWORD WINAPI clipboard_thread(void *param)
Definition: clipboard.c:1035
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DestroyWindow(_In_ HWND)
static CRITICAL_SECTION clipboard_cs
Definition: clipboard.c:893
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:111
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_OBJECT_0
Definition: winbase.h:387
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
#define WM_DRAWCLIPBOARD
Definition: winuser.h:1830
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
LPCSTR lpszClassName
Definition: winuser.h:3125
static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
Definition: clipboard.c:904
static real win[4][36]
HINSTANCE hInstance
Definition: winuser.h:3120
WNDPROC lpfnWndProc
Definition: winuser.h:3117
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39
static TfClientId tid
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ test_RegisterClipboardFormatA()

static void test_RegisterClipboardFormatA ( void  )
static

Definition at line 373 of file clipboard.c.

374 {
375  ATOM atom_id;
376  UINT format_id, format_id2;
377  char buf[256];
378  int len;
379  BOOL ret;
380  HANDLE handle;
381 
382  format_id = RegisterClipboardFormatA("my_cool_clipboard_format");
383  ok(format_id > 0xc000 && format_id < 0xffff, "invalid clipboard format id %04x\n", format_id);
384 
385  format_id2 = RegisterClipboardFormatA("MY_COOL_CLIPBOARD_FORMAT");
386  ok(format_id2 == format_id, "invalid clipboard format id %04x\n", format_id2);
387 
389  ok(len == lstrlenA("my_cool_clipboard_format"), "wrong format name length %d\n", len);
390  ok(!lstrcmpA(buf, "my_cool_clipboard_format"), "wrong format name \"%s\"\n", buf);
391 
393  ok(len == 0, "wrong format name length %d\n", len);
394 
395  lstrcpyA(buf, "foo");
396  SetLastError(0xdeadbeef);
397  len = GetAtomNameA((ATOM)format_id, buf, 256);
398  ok(len == 0, "GetAtomNameA should fail\n");
399  ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError());
400 
401 todo_wine
402 {
403  lstrcpyA(buf, "foo");
404  SetLastError(0xdeadbeef);
406  ok(len == 0, "GlobalGetAtomNameA should fail\n");
407  ok(GetLastError() == ERROR_INVALID_HANDLE, "err %d\n", GetLastError());
408 }
409 
410  SetLastError(0xdeadbeef);
411  atom_id = FindAtomA("my_cool_clipboard_format");
412  ok(atom_id == 0, "FindAtomA should fail\n");
413  ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
414 
415  if (0)
416  {
417  /* this relies on the clipboard and global atom table being different */
418  SetLastError(0xdeadbeef);
419  atom_id = GlobalFindAtomA("my_cool_clipboard_format");
420  ok(atom_id == 0, "GlobalFindAtomA should fail\n");
421  ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
422  }
423 
424  for (format_id = 0; format_id < 0x10fff; format_id++)
425  {
426  SetLastError(0xdeadbeef);
428 
429  if (format_id < 0xc000 || format_id > 0xffff)
430  ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf);
431  else if (len && winetest_debug > 1)
432  trace("%04x: %s\n", format_id, len ? buf : "");
433  }
434 
435  ret = OpenClipboard(0);
436  ok( ret, "OpenClipboard error %d\n", GetLastError());
437 
438  /* try some invalid/unregistered formats */
439  SetLastError( 0xdeadbeef );
441  ok( !handle, "SetClipboardData succeeded\n" );
442  ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError());
444  ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
446  ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
448  ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
449 
450  ok( IsClipboardFormatAvailable( 0x1234 ), "format missing\n" );
451  ok( IsClipboardFormatAvailable( 0x123456 ), "format missing\n" );
452  ok( IsClipboardFormatAvailable( 0xffff8765 ), "format missing\n" );
453  ok( !IsClipboardFormatAvailable( 0 ), "format available\n" );
454  ok( !IsClipboardFormatAvailable( 0x3456 ), "format available\n" );
455  ok( !IsClipboardFormatAvailable( 0x8765 ), "format available\n" );
456 
457  trace("# of formats available: %d\n", CountClipboardFormats());
458 
459  format_id = 0;
461  {
462  ok(IsClipboardFormatAvailable(format_id), "format %04x was listed as available\n", format_id);
464  trace("%04x: %s\n", format_id, len ? buf : "");
465  }
466 
467  ret = EmptyClipboard();
468  ok( ret, "EmptyClipboard error %d\n", GetLastError());
469  ret =CloseClipboard();
470  ok( ret, "CloseClipboard error %d\n", GetLastError());
471 
472  if (CountClipboardFormats())
473  {
474  SetLastError(0xdeadbeef);
475  ok(!EnumClipboardFormats(0), "EnumClipboardFormats should fail if clipboard wasn't open\n");
477  "Last error should be set to ERROR_CLIPBOARD_NOT_OPEN, not %d\n", GetLastError());
478  }
479 
480  SetLastError(0xdeadbeef);
481  ok(!EmptyClipboard(), "EmptyClipboard should fail if clipboard wasn't open\n");
482  ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
483  "Wrong error %u\n", GetLastError());
484 
486  ok(format_id == 1234, "invalid clipboard format id %04x\n", format_id);
487 }
UINT WINAPI GetAtomNameA(ATOM nAtom, LPSTR lpBuffer, int nSize)
Definition: atom.c:577
#define trace(...)
Definition: kmt_test.h:217
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
WORD ATOM
Definition: dimm.idl:113
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int winetest_debug
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define SetLastError(x)
Definition: compat.h:409
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
int ret
#define todo_wine
Definition: test.h:154
ATOM WINAPI GlobalFindAtomA(LPCSTR lpString)
Definition: atom.c:464
GLenum GLsizei len
Definition: glext.h:6722
UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat)
Definition: clipboard.c:92
#define broken(x)
Definition: _sntprintf.h:21
#define ERROR_CLIPBOARD_NOT_OPEN
Definition: winerror.h:899
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
INT WINAPI GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
Definition: clipboard.c:44
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI EnumClipboardFormats(UINT format)
Definition: clipboard.c:33
#define GMEM_DDESHARE
Definition: winbase.h:295
UINT len
Definition: clipboard.c:2030
UINT WINAPI GlobalGetAtomNameA(ATOM nAtom, LPSTR lpBuffer, int nSize)
Definition: atom.c:484
ATOM WINAPI FindAtomA(LPCSTR lpString)
Definition: atom.c:556
static UINT format_id
Definition: clipboard.c:1343
int WINAPI CountClipboardFormats(void)
Definition: ntwrapper.h:184
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by START_TEST().

◆ test_string_data()

static void test_string_data ( void  )
static

Definition at line 2048 of file clipboard.c.

2049 {
2050  UINT i;
2051  BOOL r;
2052  HANDLE data;
2053  char cmd[16];
2054  char bufferA[12];
2055  WCHAR bufferW[12];
2056 
2057  for (i = 0; i < sizeof(test_data) / sizeof(test_data[0]); i++)
2058  {
2059  /* 1-byte Unicode strings crash on Win64 */
2060 #ifdef _WIN64
2061  if (!test_data[i].strA[0] && test_data[i].len < sizeof(WCHAR)) continue;
2062 #endif
2063  r = OpenClipboard( 0 );
2064  ok( r, "gle %d\n", GetLastError() );
2065  r = EmptyClipboard();
2066  ok( r, "gle %d\n", GetLastError() );
2068  if (test_data[i].strA[0])
2069  {
2072  memcpy( bufferA, test_data[i].strA, test_data[i].len );
2073  bufferA[test_data[i].len - 1] = 0;
2074  ok( !memcmp( data, bufferA, test_data[i].len ),
2075  "%u: wrong data %.*s\n", i, test_data[i].len, (char *)data );
2076  }
2077  else
2078  {
2081  memcpy( bufferW, test_data[i].strW, test_data[i].len );
2082  bufferW[(test_data[i].len + 1) / sizeof(WCHAR) - 1] = 0;
2083  ok( !memcmp( data, bufferW, test_data[i].len ),
2084  "%u: wrong data %s\n", i, wine_dbgstr_wn( data, (test_data[i].len + 1) / sizeof(WCHAR) ));
2085  }
2086  r = CloseClipboard();
2087  ok( r, "gle %d\n", GetLastError() );
2088  sprintf( cmd, "string_data %u", i );
2089  run_process( cmd );
2090  }
2091 }
char strA[12]
Definition: clipboard.c:2028
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: ftp_var.h:139
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
WCHAR strW[12]
Definition: clipboard.c:2029
#define ok(value,...)
#define CF_UNICODETEXT
Definition: constants.h:408
#define CF_TEXT
Definition: constants.h:396
HANDLE WINAPI SetClipboardData(UINT uFormat, HANDLE hMem)
Definition: clipboard.c:285
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define GMEM_FIXED
Definition: winbase.h:290
static void run_process(const char *args)
Definition: clipboard.c:166
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:342
unsigned int UINT
Definition: ndis.h:50
static const struct @1647 test_data[]

Referenced by START_TEST().

◆ test_string_data_process()

static void test_string_data_process ( int  i)
static

Definition at line 2093 of file clipboard.c.

2094 {
2095  BOOL r;
2096  HANDLE data;
2097  UINT len, len2;
2098  char bufferA[12];
2099  WCHAR bufferW[12];
2100 
2101  r = OpenClipboard( 0 );
2102  ok( r, "gle %d\n", GetLastError() );
2103  if (test_data[i].strA[0])
2104  {
2106  ok( data != 0, "%u: could not get data\n", i );
2107  len = GlobalSize( data );
2108  ok( len == test_data[i].len, "%u: wrong size %u / %u\n", i, len, test_data[i].len );
2109  memcpy( bufferA, test_data[i].strA, test_data[i].len );
2110  bufferA[test_data[i].len - 1] = 0;
2111  ok( !memcmp( data, bufferA, len ), "%u: wrong data %.*s\n", i, len, (char *)data );
2113  ok( data != 0, "%u: could not get data\n", i );
2114  len = GlobalSize( data );
2115  len2 = MultiByteToWideChar( CP_ACP, 0, bufferA, test_data[i].len, bufferW, 12 );
2116  ok( len == len2 * sizeof(WCHAR), "%u: wrong size %u / %u\n", i, len, len2 );
2117  ok( !memcmp( data, bufferW, len ), "%u: wrong data %s\n", i, wine_dbgstr_wn( data, len2 ));
2118  }
2119  else
2120  {
2122  ok( data != 0, "%u: could not get data\n", i );
2123  len = GlobalSize( data );
2124  ok( len == test_data[i].len, "%u: wrong size %u / %u\n", i, len, test_data[i].len );
2125  memcpy( bufferW, test_data[i].strW, test_data[i].len );
2126  bufferW[(test_data[i].len + 1) / sizeof(WCHAR) - 1] = 0;
2127  ok( !memcmp( data, bufferW, len ),
2128  "%u: wrong data %s\n", i, wine_dbgstr_wn( data, (len + 1) / sizeof(WCHAR) ));
2130  if (test_data[i].len >= sizeof(WCHAR))
2131  {
2132  ok( data != 0, "%u: could not get data\n", i );
2133  len = GlobalSize( data );
2134  len2 = WideCharToMultiByte( CP_ACP, 0, bufferW, test_data[i].len / sizeof(WCHAR),
2135  bufferA, 12, NULL, NULL );
2136  bufferA[len2 - 1] = 0;
2137  ok( len == len2, "%u: wrong size %u / %u\n", i, len, len2 );
2138  ok( !memcmp( data, bufferA, len ), "%u: wrong data %.*s\n", i, len, (char *)data );
2139  }
2140  else
2141  {
2142  ok( !data, "%u: got data for empty string\n", i );
2143  ok( IsClipboardFormatAvailable( CF_TEXT ), "%u: text not available\n", i );
2144  }
2145  }
2146  r = CloseClipboard();
2147  ok( r, "gle %d\n", GetLastError() );
2148 }
char strA[12]
Definition: clipboard.c:2028
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define WideCharToMultiByte
Definition: compat.h:101
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
HANDLE WINAPI GetClipboardData(UINT uFormat)
Definition: clipboard.c:194
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
WCHAR strW[12]
Definition: clipboard.c:2029
#define ok(value,...)
#define CF_UNICODETEXT
Definition: constants.h:408
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:342
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
UINT len
Definition: clipboard.c:2030

Referenced by START_TEST().

◆ test_synthesized()

static void test_synthesized ( void  )
static

Definition at line 586 of file clipboard.c.

587 {
588  static const struct test
589  {
590  UINT format;
591  UINT expected[8];
592  } tests[] =
593  {
599 /* 5 */ { CF_BITMAP, { CF_BITMAP, CF_DIB, CF_DIBV5 }},
600  { CF_DIB, { CF_DIB, CF_BITMAP, CF_DIBV5 }},
601  { CF_DIBV5, { CF_DIBV5, CF_BITMAP, CF_DIB }},
602  };
603 
604  HGLOBAL h, htext;
605  HENHMETAFILE emf;
606  BOOL r;
607  UINT cf, i, j, count, rendered, seq, old_seq;
608  HANDLE data;
609  HWND