2003-07-09 21:49:12 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* OLE2 library - 16 bit only interfaces
|
|
|
|
*
|
|
|
|
* Copyright 1995 Martin von Loewis
|
|
|
|
* Copyright 1999 Francis Beaudet
|
|
|
|
* Copyright 1999 Noel Borthwick
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-09 21:49:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-07-09 21:49:12 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
2009-03-11 17:03:10 +01:00
|
|
|
#include "wownt32.h"
|
2003-07-09 21:49:12 +02:00
|
|
|
#include "ole2.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include "wine/winbase16.h"
|
|
|
|
#include "wine/wingdi16.h"
|
|
|
|
#include "wine/winuser16.h"
|
2004-01-23 23:51:41 +01:00
|
|
|
#include "ifs.h"
|
2003-07-09 21:49:12 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
2010-01-04 20:26:54 +01:00
|
|
|
|
|
|
|
static HICON convert_icon_to_32( HICON16 icon16 )
|
|
|
|
{
|
|
|
|
CURSORICONINFO *info = GlobalLock16( icon16 );
|
|
|
|
void *and_bits = info + 1;
|
|
|
|
void *xor_bits = (BYTE *)and_bits + info->nHeight * 2 * ((info->nWidth + 15) / 16);
|
|
|
|
HICON ret = CreateIcon( 0, info->nWidth, info->nHeight, info->bPlanes, info->bBitsPerPixel,
|
|
|
|
and_bits, xor_bits );
|
|
|
|
GlobalUnlock16( icon16 );
|
|
|
|
return ret;
|
|
|
|
}
|
2003-07-09 21:49:12 +02:00
|
|
|
|
2009-03-11 17:05:20 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* OleBuildVersion (OLE2.1)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI OleBuildVersion16(void)
|
|
|
|
{
|
|
|
|
return OleBuildVersion();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* OleInitialize (OLE2.2)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleInitialize16(LPVOID reserved)
|
|
|
|
{
|
|
|
|
return OleInitialize( reserved );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* OleUninitialize (OLE2.3)
|
|
|
|
*/
|
|
|
|
void WINAPI OleUninitialize16(void)
|
|
|
|
{
|
|
|
|
return OleUninitialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllGetClassObject (OLE2.4)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllGetClassObject16(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* GetRunningObjectTable (OLE2.30)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
|
|
|
|
{
|
|
|
|
FIXME("(%d,%p),stub!\n",reserved,pprot);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2003-07-09 21:49:12 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* RegisterDragDrop (OLE2.35)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI RegisterDragDrop16(
|
|
|
|
HWND16 hwnd,
|
|
|
|
LPDROPTARGET pDropTarget
|
|
|
|
) {
|
|
|
|
FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* RevokeDragDrop (OLE2.36)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI RevokeDragDrop16(
|
|
|
|
HWND16 hwnd
|
|
|
|
) {
|
|
|
|
FIXME("(0x%04x),stub!\n",hwnd);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* OleMetaFilePictFromIconAndLabel (OLE2.56)
|
|
|
|
*
|
|
|
|
* Returns a global memory handle to a metafile which contains the icon and
|
|
|
|
* label given.
|
|
|
|
* I guess the result of that should look somehow like desktop icons.
|
|
|
|
* If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
|
|
|
|
* This code might be wrong at some places.
|
|
|
|
*/
|
2009-12-23 17:11:24 +01:00
|
|
|
HGLOBAL16 WINAPI OleMetafilePictFromIconAndLabel16(
|
2010-01-04 20:26:54 +01:00
|
|
|
HICON16 icon16,
|
2003-07-09 21:49:12 +02:00
|
|
|
LPCOLESTR16 lpszLabel,
|
|
|
|
LPCOLESTR16 lpszSourceFile,
|
|
|
|
UINT16 iIconIndex
|
|
|
|
) {
|
2009-12-23 17:11:24 +01:00
|
|
|
METAFILEPICT *pict;
|
|
|
|
HGLOBAL hmf;
|
2005-04-13 17:16:40 +02:00
|
|
|
HGLOBAL16 hmf16;
|
2009-12-23 17:11:24 +01:00
|
|
|
LPWSTR label = NULL, source = NULL;
|
|
|
|
DWORD len;
|
2010-01-04 20:26:54 +01:00
|
|
|
HICON icon = convert_icon_to_32( icon16 );
|
2003-07-09 21:49:12 +02:00
|
|
|
|
2009-12-23 17:11:24 +01:00
|
|
|
if (lpszLabel)
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, lpszLabel, -1, NULL, 0 );
|
|
|
|
label = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpszLabel, -1, label, len );
|
|
|
|
}
|
|
|
|
if (lpszSourceFile)
|
|
|
|
{
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, lpszSourceFile, -1, NULL, 0 );
|
|
|
|
source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, lpszSourceFile, -1, source, len );
|
|
|
|
}
|
2010-01-04 20:26:54 +01:00
|
|
|
hmf = OleMetafilePictFromIconAndLabel( icon, label, source, iIconIndex );
|
2009-12-23 17:11:24 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, label );
|
|
|
|
HeapFree( GetProcessHeap(), 0, source );
|
2010-01-04 20:26:54 +01:00
|
|
|
DestroyIcon( icon );
|
2005-04-13 17:16:40 +02:00
|
|
|
|
2009-12-23 17:11:24 +01:00
|
|
|
if (!hmf) return 0;
|
|
|
|
pict = GlobalLock( hmf );
|
2005-04-13 17:16:40 +02:00
|
|
|
|
|
|
|
hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16));
|
2009-12-23 17:11:24 +01:00
|
|
|
if (hmf16)
|
2005-04-13 17:16:40 +02:00
|
|
|
{
|
2009-12-23 17:11:24 +01:00
|
|
|
METAFILEPICT16 *pict16 = GlobalLock16( hmf16 );
|
|
|
|
pict16->mm = pict->mm;
|
|
|
|
pict16->xExt = pict->xExt;
|
|
|
|
pict16->yExt = pict->yExt;
|
|
|
|
len = GetMetaFileBitsEx( pict->hMF, 0, 0 );
|
|
|
|
pict16->hMF = GlobalAlloc16( GMEM_MOVEABLE, len );
|
|
|
|
GetMetaFileBitsEx( pict->hMF, len, GlobalLock16( pict16->hMF) );
|
|
|
|
GlobalUnlock16( pict16->hMF );
|
|
|
|
GlobalUnlock16( hmf16 );
|
2005-04-13 17:16:40 +02:00
|
|
|
}
|
2009-12-23 17:11:24 +01:00
|
|
|
DeleteMetaFile( pict->hMF );
|
|
|
|
GlobalUnlock( hmf );
|
|
|
|
GlobalFree( hmf );
|
2005-04-13 17:16:40 +02:00
|
|
|
return hmf16;
|
2003-07-09 21:49:12 +02:00
|
|
|
}
|
2004-01-23 23:51:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CreateItemMoniker (OLE2.27)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR16 lpszItem,LPMONIKER* ppmk)
|
|
|
|
{
|
|
|
|
FIXME("(%s,%p),stub!\n",lpszDelim,ppmk);
|
|
|
|
*ppmk = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* CreateFileMoniker (OLE2.28)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk)
|
|
|
|
{
|
|
|
|
FIXME("(%s,%p),stub!\n",lpszPathName,ppmk);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-07-22 20:29:39 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* OleSetMenuDescriptor (OLE2.41)
|
2006-11-12 20:23:57 +01:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* hOleMenu FIXME: Should probably be an HOLEMENU16.
|
2005-07-22 20:29:39 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleSetMenuDescriptor16(
|
2006-11-12 20:23:57 +01:00
|
|
|
HOLEMENU hOleMenu,
|
2005-07-22 20:29:39 +02:00
|
|
|
HWND16 hwndFrame,
|
|
|
|
HWND16 hwndActiveObject,
|
|
|
|
LPOLEINPLACEFRAME lpFrame,
|
|
|
|
LPOLEINPLACEACTIVEOBJECT lpActiveObject)
|
|
|
|
{
|
2005-07-24 18:15:24 +02:00
|
|
|
FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject);
|
2005-07-22 20:29:39 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-07-24 18:15:24 +02:00
|
|
|
|
2005-08-15 11:46:51 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* OleLoad [OLE2.12]
|
2005-08-16 18:01:15 +02:00
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pStg Segmented LPSTORAGE pointer.
|
|
|
|
* pClientSite Segmented LPOLECLIENTSITE pointer.
|
2005-08-15 11:46:51 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleLoad16(
|
2005-08-16 18:01:15 +02:00
|
|
|
SEGPTR pStg,
|
|
|
|
REFIID riid,
|
|
|
|
SEGPTR pClientSite,
|
|
|
|
LPVOID* ppvObj)
|
2005-08-15 11:46:51 +02:00
|
|
|
{
|
2006-10-15 12:28:08 +02:00
|
|
|
FIXME("(%x,%s,%x,%p), stub!\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
|
2005-08-15 11:46:51 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2005-09-25 17:17:10 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* OleDoAutoConvert [OLE2.79]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleDoAutoConvert16(LPSTORAGE pStg, LPCLSID pClsidNew)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p) : stub\n",pStg,pClsidNew);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* OleSetClipboard [OLE2.49]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleSetClipboard16(IDataObject* pDataObj)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", pDataObj);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* OleGetClipboard [OLE2.50]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI OleGetClipboard16(IDataObject** ppDataObj)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", ppDataObj);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* OleFlushClipboard [OLE2.76]
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI OleFlushClipboard16(void)
|
|
|
|
{
|
|
|
|
return OleFlushClipboard();
|
|
|
|
}
|
2009-03-11 17:03:10 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* ReadClassStg (OLE2.18)
|
|
|
|
*
|
|
|
|
* This method reads the CLSID previously written to a storage object with
|
|
|
|
* the WriteClassStg.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pstg [I] Segmented LPSTORAGE pointer.
|
|
|
|
* pclsid [O] Pointer to where the CLSID is written
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: S_OK.
|
|
|
|
* Failure: HRESULT code.
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
|
|
|
|
{
|
|
|
|
STATSTG16 statstg;
|
|
|
|
HANDLE16 hstatstg;
|
|
|
|
HRESULT hres;
|
|
|
|
DWORD args[3];
|
|
|
|
|
|
|
|
TRACE("(%x, %p)\n", pstg, pclsid);
|
|
|
|
|
|
|
|
if(pclsid==NULL)
|
|
|
|
return E_POINTER;
|
|
|
|
/*
|
|
|
|
* read a STATSTG structure (contains the clsid) from the storage
|
|
|
|
*/
|
|
|
|
args[0] = (DWORD)pstg; /* iface */
|
|
|
|
args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg );
|
|
|
|
args[2] = STATFLAG_DEFAULT;
|
|
|
|
|
|
|
|
if (!WOWCallback16Ex(
|
|
|
|
(DWORD)((const IStorage16Vtbl*)MapSL(
|
|
|
|
(SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl)
|
|
|
|
)->Stat,
|
|
|
|
WCB16_PASCAL,
|
|
|
|
3*sizeof(DWORD),
|
|
|
|
(LPVOID)args,
|
|
|
|
(LPDWORD)&hres
|
|
|
|
)) {
|
|
|
|
WOWGlobalUnlockFree16(args[1]);
|
|
|
|
ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16));
|
|
|
|
WOWGlobalUnlockFree16(args[1]);
|
|
|
|
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
*pclsid=statstg.clsid;
|
|
|
|
TRACE("clsid is %s\n", debugstr_guid(&statstg.clsid));
|
|
|
|
}
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetConvertStg (OLE2.82)
|
|
|
|
*/
|
2011-04-25 17:41:04 +02:00
|
|
|
HRESULT WINAPI GetConvertStg16(LPSTORAGE stg)
|
|
|
|
{
|
2009-03-11 17:03:10 +01:00
|
|
|
FIXME("unimplemented stub!\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2011-04-25 17:41:04 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* ReleaseStgMedium (OLE2.32)
|
|
|
|
*/
|
|
|
|
VOID WINAPI ReleaseStgMedium16(LPSTGMEDIUM medium)
|
|
|
|
{
|
|
|
|
FIXME("%p: unimplemented stub!\n", medium);
|
|
|
|
}
|