fix(hostname): fix handling of non-ASCII hostnames on Windows (#3382)

This commit is contained in:
Cameron Gutman
2024-11-09 14:05:46 -06:00
committed by GitHub
parent d552073eaf
commit fb1f5b5a89
8 changed files with 51 additions and 5 deletions

View File

@ -1846,6 +1846,16 @@ namespace platf {
return output;
}
std::string
get_host_name() {
WCHAR hostname[256];
if (GetHostNameW(hostname, ARRAYSIZE(hostname)) == SOCKET_ERROR) {
BOOST_LOG(error) << "GetHostNameW() failed: "sv << WSAGetLastError();
return "Sunshine"s;
}
return to_utf8(hostname);
}
class win32_high_precision_timer: public high_precision_timer {
public:
win32_high_precision_timer() {