~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/urlmon/internet.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2005 Jacek Caban
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2.1 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with this library; if not, write to the Free Software
 16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 17  */
 18 
 19 #include "urlmon_main.h"
 20 #include "winreg.h"
 21 #include "shlwapi.h"
 22 
 23 #include "wine/debug.h"
 24 
 25 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
 26 
 27 static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
 28 {
 29     WCHAR *ptr;
 30     DWORD len = 0;
 31 
 32     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
 33 
 34     if(flags)
 35         ERR("wrong flags\n");
 36     
 37     ptr = strchrW(url, ':');
 38     if(ptr)
 39         len = ptr-url;
 40 
 41     if(len >= size)
 42         return E_POINTER;
 43 
 44     if(len)
 45         memcpy(result, url, len*sizeof(WCHAR));
 46     result[len] = 0;
 47 
 48     if(rsize)
 49         *rsize = len;
 50 
 51     return S_OK;
 52 }
 53 
 54 static HRESULT parse_canonicalize_url(LPCWSTR url, DWORD flags, LPWSTR result,
 55         DWORD size, DWORD *rsize)
 56 {
 57     IInternetProtocolInfo *protocol_info;
 58     DWORD prsize = size;
 59     HRESULT hres;
 60 
 61     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
 62 
 63     protocol_info = get_protocol_info(url);
 64 
 65     if(protocol_info) {
 66         hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_CANONICALIZE,
 67                 flags, result, size, rsize, 0);
 68         IInternetProtocolInfo_Release(protocol_info);
 69         if(SUCCEEDED(hres))
 70             return hres;
 71     }
 72 
 73     hres = UrlCanonicalizeW(url, result, &prsize, flags);
 74 
 75     if(rsize)
 76         *rsize = prsize;
 77     return hres;
 78 }
 79 
 80 static HRESULT parse_security_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
 81 {
 82     IInternetProtocolInfo *protocol_info;
 83     HRESULT hres;
 84 
 85     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
 86 
 87     protocol_info = get_protocol_info(url);
 88 
 89     if(protocol_info) {
 90         hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL,
 91                 flags, result, size, rsize, 0);
 92         IInternetProtocolInfo_Release(protocol_info);
 93         return hres;
 94     }
 95 
 96     return E_FAIL;
 97 }
 98 
 99 static HRESULT parse_encode(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
100 {
101     IInternetProtocolInfo *protocol_info;
102     DWORD prsize;
103     HRESULT hres;
104 
105     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
106 
107     protocol_info = get_protocol_info(url);
108 
109     if(protocol_info) {
110         hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_ENCODE,
111                 flags, result, size, rsize, 0);
112         IInternetProtocolInfo_Release(protocol_info);
113         if(SUCCEEDED(hres))
114             return hres;
115     }
116 
117     prsize = size;
118     hres = UrlUnescapeW((LPWSTR)url, result, &prsize, flags);
119 
120     if(rsize)
121         *rsize = prsize;
122 
123     return hres;
124 }
125 
126 static HRESULT parse_path_from_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
127 {
128     IInternetProtocolInfo *protocol_info;
129     DWORD prsize;
130     HRESULT hres;
131 
132     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
133 
134     protocol_info = get_protocol_info(url);
135 
136     if(protocol_info) {
137         hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_PATH_FROM_URL,
138                 flags, result, size, rsize, 0);
139         IInternetProtocolInfo_Release(protocol_info);
140         if(SUCCEEDED(hres))
141             return hres;
142     }
143 
144     prsize = size;
145     hres = PathCreateFromUrlW(url, result, &prsize, 0);
146 
147     if(rsize)
148         *rsize = prsize;
149     return hres;
150 }
151 
152 static HRESULT parse_security_domain(LPCWSTR url, DWORD flags, LPWSTR result,
153         DWORD size, DWORD *rsize)
154 {
155     IInternetProtocolInfo *protocol_info;
156     HRESULT hres;
157 
158     TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
159 
160     protocol_info = get_protocol_info(url);
161 
162     if(protocol_info) {
163         hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN,
164                 flags, result, size, rsize, 0);
165         IInternetProtocolInfo_Release(protocol_info);
166         if(SUCCEEDED(hres))
167             return hres;
168     }
169 
170     return E_FAIL;
171 }
172 
173 /**************************************************************************
174  *          CoInternetParseUrl    (URLMON.@)
175  */
176 HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags,
177         LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
178 {
179     if(dwReserved)
180         WARN("dwReserved = %d\n", dwReserved);
181 
182     switch(ParseAction) {
183     case PARSE_CANONICALIZE:
184         return parse_canonicalize_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
185     case PARSE_SECURITY_URL:
186         return parse_security_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
187     case PARSE_ENCODE:
188         return parse_encode(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
189     case PARSE_PATH_FROM_URL:
190         return parse_path_from_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
191     case PARSE_SCHEMA:
192         return parse_schema(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
193     case PARSE_SECURITY_DOMAIN:
194         return parse_security_domain(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
195     default:
196         FIXME("not supported action %d\n", ParseAction);
197     }
198 
199     return E_NOTIMPL;
200 }
201 
202 /**************************************************************************
203  *          CoInternetCombineUrl    (URLMON.@)
204  */
205 HRESULT WINAPI CoInternetCombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
206         DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult,
207         DWORD dwReserved)
208 {
209     IInternetProtocolInfo *protocol_info;
210     DWORD size = cchResult;
211     HRESULT hres;
212     
213     TRACE("(%s,%s,0x%08x,%p,%d,%p,%d)\n", debugstr_w(pwzBaseUrl),
214           debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult, pcchResult,
215           dwReserved);
216 
217     protocol_info = get_protocol_info(pwzBaseUrl);
218 
219     if(protocol_info) {
220         hres = IInternetProtocolInfo_CombineUrl(protocol_info, pwzBaseUrl, pwzRelativeUrl,
221                 dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved);
222         IInternetProtocolInfo_Release(protocol_info);
223         if(SUCCEEDED(hres))
224             return hres;
225     }
226 
227 
228     hres = UrlCombineW(pwzBaseUrl, pwzRelativeUrl, pwzResult, &size, dwCombineFlags);
229 
230     if(pcchResult)
231         *pcchResult = size;
232 
233     return hres;
234 }
235 
236 /**************************************************************************
237  *          CoInternetCompareUrl    (URLMON.@)
238  */
239 HRESULT WINAPI CoInternetCompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
240 {
241     IInternetProtocolInfo *protocol_info;
242     HRESULT hres;
243 
244     TRACE("(%s,%s,%08x)\n", debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
245 
246     protocol_info = get_protocol_info(pwzUrl1);
247 
248     if(protocol_info) {
249         hres = IInternetProtocolInfo_CompareUrl(protocol_info, pwzUrl1, pwzUrl2, dwCompareFlags);
250         IInternetProtocolInfo_Release(protocol_info);
251         if(SUCCEEDED(hres))
252             return hres;
253     }
254 
255     return UrlCompareW(pwzUrl1, pwzUrl2, dwCompareFlags) ? S_FALSE : S_OK;
256 }
257 
258 /***********************************************************************
259  *           CoInternetQueryInfo (URLMON.@)
260  *
261  * Retrieves information relevant to a specified URL
262  *
263  */
264 HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption,
265         DWORD dwQueryFlags, LPVOID pvBuffer, DWORD cbBuffer, DWORD *pcbBuffer,
266         DWORD dwReserved)
267 {
268     IInternetProtocolInfo *protocol_info;
269     HRESULT hres;
270 
271     TRACE("(%s, %x, %x, %p, %x, %p, %x): stub\n", debugstr_w(pwzUrl),
272           QueryOption, dwQueryFlags, pvBuffer, cbBuffer, pcbBuffer, dwReserved);
273 
274     protocol_info = get_protocol_info(pwzUrl);
275 
276     if(protocol_info) {
277         hres = IInternetProtocolInfo_QueryInfo(protocol_info, pwzUrl, QueryOption, dwQueryFlags,
278                 pvBuffer, cbBuffer, pcbBuffer, dwReserved);
279         IInternetProtocolInfo_Release(protocol_info);
280 
281         return SUCCEEDED(hres) ? hres : E_FAIL;
282     }
283 
284     switch(QueryOption) {
285     case QUERY_USES_NETWORK:
286         if(!pvBuffer || cbBuffer < sizeof(DWORD))
287             return E_FAIL;
288 
289         *(DWORD*)pvBuffer = 0;
290         if(pcbBuffer)
291             *pcbBuffer = sizeof(DWORD);
292         break;
293 
294     default:
295         FIXME("Not supported option %d\n", QueryOption);
296         return E_NOTIMPL;
297     }
298 
299     return S_OK;
300 }
301 
302 /***********************************************************************
303  *             CoInternetSetFeatureEnabled (URLMON.@)
304  */
305 HRESULT WINAPI CoInternetSetFeatureEnabled(INTERNETFEATURELIST feature, DWORD flags, BOOL enable)
306 {
307     FIXME("%d, 0x%08x, %x, stub\n", feature, flags, enable);
308     return E_NOTIMPL;
309 }
310 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.