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
27 #define NO_SHLWAPI_REG
30 #include "wine/debug.h"
34 #include "urlmon_main.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
38 HINSTANCE URLMON_hInstance = 0;
40 /***********************************************************************
41 * DllMain (URLMON.init)
43 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
45 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
48 case DLL_PROCESS_ATTACH:
49 DisableThreadLibraryCalls(hinstDLL);
50 URLMON_hInstance = hinstDLL;
53 case DLL_PROCESS_DETACH:
61 /***********************************************************************
62 * DllInstall (URLMON.@)
64 HRESULT WINAPI URLMON_DllInstall(BOOL bInstall, LPCWSTR cmdline)
66 FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",
72 /***********************************************************************
73 * DllCanUnloadNow (URLMON.@)
75 HRESULT WINAPI URLMON_DllCanUnloadNow(void)
77 FIXME("(void): stub\n");
84 /******************************************************************************
88 IClassFactory ITF_IClassFactory;
91 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
94 struct object_creation_info
97 HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
100 static const struct object_creation_info object_creation[] =
102 { &CLSID_InternetSecurityManager, &SecManagerImpl_Construct }
105 static HRESULT WINAPI
106 CF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
108 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
110 if (IsEqualGUID(riid, &IID_IUnknown)
111 || IsEqualGUID(riid, &IID_IClassFactory))
113 IClassFactory_AddRef(iface);
118 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
119 return E_NOINTERFACE;
122 static ULONG WINAPI CF_AddRef(LPCLASSFACTORY iface)
124 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
125 return InterlockedIncrement(&This->ref);
128 static ULONG WINAPI CF_Release(LPCLASSFACTORY iface)
130 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
132 ULONG ref = InterlockedDecrement(&This->ref);
135 HeapFree(GetProcessHeap(), 0, This);
141 static HRESULT WINAPI CF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
142 REFIID riid, LPVOID *ppobj)
144 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
148 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
151 if(SUCCEEDED(hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk))) {
152 hres = IUnknown_QueryInterface(punk, riid, ppobj);
153 IUnknown_Release(punk);
158 static HRESULT WINAPI CF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
160 IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
161 FIXME("(%p)->(%d),stub!\n",This,dolock);
165 static IClassFactoryVtbl CF_Vtbl =
174 /*******************************************************************************
175 * DllGetClassObject [URLMON.@]
176 * Retrieves class object from a DLL object
179 * Docs say returns STDAPI
182 * rclsid [I] CLSID for the class object
183 * riid [I] Reference to identifier of interface for class object
184 * ppv [O] Address of variable to receive interface pointer for riid
188 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
192 DWORD WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
195 IClassFactoryImpl *factory;
197 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
199 if ( !IsEqualGUID( &IID_IClassFactory, riid )
200 && ! IsEqualGUID( &IID_IUnknown, riid) )
201 return E_NOINTERFACE;
203 for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
205 if (IsEqualGUID(object_creation[i].clsid, rclsid))
209 if (i == sizeof(object_creation)/sizeof(object_creation[0]))
211 FIXME("%s: no class found.\n", debugstr_guid(rclsid));
212 return CLASS_E_CLASSNOTAVAILABLE;
215 factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
216 if (factory == NULL) return E_OUTOFMEMORY;
218 factory->ITF_IClassFactory.lpVtbl = &CF_Vtbl;
221 factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
223 *ppv = &(factory->ITF_IClassFactory);
228 /***********************************************************************
229 * DllRegisterServerEx (URLMON.@)
231 HRESULT WINAPI URLMON_DllRegisterServerEx(void)
233 FIXME("(void): stub\n");
238 /**************************************************************************
239 * UrlMkSetSessionOption (URLMON.@)
241 HRESULT WINAPI UrlMkSetSessionOption(long lost, LPVOID *splat, long time,
244 FIXME("(%#lx, %p, %#lx, %#lx): stub\n", lost, splat, time, nosee);
249 /**************************************************************************
250 * ObtainUserAgentString (URLMON.@)
252 HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPCSTR pcszUAOut, DWORD *cbSize)
254 FIXME("(%ld, %p, %p): stub\n", dwOption, pcszUAOut, cbSize);
257 ERR("dwOption: %ld, must be zero\n", dwOption);
263 HRESULT WINAPI CoInternetCombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
264 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
267 DWORD size = cchResult;
269 TRACE("(%s,%s,0x%08lx,%p,%ld,%p,%ld)\n", debugstr_w(pwzBaseUrl), debugstr_w(pwzRelativeUrl), dwCombineFlags,
270 pwzResult, cchResult, pcchResult, dwReserved);
271 hres = UrlCombineW(pwzBaseUrl, pwzRelativeUrl, pwzResult, &size, dwCombineFlags);
272 if(pcchResult) *pcchResult = size;
276 HRESULT WINAPI CoInternetCompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
278 TRACE("(%s,%s,%08lx)\n", debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
279 return UrlCompareW(pwzUrl1, pwzUrl2, dwCompareFlags)==0?S_OK:S_FALSE;
282 /**************************************************************************
283 * IsValidURL (URLMON.@)
285 * Determines if a specified string is a valid URL.
288 * pBC [I] ignored, must be NULL.
289 * szURL [I] string that represents the URL in question.
290 * dwReserved [I] reserved and must be zero.
295 * returns E_INVALIDARG if one or more of the args is invalid.
298 * test functionality against windows to see what a valid URL is.
300 HRESULT WINAPI IsValidURL(LPBC pBC, LPCWSTR szURL, DWORD dwReserved)
302 FIXME("(%p, %s, %ld): stub\n", pBC, debugstr_w(szURL), dwReserved);
304 if (pBC != NULL || dwReserved != 0)