ReactOS  0.4.13-dev-99-g7e18b6d
atl_ax.c
Go to the documentation of this file.
1 /*
2  * Active Template Library ActiveX functions (atl.dll)
3  *
4  * Copyright 2006 Andrey Turkin
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <stdarg.h>
22 #include <stdio.h>
23 
24 #define COBJMACROS
25 
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29 #include "winuser.h"
30 #include "wine/debug.h"
31 #include "wine/heap.h"
32 #include "objbase.h"
33 #include "objidl.h"
34 #include "ole2.h"
35 #include "exdisp.h"
36 #include "wine/atlbase.h"
37 #include "atliface.h"
38 #include "wine/atlwin.h"
39 #include "shlwapi.h"
40 
41 #include "wine/unicode.h"
42 
44 
45 typedef struct IOCS {
51 
58 } IOCS;
59 
60 static const WCHAR wine_atl_iocsW[] = {'_','_','W','I','N','E','_','A','T','L','_','I','O','C','S','\0'};
61 
62 /**********************************************************************
63  * AtlAxWin class window procedure
64  */
66 {
67  if ( wMsg == WM_CREATE )
68  {
70  WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
71  if (!ptr)
72  return 1;
75  HeapFree( GetProcessHeap(), 0, ptr );
76  return 0;
77  }
78  return DefWindowProcW( hWnd, wMsg, wParam, lParam );
79 }
80 
81 /***********************************************************************
82  * AtlAxWinInit [atl100.@]
83  * Initializes the control-hosting code: registering the AtlAxWin,
84  * AtlAxWin7 and AtlAxWinLic7 window classes and some messages.
85  *
86  * RETURNS
87  * TRUE or FALSE
88  */
89 
91 {
92  WNDCLASSEXW wcex;
93 
94 #if _ATL_VER <= _ATL_VER_30
95 #define ATL_NAME_SUFFIX 0
96 #elif _ATL_VER == _ATL_VER_80
97 #define ATL_NAME_SUFFIX '8','0',0
98 #elif _ATL_VER == _ATL_VER_90
99 #define ATL_NAME_SUFFIX '9','0',0
100 #elif _ATL_VER == _ATL_VER_100
101 #define ATL_NAME_SUFFIX '1','0','0',0
102 #elif _ATL_VER == _ATL_VER_110
103 #define ATL_NAME_SUFFIX '1','1','0',0
104 #else
105 #error Unsupported version
106 #endif
107 
108  static const WCHAR AtlAxWinW[] = {'A','t','l','A','x','W','i','n',ATL_NAME_SUFFIX};
109 
110  FIXME("version %04x semi-stub\n", _ATL_VER);
111 
112  if ( FAILED( OleInitialize(NULL) ) )
113  return FALSE;
114 
115  wcex.cbSize = sizeof(wcex);
117  wcex.cbClsExtra = 0;
118  wcex.cbWndExtra = 0;
119  wcex.hInstance = GetModuleHandleW( NULL );
120  wcex.hIcon = NULL;
121  wcex.hCursor = NULL;
122  wcex.hbrBackground = NULL;
123  wcex.lpszMenuName = NULL;
124  wcex.hIconSm = 0;
125 
127  wcex.lpszClassName = AtlAxWinW;
128  if ( !RegisterClassExW( &wcex ) )
129  return FALSE;
130 
131  if(_ATL_VER > _ATL_VER_30) {
132  static const WCHAR AtlAxWinLicW[] = {'A','t','l','A','x','W','i','n','L','i','c',ATL_NAME_SUFFIX};
133 
134  wcex.lpszClassName = AtlAxWinLicW;
135  if ( !RegisterClassExW( &wcex ) )
136  return FALSE;
137  }
138 
139  return TRUE;
140 }
141 
142 /***********************************************************************
143  * Atl container component implementation
144  */
145 
146 /****** IOleClientSite *****/
148 {
149  return CONTAINING_RECORD(iface, IOCS, IOleClientSite_iface);
150 }
151 
152 static HRESULT IOCS_Detach( IOCS *This ) /* remove subclassing */
153 {
154  if ( This->hWnd )
155  {
156  SetWindowLongPtrW( This->hWnd, GWLP_WNDPROC, (ULONG_PTR) This->OrigWndProc );
158  This->hWnd = NULL;
159  }
160  if ( This->control )
161  {
162  IOleObject *control = This->control;
163 
164  This->control = NULL;
165  IOleObject_Close( control, OLECLOSE_NOSAVE );
166  IOleObject_SetClientSite( control, NULL );
167  IOleObject_Release( control );
168  }
169  return S_OK;
170 }
171 
173 {
175 
176  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
177 
178  *ppv = NULL;
179 
180  if (IsEqualIID(&IID_IUnknown, riid) ||
182  {
183  *ppv = iface;
184  }
185  else if (IsEqualIID(&IID_IOleContainer, riid))
186  {
187  *ppv = &This->IOleContainer_iface;
188  }
189  else if (IsEqualIID(&IID_IOleInPlaceSite, riid) ||
190  IsEqualIID(&IID_IOleInPlaceSiteEx, riid) ||
191  IsEqualIID(&IID_IOleInPlaceSiteWindowless, riid))
192  {
193  *ppv = &This->IOleInPlaceSiteWindowless_iface;
194  }
196  {
197  *ppv = &This->IOleInPlaceFrame_iface;
198  }
199  else if (IsEqualIID(&IID_IOleControlSite, riid))
200  {
201  *ppv = &This->IOleControlSite_iface;
202  }
203 
204  if (*ppv)
205  {
206  IOleClientSite_AddRef(iface);
207  return S_OK;
208  }
209 
210  WARN("unsupported interface %s\n", debugstr_guid(riid));
211  return E_NOINTERFACE;
212 }
213 
215 {
218  TRACE("(%p)->(%d)\n", This, ref);
219  return ref;
220 }
221 
223 {
226 
227  TRACE("(%p)->(%d)\n", This, ref);
228 
229  if (!ref)
230  {
231  IOCS_Detach( This );
232  HeapFree( GetProcessHeap(), 0, This );
233  }
234 
235  return ref;
236 }
237 
239 {
241  FIXME( "(%p) - stub\n", This );
242  return E_NOTIMPL;
243 }
244 
245 static HRESULT WINAPI OleClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
246 {
248 
249  FIXME( "(%p, 0x%x, 0x%x, %p)\n", This, dwAssign, dwWhichMoniker, ppmk );
250  return E_NOTIMPL;
251 }
252 
254 {
256  TRACE("(%p, %p)\n", This, container);
257  return IOleClientSite_QueryInterface(iface, &IID_IOleContainer, (void**)container);
258 }
259 
261 {
263  FIXME( "(%p) - stub\n", This );
264  return S_OK;
265 }
266 
268 {
270  FIXME( "(%p, %s) - stub\n", This, fShow ? "TRUE" : "FALSE" );
271  return E_NOTIMPL;
272 }
273 
275 {
277  FIXME( "(%p) - stub\n", This );
278  return E_NOTIMPL;
279 }
280 
281 
282 /****** IOleContainer *****/
284 {
285  return CONTAINING_RECORD(iface, IOCS, IOleContainer_iface);
286 }
287 
289 {
291  return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
292 }
293 
295 {
297  return IOleClientSite_AddRef(&This->IOleClientSite_iface);
298 }
299 
301 {
303  return IOleClientSite_Release(&This->IOleClientSite_iface);
304 }
305 
307  LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut)
308 {
310  FIXME( "(%p,%p,%s,%p,%p) - stub\n", This, pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut );
311  return E_NOTIMPL;
312 }
313 
315 {
317  FIXME( "(%p, %u, %p) - stub\n", This, grfFlags, ppenum );
318  return E_NOTIMPL;
319 }
320 
322 {
324  FIXME( "(%p, %s) - stub\n", This, fLock?"TRUE":"FALSE" );
325  return E_NOTIMPL;
326 }
327 
328 
329 /****** IOleInPlaceSiteWindowless *******/
331 {
332  return CONTAINING_RECORD(iface, IOCS, IOleInPlaceSiteWindowless_iface);
333 }
334 
336 {
338  return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
339 }
340 
342 {
344  return IOleClientSite_AddRef(&This->IOleClientSite_iface);
345 }
346 
348 {
350  return IOleClientSite_Release(&This->IOleClientSite_iface);
351 }
352 
354 {
356 
357  TRACE("(%p,%p)\n", This, phwnd);
358  *phwnd = This->hWnd;
359  return S_OK;
360 }
361 
363 {
365  FIXME("(%p,%d) - stub\n", This, fEnterMode);
366  return E_NOTIMPL;
367 }
368 
370 {
372  TRACE("(%p)\n", This);
373  return S_OK;
374 }
375 
377 {
379 
380  TRACE("(%p)\n", This);
381 
382  This->fInPlace = TRUE;
383  return S_OK;
384 }
385 
387 {
389 
390  TRACE("(%p)\n", This);
391 
392  return S_OK;
393 }
395  IOleInPlaceFrame **frame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
396  LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
397 {
399 
400  TRACE("(%p,%p,%p,%p,%p,%p)\n", This, frame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo);
401 
402  if ( lprcClipRect )
403  *lprcClipRect = This->size;
404  if ( lprcPosRect )
405  *lprcPosRect = This->size;
406 
407  if ( frame )
408  {
409  *frame = &This->IOleInPlaceFrame_iface;
410  IOleInPlaceFrame_AddRef(*frame);
411  }
412 
413  if ( ppDoc )
414  *ppDoc = NULL;
415 
416  if ( lpFrameInfo )
417  {
418  lpFrameInfo->fMDIApp = FALSE;
419  lpFrameInfo->hwndFrame = This->hWnd;
420  lpFrameInfo->haccel = NULL;
421  lpFrameInfo->cAccelEntries = 0;
422  }
423 
424  return S_OK;
425 }
426 
428 {
430  FIXME("(%p) - stub\n", This);
431  return E_NOTIMPL;
432 }
433 
435 {
437  FIXME("(%p,%d) - stub\n", This, fUndoable);
438  return E_NOTIMPL;
439 }
440 
442 {
444 
445  TRACE("(%p)\n", This);
446 
447  This->fInPlace = This->fWindowless = FALSE;
448  return S_OK;
449 }
450 
452 {
454  FIXME("(%p) - stub\n", This);
455  return E_NOTIMPL;
456 }
457 
459 {
461  FIXME("(%p) - stub\n", This);
462  return E_NOTIMPL;
463 }
464 
466 {
468  FIXME("(%p,%p) - stub\n", This, lprcPosRect);
469  return E_NOTIMPL;
470 }
471 
473 {
475 
476  TRACE("\n");
477 
478  This->fActive = This->fInPlace = TRUE;
479  if ( dwFlags & ACTIVATE_WINDOWLESS )
480  This->fWindowless = TRUE;
481  return S_OK;
482 }
483 
485 {
487 
488  TRACE("\n");
489 
490  This->fActive = This->fInPlace = This->fWindowless = FALSE;
491  return S_OK;
492 }
494 {
495  FIXME("\n");
496  return E_NOTIMPL;
497 }
499 {
500  FIXME("\n");
501  return S_OK;
502 }
504 {
505  FIXME("\n");
506  return E_NOTIMPL;
507 }
509 {
510  FIXME("\n");
511  return E_NOTIMPL;
512 }
514 {
515  FIXME("\n");
516  return E_NOTIMPL;
517 }
519 {
520  FIXME("\n");
521  return E_NOTIMPL;
522 }
524 {
525  FIXME("\n");
526  return E_NOTIMPL;
527 }
529 {
530  FIXME("\n");
531  return E_NOTIMPL;
532 }
534 {
535  FIXME("\n");
536  return E_NOTIMPL;
537 }
539 {
540  FIXME("\n");
541  return E_NOTIMPL;
542 }
544 {
545  FIXME("\n");
546  return E_NOTIMPL;
547 }
549 {
550  FIXME("\n");
551  return E_NOTIMPL;
552 }
554 {
555  FIXME("\n");
556  return E_NOTIMPL;
557 }
558 
559 
560 /****** IOleInPlaceFrame *******/
562 {
563  return CONTAINING_RECORD(iface, IOCS, IOleInPlaceFrame_iface);
564 }
565 
567 {
569  return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
570 }
571 
573 {
575  return IOleClientSite_AddRef(&This->IOleClientSite_iface);
576 }
577 
579 {
581  return IOleClientSite_Release(&This->IOleClientSite_iface);
582 }
583 
585 {
587 
588  TRACE( "(%p,%p)\n", This, phWnd );
589 
590  *phWnd = This->hWnd;
591  return S_OK;
592 }
593 
595 {
597 
598  FIXME( "(%p,%d) - stub\n", This, fEnterMode );
599  return E_NOTIMPL;
600 }
601 
603 {
605 
606  FIXME( "(%p,%p) - stub\n", This, lprectBorder );
607  return E_NOTIMPL;
608 }
609 
610 static HRESULT WINAPI OleInPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
611 {
613 
614  FIXME( "(%p,%p) - stub\n", This, pborderwidths );
615  return E_NOTIMPL;
616 }
617 
618 static HRESULT WINAPI OleInPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
619 {
621 
622  FIXME( "(%p,%p) - stub\n", This, pborderwidths );
623  return E_NOTIMPL;
624 }
625 
626 static HRESULT WINAPI OleInPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
627 {
629 
630  FIXME( "(%p,%p,%s) - stub\n", This, pActiveObject, debugstr_w(pszObjName) );
631  return S_OK;
632 }
633 
634 static HRESULT WINAPI OleInPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
635 {
637 
638  FIXME( "(%p,%p,%p) - stub\n", This, hmenuShared, lpMenuWidths );
639  return E_NOTIMPL;
640 }
641 
642 static HRESULT WINAPI OleInPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
643 {
645 
646  FIXME( "(%p,%p,%p,%p) - stub\n", This, hmenuShared, holemenu, hwndActiveObject );
647  return E_NOTIMPL;
648 }
649 
651 {
653 
654  FIXME( "(%p, %p) - stub\n", This, hmenuShared );
655  return E_NOTIMPL;
656 }
657 
658 static HRESULT WINAPI OleInPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
659 {
661 
662  FIXME( "(%p, %s) - stub\n", This, debugstr_w( pszStatusText ) );
663  return E_NOTIMPL;
664 }
665 
667 {
669 
670  FIXME( "(%p, %d) - stub\n", This, fEnable );
671  return E_NOTIMPL;
672 }
673 
675 {
677 
678  FIXME( "(%p, %p, %x) - stub\n", This, lpmsg, wID );
679  return E_NOTIMPL;
680 }
681 
682 
683 /****** IOleControlSite *******/
685 {
686  return CONTAINING_RECORD(iface, IOCS, IOleControlSite_iface);
687 }
688 
690 {
692  return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
693 }
694 
696 {
698  return IOleClientSite_AddRef(&This->IOleClientSite_iface);
699 }
700 
702 {
704  return IOleClientSite_Release(&This->IOleClientSite_iface);
705 }
706 
708 {
709  FIXME( "\n" );
710  return E_NOTIMPL;
711 }
713 {
714  FIXME( "\n" );
715  return E_NOTIMPL;
716 }
718 {
719  FIXME( "\n" );
720  return E_NOTIMPL;
721 }
722 static HRESULT WINAPI OleControlSite_TransformCoords( IOleControlSite* This, POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags)
723 {
724  FIXME( "\n" );
725  return E_NOTIMPL;
726 }
728 {
729  FIXME( "\n" );
730  return E_NOTIMPL;
731 }
733 {
734  FIXME( "\n" );
735  return E_NOTIMPL;
736 }
738 {
739  FIXME( "\n" );
740  return E_NOTIMPL;
741 }
742 
743 
744 static const IOleClientSiteVtbl OleClientSite_vtbl = {
754 };
755 static const IOleContainerVtbl OleContainer_vtbl = {
762 };
763 static const IOleInPlaceSiteWindowlessVtbl OleInPlaceSiteWindowless_vtbl = {
794 };
795 static const IOleInPlaceFrameVtbl OleInPlaceFrame_vtbl =
796 {
812 };
813 static const IOleControlSiteVtbl OleControlSite_vtbl =
814 {
825 };
826 
827 static void IOCS_OnSize( IOCS* This, LPCRECT rect )
828 {
829  SIZEL inPix, inHi;
830 
831  This->size = *rect;
832 
833  if ( !This->control )
834  return;
835 
836  inPix.cx = rect->right - rect->left;
837  inPix.cy = rect->bottom - rect->top;
838  AtlPixelToHiMetric( &inPix, &inHi );
839  IOleObject_SetExtent( This->control, DVASPECT_CONTENT, &inHi );
840 
841  if ( This->fInPlace )
842  {
843  IOleInPlaceObject *wl;
844 
845  if ( SUCCEEDED( IOleObject_QueryInterface( This->control, &IID_IOleInPlaceObject, (void**)&wl ) ) )
846  {
847  IOleInPlaceObject_SetObjectRects( wl, rect, rect );
848  IOleInPlaceObject_Release( wl );
849  }
850  }
851 }
852 
853 static void IOCS_OnShow( IOCS *This, BOOL fShow )
854 {
855  if (!This->control || This->fActive || !fShow )
856  return;
857 
858  This->fActive = TRUE;
859 }
860 
861 static void IOCS_OnDraw( IOCS *This )
862 {
863  IViewObject *view;
864 
865  if ( !This->control || !This->fWindowless )
866  return;
867 
868  if ( SUCCEEDED( IOleObject_QueryInterface( This->control, &IID_IViewObject, (void**)&view ) ) )
869  {
870  HDC dc = GetDC( This->hWnd );
871  RECTL rect;
872 
873  rect.left = This->size.left; rect.top = This->size.top;
874  rect.bottom = This->size.bottom; rect.right = This->size.right;
875 
876  IViewObject_Draw( view, DVASPECT_CONTENT, ~0, NULL, NULL, 0, dc, &rect, &rect, NULL, 0 );
877  IViewObject_Release( view );
878  ReleaseDC( This->hWnd, dc );
879  }
880 }
881 
883 {
884  WNDPROC OrigWndProc = This->OrigWndProc;
885 
886  switch( uMsg )
887  {
888  case WM_DESTROY:
889  IOCS_Detach( This );
890  break;
891  case WM_SIZE:
892  {
893  RECT r;
894  SetRect(&r, 0, 0, LOWORD(lParam), HIWORD(lParam));
895  IOCS_OnSize( This, &r );
896  }
897  break;
898  case WM_SHOWWINDOW:
899  IOCS_OnShow( This, (BOOL) wParam );
900  break;
901  case WM_PAINT:
902  IOCS_OnDraw( This );
903  break;
904  }
905 
906  return CallWindowProcW( OrigWndProc, hWnd, uMsg, wParam, lParam );
907 }
908 
910 {
912  return IOCS_OnWndProc( This, hWnd, wMsg, wParam, lParam );
913 }
914 
915 static HRESULT IOCS_Attach( IOCS *This, HWND hWnd, IUnknown *pUnkControl ) /* subclass hWnd */
916 {
917  This->hWnd = hWnd;
918  IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control );
919  IOleObject_SetClientSite( This->control, &This->IOleClientSite_iface );
922 
923  return S_OK;
924 }
925 
927 {
928  RECT rect;
929  static const WCHAR AXWIN[] = {'A','X','W','I','N',0};
930 
931  IOleObject_SetHostNames( This->control, AXWIN, AXWIN );
932 
933  GetClientRect( This->hWnd, &rect );
934  IOCS_OnSize( This, &rect );
935  IOleObject_DoVerb( This->control, OLEIVERB_INPLACEACTIVATE, NULL, &This->IOleClientSite_iface,
936  0, This->hWnd, &rect );
937 
938  return S_OK;
939 }
940 
941 /**********************************************************************
942  * Create new instance of Atl host component and attach it to window *
943  */
945 {
946  HRESULT hr;
947  IOCS *This;
948 
949  if (!container)
950  return S_OK;
951 
952  *container = NULL;
953  This = HeapAlloc(GetProcessHeap(), 0, sizeof(IOCS));
954 
955  if (!This)
956  return E_OUTOFMEMORY;
957 
958  This->IOleClientSite_iface.lpVtbl = &OleClientSite_vtbl;
959  This->IOleContainer_iface.lpVtbl = &OleContainer_vtbl;
960  This->IOleInPlaceSiteWindowless_iface.lpVtbl = &OleInPlaceSiteWindowless_vtbl;
961  This->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrame_vtbl;
962  This->IOleControlSite_iface.lpVtbl = &OleControlSite_vtbl;
963  This->ref = 1;
964 
965  This->OrigWndProc = NULL;
966  This->hWnd = NULL;
967  This->fWindowless = This->fActive = This->fInPlace = FALSE;
968 
969  hr = IOCS_Attach( This, hWnd, pUnkControl );
970  if ( SUCCEEDED( hr ) )
971  hr = IOCS_Init( This );
972  if ( SUCCEEDED( hr ) )
973  *container = (IUnknown*)&This->IOleClientSite_iface;
974  else
975  {
976  IOCS_Detach( This );
978  }
979 
980  return hr;
981 }
982 
983 
984 /***********************************************************************
985  * AtlAxCreateControl [atl100.@]
986  */
988  IStream *pStream, IUnknown **ppUnkContainer)
989 {
990  return AtlAxCreateControlEx( lpszName, hWnd, pStream, ppUnkContainer,
991  NULL, NULL, NULL );
992 }
993 
995 {
996  IsEmpty = 0,
997  IsGUID = 1,
998  IsHTML = 2,
999  IsURL = 3,
1001 };
1002 
1003 static enum content get_content_type(LPCOLESTR name, CLSID *control_id)
1004 {
1005  static const WCHAR mshtml_prefixW[] = {'m','s','h','t','m','l',':',0};
1006  WCHAR new_urlW[MAX_PATH];
1007  DWORD size = MAX_PATH;
1008 
1009  if (!name || !name[0])
1010  {
1011  WARN("name %s\n", wine_dbgstr_w(name));
1012  return IsEmpty;
1013  }
1014 
1015  if (CLSIDFromString(name, control_id) == S_OK ||
1016  CLSIDFromProgID(name, control_id) == S_OK)
1017  return IsGUID;
1018 
1019  if (PathIsURLW (name) ||
1021  {
1022  *control_id = CLSID_WebBrowser;
1023  return IsURL;
1024  }
1025 
1026  if (!strncmpiW(name, mshtml_prefixW, 7))
1027  {
1028  FIXME("mshtml prefix not implemented\n");
1029  *control_id = CLSID_WebBrowser;
1030  return IsHTML;
1031  }
1032 
1033  return IsUnknown;
1034 }
1035 
1036 /***********************************************************************
1037  * AtlAxCreateControlLicEx [atl100.@]
1038  *
1039  * REMARKS
1040  * See http://www.codeproject.com/com/cwebpage.asp for some background
1041  *
1042  */
1044  IStream *pStream, IUnknown **ppUnkContainer, IUnknown **ppUnkControl,
1045  REFIID iidSink, IUnknown *punkSink, BSTR lic)
1046 {
1047  CLSID controlId;
1048  HRESULT hRes;
1049  IOleObject *pControl;
1050  IUnknown *pUnkControl = NULL;
1051  IPersistStreamInit *pPSInit;
1052  IUnknown *pContainer = NULL;
1053  enum content content;
1054 
1055  TRACE("(%s %p %p %p %p %p %p %s)\n", debugstr_w(lpszName), hWnd, pStream,
1056  ppUnkContainer, ppUnkControl, iidSink, punkSink, debugstr_w(lic));
1057 
1058  if (lic)
1059  FIXME("semi stub\n");
1060 
1061  if (ppUnkContainer) *ppUnkContainer = NULL;
1062  if (ppUnkControl) *ppUnkControl = NULL;
1063 
1064  content = get_content_type(lpszName, &controlId);
1065 
1066  if (content == IsEmpty)
1067  return S_OK;
1068 
1069  if (content == IsUnknown)
1070  return CO_E_CLASSSTRING;
1071 
1072  hRes = CoCreateInstance( &controlId, 0, CLSCTX_ALL, &IID_IOleObject,
1073  (void**) &pControl );
1074  if ( FAILED( hRes ) )
1075  {
1076  WARN( "cannot create ActiveX control %s instance - error 0x%08x\n",
1077  debugstr_guid( &controlId ), hRes );
1078  return hRes;
1079  }
1080 
1081  hRes = IOleObject_QueryInterface( pControl, &IID_IPersistStreamInit, (void**) &pPSInit );
1082  if ( SUCCEEDED( hRes ) )
1083  {
1084  if (!pStream)
1085  IPersistStreamInit_InitNew( pPSInit );
1086  else
1087  IPersistStreamInit_Load( pPSInit, pStream );
1088  IPersistStreamInit_Release( pPSInit );
1089  } else
1090  WARN("cannot get IID_IPersistStreamInit out of control\n");
1091 
1092  IOleObject_QueryInterface( pControl, &IID_IUnknown, (void**) &pUnkControl );
1093  IOleObject_Release( pControl );
1094 
1095 
1096  hRes = AtlAxAttachControl( pUnkControl, hWnd, &pContainer );
1097  if ( FAILED( hRes ) )
1098  WARN("cannot attach control to window\n");
1099 
1100  if ( content == IsURL )
1101  {
1102  IWebBrowser2 *browser;
1103 
1104  hRes = IOleObject_QueryInterface( pControl, &IID_IWebBrowser2, (void**) &browser );
1105  if ( !browser )
1106  WARN( "Cannot query IWebBrowser2 interface: %08x\n", hRes );
1107  else {
1108  VARIANT url;
1109 
1110  IWebBrowser2_put_Visible( browser, VARIANT_TRUE ); /* it seems that native does this on URL (but do not on MSHTML:! why? */
1111 
1112  V_VT(&url) = VT_BSTR;
1113  V_BSTR(&url) = SysAllocString( lpszName );
1114 
1115  hRes = IWebBrowser2_Navigate2( browser, &url, NULL, NULL, NULL, NULL );
1116  if ( FAILED( hRes ) )
1117  WARN( "IWebBrowser2::Navigate2 failed: %08x\n", hRes );
1118  SysFreeString( V_BSTR(&url) );
1119 
1120  IWebBrowser2_Release( browser );
1121  }
1122  }
1123 
1124  if (ppUnkContainer)
1125  {
1126  *ppUnkContainer = pContainer;
1127  if ( pContainer )
1128  IUnknown_AddRef( pContainer );
1129  }
1130  if (ppUnkControl)
1131  {
1132  *ppUnkControl = pUnkControl;
1133  if ( pUnkControl )
1134  IUnknown_AddRef( pUnkControl );
1135  }
1136 
1137  if ( pUnkControl )
1138  IUnknown_Release( pUnkControl );
1139  if ( pContainer )
1140  IUnknown_Release( pContainer );
1141 
1142  return S_OK;
1143 }
1144 
1145 /***********************************************************************
1146  * AtlAxAttachControl [atl100.@]
1147  */
1149 {
1150  HRESULT hr;
1151 
1152  TRACE("(%p %p %p)\n", control, hWnd, container);
1153 
1154  if (!control)
1155  return E_INVALIDARG;
1156 
1157  hr = IOCS_Create( hWnd, control, container );
1158  return hWnd ? hr : S_FALSE;
1159 }
1160 
1161 /**********************************************************************
1162  * Helper function for AX_ConvertDialogTemplate
1163  */
1164 static inline BOOL advance_array(WORD **pptr, DWORD *palloc, DWORD *pfilled, const WORD *data, DWORD size)
1165 {
1166  if ( (*pfilled + size) > *palloc )
1167  {
1168  *palloc = ((*pfilled+size) + 0xFF) & ~0xFF;
1169  *pptr = HeapReAlloc( GetProcessHeap(), 0, *pptr, *palloc * sizeof(WORD) );
1170  if (!*pptr)
1171  return FALSE;
1172  }
1173  RtlMoveMemory( *pptr+*pfilled, data, size * sizeof(WORD) );
1174  *pfilled += size;
1175  return TRUE;
1176 }
1177 
1178 /**********************************************************************
1179  * Convert ActiveX control templates to AtlAxWin class instances
1180  */
1182 {
1183 #define GET_WORD(x) (*(const WORD *)(x))
1184 #define GET_DWORD(x) (*(const DWORD *)(x))
1185 #define PUT_BLOCK(x,y) do {if (!advance_array(&output, &allocated, &filled, (x), (y))) return NULL;} while (0)
1186 #define PUT_WORD(x) do {WORD w = (x);PUT_BLOCK(&w, 1);} while(0)
1187  const WORD *tmp, *src = (const WORD *)src_tmpl;
1188  WORD *output;
1189  DWORD allocated, filled; /* in WORDs */
1190  BOOL ext;
1191  WORD signature, dlgver, rescount;
1192  DWORD style;
1193 
1194  filled = 0; allocated = 256;
1195  output = HeapAlloc( GetProcessHeap(), 0, allocated * sizeof(WORD) );
1196  if (!output)
1197  return NULL;
1198 
1199  /* header */
1200  tmp = src;
1201  signature = GET_WORD(src);
1202  dlgver = GET_WORD(src + 1);
1203  if (signature == 1 && dlgver == 0xFFFF)
1204  {
1205  ext = TRUE;
1206  src += 6;
1207  style = GET_DWORD(src);
1208  src += 2;
1209  rescount = GET_WORD(src++);
1210  src += 4;
1211  if ( GET_WORD(src) == 0xFFFF ) /* menu */
1212  src += 2;
1213  else
1214  src += strlenW(src) + 1;
1215  if ( GET_WORD(src) == 0xFFFF ) /* class */
1216  src += 2;
1217  else
1218  src += strlenW(src) + 1;
1219  src += strlenW(src) + 1; /* title */
1220  if ( style & (DS_SETFONT | DS_SHELLFONT) )
1221  {
1222  src += 3;
1223  src += strlenW(src) + 1;
1224  }
1225  } else {
1226  ext = FALSE;
1227  style = GET_DWORD(src);
1228  src += 4;
1229  rescount = GET_WORD(src++);
1230  src += 4;
1231  if ( GET_WORD(src) == 0xFFFF ) /* menu */
1232  src += 2;
1233  else
1234  src += strlenW(src) + 1;
1235  if ( GET_WORD(src) == 0xFFFF ) /* class */
1236  src += 2;
1237  else
1238  src += strlenW(src) + 1;
1239  src += strlenW(src) + 1; /* title */
1240  if ( style & DS_SETFONT )
1241  {
1242  src++;
1243  src += strlenW(src) + 1;
1244  }
1245  }
1246  PUT_BLOCK(tmp, src-tmp);
1247 
1248  while(rescount--)
1249  {
1250  src = (const WORD *)( ( ((ULONG_PTR)src) + 3) & ~3); /* align on DWORD boundary */
1251  filled = (filled + 1) & ~1; /* depends on DWORD-aligned allocation unit */
1252 
1253  tmp = src;
1254  if (ext)
1255  src += 12;
1256  else
1257  src += 9;
1258  PUT_BLOCK(tmp, src-tmp);
1259 
1260  tmp = src;
1261  if ( GET_WORD(src) == 0xFFFF ) /* class */
1262  {
1263  src += 2;
1264  } else
1265  {
1266  src += strlenW(src) + 1;
1267  }
1268  src += strlenW(src) + 1; /* title */
1269  if ( GET_WORD(tmp) == '{' ) /* all this mess created because of this line */
1270  {
1271  static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n', 0};
1272  PUT_BLOCK(AtlAxWin, ARRAY_SIZE(AtlAxWin));
1273  PUT_BLOCK(tmp, strlenW(tmp)+1);
1274  } else
1275  PUT_BLOCK(tmp, src-tmp);
1276 
1277  if ( GET_WORD(src) )
1278  {
1279  WORD size = (GET_WORD(src)+sizeof(WORD)-1) / sizeof(WORD); /* quite ugly :( Maybe use BYTE* instead of WORD* everywhere ? */
1280  PUT_BLOCK(src, size);
1281  src+=size;
1282  }
1283  else
1284  {
1285  PUT_WORD(0);
1286  src++;
1287  }
1288  }
1289  return (LPDLGTEMPLATEW) output;
1290 }
1291 
1292 /***********************************************************************
1293  * AtlAxCreateDialogA [atl100.@]
1294  *
1295  * Creates a dialog window
1296  *
1297  * PARAMS
1298  * hInst [I] Application instance
1299  * name [I] Dialog box template name
1300  * owner [I] Dialog box parent HWND
1301  * dlgProc [I] Dialog box procedure
1302  * param [I] This value will be passed to dlgProc as WM_INITDIALOG's message lParam
1303  *
1304  * RETURNS
1305  * Window handle of dialog window.
1306  */
1308 {
1309  HWND res = NULL;
1310  int length;
1311  WCHAR *nameW;
1312 
1313  if (IS_INTRESOURCE(name))
1314  return AtlAxCreateDialogW( hInst, (LPCWSTR) name, owner, dlgProc, param );
1315 
1316  length = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
1317  nameW = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
1318  if (nameW)
1319  {
1321  res = AtlAxCreateDialogW( hInst, nameW, owner, dlgProc, param );
1322  HeapFree( GetProcessHeap(), 0, nameW );
1323  }
1324  return res;
1325 }
1326 
1327 /***********************************************************************
1328  * AtlAxCreateDialogW [atl100.@]
1329  *
1330  * See AtlAxCreateDialogA
1331  *
1332  */
1334 {
1335  HRSRC hrsrc;
1336  HGLOBAL hgl;
1338  LPDLGTEMPLATEW newptr;
1339  HWND res;
1340 
1341  TRACE("(%p %s %p %p %lx)\n", hInst, debugstr_w(name), owner, dlgProc, param);
1342 
1343  hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG );
1344  if ( !hrsrc )
1345  return NULL;
1346  hgl = LoadResource (hInst, hrsrc);
1347  if ( !hgl )
1348  return NULL;
1349  ptr = LockResource ( hgl );
1350  if (!ptr)
1351  {
1352  FreeResource( hgl );
1353  return NULL;
1354  }
1355  newptr = AX_ConvertDialogTemplate( ptr );
1356  if ( newptr )
1357  {
1358  res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
1359  HeapFree( GetProcessHeap(), 0, newptr );
1360  } else
1361  res = NULL;
1362  FreeResource ( hrsrc );
1363  return res;
1364 }
1365 
1366 /***********************************************************************
1367  * AtlAxGetHost [atl100.@]
1368  *
1369  */
1371 {
1372  IOCS *This;
1373 
1374  TRACE("(%p, %p)\n", hWnd, host);
1375 
1376  *host = NULL;
1377 
1379  if ( !This )
1380  {
1381  WARN("No container attached to %p\n", hWnd );
1382  return E_FAIL;
1383  }
1384 
1385  return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, &IID_IUnknown, (void**)host);
1386 }
1387 
1388 /***********************************************************************
1389  * AtlAxGetControl [atl100.@]
1390  *
1391  */
1393 {
1394  IOCS *This;
1395 
1396  TRACE( "(%p, %p)\n", hWnd, pUnk );
1397 
1398  *pUnk = NULL;
1399 
1401  if ( !This || !This->control )
1402  {
1403  WARN("No control attached to %p\n", hWnd );
1404  return E_FAIL;
1405  }
1406 
1407  return IOleObject_QueryInterface( This->control, &IID_IUnknown, (void**) pUnk );
1408 }
1409 
1410 /***********************************************************************
1411  * AtlAxDialogBoxA [atl100.@]
1412  *
1413  */
1415 {
1416  INT_PTR res = 0;
1417  int length;
1418  WCHAR *nameW;
1419 
1420  if (IS_INTRESOURCE(name))
1421  return AtlAxDialogBoxW( hInst, (LPCWSTR) name, owner, dlgProc, param );
1422 
1423  length = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
1424  nameW = heap_alloc( length * sizeof(WCHAR) );
1425  if (nameW)
1426  {
1428  res = AtlAxDialogBoxW( hInst, nameW, owner, dlgProc, param );
1429  heap_free( nameW );
1430  }
1431  return res;
1432 }
1433 
1434 /***********************************************************************
1435  * AtlAxDialogBoxW [atl100.@]
1436  *
1437  */
1439 {
1440  HRSRC hrsrc;
1441  HGLOBAL hgl;
1443  LPDLGTEMPLATEW newptr;
1444  INT_PTR res;
1445 
1446  TRACE("(%p %s %p %p %lx)\n", hInst, debugstr_w(name), owner, dlgProc, param);
1447 
1448  hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG );
1449  if ( !hrsrc )
1450  return 0;
1451  hgl = LoadResource (hInst, hrsrc);
1452  if ( !hgl )
1453  return 0;
1454  ptr = LockResource ( hgl );
1455  if (!ptr)
1456  {
1457  FreeResource( hgl );
1458  return 0;
1459  }
1460  newptr = AX_ConvertDialogTemplate( ptr );
1461  if ( newptr )
1462  {
1463  res = DialogBoxIndirectParamW( hInst, newptr, owner, dlgProc, param );
1464  heap_free( newptr );
1465  } else
1466  res = 0;
1467  FreeResource ( hrsrc );
1468  return res;
1469 }
1470 
1471 /***********************************************************************
1472  * AtlAxCreateControlLic [atl100.59]
1473  *
1474  */
1476 {
1477  return AtlAxCreateControlLicEx(lpTricsData, hwnd, stream, container, NULL, NULL, NULL, lic);
1478 }
1479 
1480 /***********************************************************************
1481  * AtlAxCreateControlEx [atl100.@]
1482  *
1483  */
1485  IUnknown **container, IUnknown **control, REFIID iidSink, IUnknown *punkSink)
1486 {
1487  return AtlAxCreateControlLicEx(lpTricsData, hwnd, stream, container, control, iidSink, punkSink, NULL);
1488 }
static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
Definition: atl_ax.c:695
static HRESULT WINAPI OleInPlaceSiteWindowless_SetCapture(IOleInPlaceSiteWindowless *iface, BOOL fCapture)
Definition: atl_ax.c:508
IOleControlSite IOleControlSite_iface
Definition: atl_ax.c:50
const GUID IID_IOleInPlaceFrame
static HRESULT WINAPI OleInPlaceSiteWindowless_DiscardUndoState(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:451
static HRESULT WINAPI OleInPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
Definition: atl_ax.c:618
Definition: atl_ax.c:45
static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
Definition: atl_ax.c:701
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *This, IDispatch **ppDisp)
Definition: atl_ax.c:717
static IOCS * impl_from_IOleClientSite(IOleClientSite *iface)
Definition: atl_ax.c:147
#define GET_DWORD(x)
IOleInPlaceFrame IOleInPlaceFrame_iface
Definition: atl_ax.c:49
static HRESULT WINAPI OleClientSite_SaveObject(IOleClientSite *iface)
Definition: atl_ax.c:238
static HRESULT WINAPI OleInPlaceSiteWindowless_Scroll(IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
Definition: atl_ax.c:427
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *This, BOOL fGotFocus)
Definition: atl_ax.c:732
static HRESULT WINAPI OleInPlaceSiteWindowless_GetWindow(IOleInPlaceSiteWindowless *iface, HWND *phwnd)
Definition: atl_ax.c:353
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static HRESULT WINAPI OleInPlaceSiteWindowless_CanInPlaceActivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:369
const GUID IID_IViewObject
#define E_NOINTERFACE
Definition: winerror.h:2364
LONG ref
Definition: atl_ax.c:52
static HRESULT WINAPI OleInPlaceSiteWindowless_GetCapture(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:503
static IOCS * impl_from_IOleContainer(IOleContainer *iface)
Definition: atl_ax.c:283
BOOL WINAPI AtlAxWinInit(void)
Definition: atl_ax.c:90
static const IOleInPlaceFrameVtbl OleInPlaceFrame_vtbl
Definition: atl_ax.c:795
static HRESULT WINAPI OleInPlaceSiteWindowless_CanWindowlessActivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:498
WINE_DEFAULT_DEBUG_CHANNEL(atl)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int cbWndExtra
Definition: winuser.h:3173
#define PUT_WORD(x)
INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
Definition: atl_ax.c:1438
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static HRESULT WINAPI OleInPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
Definition: atl_ax.c:610
static void IOCS_OnDraw(IOCS *This)
Definition: atl_ax.c:861
static HRESULT WINAPI OleClientSite_GetContainer(IOleClientSite *iface, IOleContainer **container)
Definition: atl_ax.c:253
HDC WINAPI GetDC(_In_opt_ HWND)
static LRESULT IOCS_OnWndProc(IOCS *This, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atl_ax.c:882
HWND hWnd
Definition: atl_ax.c:53
static HRESULT WINAPI OleInPlaceSiteWindowless_DeactivateAndUndo(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:458
Definition: atl_ax.c:997
static HRESULT WINAPI OleInPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
Definition: atl_ax.c:658
REFIID riid
Definition: precomp.h:44
const GUID IID_IOleInPlaceSite
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static IOCS * impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
Definition: atl_ax.c:561
#define CP_ACP
Definition: compat.h:99
const GUID IID_IOleClientSite
GLint dy
Definition: linetemp.h:97
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WARN(fmt,...)
Definition: debug.h:111
char * host
Definition: whois.c:55
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
static HRESULT WINAPI OleInPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
Definition: atl_ax.c:674
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT WINAPI OleInPlaceSiteWindowless_OnDefWindowMessage(IOleInPlaceSiteWindowless *iface, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
Definition: atl_ax.c:553
#define wine_dbgstr_w
Definition: kernel32.h:34
static HRESULT WINAPI OleInPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
Definition: atl_ax.c:602
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define WM_SHOWWINDOW
Definition: winuser.h:1610
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HICON hIcon
Definition: winuser.h:3175
static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
Definition: atl_ax.c:306
HDC dc
Definition: cylfrac.c:34
UINT_PTR WPARAM
Definition: windef.h:207
static const IOleControlSiteVtbl OleControlSite_vtbl
Definition: atl_ax.c:813
static HRESULT IOCS_Init(IOCS *This)
Definition: atl_ax.c:926
OLECHAR * BSTR
Definition: compat.h:1934
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
int32_t INT_PTR
Definition: typedefs.h:62
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define _ATL_VER_30
Definition: atlbase.h:28
HRESULT WINAPI AtlAxCreateControlLic(const WCHAR *lpTricsData, HWND hwnd, IStream *stream, IUnknown **container, BSTR lic)
Definition: atl_ax.c:1475
static const IOleInPlaceSiteWindowlessVtbl OleInPlaceSiteWindowless_vtbl
Definition: atl_ax.c:763
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2511
int32_t INT
Definition: typedefs.h:56
Definition: send.c:47
HRESULT WINAPI AtlAxCreateControl(LPCOLESTR lpszName, HWND hWnd, IStream *pStream, IUnknown **ppUnkContainer)
Definition: atl_ax.c:987
static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags, IEnumUnknown **ppenum)
Definition: atl_ax.c:314
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
static HRESULT WINAPI OleInPlaceSiteWindowless_OnUIActivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:386
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
static const IOleClientSiteVtbl OleClientSite_vtbl
Definition: atl_ax.c:744
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
static HRESULT IOCS_Create(HWND hWnd, IUnknown *pUnkControl, IUnknown **container)
Definition: atl_ax.c:944
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *This, MSG *pMsg, DWORD grfModifiers)
Definition: atl_ax.c:727
static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *This, BOOL fLock)
Definition: atl_ax.c:712
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
uint32_t ULONG_PTR
Definition: typedefs.h:63
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
static const WCHAR wine_atl_iocsW[]
Definition: atl_ax.c:60
static HRESULT WINAPI OleInPlaceSiteWindowless_GetWindowContext(IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **frame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
Definition: atl_ax.c:394
LPCWSTR lpszMenuName
Definition: winuser.h:3178
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT WINAPI OleInPlaceSiteWindowless_ScrollRect(IOleInPlaceSiteWindowless *iface, INT dx, INT dy, LPCRECT pRectScroll, LPCRECT pRectClip)
Definition: atl_ax.c:543
HRESULT WINAPI AtlAxCreateControlLicEx(LPCOLESTR lpszName, HWND hWnd, IStream *pStream, IUnknown **ppUnkContainer, IUnknown **ppUnkControl, REFIID iidSink, IUnknown *punkSink, BSTR lic)
Definition: atl_ax.c:1043
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
const GUID IID_IOleControlSite
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
static PVOID ptr
Definition: dispmode.c:27
content
Definition: atl_ax.c:994
#define S_FALSE
Definition: winerror.h:2357
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT WINAPI OleInPlaceSiteWindowless_ReleaseDC(IOleInPlaceSiteWindowless *iface, HDC hDC)
Definition: atl_ax.c:528
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
static ULONG WINAPI OleClientSite_Release(IOleClientSite *iface)
Definition: atl_ax.c:222
LONG cx
Definition: windef.h:319
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
static void IOCS_OnSize(IOCS *This, LPCRECT rect)
Definition: atl_ax.c:827
static IOCS * impl_from_IOleInPlaceSiteWindowless(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:330
LONG_PTR LPARAM
Definition: windef.h:208
int cbClsExtra
Definition: winuser.h:3172
const char * LPCSTR
Definition: xmlstorage.h:183
Definition: atl_ax.c:999
#define debugstr_guid
Definition: kernel32.h:35
static enum content get_content_type(LPCOLESTR name, CLSID *control_id)
Definition: atl_ax.c:1003
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
const GUID IID_IOleInPlaceObject
LPCWSTR lpszClassName
Definition: winuser.h:3179
static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceDeactivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:441
#define WM_DESTROY
Definition: winuser.h:1591
const GUID IID_IOleObject
#define RT_DIALOG
Definition: pedump.c:367
#define _ATL_VER
Definition: atlbase.h:36
static const WCHAR nameW[]
Definition: main.c:46
RECT size
Definition: atl_ax.c:55
HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk)
Definition: atl_ax.c:1392
INT_PTR WINAPI AtlAxDialogBoxA(HINSTANCE hInst, LPCSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
Definition: atl_ax.c:1414
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT WINAPI OleInPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phWnd)
Definition: atl_ax.c:584
#define DS_SHELLFONT
Definition: winuser.h:381
GLsizeiptr size
Definition: glext.h:5919
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HRESULT WINAPI OleInPlaceSiteWindowless_RequestUIActivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:493
static HRESULT WINAPI OleInPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
Definition: atl_ax.c:642
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
static HRESULT WINAPI OleInPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
Definition: atl_ax.c:335
static void IOCS_OnShow(IOCS *This, BOOL fShow)
Definition: atl_ax.c:853
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1593
HWND WINAPI AtlAxCreateDialogA(HINSTANCE hInst, LPCSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
Definition: atl_ax.c:1307
static HRESULT WINAPI OleInPlaceSiteWindowless_GetFocus(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:513
HBRUSH hbrBackground
Definition: winuser.h:3177
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
UINT cbSize
Definition: winuser.h:3169
static HRESULT IOCS_Attach(IOCS *This, HWND hWnd, IUnknown *pUnkControl)
Definition: atl_ax.c:915
static const WCHAR url[]
Definition: encode.c:1432
static HRESULT WINAPI OleInPlaceSiteWindowless_GetDC(IOleInPlaceSiteWindowless *iface, LPCRECT pRect, DWORD grfFlags, HDC *phDC)
Definition: atl_ax.c:523
const GUID IID_IOleContainer
const GUID IID_IUnknown
static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
Definition: atl_ax.c:288
static HRESULT WINAPI OleInPlaceSiteWindowless_SetFocus(IOleInPlaceSiteWindowless *iface, BOOL fFocus)
Definition: atl_ax.c:518
#define CS_GLOBALCLASS
Definition: winuser.h:647
static ULONG WINAPI OleInPlaceFrame_AddRef(IOleInPlaceFrame *iface)
Definition: atl_ax.c:572
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:26
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define WINAPI
Definition: msvc.h:8
static ULONG WINAPI OleClientSite_AddRef(IOleClientSite *iface)
Definition: atl_ax.c:214
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT WINAPI OleInPlaceSiteWindowless_AdjustRect(IOleInPlaceSiteWindowless *iface, LPRECT prc)
Definition: atl_ax.c:548
static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *This)
Definition: atl_ax.c:737
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HINSTANCE hInstance
Definition: winuser.h:3174
#define WM_PAINT
Definition: winuser.h:1602
static HRESULT WINAPI OleInPlaceSiteWindowless_InvalidateRect(IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
Definition: atl_ax.c:533
HRESULT WINAPI AtlAxAttachControl(IUnknown *control, HWND hWnd, IUnknown **container)
Definition: atl_ax.c:1148
BOOL fWindowless
Definition: atl_ax.c:57
static HRESULT WINAPI OleInPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
Definition: atl_ax.c:626
static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceActivate(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:376
#define InterlockedDecrement
Definition: armddk.h:52
Definition: parse.h:22
const GUID IID_IPersistStreamInit
#define DS_SETFONT
Definition: winuser.h:378
HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwFlags)
Definition: url.c:1817
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define V_VT(A)
Definition: oleauto.h:211
static BOOL advance_array(WORD **pptr, DWORD *palloc, DWORD *pfilled, const WORD *data, DWORD size)
Definition: atl_ax.c:1164
WNDPROC OrigWndProc
Definition: atl_ax.c:56
GLenum GLsizei len
Definition: glext.h:6722
HCURSOR hCursor
Definition: winuser.h:3176
static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
Definition: atl_ax.c:1181
#define CS_DBLCLKS
Definition: winuser.h:646
BOOL fInPlace
Definition: atl_ax.c:57
GLenum src
Definition: glext.h:6340
UINT style
Definition: winuser.h:3170
#define V_BSTR(A)
Definition: oleauto.h:226
static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
Definition: atl_ax.c:689
WNDPROC lpfnWndProc
Definition: winuser.h:3171
#define GWLP_WNDPROC
Definition: treelist.c:66
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2849
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static LRESULT CALLBACK AtlHost_wndproc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: atl_ax.c:909
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2859
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
void WINAPI AtlPixelToHiMetric(const SIZEL *lpPix, SIZEL *lpHiMetric)
Definition: atl.c:166
static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *This)
Definition: atl_ax.c:707
static HRESULT WINAPI OleClientSite_RequestNewObjectLayout(IOleClientSite *iface)
Definition: atl_ax.c:274
static LRESULT CALLBACK AtlAxWin_wndproc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
Definition: atl_ax.c:65
IOleObject * control
Definition: atl_ax.c:54
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define S_OK
Definition: intsafe.h:59
HINSTANCE hInst
Definition: dxdiag.c:13
#define InterlockedIncrement
Definition: armddk.h:53
IOleInPlaceSiteWindowless IOleInPlaceSiteWindowless_iface
Definition: atl_ax.c:48
static HRESULT WINAPI OleClientSite_ShowObject(IOleClientSite *iface)
Definition: atl_ax.c:260
HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host)
Definition: atl_ax.c:1370
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
Definition: atl_ax.c:294
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *This, POINTL *pPtlHimetric, POINTF *pPtfContainer, DWORD dwFlags)
Definition: atl_ax.c:722
#define OLEIVERB_INPLACEACTIVATE
Definition: ole2.h:43
static HRESULT WINAPI OleInPlaceSiteWindowless_OnUIDeactivate(IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
Definition: atl_ax.c:434
#define HeapReAlloc
Definition: compat.h:393
static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceDeactivateEx(IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
Definition: atl_ax.c:484
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
Definition: atl_ax.c:321
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
unsigned int UINT
Definition: ndis.h:50
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceActivateEx(IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
Definition: atl_ax.c:472
static HRESULT WINAPI OleInPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: atl_ax.c:634
GLint dx
Definition: linetemp.h:97
HWND WINAPI AtlAxCreateDialogW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPROC dlgProc, LPARAM param)
Definition: atl_ax.c:1333
#define MultiByteToWideChar
Definition: compat.h:100
static HRESULT WINAPI OleInPlaceSiteWindowless_ContextSensitiveHelp(IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
Definition: atl_ax.c:362
HICON hIconSm
Definition: winuser.h:3180
#define URL_APPLY_GUESSSCHEME
Definition: shlwapi.h:1203
static ULONG WINAPI OleInPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:347
#define msg(x)
Definition: auth_time.c:54
static const IOleContainerVtbl OleContainer_vtbl
Definition: atl_ax.c:755
IOleClientSite IOleClientSite_iface
Definition: atl_ax.c:46
Definition: name.c:36
#define WM_CREATE
Definition: winuser.h:1590
GLuint res
Definition: glext.h:9613
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
#define ATL_NAME_SUFFIX
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:845
static IOleDocumentView * view
Definition: activex.c:1749
static HRESULT IOCS_Detach(IOCS *This)
Definition: atl_ax.c:152
static HRESULT WINAPI OleInPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
Definition: atl_ax.c:594
IOleContainer IOleContainer_iface
Definition: atl_ax.c:47
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define SetWindowLongPtrW
Definition: winuser.h:5215
static ULONG WINAPI OleInPlaceFrame_Release(IOleInPlaceFrame *iface)
Definition: atl_ax.c:578
#define URL_APPLY_GUESSFILE
Definition: shlwapi.h:1202
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
BOOL fActive
Definition: atl_ax.c:57
#define GET_WORD(x)
Arabic default style
Definition: afstyles.h:93
static HRESULT WINAPI OleClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
Definition: atl_ax.c:172
_Out_ LPRECT prc
Definition: ntgdi.h:1658
static HRESULT WINAPI OleInPlaceSiteWindowless_OnPosRectChange(IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
Definition: atl_ax.c:465
HRESULT WINAPI AtlAxCreateControlEx(const WCHAR *lpTricsData, HWND hwnd, IStream *stream, IUnknown **container, IUnknown **control, REFIID iidSink, IUnknown *punkSink)
Definition: atl_ax.c:1484
static HRESULT WINAPI OleInPlaceSiteWindowless_InvalidateRgn(IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
Definition: atl_ax.c:538
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LONG cy
Definition: windef.h:320
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
LPARAM lParam
Definition: combotst.c:139
static IOCS * impl_from_IOleControlSite(IOleControlSite *iface)
Definition: atl_ax.c:684
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static HRESULT WINAPI OleClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
Definition: atl_ax.c:245
static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
Definition: atl_ax.c:300
struct IOCS IOCS
static HRESULT WINAPI OleInPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
Definition: atl_ax.c:650
Definition: atl_ax.c:998
#define PUT_BLOCK(x, y)
static HRESULT WINAPI OleClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
Definition: atl_ax.c:267
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static HRESULT WINAPI OleInPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
Definition: atl_ax.c:566
static HRESULT WINAPI OleInPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
Definition: atl_ax.c:666
static ULONG WINAPI OleInPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
Definition: atl_ax.c:341