console stuff

This commit is contained in:
Luna 2022-08-27 01:04:14 +01:00
parent 85f343c253
commit f55c897d42
No known key found for this signature in database
GPG Key ID: DE2FDA6E04D2DCE8
2 changed files with 10 additions and 8 deletions

View File

@ -47,8 +47,6 @@ char* ScanInternal(char* pattern,char * mask, char* begin, intptr_t size)
return match; return match;
} }
void* find_rel_addr(char* nextins,uint32_t offset) { void* find_rel_addr(char* nextins,uint32_t offset) {
char* mod = (char*)GetModuleHandleA(nullptr); char* mod = (char*)GetModuleHandleA(nullptr);
auto parta = (nextins - mod) + offset; auto parta = (nextins - mod) + offset;
@ -64,8 +62,9 @@ void* find_rel_addr_lea(char* nextins, char* offset) {
void main_thread() { void main_thread() {
AllocConsole(); AllocConsole();
freopen_s((FILE**)stdout,"CONOUT$", "w", (FILE*)stdout); FILE* f;
freopen_s((FILE**)stdin,"CONIN$", "w", (FILE*)stdin); freopen_s(&f,"CONOUT$", "w", (FILE*)stdout);
freopen_s(&f,"CONIN$", "r", (FILE*)stdin);
auto pog1 = GetModuleHandleA(nullptr); auto pog1 = GetModuleHandleA(nullptr);
@ -115,8 +114,10 @@ void main_thread() {
std::cout << std::hex << (int) secretKey[i]; std::cout << std::hex << (int) secretKey[i];
} }
std::cout << std::dec << ";" << std::endl; std::cout << std::dec << ";" << std::endl;
std::cin.get(); std::cout << "ok you can close me without killing main process now";
fclose(f);
FreeConsole();
} }
BOOL APIENTRY DllMain( HMODULE hModule, BOOL APIENTRY DllMain( HMODULE hModule,
@ -127,8 +128,9 @@ BOOL APIENTRY DllMain( HMODULE hModule,
switch (ul_reason_for_call) switch (ul_reason_for_call)
{ {
case DLL_PROCESS_ATTACH: { case DLL_PROCESS_ATTACH: {
std::thread pog(main_thread); std::thread mt(main_thread);
pog.detach(); //main_thread();
mt.detach();
} }
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:

View File

@ -112,7 +112,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>