Archive: Delete a specific registry data


Delete a specific registry data
Hi,

I need to delete a specific registry data inside a value, but not the whole value.
The problem is this:
When the user uninstall there are files that can't be deleted, and therefore we use /REBOOTOK
but if the user re-installed the program before he restarted the machine and then he did the restart, the pending-to-be-deleted-files will be deleted and the program won't work.

For this reason, we want on installation to look inside:
HKLM\SYSTEM\ControlSet\Control\Session Manager "PendingFileRenameOperations"

This key contains the value-data ​​to be deleted after reboot.
But we need to look for the specific value-data and to delete only it and not the whole value (the value contains other files to be deleted)!

Any idea how to do this ?


I believe that is a REG_MULTI_SZ which you can read and write using the Registry plug-in.

Stu


If you rename the file(s) that the uninstaller was unable to delete, then the new files added by the installer won't get deleted by the reboot. (Renaming the files might or might not work, depending upon why you are unable to delete them).

You can try moving the files to a temporary directory if you want to make the install folder look like they were deleted.


You can try moving the files
you cant move them while they are marked for delete on reboot.
thats one reason they are marked for - in use!

"PendingFileRenameOperations"
is a long string sometimes >1024 - so you need the long string special build from nsis.
oh, my watcher limits outout to 730 token, afair this is due the line breaks inbetween that value

I'll have to accept your statement that files listed in PendingFileRenameOperations are locked from being moved, but the code in my installer does it like this:

${If} ${FileExists} C:\Ipls\dlls\*.*
SetOutPath C:\IPLS ; set current dir to prevent deleting C:\Ipls
RMDir /r C:\Ipls ; don't keep any old files or folders
${If} ${FileExists} C:\Ipls\dlls\*.*
; something has held up the folder: rename it to allow fresh files
Rename C:\Ipls\dlls C:\Ipls\dlls.prev
RMDir /r /REBOOTOK C:\Ipls\dlls.prev
${If} ${FileExists} C:\Ipls\dlls.prev\*.*
Push "C:\Ipls\dlls.prev will be deleted after reboot."
Call ErrorLog
${EndIf}
${EndIf}
ClearErrors
${EndIf}
Notice that I don't use the /REBOOTOK switch until after I've tried to remove the files once. Before that logic was added there were always a couple of dlls that wouldn't get deleted. The code above works for us. Now those stubborn files are in a different directory and are safe from the reboot delete.

Here's a second place I do the same thing:
Rename C:\Lockit $Temp\Lockit
RMDir /r /REBOOTOK $Temp\Lockit
${If} ${FileExists} $Temp\Lockit\*.*
Push "$Temp\Lockit will be deleted after reboot."
Call ErrorLog
${EndIf}
There are always a couple of files in that folder that can't get deleted (dlls used by Windows Explorer and the Logon process). The code above works.

similar to mine
http://forums.winamp.com/showthread.php?t=340940