Posted by: Christian Wimmer in: Common
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.
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).