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

Function ParseHCode

host/hookcode.cpp:51–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 }
50
51 std::optional<HookParam> ParseHCode(std::wstring HCode)
52 {
53 std::wsmatch match;
54 HookParam hp = {};
55
56 // {A|B|W|H|S|Q|V|M}
57 switch (HCode[0])
58 {
59 case L'A':
60 hp.type |= BIG_ENDIAN;
61 hp.length_offset = 1;
62 break;
63 case L'B':
64 hp.length_offset = 1;
65 break;
66 case L'W':
67 hp.type |= USING_UNICODE;
68 hp.length_offset = 1;
69 break;
70 case L'H':
71 hp.type |= USING_UNICODE | HEX_DUMP;
72 hp.length_offset = 1;
73 break;
74 case L'S':
75 hp.type |= USING_STRING;
76 break;
77 case L'Q':
78 hp.type |= USING_STRING | USING_UNICODE;
79 break;
80 case L'V':
81 hp.type |= USING_STRING | USING_UTF8;
82 break;
83 case L'M':
84 hp.type |= USING_STRING | USING_UNICODE | HEX_DUMP;
85 break;
86 default:
87 return {};
88 }
89 HCode.erase(0, 1);
90
91 if (hp.type & USING_STRING)
92 {
93 if (HCode[0] == L'F')
94 {
95 hp.type |= FULL_STRING;
96 HCode.erase(0, 1);
97 }
98
99 // [null_length<]
100 if (std::regex_search(HCode, match, std::wregex(L"^([0-9]+)<")))
101 {
102 hp.null_length = std::stoi(match[1]);
103 HCode.erase(0, match[0].length());
104 }
105 }
106
107 // [N]
108 if (HCode[0] == L'N')

Callers 1

ParseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected