3 * OLE2 library - 16 bit only interfaces
5 * Copyright 1995 Martin von Loewis
6 * Copyright 1999 Francis Beaudet
7 * Copyright 1999 Noel Borthwick
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
42 #include "wine/winbase16.h"
43 #include "wine/wingdi16.h"
44 #include "wine/winuser16.h"
47 #include "wine/debug.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(ole);
52 static HICON convert_icon_to_32( HICON16 icon16 )
54 CURSORICONINFO *info = GlobalLock16( icon16 );
55 void *and_bits = info + 1;
56 void *xor_bits = (BYTE *)and_bits + info->nHeight * 2 * ((info->nWidth + 15) / 16);
57 HICON ret = CreateIcon( 0, info->nWidth, info->nHeight, info->bPlanes, info->bBitsPerPixel,
59 GlobalUnlock16( icon16 );
63 /******************************************************************************
64 * OleBuildVersion (OLE2.1)
66 DWORD WINAPI OleBuildVersion16(void)
68 return OleBuildVersion();
71 /***********************************************************************
72 * OleInitialize (OLE2.2)
74 HRESULT WINAPI OleInitialize16(LPVOID reserved)
76 return OleInitialize( reserved );
79 /******************************************************************************
80 * OleUninitialize (OLE2.3)
82 void WINAPI OleUninitialize16(void)
87 /***********************************************************************
88 * DllGetClassObject (OLE2.4)
90 HRESULT WINAPI DllGetClassObject16(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
92 FIXME("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
96 /******************************************************************************
97 * GetRunningObjectTable (OLE2.30)
99 HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
101 FIXME("(%d,%p),stub!\n",reserved,pprot);
105 /***********************************************************************
106 * RegisterDragDrop (OLE2.35)
108 HRESULT WINAPI RegisterDragDrop16(
110 LPDROPTARGET pDropTarget
112 FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
116 /***********************************************************************
117 * RevokeDragDrop (OLE2.36)
119 HRESULT WINAPI RevokeDragDrop16(
122 FIXME("(0x%04x),stub!\n",hwnd);
126 /******************************************************************************
127 * OleMetaFilePictFromIconAndLabel (OLE2.56)
129 * Returns a global memory handle to a metafile which contains the icon and
131 * I guess the result of that should look somehow like desktop icons.
132 * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
133 * This code might be wrong at some places.
135 HGLOBAL16 WINAPI OleMetafilePictFromIconAndLabel16(
137 LPCOLESTR16 lpszLabel,
138 LPCOLESTR16 lpszSourceFile,
144 LPWSTR label = NULL, source = NULL;
146 HICON icon = convert_icon_to_32( icon16 );
150 len = MultiByteToWideChar( CP_ACP, 0, lpszLabel, -1, NULL, 0 );
151 label = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
152 MultiByteToWideChar( CP_ACP, 0, lpszLabel, -1, label, len );
156 len = MultiByteToWideChar( CP_ACP, 0, lpszSourceFile, -1, NULL, 0 );
157 source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
158 MultiByteToWideChar( CP_ACP, 0, lpszSourceFile, -1, source, len );
160 hmf = OleMetafilePictFromIconAndLabel( icon, label, source, iIconIndex );
161 HeapFree( GetProcessHeap(), 0, label );
162 HeapFree( GetProcessHeap(), 0, source );
166 pict = GlobalLock( hmf );
168 hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16));
171 METAFILEPICT16 *pict16 = GlobalLock16( hmf16 );
172 pict16->mm = pict->mm;
173 pict16->xExt = pict->xExt;
174 pict16->yExt = pict->yExt;
175 len = GetMetaFileBitsEx( pict->hMF, 0, 0 );
176 pict16->hMF = GlobalAlloc16( GMEM_MOVEABLE, len );
177 GetMetaFileBitsEx( pict->hMF, len, GlobalLock16( pict16->hMF) );
178 GlobalUnlock16( pict16->hMF );
179 GlobalUnlock16( hmf16 );
181 DeleteMetaFile( pict->hMF );
188 /******************************************************************************
189 * CreateItemMoniker (OLE2.27)
191 HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR16 lpszItem,LPMONIKER* ppmk)
193 FIXME("(%s,%p),stub!\n",lpszDelim,ppmk);
199 /******************************************************************************
200 * CreateFileMoniker (OLE2.28)
202 HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk)
204 FIXME("(%s,%p),stub!\n",lpszPathName,ppmk);
208 /******************************************************************************
209 * OleSetMenuDescriptor (OLE2.41)
212 * hOleMenu FIXME: Should probably be an HOLEMENU16.
214 HRESULT WINAPI OleSetMenuDescriptor16(
217 HWND16 hwndActiveObject,
218 LPOLEINPLACEFRAME lpFrame,
219 LPOLEINPLACEACTIVEOBJECT lpActiveObject)
221 FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject);
225 /******************************************************************************
229 * pStg Segmented LPSTORAGE pointer.
230 * pClientSite Segmented LPOLECLIENTSITE pointer.
232 HRESULT WINAPI OleLoad16(
238 FIXME("(%x,%s,%x,%p), stub!\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
242 /******************************************************************************
243 * OleDoAutoConvert [OLE2.79]
245 HRESULT WINAPI OleDoAutoConvert16(LPSTORAGE pStg, LPCLSID pClsidNew)
247 FIXME("(%p,%p) : stub\n",pStg,pClsidNew);
251 /***********************************************************************
252 * OleSetClipboard [OLE2.49]
254 HRESULT WINAPI OleSetClipboard16(IDataObject* pDataObj)
256 FIXME("(%p): stub\n", pDataObj);
260 /***********************************************************************
261 * OleGetClipboard [OLE2.50]
263 HRESULT WINAPI OleGetClipboard16(IDataObject** ppDataObj)
265 FIXME("(%p): stub\n", ppDataObj);
269 /***********************************************************************
270 * OleFlushClipboard [OLE2.76]
273 HRESULT WINAPI OleFlushClipboard16(void)
275 return OleFlushClipboard();
278 /***********************************************************************
279 * ReadClassStg (OLE2.18)
281 * This method reads the CLSID previously written to a storage object with
285 * pstg [I] Segmented LPSTORAGE pointer.
286 * pclsid [O] Pointer to where the CLSID is written
290 * Failure: HRESULT code.
292 HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
299 TRACE("(%x, %p)\n", pstg, pclsid);
304 * read a STATSTG structure (contains the clsid) from the storage
306 args[0] = (DWORD)pstg; /* iface */
307 args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg );
308 args[2] = STATFLAG_DEFAULT;
310 if (!WOWCallback16Ex(
311 (DWORD)((const IStorage16Vtbl*)MapSL(
312 (SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl)
319 WOWGlobalUnlockFree16(args[1]);
320 ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres);
323 memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16));
324 WOWGlobalUnlockFree16(args[1]);
326 if(SUCCEEDED(hres)) {
327 *pclsid=statstg.clsid;
328 TRACE("clsid is %s\n", debugstr_guid(&statstg.clsid));
333 /***********************************************************************
334 * GetConvertStg (OLE2.82)
336 HRESULT WINAPI GetConvertStg16(LPSTORAGE stg)
338 FIXME("unimplemented stub!\n");
342 /***********************************************************************
343 * ReleaseStgMedium (OLE2.32)
345 VOID WINAPI ReleaseStgMedium16(LPSTGMEDIUM medium)
347 FIXME("%p: unimplemented stub!\n", medium);