mshtml_private.h 18.2 KB
Newer Older
1
/*
2
 * Copyright 2005-2006 Jacek Caban for CodeWeavers
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
#include "wingdi.h"
20 21 22
#include "docobj.h"
#include "mshtml.h"
#include "mshtmhst.h"
23
#include "hlink.h"
24

25 26
#include "wine/list.h"

27 28 29 30
#ifdef INIT_GUID
#include "initguid.h"
#endif

31 32
#include "nsiface.h"

33 34 35
#define GENERATE_MSHTML_NS_FAILURE(code) \
    ((nsresult) ((PRUint32)(1<<31) | ((PRUint32)(0x45+6)<<16) | (PRUint32)(code)))

36
#define NS_OK                     ((nsresult)0x00000000L)
37
#define NS_ERROR_FAILURE          ((nsresult)0x80004005L)
38 39
#define NS_NOINTERFACE            ((nsresult)0x80004002L)
#define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
40
#define NS_ERROR_INVALID_ARG      ((nsresult)0x80070057L) 
41
#define NS_ERROR_UNEXPECTED       ((nsresult)0x8000ffffL)
42
#define NS_ERROR_UNKNOWN_PROTOCOL ((nsresult)0x804b0012L)
43

44 45
#define WINE_NS_LOAD_FROM_MONIKER GENERATE_MSHTML_NS_FAILURE(0)

46 47 48
#define NS_FAILED(res) ((res) & 0x80000000)
#define NS_SUCCEEDED(res) (!NS_FAILED(res))

49 50
#define NSAPI WINAPI

51 52
#define MSHTML_E_NODOC    0x800a025c

53
typedef struct HTMLDOMNode HTMLDOMNode;
54
typedef struct ConnectionPoint ConnectionPoint;
55
typedef struct BSCallback BSCallback;
56

57 58 59 60 61 62 63
typedef struct {
    const IHTMLWindow2Vtbl *lpHTMLWindow2Vtbl;

    LONG ref;

    HTMLDocument *doc;
    nsIDOMWindow *nswindow;
64 65

    struct list entry;
66 67
} HTMLWindow;

68 69 70 71 72 73
typedef enum {
    UNKNOWN_USERMODE,
    BROWSEMODE,
    EDITMODE        
} USERMODE;

74 75 76 77 78 79 80
typedef struct {
    const IConnectionPointContainerVtbl  *lpConnectionPointContainerVtbl;

    ConnectionPoint *cp_list;
    IUnknown *outer;
} ConnectionPointContainer;

81 82 83
struct ConnectionPoint {
    const IConnectionPointVtbl *lpConnectionPointVtbl;

84
    IConnectionPointContainer *container;
85 86 87 88 89 90 91 92 93

    union {
        IUnknown *unk;
        IDispatch *disp;
        IPropertyNotifySink *propnotif;
    } *sinks;
    DWORD sinks_size;

    IID iid;
94 95

    ConnectionPoint *next;
96 97
};

98 99 100 101 102 103 104 105
typedef struct {
    const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;

    LONG ref;

    HTMLDocument *doc;
} HTMLOptionElementFactory;

106
struct HTMLDocument {
107
    const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
108
    const IHTMLDocument3Vtbl              *lpHTMLDocument3Vtbl;
109
    const IHTMLDocument4Vtbl              *lpHTMLDocument4Vtbl;
110
    const IHTMLDocument5Vtbl              *lpHTMLDocument5Vtbl;
111 112 113 114 115 116 117 118 119
    const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
    const IPersistFileVtbl                *lpPersistFileVtbl;
    const IMonikerPropVtbl                *lpMonikerPropVtbl;
    const IOleObjectVtbl                  *lpOleObjectVtbl;
    const IOleDocumentVtbl                *lpOleDocumentVtbl;
    const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
    const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
    const IViewObject2Vtbl                *lpViewObject2Vtbl;
    const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
120
    const IServiceProviderVtbl            *lpServiceProviderVtbl;
121
    const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
122
    const IOleControlVtbl                 *lpOleControlVtbl;
123
    const IHlinkTargetVtbl                *lpHlinkTargetVtbl;
124
    const IPersistStreamInitVtbl          *lpPersistStreamInitVtbl;
125
    const ICustomDocVtbl                  *lpCustomDocVtbl;
126

127
    LONG ref;
128

129
    NSContainer *nscontainer;
130
    HTMLWindow *window;
131

132
    IOleClientSite *client;
133
    IDocHostUIHandler *hostui;
134
    IOleInPlaceSite *ipsite;
135
    IOleInPlaceFrame *frame;
136
    IOleInPlaceUIWindow *ip_window;
137

138 139
    IOleUndoManager *undomgr;

140
    BSCallback *bscallback;
141
    IMoniker *mon;
142
    LPOLESTR url;
143

144
    HWND hwnd;
145
    HWND tooltips_hwnd;
146

147 148
    DOCHOSTUIINFO hostinfo;

149
    USERMODE usermode;
150
    READYSTATE readystate;
151 152
    BOOL in_place_active;
    BOOL ui_active;
153
    BOOL window_active;
Jacek Caban's avatar
Jacek Caban committed
154
    BOOL has_key_path;
155
    BOOL container_locked;
156
    BOOL focus;
157

158 159
    DWORD update;

160
    ConnectionPointContainer cp_container;
161 162 163
    ConnectionPoint cp_htmldocevents;
    ConnectionPoint cp_htmldocevents2;
    ConnectionPoint cp_propnotif;
164

165 166
    HTMLOptionElementFactory *option_factory;

167
    struct list selection_list;
168
    struct list range_list;
169

170
    HTMLDOMNode *nodes;
171
};
172

173 174 175 176 177
typedef struct {
    const nsIDOMEventListenerVtbl      *lpDOMEventListenerVtbl;
    NSContainer *This;
} nsEventListener;

178
struct NSContainer {
179 180 181 182 183 184 185 186
    const nsIWebBrowserChromeVtbl       *lpWebBrowserChromeVtbl;
    const nsIContextMenuListenerVtbl    *lpContextMenuListenerVtbl;
    const nsIURIContentListenerVtbl     *lpURIContentListenerVtbl;
    const nsIEmbeddingSiteWindowVtbl    *lpEmbeddingSiteWindowVtbl;
    const nsITooltipListenerVtbl        *lpTooltipListenerVtbl;
    const nsIInterfaceRequestorVtbl     *lpInterfaceRequestorVtbl;
    const nsIWeakReferenceVtbl          *lpWeakReferenceVtbl;
    const nsISupportsWeakReferenceVtbl  *lpSupportsWeakReferenceVtbl;
187

188 189
    nsEventListener blur_listener;
    nsEventListener focus_listener;
190
    nsEventListener keypress_listener;
191
    nsEventListener load_listener;
192

193 194 195
    nsIWebBrowser *webbrowser;
    nsIWebNavigation *navigation;
    nsIBaseWindow *window;
196
    nsIWebBrowserFocus *focus;
197

198
    nsIEditor *editor;
199 200
    nsIController *editor_controller;

201 202
    LONG ref;

203
    NSContainer *parent;
204 205
    HTMLDocument *doc;

206 207
    nsIURIContentListener *content_listener;

208
    HWND hwnd;
209

210
    BSCallback *bscallback; /* hack */
