Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Force Delete [CMD]


  • Please log in to reply
14 replies to this topic
Jon
  • Members
  • 349 posts
  • Last active: Aug 30 2011 08:35 PM
  • Joined: 28 Apr 2004

Have you ever tried to delete a file or folder, only to get a Windows error message saying no can do? Maybe you're having a bad hair day, but more likely the file is being used by a program. Try downloading ForceDel, a utility that works with all Windows versions to force delete the stubborn file. The program runs from a DOS command window (click Start, Run, and type "cmd"). Enter forcedel filename to give the file the boot for good.


http://www.pcworld.c... ... RSS,00.asp

C++ Source code is included

  • Guests
  • Last active:
  • Joined: --
the links is dead, seems very useful
an alternative to unlocker, can you please update the link ?

Standarte
  • Guests
  • Last active:
  • Joined: --
New link:
http://www.technipages.com/wp-content/uploads/2007/11/forcedel.zip


Ice_Tea
  • Members
  • 131 posts
  • Last active: Aug 25 2010 11:11 AM
  • Joined: 12 Jan 2008

New link:

http://www.technipages.com/wp-content/uploads/2007/11/forcedel.zip


Thanks for the link...

It's opensource, but I still scanned the exe, and there were a lot of malware/infected reports, it's prolly false-positive but I thougt it'd be worth mentioning this to carefree people...

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008
Here you can get evolution of ForceDel, created by another person. Well, by me.
It has a GUI, but it's not finished and honestly it sucks. Shouldn't be a problem for sb. wanting to use the command line version.
But there are also important engine changes:
-Speed. Way better. Much faster than any other similar tool that works in user mode.
-It's a bit stronger.
-Deletes multiple files, to recycle bin etc.

Anyone who trades liberty for security deserves neither liberty nor security.


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
The ultimate one is bellow, and u can make it portable:
http://ccollomb.free.fr/unlocker/

Btw, m^2, since your tool is written in user mode, its certanly buggy. Both methods (the one working in user mode, and the one with driver) are documented on SysInternals forum, the one doing things from user mode is buggy but bug is random and you may never get it and by my experience it happens on some computers while it doesn't on some other computers.

I posted the source code of user mode method here
Posted Image

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008

The ultimate one is bellow, and u can make it portable:
http://ccollomb.free.fr/unlocker/

Btw, m^2, since your tool is written in user mode, its certanly buggy. Both methods (the one working in user mode, and the one with driver) are documented on SysInternals forum, the one doing things from user mode is buggy but bug is random and you may never get it and by my experience it happens on some computers while it doesn't on some other computers.

I posted the source code of user mode method here


You mean this thread and the problem that it's slow?
Take a look into my code, unlocker is faster, but just a bit.

I'd have to register to get the code from winasm, but the thing that you wrote on sysinternals carries a minor bug from the original ForceDel. :p
It mixes C and WinAPI threads, which can cause resource leaks and possibly be incompatible with some future Windows version.

Anyone who trades liberty for security deserves neither liberty nor security.


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
No, not that thread, it was some other thread on the forum. In the one you mentioned I simply posted what I got until the moment. The problem of speed was side effect, not the real problem. The side effect was there to solve the thread stucking problem.

I don't know about resource leaks that you are talking about, and if I remember correctly (it was about 2 years ago) I started without threads, thread was there because of stucking.

So, what do you want to say ? Did you succesifully solved the stucking or u sucessifully killed the stucked threads ? In any case I downloaded your utility and will give it a longer try.

BTW, can you explain a bit about C vs API threads you mentioned ? I don't understand it. Arent c threads one way or another mapped to API calls ?
Posted Image

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008

No, not that thread, it was some other thread on the forum. In the one you mentioned I simply posted what I got until the moment. The problem of speed was side effect, not the real problem. The side effect was there to solve the thread stucking problem.

I can't find it, could you help? I'd like to get a broader view.

The problem is that NtQueryInformationFile gets access denial on some files. There are 2 issues with it:
1. There are some handles that can't be unlocked. I *guess* that these are some system files, it never caused me any problems. That's why I'd like to know what more knowledgeable people say about it.
2. On access denied it hangs. Yes, doesn't return at all. Therefore you always call NtQueryInformationFile in a separate thread that you can just kill after you decided that it took too long. You have to wait, that's why ForceDel is slow.

I don't know about resource leaks that you are talking about

_beginthread returns uintptr_t.
TerminateThread takes HANDLE, so giving it uintptr_t is mixing different things that currently happen to be the same.
You can't safely assume that _beginthread will always relay on CreateThread or that it doesn't store some information by itself.

, and if I remember correctly (it was about 2 years ago) I started without threads, thread was there because of stucking.

