load shfolder.dll before the script is executed to avoid any usage effects

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5198 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-07-12 19:15:50 +00:00
parent 161ac2adf2
commit edd3c299f7
2 changed files with 23 additions and 5 deletions

View file

@ -52,6 +52,8 @@ char *ValidateTempDir()
return my_GetTempFileName(state_language, state_temp_dir);
}
void *g_SHGetFolderPath;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
{
int ret = 0;
@ -74,6 +76,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
}
#endif
// load shfolder.dll before any script code is executed to avoid
// weird situations where SetOutPath or even the extraction of
// shfolder.dll will cause unexpected behavior.
//
// this also prevents the following:
//
// SetOutPath "C:\Program Files\NSIS" # maybe read from reg
// File shfolder.dll
// Delete $PROGRAMFILES\shfolder.dll # can't be deleted, as the
// # new shfolder.dll is used
// # to find its own path.
g_SHGetFolderPath = myGetProcAddress(MGA_SHGetFolderPathA);
{
// workaround for bug #1008632
// http://sourceforge.net/tracker/index.php?func=detail&aid=1008632&group_id=22049&atid=373085