fix(spy): fix WxString memory map

This commit is contained in:
Changhua 2025-02-19 00:58:24 +08:00
parent b9240a84d8
commit d368e26318

View File

@ -7,40 +7,51 @@ typedef uint64_t QWORD;
class WxString class WxString
{ {
public: public:
const wchar_t *wptr; const wchar_t *wptr;
DWORD size; DWORD size;
DWORD capacity; DWORD length;
const char *ptr; const char *ptr;
DWORD clen; DWORD clen;
WxString() WxString() : wptr(nullptr), size(0), length(0), ptr(nullptr), clen(0) { }
{
wptr = nullptr;
size = 0;
capacity = 0;
ptr = nullptr;
clen = 0;
}
WxString(std::wstring ws) : internal_ws(std::move(ws)) explicit WxString(const std::wstring &ws)
: wptr(ws.c_str()), size(static_cast<DWORD>(ws.size())), length(static_cast<DWORD>(ws.length())), ptr(nullptr),
clen(0)
{ {
wptr = internal_ws.c_str();
size = static_cast<DWORD>(internal_ws.size());
capacity = static_cast<DWORD>(internal_ws.capacity());
ptr = nullptr;
clen = 0;
} }
WxString(const WxString &) = delete; WxString(const WxString &) = delete;
WxString &operator=(const WxString &) = delete; WxString &operator=(const WxString &) = delete;
WxString(WxString &&) noexcept = default; WxString(WxString &&other) noexcept
WxString &operator=(WxString &&) noexcept = default; : wptr(other.wptr), size(other.size), length(other.length), ptr(other.ptr), clen(other.clen)
{
other.wptr = nullptr;
other.size = 0;
other.length = 0;
other.ptr = nullptr;
other.clen = 0;
}
private: WxString &operator=(WxString &&other) noexcept
std::wstring internal_ws; {
if (this != &other) {
wptr = other.wptr;
size = other.size;
length = other.length;
ptr = other.ptr;
clen = other.clen;
other.wptr = nullptr;
other.size = 0;
other.length = 0;
other.ptr = nullptr;
other.clen = 0;
}
return *this;
}
}; };
typedef struct RawVector { typedef struct RawVector {