urlmon: Added UrlMkGetSessionOption implementation.
This commit is contained in:
parent
919871523a
commit
ec26cd2704
|
@ -323,3 +323,58 @@ HRESULT WINAPI CoInternetGetSession(DWORD dwSessionMode, IInternetSession **ppII
|
|||
*ppIInternetSession = &InternetSession;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* UrlMkGetSessionOption (URLMON.@)
|
||||
*/
|
||||
static BOOL get_url_encoding(HKEY root, DWORD *encoding)
|
||||
{
|
||||
DWORD size = sizeof(DWORD), res, type;
|
||||
HKEY hkey;
|
||||
|
||||
static const WCHAR wszKeyName[] =
|
||||
{'S','O','F','T','W','A','R','E',
|
||||
'\\','M','i','c','r','o','s','o','f','t',
|
||||
'\\','W','i','n','d','o','w','s',
|
||||
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
|
||||
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0};
|
||||
static const WCHAR wszUrlEncoding[] = {'U','r','l','E','n','c','o','d','i','n','g',0};
|
||||
|
||||
res = RegOpenKeyW(root, wszKeyName, &hkey);
|
||||
if(res != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
res = RegQueryValueExW(hkey, wszUrlEncoding, NULL, &type, (LPBYTE)encoding, &size);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
HRESULT WINAPI UrlMkGetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength,
|
||||
DWORD* pdwBufferLength, DWORD dwReserved)
|
||||
{
|
||||
TRACE("(%lx, %p, %ld, %p)\n", dwOption, pBuffer, dwBufferLength, pdwBufferLength);
|
||||
|
||||
if(dwReserved)
|
||||
WARN("dwReserved = %ld\n", dwReserved);
|
||||
|
||||
switch(dwOption) {
|
||||
case URLMON_OPTION_URL_ENCODING: {
|
||||
DWORD encoding = 0;
|
||||
|
||||
if(!pBuffer || dwBufferLength < sizeof(DWORD) || !pdwBufferLength)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(!get_url_encoding(HKEY_CURRENT_USER, &encoding))
|
||||
get_url_encoding(HKEY_LOCAL_MACHINE, &encoding);
|
||||
|
||||
*pdwBufferLength = sizeof(DWORD);
|
||||
*(DWORD*)pBuffer = encoding ? URL_ENCODING_DISABLE_UTF8 : URL_ENCODING_ENABLE_UTF8;
|
||||
return S_OK;
|
||||
}
|
||||
default:
|
||||
FIXME("unsupported option %lx\n", dwOption);
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
|
|
@ -953,6 +953,46 @@ static void test_ReleaseBindInfo(void)
|
|||
ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
|
||||
}
|
||||
|
||||
static void test_UrlMkGetSessionOption(void)
|
||||
{
|
||||
DWORD encoding, size;
|
||||
HRESULT hres;
|
||||
|
||||
size = encoding = 0xdeadbeef;
|
||||
hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
|
||||
sizeof(encoding), &size, 0);
|
||||
ok(hres == S_OK, "UrlMkGetSessionOption failed: %08lx\n", hres);
|
||||
ok(encoding != 0xdeadbeef, "encoding not changed\n");
|
||||
ok(size == sizeof(encoding), "size=%ld\n", size);
|
||||
|
||||
size = encoding = 0xdeadbeef;
|
||||
hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
|
||||
sizeof(encoding)+1, &size, 0);
|
||||
ok(hres == S_OK, "UrlMkGetSessionOption failed: %08lx\n", hres);
|
||||
ok(encoding != 0xdeadbeef, "encoding not changed\n");
|
||||
ok(size == sizeof(encoding), "size=%ld\n", size);
|
||||
|
||||
size = encoding = 0xdeadbeef;
|
||||
hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
|
||||
sizeof(encoding)-1, &size, 0);
|
||||
ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
|
||||
ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
|
||||
ok(size == 0xdeadbeef, "size=%ld\n", size);
|
||||
|
||||
size = encoding = 0xdeadbeef;
|
||||
hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, NULL,
|
||||
sizeof(encoding)-1, &size, 0);
|
||||
ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
|
||||
ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
|
||||
ok(size == 0xdeadbeef, "size=%ld\n", size);
|
||||
|
||||
encoding = 0xdeadbeef;
|
||||
hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
|
||||
sizeof(encoding)-1, NULL, 0);
|
||||
ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
|
||||
ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
|
||||
}
|
||||
|
||||
START_TEST(misc)
|
||||
{
|
||||
OleInitialize(NULL);
|
||||
|
@ -967,6 +1007,7 @@ START_TEST(misc)
|
|||
test_ZoneManager();
|
||||
test_NameSpace();
|
||||
test_ReleaseBindInfo();
|
||||
test_UrlMkGetSessionOption();
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
|
|
@ -283,17 +283,6 @@ HRESULT WINAPI UrlMkSetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBuf
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* UrlMkGetSessionOption (URLMON.@)
|
||||
*/
|
||||
HRESULT WINAPI UrlMkGetSessionOption(DWORD dwOption, LPVOID pBuffer, DWORD dwBufferLength,
|
||||
DWORD* pdwBufferLength, DWORD dwReserved)
|
||||
{
|
||||
FIXME("(%#lx, %p, %#lx, %p): stub\n", dwOption, pBuffer, dwBufferLength, pdwBufferLength);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const CHAR Agent[] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
|
||||
|
||||
/**************************************************************************
|
||||
|
|
Loading…
Reference in New Issue