Huw Davies : oledlg: Forward OleUIPasteSpecialA -> OleUIPasteSpecialW.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 20 04:45:50 CDT 2006


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed Oct 18 17:07:47 2006 +0100

oledlg: Forward OleUIPasteSpecialA -> OleUIPasteSpecialW.

---

 dlls/oledlg/pastespl.c |   68 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/dlls/oledlg/pastespl.c b/dlls/oledlg/pastespl.c
index 94547dd..f255486 100644
--- a/dlls/oledlg/pastespl.c
+++ b/dlls/oledlg/pastespl.c
@@ -26,6 +26,7 @@ #include "winbase.h"
 #include "winerror.h"
 #include "wingdi.h"
 #include "winuser.h"
+#include "winnls.h"
 #include "oledlg.h"
 #include "wine/debug.h"
 
@@ -95,14 +96,73 @@ static void dump_pastespecial(LPOLEUIPAS
 
 }
 
+static inline WCHAR *strdupAtoW(const char *str)
+{
+    DWORD len;
+    WCHAR *ret;
+    if(!str) return NULL;
+    len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
+    ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+    return ret;
+}
+
 /***********************************************************************
  *           OleUIPasteSpecialA (OLEDLG.4)
  */
-UINT WINAPI OleUIPasteSpecialA(LPOLEUIPASTESPECIALA lpOleUIPasteSpecial)
+UINT WINAPI OleUIPasteSpecialA(LPOLEUIPASTESPECIALA psA)
 {
-  FIXME("(%p): stub\n", lpOleUIPasteSpecial);
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return OLEUI_FALSE;
+    OLEUIPASTESPECIALW ps;
+    UINT ret;
+    TRACE("(%p)\n", psA);
+
+    memcpy(&ps, psA, psA->cbStruct);
+
+    ps.lpszCaption = strdupAtoW(psA->lpszCaption);
+    if(!IS_INTRESOURCE(ps.lpszTemplate))
+        ps.lpszTemplate = strdupAtoW(psA->lpszTemplate);
+
+    if(psA->cPasteEntries > 0)
+    {
+        DWORD size = psA->cPasteEntries * sizeof(ps.arrPasteEntries[0]);
+        UINT i;
+
+        ps.arrPasteEntries = HeapAlloc(GetProcessHeap(), 0, size);
+        memcpy(ps.arrPasteEntries, psA->arrPasteEntries, size);
+        for(i = 0; i < psA->cPasteEntries; i++)
+        {
+            ps.arrPasteEntries[i].lpstrFormatName =
+                strdupAtoW(psA->arrPasteEntries[i].lpstrFormatName);
+            ps.arrPasteEntries[i].lpstrResultText =
+                strdupAtoW(psA->arrPasteEntries[i].lpstrResultText);
+        }
+    }
+
+    ret = OleUIPasteSpecialW(&ps);
+
+    if(psA->cPasteEntries > 0)
+    {
+        UINT i;
+        for(i = 0; i < psA->cPasteEntries; i++)
+        {
+            HeapFree(GetProcessHeap(), 0, (WCHAR*)ps.arrPasteEntries[i].lpstrFormatName);
+            HeapFree(GetProcessHeap(), 0, (WCHAR*)ps.arrPasteEntries[i].lpstrResultText);
+        }
+        HeapFree(GetProcessHeap(), 0, ps.arrPasteEntries);
+    }
+    if(!IS_INTRESOURCE(ps.lpszTemplate))
+        HeapFree(GetProcessHeap(), 0, (WCHAR*)ps.lpszTemplate);
+    HeapFree(GetProcessHeap(), 0, (WCHAR*)ps.lpszCaption);
+
+    /* Copy back the output fields */
+    psA->dwFlags = ps.dwFlags;
+    psA->lpSrcDataObj = ps.lpSrcDataObj;
+    psA->nSelectedIndex = ps.nSelectedIndex;
+    psA->fLink = ps.fLink;
+    psA->hMetaPict = ps.hMetaPict;
+    psA->sizel = ps.sizel;
+
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list