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 LONG URLMON_refCount
= 0;
42 HINSTANCE URLMON_hInstance
= 0;
44 /***********************************************************************
45 * DllMain (URLMON.init)
47 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
49 TRACE("%p 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
52 case DLL_PROCESS_ATTACH
:
53 DisableThreadLibraryCalls(hinstDLL
);
54 URLMON_hInstance
= hinstDLL
;
57 case DLL_PROCESS_DETACH
:
65 /***********************************************************************
66 * DllInstall (URLMON.@)
68 HRESULT WINAPI
URLMON_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
70 FIXME("(%s, %s): stub\n", bInstall
?"TRUE":"FALSE",
76 /***********************************************************************
77 * DllCanUnloadNow (URLMON.@)
79 HRESULT WINAPI
URLMON_DllCanUnloadNow(void)
81 return URLMON_refCount
!= 0 ? S_FALSE
: S_OK
;
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
},
105 { &CLSID_InternetZoneManager
, ZoneMgrImpl_Construct
}
108 static HRESULT WINAPI
109 CF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
111 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
113 if (IsEqualGUID(riid
, &IID_IUnknown
)
114 || IsEqualGUID(riid
, &IID_IClassFactory
))
116 IClassFactory_AddRef(iface
);
121 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
122 return E_NOINTERFACE
;
125 static ULONG WINAPI
CF_AddRef(LPCLASSFACTORY iface
)
127 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
130 return InterlockedIncrement(&This
->ref
);
133 static ULONG WINAPI
CF_Release(LPCLASSFACTORY iface
)
135 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
137 ULONG ref
= InterlockedDecrement(&This
->ref
);
140 HeapFree(GetProcessHeap(), 0, This
);
142 URLMON_UnlockModule();
148 static HRESULT WINAPI
CF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
,
149 REFIID riid
, LPVOID
*ppobj
)
151 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
155 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
158 if(SUCCEEDED(hres
= This
->pfnCreateInstance(pOuter
, (LPVOID
*) &punk
))) {
159 hres
= IUnknown_QueryInterface(punk
, riid
, ppobj
);
160 IUnknown_Release(punk
);
165 static HRESULT WINAPI
CF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
167 TRACE("(%d)\n", dolock
);
172 URLMON_UnlockModule();
177 static IClassFactoryVtbl CF_Vtbl
=
186 /*******************************************************************************
187 * DllGetClassObject [URLMON.@]
188 * Retrieves class object from a DLL object
191 * Docs say returns STDAPI
194 * rclsid [I] CLSID for the class object
195 * riid [I] Reference to identifier of interface for class object
196 * ppv [O] Address of variable to receive interface pointer for riid
200 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
204 DWORD WINAPI
URLMON_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
207 IClassFactoryImpl
*factory
;
209 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
211 if ( !IsEqualGUID( &IID_IClassFactory
, riid
)
212 && ! IsEqualGUID( &IID_IUnknown
, riid
) )
213 return E_NOINTERFACE
;
215 for (i
=0; i
< sizeof(object_creation
)/sizeof(object_creation
[0]); i
++)
217 if (IsEqualGUID(object_creation
[i
].clsid
, rclsid
))
221 if (i
== sizeof(object_creation
)/sizeof(object_creation
[0]))
223 FIXME("%s: no class found.\n", debugstr_guid(rclsid
));
224 return CLASS_E_CLASSNOTAVAILABLE
;
227 factory
= HeapAlloc(GetProcessHeap(), 0, sizeof(*factory
));
228 if (factory
== NULL
) return E_OUTOFMEMORY
;
230 factory
->ITF_IClassFactory
.lpVtbl
= &CF_Vtbl
;
233 factory
->pfnCreateInstance
= object_creation
[i
].pfnCreateInstance
;
235 *ppv
= &(factory
->ITF_IClassFactory
);
240 /***********************************************************************
241 * DllRegisterServerEx (URLMON.@)
243 HRESULT WINAPI
URLMON_DllRegisterServerEx(void)
245 FIXME("(void): stub\n");
250 /**************************************************************************
251 * UrlMkSetSessionOption (URLMON.@)
253 HRESULT WINAPI
UrlMkSetSessionOption(DWORD dwOption
, LPVOID
*pBuffer
, DWORD dwBufferLength
,
256 FIXME("(%#lx, %p, %#lx): stub\n", dwOption
, pBuffer
, dwBufferLength
);
261 /**************************************************************************
262 * UrlMkGetSessionOption (URLMON.@)
264 HRESULT WINAPI
UrlMkGetSessionOption(DWORD dwOption
, LPVOID
*pBuffer
, DWORD dwBufferLength
,
265 DWORD
* pdwBufferLength
, DWORD dwReserved
)
267 FIXME("(%#lx, %p, %#lx, %p): stub\n", dwOption
, pBuffer
, dwBufferLength
, pdwBufferLength
);
272 /**************************************************************************
273 * ObtainUserAgentString (URLMON.@)
275 HRESULT WINAPI
ObtainUserAgentString(DWORD dwOption
, LPCSTR pcszUAOut
, DWORD
*cbSize
)
277 FIXME("(%ld, %p, %p): stub\n", dwOption
, pcszUAOut
, cbSize
);
280 ERR("dwOption: %ld, must be zero\n", dwOption
);
286 HRESULT WINAPI
CoInternetCombineUrl(LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
287 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
290 DWORD size
= cchResult
;
292 TRACE("(%s,%s,0x%08lx,%p,%ld,%p,%ld)\n", debugstr_w(pwzBaseUrl
), debugstr_w(pwzRelativeUrl
), dwCombineFlags
,
293 pwzResult
, cchResult
, pcchResult
, dwReserved
);
294 hres
= UrlCombineW(pwzBaseUrl
, pwzRelativeUrl
, pwzResult
, &size
, dwCombineFlags
);
295 if(pcchResult
) *pcchResult
= size
;
299 HRESULT WINAPI
CoInternetCompareUrl(LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
301 TRACE("(%s,%s,%08lx)\n", debugstr_w(pwzUrl1
), debugstr_w(pwzUrl2
), dwCompareFlags
);
302 return UrlCompareW(pwzUrl1
, pwzUrl2
, dwCompareFlags
)==0?S_OK
:S_FALSE
;
305 /**************************************************************************
306 * IsValidURL (URLMON.@)
308 * Determines if a specified string is a valid URL.
311 * pBC [I] ignored, must be NULL.
312 * szURL [I] string that represents the URL in question.
313 * dwReserved [I] reserved and must be zero.
318 * returns E_INVALIDARG if one or more of the args is invalid.
321 * test functionality against windows to see what a valid URL is.
323 HRESULT WINAPI
IsValidURL(LPBC pBC
, LPCWSTR szURL
, DWORD dwReserved
)
325 FIXME("(%p, %s, %ld): stub\n", pBC
, debugstr_w(szURL
), dwReserved
);
327 if (pBC
!= NULL
|| dwReserved
!= 0)
333 /**************************************************************************
334 * FaultInIEFeature (URLMON.@)
336 * Undocumented. Appears to be used by native shdocvw.dll.
338 HRESULT WINAPI
FaultInIEFeature( HWND hwnd
, uCLSSPEC
* pClassSpec
,
339 QUERYCONTEXT
*pQuery
, DWORD flags
)
341 FIXME("%p %p %p %08lx\n", hwnd
, pClassSpec
, pQuery
, flags
);
345 /**************************************************************************
346 * CoGetClassObjectFromURL (URLMON.@)
348 HRESULT WINAPI
CoGetClassObjectFromURL( REFCLSID rclsid
, LPCWSTR szCodeURL
, DWORD dwFileVersionMS
,
349 DWORD dwFileVersionLS
, LPCWSTR szContentType
,
350 LPBINDCTX pBindCtx
, DWORD dwClsContext
, LPVOID pvReserved
,
351 REFIID riid
, LPVOID
*ppv
)
353 FIXME("(%s %s %ld %ld %s %p %ld %p %s %p) Stub!\n", debugstr_guid(rclsid
), debugstr_w(szCodeURL
),
354 dwFileVersionMS
, dwFileVersionLS
, debugstr_w(szContentType
), pBindCtx
, dwClsContext
, pvReserved
,
355 debugstr_guid(riid
), ppv
);
356 return E_NOINTERFACE
;