oledlg: Forward OleUIPasteSpecialA -> OleUIPasteSpecialW.

This commit is contained in:
Huw Davies 2006-10-18 17:07:47 +01:00 committed by Alexandre Julliard
parent f08c5c2ccf
commit a94bc4c0b6
1 changed files with 64 additions and 4 deletions

View File

@ -26,6 +26,7 @@
#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(LPOLEUIPASTESPECIALW ps)
}
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;
}
/***********************************************************************