wininet: Add handling for remaining special errors to InternetErrorDlg.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2021-09-10 16:01:12 +02:00 committed by Alexandre Julliard
parent 5e012f7bec
commit 03236a391a
2 changed files with 51 additions and 37 deletions

View File

@ -514,11 +514,17 @@ DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest,
} }
break; break;
} }
case ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED:
if(!req)
return ERROR_INVALID_PARAMETER;
/* fall through */
case ERROR_INTERNET_SEC_CERT_ERRORS: case ERROR_INTERNET_SEC_CERT_ERRORS:
case ERROR_INTERNET_SEC_CERT_CN_INVALID: case ERROR_INTERNET_SEC_CERT_CN_INVALID:
case ERROR_INTERNET_SEC_CERT_DATE_INVALID: case ERROR_INTERNET_SEC_CERT_DATE_INVALID:
case ERROR_INTERNET_INVALID_CA: case ERROR_INTERNET_INVALID_CA:
case ERROR_INTERNET_SEC_CERT_REV_FAILED: case ERROR_INTERNET_SEC_CERT_REV_FAILED:
case ERROR_INTERNET_SEC_CERT_WEAK_SIGNATURE:
if( dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI ) { if( dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI ) {
res = ERROR_CANCELLED; res = ERROR_CANCELLED;
break; break;
@ -530,13 +536,51 @@ DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest,
res = DialogBoxParamW( WININET_hModule, MAKEINTRESOURCEW( IDD_INVCERTDLG ), res = DialogBoxParamW( WININET_hModule, MAKEINTRESOURCEW( IDD_INVCERTDLG ),
hWnd, WININET_InvalidCertificateDialog, (LPARAM) &params ); hWnd, WININET_InvalidCertificateDialog, (LPARAM) &params );
break; break;
case ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION:
if(dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI) {
res = ERROR_HTTP_COOKIE_DECLINED;
break;
}
FIXME("Need to display dialog for error %d\n", dwError);
res = ERROR_CANCELLED;
break;
case ERROR_INTERNET_INSERT_CDROM:
if(!req)
return ERROR_INVALID_PARAMETER;
/* fall through */
case ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION:
case ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT:
case ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT:
case ERROR_INTERNET_MIXED_SECURITY:
case ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR:
if(!(dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI))
FIXME("Need to display dialog for error %d\n", dwError);
res = ERROR_CANCELLED;
break;
case ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR:
case ERROR_INTERNET_CHG_POST_IS_NON_SECURE:
if(dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI) {
res = ERROR_SUCCESS;
break;
}
FIXME("Need to display dialog for error %d\n", dwError);
res = ERROR_CANCELLED;
break;
case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR:
case ERROR_INTERNET_POST_IS_NON_SECURE: case ERROR_INTERNET_POST_IS_NON_SECURE:
FIXME("Need to display dialog for error %d\n", dwError); if (!(dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI))
FIXME("Need to display dialog for error %d\n", dwError);
res = ERROR_SUCCESS; res = ERROR_SUCCESS;
break; break;
default: default:
res = ERROR_CANCELLED; if(!(dwFlags & FLAGS_ERROR_UI_FILTER_FOR_ERRORS))
res = ERROR_CANCELLED;
break;
} }
if(req) if(req)

View File

@ -1566,29 +1566,14 @@ static void test_InternetErrorDlg(void)
break; break;
} }
todo_wine_if(i == ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION || ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
i == ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR ||
i == ERROR_INTERNET_CHG_POST_IS_NON_SECURE)
ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
/* Same thing with NULL hwnd */ /* Same thing with NULL hwnd */
res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine_if(i == ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION || ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
i == ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR ||
i == ERROR_INTERNET_CHG_POST_IS_NON_SECURE)
ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine_if(i != ERROR_INTERNET_INCORRECT_PASSWORD && i != ERROR_INTERNET_SEC_CERT_DATE_INVALID && ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
i != ERROR_INTERNET_SEC_CERT_CN_INVALID && i != ERROR_INTERNET_INVALID_CA &&
i != ERROR_INTERNET_SEC_CERT_ERRORS && i != ERROR_INTERNET_SEC_CERT_REV_FAILED &&
i != ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR && i != ERROR_INTERNET_POST_IS_NON_SECURE &&
i != ERROR_INTERNET_MIXED_SECURITY &&
i != ERROR_INTERNET_POST_IS_NON_SECURE && i != ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED &&
i != ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR && i != ERROR_INTERNET_INSERT_CDROM &&
i != ERROR_INTERNET_SEC_CERT_WEAK_SIGNATURE && i != ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT &&
i != ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT && i != ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION)
ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
/* With a null req */ /* With a null req */
if(test_flags & FLAG_NEEDREQ) if(test_flags & FLAG_NEEDREQ)
@ -1598,31 +1583,16 @@ static void test_InternetErrorDlg(void)
} }
res = InternetErrorDlg(hwnd, NULL, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(hwnd, NULL, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine_if(i == ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION || ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
i == ERROR_INTERNET_INSERT_CDROM ||
i == ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED ||
i == ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR ||
i == ERROR_INTERNET_CHG_POST_IS_NON_SECURE)
ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
res = InternetErrorDlg(NULL, NULL, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(NULL, NULL, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine_if(i != ERROR_INTERNET_SEC_CERT_DATE_INVALID && i != ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR && ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
i != ERROR_INTERNET_SEC_CERT_CN_INVALID && i != ERROR_INTERNET_INVALID_CA &&
i != ERROR_INTERNET_SEC_CERT_ERRORS && i != ERROR_INTERNET_SEC_CERT_REV_FAILED &&
i != ERROR_INTERNET_MIXED_SECURITY && i != ERROR_INTERNET_POST_IS_NON_SECURE &&
i != ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR && i != ERROR_INTERNET_INCORRECT_PASSWORD &&
i != ERROR_INTERNET_SEC_CERT_WEAK_SIGNATURE && i != ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT &&
i != ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT &&
i != ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION)
ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
} }
res = InternetErrorDlg(NULL, req, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(NULL, req, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine
ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res); ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res);
res = InternetErrorDlg(NULL, NULL, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL); res = InternetErrorDlg(NULL, NULL, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
todo_wine
ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res); ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res);
res = InternetCloseHandle(req); res = InternetCloseHandle(req);