Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Modify TIniFile



Permlink Replies: 2 - Last Post: Sep 20, 2017 6:07 PM Last Post By: Colin Maharaj Threads: [ Previous | Next ]
Colin Maharaj

Posts: 122
Registered: 12/2/99
Modify TIniFile
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 14, 2017 5:51 AM
I need to do this , make changes to System.IniFile.pas, how can I recompile and make active?
Of, can I inherit and modify the function.....

procedure TMemIniFile.UpdateFile;

I am having an issue where if the target folder is not Everyone all access or the app is not
run as admin, the write fails.

I have the permission on the folder as Write to the Users group,
Remember I want to run my apps as non-admin.

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Modify TIniFile
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 14, 2017 2:20 PM   in response to: Colin Maharaj in response to: Colin Maharaj
Colin Maharaj wrote:

I need to do this , make changes to System.IniFile.pas

Why do you need to change it?

how can I recompile and make active?

Make a copy of IniFile.pas and add it to your project, then make
whatever modifications you want to the "implementation" section only.
DO NOT modify the "interface" section at all.

Note that this technique only works if you are compiling with Runtime
Packages disabled. Otherwise, you have to recompile the entire RTL.

can I inherit and modify the function.....

procedure TMemIniFile.UpdateFile;

Yes, since UpdateFile() is virtual.

I am having an issue where if the target folder is not Everyone all
access or the app is not run as admin, the write fails.

Makes sense, since TMemIniFile does not save changes to file in
real-time, like TIniFile does. They are only saved when UpdateFile()
is called.

Remember I want to run my apps as non-admin.

Obviously, you are trying to save your INI in a folder that non-admins
do not have write access to. This is a bug in your code, not in
TMemIniFile itself. Microsoft has sets asside specific folders for
this exact situation. You should be using them, not avoiding them.

--
Remy Lebeau (TeamB)
Colin Maharaj

Posts: 122
Registered: 12/2/99
Re: Modify TIniFile
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 20, 2017 6:07 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Big mistake here Remy,
I actually redid the TIniFile and saw the
same access error, apparently the User
group did not have write permission.

If I knew this I would not have written this post.
Thanks again.

On 9/14/2017 5:20 PM, Remy Lebeau (TeamB) wrote:

Colin Maharaj wrote:

I need to do this , make changes to System.IniFile.pas

Why do you need to change it?

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02