shdocvw: Check safearray dimension too (Coverity).
[wine/multimedia.git] / dlls / shdocvw / frame.c
blob2323772ef30b8dbfdfa998982f6045a86764be3f
1 /*
2 * Copyright 2005 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wine/debug.h"
20 #include "shdocvw.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
24 static inline DocHost *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
26 return CONTAINING_RECORD(iface, DocHost, IOleInPlaceFrame_iface);
29 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface,
30 REFIID riid, void **ppv)
32 DocHost *This = impl_from_IOleInPlaceFrame(iface);
34 if(IsEqualGUID(&IID_IUnknown, riid)) {
35 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
36 *ppv = &This->IOleInPlaceFrame_iface;
37 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
38 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
39 *ppv = &This->IOleInPlaceFrame_iface;
40 }else if(IsEqualGUID(&IID_IOleInPlaceUIWindow, riid)) {
41 TRACE("(%p)->(IID_IOleInPlaceUIWindow %p)\n", This, ppv);
42 *ppv = &This->IOleInPlaceFrame_iface;
43 }else if(IsEqualGUID(&IID_IOleInPlaceFrame, riid)) {
44 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppv);
45 *ppv = &This->IOleInPlaceFrame_iface;
46 }else {
47 *ppv = NULL;
48 WARN("Unsopported interface %s\n", debugstr_guid(riid));
49 return E_NOINTERFACE;
53 IUnknown_AddRef((IUnknown*)*ppv);
54 return S_OK;
57 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
59 DocHost *This = impl_from_IOleInPlaceFrame(iface);
60 return IOleClientSite_AddRef(&This->IOleClientSite_iface);
63 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
65 DocHost *This = impl_from_IOleInPlaceFrame(iface);
66 return IOleClientSite_Release(&This->IOleClientSite_iface);
69 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
71 DocHost *This = impl_from_IOleInPlaceFrame(iface);
72 FIXME("(%p)->(%p)\n", This, phwnd);
73 return E_NOTIMPL;
76 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface,
77 BOOL fEnterMode)
79 DocHost *This = impl_from_IOleInPlaceFrame(iface);
80 FIXME("(%p)->(%x)\n", This, fEnterMode);
81 return E_NOTIMPL;
84 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
86 DocHost *This = impl_from_IOleInPlaceFrame(iface);
87 FIXME("(%p)->(%p)\n", This, lprectBorder);
88 return E_NOTIMPL;
91 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
92 LPCBORDERWIDTHS pborderwidths)
94 DocHost *This = impl_from_IOleInPlaceFrame(iface);
95 FIXME("(%p)->(%p)\n", This, pborderwidths);
96 return E_NOTIMPL;
99 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
100 LPCBORDERWIDTHS pborderwidths)
102 DocHost *This = impl_from_IOleInPlaceFrame(iface);
103 FIXME("(%p)->(%p)\n", This, pborderwidths);
104 return E_NOTIMPL;
107 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
108 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
110 DocHost *This = impl_from_IOleInPlaceFrame(iface);
111 FIXME("(%p)->(%p %s)\n", This, pActiveObject, debugstr_w(pszObjName));
112 return E_NOTIMPL;
115 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
116 LPOLEMENUGROUPWIDTHS lpMenuWidths)
118 DocHost *This = impl_from_IOleInPlaceFrame(iface);
119 FIXME("(%p)->(%p %p)\n", This, hmenuShared, lpMenuWidths);
120 return E_NOTIMPL;
123 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
124 HOLEMENU holemenu, HWND hwndActiveObject)
126 DocHost *This = impl_from_IOleInPlaceFrame(iface);
127 FIXME("(%p)->(%p %p %p)\n", This, hmenuShared, holemenu, hwndActiveObject);
128 return E_NOTIMPL;
131 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
133 DocHost *This = impl_from_IOleInPlaceFrame(iface);
134 FIXME("(%p)->(%p)\n", This, hmenuShared);
135 return E_NOTIMPL;
138 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface,
139 LPCOLESTR pszStatusText)
141 DocHost *This = impl_from_IOleInPlaceFrame(iface);
142 TRACE("(%p)->(%s)\n", This, debugstr_w(pszStatusText));
143 return This->container_vtbl->SetStatusText(This, pszStatusText);
146 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
148 DocHost *This = impl_from_IOleInPlaceFrame(iface);
149 FIXME("(%p)->(%x)\n", This, fEnable);
150 return E_NOTIMPL;
153 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg,
154 WORD wID)
156 DocHost *This = impl_from_IOleInPlaceFrame(iface);
157 FIXME("(%p)->(%p %d)\n", This, lpmsg, wID);
158 return E_NOTIMPL;
161 #undef impl_from_IOleInPlaceFrame
163 static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl = {
164 InPlaceFrame_QueryInterface,
165 InPlaceFrame_AddRef,
166 InPlaceFrame_Release,
167 InPlaceFrame_GetWindow,
168 InPlaceFrame_ContextSensitiveHelp,
169 InPlaceFrame_GetBorder,
170 InPlaceFrame_RequestBorderSpace,
171 InPlaceFrame_SetBorderSpace,
172 InPlaceFrame_SetActiveObject,
173 InPlaceFrame_InsertMenus,
174 InPlaceFrame_SetMenu,
175 InPlaceFrame_RemoveMenus,
176 InPlaceFrame_SetStatusText,
177 InPlaceFrame_EnableModeless,
178 InPlaceFrame_TranslateAccelerator
181 void DocHost_Frame_Init(DocHost *This)
183 This->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrameVtbl;