This is part of the Windows security system that was implemented, I believe starting with Windows Vista, but perhaps it started with Windows 7.

To make sure that viruses have a harder time installing malware, executables cannot write to Program Files unless they are elevated. Files that are written to Program Files are actually placed in another folder, for where see http://stackoverflow.com/questions/11348965/where-does-windows-7-put-files-saved-to-program-files.

You can either have users run your program with elevated permissions, or, what I think makes more sense, is to create those folders under the User folder, not in the ParamStr(0) folder. This is consistent with the current Windows security philosophy.

You can use SHGetFolderPath with the CSIDL_APPDATA parameter to get the User folder.


At 02:09 PM 9/4/2014, Wilfried Mestdagh wrote:
Hi,

When I write a program, then it create a few folders in the application
directory for initialization files and data files. I use therefore
AppPath := ExtractFilePath(ParamStr(0));
And ForceDirectories(...) to create the folders.

This has always worked, also on Windows Vista (32bit and 64bit) and later.
Now for the first time at a customar it did not worked. The directories and
files where created but I could not locate where it was (I assume somewhere
in the user directories).

To overcome this problem I copied my executable on another directory in the
C drive (not program files), then it worked.

I once had this problem also in a C# NTService. It was something with the
execution directory. I solved this, but this is Delphi 7...

Maybe ParamStr(0) does not (sometimes) point to the real directory? Someone
can advice here?

Note: This customer is the first customer I met where UAC was still on!
Something to do with that? (normally everyone has switched this stupid thing
off...)

thx

--
mvg, Wilfried
http://www.mestdagh.biz
http://www.comfortsoftware.be
http://www.expertsoftware.be

_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to