only add entries to wininit.ini if short names were retrieved successfully
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3291 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
cbab2ce554
commit
6e2d07df31
2 changed files with 12 additions and 11 deletions
|
@ -303,9 +303,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
if (parm2 && file_exists(buf1))
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
g_exec_flags.exec_reboot++;
|
||||
#endif
|
||||
MoveFileOnReboot(buf1,buf2);
|
||||
update_status_text(LANG_RENAMEONREBOOT,buf3);
|
||||
log_printf2("Rename on reboot: %s",buf3);
|
||||
|
@ -495,9 +492,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
if (parm1)
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
g_exec_flags.exec_reboot++;
|
||||
#endif
|
||||
log_printf2("Delete: DeleteFile on Reboot(\"%s\")",buf1);
|
||||
update_status_text(LANG_DELETEONREBOOT,buf1);
|
||||
MoveFileOnReboot(buf1,NULL);
|
||||
|
|
|
@ -116,9 +116,6 @@ void NSISCALL doRMDir(char *buf, int flags) // 1 - recurse, 2 - rebootok
|
|||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
else if (!RemoveDirectory(buf) && flags&2) {
|
||||
log_printf2("Remove folder on reboot: %s",buf);
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
g_exec_flags.exec_reboot++;
|
||||
#endif
|
||||
MoveFileOnReboot(buf,0);
|
||||
}
|
||||
#else
|
||||
|
@ -307,15 +304,21 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
HANDLE hfile, hfilemap;
|
||||
DWORD dwFileSize, dwRenameLinePos;
|
||||
|
||||
int spn;
|
||||
|
||||
*((int *)tmpbuf) = *((int *)"NUL");
|
||||
|
||||
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);
|
||||
spn = GetShortPathName(pszNew,tmpbuf,1024);
|
||||
if (!spn || spn > 1024)
|
||||
return;
|
||||
}
|
||||
// wininit is used as a temporary here
|
||||
GetShortPathName(pszExisting,wininit,1024);
|
||||
spn = GetShortPathName(pszExisting,wininit,1024);
|
||||
if (!spn || spn > 1024)
|
||||
return;
|
||||
cchRenameLine = wsprintf(szRenameLine,"%s=%s\r\n",tmpbuf,wininit);
|
||||
|
||||
GetWindowsDirectory(wininit, 1024-16);
|
||||
|
@ -375,6 +378,10 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
}
|
||||
}
|
||||
//return fOk;
|
||||
|
||||
#ifdef NSIS_SUPPORT_REBOOT
|
||||
g_exec_flags.exec_reboot++;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue