Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2006-2010 error: "Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr"

I am getting an error after installing Delphi 2007 (Edit: This problem occurs in all Delphi versions from 2006 to 2010) that I can not figure out and have never seen before. After restarting I can launch the program without any problems, but if I were to close out of the program and start again it will give me the following error:

"Cannot create file C:\Users\Admin\AppData\Local\Temp\EditorLineEnds.ttr". The process cannont access the file because it is being use by another process."

"System" has a handle on this file that cannot be cleared unless I reboot. I can also correct the problem by renaming the file before I launch the program.

I have tried reinstalling the program with no luck.

Version installed: CodeGear™ Delphi® 2007 for Win32® R2 Version 11.0.2902.10471. Operation System: Windows 7 Pro 64bit

Update 08/14 13:35 EDT Tried the following solutions, but still having the same file lock issue:

  1. Renamed Temp Directory to a directory I know had full security rights. Files would be created in this directory when launching Delphi, but EditorLineEnds.ttr would still get locked by SYSTEM and prevent me from relaunching.
  2. Uninstalled the following security updates KB2982791 and KB2976897, but this did not solve the problem. I have suppressed windows updates for now and will try uninstalling all security patches for 8/13.
  3. Uninstalled Delphi completely and re-installed. Problem still occurs after re-installing everything.

I will try reinstalling Windows from scratch and install Delphi before Windows updates to see if updates are truly the cause. My workaround for now is just renaming EditorLineEnds.ttr before launch Delphi.

like image 880
M Schenkel Avatar asked Aug 13 '14 20:08

M Schenkel


4 Answers

There are three solutions to this that I am aware of:

  1. Try uninstalling the Windows security update KB2982791 which was already mentioned by Francisco Caffagni. This solved the issue for me (Windows 8.1 + Delphi 2007) but it might not be such a good idea to uninstall a Windows security update.
  2. Rename the file every time you start Delphi. See below for a simple program that does it for you.
  3. Use Andreas Hausladen's IdeFixpack (Delphi 2007 version, beware that version 4.4 does not work under Windows 8, version 4.3 seems to work), (for later Delphi versions) Note that the editor option Show Lineends will use a different character if you use this fix because the IDE won't load the EditorLineEnds.ttr font any more. (Solution 1 and 2 don't have this drawback, but who uses that option anyway?)

Note: Microsoft withdrew this fix a few days later and issued a new one KB2984615 on 2014-08-27. Unfortunately this did not fix the issue for me. Maybe uninstalling KB2982791 first and then installing KB2984615 might work, but I haven't tried it.

I wrote a simple program, that solves the issue for me:

It uses FindFirstChangeNotification / FindNextChangeNotification and checks whether that file exists and if yes, moves it to a unique subdirectory in %temp%.

Binary download

The source code is available from sourceforge.

like image 90
dummzeuch Avatar answered Nov 11 '22 01:11

dummzeuch


This is my bds_start.bat script running Delphi2006 on Win7-64bit system. I customized GabeMeister answer and similar script found in one of the links. I now can restart DelphiIDE without reboot. All ttr temp files are still locked by system so del command may not work. They are deletable once system is rebooted.

It's however impossible to restart Delphi double clicking myproject.dpr project files. I was afraid to install IDEFixPack for D2006 because one of comments did not promise it to work.

bds_start.bat

@REM http://www.danielmagin.de/blog/index.php/2014/08/windows-update-disable-delphi-2007-2010/
@REM http://stackoverflow.com/questions/25295980/delphi-2007-error-cannot-create-file-c-users-admin-appdata-local-temp-editorl
@REM http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/idecommandline_xml.html

@REM del files created by DelphiIDE, may not able to delete but
@REM moving to a new name is possible. Use unique name by timestamp.
del "%temp%\EditorLineEnds*.ttr"
set dt=%date%_%time:~3,2%-%time:~6,2%
rename "%temp%\EditorLineEnds.ttr" "EditorLineEnds_%dt%.ttr"
start "" "C:\Borland\BDS\4.0\Bin\bds.exe" -pDelphi

Running CBuilder change argument to -pCBuilder. Maybe best fix would be to create bds.exe replacement tool, del/move *.ttr file, run and passthrough cmd arguments to the original bds_original.exe file. This should enable *.dpr double click restarts. Or use BdsLauncher.exe which I think is regedit linked to *.dpr extension. Then process list had bds.exe name.

like image 40
Whome Avatar answered Nov 11 '22 02:11

Whome


Here is another workaround from http://www.danielmagin.de/blog/index.php/2014/08/windows-update-disable-delphi-2007-2010/

Quote:

you can rollback easy in two ways

1: create a batch file with following lines
wusa /uninstall /kb:2982791
wusa /uninstall /kb:2970228
this batch file you run on start up of windows. but with auto update both updates installs every time

2: disable the KB's from autoupdate
after update goto WindowsUpdatesin your system. disable both KB's so on new updates it will be not installed again

like image 3
Erik Virtel Avatar answered Nov 11 '22 01:11

Erik Virtel


For Delphi 2007, install IDEFixPack 4.4 and add add the following environment variable to the system settings:

IDEFixPack.DisabledPatches=DotNet.GlobalizationSearch

Reboot and it should work. I have 2 desktops with Win 8.1 Pro and its working like a charm!

like image 3
Julio Furquim Avatar answered Nov 11 '22 03:11

Julio Furquim