From 3fb593f767dced6247da04fc7cd8b9a9418b8660 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 10 Dec 2002 17:19:57 +0000 Subject: [PATCH] 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 --- Source/exehead/util.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 31e8adfe..24898e59 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -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);