Yeah, right, I don't believe you anyway, this bug is too characteristic. :p
But it doesn't matter, let's skip this part.

So, what do you want to say ? Did you succesifully solved the stucking or u sucessifully killed the stucked threads ? In any case I downloaded your utility and will give it a longer try.

I just do 2 things:
1. Find handles to all locked files at the same time. All practical solutions (i.e. FileAssissin) do the same.
2. I do the waits simultaneously.
Simple and works great. :)

Its pitty it doesn't accept command line parameters.

It does. F1.

Anyone who trades liberty for security deserves neither liberty nor security.


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006

2. On access denied it hangs. Yes, doesn't return at all. Therefore you always call NtQueryInformationFile in a separate thread that you can just kill after you decided that it took too long. You have to wait, that's why ForceDel is slow.

The problem is that for some reason, in some cases you can't kill the thread for misterious reason. So it seems you didn't solve the problem but you, most probably, never experienced the bug since it never happens on some computers. I would like that I am wrong tho and that your method trully works every time on every computer.

Yeah, right, I don't believe you anyway, this bug is too characteristic.

Sure, its your right, its not like I am here to convince you about anything. I am just sharing my experience about the thing. Maybe in your part of the world making up stories about misterious bugs is common tho... :lol:

I can't find it, could you help? I'd like to get a broader view.

I maybe can find it, but why should I, you wont beleive it anyway :p

It does. F1.

Ye, I was hasty...
Posted Image

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008

2. On access denied it hangs. Yes, doesn't return at all. Therefore you always call NtQueryInformationFile in a separate thread that you can just kill after you decided that it took too long. You have to wait, that's why ForceDel is slow.

The problem is that for some reason, in some cases you can't kill the thread for misterious reason. So it seems you didn't solve the problem but you, most probably, never experienced the bug since it never happens on some computers. I would like that I am wrong tho and that your method trully works every time on every computer.

And this might be the _beginthread/TerminateThread bug, doesn't it?
BTW for ForceDel it wasn't really a problem, but for a TC plugin it's a bit different.

I can't find it, could you help? I'd like to get a broader view.

I maybe can find it, but why should I, you wont beleive it anyway :p

Still, I would be pleased if you helped.

Anyone who trades liberty for security deserves neither liberty nor security.


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
This symptom reminds me about what was happening to me.

IMPORTANT! If you NtQueryObject with ONI (1) on a special NamedPipe handle, your thread will hang. Infact in my testing, I wasn't even able to kill the process nor shut down my computer.


And this might be the _beginthread/TerminateThread bug, doesn't it?

Perhaps it is.

Thanks.
Posted Image

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008

This symptom reminds me about what was happening to me.

IMPORTANT! If you NtQueryObject with ONI (1) on a special NamedPipe handle, your thread will hang. Infact in my testing, I wasn't even able to kill the process nor shut down my computer.


And this might be the _beginthread/TerminateThread bug, doesn't it?

Perhaps it is.

Thanks.


Thanks for the quotation, it opened endless pool of at least partially relevant threads. I hoped it will be shorter, but that's OK, I'll probably read it all later.
For now it's enough for me to know that these hanging threads belong to pipes, not files.

Anyone who trades liberty for security deserves neither liberty nor security.


majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
There were lot of new articles on the forum after I was doing this, so I couldn't find in short time what I was refereing too. The above "important thing" was one of the things that looked similar to what I was experiencing and it may be the cause of the problem in my case as checking the output of ConUnlocker I see that it lists named pipes too. I had to restart it 20 or more times here for it to hung at the end of the last try before exiting the process. I didn't think it was thread thingie as I can't imagine that _beginThread/TerminateThred works OK every time except in rare cases.

Anyway, I will see to add name pipe filtering and proper thread handling and let you know about the results.

Thanks for some explanations.
Posted Image

m^2
  • Members
  • 100 posts
  • Last active: Mar 01 2011 09:31 AM
  • Joined: 28 Feb 2008

There were lot of new articles on the forum after I was doing this, so I couldn't find in short time what I was refereing too. The above "important thing" was one of the things that looked similar to what I was experiencing and it may be the cause of the problem in my case as checking the output of ConUnlocker I see that it lists named pipes too. I had to restart it 20 or more times here for it to hung at the end of the last try before exiting the process. I didn't think it was thread thingie as I can't imagine that _beginThread/TerminateThred works OK every time except in rare cases.

Anyway, I will see to add name pipe filtering and proper thread handling and let you know about the results.

Thanks for some explanations.

It would be nice to know the outcome.
Good luck. :)

Anyone who trades liberty for security deserves neither liberty nor security.