2 * SHDOCVW - Internet Explorer Web Control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #define COM_NO_WINDOWS_H
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw
);
48 #define MOZILLA_ACTIVEX_MESSAGE "You need to install the Mozilla ActiveX control to\n" \
49 "use Wine's builtin CLSID_WebBrowser from SHDOCVW.DLL"
51 DEFINE_GUID( CLSID_MozillaBrowser
, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00);
53 typedef HRESULT (WINAPI
*fnGetClassObject
)(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
);
55 HINSTANCE shdocvw_hinstance
= 0;
56 static HMODULE SHDOCVW_hshell32
= 0;
57 static HMODULE hMozCtl
= (HMODULE
)~0UL;
60 /* convert a guid to a wide character string */
61 static void SHDOCVW_guid2wstr( const GUID
*guid
, LPWSTR wstr
)
65 sprintf(str
, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
66 guid
->Data1
, guid
->Data2
, guid
->Data3
,
67 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
68 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
69 MultiByteToWideChar( CP_ACP
, 0, str
, -1, wstr
, 40 );
72 static BOOL
SHDOCVW_GetMozctlPath( LPWSTR szPath
, DWORD sz
)
77 static const WCHAR szPre
[] = {
78 'S','o','f','t','w','a','r','e','\\',
79 'C','l','a','s','s','e','s','\\',
80 'C','L','S','I','D','\\',0 };
81 static const WCHAR szPost
[] = {
82 '\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0 };
83 WCHAR szRegPath
[(sizeof(szPre
)+sizeof(szPost
))/sizeof(WCHAR
)+40];
85 strcpyW( szRegPath
, szPre
);
86 SHDOCVW_guid2wstr( &CLSID_MozillaBrowser
, &szRegPath
[strlenW(szRegPath
)] );
87 strcatW( szRegPath
, szPost
);
89 TRACE("key = %s\n", debugstr_w( szRegPath
) );
91 r
= RegOpenKeyW( HKEY_LOCAL_MACHINE
, szRegPath
, &hkey
);
92 if( r
!= ERROR_SUCCESS
)
95 r
= RegQueryValueExW( hkey
, NULL
, NULL
, &type
, (LPBYTE
)szPath
, &sz
);
96 ret
= ( r
== ERROR_SUCCESS
) && ( type
== REG_SZ
);
102 /*************************************************************************
105 BOOL WINAPI
DllMain(HINSTANCE hinst
, DWORD fdwReason
, LPVOID fImpLoad
)
107 TRACE("%p 0x%lx %p\n", hinst
, fdwReason
, fImpLoad
);
110 case DLL_PROCESS_ATTACH
:
111 shdocvw_hinstance
= hinst
;
113 case DLL_PROCESS_DETACH
:
114 if (SHDOCVW_hshell32
) FreeLibrary(SHDOCVW_hshell32
);
115 if (hMozCtl
&& hMozCtl
!= (HMODULE
)~0UL) FreeLibrary(hMozCtl
);
121 /*************************************************************************
122 * DllCanUnloadNow (SHDOCVW.@)
124 HRESULT WINAPI
SHDOCVW_DllCanUnloadNow(void)
126 FIXME("(void): stub\n");
132 static BOOL
SHDOCVW_TryLoadMozillaControl()
134 WCHAR szPath
[MAX_PATH
];
136 if( hMozCtl
!= (HMODULE
)~0UL )
137 return hMozCtl
? TRUE
: FALSE
;
139 if( !SHDOCVW_GetMozctlPath( szPath
, sizeof szPath
) )
141 MESSAGE(MOZILLA_ACTIVEX_MESSAGE
"\n");
142 MessageBoxA(NULL
, MOZILLA_ACTIVEX_MESSAGE
, "Wine", MB_OK
| MB_ICONEXCLAMATION
);
146 hMozCtl
= LoadLibraryExW(szPath
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
149 ERR("Can't load the Mozilla ActiveX control\n");
155 /*************************************************************************
156 * DllGetClassObject (SHDOCVW.@)
158 HRESULT WINAPI
SHDOCVW_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
162 if( IsEqualGUID( &CLSID_WebBrowser
, rclsid
) &&
163 SHDOCVW_TryLoadMozillaControl() )
166 fnGetClassObject pGetClassObject
;
168 TRACE("WebBrowser class %s\n", debugstr_guid(rclsid
) );
170 pGetClassObject
= (fnGetClassObject
)
171 GetProcAddress( hMozCtl
, "DllGetClassObject" );
173 if( !pGetClassObject
)
174 return CLASS_E_CLASSNOTAVAILABLE
;
175 r
= pGetClassObject( &CLSID_MozillaBrowser
, riid
, ppv
);
177 TRACE("r = %08lx *ppv = %p\n", r
, *ppv
);
182 if (IsEqualGUID(&IID_IClassFactory
, riid
))
184 /* Pass back our shdocvw class factory */
185 *ppv
= (LPVOID
)&SHDOCVW_ClassFactory
;
186 IClassFactory_AddRef((IClassFactory
*)&SHDOCVW_ClassFactory
);
191 return CLASS_E_CLASSNOTAVAILABLE
;
194 /***********************************************************************
195 * DllGetVersion (SHDOCVW.@)
197 HRESULT WINAPI
SHDOCVW_DllGetVersion (DLLVERSIONINFO
*info
)
199 if (info
->cbSize
!= sizeof(DLLVERSIONINFO
)) FIXME("support DLLVERSIONINFO2\n");
201 /* this is what IE6 on Windows 98 reports */
202 info
->dwMajorVersion
= 6;
203 info
->dwMinorVersion
= 0;
204 info
->dwBuildNumber
= 2600;
205 info
->dwPlatformID
= DLLVER_PLATFORM_WINDOWS
;
210 /*************************************************************************
211 * DllInstall (SHDOCVW.@)
213 HRESULT WINAPI
SHDOCVW_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
215 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
220 /*************************************************************************
221 * SHDOCVW_LoadShell32
223 * makes sure the handle to shell32 is valid
225 BOOL
SHDOCVW_LoadShell32(void)
227 if (SHDOCVW_hshell32
)
229 return ((SHDOCVW_hshell32
= LoadLibraryA("shell32.dll")) != NULL
);
232 /***********************************************************************
235 * Called by Win98 explorer.exe main binary, definitely has 0
238 DWORD WINAPI
WinList_Init(void)
240 FIXME("(), stub!\n");
244 /***********************************************************************
247 * Called by Win98 explorer.exe main binary, definitely has only one
250 static BOOL (WINAPI
*pShellDDEInit
)(BOOL start
) = NULL
;
252 BOOL WINAPI
ShellDDEInit(BOOL start
)
254 TRACE("(%d)\n", start
);
258 if (!SHDOCVW_LoadShell32())
260 pShellDDEInit
= GetProcAddress(SHDOCVW_hshell32
, (LPCSTR
)188);
264 return pShellDDEInit(start
);
269 /***********************************************************************
272 * Called by Win98 explorer.exe main binary, definitely has 0
275 DWORD WINAPI
RunInstallUninstallStubs(void)
277 FIXME("(), stub!\n");