51 0, 0, { (
DWORD_PTR)(__FILE__
": session") }
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};
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};
87 wszKey =
heap_alloc(
sizeof(wszProtocolsKey)+(schema_len+1)*
sizeof(
WCHAR));
88 memcpy(wszKey, wszProtocolsKey,
sizeof(wszProtocolsKey));
94 TRACE(
"Could not open protocol handler key\n");
98 size =
sizeof(str_clsid);
102 WARN(
"Could not get protocol CLSID res=%d\n",
res);
108 WARN(
"CLSIDFromString failed: %08x\n",
hres);
129 IClassFactory_AddRef(
cf);
130 new_name_space->
cf =
cf;
132 new_name_space->
urlmon = urlmon_protocol;
157 IClassFactory_Release(iter->
cf);
197 if(
ns && !
ns->urlmon) {
198 hres = IClassFactory_QueryInterface(
ns->cf, &IID_IInternetProtocolInfo, (
void**)&
ret);
200 hres = IClassFactory_CreateInstance(
ns->cf,
NULL, &IID_IInternetProtocolInfo, (
void**)&
ret);
212 hres = IClassFactory_QueryInterface(
cf, &IID_IInternetProtocolInfo, (
void**)&
ret);
214 IClassFactory_CreateInstance(
cf,
NULL, &IID_IInternetProtocolInfo, (
void**)&
ret);
215 IClassFactory_Release(
cf);
238 IClassFactory_AddRef(*
ret);
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};
277 hres = IClassFactory_CreateInstance(
cf,
NULL, &IID_IInternetProtocol, (
void**)&
ret);
279 WARN(
"CreateInstance failed: %08x\n",
hres);
288 TRACE(
"Could not open MIME filters key\n");
297 size =
sizeof(clsidw);
313 WARN(
"CoCreateInstance failed: %08x\n",
hres);
327 IInternetSession_AddRef(iface);
356 if(cPatterns || ppwzPatterns)
357 FIXME(
"patterns not supported\n");
361 if(!pCF || !pwzProtocol)
372 if(!pCF || !pszProtocol)
387 IClassFactory_AddRef(pCF);
416 IClassFactory_Release(iter->
cf);
434 TRACE(
"(%p %s %p %p %p %08x)\n", pBC,
debugstr_w(szUrl), pUnkOuter, ppUnk,
435 ppOInetProt, dwOption);
437 if(pBC || pUnkOuter || ppUnk || dwOption)
438 FIXME(
"Unsupported arguments\n");
491 ERR(
"dwSessionMode=%d\n", dwSessionMode);
508 static const WCHAR wszUrlEncoding[] = {
'U',
'r',
'l',
'E',
'n',
'c',
'o',
'd',
'i',
'n',
'g',0};
525 const WCHAR *os_type, *is_nt;
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};
557 if(
sizeof(
void*) == 8)
585 if(
len + value_len + 2 + 1 >=
size) {
625 TRACE(
"(%x, %p, %d, %p)\n", dwOption,
pBuffer, dwBufferLength, pdwBufferLength);
631 case URLMON_OPTION_USERAGENT: {
643 *pdwBufferLength =
size;
644 if(
size <= dwBufferLength) {
657 case URLMON_OPTION_URL_ENCODING: {
660 if(!
pBuffer || dwBufferLength <
sizeof(
DWORD) || !pdwBufferLength)
666 *pdwBufferLength =
sizeof(
DWORD);
671 FIXME(
"unsupported option %x\n", dwOption);
683 TRACE(
"(%x %p %x)\n", dwOption,
pBuffer, dwBufferLength);
686 case URLMON_OPTION_USERAGENT: {
691 if(!
pBuffer || !dwBufferLength)
703 new_user_agent[
size] = 0;
715 FIXME(
"Unknown option %x\n", dwOption);
730 TRACE(
"(%d %p %p)\n", dwOption, pcszUAOut, cbSize);
732 if(!pcszUAOut || !cbSize)
741 if(
size <= *cbSize) {
762 IClassFactory_Release(ns_iter->
cf);
768 IClassFactory_Release(mf_iter->
cf);
#define VER_PLATFORM_WIN32_NT
HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, IInternetSession **ppIInternetSession, DWORD dwReserved)
#define WideCharToMultiByte
interface IBindCtx * LPBC
GLenum GLuint GLenum GLsizei const GLchar * buf
HRESULT create_binding_protocol(BindProtocol **protocol)
HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD Reserved)
LPWSTR get_useragent(void)
#define HKEY_CURRENT_USER
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
IInternetProtocolInfo * get_protocol_info(LPCWSTR url)
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
GLuint GLuint GLsizei GLenum type
HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
static void * heap_realloc(void *mem, size_t len)
HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BOOL urlmon_protocol)
static void * heap_alloc(size_t len)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
static ULONG WINAPI InternetSession_AddRef(IInternetSession *iface)
LONG WINAPI RegCloseKey(HKEY hKey)
static const WCHAR internet_settings_keyW[]
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
static WCHAR * heap_strdupW(const WCHAR *str)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
static IInternetSession InternetSession
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)
static name_space * find_name_space(LPCWSTR protocol)
_Reserved_ PVOID Reserved
static HRESULT WINAPI InternetSession_UnregisterNameSpace(IInternetSession *iface, IClassFactory *pCF, LPCWSTR pszProtocol)
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
static void URLMON_UnlockModule(void)
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, IClassFactory **ret)
static struct list mime_filter_list
static HRESULT WINAPI InternetSession_CreateBinding(IInternetSession *iface, LPBC pBC, LPCWSTR szUrl, IUnknown *pUnkOuter, IUnknown **ppUnk, IInternetProtocol **ppOInetProt, DWORD dwOption)
void update_user_agent(WCHAR *user_agent)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
HANDLE WINAPI GetCurrentProcess(VOID)
#define swprintf(buf, format,...)
static void ensure_useragent(void)
static HRESULT WINAPI InternetSession_QueryInterface(IInternetSession *iface, REFIID riid, void **ppv)
static CRITICAL_SECTION session_cs
static HRESULT WINAPI InternetSession_RegisterNameSpace(IInternetSession *iface, IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzProtocol, ULONG cPatterns, const LPCWSTR *ppwzPatterns, DWORD dwReserved)
static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *iface, IClassFactory *pCF, LPCWSTR pwzType)
static __inline const char * debugstr_an(const char *s, int n)
HRESULT get_protocol_handler(IUri *uri, CLSID *clsid, IClassFactory **ret)
#define memcpy(s1, s2, n)
IInternetProtocol * get_mime_filter(LPCWSTR mime)
UINT WINAPI SysStringLen(BSTR str)
static HRESULT WINAPI InternetSession_RegisterMimeFilter(IInternetSession *iface, IClassFactory *pCF, REFCLSID rclsid, LPCWSTR pwzType)
LIST_ENTRY ProcessLocksList
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
static struct list name_space_list
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
static ULONG WINAPI InternetSession_Release(IInternetSession *iface)
static const WCHAR emptyW[]
static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
static const IInternetSessionVtbl InternetSessionVtbl
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
HRESULT WINAPI UrlMkGetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD *pdwBufferLength, DWORD dwReserved)
#define MultiByteToWideChar
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
BOOL is_registered_protocol(LPCWSTR url)
#define HKEY_CLASSES_ROOT
static BOOL get_url_encoding(HKEY root, DWORD *encoding)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static void URLMON_LockModule(void)
HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbSize)
const GUID IID_IClassFactory
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
static CRITICAL_SECTION_DEBUG session_cs_dbg
static HRESULT WINAPI InternetSession_SetSessionOption(IInternetSession *iface, DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength, DWORD dwReserved)
static BOOL heap_free(void *mem)
#define HKEY_LOCAL_MACHINE