- 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

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

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