Impl NewWxStringFromStr and NewWxStringFromWstr
This commit is contained in:
parent
4554f2376a
commit
bd0387882d
@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
#pragma comment(lib, "shlwapi")
|
||||
@ -296,3 +297,23 @@ void DbgMsg(const char *zcFormat, ...)
|
||||
|
||||
OutputDebugStringA(strText.c_str());
|
||||
}
|
||||
|
||||
WxString *NewWxStringFromStr(const string &str) { return NewWxStringFromWstr(String2Wstring(str)); }
|
||||
|
||||
WxString *NewWxStringFromWstr(const wstring &ws)
|
||||
{
|
||||
WxString *p = (WxString *)HeapAlloc(GetProcessHeap(), 0, sizeof(WxString));
|
||||
wchar_t *pWstring = (wchar_t *)HeapAlloc(GetProcessHeap(), 0, (ws.size() + 1) * 2);
|
||||
if (p == NULL || pWstring == NULL) {
|
||||
LOG_ERROR("Out of Memory...");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wmemcpy(pWstring, ws.c_str(), ws.size() + 1);
|
||||
p->wptr = pWstring;
|
||||
p->size = (DWORD)ws.size();
|
||||
p->capacity = (DWORD)ws.size();
|
||||
p->ptr = 0;
|
||||
p->clen = 0;
|
||||
return p;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "spy_types.h"
|
||||
|
||||
#define WECHAREXE L"WeChat.exe"
|
||||
#define WECHATWINDLL L"WeChatWin.dll"
|
||||
#define WCFSDKDLL L"sdk.dll"
|
||||
@ -34,3 +36,5 @@ std::string GetStringByAddress(UINT64 address);
|
||||
std::string GetStringByStrAddr(UINT64 addr);
|
||||
std::string GetStringByWstrAddr(UINT64 addr);
|
||||
void DbgMsg(const char *zcFormat, ...);
|
||||
WxString *NewWxStringFromStr(const std::string &str);
|
||||
WxString *NewWxStringFromWstr(const std::wstring &ws);
|
||||
|
Loading…
Reference in New Issue
Block a user