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
23 #define COM_NO_WINDOWS_H
38 #include "wine/unicode.h"
39 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw
);
45 #define MOZILLA_ACTIVEX_MESSAGE "You need to install the Mozilla ActiveX control to\n" \
46 "use Wine's builtin CLSID_WebBrowser from SHDOCVW.DLL"
48 DEFINE_GUID( CLSID_MozillaBrowser
, 0x1339B54C,0x3453,0x11D2,0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00);
50 typedef HRESULT (WINAPI
*fnGetClassObject
)(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
);
52 HINSTANCE shdocvw_hinstance
= 0;
53 static HMODULE SHDOCVW_hshell32
= 0;
54 static HMODULE hMozCtl
= (HMODULE
)~0UL;
57 /* convert a guid to a wide character string */
58 static void SHDOCVW_guid2wstr( const GUID
*guid
, LPWSTR wstr
)
62 sprintf(str
, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
63 guid
->Data1
, guid
->Data2
, guid
->Data3
,
64 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
65 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
66 MultiByteToWideChar( CP_ACP
, 0, str
, -1, wstr
, 40 );
69 static BOOL
SHDOCVW_GetMozctlPath( LPWSTR szPath
, DWORD sz
)
74 static const WCHAR szPre
[] = {
75 'S','o','f','t','w','a','r','e','\\',
76 'C','l','a','s','s','e','s','\\',
77 'C','L','S','I','D','\\',0 };
78 static const WCHAR szPost
[] = {
79 '\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0 };
80 WCHAR szRegPath
[(sizeof(szPre
)+sizeof(szPost
))/sizeof(WCHAR
)+40];
82 strcpyW( szRegPath
, szPre
);
83 SHDOCVW_guid2wstr( &CLSID_MozillaBrowser
, &szRegPath
[strlenW(szRegPath
)] );
84 strcatW( szRegPath
, szPost
);
86 TRACE("key = %s\n", debugstr_w( szRegPath
) );
88 r
= RegOpenKeyW( HKEY_LOCAL_MACHINE
, szRegPath
, &hkey
);
89 if( r
!= ERROR_SUCCESS
)
92 r
= RegQueryValueExW( hkey
, NULL
, NULL
, &type
, (LPBYTE
)szPath
, &sz
);
93 ret
= ( r
== ERROR_SUCCESS
) && ( type
== REG_SZ
);
99 /*************************************************************************
102 BOOL WINAPI
DllMain(HINSTANCE hinst
, DWORD fdwReason
, LPVOID fImpLoad
)
104 TRACE("%p 0x%lx %p\n", hinst
, fdwReason
, fImpLoad
);
107 case DLL_PROCESS_ATTACH
:
108 shdocvw_hinstance
= hinst
;
110 case DLL_PROCESS_DETACH
:
111 if (SHDOCVW_hshell32
) FreeLibrary(SHDOCVW_hshell32
);
112 if (hMozCtl
&& hMozCtl
!= (HMODULE
)~0UL) FreeLibrary(hMozCtl
);
118 /*************************************************************************
119 * DllCanUnloadNow (SHDOCVW.@)
121 HRESULT WINAPI
SHDOCVW_DllCanUnloadNow(void)
123 FIXME("(void): stub\n");
129 static BOOL
SHDOCVW_TryLoadMozillaControl()
131 WCHAR szPath
[MAX_PATH
];
133 if( hMozCtl
!= (HMODULE
)~0UL )
134 return hMozCtl
? TRUE
: FALSE
;
136 if( !SHDOCVW_GetMozctlPath( szPath
, sizeof szPath
) )
138 MESSAGE(MOZILLA_ACTIVEX_MESSAGE
"\n");
139 MessageBoxA(NULL
, MOZILLA_ACTIVEX_MESSAGE
, "Wine", MB_OK
| MB_ICONEXCLAMATION
);
143 hMozCtl
= LoadLibraryExW(szPath
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
146 ERR("Can't load the Mozilla ActiveX control\n");
152 /*************************************************************************
153 * DllGetClassObject (SHDOCVW.@)
155 HRESULT WINAPI
SHDOCVW_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
159 if( IsEqualGUID( &CLSID_WebBrowser
, rclsid
) &&
160 SHDOCVW_TryLoadMozillaControl() )
163 fnGetClassObject pGetClassObject
;
165 TRACE("WebBrowser class %s\n", debugstr_guid(rclsid
) );
167 pGetClassObject
= (fnGetClassObject
)
168 GetProcAddress( hMozCtl
, "DllGetClassObject" );
170 if( !pGetClassObject
)
171 return CLASS_E_CLASSNOTAVAILABLE
;
172 r
= pGetClassObject( &CLSID_MozillaBrowser
, riid
, ppv
);
174 TRACE("r = %08lx *ppv = %p\n", r
, *ppv
);
179 if (IsEqualGUID(&IID_IClassFactory
, riid
))
181 /* Pass back our shdocvw class factory */
182 *ppv
= (LPVOID
)&SHDOCVW_ClassFactory
;
183 IClassFactory_AddRef((IClassFactory
*)&SHDOCVW_ClassFactory
);
188 return CLASS_E_CLASSNOTAVAILABLE
;
191 /***********************************************************************
192 * DllGetVersion (SHDOCVW.@)
194 HRESULT WINAPI
SHDOCVW_DllGetVersion (DLLVERSIONINFO
*info
)
196 if (info
->cbSize
!= sizeof(DLLVERSIONINFO
)) FIXME("support DLLVERSIONINFO2\n");
198 /* this is what IE6 on Windows 98 reports */
199 info
->dwMajorVersion
= 6;
200 info
->dwMinorVersion
= 0;
201 info
->dwBuildNumber
= 2600;
202 info
->dwPlatformID
= DLLVER_PLATFORM_WINDOWS
;
207 /*************************************************************************
208 * DllInstall (SHDOCVW.@)
210 HRESULT WINAPI
SHDOCVW_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
212 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
217 /*************************************************************************
218 * SHDOCVW_LoadShell32
220 * makes sure the handle to shell32 is valid
222 BOOL
SHDOCVW_LoadShell32(void)
224 if (SHDOCVW_hshell32
)
226 return ((SHDOCVW_hshell32
= LoadLibraryA("shell32.dll")) != NULL
);
229 /***********************************************************************
232 * Called by Win98 explorer.exe main binary, definitely has 0
235 DWORD WINAPI
WinList_Init(void)
237 FIXME("(), stub!\n");
241 /***********************************************************************
244 * Called by Win98 explorer.exe main binary, definitely has only one
247 static BOOL (WINAPI
*pShellDDEInit
)(BOOL start
) = NULL
;
249 BOOL WINAPI
ShellDDEInit(BOOL start
)
251 TRACE("(%d)\n", start
);
255 if (!SHDOCVW_LoadShell32())
257 pShellDDEInit
= GetProcAddress(SHDOCVW_hshell32
, (LPCSTR
)188);
261 return pShellDDEInit(start
);
266 /***********************************************************************
269 * Called by Win98 explorer.exe main binary, definitely has 0
272 DWORD WINAPI
RunInstallUninstallStubs(void)
274 FIXME("(), stub!\n");