MCPcopy Create free account
hub / github.com/Apache553/SubtitleFontHelper / AnsiStringToWideString

Function AnsiStringToWideString

FontLoadInterceptor/RpcClient.cpp:144–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 }
143
144 std::wstring AnsiStringToWideString(const char* str)
145 {
146 std::wstring ret;
147 const int length = MultiByteToWideChar(
148 CP_ACP,
149 MB_ERR_INVALID_CHARS,
150 str,
151 -1,
152 nullptr,
153 0);
154 if (length <= 0)
155 throw std::runtime_error("MultiByteToWideChar failed");
156 ret.resize(length);
157 MultiByteToWideChar(
158 CP_ACP,
159 MB_ERR_INVALID_CHARS,
160 str,
161 -1,
162 ret.data(),
163 length);
164 while (!ret.empty() && ret.back() == 0)
165 ret.pop_back();
166 return ret;
167 }
168
169 std::string WideToUtf8String(const std::wstring& wStr)
170 {

Callers 2

QueryAndLoadFunction · 0.85
InjectProcessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected