wininet: Option INTERNET_OPTION_CALLBACK is not settable.

This commit is contained in:
Hans Leidekker 2008-10-06 15:48:04 +02:00 committed by Alexandre Julliard
parent b981387383
commit 096fa3b9f5
2 changed files with 27 additions and 8 deletions

View File

@ -2259,9 +2259,14 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption,
{
case INTERNET_OPTION_CALLBACK:
{
INTERNET_STATUS_CALLBACK callback = *(INTERNET_STATUS_CALLBACK *)lpBuffer;
ret = (set_status_callback(lpwhh, callback, TRUE) != INTERNET_INVALID_STATUS_CALLBACK);
break;
if (!lpwhh)
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
WININET_Release(lpwhh);
INTERNET_SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
return FALSE;
}
case INTERNET_OPTION_HTTP_VERSION:
{
@ -2384,12 +2389,15 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption,
case INTERNET_OPTION_CALLBACK:
{
LPWININETHANDLEHEADER lpwh;
INTERNET_STATUS_CALLBACK callback = *(INTERNET_STATUS_CALLBACK *)lpBuffer;
if (!(lpwh = WININET_GetObject(hInternet))) return FALSE;
r = (set_status_callback(lpwh, callback, FALSE) != INTERNET_INVALID_STATUS_CALLBACK);
if (!(lpwh = WININET_GetObject(hInternet)))
{
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
return FALSE;
}
WININET_Release(lpwh);
return r;
INTERNET_SetLastError(ERROR_INTERNET_OPTION_NOT_SETTABLE);
return FALSE;
}
case INTERNET_OPTION_PROXY:
{

View File

@ -1984,7 +1984,7 @@ static void test_open_url_async(void)
{
BOOL ret;
HINTERNET ses, req;
DWORD size;
DWORD size, error;
struct context ctx;
ULONG type;
@ -1994,6 +1994,17 @@ static void test_open_url_async(void)
ses = InternetOpen("AdvancedInstaller", 0, NULL, NULL, INTERNET_FLAG_ASYNC);
ok(ses != NULL, "InternetOpen failed\n");
SetLastError(0xdeadbeef);
ret = InternetSetOptionA(NULL, INTERNET_OPTION_CALLBACK, &cb, sizeof(DWORD_PTR));
error = GetLastError();
ok(!ret, "InternetSetOptionA succeeded\n");
ok(error == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "got %u expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE\n", error);
ret = InternetSetOptionA(ses, INTERNET_OPTION_CALLBACK, &cb, sizeof(DWORD_PTR));
error = GetLastError();
ok(!ret, "InternetSetOptionA failed\n");
ok(error == ERROR_INTERNET_OPTION_NOT_SETTABLE, "got %u expected ERROR_INTERNET_OPTION_NOT_SETTABLE\n", error);
pInternetSetStatusCallbackA(ses, cb);
ResetEvent(ctx.event);