rendered paste body#include <windows.h>
#include <iostream>
void WINAPI Main();
void Cls();
using namespace std;
HANDLE MainThread;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
MainThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Main, NULL, 0, 0);
}
return true;
}
void WINAPI Main()
{
int answer;
int newone;
AllocConsole();
FILE *fStdIn,*fStdOut,*fStdErr;
fStdIn = freopen("conin$", "r", stdin);
fStdOut = freopen("conout$", "w", stdout);
fStdErr = freopen("conout$", "w", stderr);
std::cout.sync_with_stdio();
std::cin.sync_with_stdio();
for (;;)
{
Cls();
cout << "1: Read\n2: Write\n3: Bulk Read\n\n";
cin >> answer;
cout << endl;
DWORD ADDRESS = 0x00400000;
int times;
int count = 0;
int active = 1;
int choice = 0;
Cls();
if (answer == 1)
{
cout << "Enter address to read from: ";
cin >> hex >> ADDRESS;
cout << "Enter how many bytes to read: ";
cin >> dec >> times;
if (times > 999)
{
times = 999;
}
cout << endl;
for (int i = 0; i < times; i++)
{
if ((i%16) == 0)
{
cout << endl << hex << ADDRESS+i << ": ";
}
if ((int)*(BYTE *)(ADDRESS+i) < 16)
{
cout << uppercase << "0" << hex << (int)*(BYTE *)(ADDRESS+i) << " ";
}
else
{
cout << uppercase << hex << (int)*(BYTE *)(ADDRESS+i) << " ";
}
}
cout << endl;
cin.clear();
cin.get();
cin.get();
}
if (answer == 2)
{
cout << "Enter address to write to: ";
cin >> hex >> ADDRESS;
cout << endl;
if ((int)*(BYTE *)(ADDRESS) < 16)
{
cout << "Current: " << uppercase << "0" << hex << (int)*(BYTE *)(ADDRESS) << "\n";
}
else
{
cout << "Current: " << uppercase << hex << (int)*(BYTE *)(ADDRESS) << "\n";
}
cout << "New: ";
cin >> hex >> newone;
*(BYTE *)(ADDRESS) = newone;
cout << "Byte edited to " << newone;
cout << endl;
cin.clear();
cin.get();
cin.get();
}
if (answer == 3)
{
choice = 0;
active = 1;
cout << "Enter address to start from: ";
cin >> hex >> ADDRESS;
Cls();
while (active == 1)
{
for (int i = 0; i < 352; i++)
{
if ((i%16) == 0)
{
cout << endl << uppercase << hex << ADDRESS+i << ": ";
}
if ((int)*(BYTE *)(ADDRESS+i) < 16)
{
cout << uppercase << "0" << hex << (int)*(BYTE *)(ADDRESS+i) << " ";
}
else
{
cout << uppercase << hex << (int)*(BYTE *)(ADDRESS+i) << " ";
}
}
cout << "\n\n1: Up; 2: Down; 3: Exit" << endl;
cin >> choice;
if (choice == 1)
{
Cls();
ADDRESS = ADDRESS - 352;
}
if (choice == 2)
{
Cls();
ADDRESS = ADDRESS + 352;
}
if (choice == 3)
{
active = 0;
}
}
cout << endl;
cin.clear();
cin.get();
}
}
}
void Cls()
{
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD integer;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &integer);
SetConsoleCursorPosition(hStdOut, coord);
}