server: Return an error for invalid requests instead of killing the client process.
[wine/gsoc_dplay.git] / dlls / mshtml / mshtml_private.h
blob846a467ac1c782e0f2700ad16d0172ea3985bb0d
1 /*
2 * Copyright 2005-2006 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 "docobj.h"
20 #include "mshtml.h"
21 #include "mshtmhst.h"
22 #include "hlink.h"
24 #ifdef INIT_GUID
25 #include "initguid.h"
26 #endif
28 #include "nsiface.h"
30 #define NS_OK ((nsresult)0x00000000L)
31 #define NS_ERROR_FAILURE ((nsresult)0x80004005L)
32 #define NS_NOINTERFACE ((nsresult)0x80004002L)
33 #define NS_ERROR_NOT_IMPLEMENTED ((nsresult)0x80004001L)
34 #define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
35 #define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
36 #define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
38 #define NS_FAILED(res) ((res) & 0x80000000)
39 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
41 #define NSAPI WINAPI
43 #define NS_ELEMENT_NODE 1
44 #define NS_DOCUMENT_NODE 9
46 typedef struct BindStatusCallback BindStatusCallback;
47 typedef struct HTMLDOMNode HTMLDOMNode;
48 typedef struct ConnectionPoint ConnectionPoint;
50 typedef struct {
51 const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
52 const IHTMLDocument3Vtbl *lpHTMLDocument3Vtbl;
53 const IPersistMonikerVtbl *lpPersistMonikerVtbl;
54 const IPersistFileVtbl *lpPersistFileVtbl;
55 const IMonikerPropVtbl *lpMonikerPropVtbl;
56 const IOleObjectVtbl *lpOleObjectVtbl;
57 const IOleDocumentVtbl *lpOleDocumentVtbl;
58 const IOleDocumentViewVtbl *lpOleDocumentViewVtbl;
59 const IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl;
60 const IViewObject2Vtbl *lpViewObject2Vtbl;
61 const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
62 const IServiceProviderVtbl *lpServiceProviderVtbl;
63 const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
64 const IOleControlVtbl *lpOleControlVtbl;
65 const IHlinkTargetVtbl *lpHlinkTargetVtbl;
66 const IConnectionPointContainerVtbl *lpConnectionPointContainerVtbl;
67 const IPersistStreamInitVtbl *lpPersistStreamInitVtbl;
69 LONG ref;
71 NSContainer *nscontainer;
73 IOleClientSite *client;
74 IDocHostUIHandler *hostui;
75 IOleInPlaceSite *ipsite;
76 IOleInPlaceFrame *frame;
78 HWND hwnd;
79 HWND tooltips_hwnd;
81 BOOL in_place_active;
82 BOOL ui_active;
83 BOOL window_active;
84 BOOL has_key_path;
85 BOOL container_locked;
87 BindStatusCallback *status_callback;
89 ConnectionPoint *cp_htmldocevents;
90 ConnectionPoint *cp_htmldocevents2;
92 HTMLDOMNode *nodes;
93 } HTMLDocument;
95 struct NSContainer {
96 const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
97 const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
98 const nsIURIContentListenerVtbl *lpURIContentListenerVtbl;
99 const nsIEmbeddingSiteWindowVtbl *lpEmbeddingSiteWindowVtbl;
100 const nsITooltipListenerVtbl *lpTooltipListenerVtbl;
101 const nsIInterfaceRequestorVtbl *lpInterfaceRequestorVtbl;
102 const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
103 const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
105 nsIWebBrowser *webbrowser;
106 nsIWebNavigation *navigation;
107 nsIBaseWindow *window;
108 nsIWebBrowserStream *stream;
109 nsIWebBrowserFocus *focus;
111 LONG ref;
113 NSContainer *parent;
114 HTMLDocument *doc;
116 HWND hwnd;
118 BOOL load_call; /* hack */
121 struct HTMLDOMNode {
122 const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
124 void (*destructor)(IUnknown*);
126 enum {
127 NT_UNKNOWN,
128 NT_HTMLELEM
129 } node_type;
131 union {
132 IUnknown *unk;
133 IHTMLElement *elem;
134 } impl;
136 nsIDOMNode *nsnode;
137 HTMLDocument *doc;
139 HTMLDOMNode *next;
142 typedef struct {
143 const IHTMLElementVtbl *lpHTMLElementVtbl;
144 const IHTMLElement2Vtbl *lpHTMLElement2Vtbl;
146 void (*destructor)(IUnknown*);
148 nsIDOMHTMLElement *nselem;
149 HTMLDOMNode *node;
151 IUnknown *impl;
152 } HTMLElement;
154 typedef struct {
155 const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
157 IUnknown *impl;
158 } HTMLTextContainer;
160 #define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl)
161 #define HTMLDOC3(x) ((IHTMLDocument3*) &(x)->lpHTMLDocument3Vtbl)
162 #define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl)
163 #define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl)
164 #define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl)
165 #define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl)
166 #define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl)
167 #define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl)
168 #define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl)
169 #define OLEWIN(x) ((IOleWindow*) &(x)->lpOleInPlaceActiveObjectVtbl)
170 #define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl)
171 #define VIEWOBJ(x) ((IViewObject*) &(x)->lpViewObject2Vtbl)
172 #define VIEWOBJ2(x) ((IViewObject2*) &(x)->lpViewObject2Vtbl)
173 #define INPLACEOBJ(x) ((IOleInPlaceObject*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
174 #define INPLACEWIN(x) ((IOleInPlaceObjectWindowless*) &(x)->lpOleInPlaceObjectWindowlessVtbl)
175 #define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
176 #define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
177 #define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
178 #define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
179 #define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl)
180 #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl)
181 #define PERSTRINIT(x) ((IPersistStreamInit*) &(x)->lpPersistStreamInitVtbl)
183 #define NSWBCHROME(x) ((nsIWebBrowserChrome*) &(x)->lpWebBrowserChromeVtbl)
184 #define NSCML(x) ((nsIContextMenuListener*) &(x)->lpContextMenuListenerVtbl)
185 #define NSURICL(x) ((nsIURIContentListener*) &(x)->lpURIContentListenerVtbl)
186 #define NSEMBWNDS(x) ((nsIEmbeddingSiteWindow*) &(x)->lpEmbeddingSiteWindowVtbl)
187 #define NSIFACEREQ(x) ((nsIInterfaceRequestor*) &(x)->lpInterfaceRequestorVtbl)
188 #define NSTOOLTIP(x) ((nsITooltipListener*) &(x)->lpTooltipListenerVtbl)
189 #define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
190 #define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
192 #define HTMLELEM(x) ((IHTMLElement*) &(x)->lpHTMLElementVtbl)
193 #define HTMLELEM2(x) ((IHTMLElement2*) &(x)->lpHTMLElement2Vtbl)
194 #define HTMLDOMNODE(x) ((IHTMLDOMNode*) &(x)->lpHTMLDOMNodeVtbl)
196 #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
198 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
200 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
202 void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
203 void HTMLDocument_Persist_Init(HTMLDocument*);
204 void HTMLDocument_OleObj_Init(HTMLDocument*);
205 void HTMLDocument_View_Init(HTMLDocument*);
206 void HTMLDocument_Window_Init(HTMLDocument*);
207 void HTMLDocument_Service_Init(HTMLDocument*);
208 void HTMLDocument_Hlink_Init(HTMLDocument*);
209 void HTMLDocument_ConnectionPoints_Init(HTMLDocument*);
211 NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
212 void NSContainer_Release(NSContainer*);
214 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
215 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
217 void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
218 void hide_tooltip(HTMLDocument*);
220 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
222 void close_gecko(void);
223 void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
224 void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
226 void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
228 nsIURI *get_nsIURI(LPCWSTR);
230 void *nsalloc(size_t);
231 void nsfree(void*);
233 void nsACString_Init(nsACString*,const char*);
234 PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
235 void nsACString_Finish(nsACString*);
237 void nsAString_Init(nsAString*,const PRUnichar*);
238 PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
239 void nsAString_Finish(nsAString*);
241 nsIInputStream *create_nsstream(const char*,PRInt32);
243 IHlink *Hlink_Create(void);
245 void HTMLElement_Create(HTMLDOMNode*);
246 void HTMLBodyElement_Create(HTMLElement*);
247 void HTMLInputElement_Create(HTMLElement*);
248 void HTMLSelectElement_Create(HTMLElement*);
249 void HTMLTextAreaElement_Create(HTMLElement*);
251 void HTMLElement2_Init(HTMLElement*);
253 void HTMLTextContainer_Init(HTMLTextContainer*,IUnknown*);
255 HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
256 HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);
258 HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
259 void release_nodes(HTMLDocument*);
261 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
262 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
263 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
264 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
265 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
267 DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
269 extern LONG module_ref;
270 #define LOCK_MODULE() InterlockedIncrement(&module_ref)
271 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
273 extern HINSTANCE hInst;