Use rundll32.exe for launching URL schemes
This commit is contained in:
@@ -785,23 +785,12 @@ namespace platf {
|
||||
}
|
||||
|
||||
auto raw_target = raw_cmd_parts.at(0);
|
||||
std::wstring lookup_string;
|
||||
HRESULT res;
|
||||
|
||||
if (PathIsURLW(raw_target.c_str())) {
|
||||
std::array<WCHAR, 128> scheme;
|
||||
|
||||
DWORD out_len = scheme.size();
|
||||
res = UrlGetPartW(raw_target.c_str(), scheme.data(), &out_len, URL_PART_SCHEME, 0);
|
||||
if (res != S_OK) {
|
||||
BOOST_LOG(warning) << "Failed to extract URL scheme from URL: "sv << raw_target << " ["sv << util::hex(res).to_string_view() << ']';
|
||||
return from_utf8(raw_cmd);
|
||||
// If the target is a URL, handle it directly with rundll32.exe
|
||||
std::wstring cmd = L"rundll32.exe url.dll,FileProtocolHandler " + raw_target;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
// If the target is a URL, the class is found using the URL scheme (prior to and not including the ':')
|
||||
lookup_string = scheme.data();
|
||||
}
|
||||
else {
|
||||
// If the target is not a URL, assume it's a regular file path
|
||||
auto extension = PathFindExtensionW(raw_target.c_str());
|
||||
if (extension == nullptr || *extension == 0) {
|
||||
@@ -818,8 +807,8 @@ namespace platf {
|
||||
}
|
||||
|
||||
// For regular files, the class is found using the file extension (including the dot)
|
||||
lookup_string = extension;
|
||||
}
|
||||
std::wstring lookup_string = extension;
|
||||
HRESULT res;
|
||||
|
||||
std::array<WCHAR, MAX_PATH> shell_command_string;
|
||||
bool needs_cmd_escaping = false;
|
||||
|
||||
Reference in New Issue
Block a user