From 1cd01f0db4257bca3b6df8381c6b89c77e3d43f1 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 22 Sep 2008 00:07:48 +0000 Subject: [PATCH] On Vista, if a file type is not registered, AssocQueryString() returns information about the "Unknown" application instead of admitting that nothing is registered. The solution is to add ASSOCF_INIT_IGNOREUNKNOWN to the flags parameter. Also update dead URLs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26488 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/os_cygwin.cpp | 10 ++++------ src/support/os_win32.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index cfaeb549f6..f13d25c37b 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -241,18 +241,16 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode) DWORD bufSize = MAX_PATH + 100; TCHAR buf[MAX_PATH + 100]; - // reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc - // /platform/shell/reference/shlwapi/registry/assocquerystring.asp + // reference: http://msdn.microsoft.com/en-us/library/bb773471.aspx char const * action = (mode == VIEW) ? "open" : "edit"; - return S_OK == AssocQueryString(0, ASSOCSTR_EXECUTABLE, - full_ext.c_str(), action, buf, &bufSize); + return S_OK == AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN, + ASSOCSTR_EXECUTABLE, full_ext.c_str(), action, buf, &bufSize); } bool autoOpenFile(string const & filename, auto_open_mode const mode) { - // reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc - // /platform/shell/reference/functions/shellexecute.asp + // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx string const win_path = to_local8bit(from_utf8(convert_path(filename, PathStyle(windows)))); char const * action = (mode == VIEW) ? "open" : "edit"; return reinterpret_cast(ShellExecute(NULL, action, diff --git a/src/support/os_win32.cpp b/src/support/os_win32.cpp index 385ebc606a..1ff1b8ec78 100644 --- a/src/support/os_win32.cpp +++ b/src/support/os_win32.cpp @@ -347,19 +347,16 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode) DWORD bufSize = MAX_PATH + 100; TCHAR buf[MAX_PATH + 100]; - // reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc - // /platform/shell/reference/shlwapi/registry/assocquerystring.asp + // reference: http://msdn.microsoft.com/en-us/library/bb773471.aspx char const * action = (mode == VIEW) ? "open" : "edit"; - return S_OK == AssocQueryString(0, ASSOCSTR_EXECUTABLE, - full_ext.c_str(), action, buf, &bufSize); + return S_OK == AssocQueryString(ASSOCF_INIT_IGNOREUNKNOWN, + ASSOCSTR_EXECUTABLE, full_ext.c_str(), action, buf, &bufSize); } bool autoOpenFile(string const & filename, auto_open_mode const mode) { - // reference: http://msdn.microsoft.com/library/default.asp - // ?url=/library/en-us/shellcc/platform/shell/reference/functions/ - // shellexecute.asp + // reference: http://msdn.microsoft.com/en-us/library/bb762153.aspx char const * action = (mode == VIEW) ? "open" : "edit"; return reinterpret_cast(ShellExecute(NULL, action, to_local8bit(from_utf8(filename)).c_str(), NULL, NULL, 1)) > 32; -- 2.39.2