4 * Copyright (c) 2000 Patrik Stridvall
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
29 #define NO_SHLWAPI_REG
32 #include "wine/debug.h"
36 #include "urlmon_main.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
40 HINSTANCE URLMON_hInstance = 0;
42 /***********************************************************************
43 * DllMain (URLMON.init)
45 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
47 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
50 case DLL_PROCESS_ATTACH:
51 DisableThreadLibraryCalls(hinstDLL);
52 URLMON_hInstance = hinstDLL;
55 case DLL_PROCESS_DETACH:
63 /***********************************************************************
64 * DllInstall (URLMON.@)
66 HRESULT WINAPI URLMON_DllInstall(BOOL bInstall, LPCWSTR cmdline)
68 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",
74 /***********************************************************************
75 * DllCanUnloadNow (URLMON.@)
77 HRESULT WINAPI URLMON_DllCanUnloadNow(void)
79 FIXME("(void): stub\n");
86 /******************************************************************************
90 IClassFactory ITF_IClassFactory;
93 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
96 struct object_creation_info
99 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
102 static const struct object_creation_info object_creation[] =
104 { &CLSID_InternetSecurityManager, &SecManagerImpl_Construct }
107 static HRESULT WINAPI
108 CF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
110 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
112 if (IsEqualGUID(riid, &IID_IUnknown)
113 || IsEqualGUID(riid, &IID_IClassFactory))
115 IClassFactory_AddRef(iface);
120 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
121 return E_NOINTERFACE;
124 static ULONG WINAPI CF_AddRef(LPCLASSFACTORY iface)
126 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
127 return InterlockedIncrement(&This->ref);
130 static ULONG WINAPI CF_Release(LPCLASSFACTORY iface)
132 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
134 ULONG ref = InterlockedDecrement(&This->ref);
137 HeapFree(GetProcessHeap(), 0, This);
143 static HRESULT WINAPI CF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
144 REFIID riid, LPVOID *ppobj)
146 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
150 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
153 if(SUCCEEDED(hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk))) {
154 hres = IUnknown_QueryInterface(punk, riid, ppobj);
155 IUnknown_Release(punk);
160 static HRESULT WINAPI CF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
162 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
163 FIXME("(%p)->(%d),stub!\n",This,dolock);
167 static IClassFactoryVtbl CF_Vtbl =
176 /*******************************************************************************
177 * DllGetClassObject [URLMON.@]
178 * Retrieves class object from a DLL object
181 * Docs say returns STDAPI
184 * rclsid [I] CLSID for the class object
185 * riid [I] Reference to identifier of interface for class object
186 * ppv [O] Address of variable to receive interface pointer for riid
190 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
194 DWORD WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
197 IClassFactoryImpl *factory;
199 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
201 if ( !IsEqualGUID( &IID_IClassFactory, riid )
202 && ! IsEqualGUID( &IID_IUnknown, riid) )
203 return E_NOINTERFACE;
205 for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
207 if (IsEqualGUID(object_creation[i].clsid, rclsid))
211 if (i == sizeof(object_creation)/sizeof(object_creation[0]))
213 FIXME("%s: no class found.\n", debugstr_guid(rclsid));
214 return CLASS_E_CLASSNOTAVAILABLE;
217 factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
218 if (factory == NULL) return E_OUTOFMEMORY;
220 factory->ITF_IClassFactory.lpVtbl = &CF_Vtbl;
223 factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
225 *ppv = &(factory->ITF_IClassFactory);
230 /***********************************************************************
231 * DllRegisterServerEx (URLMON.@)
233 HRESULT WINAPI URLMON_DllRegisterServerEx(void)
235 FIXME("(void): stub\n");
240 /**************************************************************************
241 * UrlMkSetSessionOption (URLMON.@)
243 HRESULT WINAPI UrlMkSetSessionOption(long lost, LPVOID *splat, long time,
246 FIXME("(%#lx, %p, %#lx, %#lx): stub\n", lost, splat, time, nosee);
251 /**************************************************************************
252 * ObtainUserAgentString (URLMON.@)
254 HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPCSTR pcszUAOut, DWORD *cbSize)
256 FIXME("(%ld, %p, %p): stub\n", dwOption, pcszUAOut, cbSize);
259 ERR("dwOption: %ld, must be zero\n", dwOption);
265 HRESULT WINAPI CoInternetCombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
266 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
269 DWORD size = cchResult;
271 TRACE("(%s,%s,0x%08lx,%p,%ld,%p,%ld)\n", debugstr_w(pwzBaseUrl), debugstr_w(pwzRelativeUrl), dwCombineFlags,
272 pwzResult, cchResult, pcchResult, dwReserved);
273 hres = UrlCombineW(pwzBaseUrl, pwzRelativeUrl, pwzResult, &size, dwCombineFlags);
274 if(pcchResult) *pcchResult = size;
278 HRESULT WINAPI CoInternetCompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
280 TRACE("(%s,%s,%08lx)\n", debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
281 return UrlCompareW(pwzUrl1, pwzUrl2, dwCompareFlags)==0?S_OK:S_FALSE;
284 /**************************************************************************
285 * IsValidURL (URLMON.@)
287 * Determines if a specified string is a valid URL.
290 * pBC [I] ignored, must be NULL.
291 * szURL [I] string that represents the URL in question.
292 * dwReserved [I] reserved and must be zero.
297 * returns E_INVALIDARG if one or more of the args is invalid.
300 * test functionality against windows to see what a valid URL is.
302 HRESULT WINAPI IsValidURL(LPBC pBC, LPCWSTR szURL, DWORD dwReserved)
304 FIXME("(%p, %s, %ld): stub\n", pBC, debugstr_w(szURL), dwReserved);
306 if (pBC != NULL || dwReserved != 0)