Range modify ESRO code chaning?

06/13/2011 18:30 smedheaddk#1
having toruble with creating a dll... the guy posted the source which is below for his dll that goes with his loader:

esroLoaderdll.cpp:
Code:
#include "windows.h"

void WriteMemory(DWORD address, LPVOID patch, DWORD size)
{
	DWORD oldProtect;
	VirtualProtect((LPVOID)address, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
	memcpy((LPVOID)address, patch, size);
}

DWORD WINAPI PatchRangeThread(LPVOID lpParam) //need to wait for sro window or we get protection error
{
	while(1)
	{
		HWND hWnd = FindWindowA("CLIENT", 0);
		DWORD pid = 0;
		GetWindowThreadProcessId(hWnd, &pid);
		if(pid == GetCurrentProcessId())
			break;

		Sleep(10);
	}

	float range = 5000;
	WriteMemory(0xD10678, &range, sizeof(float));

	return 0;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	if(ul_reason_for_call == DLL_PROCESS_ATTACH)
	{
		CreateMutexA(0, 0, "Silkroad Online Launcher");
		CreateMutexA(0, 0, "Ready");

		CreateThread(0, 0, &PatchRangeThread, 0, 0, 0);
	}
	return true;
}
i put this in c++ and when i tried to compile it i got the foloowing error:

Code:
1>------ Build started: Project: test, Configuration: Release Win32 ------
1>  test.cpp
1>test.cpp(40): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Im a nooby to all this i just copy and pasted the code in c++, and starterd a new win 32 console appliaction and selcted dll, than pasted this. press build and results above :P

can anyone tell me where im going wrong?

heres a link to the origonal thread, my purpose is to simply change the line:

[Only registered and activated users can see links. Click Here To Register...]

Code:
	float range = 5000;
too

Code:
	float range = 2000;
06/13/2011 19:08 * White *#2
Code:
#include "windows.h"
[U][COLOR="Red"]#include "StdAfx.h"[/COLOR][/U]  [COLOR="#ff0000"]// Try to add this( i dont know too about this but just try :D )[/COLOR]

void WriteMemory(DWORD address, LPVOID patch, DWORD size)
{
	DWORD oldProtect;
	VirtualProtect((LPVOID)address, 4, PAGE_EXECUTE_READWRITE, &oldProtect);
	memcpy((LPVOID)address, patch, size);
}

DWORD WINAPI PatchRangeThread(LPVOID lpParam) //need to wait for sro window or we get protection error
{
	while(1)
	{
		HWND hWnd = FindWindowA("CLIENT", 0);
		DWORD pid = 0;
		GetWindowThreadProcessId(hWnd, &pid);
		if(pid == GetCurrentProcessId())
			break;

		Sleep(10);
	}

	float range = 5000;
	WriteMemory(0xD10678, &range, sizeof(float));

	return 0;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	if(ul_reason_for_call == DLL_PROCESS_ATTACH)
	{
		CreateMutexA(0, 0, "Silkroad Online Launcher");
		CreateMutexA(0, 0, "Ready");

		CreateThread(0, 0, &PatchRangeThread, 0, 0, 0);
	}
	return true;
}
06/13/2011 19:33 bootdisk#3
or just don't use precompiled headers...
they're useful on large scale project but for hacks, emus it looks pointless...
06/14/2011 10:09 chea77er#4
Quote:
Originally Posted by bootdisk View Post
or just don't use precompiled headers...
they're useful on large scale project but for hacks, emus it looks pointless...
emus are large projects.

BTT: You can disable precompiled headers. in Visual-Studio
(Project Properties -> C/C++ -> Precompiled Header -> .. )