From 9a0b86749c0b2645f00614564b69c0d8fc981131 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 22 Sep 2008 22:07:23 +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/branches/BRANCH_1_5_X@26499 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/os_cygwin.cpp | 10 ++++------ src/support/os_win32.cpp | 10 ++++------ status.15x | 3 +++ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/support/os_cygwin.cpp b/src/support/os_cygwin.cpp index 304dd3e997..b059d12715 100644 --- a/src/support/os_cygwin.cpp +++ b/src/support/os_cygwin.cpp @@ -258,18 +258,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 5ff9827e01..c899acb23d 100644 --- a/src/support/os_win32.cpp +++ b/src/support/os_win32.cpp @@ -389,18 +389,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; diff --git a/status.15x b/status.15x index d8e469df4b..457b7c1f9b 100644 --- a/status.15x +++ b/status.15x @@ -109,6 +109,9 @@ What's new - Fix toggling of font and corresponding undo in mathed (bug 5246). +- On Windows Vista, fix application association when a file type is not + registered (in this case the "Unknown" application would be used). + * DOCUMENTATION AND LOCALIZATION