[Command] Don't crash on shell execute
This commit is contained in:
parent
29ef5d6379
commit
a327915008
@ -257,7 +257,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (params->length() > 1)
|
if (params->length() > 1)
|
||||||
{
|
{
|
||||||
ShellExecuteA(nullptr, "open", params->get(1), nullptr, nullptr, SW_SHOWNORMAL);
|
Utils::OpenUrl(params->get(1));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -201,12 +201,12 @@ namespace Components
|
|||||||
|
|
||||||
UIScript::Add("visitWebsite", [](UIScript::Token)
|
UIScript::Add("visitWebsite", [](UIScript::Token)
|
||||||
{
|
{
|
||||||
ShellExecuteA(nullptr, "open", Utils::Cache::GetStaticUrl("").data(), nullptr, nullptr, SW_SHOWNORMAL);
|
Utils::OpenUrl(Utils::Cache::GetStaticUrl(""));
|
||||||
});
|
});
|
||||||
|
|
||||||
UIScript::Add("visitWiki", [](UIScript::Token)
|
UIScript::Add("visitWiki", [](UIScript::Token)
|
||||||
{
|
{
|
||||||
ShellExecuteA(nullptr, "open", Utils::Cache::GetStaticUrl("/wiki/").data(), nullptr, nullptr, SW_SHOWNORMAL);
|
Utils::OpenUrl(Utils::Cache::GetStaticUrl("/wiki/"));
|
||||||
});
|
});
|
||||||
|
|
||||||
Localization::Set("MPUI_CHANGELOG_TEXT", "Loading...");
|
Localization::Set("MPUI_CHANGELOG_TEXT", "Loading...");
|
||||||
|
@ -110,6 +110,15 @@ namespace Utils
|
|||||||
return GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(ntdll), sizeof ntdll), -1).data());
|
return GetModuleHandleA(Utils::String::XOR(std::string(reinterpret_cast<char*>(ntdll), sizeof ntdll), -1).data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenUrl(std::string url)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShellExecuteA(nullptr, "open", url.data(), nullptr, nullptr, SW_SHOWNORMAL);
|
||||||
|
}
|
||||||
|
catch (...) {}
|
||||||
|
}
|
||||||
|
|
||||||
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2)
|
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2)
|
||||||
{
|
{
|
||||||
return !(base1 + len1 <= base2 || base2 + len2 <= base1);
|
return !(base1 + len1 <= base2 || base2 + len2 <= base1);
|
||||||
|
@ -19,6 +19,8 @@ namespace Utils
|
|||||||
void* GetThreadStartAddress(HANDLE hThread);
|
void* GetThreadStartAddress(HANDLE hThread);
|
||||||
HMODULE GetNTDLL();
|
HMODULE GetNTDLL();
|
||||||
|
|
||||||
|
void OpenUrl(std::string url);
|
||||||
|
|
||||||
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2);
|
bool HasIntercection(unsigned int base1, unsigned int len1, unsigned int base2, unsigned int len2);
|
||||||
|
|
||||||
template <typename T> inline void RotLeft(T& object, size_t bits)
|
template <typename T> inline void RotLeft(T& object, size_t bits)
|
||||||
|
Loading…
Reference in New Issue
Block a user