#include <Windows.h>
#include <stdio.h>
#define TRANSPARENCY_COLOR RGB(0, 254, 0)
#define MAX_PATH 256
using namespace std;
char* concat(char* s1, char* s2) {
size_t len1 = strlen(s1);
size_t len2 = strlen(s2);
char* result = (char*)malloc(len1 + len2 + 1);
memcpy(result, s1, len1);
memcpy(result + len1, s2, len2 + 1);
return result;
}
void removeBn(char* str) {
size_t ln = strlen(str) - 1;
if (*str && str[ln] == '\n')
str[ln] = '\0';
}
int main() {
char* targetAppToHijack = new char[MAX_PATH];
printf("Enter Target App To Hijack Example-\"notepad.exe\"\n");
fgets(targetAppToHijack, MAX_PATH, stdin);
char* command = concat((char*)"cmd, /c start /min ", targetAppToHijack);
unsigned char targetWindowState = 0;
system(command);
char* targetWindowToHijack = new char[MAX_PATH];
printf("Enter Target Window To Hijack Example-\"Untitled - Notepad\"\n");
fgets(targetWindowToHijack, MAX_PATH, stdin);
removeBn(targetWindowToHijack);
HWND hwnd;
findTargetHwnd:
hwnd = FindWindowA(NULL, targetWindowToHijack);
if (!hwnd) {
Sleep(500);
goto findTargetHwnd;
}
SetMenu(hwnd, NULL);
SetWindowLongPtr(hwnd, GWL_STYLE, WS_VISIBLE);
SetWindowLongPtr(hwnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW);
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_HIDEWINDOW);
SetLayeredWindowAttributes(hwnd, TRANSPARENCY_COLOR, 0, LWA_COLORKEY);
DEVMODE devMode;
devMode.dmSize = sizeof(devMode);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
BITMAPINFO backBufferBmpInfo;
backBufferBmpInfo = { 0 };
backBufferBmpInfo.bmiHeader.biBitCount = devMode.dmBitsPerPel;
backBufferBmpInfo.bmiHeader.biHeight = GetSystemMetrics(SM_CYSCREEN);
backBufferBmpInfo.bmiHeader.biWidth = GetSystemMetrics(SM_CXSCREEN);
backBufferBmpInfo.bmiHeader.biPlanes = 1;
backBufferBmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
void* backBufferPixels = nullptr;
POINT res = { GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) };
HBRUSH bgTransparencyColor = CreateSolidBrush(TRANSPARENCY_COLOR);
int i = -1;
HDC hdc = GetDC(hwnd);
HDC hdcBackBuffer = CreateCompatibleDC(hdc);
SetBkMode(hdcBackBuffer, TRANSPARENT);
HBITMAP hbmBackBuffer = CreateDIBSection(hdcBackBuffer, (BITMAPINFO*)&backBufferBmpInfo, DIB_RGB_COLORS, (void**)&backBufferPixels, NULL, 0);
DeleteObject(SelectObject(hdcBackBuffer, hbmBackBuffer));
DeleteObject(SelectObject(hdcBackBuffer, bgTransparencyColor));
while (true) {
Sleep(16);
i = (i > res.x) ? 0 : ++i;
Rectangle(hdcBackBuffer, 0, 0, res.x, res.y);
RECT textPos;
textPos.left = i;
textPos.right = i;
textPos.top = res.y / 2;
textPos.bottom = res.y / 2;
SetTextColor(hdcBackBuffer, RGB(255, 255, 255));
DrawTextExW(hdcBackBuffer, (wchar_t*)L"!Hi!", 4, &textPos, DT_CENTER | DT_NOCLIP | DT_NOPREFIX, NULL);
if (targetWindowState == 0) {
targetWindowState = 1;
PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
}
BitBlt(hdc, 0, 0, res.x, res.y, hdcBackBuffer, 0, 0, SRCCOPY);
backBufferPixels = nullptr;
}
DeleteDC(hdcBackBuffer);
DeleteObject(hbmBackBuffer);
}
if (targetWindowState == 0) {
targetWindowState = 1;
PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
}
BitBlt(hdc, 0, 0, res.x, res.y, hdcBackBuffer, 0, 0, SRCCOPY);
template <typename type>
static void readMemory(uintptr_t offset, unsigned int length, type& var) {
ReadProcessMemory(targetHandle, (LPVOID)offset, &var, length * sizeof(type), 0);
}
int val; readMemory<int>(0x18872345, 1, val);
wchar_t* str = new wchar_t[nameLength]; readMemory<wchar_t*>(0x2834543, 16, str);
0xcccccccccccccccc <Error reading characters of string.> wchar_t *
0x0061007200740073 <Error reading characters of string.> wchar_t *
template <typename type>
static type readMemory(uintptr_t offset, unsigned int length) {
type value;
isLastSuccessful = ReadProcessMemory(targetHandle, (LPVOID)offset, &value, length * sizeof(type), 0);
return value;
}
wchar_t* playerName = new wchar_t[length];
playerName = readMemory<wchar_t>(adr, nameLength);
uintptr_t adrEntitiesCount = processManager.getModuleBaseAddress((WCHAR*)L"GameAssembly.dll");
int valEntitiesCount = processManager.readMemory<int>(adrEntitiesCount);
uintptr_t Addresses::entitiesCount = 12943454;
int entitiesCount = processManager.readMemory<int>(Addresses::entitiesCount);
--realtime-scroll-width: v-bind(realtimeScrollWidth).
<span style="color:red">Hello World</span>