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
41 #include "wine/winbase16.h"
42 #include "wine/wingdi16.h"
43 #include "wine/winuser16.h"
46 #include "wine/debug.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(ole);
50 #define HICON_16(h32) (LOWORD(h32))
51 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
52 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
54 /***********************************************************************
55 * RegisterDragDrop (OLE2.35)
57 HRESULT WINAPI RegisterDragDrop16(
59 LPDROPTARGET pDropTarget
61 FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
65 /***********************************************************************
66 * RevokeDragDrop (OLE2.36)
68 HRESULT WINAPI RevokeDragDrop16(
71 FIXME("(0x%04x),stub!\n",hwnd);
75 /******************************************************************************
76 * OleMetaFilePictFromIconAndLabel (OLE2.56)
78 * Returns a global memory handle to a metafile which contains the icon and
80 * I guess the result of that should look somehow like desktop icons.
81 * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
82 * This code might be wrong at some places.
84 HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
86 LPCOLESTR16 lpszLabel,
87 LPCOLESTR16 lpszSourceFile,
98 HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
100 /* load the icon at index from lpszSourceFile */
101 hIcon = HICON_16(LoadIconA(HINSTANCE_32(hInstance), (LPCSTR)(DWORD)iIconIndex));
102 FreeLibrary16(hInstance);
107 FIXME("(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n",
108 hIcon, lpszLabel, lpszSourceFile, iIconIndex);
110 hdc = CreateMetaFileW(NULL);
111 DrawIcon(hdc, 0, 0, HICON_32(hIcon)); /* FIXME */
112 TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */
113 hmf = CloseMetaFile(hdc);
115 hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16));
116 mf16 = GlobalLock16(hmf16);
117 mf16->mm = MM_ANISOTROPIC;
118 mf16->xExt = 20; /* FIXME: bogus */
119 mf16->yExt = 20; /* ditto */
120 mfSize = GetMetaFileBitsEx(hmf, 0, 0);
121 mf16->hMF = GlobalAlloc16(GMEM_MOVEABLE, mfSize);
124 GetMetaFileBitsEx(hmf, mfSize, GlobalLock16(mf16->hMF));
125 GlobalUnlock16(mf16->hMF);
131 /******************************************************************************
132 * CreateItemMoniker (OLE2.27)
134 HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR16 lpszItem,LPMONIKER* ppmk)
136 FIXME("(%s,%p),stub!\n",lpszDelim,ppmk);
142 /******************************************************************************
143 * CreateFileMoniker (OLE2.28)
145 HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk)
147 FIXME("(%s,%p),stub!\n",lpszPathName,ppmk);
151 /******************************************************************************
152 * OleSetMenuDescriptor (OLE2.41)
155 * hOleMenu FIXME: Should probably be an HOLEMENU16.
157 HRESULT WINAPI OleSetMenuDescriptor16(
160 HWND16 hwndActiveObject,
161 LPOLEINPLACEFRAME lpFrame,
162 LPOLEINPLACEACTIVEOBJECT lpActiveObject)
164 FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject);
168 /******************************************************************************
169 * IsValidInterface [COMPOBJ.23]
171 * Determines whether a pointer is a valid interface.
174 * punk [I] Interface to be tested.
177 * TRUE, if the passed pointer is a valid interface, or FALSE otherwise.
179 BOOL WINAPI IsValidInterface16(SEGPTR punk)
183 if (IsBadReadPtr16(punk,4))
186 if (IsBadReadPtr16((SEGPTR)ptr[0],4)) /* check vtable ptr */
188 ptr = MapSL((SEGPTR)ptr[0]); /* ptr to first method */
189 if (IsBadReadPtr16((SEGPTR)ptr[0],2))
194 /******************************************************************************
198 * pStg Segmented LPSTORAGE pointer.
199 * pClientSite Segmented LPOLECLIENTSITE pointer.
201 HRESULT WINAPI OleLoad16(
207 FIXME("(%x,%s,%x,%p), stub!\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
211 /******************************************************************************
212 * OleDoAutoConvert [OLE2.79]
214 HRESULT WINAPI OleDoAutoConvert16(LPSTORAGE pStg, LPCLSID pClsidNew)
216 FIXME("(%p,%p) : stub\n",pStg,pClsidNew);
220 /***********************************************************************
221 * OleSetClipboard [OLE2.49]
223 HRESULT WINAPI OleSetClipboard16(IDataObject* pDataObj)
225 FIXME("(%p): stub\n", pDataObj);
229 /***********************************************************************
230 * OleGetClipboard [OLE2.50]
232 HRESULT WINAPI OleGetClipboard16(IDataObject** ppDataObj)
234 FIXME("(%p): stub\n", ppDataObj);
238 /***********************************************************************
239 * OleFlushClipboard [OLE2.76]
242 HRESULT WINAPI OleFlushClipboard16(void)
244 return OleFlushClipboard();