Skip to content

Commit f63d687

Browse files
committed
update ChsIME.exe support
1 parent 0202366 commit f63d687

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

main.cpp

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <set>
44
#include <vector>
5+
#include <map>
56
#include <string>
67
#include <iostream>
78
#include <string>
@@ -89,6 +90,14 @@ static bool my_WriteProcessMemory(HANDLE h, uint64_t address, const uint8_t* byt
8990

9091
static std::wstring s_target_process_name = L"ChsIME.exe";
9192

93+
///< key = md5, value = address
94+
static std::map<std::string, uint64_t> s_support_files = {
95+
{"b3448bf077665f2e1ca67094bcf2a7c5", 0x14DE1},
96+
{"de5fa392a825332ab3e348ef0316b514", 0x16A61},
97+
};
98+
///< current file md5
99+
static std::string s_file_md5;
100+
92101
class win10_wubi_patch
93102
{
94103
public:
@@ -155,7 +164,13 @@ class win10_wubi_patch
155164
uint8_t patch_bytes[] = {
156165
0x31, 0xC0
157166
};
158-
bOK = patch(0x14DE1, patch_bytes, sizeof(patch_bytes));
167+
168+
///< check again
169+
if (s_support_files.find(s_file_md5) == s_support_files.end()) {
170+
break;
171+
}
172+
uint64_t address = s_support_files[s_file_md5];
173+
bOK = patch(address, patch_bytes, sizeof(patch_bytes));
159174
} while (0);
160175

161176
if (hopen) {
@@ -178,16 +193,17 @@ bool check_support_version()
178193
bool bSupport = false;
179194
do
180195
{
181-
std::string file_md5 = md5file(chs_ime_path.c_str());
182-
if (file_md5.empty()) {
196+
s_file_md5 = md5file(chs_ime_path.c_str());
197+
if (s_file_md5.empty()) {
183198
break;
184199
}
185200

186-
file_md5 = lower_case(file_md5);
187-
if (file_md5 == "b3448bf077665f2e1ca67094bcf2a7c5") {
188-
bSupport = true;
201+
s_file_md5 = lower_case(s_file_md5);
202+
if (s_support_files.find(s_file_md5) == s_support_files.end()) {
203+
break;
189204
}
190205

206+
bSupport = true;
191207
} while (0);
192208
return bSupport;
193209
}
@@ -199,7 +215,8 @@ int main()
199215
printf("\n");
200216

201217
if (!check_support_version()) {
202-
printf("file(ChsIME.exe) not support.\n");
218+
printf("file(ChsIME.exe) not support, need send ChsIME.exe to author.\n");
219+
getchar();
203220
return -1;
204221
}
205222

0 commit comments

Comments
 (0)