Yes, I know, the last post is some time ago. The reason is that I am in the middle of another project and also going to release a huge jedi pack for your convenience. Furthermore it is hard to get writers for the API. So please excuse me and stay alerted.
Today I had a thing with my Windows Vista (fully updated) that got me crazy. My Delphi created an executable file that had a size of zero. (Don’t ask me why that happened at all). Anyway. Delphi could not overwrite this file and always showed me a stream write error. I tried to erase this file manually but had no success. The Vista Explorer told me that the file was in use by another program (which was not correct as you’ll see later). I also created a copy of the exe file in another location to see if I could erase the copy there. No I could not! And now I had two copies of an unerasable file.
First I suspected that my virus scanner could be the problem, so I deactivated the background scanner and everything I could deactive - but without any success. Then I tried to do a hard disk scan: maybe there are some ntfs problem. To make it short - no there weren’t any defects. In my desperation I booted up my Windows XP, opened the folder and started to delete the file. At that moment, I did not believe for success. However to my suprise I could delete the broken exe file without problem.
Back to Windows Vista, the first thing I did was openening the folder in the Explorer and the command prompt. Deleting the file from command line was no success either, so in my deep desperate situation I did a full kill of all explorer processes. Then I tried to delete the file again - and you know what? - I had success.
In conclusion (and to make it short), I found out that as soon as you open the Windows Explorer and delete the file, the game is over. So there are at least two options which lead to success.
You don’t need to kill the main explorer.exe process for both solutions. I found out that the bad guy is just the window that displays the folder content.
Why?
Don’t ask me why this happens at all. I suppose that Windows Explorer has some serious bugs that leads to the problem. As you may know, the Windows Explorer always tries to get information from every file on the disk. Exe files are even more problematic in Windows Vista, since there is a UAC that tries to find out whether the exe file has a manifest. If the answer is yes, the Explorer shows a shield icon on the icon next to the name. Maybe that could be the reason.
In this case, the exe file must not be empty. You can also rename any other none-exe file to make it work (or not work).
5 Responses
Daniel Wischnewski
26|Jul|2008 1Hi,
I have tried it. I created an empty .exe file. Closed Explorer and opened the folder with this empty .exe again. I selected the file and hit the [DEL] key. And after requesting whether I really want to delete the file it was deleted. No problem whatsoever. Windows Vista Ultimate German, all Patches applied.
Christian Wimmer
26|Jul|2008 2As I said I have no idea why this happens. I see the file handle in the handles list of ProcessExplorer. Usually one could close such a hande but not this one.
I also checked the thread status to see if there are any running external threads : nothing.
To my suprise the explorer of another user works fine on the same Windows. So I suspect it is something with my own user profile.
CodeX
26|Jul|2008 3I can confirm, that there are strange problems with the explorer of Vista.
I had a similar but not the same problem.
I reorganized some bigger files (~100mb) until one of them couldn’t be moved. It was copied to the new location but still remained in the old place as well. When selecting it and hitting Shift+Del it disappeared immediately without any dialog! But refreshing that folder showed that file again. Hitting just Del gave the common dialog but told afterwards that it’s not possible to delete the file. Command line didn’t work as well. Closing all windows and rebooting didn’t help either.
Maybe I should mention that however the filesitze was still shown as 100mb I couldn’t access the content of the file anymore.
I solved it by using the little tool Unlocker. It showed that the file is used twice by explorer.exe. I used the free & delete options to get rid of the file. Afterwards I was also able to delete the folder the file has been in, using the normal way in the explorer.
Christian Wimmer
26|Jul|2008 4Yes I know the Unlocker. And I also did try it out. However it could find no handle to it to close. So it was useless.
yogi yang
28|Jul|2008 5I think (with my limited knowledge) that this problem is not only with VISTA. It also exist in XP. I have faced it.
My problem was such that even after rebooting my PC I could not delete the file as well as folder. I did everything that I could but nothing allowed me to delete.
So ultimately I booted in Win2000 and then deleted the file from there and everything got deleted immediately.
Again after some days I faced this same problem but this time the storage media was a USB pen drive. An you know what? I could not delete with XP even after changing to another physical PC, but could delete it from Win2000.
I fired up one of my favorite tracing tools Handles, RegMon and FileMon from http://www.sysinternals.com.
After tracing I came to the conclusion that whenever XP misses to release the Handle of a file that particular file cannot be deleted even if we change from one XP (physical PC) to another XP (physical PC).
Leave a reply
Search
Paypal donation (EUR)
Categories
Most Viewed
Archives
Tags
ACL callback COM Conversion CreateProcess DACL Delphi dialog DidYouKnow DLL documentation Download elevation factory file Handle header HowTo interface JWA JWSCL Kernel Microsoft KillProcess Laptop mail mailinglist manifest permission Privilege Process ProcessExplorer RunEl Russinovich Service Setup Sid TerminateProcess Theme Thread Token UAC user Vista Window WindowsRecent Posts
Recent Comments
Blogroll
Pages
Meta
A design creation of Design Disease
Copyright © 2007 - JEDI Windows API - is proudly powered by WordPress
InSense 1.0 Theme by Design Disease brought to you by HostGator Web Hosting.