2 * SHDOCVW - Internet Explorer Web Control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2004 Mike McCormack (for CodeWeavers)
6 * Copyright 2008 Detlef Riekenberg
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
28 #include "wine/unicode.h"
29 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
41 LONG SHDOCVW_refCount = 0;
43 HINSTANCE shdocvw_hinstance = 0;
44 static HMODULE SHDOCVW_hshell32 = 0;
45 static ITypeInfo *wb_typeinfo = NULL;
47 HRESULT get_typeinfo(ITypeInfo **typeinfo)
53 *typeinfo = wb_typeinfo;
57 hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, &typelib);
59 ERR("LoadRegTypeLib failed: %08x\n", hres);
63 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IWebBrowser2, &wb_typeinfo);
64 ITypeLib_Release(typelib);
66 *typeinfo = wb_typeinfo;
70 /*************************************************************************
73 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
75 TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
78 case DLL_PROCESS_ATTACH:
79 shdocvw_hinstance = hinst;
80 register_iewindow_class();
82 case DLL_PROCESS_DETACH:
83 if (SHDOCVW_hshell32) FreeLibrary(SHDOCVW_hshell32);
84 unregister_iewindow_class();
86 ITypeInfo_Release(wb_typeinfo);
92 /*************************************************************************
93 * DllCanUnloadNow (SHDOCVW.@)
95 HRESULT WINAPI DllCanUnloadNow(void)
97 return SHDOCVW_refCount ? S_FALSE : S_OK;
100 /***********************************************************************
101 * DllGetVersion (SHDOCVW.@)
103 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
105 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
107 /* this is what IE6 on Windows 98 reports */
108 info->dwMajorVersion = 6;
109 info->dwMinorVersion = 0;
110 info->dwBuildNumber = 2600;
111 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
116 /*************************************************************************
117 * DllInstall (SHDOCVW.@)
119 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
121 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
126 /*************************************************************************
127 * SHDOCVW_LoadShell32
129 * makes sure the handle to shell32 is valid
131 static BOOL SHDOCVW_LoadShell32(void)
133 if (SHDOCVW_hshell32)
135 return ((SHDOCVW_hshell32 = LoadLibraryA("shell32.dll")) != NULL);
138 /***********************************************************************
141 * Called by Win98 explorer.exe main binary, definitely has 0
144 DWORD WINAPI WinList_Init(void)
146 FIXME("(), stub!\n");
150 /***********************************************************************
153 * Called by Win98 explorer.exe main binary, definitely has only one
156 static BOOL (WINAPI *pShellDDEInit)(BOOL start) = NULL;
158 BOOL WINAPI ShellDDEInit(BOOL start)
160 TRACE("(%d)\n", start);
164 if (!SHDOCVW_LoadShell32())
166 pShellDDEInit = (void *)GetProcAddress(SHDOCVW_hshell32, (LPCSTR)188);
170 return pShellDDEInit(start);
175 /***********************************************************************
178 * Called by Win98 explorer.exe main binary, definitely has 0
181 DWORD WINAPI RunInstallUninstallStubs(void)
183 FIXME("(), stub!\n");
187 /***********************************************************************
188 * SetQueryNetSessionCount (SHDOCVW.@)
190 DWORD WINAPI SetQueryNetSessionCount(DWORD arg)
192 FIXME("(%u), stub!\n", arg);
196 /**********************************************************************
197 * OpenURL (SHDOCVW.@)
199 void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd)
201 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(lpcstrUrl), nShowCmd);
204 /**********************************************************************
205 * Some forwards (by ordinal) to SHLWAPI
208 static void* fetch_shlwapi_ordinal(unsigned ord)
210 static const WCHAR shlwapiW[] = {'s','h','l','w','a','p','i','.','d','l','l','\0'};
213 if (!h && !(h = GetModuleHandleW(shlwapiW))) return NULL;
214 return (void*)GetProcAddress(h, (const char*)ord);
217 /******************************************************************
218 * WhichPlatformFORWARD (SHDOCVW.@)
220 DWORD WINAPI WhichPlatformFORWARD(void)
222 static DWORD (WINAPI *p)(void);
224 if (p || (p = fetch_shlwapi_ordinal(276))) return p();
225 return 1; /* not integrated, see shlwapi.WhichPlatform */
228 /******************************************************************
229 * StopWatchModeFORWARD (SHDOCVW.@)
231 void WINAPI StopWatchModeFORWARD(void)
233 static void (WINAPI *p)(void);
235 if (p || (p = fetch_shlwapi_ordinal(241))) p();
238 /******************************************************************
239 * StopWatchFlushFORWARD (SHDOCVW.@)
241 void WINAPI StopWatchFlushFORWARD(void)
243 static void (WINAPI *p)(void);
245 if (p || (p = fetch_shlwapi_ordinal(242))) p();
248 /******************************************************************
249 * StopWatchWFORWARD (SHDOCVW.@)
251 DWORD WINAPI StopWatchWFORWARD(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
252 DWORD dwMode, DWORD dwTimeStamp)
254 static DWORD (WINAPI *p)(DWORD, LPCWSTR, DWORD, DWORD, DWORD);
256 if (p || (p = fetch_shlwapi_ordinal(243)))
257 return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
258 return ERROR_CALL_NOT_IMPLEMENTED;
261 /******************************************************************
262 * StopWatchAFORWARD (SHDOCVW.@)
264 DWORD WINAPI StopWatchAFORWARD(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
265 DWORD dwMode, DWORD dwTimeStamp)
267 static DWORD (WINAPI *p)(DWORD, LPCSTR, DWORD, DWORD, DWORD);
269 if (p || (p = fetch_shlwapi_ordinal(244)))
270 return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
271 return ERROR_CALL_NOT_IMPLEMENTED;
274 /******************************************************************
275 * URLSubRegQueryA (SHDOCVW.151)
277 HRESULT WINAPI URLSubRegQueryA(LPCSTR regpath, LPCSTR name, DWORD type,
278 LPSTR out, DWORD outlen, DWORD unknown)
280 CHAR buffer[INTERNET_MAX_URL_LENGTH];
284 TRACE("(%s, %s, %d, %p, %d, %d)\n", debugstr_a(regpath), debugstr_a(name),
285 type, out, outlen, unknown);
287 if (!out) return S_OK;
289 len = sizeof(buffer);
290 res = SHRegGetUSValueA(regpath, name, NULL, buffer, &len, FALSE, NULL, 0);
292 lstrcpynA(out, buffer, outlen);