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

@ -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