wininet: Move remeining InternetQueryOption implementation to vtbl.
This commit is contained in:
parent
46f2628448
commit
9f5748e6b4
|
@ -2066,88 +2066,60 @@ DWORD INET_QueryOption(DWORD option, void *buffer, DWORD *size, BOOL unicode)
|
||||||
|
|
||||||
return APPINFO_QueryOption(&ai.hdr, INTERNET_OPTION_PROXY, buffer, size, unicode); /* FIXME */
|
return APPINFO_QueryOption(&ai.hdr, INTERNET_OPTION_PROXY, buffer, size, unicode); /* FIXME */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FIXME("Stub for %d\n", option);
|
|
||||||
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* INET_QueryOptionHelper (internal)
|
|
||||||
*/
|
|
||||||
static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD dwOption,
|
|
||||||
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
|
||||||
{
|
|
||||||
LPWININETHANDLEHEADER lpwhh;
|
|
||||||
BOOL bSuccess = FALSE;
|
|
||||||
|
|
||||||
TRACE("(%p, 0x%08x, %p, %p)\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
|
||||||
|
|
||||||
lpwhh = WININET_GetObject( hInternet );
|
|
||||||
|
|
||||||
switch (dwOption)
|
|
||||||
{
|
|
||||||
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
case INTERNET_OPTION_MAX_CONNS_PER_SERVER:
|
||||||
{
|
TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
|
||||||
ULONG conn = 2;
|
|
||||||
TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER: %d\n", conn);
|
if (*size < sizeof(ULONG))
|
||||||
if (*lpdwBufferLength < sizeof(ULONG))
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
else
|
*(ULONG*)buffer = 2;
|
||||||
{
|
*size = sizeof(ULONG);
|
||||||
memcpy(lpBuffer, &conn, sizeof(ULONG));
|
|
||||||
bSuccess = TRUE;
|
return ERROR_SUCCESS;
|
||||||
}
|
|
||||||
*lpdwBufferLength = sizeof(ULONG);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER:
|
||||||
{
|
TRACE("INTERNET_OPTION_MAX_CONNS_1_0_SERVER\n");
|
||||||
ULONG conn = 4;
|
|
||||||
TRACE("INTERNET_OPTION_MAX_CONNS_1_0_SERVER: %d\n", conn);
|
if (*size < sizeof(ULONG))
|
||||||
if (*lpdwBufferLength < sizeof(ULONG))
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
else
|
*(ULONG*)size = 4;
|
||||||
{
|
*size = sizeof(ULONG);
|
||||||
memcpy(lpBuffer, &conn, sizeof(ULONG));
|
|
||||||
bSuccess = TRUE;
|
return ERROR_SUCCESS;
|
||||||
}
|
|
||||||
*lpdwBufferLength = sizeof(ULONG);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case INTERNET_OPTION_SECURITY_FLAGS:
|
case INTERNET_OPTION_SECURITY_FLAGS:
|
||||||
FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
|
FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
|
||||||
bSuccess = TRUE;
|
return ERROR_SUCCESS;
|
||||||
break;
|
|
||||||
|
|
||||||
case INTERNET_OPTION_VERSION:
|
case INTERNET_OPTION_VERSION: {
|
||||||
{
|
|
||||||
TRACE("INTERNET_OPTION_VERSION\n");
|
|
||||||
if (*lpdwBufferLength < sizeof(INTERNET_VERSION_INFO))
|
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
static const INTERNET_VERSION_INFO info = { 1, 2 };
|
static const INTERNET_VERSION_INFO info = { 1, 2 };
|
||||||
memcpy(lpBuffer, &info, sizeof(info));
|
|
||||||
*lpdwBufferLength = sizeof(info);
|
TRACE("INTERNET_OPTION_VERSION\n");
|
||||||
bSuccess = TRUE;
|
|
||||||
|
if (*size < sizeof(INTERNET_VERSION_INFO))
|
||||||
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
|
||||||
|
memcpy(buffer, &info, sizeof(info));
|
||||||
|
*size = sizeof(info);
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
case INTERNET_OPTION_PER_CONNECTION_OPTION: {
|
||||||
case INTERNET_OPTION_PER_CONNECTION_OPTION:
|
INTERNET_PER_CONN_OPTION_LISTW *con = buffer;
|
||||||
|
DWORD res = ERROR_SUCCESS, i;
|
||||||
|
|
||||||
FIXME("INTERNET_OPTION_PER_CONNECTION_OPTION stub\n");
|
FIXME("INTERNET_OPTION_PER_CONNECTION_OPTION stub\n");
|
||||||
if (*lpdwBufferLength < sizeof(INTERNET_PER_CONN_OPTION_LISTW))
|
|
||||||
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
if (*size < sizeof(INTERNET_PER_CONN_OPTION_LISTW))
|
||||||
else
|
return ERROR_INSUFFICIENT_BUFFER;
|
||||||
{
|
|
||||||
INTERNET_PER_CONN_OPTION_LISTW *con = lpBuffer;
|
for (i = 0; i < con->dwOptionCount; i++) {
|
||||||
int x;
|
INTERNET_PER_CONN_OPTIONW *option = con->pOptions + i;
|
||||||
bSuccess = TRUE;
|
|
||||||
for (x = 0; x < con->dwOptionCount; ++x)
|
switch (option->dwOption) {
|
||||||
{
|
|
||||||
INTERNET_PER_CONN_OPTIONW *option = con->pOptions + x;
|
|
||||||
switch (option->dwOption)
|
|
||||||
{
|
|
||||||
case INTERNET_PER_CONN_FLAGS:
|
case INTERNET_PER_CONN_FLAGS:
|
||||||
option->Value.dwValue = PROXY_TYPE_DIRECT;
|
option->Value.dwValue = PROXY_TYPE_DIRECT;
|
||||||
break;
|
break;
|
||||||
|
@ -2162,41 +2134,22 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
||||||
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL:
|
||||||
FIXME("Unhandled dwOption %d\n", option->dwOption);
|
FIXME("Unhandled dwOption %d\n", option->dwOption);
|
||||||
option->Value.dwValue = 0;
|
option->Value.dwValue = 0;
|
||||||
bSuccess = FALSE;
|
res = ERROR_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("Unknown dwOption %d\n", option->dwOption);
|
FIXME("Unknown dwOption %d\n", option->dwOption);
|
||||||
bSuccess = FALSE;
|
res = ERROR_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bSuccess)
|
|
||||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 66:
|
|
||||||
FIXME("66\n");
|
|
||||||
bSuccess = TRUE;
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
DWORD res;
|
|
||||||
|
|
||||||
if(lpwhh)
|
return res;
|
||||||
res = lpwhh->vtbl->QueryOption(lpwhh, dwOption, lpBuffer, lpdwBufferLength, bIsUnicode);
|
|
||||||
else
|
|
||||||
res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, bIsUnicode);
|
|
||||||
|
|
||||||
if(res == ERROR_SUCCESS)
|
|
||||||
bSuccess = TRUE;
|
|
||||||
else
|
|
||||||
SetLastError(res);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lpwhh)
|
|
||||||
WININET_Release( lpwhh );
|
|
||||||
|
|
||||||
return bSuccess;
|
FIXME("Stub for %d\n", option);
|
||||||
|
return ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2212,7 +2165,24 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
|
||||||
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
|
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||||
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
||||||
{
|
{
|
||||||
return INET_QueryOptionHelper(TRUE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
LPWININETHANDLEHEADER hdr;
|
||||||
|
DWORD res = ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
||||||
|
|
||||||
|
if(hInternet) {
|
||||||
|
hdr = WININET_GetObject(hInternet);
|
||||||
|
if (hdr) {
|
||||||
|
res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
||||||
|
WININET_Release(hdr);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res != ERROR_SUCCESS)
|
||||||
|
SetLastError(res);
|
||||||
|
return res == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2228,7 +2198,24 @@ BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption,
|
||||||
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
|
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption,
|
||||||
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
LPVOID lpBuffer, LPDWORD lpdwBufferLength)
|
||||||
{
|
{
|
||||||
return INET_QueryOptionHelper(FALSE, hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
LPWININETHANDLEHEADER hdr;
|
||||||
|
DWORD res = ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
|
||||||
|
|
||||||
|
if(hInternet) {
|
||||||
|
hdr = WININET_GetObject(hInternet);
|
||||||
|
if (hdr) {
|
||||||
|
res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
||||||
|
WININET_Release(hdr);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
res = INET_QueryOption(dwOption, lpBuffer, lpdwBufferLength, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res != ERROR_SUCCESS)
|
||||||
|
SetLastError(res);
|
||||||
|
return res == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue