- Add way to close unspotify console
This commit is contained in:
og 2021-11-18 03:45:24 +10:00
parent 272f88fb76
commit d9315980e7
2 changed files with 15 additions and 3 deletions

View File

@ -67,11 +67,16 @@ namespace util {
MessageBoxA( NULL, buf, "Unspotify", MB_OK );
}
inline void startup( ) {
AllocConsole( );
__forceinline void startup( ) {
::AllocConsole( );
freopen_s( reinterpret_cast< FILE** >( stdin ), "CONIN$", "r", stdin );
freopen_s( reinterpret_cast< FILE** >( stdout ), "CONOUT$", "w", stdout );
SetConsoleTitleA( "Unspotify" );
::SetConsoleTitleA( "Unspotify" );
}
__forceinline void detach( ) {
::ShowWindow( ::GetConsoleWindow( ), SW_HIDE );
::FreeConsole( );
}
}
}

View File

@ -4,6 +4,9 @@
#include "../hooks/hooks.h"
#include "shared/logo.h"
#include <string>
#include <iostream>
namespace bootstrap {
DWORD __stdcall _initial_routine( HANDLE ) {
@ -11,6 +14,10 @@ namespace bootstrap {
spotify::init( );
hooks::init( );
util::logger::warn( "press any key to close this console" );
_getwch( );
util::logger::detach( );
#ifndef _DEBUG
for ( ;;) {
#else