MCPcopy Create free account
hub / github.com/ReversecLabs/C3 / WidestringToString

Function WidestringToString

Src/Common/FSecure/WinTools/HostInfo.cpp:12–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 namespace
11 {
12 std::string WidestringToString(std::wstring const& wstr)
13 {
14 if (wstr.empty())
15 return {};
16
17 int size = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, &wstr[0], static_cast<int>(wstr.size()), NULL, 0, NULL, NULL);
18 std::string ret(size, 0);
19 WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, &wstr[0], static_cast<int>(wstr.size()), &ret[0], size, NULL, NULL);
20 return ret;
21 }
22
23 bool IsElevated() noexcept
24 {

Callers 1

GatherMethod · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected