Windows takes more time than usual to know that an executable file has been closed or is not used

1

0

Okey my fault, only my fault.

Trying to speed up an old laptop, I searched for registry tweaks and perform many of them on this computer. Windows 7 Enterprise, 64 bits.

I found some of this tweaks were not really good things. For example, one of them cause, hanging application to automatically close. Or other behavior was that under low memory conditions it automatically closed apps.

So I went and tried to reverse them and apparently it did.

But my computer is still having a very strange behavior. I'm going to try to say it in a single phrase: it takes more time than usual for windows to know that an executable file has been closed or is not used.

For example, I have a batch file that compiles a file (Delphi), then compresses it, then signs it, all via old good MSDOS command batch. This started to behave strangely, now after copying the file, many times I get access denied errors to that file. At first I thought it was either the antivirus, or antimalware, or the VCS that was locking the newly created files, but not, I have stripped the computer of those software and the problem persist.

Another example, I put executable "dummy.exe", say a standalone executable built in Delphi, in directory "c:\mydirectory". I execute the file, than close it. Then I tried to delete the file and Windows tells me that I can't, that the file is open... but it is not, I closed it. I just wait a couple of minutes, try later and now it works.

What missing or changed registry key could be causing this behavior?

EDIT 1:

Using Sysinternal's Handle, I found the process blocking my file was the PID:4, which is the NT Kernel and System.... so, what is really going on here !? :(

EDIT 2:

I think I'm sure what is the problem, but still don't know how to fix it. I remember some "tweak" was related to UAC. The file was just created by Delphi running as Administrator, if I run the Command Prompt as administrator and run my batch to copy/aspack/sign it works smoothly. It is when I run the batch directly by double clicking the batch file that the locking is fired.

Also, there's still the other weird. A newly created folder in which I drop and executable (say notepad.exe), then run it, then close it, keeps locked and can't be deleted. This is not normal, I just checked in a few other computers.

EDIT 3:

I can confirm that just by opening the Windows Explorer and have it "viewing" the directory where my exe and batch resides (even if I run my batch directly from a previously opened CMD prompt session), it causes the files to being locked and get: "The process cannot access the file because it is being used by another process." So, it is the Windows Explorer viewing my files, which causes this lock..... but again,why? And Windows Explorer extension could be? I have Mozy backup and use Tortoise for version control, both have installed items under "File" menu.

Craig Stevensson

Posted 2014-06-24T16:08:48.500

Reputation: 297

The behavior you describe isn't handled by a registry key. I would either restore your system from a backup and/or backup your personal files and install the operating system again. – Ramhound – 2014-06-24T16:15:16.323

It is caused by a registry key... because it wasn't working this way... it just stared to fail just after I "tweaked" it ... what I plan to do if no one could guess what is happening here, is to review again each "tweak"/registry key against freshly installed Windows 7 SP 1, than compare values against mine. – Craig Stevensson – 2014-06-24T17:16:54.353

1Since you don't indicate what tweaks you did exactly its hard to be sure if the tweaks are the reason or something else is the reason. – Ramhound – 2014-06-24T18:03:45.387

Use Sysinternals' Handle to find out what blocks your file. Run Command Prompt as administrator (right click-> run as administrator), go to the folder where you have handle.exe (by using cd or pushd), then type this: handle C:\YourFilePath\YourFile.exe . If it happens again, do this and put here the output.

– Jet – 2014-06-24T18:30:06.850

@jet Thanks for your help. Actually I tried that too, and it says "No matching handles found"... :( ... I am suspecting it is the Windows Explorer it self.. now that I went to MSDOS directly without having the Explorer open, the file does not block... EDIT, I caught it now. It says it is the PID:4, which is.... System / NT Kernel & System. – Craig Stevensson – 2014-06-24T20:22:04.453

Answers

1

The problem was caused by disabling the service Application Experience. After enabling it again, everything works as it should. :)

Thank you very much for helping troubleshooting this one. The use of "Handle" was very helpful, cause it helped me to narrow down the exact moments where the files were being locked.

This is where I find the clue to solve this problem: http://social.msdn.microsoft.com/Forums/office/en-US/40f15ae2-017d-4101-aff8-3981964addb3/error8-unable-to-copy-file-objdebugxxxexe-to-bindebugxxxexe-access-to-the-path?forum=visualstudiogeneral

Craig Stevensson

Posted 2014-06-24T16:08:48.500

Reputation: 297

Interesting, and how it could block files? Currently it's not running in my PC and I don't remember when I last saw it running. – Jet – 2014-06-26T10:05:33.913

This service is part of an infrastructure that automatically applies software updates to programs to make sure that they run on newly released service packs and newly released versions of the Windows operating system. But if it is not working how does it block it? I suppose there's another complementary service that do that, try to use Application Experience and during the attempt it blocks the file until it times out. It's my theory. – Craig Stevensson – 2014-06-26T13:57:36.310