Fixes usage like 'winebrowser winehq.org' when xdg-open or macOS 'open' is used.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50094 Signed-off-by: Brendan Shanks bshanks@codeweavers.com ---
v2: Split invalid URL handling into separate function.
programs/winebrowser/main.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/programs/winebrowser/main.c b/programs/winebrowser/main.c index 9cd6812d032..c70457e50b3 100644 --- a/programs/winebrowser/main.c +++ b/programs/winebrowser/main.c @@ -184,6 +184,29 @@ static int open_mailto_url( const WCHAR *url ) return launch_app( mailers, url ); }
+static int open_invalid_url( const WCHAR *url ) +{ + static const WCHAR httpW[] = + {'h','t','t','p',':','/','/',0}; + + WCHAR *url_prefixed; + int ret; + + url_prefixed = HeapAlloc( GetProcessHeap(), 0, (ARRAY_SIZE(httpW) + strlenW( url )) * sizeof(WCHAR) ); + if (!url_prefixed) + { + WINE_ERR("Out of memory\n"); + return 1; + } + + strcpyW( url_prefixed, httpW ); + strcatW( url_prefixed, url ); + + ret = open_http_url( url_prefixed ); + HeapFree( GetProcessHeap(), 0, url_prefixed ); + return ret; +} + /***************************************************************************** * DDE helper functions. */ @@ -448,8 +471,8 @@ int __cdecl wmain(int argc, WCHAR *argv[])
hres = CreateUri(url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri); if(FAILED(hres)) { - WINE_ERR("Failed to parse URL\n"); - ret = open_http_url(url); + WINE_ERR("Failed to parse URL %s, treating as HTTP\n", wine_dbgstr_w(url)); + ret = open_invalid_url(url); HeapFree(GetProcessHeap(), 0, ddeString); return ret; }
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50094 Signed-off-by: Brendan Shanks bshanks@codeweavers.com --- loader/wine.inf.in | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 5210672c295..d292b065a0e 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -780,6 +780,11 @@ HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components{6BF52A52-394A-11d3-B1 HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components{6BF52A52-394A-11d3-B153-00C04F79FAA6},"Locale",2,"*" HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components{6BF52A52-394A-11d3-B153-00C04F79FAA6},"Version",2,"12,0,7601,18840"
+; URL Associations +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice,"ProgId",,"ftp" +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice,"ProgId",,"http" +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice,"ProgId",,"https" + [Nls] HKLM,System\CurrentControlSet\Control\Nls\Language,"0401",,"l_intl.nls" HKLM,System\CurrentControlSet\Control\Nls\Language,"0402",,"l_intl.nls"