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
40 #include "wine/winbase16.h"
41 #include "wine/wingdi16.h"
42 #include "wine/winuser16.h"
45 #include "wine/debug.h"
47 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
50 static HICON
convert_icon_to_32( HICON16 icon16
)
52 CURSORICONINFO
*info
= GlobalLock16( icon16
);
53 void *and_bits
= info
+ 1;
54 void *xor_bits
= (BYTE
*)and_bits
+ info
->nHeight
* 2 * ((info
->nWidth
+ 15) / 16);
55 HICON ret
= CreateIcon( 0, info
->nWidth
, info
->nHeight
, info
->bPlanes
, info
->bBitsPerPixel
,
57 GlobalUnlock16( icon16
);
61 /******************************************************************************
62 * OleBuildVersion (OLE2.1)
64 DWORD WINAPI
OleBuildVersion16(void)
66 return OleBuildVersion();
69 /***********************************************************************
70 * OleInitialize (OLE2.2)
72 HRESULT WINAPI
OleInitialize16(LPVOID reserved
)
74 return OleInitialize( reserved
);
77 /******************************************************************************
78 * OleUninitialize (OLE2.3)
80 void WINAPI
OleUninitialize16(void)
85 /***********************************************************************
86 * DllGetClassObject (OLE2.4)
88 HRESULT WINAPI
DllGetClassObject16(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
90 FIXME("(%s, %s, %p): stub\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
94 /******************************************************************************
95 * GetRunningObjectTable (OLE2.30)
97 HRESULT WINAPI
GetRunningObjectTable16(DWORD reserved
, LPRUNNINGOBJECTTABLE
*pprot
)
99 FIXME("(%d,%p),stub!\n",reserved
,pprot
);
103 /***********************************************************************
104 * RegisterDragDrop (OLE2.35)
106 HRESULT WINAPI
RegisterDragDrop16(
108 LPDROPTARGET pDropTarget
110 FIXME("(0x%04x,%p),stub!\n",hwnd
,pDropTarget
);
114 /***********************************************************************
115 * RevokeDragDrop (OLE2.36)
117 HRESULT WINAPI
RevokeDragDrop16(
120 FIXME("(0x%04x),stub!\n",hwnd
);
124 /******************************************************************************
125 * OleMetaFilePictFromIconAndLabel (OLE2.56)
127 * Returns a global memory handle to a metafile which contains the icon and
129 * I guess the result of that should look somehow like desktop icons.
130 * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex.
131 * This code might be wrong at some places.
133 HGLOBAL16 WINAPI
OleMetafilePictFromIconAndLabel16(
135 LPCOLESTR16 lpszLabel
,
136 LPCOLESTR16 lpszSourceFile
,
142 LPWSTR label
= NULL
, source
= NULL
;
144 HICON icon
= convert_icon_to_32( icon16
);
148 len
= MultiByteToWideChar( CP_ACP
, 0, lpszLabel
, -1, NULL
, 0 );
149 label
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
150 MultiByteToWideChar( CP_ACP
, 0, lpszLabel
, -1, label
, len
);
154 len
= MultiByteToWideChar( CP_ACP
, 0, lpszSourceFile
, -1, NULL
, 0 );
155 source
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof(WCHAR
) );
156 MultiByteToWideChar( CP_ACP
, 0, lpszSourceFile
, -1, source
, len
);
158 hmf
= OleMetafilePictFromIconAndLabel( icon
, label
, source
, iIconIndex
);
159 HeapFree( GetProcessHeap(), 0, label
);
160 HeapFree( GetProcessHeap(), 0, source
);
164 pict
= GlobalLock( hmf
);
166 hmf16
= GlobalAlloc16(0, sizeof(METAFILEPICT16
));
169 METAFILEPICT16
*pict16
= GlobalLock16( hmf16
);
170 pict16
->mm
= pict
->mm
;
171 pict16
->xExt
= pict
->xExt
;
172 pict16
->yExt
= pict
->yExt
;
173 len
= GetMetaFileBitsEx( pict
->hMF
, 0, 0 );
174 pict16
->hMF
= GlobalAlloc16( GMEM_MOVEABLE
, len
);
175 GetMetaFileBitsEx( pict
->hMF
, len
, GlobalLock16( pict16
->hMF
) );
176 GlobalUnlock16( pict16
->hMF
);
177 GlobalUnlock16( hmf16
);
179 DeleteMetaFile( pict
->hMF
);
186 /******************************************************************************
187 * CreateItemMoniker (OLE2.27)
189 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
,LPCOLESTR16 lpszItem
,LPMONIKER
* ppmk
)
191 FIXME("(%s,%p),stub!\n",lpszDelim
,ppmk
);
197 /******************************************************************************
198 * CreateFileMoniker (OLE2.28)
200 HRESULT WINAPI
CreateFileMoniker16(LPCOLESTR16 lpszPathName
,LPMONIKER
* ppmk
)
202 FIXME("(%s,%p),stub!\n",lpszPathName
,ppmk
);
206 /******************************************************************************
207 * OleSetMenuDescriptor (OLE2.41)
210 * hOleMenu FIXME: Should probably be an HOLEMENU16.
212 HRESULT WINAPI
OleSetMenuDescriptor16(
215 HWND16 hwndActiveObject
,
216 LPOLEINPLACEFRAME lpFrame
,
217 LPOLEINPLACEACTIVEOBJECT lpActiveObject
)
219 FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu
, hwndFrame
, hwndActiveObject
, lpFrame
, lpActiveObject
);
223 /******************************************************************************
227 * pStg Segmented LPSTORAGE pointer.
228 * pClientSite Segmented LPOLECLIENTSITE pointer.
230 HRESULT WINAPI
OleLoad16(
236 FIXME("(%x,%s,%x,%p), stub!\n", pStg
, debugstr_guid(riid
), pClientSite
, ppvObj
);
240 /******************************************************************************
241 * OleDoAutoConvert [OLE2.79]
243 HRESULT WINAPI
OleDoAutoConvert16(LPSTORAGE pStg
, LPCLSID pClsidNew
)
245 FIXME("(%p,%p) : stub\n",pStg
,pClsidNew
);
249 /***********************************************************************
250 * OleSetClipboard [OLE2.49]
252 HRESULT WINAPI
OleSetClipboard16(IDataObject
* pDataObj
)
254 FIXME("(%p): stub\n", pDataObj
);
258 /***********************************************************************
259 * OleGetClipboard [OLE2.50]
261 HRESULT WINAPI
OleGetClipboard16(IDataObject
** ppDataObj
)
263 FIXME("(%p): stub\n", ppDataObj
);
267 /***********************************************************************
268 * OleFlushClipboard [OLE2.76]
271 HRESULT WINAPI
OleFlushClipboard16(void)
273 return OleFlushClipboard();
276 /***********************************************************************
277 * ReadClassStg (OLE2.18)
279 * This method reads the CLSID previously written to a storage object with
283 * pstg [I] Segmented LPSTORAGE pointer.
284 * pclsid [O] Pointer to where the CLSID is written
288 * Failure: HRESULT code.
290 HRESULT WINAPI
ReadClassStg16(SEGPTR pstg
, CLSID
*pclsid
)
297 TRACE("(%x, %p)\n", pstg
, pclsid
);
302 * read a STATSTG structure (contains the clsid) from the storage
304 args
[0] = (DWORD
)pstg
; /* iface */
305 args
[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16
), &hstatstg
);
306 args
[2] = STATFLAG_DEFAULT
;
308 if (!WOWCallback16Ex(
309 (DWORD
)((const IStorage16Vtbl
*)MapSL(
310 (SEGPTR
)((LPSTORAGE16
)MapSL(pstg
))->lpVtbl
)
317 WOWGlobalUnlockFree16(args
[1]);
318 ERR("CallTo16 IStorage16::Stat() failed, hres %x\n",hres
);
321 memcpy(&statstg
, MapSL(args
[1]), sizeof(STATSTG16
));
322 WOWGlobalUnlockFree16(args
[1]);
324 if(SUCCEEDED(hres
)) {
325 *pclsid
=statstg
.clsid
;
326 TRACE("clsid is %s\n", debugstr_guid(&statstg
.clsid
));
331 /***********************************************************************
332 * GetConvertStg (OLE2.82)
334 HRESULT WINAPI
GetConvertStg16(LPSTORAGE stg
)
336 FIXME("unimplemented stub!\n");
340 /***********************************************************************
341 * ReleaseStgMedium (OLE2.32)
343 VOID WINAPI
ReleaseStgMedium16(LPSTGMEDIUM medium
)
345 FIXME("%p: unimplemented stub!\n", medium
);
348 /***********************************************************************
349 * WriteClassStg16 (OLE2.19)
351 HRESULT WINAPI
WriteClassStg16(IStorage
*stg
, REFCLSID clsid
)
353 FIXME("stub:%p %s\n", stg
, debugstr_guid(clsid
));
354 return STG_E_MEDIUMFULL
;