diff options
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 8e1e0070..179ea217 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -21,15 +21,15 @@ #include <fcntl.h> #include <io.h> #include <math.h> #include <shlobj.h> +#include <shlwapi.h> #include <sys/stat.h> #include <stdlib.h> #include <time.h> #include <tchar.h> #include <Richedit.h> #if defined (TCMOUNT) || defined (VOLFORMAT) -#include <Shlwapi.h> #include <process.h> #include <Tlhelp32.h> #endif @@ -344,8 +344,15 @@ typedef HINF (WINAPI *SetupOpenInfFileWPtr)(PCWSTR FileName,PCWSTR InfClass,DWOR typedef LSTATUS (STDAPICALLTYPE *SHDeleteKeyWPtr)(HKEY hkey, LPCWSTR pszSubKey); typedef HRESULT (STDAPICALLTYPE *SHStrDupWPtr)(LPCWSTR psz, LPWSTR *ppwsz); +typedef HRESULT (STDAPICALLTYPE *UrlUnescapeWPtr)( + PWSTR pszUrl, + PWSTR pszUnescaped, + DWORD *pcchUnescaped, + DWORD dwFlags +); + // ChangeWindowMessageFilter typedef BOOL (WINAPI *ChangeWindowMessageFilterPtr) (UINT, DWORD); typedef BOOL (WINAPI *CreateProcessWithTokenWFn)( @@ -372,8 +379,9 @@ SetupDiOpenClassRegKeyPtr SetupDiOpenClassRegKeyFn = NULL; SetupInstallFromInfSectionWPtr SetupInstallFromInfSectionWFn = NULL; SetupOpenInfFileWPtr SetupOpenInfFileWFn = NULL; SHDeleteKeyWPtr SHDeleteKeyWFn = NULL; SHStrDupWPtr SHStrDupWFn = NULL; +UrlUnescapeWPtr UrlUnescapeWFn = NULL; ChangeWindowMessageFilterPtr ChangeWindowMessageFilterFn = NULL; CreateProcessWithTokenWFn CreateProcessWithTokenWPtr = NULL; typedef LONG (WINAPI *WINVERIFYTRUST)(HWND hwnd, GUID *pgActionID, LPVOID pWVTData); @@ -3100,12 +3108,13 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) if (!SetupCloseInfFileFn || !SetupDiOpenClassRegKeyFn || !SetupInstallFromInfSectionWFn || !SetupOpenInfFileWFn) AbortProcess ("INIT_DLL"); - // Get SHDeleteKeyW function pointer + // Get SHDeleteKeyW,SHStrDupW, UrlUnescapeW functions pointers SHDeleteKeyWFn = (SHDeleteKeyWPtr) GetProcAddress (hShlwapiDll, "SHDeleteKeyW"); SHStrDupWFn = (SHStrDupWPtr) GetProcAddress (hShlwapiDll, "SHStrDupW"); - if (!SHDeleteKeyWFn || !SHStrDupWFn) + UrlUnescapeWFn = (UrlUnescapeWPtr) GetProcAddress(hShlwapiDll, "UrlUnescapeW"); + if (!SHDeleteKeyWFn || !SHStrDupWFn || !UrlUnescapeWFn) AbortProcess ("INIT_DLL"); if (IsOSAtLeast (WIN_VISTA)) { @@ -11190,9 +11199,9 @@ void Applink (const char *dest) StringCbPrintfW (url, sizeof (url), L"file:///%sdocs/html/en/%s", installDir, page); CorrectURL (url); } - if (IsAdmin ()) + if (IsOSAtLeast (WIN_VISTA) && IsAdmin ()) { int openDone = 0; if (buildUrl) { @@ -11200,9 +11209,9 @@ void Applink (const char *dest) DWORD cchUnescaped = ARRAYSIZE(pageFileName); StringCbCopyW (pageFileName, sizeof(pageFileName), page); /* remove escape sequences from the page name before calling FileExists function */ - if (S_OK == UrlUnescapeW (pageFileName, pageFileName, &cchUnescaped, URL_UNESCAPE_INPLACE)) + if (S_OK == UrlUnescapeWFn (pageFileName, pageFileName, &cchUnescaped, URL_UNESCAPE_INPLACE)) { std::wstring pageFullPath = installDir; pageFullPath += L"docs\\html\\en\\"; pageFullPath += pageFileName; |