I'm currently coding a class file to read an integer from another process from its base address. The target is CheatEngine's tutorial step 8 (multilevel pointers) cause it was on hand and works very nicely for this project.

The base address is 0x0045cc20 and the following offsets are 0x18,0x0,0x14,0x0c as found by cheat engine.

The ExternalInt body code:
ExternalInt::ExternalInt(DWORD pid, DWORD BaseAddress, int pointercount, DWORD Offsets[]) {
    this->pid = pid;
    this->BaseAddress = BaseAddress;
    this->PointerCount = pointercount;
    this->Offsets = Offsets;

ExternalInt::ExternalInt(const ExternalInt& orig) {

ExternalInt::~ExternalInt() {
int ExternalInt::getValue(){
    int returnvalue;

    HANDLE hprocess = OpenProcess(PROCESS_ALL_ACCESS,0,this->pid);
    DWORD address = BaseAddress;
    DWORD nextAddress = 0;

    for(int i=0;i<this->PointerCount;i++){
        std::cout << "address: " << address << "\n";
        std::cout << "offset: " << Offsets[i] << "\n";

        DWORD result = address + Offsets[i];
        std::cout << "result: " << result << "\n";

            address = nextAddress;
            std::cout <<"error: "<< GetLastError() << "\n";
Called from the main function:
int main(int argc, char** argv) {
    HWND CheatEngine;
    HANDLE CheatEngineProc;
    DWORD pid;

    DWORD offsets[] = {0x18,0x0,0x14,0x0c};
    if((CheatEngine = FindWindow(0,"Step 8"))){ //if the window is found//

        CheatEngineProc = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
        std::cout <<CheatEngineProc <<"\n";
        //If the Process didn't open
            std::cout << "unable to open process!";
        else {
            std::cout << "found! \n";
            ExternalInt *a = new ExternalInt(pid,0x0045cc20,4,offsets);
            int value = a->getValue();
            std::cout << value << "\n";
            delete a;

    return (EXIT_SUCCESS);
The code compiles fine, however when getValue() is called, strange results insue:
0x3724 //Handle when printed to cout (was used for debugging)
found! //Debug message
address: 4574240 //addr1 0x45cc20: base address
offset: 24 // 0x18: offset[0]
result: 4574264 // correct address with offset
address:4294967295 // huge number retrieved from ReadProcessMemory obviously will go out of bounds
offset: 0 //offset #2 is right 0x0
error 998 //Unable to read memory... obviously
My Question is why am i getting the strange results.. the size of a pointer is 4 bytes correct? so sizeof (DWORD) should be right? (i'm assuming i'm wrong but idk otherwise)
can someone point me in the right direction?