Commit | Line | Data |
---|---|---|
32d27dc7 SE |
1 | |
2 | /* | |
3 | * OLE2 library - 16 bit only interfaces | |
4 | * | |
5 | * Copyright 1995 Martin von Loewis | |
6 | * Copyright 1999 Francis Beaudet | |
7 | * Copyright 1999 Noel Borthwick | |
8 | * | |
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. | |
13 | * | |
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. | |
18 | * | |
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | #include "config.h" | |
25 | ||
26 | #include <assert.h> | |
27 | #include <stdlib.h> | |
e37c6e18 | 28 | #include <stdarg.h> |
32d27dc7 SE |
29 | #include <stdio.h> |
30 | #include <string.h> | |
31 | ||
32 | #define NONAMELESSUNION | |
33 | #define NONAMELESSSTRUCT | |
e37c6e18 AJ |
34 | #include "windef.h" |
35 | #include "winbase.h" | |
36 | #include "wingdi.h" | |
37 | #include "winuser.h" | |
38 | #include "winnls.h" | |
32d27dc7 SE |
39 | #include "commctrl.h" |
40 | #include "ole2.h" | |
41 | #include "ole2ver.h" | |
32d27dc7 | 42 | #include "winerror.h" |
32d27dc7 SE |
43 | #include "wownt32.h" |
44 | ||
45 | #include "wine/winbase16.h" | |
46 | #include "wine/wingdi16.h" | |
47 | #include "wine/winuser16.h" | |
d07c1004 | 48 | #include "ifs.h" |
32d27dc7 SE |
49 | |
50 | #include "wine/debug.h" | |
51 | ||
52 | WINE_DEFAULT_DEBUG_CHANNEL(ole); | |
53 | WINE_DECLARE_DEBUG_CHANNEL(accel); | |
54 | ||
55 | #define HICON_16(h32) (LOWORD(h32)) | |
56 | #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16)) | |
57 | #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) | |
58 | ||
59 | /*********************************************************************** | |
60 | * RegisterDragDrop (OLE2.35) | |
61 | */ | |
62 | HRESULT WINAPI RegisterDragDrop16( | |
63 | HWND16 hwnd, | |
64 | LPDROPTARGET pDropTarget | |
65 | ) { | |
66 | FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget); | |
67 | return S_OK; | |
68 | } | |
69 | ||
70 | /*********************************************************************** | |
71 | * RevokeDragDrop (OLE2.36) | |
72 | */ | |
73 | HRESULT WINAPI RevokeDragDrop16( | |
74 | HWND16 hwnd | |
75 | ) { | |
76 | FIXME("(0x%04x),stub!\n",hwnd); | |
77 | return S_OK; | |
78 | } | |
79 | ||
80 | /****************************************************************************** | |
81 | * OleMetaFilePictFromIconAndLabel (OLE2.56) | |
82 | * | |
83 | * Returns a global memory handle to a metafile which contains the icon and | |
84 | * label given. | |
85 | * I guess the result of that should look somehow like desktop icons. | |
86 | * If no hIcon is given, we load the icon via lpszSourceFile and iIconIndex. | |
87 | * This code might be wrong at some places. | |
88 | */ | |
89 | HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16( | |
90 | HICON16 hIcon, | |
91 | LPCOLESTR16 lpszLabel, | |
92 | LPCOLESTR16 lpszSourceFile, | |
93 | UINT16 iIconIndex | |
94 | ) { | |
e3e5cf19 DP |
95 | METAFILEPICT16 *mf16; |
96 | HGLOBAL16 hmf16; | |
97 | HMETAFILE hmf; | |
98 | INT mfSize; | |
32d27dc7 SE |
99 | HDC hdc; |
100 | ||
32d27dc7 SE |
101 | if (!hIcon) { |
102 | if (lpszSourceFile) { | |
103 | HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile); | |
104 | ||
105 | /* load the icon at index from lpszSourceFile */ | |
106 | hIcon = HICON_16(LoadIconA(HINSTANCE_32(hInstance), (LPCSTR)(DWORD)iIconIndex)); | |
107 | FreeLibrary16(hInstance); | |
108 | } else | |
109 | return 0; | |
110 | } | |
111 | ||
e3e5cf19 DP |
112 | FIXME("(%04x, '%s', '%s', %d): incorrect metrics, please try to correct them !\n", |
113 | hIcon, lpszLabel, lpszSourceFile, iIconIndex); | |
114 | ||
115 | hdc = CreateMetaFileW(NULL); | |
32d27dc7 SE |
116 | DrawIcon(hdc, 0, 0, HICON_32(hIcon)); /* FIXME */ |
117 | TextOutA(hdc, 0, 0, lpszLabel, 1); /* FIXME */ | |
e3e5cf19 DP |
118 | hmf = CloseMetaFile(hdc); |
119 | ||
120 | hmf16 = GlobalAlloc16(0, sizeof(METAFILEPICT16)); | |
121 | mf16 = (METAFILEPICT16 *)GlobalLock16(hmf16); | |
122 | mf16->mm = MM_ANISOTROPIC; | |
123 | mf16->xExt = 20; /* FIXME: bogus */ | |
124 | mf16->yExt = 20; /* dito */ | |
125 | mfSize = GetMetaFileBitsEx(hmf, 0, 0); | |
126 | mf16->hMF = GlobalAlloc16(GMEM_MOVEABLE, mfSize); | |
127 | if(mf16->hMF) | |
128 | { | |
129 | GetMetaFileBitsEx(hmf, mfSize, GlobalLock16(mf16->hMF)); | |
130 | GlobalUnlock16(mf16->hMF); | |
131 | } | |
132 | return hmf16; | |
32d27dc7 | 133 | } |
d07c1004 AJ |
134 | |
135 | ||
136 | /****************************************************************************** | |
137 | * CreateItemMoniker (OLE2.27) | |
138 | */ | |
139 | HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR16 lpszItem,LPMONIKER* ppmk) | |
140 | { | |
141 | FIXME("(%s,%p),stub!\n",lpszDelim,ppmk); | |
142 | *ppmk = NULL; | |
143 | return E_NOTIMPL; | |
144 | } | |
145 | ||
146 | ||
147 | /****************************************************************************** | |
148 | * CreateFileMoniker (OLE2.28) | |
149 | */ | |
150 | HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk) | |
151 | { | |
152 | FIXME("(%s,%p),stub!\n",lpszPathName,ppmk); | |
153 | return E_NOTIMPL; | |
154 | } | |
1c3054af MM |
155 | |
156 | /****************************************************************************** | |
157 | * OleSetMenuDescriptor (OLE2.41) | |
158 | */ | |
159 | HRESULT WINAPI OleSetMenuDescriptor16( | |
160 | HOLEMENU hOleMenu, /* FIXME: HOLEMENU16 likely */ | |
161 | HWND16 hwndFrame, | |
162 | HWND16 hwndActiveObject, | |
163 | LPOLEINPLACEFRAME lpFrame, | |
164 | LPOLEINPLACEACTIVEOBJECT lpActiveObject) | |
165 | { | |
c5feb317 | 166 | FIXME("(%p, %x, %x, %p, %p), stub!\n", hOleMenu, hwndFrame, hwndActiveObject, lpFrame, lpActiveObject); |
1c3054af MM |
167 | return E_NOTIMPL; |
168 | } | |
c5feb317 MM |
169 | |
170 | /****************************************************************************** | |
171 | * IsValidInterface [COMPOBJ.23] | |
172 | * | |
173 | * Determines whether a pointer is a valid interface. | |
174 | * | |
175 | * PARAMS | |
176 | * punk [I] Interface to be tested. | |
177 | * | |
178 | * RETURNS | |
179 | * TRUE, if the passed pointer is a valid interface, or FALSE otherwise. | |
180 | */ | |
181 | BOOL WINAPI IsValidInterface16(SEGPTR punk) | |
182 | { | |
183 | DWORD **ptr; | |
184 | ||
185 | if (IsBadReadPtr16(punk,4)) | |
186 | return FALSE; | |
187 | ptr = MapSL(punk); | |
188 | if (IsBadReadPtr16((SEGPTR)ptr[0],4)) /* check vtable ptr */ | |
189 | return FALSE; | |
190 | ptr = MapSL((SEGPTR)ptr[0]); /* ptr to first method */ | |
191 | if (IsBadReadPtr16((SEGPTR)ptr[0],2)) | |
192 | return FALSE; | |
193 | return TRUE; | |
194 | } | |
61b2fba9 MM |
195 | |
196 | /****************************************************************************** | |
197 | * OleLoad [OLE2.12] | |
71af5954 FG |
198 | * |
199 | * PARAMS | |
200 | * pStg Segmented LPSTORAGE pointer. | |
201 | * pClientSite Segmented LPOLECLIENTSITE pointer. | |
61b2fba9 MM |
202 | */ |
203 | HRESULT WINAPI OleLoad16( | |
71af5954 FG |
204 | SEGPTR pStg, |
205 | REFIID riid, | |
206 | SEGPTR pClientSite, | |
207 | LPVOID* ppvObj) | |
61b2fba9 MM |
208 | { |
209 | FIXME("(%lx,%s,%lx,%p), stub!\n", pStg, debugstr_guid(riid), pClientSite, ppvObj); | |
210 | return E_NOTIMPL; | |
211 | } |