211 212
};

213 214 215 216 217 218 219 220 221 222 223 224 225 226
typedef struct {
    const nsIHttpChannelVtbl *lpHttpChannelVtbl;
    const nsIUploadChannelVtbl *lpUploadChannelVtbl;

    LONG ref;

    nsIChannel *channel;
    nsIHttpChannel *http_channel;
    nsIWineURI *uri;
    nsIInputStream *post_data_stream;
    nsILoadGroup *load_group;
    nsIInterfaceRequestor *notif_callback;
    nsLoadFlags load_flags;
    nsIURI *original_uri;
227
    char *content;
228
    char *charset;
229 230
} nsChannel;

231 232 233 234 235 236 237 238 239
typedef struct {
    const nsIInputStreamVtbl *lpInputStreamVtbl;

    LONG ref;

    char buf[1024];
    DWORD buf_size;
} nsProtocolStream;

240 241 242 243 244 245 246 247 248 249 250
struct BSCallback {
    const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
    const IServiceProviderVtbl    *lpServiceProviderVtbl;
    const IHttpNegotiate2Vtbl     *lpHttpNegotiate2Vtbl;
    const IInternetBindInfoVtbl   *lpInternetBindInfoVtbl;

    LONG ref;

    LPWSTR headers;
    HGLOBAL post_data;
    ULONG post_data_len;
251
    ULONG readed;
252 253 254 255

    nsChannel *nschannel;
    nsIStreamListener *nslistener;
    nsISupports *nscontext;
256

257
    IMoniker *mon;
258
    IBinding *binding;
259

260 261
    HTMLDocument *doc;

262
    nsProtocolStream *nsstream;
263 264
};

265
typedef struct {
266
    HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
267 268 269
    void (*destructor)(HTMLDOMNode*);
} NodeImplVtbl;

270 271
struct HTMLDOMNode {
    const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
272
    const NodeImplVtbl *vtbl;
273

274 275
    LONG ref;

276 277 278 279 280 281
    nsIDOMNode *nsnode;
    HTMLDocument *doc;

    HTMLDOMNode *next;
};

282
typedef struct {
283 284
    HTMLDOMNode node;

285 286
    const IHTMLElementVtbl   *lpHTMLElementVtbl;
    const IHTMLElement2Vtbl  *lpHTMLElement2Vtbl;
287 288 289 290

    nsIDOMHTMLElement *nselem;
} HTMLElement;

291
typedef struct {
292
    HTMLElement element;
293

294
    const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
295 296
} HTMLTextContainer;

297 298
#define HTMLWINDOW2(x)   ((IHTMLWindow2*)                 &(x)->lpHTMLWindow2Vtbl)

299
#define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
300
#define HTMLDOC3(x)      ((IHTMLDocument3*)               &(x)->lpHTMLDocument3Vtbl)
301
#define HTMLDOC4(x)      ((IHTMLDocument4*)               &(x)->lpHTMLDocument4Vtbl)
302
#define HTMLDOC5(x)      ((IHTMLDocument5*)               &(x)->lpHTMLDocument5Vtbl)
303 304 305 306 307 308 309 310 311 312 313 314 315
#define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
#define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
#define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
#define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
#define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
#define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
#define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
#define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
#define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
#define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
#define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
#define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
#define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
316
#define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
317
#define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
318
#define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
319
#define HLNKTARGET(x)    ((IHlinkTarget*)                 &(x)->lpHlinkTargetVtbl)
320
#define CONPTCONT(x)     ((IConnectionPointContainer*)    &(x)->lpConnectionPointContainerVtbl)
321
#define PERSTRINIT(x)    ((IPersistStreamInit*)           &(x)->lpPersistStreamInitVtbl)
322
#define CUSTOMDOC(x)     ((ICustomDoc*)                   &(x)->lpCustomDocVtbl)
323

324 325
#define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
#define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
326
#define NSURICL(x)       ((nsIURIContentListener*)        &(x)->lpURIContentListenerVtbl)
327
#define NSEMBWNDS(x)     ((nsIEmbeddingSiteWindow*)       &(x)->lpEmbeddingSiteWindowVtbl)
328
#define NSIFACEREQ(x)    ((nsIInterfaceRequestor*)        &(x)->lpInterfaceRequestorVtbl)
329
#define NSTOOLTIP(x)     ((nsITooltipListener*)           &(x)->lpTooltipListenerVtbl)
330
#define NSEVENTLIST(x)   ((nsIDOMEventListener*)          &(x)->lpDOMEventListenerVtbl)
331 332
#define NSWEAKREF(x)     ((nsIWeakReference*)             &(x)->lpWeakReferenceVtbl)
#define NSSUPWEAKREF(x)  ((nsISupportsWeakReference*)     &(x)->lpSupportsWeakReferenceVtbl)
333

334 335 336 337
#define NSCHANNEL(x)     ((nsIChannel*)        &(x)->lpHttpChannelVtbl)
#define NSHTTPCHANNEL(x) ((nsIHttpChannel*)    &(x)->lpHttpChannelVtbl)
#define NSUPCHANNEL(x)   ((nsIUploadChannel*)  &(x)->lpUploadChannelVtbl)

338
#define HTTPNEG(x)       ((IHttpNegotiate2*)              &(x)->lpHttpNegotiate2Vtbl)
339
#define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
340 341
#define BINDINFO(x)      ((IInternetBindInfo*)            &(x)->lpInternetBindInfoVtbl);

342
#define HTMLELEM(x)      ((IHTMLElement*)                 &(x)->lpHTMLElementVtbl)
343
#define HTMLELEM2(x)     ((IHTMLElement2*)                &(x)->lpHTMLElement2Vtbl)
344 345
#define HTMLDOMNODE(x)   ((IHTMLDOMNode*)                 &(x)->lpHTMLDOMNodeVtbl)

346 347
#define HTMLTEXTCONT(x)  ((IHTMLTextContainer*)           &(x)->lpHTMLTextContainerVtbl)

348 349
#define HTMLOPTFACTORY(x)  ((IHTMLOptionElementFactory*)  &(x)->lpHTMLOptionElementFactoryVtbl)

350 351
#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
352

353
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
354
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
355

356
HTMLWindow *HTMLWindow_Create(HTMLDocument*);
357
HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
358
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
359
void setup_nswindow(HTMLWindow*);
360

361
void HTMLDocument_HTMLDocument3_Init(HTMLDocument*);
362
void HTMLDocument_HTMLDocument5_Init(HTMLDocument*);
363
void HTMLDocument_Persist_Init(HTMLDocument*);
364
void HTMLDocument_OleCmd_Init(HTMLDocument*);
365
void HTMLDocument_OleObj_Init(HTMLDocument*);
366
void HTMLDocument_View_Init(HTMLDocument*);
367
void HTMLDocument_Window_Init(HTMLDocument*);
368
void HTMLDocument_Service_Init(HTMLDocument*);
369
void HTMLDocument_Hlink_Init(HTMLDocument*);
370

371
void ConnectionPoint_Init(ConnectionPoint*,IConnectionPointContainer*,REFIID,ConnectionPoint*);
372 373
void ConnectionPointContainer_Init(ConnectionPointContainer*,ConnectionPoint*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
374

375
NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
376
void NSContainer_Release(NSContainer*);
377

378
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
379
void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
380
void notif_focus(HTMLDocument*);
381

382 383
void show_tooltip(HTMLDocument*,DWORD,DWORD,LPCWSTR);
void hide_tooltip(HTMLDocument*);
384
HRESULT get_client_disp_property(IOleClientSite*,DISPID,VARIANT*);
385

386 387
HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);

388
BOOL load_gecko(BOOL);
389
void close_gecko(void);
390
void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*);
391
void init_nsio(nsIComponentManager*,nsIComponentRegistrar*);
392
BOOL install_wine_gecko(BOOL);
393

394
void hlink_frame_navigate(HTMLDocument*,IHlinkFrame*,LPCWSTR,nsIInputStream*,DWORD);
395

396 397
void call_property_onchanged(ConnectionPoint*,DISPID);

398 399 400
void *nsalloc(size_t);
void nsfree(void*);

401
void nsACString_Init(nsACString*,const char*);
402
void nsACString_SetData(nsACString*,const char*);
403
PRUint32 nsACString_GetData(const nsACString*,const char**,PRBool*);
404
void nsACString_Finish(nsACString*);
405

406 407 408 409
void nsAString_Init(nsAString*,const PRUnichar*);
PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**,PRBool*);
void nsAString_Finish(nsAString*);

410
nsIInputStream *create_nsstream(const char*,PRInt32);
411
nsICommandParams *create_nscommand_params(void);
412 413
nsIMutableArray *create_nsarray(void);
nsIWritableVariant *create_nsvariant(void);
414
void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
415
void get_editor_controller(NSContainer*);
416
void init_nsevents(NSContainer*);
417
nsresult get_nsinterface(nsISupports*,REFIID,void**);
418

419
BSCallback *create_bscallback(IMoniker*);
420
HRESULT start_binding(BSCallback*);
421
HRESULT load_stream(BSCallback*,IStream*);
422
void set_document_bscallback(HTMLDocument*,BSCallback*);
423
void set_current_mon(HTMLDocument*,IMoniker*);
424

425
IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
426
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
427
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
428
IHTMLStyleSheet *HTMLStyleSheet_Create(void);
429
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
430

431
void detach_selection(HTMLDocument*);
432
void detach_ranges(HTMLDocument*);
433

434
HTMLElement *HTMLElement_Create(nsIDOMNode*);
435
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
436
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
437
HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement*);
438
HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement*);
439
HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
440
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
441

442
void HTMLElement2_Init(HTMLElement*);
443
void HTMLTextContainer_Init(HTMLTextContainer*);
444

445
HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
446 447
void HTMLDOMNode_destructor(HTMLDOMNode*);

448
HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
449
void HTMLElement_destructor(HTMLDOMNode*);
450

451 452 453
HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
void release_nodes(HTMLDocument*);

454 455
IHTMLElementCollection *create_all_collection(HTMLDOMNode*);

456
/* commands */
457 458 459 460 461 462
typedef struct {
    DWORD id;
    HRESULT (*query)(HTMLDocument*,OLECMD*);
    HRESULT (*exec)(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
} cmdtable_t;

463 464
extern const cmdtable_t editmode_cmds[];

465 466
void do_ns_command(NSContainer*,const char*,nsICommandParams*);

467
/* timer */
468 469 470 471
#define UPDATE_UI       0x0001
#define UPDATE_TITLE    0x0002

void update_doc(HTMLDocument *This, DWORD flags);
472
void update_title(HTMLDocument*);
473

474
/* editor */
475
void init_editor(HTMLDocument*);
476
void set_ns_editmode(NSContainer*);
477
void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
478
HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
479
HRESULT editor_exec_cut(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
480
HRESULT editor_exec_paste(HTMLDocument*,DWORD,VARIANT*,VARIANT*);
481
void handle_edit_load(HTMLDocument *This);
482
HRESULT editor_is_dirty(HTMLDocument*);
483

484 485
extern DWORD mshtml_tls;

486 487 488 489 490
typedef struct task_t {
    HTMLDocument *doc;

    enum {
        TASK_SETDOWNLOADSTATE,
491
        TASK_PARSECOMPLETE,
492 493
        TASK_SETPROGRESS,
        TASK_START_BINDING
494 495
    } task_id;

496 497
    BSCallback *bscallback;

498 499 500
    struct task_t *next;
} task_t;

501 502
typedef struct {
    HWND thread_hwnd;
503 504
    task_t *task_queue_head;
    task_t *task_queue_tail;
505 506 507 508
} thread_data_t;

thread_data_t *get_thread_data(BOOL);
HWND get_thread_hwnd(void);
509
void push_task(task_t*);
510
void remove_doc_tasks(const HTMLDocument*);
511

512 513 514 515 516 517 518 519
/* typelibs */
enum tid_t {
    IHTMLWindow2_tid,
    LAST_tid
};

HRESULT get_typeinfo(enum tid_t, ITypeInfo**);

520 521 522 523 524 525
DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);

526 527
DEFINE_GUID(CLSID_CMarkup,0x3050f4fb,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);

528 529 530 531
extern LONG module_ref;
#define LOCK_MODULE()   InterlockedIncrement(&module_ref)
#define UNLOCK_MODULE() InterlockedDecrement(&module_ref)

532 533 534 535 536 537 538
/* memory allocation functions */

static inline void *mshtml_alloc(size_t len)
{
    return HeapAlloc(GetProcessHeap(), 0, len);
}

539 540 541 542 543
static inline void *mshtml_alloc_zero(size_t len)
{
    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}

544 545 546 547 548 549 550 551 552 553
static inline void *mshtml_realloc(void *mem, size_t len)
{
    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
}

static inline BOOL mshtml_free(void *mem)
{
    return HeapFree(GetProcessHeap(), 0, mem);
}

554 555
HINSTANCE get_shdoclc(void);

556
extern HINSTANCE hInst;