I'm learning C++ and was messing around with Win32 api, particularly ReadProcessMemory.
So I'm trying to read text from notepad, I've found the address using Cheat Engine. The text is in Windows UTF16
Here's the code I use to read the text:
#include "pch.h"
#include <string>
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
LPCVOID Addr = (LPCVOID) 0x1711B91E610;
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, false, 9948);
u16string data[29];
if (!handle) {
exit(0);
}
ReadProcessMemory(handle, Addr, &data, 29, 0);
cout << data << endl;
cin.get();
}
I was expecting to get this Hello world!zzzzzeeeeeezzzees
however, I got this: 00000053A7EFF260
What am I doing wrong? Thank you
edit: tried wcout, also not working
And everytime I run the program, I get a different hex value, what?