Fixed CreateShortcut failure on Vista caused by security changes in r6645/2.47

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6684 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-12-15 23:11:48 +00:00
parent e2db35bf45
commit 0979ab23fc
2 changed files with 16 additions and 2 deletions

View file

@ -324,6 +324,14 @@ Released on May 19th, 2013
\b Fixed Korean MUI_[UN]TEXT_FINISH_INFO_* (\W{http://sourceforge.net/support/tracker.php?aid=3541515}{bug #3541515})
\H{v2.49} 2.49
Released on December 16th, 2015
\S1{v2.49-cl} Changelog
\b Fixed CreateShortcut failure on Vista caused by security changes in 2.47
\H{v2.48} 2.48
Released on December 10th, 2015

View file

@ -110,8 +110,14 @@ EXTERN_C void NSISWinMainNOCRT()
// dynamically loaded modules (with relative paths) to just
// %windir%\System32 and directories added with AddDllDirectory().
// This prevents DLL search order attacks (CAPEC-471).
FARPROC fp = myGetProcAddress(MGA_SetDefaultDllDirectories);
if (fp) ((BOOL(WINAPI*)(DWORD))fp)(LOAD_LIBRARY_SEARCH_SYSTEM32|LOAD_LIBRARY_SEARCH_USER_DIRS);
DWORD winver = GetVersion();
// CoCreateInstance(CLSID_ShellLink, ...) fails on Vista if SetDefaultDllDirectories is called
BOOL avoidwinbug = LOWORD(winver) == MAKEWORD(6, 0);
if (!avoidwinbug)
{
FARPROC fp = myGetProcAddress(MGA_SetDefaultDllDirectories);
if (fp) ((BOOL(WINAPI*)(DWORD))fp)(LOAD_LIBRARY_SEARCH_SYSTEM32|LOAD_LIBRARY_SEARCH_USER_DIRS);
}
}
// Because myGetProcAddress now loads dlls with a full path