Fixed a year and a half old bug with renaming on Windows 9x to a file name that does not exist.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1931 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-12-10 17:19:57 +00:00
parent cccfc1cb65
commit 3fb593f767

View file

@ -228,7 +228,11 @@ BOOL NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
DWORD dwFileSize, dwRenameLinePos;
static const char nulint[4]="NUL";
if (pszNew) GetShortPathName(pszNew,tmpbuf,1024);
if (pszNew) {
// create the file if it's not already there to prevent GetShortPathName from failing
CloseHandle(myOpenFile(pszNew, 0, CREATE_NEW));
GetShortPathName(pszNew,tmpbuf,1024);
}
else *((int *)tmpbuf) = *((int *)nulint);
// wininit is used as a temporary here
GetShortPathName(pszExisting,wininit,1024);