Changes in crossover-wine-src-6.1.0 except for configure
[wine/hacks.git] / dlls / shdocvw / shdocvw_main.c
blob551fb3ec80da6885d9ee7be82773357a316d1712
1 /*
2 * SHDOCVW - Internet Explorer Web Control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2004 Mike McCormack (for CodeWeavers)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
24 #include <stdarg.h>
25 #include <stdio.h>
27 #include "wine/unicode.h"
28 #include "wine/debug.h"
30 #include "shdocvw.h"
32 #include "winreg.h"
33 #include "shlwapi.h"
35 #include "initguid.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
39 LONG SHDOCVW_refCount = 0;
41 HINSTANCE shdocvw_hinstance = 0;
42 static HMODULE SHDOCVW_hshell32 = 0;
43 static ITypeInfo *wb_typeinfo = NULL;
45 HRESULT get_typeinfo(ITypeInfo **typeinfo)
47 ITypeLib *typelib;
48 HRESULT hres;
50 if(wb_typeinfo) {
51 *typeinfo = wb_typeinfo;
52 return S_OK;
55 hres = LoadRegTypeLib(&LIBID_SHDocVw, 1, 1, LOCALE_SYSTEM_DEFAULT, &typelib);
56 if(FAILED(hres)) {
57 ERR("LoadRegTypeLib failed: %08x\n", hres);
58 return hres;
61 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IWebBrowser2, &wb_typeinfo);
62 ITypeLib_Release(typelib);
64 *typeinfo = wb_typeinfo;
65 return hres;
68 /*************************************************************************
69 * SHDOCVW DllMain
71 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
73 TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
74 switch (fdwReason)
76 case DLL_PROCESS_ATTACH:
77 shdocvw_hinstance = hinst;
78 register_iewindow_class();
79 break;
80 case DLL_PROCESS_DETACH:
81 if (SHDOCVW_hshell32) FreeLibrary(SHDOCVW_hshell32);
82 unregister_iewindow_class();
83 if(wb_typeinfo)
84 ITypeInfo_Release(wb_typeinfo);
85 break;
87 return TRUE;
90 /*************************************************************************
91 * DllCanUnloadNow (SHDOCVW.@)
93 HRESULT WINAPI DllCanUnloadNow(void)
95 return SHDOCVW_refCount ? S_FALSE : S_OK;
98 /***********************************************************************
99 * DllGetVersion (SHDOCVW.@)
101 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
103 if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
105 /* this is what IE6 on Windows 98 reports */
106 info->dwMajorVersion = 6;
107 info->dwMinorVersion = 0;
108 info->dwBuildNumber = 2600;
109 info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
111 return NOERROR;
114 /*************************************************************************
115 * DllInstall (SHDOCVW.@)
117 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
119 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
121 return S_OK;
124 /*************************************************************************
125 * SHDOCVW_LoadShell32
127 * makes sure the handle to shell32 is valid
129 static BOOL SHDOCVW_LoadShell32(void)
131 if (SHDOCVW_hshell32)
132 return TRUE;
133 return ((SHDOCVW_hshell32 = LoadLibraryA("shell32.dll")) != NULL);
136 /***********************************************************************
137 * @ (SHDOCVW.110)
139 * Called by Win98 explorer.exe main binary, definitely has 0
140 * parameters.
142 DWORD WINAPI WinList_Init(void)
144 FIXME("(), stub!\n");
145 return 0x0deadfeed;
148 /***********************************************************************
149 * @ (SHDOCVW.118)
151 * Called by Win98 explorer.exe main binary, definitely has only one
152 * parameter.
154 static BOOL (WINAPI *pShellDDEInit)(BOOL start) = NULL;
156 BOOL WINAPI ShellDDEInit(BOOL start)
158 TRACE("(%d)\n", start);
160 if (!pShellDDEInit)
162 if (!SHDOCVW_LoadShell32())
163 return FALSE;
164 pShellDDEInit = GetProcAddress(SHDOCVW_hshell32, (LPCSTR)188);
167 if (pShellDDEInit)
168 return pShellDDEInit(start);
169 else
170 return FALSE;
173 /***********************************************************************
174 * @ (SHDOCVW.125)
176 * Called by Win98 explorer.exe main binary, definitely has 0
177 * parameters.
179 DWORD WINAPI RunInstallUninstallStubs(void)
181 FIXME("(), stub!\n");
182 return 0x0deadbee;
185 /***********************************************************************
186 * SetQueryNetSessionCount (SHDOCVW.@)
188 DWORD WINAPI SetQueryNetSessionCount(DWORD arg)
190 FIXME("(%u), stub!\n", arg);
191 return 0;
194 /**********************************************************************
195 * OpenURL (SHDOCVW.@)
197 void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd)
199 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(lpcstrUrl), nShowCmd);
202 /**********************************************************************
203 * Some forwards (by ordinal) to SHLWAPI
206 static void* fetch_shlwapi_ordinal(unsigned ord)
208 static const WCHAR shlwapiW[] = {'s','h','l','w','a','p','i','.','d','l','l','\0'};
209 static HANDLE h;
211 if (!h && !(h = GetModuleHandleW(shlwapiW))) return NULL;
212 return (void*)GetProcAddress(h, (const char*)ord);
215 /******************************************************************
216 * WhichPlatformFORWARD (SHDOCVW.@)
218 DWORD WINAPI WhichPlatformFORWARD(void)
220 static DWORD (*WINAPI p)(void);
222 if (p || (p = fetch_shlwapi_ordinal(276))) return p();
223 return 1; /* not integrated, see shlwapi.WhichPlatform */
226 /******************************************************************
227 * StopWatchModeFORWARD (SHDOCVW.@)
229 void WINAPI StopWatchModeFORWARD(void)
231 static void (*WINAPI p)(void);
233 if (p || (p = fetch_shlwapi_ordinal(241))) p();
236 /******************************************************************
237 * StopWatchFlushFORWARD (SHDOCVW.@)
239 void WINAPI StopWatchFlushFORWARD(void)
241 static void (*WINAPI p)(void);
243 if (p || (p = fetch_shlwapi_ordinal(242))) p();
246 /******************************************************************
247 * StopWatchWFORWARD (SHDOCVW.@)
249 DWORD WINAPI StopWatchWFORWARD(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
250 DWORD dwMode, DWORD dwTimeStamp)
252 static DWORD (*WINAPI p)(DWORD, LPCWSTR, DWORD, DWORD, DWORD);
254 if (p || (p = fetch_shlwapi_ordinal(243)))
255 return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
256 return ERROR_CALL_NOT_IMPLEMENTED;
259 /******************************************************************
260 * StopWatchAFORWARD (SHDOCVW.@)
262 DWORD WINAPI StopWatchAFORWARD(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
263 DWORD dwMode, DWORD dwTimeStamp)
265 static DWORD (*WINAPI p)(DWORD, LPCSTR, DWORD, DWORD, DWORD);
267 if (p || (p = fetch_shlwapi_ordinal(244)))
268 return p(dwClass, lpszStr, dwUnknown, dwMode, dwTimeStamp);
269 return ERROR_CALL_NOT_IMPLEMENTED;