fixed bug #1542530 - WriteUninstaller fails to overwrite read-only uninstallers
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4822 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9f37ece536
commit
a92506d828
3 changed files with 12 additions and 4 deletions
|
@ -165,7 +165,7 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
else
|
||||
{
|
||||
log_printf2("Delete: DeleteFile(\"%s\")",buf);
|
||||
SetFileAttributes(buf,fd.dwFileAttributes&(~FILE_ATTRIBUTE_READONLY));
|
||||
remove_ro_attr(buf);
|
||||
if (!DeleteFile(buf))
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
|
@ -208,7 +208,7 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
{
|
||||
addtrailingslash(buf);
|
||||
log_printf2("RMDir: RemoveDirectory(\"%s\")",buf);
|
||||
SetFileAttributes(buf,FILE_ATTRIBUTE_NORMAL);
|
||||
remove_ro_attr(buf);
|
||||
if (!RemoveDirectory(buf))
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
|
@ -370,6 +370,13 @@ void NSISCALL mini_memcpy(void *out, const void *in, int len)
|
|||
}
|
||||
}
|
||||
|
||||
void NSISCALL remove_ro_attr(char *file)
|
||||
{
|
||||
int attr = GetFileAttributes(file);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES)
|
||||
SetFileAttributes(file,attr&(~FILE_ATTRIBUTE_READONLY));
|
||||
}
|
||||
|
||||
HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd)
|
||||
{
|
||||
int attr = GetFileAttributes(fn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue