ForceDel - a tool that deletes locked files

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

ForceDel - a tool that deletes locked files

Post by *m^2 »

ForceDelete for WinNT+
Deletes files that can't be deleted from Explorer
Written by Zoltan Csizmadia, extended by me to be more useful.
Download
Mirror


http://ghisler.ch/board/viewtopic.php?t=137&start=1161
Conitinued, from the thread above.
icfu wrote:First try with new version was successful. A later try gave "Error = 123" with one file.
winerror.h wrote:// MessageId: ERROR_INVALID_NAME
//
// MessageText:
//
// The filename, directory name, or volume label syntax is incorrect.
//
#define ERROR_INVALID_NAME 123L
:?
I'll take a closer look tomorrow.
icfu wrote:Anyway, looks like it can really become a nice alternative or replacement for Unlocker if probs are fixed, especially with speed.
I see no way to significantly improve performance :(
I'll try to analyze Unlocker's code unless it's license prohibits it.
The problem is that I enumerate all handles system-wide.
icfu wrote:Maybe you better open a separate thread for your tool for feedback... ;) You can also contact me on ICQ or mail if you need a tester.

Icfu
You're right ;) BTW. I wrote too little to call it "my tool". The main part is written by Zoltan Csizmadia, based on Felix Kasza's code.

Edited.
Last edited by m^2 on 2008-03-13, 07:38 UTC, edited 3 times in total.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Re: ForceDel - a tool that deletes locked files

Post by *m^2 »

icfu wrote:First try with new version was successful. A later try gave "Error = 123" with one file.
Did it happen only once?
I can't figure out what the problem is.
ADD:
New version is out, fixed a thread synchronization issue that could reduce performance under Win2k and newer and make ForceDel not delete a file under NT 4.
Click
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Only once till now, yep.

Icfu
This account is for sale
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

ForceDel 1.02
[+] Lowered required user privileges (sometimes works from User account, previously Debug User was required).
Giovanni
Member
Member
Posts: 154
Joined: 2005-03-23, 18:28 UTC

Post by *Giovanni »

Nice app :-)
Is it possible to delete directories?
I get "Error = 5" when I try.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

Not empty directories?
TODO ;)
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Test it with RarExt.dll of installed WinRAR folder, no luck.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

I can't unlock running .exe files. I could do this with .dlls, but applications which loaded them would crash soon.
I'm going to implement process termination when file can't be unlocked, now I display pids of processes holding a lock, so you can terminate them manually.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

New version
[+] Directory recursion
[~] Faster and more effective in user mode
Giovanni
Member
Member
Posts: 154
Joined: 2005-03-23, 18:28 UTC

Post by *Giovanni »

This just keeps getting better and better - thank you.

Small request: can it unlock a file without deleting it?
Example - log file is locked but I want to read contents.
Possibly rename it to something else temporarily.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

Giovanni wrote:This just keeps getting better and better - thank you.

Small request: can it unlock a file without deleting it?
Example - log file is locked but I want to read contents.
Possibly rename it to something else temporarily.
Yes, it's already on a TODO list. Maybe I should post it...
Sorted by priority.
- Unlock w/out deleting
- Convert to a windowed app
- Terminate processes keeping the lock
- Implement apt like termination methods
- Improve performance
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

New version
[+] Unlock w/out deleting
[+] Schedule on reboot deletion
[~] Revised command line switches

TODO:
- Convert to a windowed app
- Terminate processes keeping the lock
- Delete files with invalid names
- Print progress
- Delete file comments
- Unload dlls
- Implement apt like termination methods
- Improve performance

Edited.
Last edited by m^2 on 2007-10-17, 09:36 UTC, edited 1 time in total.
Giovanni
Member
Member
Posts: 154
Joined: 2005-03-23, 18:28 UTC

Post by *Giovanni »

[+] Delete w/out unlocking
Thanks for implementing that!

Version 1.4 generates error mesages when I try it.
Here is a copy of the output:
C:\>ForceDel.exe C:\WINDOS\WindowsUpdate.log
Trying to delete:
C:\WINDOWS\WindowsUpdate.log...failed: 32
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 412
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 664
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 664
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 664
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 664
Found a handle for \Device\HarddiskVolume2\WINDOWS\WindowsUpdate.log in 664
Closing handle in process #412 ... Closing handle in process #412 ... Ok
Then I get an error message:
ForceDel.exe - Application Error

The instruction at "0x7c92ae22" referenced memory at "0x74616369". The memory could not be "read".

Click on OK to terminate the program"
When I click OK it continues trying:
Closing handle in process #664 ... OpenProcess(664) failed
Closing handle in process #664 ... OpenProcess(664) failed
Closing handle in process #664 ... OpenProcess(664) failed
Closing handle in process #664 ... OpenProcess(664) failed
Closing handle in process #664 ... OpenProcess(664) failed
Closing handle in process #412 ... Closing handle in process #412 ... Closing ha
ndle in process #412 ... Closing handle in process #412 ... Closing handle in pr
ocess #412 ... Closing handle in process #412 ... Closing handle in process #412
... Closing handle in process #412 ... Closing handle in process #412 ... Closi
ng handle in process #412 ... Closing handle in process #412 ... Closing handle
in process #412 ... Closing handle in process #412 ... Closing handle in process
#412 ... Closing handle in process #412 ... Closing handle in process #412 ...
Closing handle in process #412 ... Closing handle in process #412 ... Closing ha
ndle in process #412 ... Closing handle in process #412 ... Closing handle in pr
ocess #412 ... Closing handle in process #412 ... Closing handle in process #412
... Closing handle in process #412 ... Closing handle in process #412 ... Closi
ng handle in process #412 ... Closing handle in process #412 ... Closing handle
in process #412 ... Closing handle in process #412 ...
C:\>
Then another error message:
ForceDel.exe - Application Error

The instruction at "0x7c92ae22" referenced memory at "0x00000f60". The memory could not be "read".

Click on OK to terminate the program"
I click OK and the unlocked file is gone.

The numbers vary - sometimes they are 0x00000000. The file is sucessfully deleted though.

There are no errors when I try with the /ND switch.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

Giovanni wrote:
[+] Delete w/out unlocking
Thanks for implementing that!
Actually I made a mistake, I should have written
[+] Unlock w/out deleting
.
Delete w/out unlocking was in original Zoltan's ForceDel already with /s (soft) switch.
But I guess you read what I wanted to write ;)
Giovanni wrote:Version 1.4 generates error mesages when I try it.
Here is a copy of the output:(...)
Thanks for the report. I hope this quick fix helps.
[!] Fixed: crashes..often.
Giovanni
Member
Member
Posts: 154
Joined: 2005-03-23, 18:28 UTC

Post by *Giovanni »

But I guess you read what I wanted to write ;)
Yes - I knew what you meant!
I hope this quick fix helps.
[!] Fixed: crashes..often.
Another speedy solution - thanks.
I shall try... but the link is dead :-(
Post Reply