mshtml: Added hack to allow pass post data to IPersistMoniker::Load.
[wine] / dlls / mshtml / persist.c
1 /*
2  * Copyright 2005 Jacek Caban
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "ole2.h"
32 #include "shlguid.h"
33
34 #include "wine/debug.h"
35 #include "wine/unicode.h"
36
37 #include "mshtml_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40
41 struct BindStatusCallback {
42     const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
43
44     LONG ref;
45
46     HTMLDocument *doc;
47     IBinding *binding;
48     IStream *stream;
49     LPOLESTR url;
50 };
51
52 #define STATUSCLB_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
53
54 static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
55         REFIID riid, void **ppv)
56 {
57     BindStatusCallback *This = STATUSCLB_THIS(iface);
58
59     *ppv = NULL;
60     if(IsEqualGUID(&IID_IUnknown, riid)) {
61         TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv);
62         *ppv = STATUSCLB(This);
63     }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
64         TRACE("(%p)->(IID_IBindStatusCallback, %p)\n", This, ppv);
65         *ppv = STATUSCLB(This);
66     }
67
68     if(*ppv) {
69         IBindStatusCallback_AddRef(STATUSCLB(This));
70         return S_OK;
71     }
72
73     TRACE("Unsupported riid = %s\n", debugstr_guid(riid));
74     return E_NOINTERFACE;
75 }
76
77 static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
78 {
79     BindStatusCallback *This = STATUSCLB_THIS(iface);
80     LONG ref = InterlockedIncrement(&This->ref);
81
82     TRACE("(%p) ref = %ld\n", This, ref);
83
84     return ref;
85 }
86
87 static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
88 {
89     BindStatusCallback *This = STATUSCLB_THIS(iface);
90     LONG ref = InterlockedDecrement(&This->ref);
91
92     TRACE("(%p) ref = %ld\n", This, ref);
93
94     if(!ref) {
95         if(This->doc->status_callback == This)
96             This->doc->status_callback = NULL;
97         IHTMLDocument2_Release(HTMLDOC(This->doc));
98         if(This->stream)
99             IStream_Release(This->stream);
100         CoTaskMemFree(This->url);
101         HeapFree(GetProcessHeap(), 0, This);
102     }
103
104     return ref;
105 }
106
107 static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
108         DWORD dwReserved, IBinding *pbind)
109 {
110     BindStatusCallback *This = STATUSCLB_THIS(iface);
111
112     TRACE("(%p)->(%ld %p)\n", This, dwReserved, pbind);
113
114     This->binding = pbind;
115     IBinding_AddRef(pbind);
116
117     if(This->doc->nscontainer && This->doc->nscontainer->stream) {
118         nsACString *strTextHtml;
119         nsresult nsres;
120         nsIURI *uri = get_nsIURI(This->url);
121
122         strTextHtml = nsACString_Create();
123         /* FIXME: Set it correctly */
124         nsACString_SetData(strTextHtml, "text/html");
125
126         nsres = nsIWebBrowserStream_OpenStream(This->doc->nscontainer->stream, uri, strTextHtml);
127         if(NS_FAILED(nsres))
128             ERR("OpenStream failed: %08lx\n", nsres);
129
130         nsIURI_Release(uri);
131     }
132
133     return S_OK;
134 }
135
136 static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
137 {
138     BindStatusCallback *This = STATUSCLB_THIS(iface);
139     FIXME("(%p)->(%p)\n", This, pnPriority);
140     return E_NOTIMPL;
141 }
142
143 static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
144 {
145     BindStatusCallback *This = STATUSCLB_THIS(iface);
146     FIXME("(%p)->(%ld)\n", This, reserved);
147     return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress,
151         ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
152 {
153     BindStatusCallback *This = STATUSCLB_THIS(iface);
154     TRACE("%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
155             debugstr_w(szStatusText));
156     return S_OK;
157 }
158
159 static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
160         HRESULT hresult, LPCWSTR szError)
161 {
162     BindStatusCallback *This = STATUSCLB_THIS(iface);
163
164     TRACE("(%p)->(%08lx %s)\n", This, hresult, debugstr_w(szError));
165
166     if(This->doc->nscontainer && This->doc->nscontainer->stream)
167         nsIWebBrowserStream_CloseStream(This->doc->nscontainer->stream);
168
169     IBinding_Release(This->binding);
170     This->binding = NULL;
171     return S_OK;
172 }
173
174 static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
175         DWORD *grfBINDF, BINDINFO *pbindinfo)
176 {
177     BindStatusCallback *This = STATUSCLB_THIS(iface);
178     DWORD size;
179
180     TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
181
182     *grfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
183     size = pbindinfo->cbSize;
184     memset(pbindinfo, 0, size);
185     pbindinfo->cbSize = size;
186
187     return S_OK;
188 }
189
190 static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
191         DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
192 {
193     BindStatusCallback *This = STATUSCLB_THIS(iface);
194
195     TRACE("(%p)->(%08lx %ld %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
196
197     if(!This->stream) {
198         This->stream = pstgmed->u.pstm;
199         IStream_AddRef(This->stream);
200     }
201
202     if(This->doc->nscontainer && This->doc->nscontainer->stream) {
203         BYTE buf[1024];
204         DWORD size;
205         HRESULT hres;
206
207         do {
208             size = sizeof(buf);
209             hres = IStream_Read(This->stream, buf, size, &size);
210             nsIWebBrowserStream_AppendToStream(This->doc->nscontainer->stream, buf, size);
211         }while(hres == S_OK);
212     }
213
214     return S_OK;
215 }
216
217 static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
218         REFIID riid, IUnknown *punk)
219 {
220     BindStatusCallback *This = STATUSCLB_THIS(iface);
221     FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
222     return E_NOTIMPL;
223 }
224
225 #undef STATUSCLB_THIS
226
227 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
228     BindStatusCallback_QueryInterface,
229     BindStatusCallback_AddRef,
230     BindStatusCallback_Release,
231     BindStatusCallback_OnStartBinding,
232     BindStatusCallback_GetPriority,
233     BindStatusCallback_OnLowResource,
234     BindStatusCallback_OnProgress,
235     BindStatusCallback_OnStopBinding,
236     BindStatusCallback_GetBindInfo,
237     BindStatusCallback_OnDataAvailable,
238     BindStatusCallback_OnObjectAvailable
239 };
240
241 static BindStatusCallback *BindStatusCallback_Create(HTMLDocument *doc, LPOLESTR url)
242 {
243     BindStatusCallback *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(BindStatusCallback));
244
245     ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
246     ret->ref = 0;
247     ret->url = url;
248     ret->doc = doc;
249     ret->stream = NULL;
250     IHTMLDocument2_AddRef(HTMLDOC(doc));
251
252     return ret;
253 }
254
255 /**********************************************************
256  * IPersistMoniker implementation
257  */
258
259 #define PERSISTMON_THIS(iface) DEFINE_THIS(HTMLDocument, PersistMoniker, iface)
260
261 static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid,
262                                                             void **ppvObject)
263 {
264     HTMLDocument *This = PERSISTMON_THIS(iface);
265     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
266 }
267
268 static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
269 {
270     HTMLDocument *This = PERSISTMON_THIS(iface);
271     return IHTMLDocument2_AddRef(HTMLDOC(This));
272 }
273
274 static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
275 {
276     HTMLDocument *This = PERSISTMON_THIS(iface);
277     return IHTMLDocument2_Release(HTMLDOC(This));
278 }
279
280 static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
281 {
282     HTMLDocument *This = PERSISTMON_THIS(iface);
283     return IPersist_GetClassID(PERSIST(This), pClassID);
284 }
285
286 static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
287 {
288     HTMLDocument *This = PERSISTMON_THIS(iface);
289     FIXME("(%p)\n", This);
290     return E_NOTIMPL;
291 }
292
293 static nsIInputStream *get_post_data_stream(IBindCtx *bctx)
294 {
295     nsIInputStream *ret = NULL;
296     IBindStatusCallback *callback;
297     IHttpNegotiate *http_negotiate;
298     BINDINFO bindinfo;
299     DWORD bindf = 0;
300     DWORD post_len = 0, headers_len = 0;
301     LPWSTR headers = NULL;
302     WCHAR emptystr[] = {0};
303     char *data;
304     HRESULT hres;
305
306     static WCHAR _BSCB_Holder_[] =
307         {'_','B','S','C','B','_','H','o','l','d','e','r','_',0};
308
309
310     /* FIXME: This should be done in URLMoniker */
311     if(!bctx)
312         return NULL;
313
314     hres = IBindCtx_GetObjectParam(bctx, _BSCB_Holder_, (IUnknown**)&callback);
315     if(FAILED(hres))
316         return NULL;
317
318     hres = IBindStatusCallback_QueryInterface(callback, &IID_IHttpNegotiate,
319                                               (void**)&http_negotiate);
320     if(SUCCEEDED(hres)) {
321         hres = IHttpNegotiate_BeginningTransaction(http_negotiate, emptystr,
322                                                    emptystr, 0, &headers);
323         IHttpNegotiate_Release(http_negotiate);
324
325         if(SUCCEEDED(hres) && headers)
326             headers_len = WideCharToMultiByte(CP_ACP, 0, headers, -1, NULL, 0, NULL, NULL);
327     }
328
329     memset(&bindinfo, 0, sizeof(bindinfo));
330     bindinfo.cbSize = sizeof(bindinfo);
331
332     hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
333
334     if(SUCCEEDED(hres) && bindinfo.dwBindVerb == BINDVERB_POST)
335         post_len = bindinfo.cbStgmedData-1;
336
337     if(headers_len || post_len) {
338         int len = headers_len;
339
340         static const char content_length[] = "Content-Length: %lu\r\n\r\n";
341
342         data = HeapAlloc(GetProcessHeap(), 0, headers_len+post_len+sizeof(content_length)+8);
343
344         if(headers_len) {
345             WideCharToMultiByte(CP_ACP, 0, headers, -1, data, -1, NULL, NULL);
346             CoTaskMemFree(headers);
347         }
348
349         if(post_len) {
350             sprintf(data+headers_len-1, content_length, post_len);
351             len = strlen(data);
352
353             memcpy(data+len, bindinfo.stgmedData.u.hGlobal, post_len);
354         }
355
356         TRACE("data = %s\n", debugstr_an(data, len+post_len));
357
358         ret = create_nsstream(data, strlen(data));
359     }
360
361     ReleaseBindInfo(&bindinfo);
362     IBindStatusCallback_Release(callback);
363
364     return ret;
365 }
366
367 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
368         IMoniker *pimkName, LPBC pibc, DWORD grfMode)
369 {
370     HTMLDocument *This = PERSISTMON_THIS(iface);
371     IBindCtx *pbind;
372     BindStatusCallback *callback;
373     IStream *str = NULL;
374     LPOLESTR url;
375     HRESULT hres;
376     nsresult nsres;
377
378     TRACE("(%p)->(%x %p %p %08lx)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
379
380     if(pibc) {
381         IUnknown *unk = NULL;
382
383         /* FIXME:
384          * Use params:
385          * "__PrecreatedObject"
386          * "BIND_CONTEXT_PARAM"
387          * "__HTMLLOADOPTIONS"
388          * "__DWNBINDINFO"
389          * "URL Context"
390          * "CBinding Context"
391          * "_ITransData_Object_"
392          * "_EnumFORMATETC_"
393          */
394
395         IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
396         if(unk) {
397             IOleClientSite *client = NULL;
398
399             hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
400             if(SUCCEEDED(hres)) {
401                 TRACE("Got client site %p\n", client);
402                 IOleObject_SetClientSite(OLEOBJ(This), client);
403                 IOleClientSite_Release(client);
404             }
405
406             IUnknown_Release(unk);
407         }
408     }
409
410     HTMLDocument_LockContainer(This, TRUE);
411     
412     hres = IMoniker_GetDisplayName(pimkName, pibc, NULL, &url);
413     if(FAILED(hres)) {
414         WARN("GetDiaplayName failed: %08lx\n", hres);
415         return hres;
416     }
417
418     TRACE("got url: %s\n", debugstr_w(url));
419
420     if(This->client) {
421         IOleCommandTarget *cmdtrg = NULL;
422
423         hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
424                 (void**)&cmdtrg);
425         if(SUCCEEDED(hres)) {
426             VARIANT var;
427
428             V_VT(&var) = VT_I4;
429             V_I4(&var) = 0;
430             IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
431         }
432     }
433
434     if(This->nscontainer && !This->nscontainer->stream) {
435         /*
436          * This is a workaround for older Gecko that doesn't support nsIWebBrowserStream.
437          * It uses Gecko's LoadURI instead of IMoniker's BindToStorage. Should we improve
438          * it (to do so we'd have to use not frozen interfaces)?
439          */
440
441         nsIInputStream *post_data_stream = get_post_data_stream(pibc);;
442
443         This->nscontainer->load_call = TRUE;
444         nsres = nsIWebNavigation_LoadURI(This->nscontainer->navigation, url,
445                 LOAD_FLAGS_NONE, NULL, post_data_stream, NULL);
446         This->nscontainer->load_call = FALSE;
447
448         if(post_data_stream)
449             nsIInputStream_Release(post_data_stream);
450
451         if(NS_SUCCEEDED(nsres)) {
452             CoTaskMemFree(url);
453             return S_OK;
454         }else {
455             WARN("LoadURI failed: %08lx\n", nsres);
456         }
457     }    
458
459     /* FIXME: Use grfMode */
460
461     if(fFullyAvailable)
462         FIXME("not supported fFullyAvailable\n");
463
464     if(This->status_callback && This->status_callback->binding)
465         IBinding_Abort(This->status_callback->binding);
466
467     callback = This->status_callback = BindStatusCallback_Create(This, url);
468     CoTaskMemFree(url);
469
470     if(pibc) {
471         pbind = pibc;
472         RegisterBindStatusCallback(pbind, STATUSCLB(callback), NULL, 0);
473     }else {
474         CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &pbind);
475     }
476
477     hres = IMoniker_BindToStorage(pimkName, pbind, NULL, &IID_IStream, (void**)&str);
478
479     if(!pibc)
480         IBindCtx_Release(pbind);
481     if(str)
482         IStream_Release(str);
483     if(FAILED(hres)) {
484         WARN("BindToStorage failed: %08lx\n", hres);
485         return hres;
486     }
487
488     return S_OK;
489 }
490
491 static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
492         LPBC pbc, BOOL fRemember)
493 {
494     HTMLDocument *This = PERSISTMON_THIS(iface);
495     FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
496     return E_NOTIMPL;
497 }
498
499 static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
500 {
501     HTMLDocument *This = PERSISTMON_THIS(iface);
502     FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
503     return E_NOTIMPL;
504 }
505
506 static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
507 {
508     HTMLDocument *This = PERSISTMON_THIS(iface);
509     FIXME("(%p)->(%p)\n", This, ppimkName);
510     return E_NOTIMPL;
511 }
512
513 static const IPersistMonikerVtbl PersistMonikerVtbl = {
514     PersistMoniker_QueryInterface,
515     PersistMoniker_AddRef,
516     PersistMoniker_Release,
517     PersistMoniker_GetClassID,
518     PersistMoniker_IsDirty,
519     PersistMoniker_Load,
520     PersistMoniker_Save,
521     PersistMoniker_SaveCompleted,
522     PersistMoniker_GetCurMoniker
523 };
524
525 /**********************************************************
526  * IMonikerProp implementation
527  */
528
529 #define MONPROP_THIS(iface) DEFINE_THIS(HTMLDocument, MonikerProp, iface)
530
531 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppvObject)
532 {
533     HTMLDocument *This = MONPROP_THIS(iface);
534     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
535 }
536
537 static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
538 {
539     HTMLDocument *This = MONPROP_THIS(iface);
540     return IHTMLDocument2_AddRef(HTMLDOC(This));
541 }
542
543 static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
544 {
545     HTMLDocument *This = MONPROP_THIS(iface);
546     return IHTMLDocument_Release(HTMLDOC(This));
547 }
548
549 static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
550 {
551     HTMLDocument *This = MONPROP_THIS(iface);
552     FIXME("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
553     return E_NOTIMPL;
554 }
555
556 static const IMonikerPropVtbl MonikerPropVtbl = {
557     MonikerProp_QueryInterface,
558     MonikerProp_AddRef,
559     MonikerProp_Release,
560     MonikerProp_PutProperty
561 };
562
563 /**********************************************************
564  * IPersistFile implementation
565  */
566
567 #define PERSISTFILE_THIS(iface) DEFINE_THIS(HTMLDocument, PersistFile, iface)
568
569 static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppvObject)
570 {
571     HTMLDocument *This = PERSISTFILE_THIS(iface);
572     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
573 }
574
575 static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
576 {
577     HTMLDocument *This = PERSISTFILE_THIS(iface);
578     return IHTMLDocument2_AddRef(HTMLDOC(This));
579 }
580
581 static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
582 {
583     HTMLDocument *This = PERSISTFILE_THIS(iface);
584     return IHTMLDocument2_Release(HTMLDOC(This));
585 }
586
587 static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
588 {
589     HTMLDocument *This = PERSISTFILE_THIS(iface);
590
591     TRACE("(%p)->(%p)\n", This, pClassID);
592
593     if(!pClassID)
594         return E_INVALIDARG;
595
596     memcpy(pClassID, &CLSID_HTMLDocument, sizeof(CLSID));
597     return S_OK;
598 }
599
600 static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
601 {
602     HTMLDocument *This = PERSISTFILE_THIS(iface);
603     FIXME("(%p)\n", This);
604     return E_NOTIMPL;
605 }
606
607 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
608 {
609     HTMLDocument *This = PERSISTFILE_THIS(iface);
610     FIXME("(%p)->(%s %08lx)\n", This, debugstr_w(pszFileName), dwMode);
611     return E_NOTIMPL;
612 }
613
614 static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
615 {
616     HTMLDocument *This = PERSISTFILE_THIS(iface);
617     FIXME("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
618     return E_NOTIMPL;
619 }
620
621 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
622 {
623     HTMLDocument *This = PERSISTFILE_THIS(iface);
624     FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
625     return E_NOTIMPL;
626 }
627
628 static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
629 {
630     HTMLDocument *This = PERSISTFILE_THIS(iface);
631     FIXME("(%p)->(%p)\n", This, pszFileName);
632     return E_NOTIMPL;
633 }
634
635 static const IPersistFileVtbl PersistFileVtbl = {
636     PersistFile_QueryInterface,
637     PersistFile_AddRef,
638     PersistFile_Release,
639     PersistFile_GetClassID,
640     PersistFile_IsDirty,
641     PersistFile_Load,
642     PersistFile_Save,
643     PersistFile_SaveCompleted,
644     PersistFile_GetCurFile
645 };
646
647 void HTMLDocument_Persist_Init(HTMLDocument *This)
648 {
649     This->lpPersistMonikerVtbl = &PersistMonikerVtbl;
650     This->lpPersistFileVtbl = &PersistFileVtbl;
651     This->lpMonikerPropVtbl = &MonikerPropVtbl;
652
653     This->status_callback = NULL;
654 }