[Coding] getting client.dll Adress error(const char* not compatible with TCHAR*

Hello,

I’m trying to make my own csgo cheat but I always get this error: “argument of type “const char *” is incompatible with parameter of type “TCHAR*”
I tried instead of using TCHAR to use const wchar_t but then If I tell the Programm to show me the value of the health it shows me 1 wich is wrong. The Offsets are right that’s not the Problem

Is there a way to convert const char* to TCHAR* ? I googled but there were many ways but I couldn’t understand them. I tried changed the compiler code thing from UNICODE to Multibyte and even not set. I don’t know the exact names of them because my Visual Studio is in German

Here are the Codes:
GetModuleBaseAddress:

Code:

uintptr_t GetModuleBaseAddress(DWORD dwProcID, TCHAR *szModuleName) {

	uintptr_t ModuleBaseAddress = 0;
	HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwProcID);
	if (hSnapshot != INVALID_HANDLE_VALUE)
	{
		MODULEENTRY32 ModuleEntry32;
		ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
		if (Module32First(hSnapshot, &ModuleEntry32))
		{
			do
			{
				if (_tcsicmp(ModuleEntry32.szModule, szModuleName) == 0)
				{
					ModuleBaseAddress = (uintptr_t)ModuleEntry32.modBaseAddr;
					break;
				}
			} while (Module32Next(hSnapshot, &ModuleEntry32));
		}
		CloseHandle(hSnapshot);
	}
	return ModuleBaseAddress;
}

int main:

Code:

HWND hwnd = FindWindowA(0, ("Counter-Strike: Global Offensive"));
	GetWindowThreadProcessId(hwnd, &dwProcID);
	HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
	uintptr_t client = 0;
	client = GetModuleBaseAddress(dwProcID, _T("client.dll"));
	ReadProcessMemory(pHandle, (LPVOID)(client + 0x936173F4 + 0x00AA00FC + 0xFC), &Health, sizeof(Health), 0);

Leave a Reply

Your email address will not be published. Required fields are marked *