Alexandre Julliard : user32: Get rid of the RegisterClipboardFormat driver entry point.

Alexandre Julliard julliard at winehq.org
Mon Mar 7 12:22:48 CST 2011


Module: wine
Branch: master
Commit: 7879b8e349e2a8e81d684a78939865cbf758e00a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7879b8e349e2a8e81d684a78939865cbf758e00a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  7 17:05:32 2011 +0100

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 875a027..0985e6f 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 d40789c..d152f86 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 c461df4..158ff3f 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 f7b79b3..6d668ba 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 225c23c..0899815 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 cc5cf43..c4a7672 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




More information about the wine-cvs mailing list