From 7879b8e349e2a8e81d684a78939865cbf758e00a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 7 Mar 2011 17:05:32 +0100 Subject: [PATCH] user32: Get rid of the RegisterClipboardFormat driver entry point. --- dlls/user32/clipboard.c | 18 ++++-------------- dlls/user32/driver.c | 13 ------------- dlls/user32/tests/clipboard.c | 3 +++ dlls/user32/user_private.h | 1 - dlls/winex11.drv/clipboard.c | 12 ------------ dlls/winex11.drv/winex11.drv.spec | 1 - 6 files changed, 7 insertions(+), 41 deletions(-) diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 875a0275320..0985e6f962e 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -213,28 +213,18 @@ static HWND CLIPBOARD_SetClipboardViewer( HWND hWnd ) /************************************************************************** * RegisterClipboardFormatW (USER32.@) */ -UINT WINAPI RegisterClipboardFormatW(LPCWSTR FormatName) +UINT WINAPI RegisterClipboardFormatW( LPCWSTR name ) { - return USER_Driver->pRegisterClipboardFormat(FormatName); + return GlobalAddAtomW( name ); } /************************************************************************** * RegisterClipboardFormatA (USER32.@) */ -UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName) +UINT WINAPI RegisterClipboardFormatA( LPCSTR name ) { - int len; - LPWSTR wFormat; - UINT ret; - - len = MultiByteToWideChar(CP_ACP, 0, formatName, -1, NULL, 0); - wFormat = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, formatName, -1, wFormat, len); - - ret = RegisterClipboardFormatW(wFormat); - HeapFree(GetProcessHeap(), 0, wFormat); - return ret; + return GlobalAddAtomA( name ); } diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index d40789c4e0e..d152f8629e5 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -98,7 +98,6 @@ static const USER_DRIVER *load_driver(void) GET_USER_FUNC(CountClipboardFormats); GET_USER_FUNC(EnumClipboardFormats); GET_USER_FUNC(IsClipboardFormatAvailable); - GET_USER_FUNC(RegisterClipboardFormat); GET_USER_FUNC(EndClipboardUpdate); GET_USER_FUNC(ChangeDisplaySettingsEx); GET_USER_FUNC(EnumDisplayMonitors); @@ -279,11 +278,6 @@ static BOOL CDECL nulldrv_IsClipboardFormatAvailable( UINT format ) return FALSE; } -static UINT CDECL nulldrv_RegisterClipboardFormat( LPCWSTR name ) -{ - return 0; -} - static BOOL CDECL nulldrv_SetClipboardData( UINT format, HANDLE handle, BOOL owner ) { return FALSE; @@ -457,7 +451,6 @@ static USER_DRIVER null_driver = nulldrv_EnumClipboardFormats, nulldrv_GetClipboardData, nulldrv_IsClipboardFormatAvailable, - nulldrv_RegisterClipboardFormat, nulldrv_SetClipboardData, /* display modes */ nulldrv_ChangeDisplaySettingsEx, @@ -626,11 +619,6 @@ static BOOL CDECL loaderdrv_IsClipboardFormatAvailable( UINT format ) return load_driver()->pIsClipboardFormatAvailable( format ); } -static UINT CDECL loaderdrv_RegisterClipboardFormat( LPCWSTR name ) -{ - return load_driver()->pRegisterClipboardFormat( name ); -} - static BOOL CDECL loaderdrv_SetClipboardData( UINT format, HANDLE handle, BOOL owner ) { return load_driver()->pSetClipboardData( format, handle, owner ); @@ -798,7 +786,6 @@ static USER_DRIVER lazy_load_driver = loaderdrv_EnumClipboardFormats, loaderdrv_GetClipboardData, loaderdrv_IsClipboardFormatAvailable, - loaderdrv_RegisterClipboardFormat, loaderdrv_SetClipboardData, /* display modes */ loaderdrv_ChangeDisplaySettingsEx, diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index c461df40251..158ff3f075a 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -183,6 +183,9 @@ todo_wine ok(!EmptyClipboard(), "EmptyClipboard should fail if clipboard wasn't open\n"); ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */ "Wrong error %u\n", GetLastError()); + + format_id = RegisterClipboardFormatA("#1234"); + ok(format_id == 1234, "invalid clipboard format id %04x\n", format_id); } static HGLOBAL create_text(void) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index f7b79b3d1b0..6d668ba7e75 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -82,7 +82,6 @@ typedef struct tagUSER_DRIVER { UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */ HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */ BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */ - UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */ BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */ /* display modes */ LONG (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 225c23cadcd..0899815e2a9 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -2481,18 +2481,6 @@ static BOOL X11DRV_CLIPBOARD_IsSelectionOwner(void) **************************************************************************/ -/************************************************************************** - * RegisterClipboardFormat (X11DRV.@) - * - * Registers a custom X clipboard format - * Returns: Format id or 0 on failure - */ -UINT CDECL X11DRV_RegisterClipboardFormat(LPCWSTR FormatName) -{ - return GlobalAddAtomW( FormatName ); -} - - static void selection_acquire(void) { Window owner; diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index cc5cf437d56..c4a7672725e 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -94,7 +94,6 @@ @ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC @ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx -@ cdecl RegisterClipboardFormat(wstr) X11DRV_RegisterClipboardFormat @ cdecl ReleaseDC(long long) X11DRV_ReleaseDC @ cdecl ScrollDC(long long long ptr ptr long ptr) X11DRV_ScrollDC @ cdecl SetClipboardData(long long long) X11DRV_SetClipboardData