v1.0.7
- Fixed crash related to autoupdater
This commit is contained in:
parent
005ac5f261
commit
e370cb44ad
@ -1,21 +1,29 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "injector/injector.h"
|
#include "injector/injector.h"
|
||||||
|
|
||||||
|
|
||||||
int main( ) {
|
int main( ) {
|
||||||
util::logo::create_console_and_draw_logo( );
|
util::logo::create_console_and_draw_logo( );
|
||||||
STARTUPINFO si = { .cb = sizeof( STARTUPINFO ) };
|
|
||||||
|
STARTUPINFOA si = { .cb = sizeof( si ) };
|
||||||
PROCESS_INFORMATION pi = {};
|
PROCESS_INFORMATION pi = {};
|
||||||
|
|
||||||
util::logger::debug( "Spawning oSpotify.exe" );
|
constexpr const char* exe_path = "oSpotify.exe";
|
||||||
if ( !CreateProcessW( L"oSpotify.exe", NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi ) ) {
|
|
||||||
|
// Creating process
|
||||||
|
//
|
||||||
|
util::logger::debug( "Spawning %s", exe_path );
|
||||||
|
if ( !CreateProcessA( exe_path, NULL, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi ) ) {
|
||||||
util::logger::error( "Unable to create process, error code: %d", GetLastError( ) );
|
util::logger::error( "Unable to create process, error code: %d", GetLastError( ) );
|
||||||
system( "pause" );
|
system( "pause" );
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Injecting Unspotify
|
||||||
|
//
|
||||||
util::logger::debug( "Injecting spotify-reverse.dll" );
|
util::logger::debug( "Injecting spotify-reverse.dll" );
|
||||||
if ( !injector::inject( pi.hProcess, "spotify-reverse.dll" ) ) {
|
if ( !injector::inject( pi.hProcess, "spotify-reverse.dll" ) ) {
|
||||||
util::logger::error( "Unable to inject module, error code: %d", GetLastError( ) );
|
util::logger::error( "Unable to inject module, error code: %d", GetLastError( ) );
|
||||||
@ -25,6 +33,7 @@ int main( ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResumeThread(pi.hThread);
|
ResumeThread(pi.hThread);
|
||||||
|
|
||||||
END:
|
END:
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
@ -29,7 +29,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>ClangCL</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<LLVMToolsVersion>12.0.0</LLVMToolsVersion>
|
<LLVMToolsVersion>12.0.0</LLVMToolsVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>ClangCL</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<LLVMToolsVersion>12.0.0</LLVMToolsVersion>
|
<LLVMToolsVersion>12.0.0</LLVMToolsVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -110,14 +110,12 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
<AdditionalOptions>-Xclang -Ofast -Xclang -fno-threadsafe-statics -Xclang -fdelayed-template-parsing -fcf-protection=none -mllvm -pgso -Wno-missing-braces -Wno-deprecated-volatile -Wno-missing-field-initializers -Wno-ignored-pragma-optimize /clang:-fno-unwind-tables /clang:-ffast-math /clang:-fno-builtin -Wno-gnu-string-literal-operator-template -Wno-unused-private-field -Wno-invalid-token-paste -Wno-microsoft-cast -Wno-unused-command-line-argument -Wno-pragma-once-outside-header %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalOptions>/MAP /MERGE:.voltbl=.data /MERGE:.retplne=.data /MERGE:.gehcont=.data /MERGE:.00cfg=.data /MERGE:_RDATA=.rdata /FORCE:UNRESOLVED %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -150,14 +148,12 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||||
<AdditionalOptions>-Xclang -Ofast -Xclang -fno-threadsafe-statics -Xclang -fdelayed-template-parsing -fcf-protection=none -mllvm -pgso -Wno-missing-braces -Wno-deprecated-volatile -Wno-missing-field-initializers -Wno-ignored-pragma-optimize /clang:-fno-unwind-tables /clang:-ffast-math /clang:-fno-builtin -Wno-gnu-string-literal-operator-template -Wno-unused-private-field -Wno-invalid-token-paste -Wno-microsoft-cast -Wno-unused-command-line-argument -Wno-pragma-once-outside-header %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalOptions>/MAP /MERGE:.voltbl=.data /MERGE:.retplne=.data /MERGE:.gehcont=.data /MERGE:.00cfg=.data /MERGE:_RDATA=.rdata /FORCE:UNRESOLVED %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@ -188,6 +184,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="injector\injector.h" />
|
<ClInclude Include="injector\injector.h" />
|
||||||
|
<ClInclude Include="util\util.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -26,5 +26,8 @@
|
|||||||
<ClInclude Include="injector\injector.h">
|
<ClInclude Include="injector\injector.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="util\util.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
// autoupdates
|
// autoupdates
|
||||||
|
|
||||||
// @note: es3n1n: v1.0.5 = 105
|
// @note: es3n1n: v1.0.7 = 107
|
||||||
#define UNSPOTIFY_VERSION 106
|
#define UNSPOTIFY_VERSION 107
|
||||||
|
|
||||||
#define AUTOUPDATER_DOMAIN "es3n.in"
|
#define AUTOUPDATER_DOMAIN "es3n.in"
|
||||||
#define AUTOUPDATER_URL "unspotify.json"
|
#define AUTOUPDATER_URL "unspotify.json"
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
namespace updates {
|
namespace updates {
|
||||||
update_info_t poll_info( ) {
|
update_info_t poll_info( ) {
|
||||||
auto data = util::networking::get( AUTOUPDATER_DOMAIN, AUTOUPDATER_URL );
|
auto [data, error] = util::networking::get( AUTOUPDATER_DOMAIN, AUTOUPDATER_URL );
|
||||||
if ( data.find( "error" ) != data.end( ) )
|
if ( error )
|
||||||
return update_info_t {
|
return update_info_t {
|
||||||
.m_error = true,
|
.m_error = true,
|
||||||
.m_error_desc = data[ "error" ].get<std::string>( )
|
.m_error_desc = "Internal server error :shrug:"
|
||||||
};
|
};
|
||||||
|
|
||||||
return update_info_t {
|
return update_info_t {
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
namespace networking {
|
namespace networking {
|
||||||
nlohmann::json get( const char* domain, const char* url ) {
|
errorable_json_result get( const char* domain, const char* url ) {
|
||||||
std::string response_data = err_json_data;
|
std::string response_data = err_json_data;
|
||||||
|
|
||||||
auto internet_session = InternetOpenA( "Unspotify/1.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0 );
|
auto internet_session = InternetOpenA( "Unspotify/1.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0 );
|
||||||
|
|
||||||
if ( !internet_session )
|
if ( !internet_session )
|
||||||
return nlohmann::json::parse( response_data );
|
return { nlohmann::json::parse( response_data ), true };
|
||||||
|
|
||||||
auto http_session = InternetConnectA( internet_session, domain, 80, 0, 0, INTERNET_SERVICE_HTTP, 0, NULL );
|
auto http_session = InternetConnectA( internet_session, domain, 80, 0, 0, INTERNET_SERVICE_HTTP, 0, NULL );
|
||||||
|
|
||||||
if ( !http_session )
|
if ( !http_session )
|
||||||
return nlohmann::json::parse( response_data );
|
return { nlohmann::json::parse( response_data ), true };
|
||||||
|
|
||||||
HINTERNET http_req = HttpOpenRequestA( http_session, "GET", url, 0, 0, 0, INTERNET_FLAG_RELOAD, 0 );
|
HINTERNET http_req = HttpOpenRequestA( http_session, "GET", url, 0, 0, 0, INTERNET_FLAG_RELOAD, 0 );
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ namespace util {
|
|||||||
const char* szHeaders = "Content-Type: application/json\r\nUser-Agent: Unspotify/1.0";
|
const char* szHeaders = "Content-Type: application/json\r\nUser-Agent: Unspotify/1.0";
|
||||||
|
|
||||||
if ( !HttpSendRequestA( http_req, szHeaders, strlen( szHeaders ), NULL, NULL ) )
|
if ( !HttpSendRequestA( http_req, szHeaders, strlen( szHeaders ), NULL, NULL ) )
|
||||||
return response_data;
|
return { response_data, true };
|
||||||
|
|
||||||
response_data.clear( );
|
response_data.clear( );
|
||||||
|
|
||||||
@ -39,9 +39,9 @@ namespace util {
|
|||||||
InternetCloseHandle( internet_session );
|
InternetCloseHandle( internet_session );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return nlohmann::json::parse( response_data );
|
return { nlohmann::json::parse( response_data ), false };
|
||||||
} catch ( const nlohmann::json::parse_error& er ) {
|
} catch ( const nlohmann::json::parse_error& er ) {
|
||||||
return nlohmann::json::parse( err_json_data );
|
return { nlohmann::json::parse( err_json_data ), true };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <urlmon.h>
|
#include <urlmon.h>
|
||||||
#include <WinInet.h>
|
#include <WinInet.h>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "ext/json.hpp"
|
#include "ext/json.hpp"
|
||||||
|
|
||||||
@ -11,8 +12,9 @@
|
|||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
namespace networking {
|
namespace networking {
|
||||||
|
using errorable_json_result = std::pair<nlohmann::json, bool>;
|
||||||
constexpr const char* err_json_data = "{\"error\": \"Unable to connect to server\"}";
|
constexpr const char* err_json_data = "{\"error\": \"Unable to connect to server\"}";
|
||||||
|
|
||||||
nlohmann::json get( const char* domain, const char* url );
|
errorable_json_result get( const char* domain, const char* url );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user