■ ■ ■ ■ ■ ■
SearchAvailableExe/Tools.cpp
| skipped 159 lines |
160 | 160 | | int fileDirLength = fileDir.length(); |
161 | 161 | | DWORD vaule, vaule1; |
162 | 162 | | char* str; |
| 163 | + | int strLength; |
163 | 164 | | char ch; |
| 165 | + | int index = 0; |
164 | 166 | | |
165 | | - | for (size_t i = rdataLength - 4; i > 0; --i) { |
| 167 | + | for (int i = rdataLength - 8; i > 0; --i, index = 0) { |
166 | 168 | | vaule = *(PDWORD)((PBYTE)rdata + i); |
| 169 | + | vaule1 = *(PDWORD)((PBYTE)rdata + i + 4); |
167 | 170 | | |
168 | | - | if (vaule == 0x6c6c642e) { |
169 | | - | ch = rdata[--i]; |
| 171 | + | if (vaule == 0x6c6c642e) |
| 172 | + | index = 1; |
| 173 | + | else if (vaule1 == 0x6c && vaule == 0x6c0064) |
| 174 | + | index = 2; |
| 175 | + | |
| 176 | + | if (index > 0) { |
| 177 | + | i -= index; |
| 178 | + | ch = rdata[i]; |
170 | 179 | | while (((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_' || ch == '.' || ch == '-')) { |
171 | | - | ch = rdata[--i]; |
| 180 | + | i -= index; |
| 181 | + | ch = rdata[i]; |
172 | 182 | | } |
173 | 183 | | |
174 | 184 | | if (ch != 0) |
175 | 185 | | continue; |
176 | 186 | | |
177 | | - | str = (char*)(rdata + i + 1); |
178 | | - | memcpy(fileFullPath + fileDirLength, str, strlen(str) + 1); |
| 187 | + | if (index == 1) |
| 188 | + | str = (char*)(rdata + i + 1); |
| 189 | + | else |
| 190 | + | str = ConvertWideToMultiByte((wchar_t*)(rdata + i + 2)); |
179 | 191 | | |
180 | | - | if (filesystem::exists(filesystem::path(fileFullPath)) && containsIgnoreCase(dllsName, str) == NULL) |
181 | | - | result->postLoadDlls.push_back(_strdup(str)); |
182 | | - | } |
183 | | - | } |
184 | | - | |
185 | | - | for (size_t i = rdataLength - 8; i > 0; i -= 2) { |
186 | | - | vaule = *(PDWORD)((PBYTE)rdata + i); |
187 | | - | vaule1 = *(PDWORD)((PBYTE)rdata + i + 4); |
188 | | - | |
189 | | - | if (vaule1 == 0x6c && vaule == 0x6c0064) { |
190 | | - | i -= 2; |
191 | | - | ch = rdata[i]; |
192 | | - | while (((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_' || ch == '.' || ch == '-')) { |
193 | | - | i -= 2; |
194 | | - | ch = rdata[i]; |
195 | | - | } |
196 | | - | |
197 | | - | if (ch != 0) |
| 192 | + | strLength = strlen(str); |
| 193 | + | if (strLength > 35); |
198 | 194 | | continue; |
199 | 195 | | |
200 | | - | str = ConvertWideToMultiByte((wchar_t*)(rdata + i + 2)); |
201 | | - | memcpy(fileFullPath + fileDirLength, str, strlen(str)+1); |
| 196 | + | memcpy(fileFullPath + fileDirLength, str, strLength + 1); |
202 | 197 | | |
203 | 198 | | if (filesystem::exists(filesystem::path(fileFullPath)) && containsIgnoreCase(dllsName, str) == NULL) |
204 | 199 | | result->postLoadDlls.push_back(_strdup(str)); |
| skipped 202 lines |