File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -49,17 +49,35 @@ namespace Injector {
4949
5050 m_arch = (processArch == IMAGE_FILE_MACHINE_UNKNOWN) ? nativeMachine : processArch;
5151
52+ // Architecture names for human-readable errors
53+ auto GetArchName = [](USHORT arch) -> std::string {
54+ switch (arch) {
55+ case 0x8664 : return " x64 (AMD64)" ;
56+ case 0xAA64 : return " ARM64" ;
57+ case 0x014C : return " x86 (i386)" ;
58+ case 0x01C4 : return " ARM (Thumb-2)" ;
59+ default : return " Unknown (0x" + std::to_string (arch) + " )" ;
60+ }
61+ };
62+
5263 // Injector is x64 or ARM64 (native)
5364#if defined(_M_X64)
5465 constexpr USHORT injectorArch = 0x8664 ; // AMD64
66+ constexpr const char * injectorArchName = " x64" ;
5567#elif defined(_M_ARM64)
5668 constexpr USHORT injectorArch = 0xAA64 ; // ARM64
69+ constexpr const char * injectorArchName = " ARM64" ;
5770#else
5871 constexpr USHORT injectorArch = 0 ;
72+ constexpr const char * injectorArchName = " Unknown" ;
5973#endif
6074
6175 if (m_arch != injectorArch) {
62- throw std::runtime_error (" Architecture mismatch: Target is " + std::to_string (m_arch));
76+ std::string error = " Architecture mismatch!\n " ;
77+ error += " Injector: " + std::string (injectorArchName) + " \n " ;
78+ error += " Target: " + GetArchName (m_arch) + " \n " ;
79+ error += " Solution: Use chromelevator_" + std::string (m_arch == 0xAA64 ? " arm64" : " x64" ) + " .exe" ;
80+ throw std::runtime_error (error);
6381 }
6482 }
6583
You can’t perform that action at this time.
0 commit comments