Old 2nd April 2018, 21:31   #1
jwptrek
Junior Member
 
Join Date: Mar 2016
Posts: 12
Delete command not deleting files in Windows directories

I am having a problem where my uninstaller is not deleting files properly from Windows folders.

The commands are (I've put some placeholders in for confidentiality):
Delete $WINDIR\system32\[filename].dll
Delete $WINDIR\sysWOW64\[filename].dll
Delete $WINDIR\system32\drivers\[filename].sys

My current suspicion is that the DLL files are in use by a different driver not just mine, since they are API DLLs. The sys file is only for my driver, however, and I know the driver is being removed from Windows. It doesn't get deleted either. However, the uninstaller gives no error when it tries to delete the files.

I am going to run the installer and uninstaller on a clean boot machine to see if I get different behavior. I was hoping however that someone would have ideas to make the files delete properly
jwptrek is offline   Reply With Quote
Old 2nd April 2018, 22:11   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,768
Make sure you have the RequestExecutionLevel attribute in your script.

Are you using the macros in x64.nsh to disable redirection?

Monitor the uninstaller with Process Monitor to see why the delete fails.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd April 2018, 22:59   #3
jwptrek
Junior Member
 
Join Date: Mar 2016
Posts: 12
I have the RequestExecutionLevel attribute at the beginning of the script. I also tried adding it to the uninstall portion of the script, but that gave an error. The only macro I am using currently is the InstallLib DLL to install the 64 bit API dll into the system32 folder. On my clean boot PC, the file in syswow64 is deleted properly, but the other two files are not deleted.
jwptrek is offline   Reply With Quote
Old 2nd April 2018, 23:21   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,768
And what does Process Monitor say?

And it is hard to say what is going on without any code.

Should probably look something like this:
Quote:
${If} ${RunningX64}
!define LIBRARY_X64 ; Will call ${DisableX64FSRedirection} internally
!insertmacro UnInstallLib ... ; Uninstall 64-bit module from system32 on 64-bit Windows
${EndIf}
!insertmacro UnInstallLib ... ; Uninstall 32-bit module from system32 (32-bit Windows) or syswow64 (64-bit Windows)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd April 2018, 23:51   #5
jwptrek
Junior Member
 
Join Date: Mar 2016
Posts: 12
Process Monitor shows that Windows is indeed redirecting. I can see where the first file is deleted, and it tries to delete the other two files, but in the wrong place. I will try using the UnInstallLib macro instead of the simple Delete command.
jwptrek is offline   Reply With Quote
Old 4th April 2018, 03:44   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,768
You can use Delete if the .dll is not registered but you have to use the macros in x64.nsh to deal with the redirection.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
delete, system32, windows

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump