4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2003 Mike McCormack
6 * Copyright 2005 Jacek Caban
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
41 #include "wine/debug.h"
44 #include "mshtml_private.h"
46 #include "pluginhost.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
52 DWORD mshtml_tls
= TLS_OUT_OF_INDEXES
;
54 void (__cdecl
*ccp_init
)(ExternalCycleCollectionParticipant
*,const CCObjCallback
*);
55 nsrefcnt (__cdecl
*ccref_decr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*,ExternalCycleCollectionParticipant
*);
56 nsrefcnt (__cdecl
*ccref_incr
)(nsCycleCollectingAutoRefCnt
*,nsISupports
*);
57 void (__cdecl
*ccref_init
)(nsCycleCollectingAutoRefCnt
*,nsrefcnt
);
58 void (__cdecl
*describe_cc_node
)(nsCycleCollectingAutoRefCnt
*,const char*,nsCycleCollectionTraversalCallback
*);
59 void (__cdecl
*note_cc_edge
)(nsISupports
*,const char*,nsCycleCollectionTraversalCallback
*);
61 static HINSTANCE shdoclc
= NULL
;
62 static WCHAR
*status_strings
[IDS_STATUS_LAST
-IDS_STATUS_FIRST
+1];
63 static IMultiLanguage2
*mlang
;
64 static IInternetSecurityManager
*security_manager
;
65 static unsigned global_max_compat_mode
= COMPAT_MODE_IE11
;
66 static struct list compat_config
= LIST_INIT(compat_config
);
70 compat_mode_t max_compat_mode
;
74 static BOOL
ensure_mlang(void)
76 IMultiLanguage2
*new_mlang
;
82 hres
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
83 &IID_IMultiLanguage2
, (void**)&new_mlang
);
85 ERR("Could not create CMultiLanguage instance\n");
89 if(InterlockedCompareExchangePointer((void**)&mlang
, new_mlang
, NULL
))
90 IMultiLanguage2_Release(new_mlang
);
95 UINT
cp_from_charset_string(BSTR charset
)
103 hres
= IMultiLanguage2_GetCharsetInfo(mlang
, charset
, &info
);
105 FIXME("GetCharsetInfo failed: %08lx\n", hres
);
109 return info
.uiInternetEncoding
;
112 BSTR
charset_string_from_cp(UINT cp
)
118 return SysAllocString(NULL
);
120 hres
= IMultiLanguage2_GetCodePageInfo(mlang
, cp
, GetUserDefaultUILanguage(), &info
);
122 ERR("GetCodePageInfo failed: %08lx\n", hres
);
123 return SysAllocString(NULL
);
126 return SysAllocString(info
.wszWebCharset
);
129 HRESULT
get_mime_type_display_name(const WCHAR
*content_type
, BSTR
*ret
)
132 extern BOOL WINAPI
GetMIMETypeSubKeyW(LPCWSTR
,LPWSTR
,DWORD
);
134 WCHAR buffer
[128], ext
[128], *str
, *progid
;
142 if(!GetMIMETypeSubKeyW(content_type
, buffer
, ARRAY_SIZE(buffer
))) {
143 len
= wcslen(content_type
) + 32;
145 if(!(str
= malloc(len
* sizeof(WCHAR
))))
146 return E_OUTOFMEMORY
;
147 if(GetMIMETypeSubKeyW(content_type
, str
, len
))
154 status
= RegOpenKeyExW(HKEY_CLASSES_ROOT
, str
, 0, KEY_QUERY_VALUE
, &key
);
157 if(status
!= ERROR_SUCCESS
)
161 status
= RegQueryValueExW(key
, L
"Extension", NULL
, &type
, (BYTE
*)ext
, &len
);
162 if(status
!= ERROR_SUCCESS
|| type
!= REG_SZ
) {
163 len
= sizeof(buffer
);
164 status
= RegQueryValueExW(key
, L
"CLSID", NULL
, &type
, (BYTE
*)buffer
, &len
);
165 if(status
!= ERROR_SUCCESS
|| type
!= REG_SZ
|| CLSIDFromString(buffer
, &clsid
) != S_OK
)
168 hres
= ProgIDFromCLSID(&clsid
, &progid
);
169 if(hres
== E_OUTOFMEMORY
) {
179 len
= ARRAY_SIZE(buffer
);
182 hres
= AssocQueryStringW(ASSOCF_NOTRUNCATE
, ASSOCSTR_FRIENDLYDOCNAME
, progid
, NULL
, str
, &len
);
183 if(hres
== S_OK
&& len
)
187 if(hres
!= E_POINTER
) {
189 CoTaskMemFree(progid
);
194 len
= sizeof(buffer
);
195 status
= RegQueryValueExW(key
, L
"CLSID", NULL
, &type
, (BYTE
*)buffer
, &len
);
196 if(status
!= ERROR_SUCCESS
|| type
!= REG_SZ
|| CLSIDFromString(buffer
, &clsid
) != S_OK
)
199 hres
= ProgIDFromCLSID(&clsid
, &progid
);
200 if(hres
== E_OUTOFMEMORY
) {
207 len
= ARRAY_SIZE(buffer
);
211 str
= malloc(len
* sizeof(WCHAR
));
214 CoTaskMemFree(progid
);
217 *ret
= SysAllocString(str
);
220 return *ret
? S_OK
: E_OUTOFMEMORY
;
225 WARN("Did not find MIME in database for %s\n", debugstr_w(content_type
));
227 /* native seems to return "File" when it doesn't know the content type */
228 *ret
= SysAllocString(L
"File");
229 return *ret
? S_OK
: E_OUTOFMEMORY
;
232 IInternetSecurityManager
*get_security_manager(void)
234 if(!security_manager
) {
235 IInternetSecurityManager
*manager
;
238 hres
= CoInternetCreateSecurityManager(NULL
, &manager
, 0);
242 if(InterlockedCompareExchangePointer((void**)&security_manager
, manager
, NULL
))
243 IInternetSecurityManager_Release(manager
);
246 return security_manager
;
249 static BOOL
read_compat_mode(HKEY key
, compat_mode_t
*r
)
255 size
= sizeof(version
);
256 status
= RegQueryValueExW(key
, L
"MaxCompatMode", NULL
, &type
, (BYTE
*)version
, &size
);
257 if(status
!= ERROR_SUCCESS
|| type
!= REG_SZ
)
260 return parse_compat_version(version
, r
) != NULL
;
263 static BOOL WINAPI
load_compat_settings(INIT_ONCE
*once
, void *param
, void **context
)
265 WCHAR key_name
[INTERNET_MAX_HOST_NAME_LENGTH
];
266 DWORD index
= 0, name_size
;
267 compat_config_t
*new_entry
;
268 compat_mode_t max_compat_mode
;
272 /* @@ Wine registry key: HKCU\Software\Wine\MSHTML\CompatMode */
273 res
= RegOpenKeyW(HKEY_CURRENT_USER
, L
"Software\\Wine\\MSHTML\\CompatMode", &key
);
274 if(res
!= ERROR_SUCCESS
)
277 if(read_compat_mode(key
, &max_compat_mode
)) {
278 TRACE("Setting global max compat mode to %u\n", max_compat_mode
);
279 global_max_compat_mode
= max_compat_mode
;
283 res
= RegEnumKeyW(key
, index
, key_name
, ARRAY_SIZE(key_name
));
284 if(res
== ERROR_NO_MORE_ITEMS
)
287 if(res
!= ERROR_SUCCESS
) {
288 WARN("RegEnumKey failed: %lu\n", GetLastError());
292 name_size
= lstrlenW(key_name
) + 1;
293 new_entry
= malloc(FIELD_OFFSET(compat_config_t
, host
[name_size
]));
297 new_entry
->max_compat_mode
= COMPAT_MODE_IE11
;
298 memcpy(new_entry
->host
, key_name
, name_size
* sizeof(WCHAR
));
299 list_add_tail(&compat_config
, &new_entry
->entry
);
301 res
= RegOpenKeyW(key
, key_name
, &host_key
);
302 if(res
!= ERROR_SUCCESS
)
305 if(read_compat_mode(host_key
, &max_compat_mode
)) {
306 TRACE("Setting max compat mode for %s to %u\n", debugstr_w(key_name
), max_compat_mode
);
307 new_entry
->max_compat_mode
= max_compat_mode
;
310 RegCloseKey(host_key
);
317 compat_mode_t
get_max_compat_mode(IUri
*uri
)
319 compat_config_t
*iter
;
320 size_t len
, iter_len
;
324 static INIT_ONCE init_once
= INIT_ONCE_STATIC_INIT
;
325 InitOnceExecuteOnce(&init_once
, load_compat_settings
, NULL
, NULL
);
328 return global_max_compat_mode
;
329 hres
= IUri_GetHost(uri
, &host
);
332 return global_max_compat_mode
;
334 len
= SysStringLen(host
);
336 LIST_FOR_EACH_ENTRY(iter
, &compat_config
, compat_config_t
, entry
) {
337 iter_len
= lstrlenW(iter
->host
);
338 /* If configured host starts with '.', we also match subdomains */
339 if((len
== iter_len
|| (iter
->host
[0] == '.' && len
> iter_len
))
340 && !memcmp(host
+ len
- iter_len
, iter
->host
, iter_len
* sizeof(WCHAR
))) {
341 TRACE("Found max mode %u\n", iter
->max_compat_mode
);
342 return iter
->max_compat_mode
;
347 TRACE("Using global max mode %u\n", global_max_compat_mode
);
348 return global_max_compat_mode
;
351 static void thread_detach(void)
353 thread_data_t
*thread_data
;
355 thread_data
= get_thread_data(FALSE
);
359 if(thread_data
->thread_hwnd
)
360 DestroyWindow(thread_data
->thread_hwnd
);
362 destroy_session_storage(thread_data
);
366 static void free_strings(void)
369 for(i
= 0; i
< ARRAY_SIZE(status_strings
); i
++)
370 free(status_strings
[i
]);
373 static void process_detach(void)
375 compat_config_t
*config
;
380 while(!list_empty(&compat_config
)) {
381 config
= LIST_ENTRY(list_head(&compat_config
), compat_config_t
, entry
);
382 list_remove(&config
->entry
);
387 FreeLibrary(shdoclc
);
388 if(mshtml_tls
!= TLS_OUT_OF_INDEXES
)
391 IMultiLanguage2_Release(mlang
);
393 IInternetSecurityManager_Release(security_manager
);
398 void set_statustext(HTMLDocumentObj
* doc
, INT id
, LPCWSTR arg
)
400 int index
= id
- IDS_STATUS_FIRST
;
401 WCHAR
*p
= status_strings
[index
];
409 p
= malloc(len
* sizeof(WCHAR
));
411 len
= LoadStringW(hInst
, id
, p
, len
) + 1;
412 p
= realloc(p
, len
* sizeof(WCHAR
));
413 if(InterlockedCompareExchangePointer((void**)&status_strings
[index
], p
, NULL
)) {
415 p
= status_strings
[index
];
422 len
= lstrlenW(p
) + lstrlenW(arg
) - 1;
423 buf
= malloc(len
* sizeof(WCHAR
));
426 swprintf(buf
, len
, p
, arg
);
431 IOleInPlaceFrame_SetStatusText(doc
->frame
, p
);
437 HRESULT
do_query_service(IUnknown
*unk
, REFGUID guid_service
, REFIID riid
, void **ppv
)
439 IServiceProvider
*sp
;
442 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&sp
);
446 hres
= IServiceProvider_QueryService(sp
, guid_service
, riid
, ppv
);
447 IServiceProvider_Release(sp
);
451 HINSTANCE
get_shdoclc(void)
456 return shdoclc
= LoadLibraryExW(L
"shdoclc.dll", NULL
, LOAD_LIBRARY_AS_DATAFILE
);
459 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID reserved
)
462 case DLL_PROCESS_ATTACH
:
465 case DLL_PROCESS_DETACH
:
469 case DLL_THREAD_DETACH
:
476 /***********************************************************
477 * ClassFactory implementation
479 typedef HRESULT (*CreateInstanceFunc
)(IUnknown
*,REFIID
,void**);
481 IClassFactory IClassFactory_iface
;
483 CreateInstanceFunc fnCreateInstance
;
486 static inline ClassFactory
*impl_from_IClassFactory(IClassFactory
*iface
)
488 return CONTAINING_RECORD(iface
, ClassFactory
, IClassFactory_iface
);
491 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFGUID riid
, void **ppvObject
)
493 if(IsEqualGUID(&IID_IClassFactory
, riid
) || IsEqualGUID(&IID_IUnknown
, riid
)) {
494 IClassFactory_AddRef(iface
);
499 WARN("not supported iid %s\n", debugstr_mshtml_guid(riid
));
501 return E_NOINTERFACE
;
504 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
506 ClassFactory
*This
= impl_from_IClassFactory(iface
);
507 ULONG ref
= InterlockedIncrement(&This
->ref
);
508 TRACE("(%p) ref = %lu\n", This
, ref
);
512 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
514 ClassFactory
*This
= impl_from_IClassFactory(iface
);
515 ULONG ref
= InterlockedDecrement(&This
->ref
);
517 TRACE("(%p) ref = %lu\n", This
, ref
);
526 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pUnkOuter
,
527 REFIID riid
, void **ppvObject
)
529 ClassFactory
*This
= impl_from_IClassFactory(iface
);
530 return This
->fnCreateInstance(pUnkOuter
, riid
, ppvObject
);
533 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
535 TRACE("(%p)->(%x)\n", iface
, dolock
);
537 /* We never unload the DLL. See DllCanUnloadNow(). */
541 static const IClassFactoryVtbl HTMLClassFactoryVtbl
= {
542 ClassFactory_QueryInterface
,
544 ClassFactory_Release
,
545 ClassFactory_CreateInstance
,
546 ClassFactory_LockServer
549 static HRESULT
ClassFactory_Create(REFIID riid
, void **ppv
, CreateInstanceFunc fnCreateInstance
)
551 ClassFactory
*ret
= malloc(sizeof(ClassFactory
));
554 ret
->IClassFactory_iface
.lpVtbl
= &HTMLClassFactoryVtbl
;
556 ret
->fnCreateInstance
= fnCreateInstance
;
558 hres
= IClassFactory_QueryInterface(&ret
->IClassFactory_iface
, riid
, ppv
);
566 /******************************************************************
567 * DllGetClassObject (MSHTML.@)
569 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
571 if(IsEqualGUID(&CLSID_HTMLDocument
, rclsid
)) {
572 TRACE("(CLSID_HTMLDocument %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
573 return ClassFactory_Create(riid
, ppv
, HTMLDocument_Create
);
574 }else if(IsEqualGUID(&CLSID_MHTMLDocument
, rclsid
)) {
575 TRACE("(CLSID_MHTMLDocument %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
576 return ClassFactory_Create(riid
, ppv
, MHTMLDocument_Create
);
577 }else if(IsEqualGUID(&CLSID_AboutProtocol
, rclsid
)) {
578 TRACE("(CLSID_AboutProtocol %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
579 return ProtocolFactory_Create(rclsid
, riid
, ppv
);
580 }else if(IsEqualGUID(&CLSID_JSProtocol
, rclsid
)) {
581 TRACE("(CLSID_JSProtocol %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
582 return ProtocolFactory_Create(rclsid
, riid
, ppv
);
583 }else if(IsEqualGUID(&CLSID_MailtoProtocol
, rclsid
)) {
584 TRACE("(CLSID_MailtoProtocol %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
585 return ProtocolFactory_Create(rclsid
, riid
, ppv
);
586 }else if(IsEqualGUID(&CLSID_ResProtocol
, rclsid
)) {
587 TRACE("(CLSID_ResProtocol %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
588 return ProtocolFactory_Create(rclsid
, riid
, ppv
);
589 }else if(IsEqualGUID(&CLSID_SysimageProtocol
, rclsid
)) {
590 TRACE("(CLSID_SysimageProtocol %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
591 return ProtocolFactory_Create(rclsid
, riid
, ppv
);
592 }else if(IsEqualGUID(&CLSID_HTMLLoadOptions
, rclsid
)) {
593 TRACE("(CLSID_HTMLLoadOptions %s %p)\n", debugstr_mshtml_guid(riid
), ppv
);
594 return ClassFactory_Create(riid
, ppv
, HTMLLoadOptions_Create
);
597 FIXME("Unknown class %s\n", debugstr_guid(rclsid
));
598 return CLASS_E_CLASSNOTAVAILABLE
;
601 /***********************************************************************
602 * RunHTMLApplication (MSHTML.@)
604 * Appears to have the same prototype as WinMain.
606 HRESULT WINAPI
RunHTMLApplication( HINSTANCE hinst
, HINSTANCE hPrevInst
,
607 LPSTR szCmdLine
, INT nCmdShow
)
609 FIXME("%p %p %s %d\n", hinst
, hPrevInst
, debugstr_a(szCmdLine
), nCmdShow
);
613 /***********************************************************************
614 * RNIGetCompatibleVersion (MSHTML.@)
616 DWORD WINAPI
RNIGetCompatibleVersion(void)
622 /***********************************************************************
623 * DllInstall (MSHTML.@)
625 HRESULT WINAPI
DllInstall(BOOL install
, const WCHAR
*cmdline
)
627 TRACE("(%x %s)\n", install
, debugstr_w(cmdline
));
629 if(cmdline
&& *cmdline
)
630 FIXME("unsupported cmdline: %s\n", debugstr_w(cmdline
));
637 /***********************************************************************
638 * ShowHTMLDialog (MSHTML.@)
640 HRESULT WINAPI
ShowHTMLDialog(HWND hwndParent
, IMoniker
*pMk
, VARIANT
*pvarArgIn
,
641 WCHAR
*pchOptions
, VARIANT
*pvarArgOut
)
643 FIXME("(%p %p %p %s %p)\n", hwndParent
, pMk
, pvarArgIn
, debugstr_w(pchOptions
), pvarArgOut
);
647 /***********************************************************************
648 * PrintHTML (MSHTML.@)
650 void WINAPI
PrintHTML(HWND hwnd
, HINSTANCE handle
, LPCSTR cmdline
, INT show
)
652 FIXME("(%p %p %s %x)\n", hwnd
, handle
, debugstr_a(cmdline
), show
);
655 DEFINE_GUID(CLSID_CBackgroundPropertyPage
, 0x3050F232, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
656 DEFINE_GUID(CLSID_CCDAnchorPropertyPage
, 0x3050F1FC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
657 DEFINE_GUID(CLSID_CCDGenericPropertyPage
, 0x3050F17F, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
658 DEFINE_GUID(CLSID_CDwnBindInfo
, 0x3050F3C2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
659 DEFINE_GUID(CLSID_CHiFiUses
, 0x5AAF51B3, 0xB1F0, 0x11D1, 0xB6,0xAB, 0x00,0xA0,0xC9,0x08,0x33,0xE9);
660 DEFINE_GUID(CLSID_CHtmlComponentConstructor
, 0x3050F4F8, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
661 DEFINE_GUID(CLSID_CInlineStylePropertyPage
, 0x3050F296, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
662 DEFINE_GUID(CLSID_CPeerHandler
, 0x5AAF51B2, 0xB1F0, 0x11D1, 0xB6,0xAB, 0x00,0xA0,0xC9,0x08,0x33,0xE9);
663 DEFINE_GUID(CLSID_CRecalcEngine
, 0x3050F499, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
664 DEFINE_GUID(CLSID_CSvrOMUses
, 0x3050F4F0, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
665 DEFINE_GUID(CLSID_CrSource
, 0x65014010, 0x9F62, 0x11D1, 0xA6,0x51, 0x00,0x60,0x08,0x11,0xD5,0xCE);
666 DEFINE_GUID(CLSID_ExternalFrameworkSite
, 0x3050F163, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
667 DEFINE_GUID(CLSID_HTADocument
, 0x3050F5C8, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
668 DEFINE_GUID(CLSID_HTMLPluginDocument
, 0x25336921, 0x03F9, 0x11CF, 0x8F,0xD0, 0x00,0xAA,0x00,0x68,0x6F,0x13);
669 DEFINE_GUID(CLSID_HTMLPopup
, 0x3050F667, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
670 DEFINE_GUID(CLSID_HTMLPopupDoc
, 0x3050F67D, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
671 DEFINE_GUID(CLSID_HTMLServerDoc
, 0x3050F4E7, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
672 DEFINE_GUID(CLSID_IImageDecodeFilter
, 0x607FD4E8, 0x0A03, 0x11D1, 0xAB,0x1D, 0x00,0xC0,0x4F,0xC9,0xB3,0x04);
673 DEFINE_GUID(CLSID_IImgCtx
, 0x3050F3D6, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
674 DEFINE_GUID(CLSID_IntDitherer
, 0x05F6FE1A, 0xECEF, 0x11D0, 0xAA,0xE7, 0x00,0xC0,0x4F,0xC9,0xB3,0x04);
675 DEFINE_GUID(CLSID_TridentAPI
, 0x429AF92C, 0xA51F, 0x11D2, 0x86,0x1E, 0x00,0xC0,0x4F,0xA3,0x5C,0x89);
677 #define INF_SET_ID(id) \
680 static CHAR name[] = #id; \
682 pse[i].pszName = name; \
686 #define INF_SET_CLSID(clsid) INF_SET_ID(CLSID_ ## clsid)
688 static HRESULT
register_server(BOOL do_register
)
692 HRESULT (WINAPI
*pRegInstall
)(HMODULE hm
, LPCSTR pszSection
, const STRTABLEA
* pstTable
);
695 static CLSID
const *clsids
[35];
698 TRACE("(%x)\n", do_register
);
700 INF_SET_CLSID(AboutProtocol
);
701 INF_SET_CLSID(CAnchorBrowsePropertyPage
);
702 INF_SET_CLSID(CBackgroundPropertyPage
);
703 INF_SET_CLSID(CCDAnchorPropertyPage
);
704 INF_SET_CLSID(CCDGenericPropertyPage
);
705 INF_SET_CLSID(CDocBrowsePropertyPage
);
706 INF_SET_CLSID(CDwnBindInfo
);
707 INF_SET_CLSID(CHiFiUses
);
708 INF_SET_CLSID(CHtmlComponentConstructor
);
709 INF_SET_CLSID(CImageBrowsePropertyPage
);
710 INF_SET_CLSID(CInlineStylePropertyPage
);
711 INF_SET_CLSID(CPeerHandler
);
712 INF_SET_CLSID(CRecalcEngine
);
713 INF_SET_CLSID(CSvrOMUses
);
714 INF_SET_CLSID(CrSource
);
715 INF_SET_CLSID(ExternalFrameworkSite
);
716 INF_SET_CLSID(HTADocument
);
717 INF_SET_CLSID(HTMLDocument
);
718 INF_SET_CLSID(HTMLLoadOptions
);
719 INF_SET_CLSID(HTMLPluginDocument
);
720 INF_SET_CLSID(HTMLPopup
);
721 INF_SET_CLSID(HTMLPopupDoc
);
722 INF_SET_CLSID(HTMLServerDoc
);
723 INF_SET_CLSID(HTMLWindowProxy
);
724 INF_SET_CLSID(IImageDecodeFilter
);
725 INF_SET_CLSID(IImgCtx
);
726 INF_SET_CLSID(IntDitherer
);
727 INF_SET_CLSID(JSProtocol
);
728 INF_SET_CLSID(MHTMLDocument
);
729 INF_SET_CLSID(MailtoProtocol
);
730 INF_SET_CLSID(ResProtocol
);
731 INF_SET_CLSID(Scriptlet
);
732 INF_SET_CLSID(SysimageProtocol
);
733 INF_SET_CLSID(TridentAPI
);
734 INF_SET_ID(LIBID_MSHTML
);
736 for(i
=0; i
< ARRAY_SIZE(pse
); i
++) {
737 pse
[i
].pszValue
= malloc(39);
738 sprintf(pse
[i
].pszValue
, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
739 clsids
[i
]->Data1
, clsids
[i
]->Data2
, clsids
[i
]->Data3
, clsids
[i
]->Data4
[0],
740 clsids
[i
]->Data4
[1], clsids
[i
]->Data4
[2], clsids
[i
]->Data4
[3], clsids
[i
]->Data4
[4],
741 clsids
[i
]->Data4
[5], clsids
[i
]->Data4
[6], clsids
[i
]->Data4
[7]);
744 strtable
.cEntries
= ARRAY_SIZE(pse
);
747 hAdvpack
= LoadLibraryW(L
"advpack.dll");
748 pRegInstall
= (void *)GetProcAddress(hAdvpack
, "RegInstall");
750 hres
= pRegInstall(hInst
, do_register
? "RegisterDll" : "UnregisterDll", &strtable
);
752 FreeLibrary(hAdvpack
);
754 for(i
=0; i
< ARRAY_SIZE(pse
); i
++)
755 free(pse
[i
].pszValue
);
758 ERR("RegInstall failed: %08lx\n", hres
);
766 /***********************************************************************
767 * DllRegisterServer (MSHTML.@)
769 HRESULT WINAPI
DllRegisterServer(void)
773 hres
= __wine_register_resources();
775 hres
= register_server(TRUE
);
779 /***********************************************************************
780 * DllUnregisterServer (MSHTML.@)
782 HRESULT WINAPI
DllUnregisterServer(void)
784 HRESULT hres
= __wine_unregister_resources();
785 if(SUCCEEDED(hres
)) hres
= register_server(FALSE
);
789 const char *debugstr_mshtml_guid(const GUID
*iid
)
791 #define X(x) if(IsEqualGUID(iid, &x)) return #x
792 X(DIID_HTMLDocumentEvents
);
793 X(DIID_HTMLDocumentEvents2
);
794 X(DIID_HTMLTableEvents
);
795 X(DIID_HTMLTextContainerEvents
);
796 X(IID_HTMLPluginContainer
);
797 X(IID_IConnectionPoint
);
798 X(IID_IConnectionPointContainer
);
803 X(IID_IDisplayServices
);
804 X(IID_UndocumentedScriptIface
);
805 X(IID_IEnumConnections
);
808 X(IID_IHTMLDocument6
);
809 X(IID_IHTMLDocument7
);
810 X(IID_IHTMLEditServices
);
811 X(IID_IHTMLFramesCollection2
);
812 X(IID_IHTMLPrivateWindow
);
813 X(IID_IHtmlLoadOptions
);
814 X(IID_IInternetHostSecurityManager
);
815 X(IID_IInternetProtocol
);
816 X(IID_IInternetProtocolRoot
);
817 X(IID_IManagedObject
);
818 X(IID_IMarkupContainer
);
819 X(IID_IMarkupServices
);
822 X(IID_IObjectIdentity
);
823 X(IID_IObjectSafety
);
824 X(IID_IObjectWithSite
);
825 X(IID_IOleContainer
);
826 X(IID_IOleCommandTarget
);
829 X(IID_IOleDocumentView
);
830 X(IID_IOleInPlaceActiveObject
);
831 X(IID_IOleInPlaceFrame
);
832 X(IID_IOleInPlaceObject
);
833 X(IID_IOleInPlaceObjectWindowless
);
834 X(IID_IOleInPlaceUIWindow
);
840 X(IID_IPersistHistory
);
841 X(IID_IPersistMoniker
);
842 X(IID_IPersistStreamInit
);
843 X(IID_IPropertyNotifySink
);
844 X(IID_IProvideClassInfo
);
845 X(IID_IProvideClassInfo2
);
846 X(IID_IProvideMultipleClassInfo
);
847 X(IID_IServiceProvider
);
848 X(IID_ISupportErrorInfo
);
849 X(IID_ITargetContainer
);
850 X(IID_ITravelLogClient
);
854 X(IID_IViewObjectEx
);
855 X(IID_nsCycleCollectionISupports
);
856 X(IID_nsXPCOMCycleCollectionParticipant
);
857 #define XIID(x) X(IID_##x);
858 #define XDIID(x) X(DIID_##x);
864 return debugstr_guid(iid
);