| 424 | } |
| 425 | |
| 426 | long ProcessMemory::WriteString(HWND hwnd, const wstring &address, long type, const wstring &value) { |
| 427 | vector<uchar> bin; |
| 428 | // type follows the historical DM convention: 0=ACP/GBK, 1=UTF-16, 2=UTF-8. |
| 429 | switch (type) { |
| 430 | case 1: |
| 431 | bin = encodeUnicodeBytes(value); |
| 432 | break; |
| 433 | case 2: |
| 434 | bin = wideToBytes(value, CP_UTF8, true); |
| 435 | break; |
| 436 | case 0: |
| 437 | default: |
| 438 | bin = wideToBytes(value, CP_ACP, true); |
| 439 | break; |
| 440 | } |
| 441 | if (bin.empty()) |
| 442 | return 0; |
| 443 | return WriteRaw(hwnd, address, bin.data(), bin.size()) ? 1 : 0; |
| 444 | } |
| 445 | |
| 446 | bool ProcessMemory::prepare_process(HWND hwnd) { |
| 447 | _hwnd = hwnd; |
nothing calls this directly
no test coverage detected