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
{
public:
const wchar_t *wptr;
DWORD size;
DWORD capacity;
DWORD length;
const char *ptr;
DWORD clen;
WxString()
{
wptr = nullptr;
size = 0;
capacity = 0;
ptr = nullptr;
clen = 0;
}
WxString() : wptr(nullptr), size(0), length(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 &operator=(const WxString &) = delete;
WxString(WxString &&) noexcept = default;
WxString &operator=(WxString &&) noexcept = default;
WxString(WxString &&other) noexcept
: 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:
std::wstring internal_ws;
WxString &operator=(WxString &&other) noexcept
{
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 {