MCPcopy Create free account
hub / github.com/Artikash/Textractor / ParseRCode

Function ParseRCode

host/hookcode.cpp:6–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4namespace
5{
6 std::optional<HookParam> ParseRCode(std::wstring RCode)
7 {
8 std::wsmatch match;
9 HookParam hp = {};
10 hp.type |= DIRECT_READ;
11
12 // {S|Q|V|M}
13 switch (RCode[0])
14 {
15 case L'S':
16 break;
17 case L'Q':
18 hp.type |= USING_UNICODE;
19 break;
20 case L'V':
21 hp.type |= USING_UTF8;
22 break;
23 case L'M':
24 hp.type |= USING_UNICODE | HEX_DUMP;
25 break;
26 default:
27 return {};
28 }
29 RCode.erase(0, 1);
30
31 // [null_length<]
32 if (std::regex_search(RCode, match, std::wregex(L"^([0-9]+)<")))
33 {
34 hp.null_length = std::stoi(match[1]);
35 RCode.erase(0, match[0].length());
36 }
37
38 // [codepage#]
39 if (std::regex_search(RCode, match, std::wregex(L"^([0-9]+)#")))
40 {
41 hp.codepage = std::stoi(match[1]);
42 RCode.erase(0, match[0].length());
43 }
44
45 // @addr
46 if (!std::regex_match(RCode, match, std::wregex(L"@([[:xdigit:]]+)"))) return {};
47 hp.address = std::stoull(match[1], nullptr, 16);
48 return hp;
49 }
50
51 std::optional<HookParam> ParseHCode(std::wstring HCode)
52 {

Callers 1

ParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected