Been trying to figure this out all day. Help!

errors:
Invalid conversation from 'DWORD' to 'DWORD*'
initializing argument 3 of 'DWORD FindDmaAddy(int, HANDLE, DWORD*, DWORD)'

I've been trying to figure these two errors out for a couple hours now. I was following a tutorial on how to do this and then afterwards I was going to study all of it to learn everything, so I don't really know much about this. If I remove the "if(HealthStatus)" statement the second error goes away. It doesn't make sense at all to me because the if(AmmoStatus) is almost the same and works fine. I compared my code to the code of the person who made this and it was exactly the same, so I really don't understand what's wrong.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include <iostream>
#include <windows.h>
#include <string>
#include <ctime>


void WriteToMemory(HANDLE hProcHandle);
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD offsets[], DWORD BaseAddress);



std::string Gamename = "AssaultCube";
LPCSTR LGameWindow = "AssaultCube";
std::string GameStatus;
bool GameAvail;
bool UpdateOnNextRun;

//Ammo vars
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3,0x1C,0x0,0x0};
DWORD AmmoBaseAddress = {0x00508B74};
DWORD AmmoOffsets[] = {0x384,0x14,0x0};

//Health Vars
bool HealthStatus;
BYTE HealthValue[] = {0x39,0x5,0x0,0x0};
DWORD HealthBaseAddress = {0x0050E4F4};
DWORD HealthOffsets = {0xF8};

int main()
{
HWND hGameWindow = NULL;
int timesincelastupdate = clock();
int GameAvailTMR = clock();
int OnePressTMR = clock();
DWORD dwprocID = NULL;
HANDLE hProcHandle = NULL;
UpdateOnNextRun = true;
std::string sAmmoStatus = "OFF";
std::string sHealthStatus = "OFF";

while(!GetAsyncKeyState(VK_INSERT))
{
    if(clock() - GameAvailTMR > 100)
    {
        GameAvailTMR = clock();
        GameAvail = false;

        hGameWindow = FindWindow(NULL, LGameWindow);
        if(hGameWindow)
        {
            GetWindowThreadProcessId(hGameWindow, &dwprocID);
            if(dwprocID != 0)
            {
                hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwprocID);
                if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                {
                    GameStatus = "Failed to open process for valid handle!";
                }
                else
                {
                    GameStatus = "Ready to hack!";
                    GameAvail = true;
                };
            }
            else
            {
                GameStatus = "Failed to get process ID";
            };

        }
    else
    {
        GameStatus = "Assault Cube not found!";
    };
    if(UpdateOnNextRun || clock() - timesincelastupdate > 5000)
    {
        system("cls");
            std::cout << "------------------------------------------------" << std::endl;
            std::cout << "           Assault Cube Memory Hacker           " << std::endl;
            std::cout << "------------------------------------------------" << std::endl << std::endl;
            std::cout << "Game Status: " << GameStatus << std::endl << std::endl;
            std::cout << "[F1] Unlimited Ammo " << sAmmoStatus << " <" << std::endl;
            std::cout << "[F2] Unlimited Health " << sHealthStatus << " <" << std::endl;
            std::cout << "[Insert] Exit" << std::endl;
            UpdateOnNextRun = false;
            timesincelastupdate = clock();
    }
    if(GameAvail)
    {
        WriteToMemory(hProcHandle);
    }


    }
    if (clock() - OnePressTMR > 400)
    {
        if(GameAvail)
        {
            if(GetAsyncKeyState(VK_F1))
            {
                OnePressTMR = clock();
                AmmoStatus = !AmmoStatus;
                UpdateOnNextRun = true;
                if(AmmoStatus)sAmmoStatus = "ON";
                else sAmmoStatus = "OFF";
            }
            if(GetAsyncKeyState(VK_F2))
            {
                OnePressTMR = clock();
                HealthStatus = !HealthStatus;
                UpdateOnNextRun = true;
                if(AmmoStatus)sHealthStatus = "ON";
                else sHealthStatus = "OFF";
            }
        }
    }

    CloseHandle(hProcHandle);
    CloseHandle(hGameWindow);

}


return ERROR_SUCCESS;


}

DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
	DWORD pointer = BaseAddress;
	DWORD ptemp;
	DWORD pointerAddr;
	for(int i = 0; i < PointerLevel; i ++)
	{
			if(i == 0)
			{
				ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &ptemp, 4, NULL);
			}
			pointerAddr = ptemp + Offsets[i];
			ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &ptemp, 4, NULL);
	}
	return pointerAddr;
}




void WriteToMemory(HANDLE hProcHandle)
{
   if(AmmoStatus)
   {
	   DWORD AmmoAddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffsets, AmmoBaseAddress);
	   WriteProcessMemory( hProcHandle, (BYTE*)AmmoAddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
   }

   if(HealthStatus)
   {
	   DWORD HealthAddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
	   WriteProcessMemory( hProcHandle, (BYTE*)HealthAddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
   }
}
You may want to take things a bit slower if you're not sure what's happening. It looks like you're trying to do some game development, which may not be the most technical form of programming in the world, but it still requires a good amount of knowledge to do properly.

That said, compare lines 22 and 28. What do you see that's different?

-Albatross
Last edited on
if(AmmoStatus) is almost the same and works fine.
Almost the same - so look at what is different:

AmmoOffsets is an array.

HealthOffsets is a single value, not an array.

try DWORD HealthOffsets[] = {0xF8};
Well that's embarrassing, it was something that small. Thanks for the help, I really appreciate it.
Topic archived. No new replies allowed.