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);
51 #define HICON_16(h32) (LOWORD(h32))
52 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
53 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
55 /******************************************************************************
56 * OleBuildVersion (OLE2.1)
58 DWORD WINAPI OleBuildVersion16(void)
60 return OleBuildVersion();
63 /***********************************************************************
64 * OleInitialize (OLE2.2)
66 HRESULT WINAPI OleInitialize16(LPVOID reserved)
68 return OleInitialize( reserved );
71 /******************************************************************************
72 * OleUninitialize (OLE2.3)
74 void WINAPI OleUninitialize16(void)
76 return OleUninitialize();
79 /***********************************************************************
80 * DllGetClassObject (OLE2.4)
82 HRESULT WINAPI DllGetClassObject16(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
84 FIXME("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
88 /******************************************************************************
89 * GetRunningObjectTable (OLE2.30)
91 HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
93 FIXME("(%d,%p),stub!\n",reserved,pprot);
97 /***********************************************************************
98 * RegisterDragDrop (OLE2.35)
100 HRESULT WINAPI RegisterDragDrop16(
102 LPDROPTARGET pDropTarget
104 FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
108 /***********************************************************************
109 * RevokeDragDrop (OLE2.36)
111 HRESULT WINAPI RevokeDragDrop16(
114 FIXME("(0x%04x),stub!\n",hwnd);
118 /******************************************************************************
119 * OleMetaFilePictFromIconAndLabel (OLE2.56)
121 * Returns a global memory handle to a metafile which contains the icon and
123 * I guess the result of that should look somehow like desktop icons.
124 * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
125 * This code might be wrong at some places.
127 HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
129 LPCOLESTR16 lpszLabel,
130 LPCOLESTR16 lpszSourceFile,
133 METAFILEPICT16 *mf16;
140 if (lpszSourceFile) {
141 HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
143 /* load the icon at index from lpszSourceFile */
144 hIcon = HICON_16(LoadIconA(HINSTANCE_32(hInstance), (LPCSTR)(DWORD)iIconIndex));
145 FreeLibrary16(hInstance);
150 FIXME("(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n",
151 hIcon, lpszLabel, lpszSourceFile, iIconIndex);
153 hdc = CreateMetaFileW(NULL);
154 DrawIcon(hdc, 0, 0, HICON_32(hIcon)); /* FIXME */
155 TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */
156 hmf = CloseMetaFile(hdc);
158 hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16));
159 mf16 = GlobalLock16(hmf16);
160 mf16->mm = MM_ANISOTROPIC;
161 mf16->xExt = 20; /* FIXME: bogus */
162 mf16->yExt = 20; /* ditto */
163 mfSize = GetMetaFileBitsEx(hmf, 0, 0);
164 mf16->hMF = GlobalAlloc16(GMEM_MOVEABLE, mfSize);
167 GetMetaFileBitsEx(hmf, mfSize, GlobalLock16(mf16->hMF));
168 GlobalUnlock16(mf16->hMF);
174 /******************************************************************************
175 * CreateItemMoniker (OLE2.27)
177 HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR16 lpszItem,LPMONIKER* ppmk)
179 FIXME("(%s,%p),stub!\n",lpszDelim,ppmk);
185 /******************************************************************************
186 * CreateFileMoniker (OLE2.28)
188 HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk)
190 FIXME("(%s,%p),stub!\n",lpszPathName,ppmk);
194 /******************************************************************************
195 * OleSetMenuDescriptor (OLE2.41)
198 * hOleMenu FIXME: Should probably be an HOLEMENU16.
200 HRESULT WINAPI OleSetMenuDescriptor16(
203 HWND16 hwndActiveObject,
204 LPOLEINPLACEFRAME lpFrame,
205 LPOLEINPLACEACTIVEOBJECT lpActiveObject)
207 FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject);
211 /******************************************************************************
215 * pStg Segmented LPSTORAGE pointer.
216 * pClientSite Segmented LPOLECLIENTSITE pointer.
218 HRESULT WINAPI OleLoad16(
224 FIXME("(%x,%s,%x,%p), stub!\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
228 /******************************************************************************
229 * OleDoAutoConvert [OLE2.79]
231 HRESULT WINAPI OleDoAutoConvert16(LPSTORAGE pStg, LPCLSID pClsidNew)
233 FIXME("(%p,%p) : stub\n",pStg,pClsidNew);
237 /***********************************************************************
238 * OleSetClipboard [OLE2.49]
240 HRESULT WINAPI OleSetClipboard16(IDataObject* pDataObj)
242 FIXME("(%p): stub\n", pDataObj);
246 /***********************************************************************
247 * OleGetClipboard [OLE2.50]
249 HRESULT WINAPI OleGetClipboard16(IDataObject** ppDataObj)
251 FIXME("(%p): stub\n", ppDataObj);
255 /***********************************************************************
256 * OleFlushClipboard [OLE2.76]
259 HRESULT WINAPI OleFlushClipboard16(void)
261 return OleFlushClipboard();
264 /***********************************************************************
265 * ReadClassStg (OLE2.18)
267 * This method reads the CLSID previously written to a storage object with
271 * pstg [I] Segmented LPSTORAGE pointer.
272 * pclsid [O] Pointer to where the CLSID is written
276 * Failure: HRESULT code.
278 HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
285 TRACE("(%x, %p)\n", pstg, pclsid);
290 * read a STATSTG structure (contains the clsid) from the storage
292 args[0] = (DWORD)pstg; /* iface */
293 args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg );
294 args[2] = STATFLAG_DEFAULT;
296 if (!WOWCallback16Ex(
297 (DWORD)((const IStorage16Vtbl*)MapSL(
298 (SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl)
305 WOWGlobalUnlockFree16(args[1]);
306 ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres);
309 memcpy(&statstg, MapSL(args[1]), sizeof(STATSTG16));
310 WOWGlobalUnlockFree16(args[1]);
312 if(SUCCEEDED(hres)) {
313 *pclsid=statstg.clsid;
314 TRACE("clsid is %s\n", debugstr_guid(&statstg.clsid));
319 /***********************************************************************
320 * GetConvertStg (OLE2.82)
322 HRESULT WINAPI GetConvertStg16(LPSTORAGE stg) {
323 FIXME("unimplemented stub!\n");