ReactOS  0.4.14-dev-49-gfb4591c
window.c
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Piotr Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #define COBJMACROS
20 
21 #include "oleacc_private.h"
22 
23 #include "wine/unicode.h"
24 #include "wine/debug.h"
25 #include "wine/heap.h"
26 
28 
29 typedef struct {
33 
35 } Window;
36 
37 static inline Window* impl_from_Window(IAccessible *iface)
38 {
39  return CONTAINING_RECORD(iface, Window, IAccessible_iface);
40 }
41 
43 {
44  Window *This = impl_from_Window(iface);
45 
46  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
47 
48  if(IsEqualIID(riid, &IID_IAccessible) ||
51  *ppv = iface;
52  }else if(IsEqualIID(riid, &IID_IOleWindow)) {
53  *ppv = &This->IOleWindow_iface;
54  }else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
55  *ppv = &This->IEnumVARIANT_iface;
56  }else {
57  WARN("no interface: %s\n", debugstr_guid(riid));
58  *ppv = NULL;
59  return E_NOINTERFACE;
60  }
61 
62  IAccessible_AddRef(iface);
63  return S_OK;
64 }
65 
67 {
68  Window *This = impl_from_Window(iface);
70 
71  TRACE("(%p) ref = %u\n", This, ref);
72  return ref;
73 }
74 
76 {
77  Window *This = impl_from_Window(iface);
79 
80  TRACE("(%p) ref = %u\n", This, ref);
81 
82  if(!ref)
83  heap_free(This);
84  return ref;
85 }
86 
88 {
89  Window *This = impl_from_Window(iface);
90  FIXME("(%p)->(%p)\n", This, pctinfo);
91  return E_NOTIMPL;
92 }
93 
95  UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
96 {
97  Window *This = impl_from_Window(iface);
98  FIXME("(%p)->(%u %x %p)\n", This, iTInfo, lcid, ppTInfo);
99  return E_NOTIMPL;
100 }
101 
103  LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
104 {
105  Window *This = impl_from_Window(iface);
106  FIXME("(%p)->(%s %p %u %x %p)\n", This, debugstr_guid(riid),
107  rgszNames, cNames, lcid, rgDispId);
108  return E_NOTIMPL;
109 }
110 
111 static HRESULT WINAPI Window_Invoke(IAccessible *iface, DISPID dispIdMember,
112  REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
113  VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
114 {
115  Window *This = impl_from_Window(iface);
116  FIXME("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
117  lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
118  return E_NOTIMPL;
119 }
120 
122 {
123  Window *This = impl_from_Window(iface);
124  FIXME("(%p)->(%p)\n", This, ppdispParent);
125  return E_NOTIMPL;
126 }
127 
128 static HRESULT WINAPI Window_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
129 {
130  Window *This = impl_from_Window(iface);
131  FIXME("(%p)->(%p)\n", This, pcountChildren);
132  return E_NOTIMPL;
133 }
134 
136  VARIANT varChildID, IDispatch **ppdispChild)
137 {
138  Window *This = impl_from_Window(iface);
139  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varChildID), ppdispChild);
140  return E_NOTIMPL;
141 }
142 
143 static HRESULT WINAPI Window_get_accName(IAccessible *iface, VARIANT varID, BSTR *pszName)
144 {
145  Window *This = impl_from_Window(iface);
146  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszName);
147  return E_NOTIMPL;
148 }
149 
150 static HRESULT WINAPI Window_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
151 {
152  Window *This = impl_from_Window(iface);
153  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszValue);
154  return E_NOTIMPL;
155 }
156 
158  VARIANT varID, BSTR *pszDescription)
159 {
160  Window *This = impl_from_Window(iface);
161  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDescription);
162  return E_NOTIMPL;
163 }
164 
165 static HRESULT WINAPI Window_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
166 {
167  Window *This = impl_from_Window(iface);
168  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarRole);
169  return E_NOTIMPL;
170 }
171 
172 static HRESULT WINAPI Window_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
173 {
174  Window *This = impl_from_Window(iface);
175  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState);
176  return E_NOTIMPL;
177 }
178 
179 static HRESULT WINAPI Window_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
180 {
181  Window *This = impl_from_Window(iface);
182  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszHelp);
183  return E_NOTIMPL;
184 }
185 
187  BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
188 {
189  Window *This = impl_from_Window(iface);
190  FIXME("(%p)->(%p %s %p)\n", This, pszHelpFile, debugstr_variant(&varID), pidTopic);
191  return E_NOTIMPL;
192 }
193 
195  VARIANT varID, BSTR *pszKeyboardShortcut)
196 {
197  Window *This = impl_from_Window(iface);
198  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszKeyboardShortcut);
199  return E_NOTIMPL;
200 }
201 
203 {
204  Window *This = impl_from_Window(iface);
205  FIXME("(%p)->(%p)\n", This, pvarID);
206  return E_NOTIMPL;
207 }
208 
210 {
211  Window *This = impl_from_Window(iface);
212  FIXME("(%p)->(%p)\n", This, pvarID);
213  return E_NOTIMPL;
214 }
215 
217  VARIANT varID, BSTR *pszDefaultAction)
218 {
219  Window *This = impl_from_Window(iface);
220  FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDefaultAction);
221  return E_NOTIMPL;
222 }
223 
224 static HRESULT WINAPI Window_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
225 {
226  Window *This = impl_from_Window(iface);
227  FIXME("(%p)->(%x %s)\n", This, flagsSelect, debugstr_variant(&varID));
228  return E_NOTIMPL;
229 }
230 
232  LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
233 {
234  Window *This = impl_from_Window(iface);
235  FIXME("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
236  pcxWidth, pcyHeight, debugstr_variant(&varID));
237  return E_NOTIMPL;
238 }
239 
241  LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
242 {
243  Window *This = impl_from_Window(iface);
244  FIXME("(%p)->(%d %s %p)\n", This, navDir, debugstr_variant(&varStart), pvarEnd);
245  return E_NOTIMPL;
246 }
247 
249  LONG xLeft, LONG yTop, VARIANT *pvarID)
250 {
251  Window *This = impl_from_Window(iface);
252  FIXME("(%p)->(%d %d %p)\n", This, xLeft, yTop, pvarID);
253  return E_NOTIMPL;
254 }
255 
257 {
258  Window *This = impl_from_Window(iface);
259  FIXME("(%p)->(%s)\n", This, debugstr_variant(&varID));
260  return E_NOTIMPL;
261 }
262 
263 static HRESULT WINAPI Window_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
264 {
265  Window *This = impl_from_Window(iface);
266  FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszName));
267  return E_NOTIMPL;
268 }
269 
270 static HRESULT WINAPI Window_put_accValue(IAccessible *iface, VARIANT varID, BSTR pszValue)
271 {
272  Window *This = impl_from_Window(iface);
273  FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszValue));
274  return E_NOTIMPL;
275 }
276 
277 static const IAccessibleVtbl WindowVtbl = {
306 };
307 
309 {
310  return CONTAINING_RECORD(iface, Window, IOleWindow_iface);
311 }
312 
314 {
316  return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
317 }
318 
320 {
322  return IAccessible_AddRef(&This->IAccessible_iface);
323 }
324 
326 {
328  return IAccessible_Release(&This->IAccessible_iface);
329 }
330 
332 {
334  FIXME("(%p)->(%p)\n", This, phwnd);
335  return E_NOTIMPL;
336 }
337 
339 {
341  FIXME("(%p)->(%x)\n", This, fEnterMode);
342  return E_NOTIMPL;
343 }
344 
345 static const IOleWindowVtbl WindowOleWindowVtbl = {
351 };
352 
354 {
355  return CONTAINING_RECORD(iface, Window, IEnumVARIANT_iface);
356 }
357 
359 {
361  return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
362 }
363 
365 {
367  return IAccessible_AddRef(&This->IAccessible_iface);
368 }
369 
371 {
373  return IAccessible_Release(&This->IAccessible_iface);
374 }
375 
377  ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched)
378 {
380  FIXME("(%p)->(%u %p %p)\n", This, celt, rgVar, pCeltFetched);
381  return E_NOTIMPL;
382 }
383 
385 {
387  FIXME("(%p)->(%u)\n", This, celt);
388  return E_NOTIMPL;
389 }
390 
392 {
394  FIXME("(%p)\n", This);
395  return E_NOTIMPL;
396 }
397 
399 {
401  FIXME("(%p)->(%p)\n", This, ppEnum);
402  return E_NOTIMPL;
403 }
404 
405 static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl = {
413 };
414 
416 {
417  Window *window;
418  HRESULT hres;
419 
420  if(!IsWindow(hwnd))
421  return E_FAIL;
422 
423  window = heap_alloc_zero(sizeof(Window));
424  if(!window)
425  return E_OUTOFMEMORY;
426 
427  window->IAccessible_iface.lpVtbl = &WindowVtbl;
428  window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
429  window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl;
430  window->ref = 1;
431 
432  hres = IAccessible_QueryInterface(&window->IAccessible_iface, iid, obj);
433  IAccessible_Release(&window->IAccessible_iface);
434  return hres;
435 }
WINE_DEFAULT_DEBUG_CHANNEL(oleacc)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT WINAPI Window_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
Definition: window.c:165
static HRESULT WINAPI Window_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
Definition: window.c:172
static HRESULT WINAPI Window_GetIDsOfNames(IAccessible *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: window.c:102
#define REFIID
Definition: guiddef.h:118
static HRESULT WINAPI Window_accDoDefaultAction(IAccessible *iface, VARIANT varID)
Definition: window.c:256
#define E_NOINTERFACE
Definition: winerror.h:2364
IAccessible IAccessible_iface
Definition: window.c:30
HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj)
Definition: window.c:415
REFIID riid
Definition: precomp.h:44
static HRESULT WINAPI Window_get_accDefaultAction(IAccessible *iface, VARIANT varID, BSTR *pszDefaultAction)
Definition: window.c:216
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT WINAPI Window_get_accKeyboardShortcut(IAccessible *iface, VARIANT varID, BSTR *pszKeyboardShortcut)
Definition: window.c:194
static HRESULT WINAPI Window_EnumVARIANT_Clone(IEnumVARIANT *iface, IEnumVARIANT **ppEnum)
Definition: window.c:398
static ULONG WINAPI Window_OleWindow_AddRef(IOleWindow *iface)
Definition: window.c:319
REFIID LPVOID * ppv
Definition: atlbase.h:39
static Window * impl_from_Window(IAccessible *iface)
Definition: window.c:37
static HRESULT WINAPI Window_get_accDescription(IAccessible *iface, VARIANT varID, BSTR *pszDescription)
Definition: window.c:157
static const IOleWindowVtbl WindowOleWindowVtbl
Definition: window.c:345
static HRESULT WINAPI Window_accNavigate(IAccessible *iface, LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
Definition: window.c:240
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1934
static HRESULT WINAPI Window_EnumVARIANT_Reset(IEnumVARIANT *iface)
Definition: window.c:391
static HRESULT WINAPI Window_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
Definition: window.c:263
static HRESULT WINAPI Window_Invoke(IAccessible *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: window.c:111
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
static ULONG WINAPI Window_EnumVARIANT_AddRef(IEnumVARIANT *iface)
Definition: window.c:364
Definition: send.c:47
static HRESULT WINAPI Window_EnumVARIANT_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **ppv)
Definition: window.c:358
static HRESULT WINAPI Window_get_accParent(IAccessible *iface, IDispatch **ppdispParent)
Definition: window.c:121
Definition: window.c:29
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static ULONG WINAPI Window_EnumVARIANT_Release(IEnumVARIANT *iface)
Definition: window.c:370
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT WINAPI Window_accHitTest(IAccessible *iface, LONG xLeft, LONG yTop, VARIANT *pvarID)
Definition: window.c:248
static HRESULT WINAPI Window_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
Definition: window.c:179
smooth NULL
Definition: ftsmooth.c:416
static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl
Definition: window.c:405
static const IAccessibleVtbl WindowVtbl
Definition: window.c:277
#define debugstr_guid
Definition: kernel32.h:35
static Window * impl_from_Window_EnumVARIANT(IEnumVARIANT *iface)
Definition: window.c:353
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI Window_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
Definition: window.c:150
static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, void **ppv)
Definition: window.c:42
BOOL WINAPI IsWindow(HWND hWnd)
Definition: window.c:1543
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT WINAPI Window_EnumVARIANT_Skip(IEnumVARIANT *iface, ULONG celt)
Definition: window.c:384
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static HRESULT WINAPI Window_accLocation(IAccessible *iface, LONG *pxLeft, LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
Definition: window.c:231
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
static HRESULT WINAPI Window_get_accSelection(IAccessible *iface, VARIANT *pvarID)
Definition: window.c:209
int Window
Definition: x11stubs.h:26
const GUID IID_IDispatch
static HRESULT WINAPI Window_GetTypeInfo(IAccessible *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: window.c:94
static ULONG WINAPI Window_OleWindow_Release(IOleWindow *iface)
Definition: window.c:325
static HRESULT WINAPI Window_get_accHelpTopic(IAccessible *iface, BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
Definition: window.c:186
#define InterlockedDecrement
Definition: armddk.h:52
static IHTMLWindow2 * window
Definition: events.c:77
static ULONG WINAPI Window_Release(IAccessible *iface)
Definition: window.c:75
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
struct stdole::EXCEPINFO EXCEPINFO
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
IOleWindow IOleWindow_iface
Definition: window.c:31
#define InterlockedIncrement
Definition: armddk.h:53
static Window * impl_from_Window_OleWindow(IOleWindow *iface)
Definition: window.c:308
#define E_NOTIMPL
Definition: ddrawi.h:99
IEnumVARIANT IEnumVARIANT_iface
Definition: window.c:32
unsigned int UINT
Definition: ndis.h:50
static HRESULT WINAPI Window_get_accName(IAccessible *iface, VARIANT varID, BSTR *pszName)
Definition: window.c:143
LONG ref
Definition: window.c:34
struct stdole::DISPPARAMS DISPPARAMS
static HRESULT WINAPI Window_OleWindow_ContextSensitiveHelp(IOleWindow *iface, BOOL fEnterMode)
Definition: window.c:338
const GUID IID_IOleWindow
static HRESULT WINAPI Window_GetTypeInfoCount(IAccessible *iface, UINT *pctinfo)
Definition: window.c:87
static HRESULT WINAPI Window_EnumVARIANT_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched)
Definition: window.c:376
unsigned int ULONG
Definition: retypes.h:1
static HRESULT WINAPI Window_OleWindow_QueryInterface(IOleWindow *iface, REFIID riid, void **ppv)
Definition: window.c:313
static HRESULT WINAPI Window_put_accValue(IAccessible *iface, VARIANT varID, BSTR pszValue)
Definition: window.c:270
static HRESULT WINAPI Window_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
Definition: window.c:128
static ULONG WINAPI Window_AddRef(IAccessible *iface)
Definition: window.c:66
static HRESULT WINAPI Window_OleWindow_GetWindow(IOleWindow *iface, HWND *phwnd)
Definition: window.c:331
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static HRESULT WINAPI Window_get_accFocus(IAccessible *iface, VARIANT *pvarID)
Definition: window.c:202
static HRESULT WINAPI Window_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
Definition: window.c:224
static HRESULT WINAPI Window_get_accChild(IAccessible *iface, VARIANT varChildID, IDispatch **ppdispChild)
Definition: window.c:135
static BOOL heap_free(void *mem)
Definition: appwiz.h:75