Successfully compiled. At first I had issues since I'm not used to C++ at all, but after reading some posts, I figured it out.
Compiler:
Microsoft Windows Studio Express 2012 for Windows Desktop
Download:
[Only registered and activated users can see links. Click Here To Register...]
DLL Creation Process:
- New Project
- Win32 Console Application
- Name your project --> Hit OK
- Click Next
- Change Application Type: to DLL
- Check the box, Empty Project under Additional Options --> Hit Finish
- Look on the right side of the screen for Source Files
- Right click on Source Files and click Add --> New Item
- In the Add New Item - your application name window, select C++ File(.cpp). Give it a name, and hit Add
- Click on the new .cpp file you just added under Source Files.
- To the left of your screen is where you have to put the Code.
- Copy and paste the Code Below, and change stdafx.h to windows.h
- Hit File at the top left of your screen, and hit Save All
- Click BUILD --> Build Solution
- DLL creation complete.
Original Code:
Code:
#include "stdafx.h"
#define ADDR_GM 0x1075C48
#define ADDR_AOE 0x10C62FC
#define ADDR_RANGE 0x10C62F8
void Start();
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
{
if (ulReason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Start, 0, 0, 0);
}
return TRUE;
}
void Start()
{
while (1)
{
if (GetKeyState(VK_F11) < 0) // Turn On
{
*(DWORD*)ADDR_GM = 2;
*(DWORD*)ADDR_AOE = 100;
*(DWORD*)ADDR_RANGE = 7;
}
if (GetKeyState(VK_F12) < 0) // Turn Off
{
*(DWORD*)ADDR_GM = 0;
*(DWORD*)ADDR_AOE = 0;
*(DWORD*)ADDR_RANGE = 0;
}
Sleep(1);
}
}
Altered Code to make it compile:
Code:
#include "windows.h"
#define ADDR_GM 0x1075C48
#define ADDR_AOE 0x10C62FC
#define ADDR_RANGE 0x10C62F8
void Start();
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReason, LPVOID lpReserved)
{
if (ulReason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Start, 0, 0, 0);
}
return TRUE;
}
void Start()
{
while (1)
{
if (GetKeyState(VK_F11) < 0) // Turn On
{
*(DWORD*)ADDR_GM = 2;
*(DWORD*)ADDR_AOE = 100;
*(DWORD*)ADDR_RANGE = 7;
}
if (GetKeyState(VK_F12) < 0) // Turn Off
{
*(DWORD*)ADDR_GM = 0;
*(DWORD*)ADDR_AOE = 0;
*(DWORD*)ADDR_RANGE = 0;
}
Sleep(1);
}
}