Recent

Author Topic: Password Protected Files  (Read 276 times)

Badger

  • Jr. Member
  • **
  • Posts: 75
Password Protected Files
« on: May 25, 2020, 01:09:13 pm »
Not sure if this should be posted here or if it should be directed to Free pascal but here goes.

I have a project that is running from a Directory and it frequently opens and saves to a number of files in a sub directory.  It would be a real problem if someone using the same computer corrupted the files either by accident or on purpose. 

What I'd like to do is protect the sub folder with a password that the program could supply when loading or saving files so the user was not aware of the need for a password.

Is this possible?
Badger

If at first you don't succeed - you're running about average!

I'm using Windows 10 Lazarus v2.0.8

eljo

  • Sr. Member
  • ****
  • Posts: 407
Re: Password Protected Files
« Reply #1 on: May 25, 2020, 01:30:43 pm »
Not sure if this should be posted here or if it should be directed to Free pascal but here goes.

I have a project that is running from a Directory and it frequently opens and saves to a number of files in a sub directory.  It would be a real problem if someone using the same computer corrupted the files either by accident or on purpose. 

What I'd like to do is protect the sub folder with a password that the program could supply when loading or saving files so the user was not aware of the need for a password.

Is this possible?
Not nativelly  no.  Create a user  in the system change the access rights of the directory to block everyone else out except the user you created. Use something like runas inernally (thread or com based on windows) to execute your program under the new user account to allow access to the directory for your program only.

Jake012345

  • Full Member
  • ***
  • Posts: 243
  • 'The knowledge is the key.'
    • FPCProjectShare
Re: Password Protected Files
« Reply #2 on: May 25, 2020, 08:14:36 pm »
Maybe Useless!


Little bit complicated...
So you can make a program what starts on startup and auto load in all files in the folder.
And now the files are unmodifiable until the program runs. (On the OnClose action, you can make a restart procedure (for the task manager))
The Reader application can send data for this application to motivate that to makes the current file free.

I hope it can be worked!
Check my ProjectShare site and share your content: FPCShare

 

TinyPortal © 2005-2018