1
votes

I have searched on this site for an answer and the top answer did not work for me, I keep getting this error. I recently (not sure if I did it successfully) imported my project, that has no errors, from my desktop to my new laptop. Whenever I try to run, I get this error in multiple files, using only one as an example :

error C2664: 'DWORD CHackProcess::GetModuleNamePointer(LPSTR,DWORD)': cannot convert argument 1 from 'const char [11]' to 'LPSTR'

This is on these lines:

while (__dwordClient == 0x0) __dwordClient = GetModuleNamePointer("client.dll", __gameProcess.th32ProcessID);

while (__dwordEngine == 0x0) __dwordEngine = GetModuleNamePointer("engine.dll"6, __gameProcess.th32ProcessID);

while (__dwordVGui == 0x0) __dwordVGui = GetModuleNamePointer("vguimatsurface.dll", __gameProcess.th32ProcessID);
1
Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. - halfer

1 Answers

2
votes

MSDN states the following definition for LPSTR:

typedef char* PSTR, *LPSTR;

This means that it is a non const expression. The string you're passing is constant.

You just have to pass a non constant string as the first argument.

EDIT:

It could be translated to the following:

char engineModuleName[] = "engine.dll";
GetModuleNamePointer(engineModuleName, __gameProcess.th32ProcessID);