@@ -233,6 +233,18 @@ static std::string to_lower_ascii(std::string v)
233233 return v;
234234}
235235
236+ static std::string wide_to_utf8 (const wchar_t * w)
237+ {
238+ if (!w)
239+ return {};
240+ int needed = WideCharToMultiByte (CP_UTF8, 0 , w, -1 , nullptr , 0 , nullptr , nullptr );
241+ if (needed <= 0 )
242+ return {};
243+ std::string out (static_cast <size_t >(needed - 1 ), ' \0 ' );
244+ WideCharToMultiByte (CP_UTF8, 0 , w, -1 , out.data (), needed, nullptr , nullptr );
245+ return out;
246+ }
247+
236248static bool list_contains_any (const std::string& hay, const std::vector<std::string>& needles)
237249{
238250 for (const auto & n : needles) {
@@ -260,7 +272,7 @@ static bool suspicious_processes_present()
260272 return false ;
261273 }
262274 do {
263- std::string name = to_lower_ascii (pe.szExeFile );
275+ std::string name = to_lower_ascii (wide_to_utf8 ( pe.szExeFile ) );
264276 if (list_contains_any (name, bad)) {
265277 CloseHandle (snap);
266278 return true ;
@@ -2388,17 +2400,6 @@ static bool is_https_url(const std::string& url)
23882400 return true ;
23892401}
23902402
2391- static bool proxy_env_set ()
2392- {
2393- const char * keys[] = { " HTTP_PROXY" , " HTTPS_PROXY" , " ALL_PROXY" , " http_proxy" , " https_proxy" , " all_proxy" };
2394- for (const char * k : keys) {
2395- const char * v = std::getenv (k);
2396- if (v && *v)
2397- return true ;
2398- }
2399- return false ;
2400- }
2401-
24022403static bool winhttp_proxy_set ()
24032404{
24042405 WINHTTP_PROXY_INFO info{};
0 commit comments