Calling Reset opens the file for writing. This is because the default value of System.FileMode is fmOpenReadWrite . Since the application is virtualized, and since your user token does not have administrator rights, the virtualization level starts and creates a copy of the file in virtual storage.
A solution available using legacy Pascal I / O is to set FileMode to fmOpenRead . Reset will then open the file for reading, and the virtualization layer will not be called.
Remember that FileMode is a global variable that affects all obsolete I / O Pascal. Woe, if you have streams, or forget to set FileMode to fmOpenReadWrite when you need to write a file. Rebellion right? Global global process flags for controlling file access mode! Well, this stuff was invented long before applications had threads. And long before OOP was invented. Therefore, I can understand why this is so.
The lesson that needs to be removed is that it's time to move on to one of the modern forms of file access. For example, TFileStream .
In fact, this is also the time when you turned off virtualization in your application. Virtualization was introduced in Vista almost 6 years ago. This was intended to help older programs that have not yet been recompiled for Vista. Your application should not use it.
source share