ReactOS  0.4.14-dev-606-g14ebc0b
session.c
Go to the documentation of this file.
1 /*
2  * Copyright 2005-2006 Jacek Caban for CodeWeavers
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 
22 #include "wine/debug.h"
23 
25 
26 typedef struct {
31 
32  struct list entry;
33 } name_space;
34 
35 typedef struct {
39 
40  struct list entry;
41 } mime_filter;
42 
45 
48 {
49  0, 0, &session_cs,
51  0, 0, { (DWORD_PTR)(__FILE__ ": session") }
52 };
53 static CRITICAL_SECTION session_cs = { &session_cs_dbg, -1, 0, 0, 0, 0 };
54 
55 static const WCHAR internet_settings_keyW[] =
56  {'S','O','F','T','W','A','R','E',
57  '\\','M','i','c','r','o','s','o','f','t',
58  '\\','W','i','n','d','o','w','s',
59  '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
60  '\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0};
61 
63 {
64  name_space *iter;
65 
67  if(!wcsicmp(iter->protocol, protocol))
68  return iter;
69  }
70 
71  return NULL;
72 }
73 
75 {
76  WCHAR str_clsid[64];
77  HKEY hkey = NULL;
78  DWORD res, type, size;
79  CLSID clsid;
80  LPWSTR wszKey;
81  HRESULT hres;
82 
83  static const WCHAR wszProtocolsKey[] =
84  {'P','R','O','T','O','C','O','L','S','\\','H','a','n','d','l','e','r','\\'};
85  static const WCHAR wszCLSID[] = {'C','L','S','I','D',0};
86 
87  wszKey = heap_alloc(sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
88  memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
89  memcpy(wszKey + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR));
90 
91  res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
92  heap_free(wszKey);
93  if(res != ERROR_SUCCESS) {
94  TRACE("Could not open protocol handler key\n");
95  return MK_E_SYNTAX;
96  }
97 
98  size = sizeof(str_clsid);
99  res = RegQueryValueExW(hkey, wszCLSID, NULL, &type, (LPBYTE)str_clsid, &size);
100  RegCloseKey(hkey);
101  if(res != ERROR_SUCCESS || type != REG_SZ) {
102  WARN("Could not get protocol CLSID res=%d\n", res);
103  return MK_E_SYNTAX;
104  }
105 
106  hres = CLSIDFromString(str_clsid, &clsid);
107  if(FAILED(hres)) {
108  WARN("CLSIDFromString failed: %08x\n", hres);
109  return hres;
110  }
111 
112  if(pclsid)
113  *pclsid = clsid;
114 
115  if(!ret)
116  return S_OK;
117 
118  hres = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)ret);
119  return SUCCEEDED(hres) ? S_OK : MK_E_SYNTAX;
120 }
121 
123 {
124  name_space *new_name_space;
125 
126  new_name_space = heap_alloc(sizeof(name_space));
127 
128  if(!urlmon_protocol)
129  IClassFactory_AddRef(cf);
130  new_name_space->cf = cf;
131  new_name_space->clsid = *clsid;
132  new_name_space->urlmon = urlmon_protocol;
133  new_name_space->protocol = heap_strdupW(protocol);
134 
136 
137  list_add_head(&name_space_list, &new_name_space->entry);
138 
140 
141  return S_OK;
142 }
143 
145 {
146  name_space *iter;
147 
149 
151  if(iter->cf == cf && !wcsicmp(iter->protocol, protocol)) {
152  list_remove(&iter->entry);
153 
155 
156  if(!iter->urlmon)
157  IClassFactory_Release(iter->cf);
158  heap_free(iter->protocol);
159  heap_free(iter);
160  return S_OK;
161  }
162  }
163 
165  return S_OK;
166 }
167 
169 {
170  DWORD schema_len;
171  WCHAR schema[64];
172  HRESULT hres;
173 
174  hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
175  if(FAILED(hres))
176  return FALSE;
177 
178  return get_protocol_cf(schema, schema_len, NULL, NULL) == S_OK;
179 }
180 
182 {
184  IClassFactory *cf;
185  name_space *ns;
186  WCHAR schema[64];
187  DWORD schema_len;
188  HRESULT hres;
189 
190  hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
191  if(FAILED(hres) || !schema_len)
192  return NULL;
193 
195 
197  if(ns && !ns->urlmon) {
198  hres = IClassFactory_QueryInterface(ns->cf, &IID_IInternetProtocolInfo, (void**)&ret);
199  if(FAILED(hres))
200  hres = IClassFactory_CreateInstance(ns->cf, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
201  }
202 
204 
205  if(ns && SUCCEEDED(hres))
206  return ret;
207 
208  hres = get_protocol_cf(schema, schema_len, NULL, &cf);
209  if(FAILED(hres))
210  return NULL;
211 
212  hres = IClassFactory_QueryInterface(cf, &IID_IInternetProtocolInfo, (void**)&ret);
213  if(FAILED(hres))
214  IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocolInfo, (void**)&ret);
215  IClassFactory_Release(cf);
216 
217  return ret;
218 }
219 
221 {
222  name_space *ns;
223  BSTR scheme;
224  HRESULT hres;
225 
226  *ret = NULL;
227 
228  /* FIXME: Avoid GetSchemeName call for known schemes */
229  hres = IUri_GetSchemeName(uri, &scheme);
230  if(FAILED(hres))
231  return hres;
232 
234 
236  if(ns) {
237  *ret = ns->cf;
238  IClassFactory_AddRef(*ret);
239  if(clsid)
240  *clsid = ns->clsid;
241  }
242 
244 
247  return hres;
248 }
249 
251 {
252  static const WCHAR filtersW[] = {'P','r','o','t','o','c','o','l','s',
253  '\\','F','i','l','t','e','r',0 };
254  static const WCHAR CLSIDW[] = {'C','L','S','I','D',0};
255 
256  IClassFactory *cf = NULL;
258  mime_filter *iter;
259  HKEY hlist, hfilter;
260  WCHAR clsidw[64];
261  CLSID clsid;
262  DWORD res, type, size;
263  HRESULT hres;
264 
266 
268  if(!wcscmp(iter->mime, mime)) {
269  cf = iter->cf;
270  break;
271  }
272  }
273 
275 
276  if(cf) {
277  hres = IClassFactory_CreateInstance(cf, NULL, &IID_IInternetProtocol, (void**)&ret);
278  if(FAILED(hres)) {
279  WARN("CreateInstance failed: %08x\n", hres);
280  return NULL;
281  }
282 
283  return ret;
284  }
285 
286  res = RegOpenKeyW(HKEY_CLASSES_ROOT, filtersW, &hlist);
287  if(res != ERROR_SUCCESS) {
288  TRACE("Could not open MIME filters key\n");
289  return NULL;
290  }
291 
292  res = RegOpenKeyW(hlist, mime, &hfilter);
293  CloseHandle(hlist);
294  if(res != ERROR_SUCCESS)
295  return NULL;
296 
297  size = sizeof(clsidw);
298  res = RegQueryValueExW(hfilter, CLSIDW, NULL, &type, (LPBYTE)clsidw, &size);
299  CloseHandle(hfilter);
300  if(res!=ERROR_SUCCESS || type!=REG_SZ) {
301  WARN("Could not get filter CLSID for %s\n", debugstr_w(mime));
302  return NULL;
303  }
304 
305  hres = CLSIDFromString(clsidw, &clsid);
306  if(FAILED(hres)) {
307  WARN("CLSIDFromString failed for %s (%x)\n", debugstr_w(mime), hres);
308  return NULL;
309  }
310 
311  hres = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void**)&ret);
312  if(FAILED(hres)) {
313  WARN("CoCreateInstance failed: %08x\n", hres);
314  return NULL;
315  }
316 
317  return ret;
318 }
319 
321  REFIID riid, void **ppv)
322 {
323  TRACE("(%s %p)\n", debugstr_guid(riid), ppv);
324 
325  if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetSession, riid)) {
326  *ppv = iface;
327  IInternetSession_AddRef(iface);
328  return S_OK;
329  }
330 
331  *ppv = NULL;
332  return E_NOINTERFACE;
333 }
334 
336 {
337  TRACE("()\n");
339  return 2;
340 }
341 
343 {
344  TRACE("()\n");
346  return 1;
347 }
348 
350  IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzProtocol, ULONG cPatterns,
351  const LPCWSTR *ppwzPatterns, DWORD dwReserved)
352 {
353  TRACE("(%p %s %s %d %p %d)\n", pCF, debugstr_guid(rclsid), debugstr_w(pwzProtocol),
354  cPatterns, ppwzPatterns, dwReserved);
355 
356  if(cPatterns || ppwzPatterns)
357  FIXME("patterns not supported\n");
358  if(dwReserved)
359  WARN("dwReserved = %d\n", dwReserved);
360 
361  if(!pCF || !pwzProtocol)
362  return E_INVALIDARG;
363 
364  return register_namespace(pCF, rclsid, pwzProtocol, FALSE);
365 }
366 
368  IClassFactory *pCF, LPCWSTR pszProtocol)
369 {
370  TRACE("(%p %s)\n", pCF, debugstr_w(pszProtocol));
371 
372  if(!pCF || !pszProtocol)
373  return E_INVALIDARG;
374 
375  return unregister_namespace(pCF, pszProtocol);
376 }
377 
379  IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzType)
380 {
382 
383  TRACE("(%p %s %s)\n", pCF, debugstr_guid(rclsid), debugstr_w(pwzType));
384 
385  filter = heap_alloc(sizeof(mime_filter));
386 
387  IClassFactory_AddRef(pCF);
388  filter->cf = pCF;
389  filter->clsid = *rclsid;
390  filter->mime = heap_strdupW(pwzType);
391 
393 
395 
397 
398  return S_OK;
399 }
400 
402  IClassFactory *pCF, LPCWSTR pwzType)
403 {
404  mime_filter *iter;
405 
406  TRACE("(%p %s)\n", pCF, debugstr_w(pwzType));
407 
409 
411  if(iter->cf == pCF && !wcscmp(iter->mime, pwzType)) {
412  list_remove(&iter->entry);
413 
415 
416  IClassFactory_Release(iter->cf);
417  heap_free(iter->mime);
418  heap_free(iter);
419  return S_OK;
420  }
421  }
422 
424  return S_OK;
425 }
426 
428  LPBC pBC, LPCWSTR szUrl, IUnknown *pUnkOuter, IUnknown **ppUnk,
429  IInternetProtocol **ppOInetProt, DWORD dwOption)
430 {
432  HRESULT hres;
433 
434  TRACE("(%p %s %p %p %p %08x)\n", pBC, debugstr_w(szUrl), pUnkOuter, ppUnk,
435  ppOInetProt, dwOption);
436 
437  if(pBC || pUnkOuter || ppUnk || dwOption)
438  FIXME("Unsupported arguments\n");
439 
441  if(FAILED(hres))
442  return hres;
443 
444  *ppOInetProt = (IInternetProtocol*)&protocol->IInternetProtocolEx_iface;
445  return S_OK;
446 }
447 
449  DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD dwReserved)
450 {
451  FIXME("(%08x %p %d %d)\n", dwOption, pBuffer, dwBufferLength, dwReserved);
452  return E_NOTIMPL;
453 }
454 
455 static const IInternetSessionVtbl InternetSessionVtbl = {
465 };
466 
468 
469 /***********************************************************************
470  * CoInternetGetSession (URLMON.@)
471  *
472  * Create a new internet session and return an IInternetSession interface
473  * representing it.
474  *
475  * PARAMS
476  * dwSessionMode [I] Mode for the internet session
477  * ppIInternetSession [O] Destination for creates IInternetSession object
478  * dwReserved [I] Reserved, must be 0.
479  *
480  * RETURNS
481  * Success: S_OK. ppIInternetSession contains the IInternetSession interface.
482  * Failure: E_INVALIDARG, if any argument is invalid, or
483  * E_OUTOFMEMORY if memory allocation fails.
484  */
485 HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, IInternetSession **ppIInternetSession,
487 {
488  TRACE("(%d %p %d)\n", dwSessionMode, ppIInternetSession, dwReserved);
489 
490  if(dwSessionMode)
491  ERR("dwSessionMode=%d\n", dwSessionMode);
492  if(dwReserved)
493  ERR("dwReserved=%d\n", dwReserved);
494 
495  IInternetSession_AddRef(&InternetSession);
496  *ppIInternetSession = &InternetSession;
497  return S_OK;
498 }
499 
500 /**************************************************************************
501  * UrlMkGetSessionOption (URLMON.@)
502  */
504 {
505  DWORD size = sizeof(DWORD), res, type;
506  HKEY hkey;
507 
508  static const WCHAR wszUrlEncoding[] = {'U','r','l','E','n','c','o','d','i','n','g',0};
509 
511  if(res != ERROR_SUCCESS)
512  return FALSE;
513 
514  res = RegQueryValueExW(hkey, wszUrlEncoding, NULL, &type, (LPBYTE)encoding, &size);
515  RegCloseKey(hkey);
516 
517  return res == ERROR_SUCCESS;
518 }
519 
521 
522 static void ensure_useragent(void)
523 {
524  OSVERSIONINFOW info = {sizeof(info)};
525  const WCHAR *os_type, *is_nt;
526  WCHAR buf[512], *ret, *tmp;
527  DWORD res, idx=0;
528  size_t len, size;
529  BOOL is_wow;
530  HKEY key;
531 
532  static const WCHAR formatW[] =
533  {'M','o','z','i','l','l','a','/','4','.','0',
534  ' ','(','c','o','m','p','a','t','i','b','l','e',';',
535  ' ','M','S','I','E',' ','8','.','0',';',
536  ' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';',
537  ' ','%','s','T','r','i','d','e','n','t','/','5','.','0',0};
538  static const WCHAR post_platform_keyW[] =
539  {'S','O','F','T','W','A','R','E',
540  '\\','M','i','c','r','o','s','o','f','t',
541  '\\','W','i','n','d','o','w','s',
542  '\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
543  '\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',
544  '\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t',
545  '\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0};
546  static const WCHAR ntW[] = {'N','T',' ',0};
547  static const WCHAR win64W[] = {'W','i','n','6','4',';',' ','x','6','4',';',' ',0};
548  static const WCHAR wow64W[] = {'W','O','W','6','4',';',' ',0};
549  static const WCHAR emptyW[] = {0};
550 
551  if(user_agent)
552  return;
553 
555  is_nt = info.dwPlatformId == VER_PLATFORM_WIN32_NT ? ntW : emptyW;
556 
557  if(sizeof(void*) == 8)
558  os_type = win64W;
559  else if(IsWow64Process(GetCurrentProcess(), &is_wow) && is_wow)
560  os_type = wow64W;
561  else
562  os_type = emptyW;
563 
564  swprintf(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
565  len = lstrlenW(buf);
566 
567  size = len+40;
568  ret = heap_alloc(size * sizeof(WCHAR));
569  if(!ret)
570  return;
571 
572  memcpy(ret, buf, len*sizeof(WCHAR));
573 
574  res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key);
575  if(res == ERROR_SUCCESS) {
576  DWORD value_len;
577 
578  while(1) {
579  value_len = ARRAY_SIZE(buf);
580  res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
581  if(res != ERROR_SUCCESS)
582  break;
583  idx++;
584 
585  if(len + value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) {
586  tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR));
587  if(!tmp)
588  break;
589  ret = tmp;
590  size = size*2+value_len;
591  }
592 
593  ret[len++] = ';';
594  ret[len++] = ' ';
595  memcpy(ret+len, buf, value_len*sizeof(WCHAR));
596  len += value_len;
597  }
598 
599  RegCloseKey(key);
600  }
601 
602  ret[len++] = ')';
603  ret[len++] = 0;
604 
605  user_agent = ret;
606  TRACE("Using user agent %s\n", debugstr_w(user_agent));
607 }
608 
610 {
611  LPWSTR ret;
612 
614 
618 
619  return ret;
620 }
621 
623  DWORD* pdwBufferLength, DWORD dwReserved)
624 {
625  TRACE("(%x, %p, %d, %p)\n", dwOption, pBuffer, dwBufferLength, pdwBufferLength);
626 
627  if(dwReserved)
628  WARN("dwReserved = %d\n", dwReserved);
629 
630  switch(dwOption) {
631  case URLMON_OPTION_USERAGENT: {
633  DWORD size;
634 
635  if(!pdwBufferLength)
636  return E_INVALIDARG;
637 
639 
641  if(user_agent) {
643  *pdwBufferLength = size;
644  if(size <= dwBufferLength) {
645  if(pBuffer)
647  else
648  hres = E_INVALIDARG;
649  }
650  }
651 
653 
654  /* Tests prove that we have to return E_OUTOFMEMORY on success. */
655  return hres;
656  }
657  case URLMON_OPTION_URL_ENCODING: {
658  DWORD encoding = 0;
659 
660  if(!pBuffer || dwBufferLength < sizeof(DWORD) || !pdwBufferLength)
661  return E_INVALIDARG;
662 
665 
666  *pdwBufferLength = sizeof(DWORD);
667  *(DWORD*)pBuffer = encoding ? URL_ENCODING_DISABLE_UTF8 : URL_ENCODING_ENABLE_UTF8;
668  return S_OK;
669  }
670  default:
671  FIXME("unsupported option %x\n", dwOption);
672  }
673 
674  return E_INVALIDARG;
675 }
676 
677 /**************************************************************************
678  * UrlMkSetSessionOption (URLMON.@)
679  */
681  DWORD Reserved)
682 {
683  TRACE("(%x %p %x)\n", dwOption, pBuffer, dwBufferLength);
684 
685  switch(dwOption) {
686  case URLMON_OPTION_USERAGENT: {
687  LPWSTR new_user_agent;
688  char *buf = pBuffer;
689  DWORD len, size;
690 
691  if(!pBuffer || !dwBufferLength)
692  return E_INVALIDARG;
693 
694  for(len=0; len<dwBufferLength && buf[len]; len++);
695 
696  TRACE("Setting user agent %s\n", debugstr_an(buf, len));
697 
699  new_user_agent = heap_alloc((size+1)*sizeof(WCHAR));
700  if(!new_user_agent)
701  return E_OUTOFMEMORY;
702  MultiByteToWideChar(CP_ACP, 0, buf, len, new_user_agent, size);
703  new_user_agent[size] = 0;
704 
706 
708  user_agent = new_user_agent;
710 
712  break;
713  }
714  default:
715  FIXME("Unknown option %x\n", dwOption);
716  return E_INVALIDARG;
717  }
718 
719  return S_OK;
720 }
721 
722 /**************************************************************************
723  * ObtainUserAgentString (URLMON.@)
724  */
725 HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbSize)
726 {
727  DWORD size;
728  HRESULT hres = E_FAIL;
729 
730  TRACE("(%d %p %p)\n", dwOption, pcszUAOut, cbSize);
731 
732  if(!pcszUAOut || !cbSize)
733  return E_INVALIDARG;
734 
736 
738  if(user_agent) {
740 
741  if(size <= *cbSize) {
742  WideCharToMultiByte(CP_ACP, 0, user_agent, -1, pcszUAOut, *cbSize, NULL, NULL);
743  hres = S_OK;
744  }else {
746  }
747 
748  *cbSize = size;
749  }
750 
752  return hres;
753 }
754 
755 void free_session(void)
756 {
757  name_space *ns_iter, *ns_last;
758  mime_filter *mf_iter, *mf_last;
759 
761  if(!ns_iter->urlmon)
762  IClassFactory_Release(ns_iter->cf);
763  heap_free(ns_iter->protocol);
764  heap_free(ns_iter);
765  }
766 
768  IClassFactory_Release(mf_iter->cf);
769  heap_free(mf_iter->mime);
770  heap_free(mf_iter);
771  }
772 
774 }
static IClassFactory * cf
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, IInternetSession **ppIInternetSession, DWORD dwReserved)
Definition: session.c:485
#define REFIID
Definition: guiddef.h:118
#define CloseHandle
Definition: compat.h:406
#define E_NOINTERFACE
Definition: winerror.h:2364
IClassFactory * cf
Definition: session.c:28
void free_session(void)
Definition: session.c:755
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
interface IBindCtx * LPBC
Definition: objfwd.h:18
const WCHAR * mime
Definition: mimefilter.c:512
CLSID clsid
Definition: session.c:29
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HRESULT create_binding_protocol(BindProtocol **protocol)
Definition: bindprot.c:1442
HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD Reserved)
Definition: session.c:680
const char * uri
Definition: sec_mgr.c:1594
REFIID riid
Definition: precomp.h:44
LPWSTR get_useragent(void)
Definition: session.c:609
#define REFCLSID
Definition: guiddef.h:117
#define CP_ACP
Definition: compat.h:99
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
struct list entry
Definition: session.c:32
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
REFIID LPVOID * ppv
Definition: atlbase.h:39
IInternetProtocolInfo * get_protocol_info(LPCWSTR url)
Definition: session.c:181
IClassFactory * cf
Definition: session.c:36
DWORD scheme
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: internet.c:392
OLECHAR * BSTR
Definition: compat.h:1942
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
#define DWORD
Definition: nt_native.h:44
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BOOL urlmon_protocol)
Definition: session.c:122
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
struct _test_info info[]
Definition: SetCursorPos.c:19
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static ULONG WINAPI InternetSession_AddRef(IInternetSession *iface)
Definition: session.c:335
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static const WCHAR internet_settings_keyW[]
Definition: session.c:55
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned int idx
Definition: utils.c:41
static IInternetSession InternetSession
Definition: session.c:467
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
static name_space * find_name_space(LPCWSTR protocol)
Definition: session.c:62
PVOID pBuffer
BOOL urlmon
Definition: session.c:30
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
static HRESULT WINAPI InternetSession_UnregisterNameSpace(IInternetSession *iface, IClassFactory *pCF, LPCWSTR pszProtocol)
Definition: session.c:367
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:69
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1974
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
Definition: session.c:74
GLsizeiptr size
Definition: glext.h:5919
static struct list mime_filter_list
Definition: session.c:44
HRESULT hres
Definition: protocol.c:465
static HRESULT WINAPI InternetSession_CreateBinding(IInternetSession *iface, LPBC pBC, LPCWSTR szUrl, IUnknown *pUnkOuter, IUnknown **ppUnk, IInternetProtocol **ppOInetProt, DWORD dwOption)
Definition: session.c:427
void update_user_agent(WCHAR *user_agent)
Definition: protocol.c:307
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define LIST_INIT(head)
Definition: queue.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
const GUID IID_IUnknown
static LPWSTR user_agent
Definition: session.c:520
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
LPWSTR mime
Definition: session.c:38
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:6
static void ensure_useragent(void)
Definition: session.c:522
static HRESULT WINAPI InternetSession_QueryInterface(IInternetSession *iface, REFIID riid, void **ppv)
Definition: session.c:320
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR protocol
Definition: session.c:27
static CRITICAL_SECTION session_cs
Definition: session.c:46
int ret
static HRESULT WINAPI InternetSession_RegisterNameSpace(IInternetSession *iface, IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzProtocol, ULONG cPatterns, const LPCWSTR *ppwzPatterns, DWORD dwReserved)
Definition: session.c:349
REFCLSID clsid
Definition: msctf.c:82
Definition: mxnamespace.c:44
static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *iface, IClassFactory *pCF, LPCWSTR pwzType)
Definition: session.c:401
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, IClassFactory **ret)
Definition: session.c:220
HKEY key
Definition: reg.c:42
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
IInternetProtocol * get_mime_filter(LPCWSTR mime)
Definition: session.c:250
Definition: _list.h:228
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface, IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzType)
Definition: session.c:378
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855
#define wcsicmp
Definition: string.h:1152
CLSID clsid
Definition: session.c:37
ed encoding
Definition: write.c:2839
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define ERR(fmt,...)
Definition: debug.h:109
static struct list name_space_list
Definition: session.c:43
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define S_OK
Definition: intsafe.h:59
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static ULONG WINAPI InternetSession_Release(IInternetSession *iface)
Definition: session.c:342
static const WCHAR emptyW[]
Definition: navigate.c:40
static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
Definition: session.c:144
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_NOTIMPL
Definition: ddrawi.h:99
static const IInternetSessionVtbl InternetSessionVtbl
Definition: session.c:455
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
const WCHAR * schema
HRESULT WINAPI UrlMkGetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD *pdwBufferLength, DWORD dwReserved)
Definition: session.c:622
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
unsigned int ULONG
Definition: retypes.h:1
BOOL is_registered_protocol(LPCWSTR url)
Definition: session.c:168
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define MK_E_SYNTAX
Definition: winerror.h:2785
static BOOL get_url_encoding(HKEY root, DWORD *encoding)
Definition: session.c:503
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68
HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbSize)
Definition: session.c:725
const GUID IID_IClassFactory
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
static CRITICAL_SECTION_DEBUG session_cs_dbg
Definition: session.c:47
static HRESULT WINAPI InternetSession_SetSessionOption(IInternetSession *iface, DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD dwReserved)
Definition: session.c:448
struct list entry
Definition: session.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57
Definition: path.c:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22