MCPcopy Create free account
hub / github.com/WallBreaker2/op / bytesToWide

Function bytesToWide

libop/memory/ProcessMemory.cpp:18–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18wstring bytesToWide(const vector<uchar> &bin, UINT cp) {
19 if (bin.empty())
20 return L"";
21 const int len =
22 ::MultiByteToWideChar(cp, 0, reinterpret_cast<LPCCH>(bin.data()), static_cast<int>(bin.size()), nullptr, 0);
23 if (len <= 0)
24 return L"";
25 wstring out(len, L'\0');
26 ::MultiByteToWideChar(cp, 0, reinterpret_cast<LPCCH>(bin.data()), static_cast<int>(bin.size()), &out[0], len);
27 return out;
28}
29
30vector<uchar> wideToBytes(const wstring &text, UINT cp, bool nullTerminated) {
31 const int len = ::WideCharToMultiByte(cp, 0, text.c_str(), -1, nullptr, 0, nullptr, nullptr);

Callers 1

ReadStringMethod · 0.85

Calls 3

emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected