#include "includes.h"
#include <thread>
#include <chrono>
#include <tchar.h>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <fstream>
#include <string>
void eraseHeaders(HINSTANCE self)
{
PIMAGE_DOS_HEADER pDoH;
PIMAGE_NT_HEADERS pNtH;
DWORD i, ersize, protect;
if (!self) return;
pDoH = (PIMAGE_DOS_HEADER)(self);
pNtH = (PIMAGE_NT_HEADERS)((LONG)self + ((PIMAGE_DOS_HEADER)self)->e_lfanew);
ersize = sizeof(IMAGE_DOS_HEADER);
if (VirtualProtect(pDoH, ersize, PAGE_READWRITE, &protect)) {
for (i = 0; i < ersize; i++) {
*(BYTE*)((BYTE*)pDoH + i) = 0;
}
}
ersize = sizeof(IMAGE_NT_HEADERS);
if (pNtH && VirtualProtect(pNtH, ersize, PAGE_READWRITE, &protect)) {
for (i = 0; i < ersize; i++) {
*(BYTE*)((BYTE*)pNtH + i) = 0;
}
}
return;
}
int __stdcall DllMain(HMODULE self, ulong_t reason, void* reserved) {
if (reason == DLL_PROCESS_ATTACH) {
#ifndef KOLO
HANDLE thread = CreateThread(nullptr, 0, Client::init, nullptr, 0, nullptr);
if (!thread)
return 0;
// CloseHandle( thread );
#else
Client::init(nullptr);
#endif
return 1;
}
return 0;
}