windows: use native error code types more

- curlx_get_winapi_error: accept DWORD (was: int), move casts one level
  up the callstack.

- sspi: bump some types to `SECURITY_STATUS` (int -> LONG).

- digest_sspi: drop unnecessary cast.

Closes #18868
This commit is contained in:
Viktor Szakats 2025-10-06 02:33:49 +02:00
parent e7a5184fa1
commit e9ababe9aa
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
8 changed files with 30 additions and 34 deletions

View file

@ -546,7 +546,7 @@ curl_url_strerror(CURLUcode error)
* Curl_sspi_strerror:
* Variant of curlx_strerror if the error code is definitely Windows SSPI.
*/
const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen)
{
#ifdef _WIN32
DWORD old_win_err = GetLastError();
@ -656,17 +656,17 @@ const char *Curl_sspi_strerror(int err, char *buf, size_t buflen)
if(err == SEC_E_ILLEGAL_MESSAGE) {
curl_msnprintf(buf, buflen,
"SEC_E_ILLEGAL_MESSAGE (0x%08X) - This error usually "
"SEC_E_ILLEGAL_MESSAGE (0x%08lX) - This error usually "
"occurs when a fatal SSL/TLS alert is received (e.g. "
"handshake failed). More detail may be available in "
"the Windows System event log.", err);
}
else {
char msgbuf[256];
if(curlx_get_winapi_error(err, msgbuf, sizeof(msgbuf)))
curl_msnprintf(buf, buflen, "%s (0x%08X) - %s", txt, err, msgbuf);
if(curlx_get_winapi_error((DWORD)err, msgbuf, sizeof(msgbuf)))
curl_msnprintf(buf, buflen, "%s (0x%08lX) - %s", txt, err, msgbuf);
else
curl_msnprintf(buf, buflen, "%s (0x%08X)", txt, err);
curl_msnprintf(buf, buflen, "%s (0x%08lX)", txt, err);
}
#else