|
-
Aug 28th, 2006, 01:35 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Lock File
hi
I am makeing a small program that will enable the user to select an exe program and it makes it password protected, basily all it does is combine the exe to protect into the main exe, witch is then run and prompts for a password, if the password is correct the exe to run is extracted and then executed.
now what I whould like to know is how can I lock this file, meaning when the app is extracted as explained above and run, I need a way for the user 1 not to rename , copy or move the file.
any ideas?
Thanks.
When your dreams come true.
On error resume pulling hair out.
-
Aug 28th, 2006, 01:39 PM
#2
Re: Lock File
You can never completely lock a file anyway.
May I ask what its going to be used for?
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 28th, 2006, 01:53 PM
#3
Frenzied Member
Re: Lock File
Do you have adminrights to the machine where this program runs?
If so, you can use NTFS permissions to restrict the user's access to the exe.
Another option is to encrypt the exe, decrypt it when needed and when done delete the decrypted exe.
I would also tell the user not to touch anything in the installationfolder so he won't break things.
If you need to be sure, train a dog to bite him if he does anyway.
-
Aug 28th, 2006, 02:06 PM
#4
Thread Starter
Hyperactive Member
Re: Lock File
yes I have adminsotrator rights, I am not sure encrypting will help becuase even when decryped and run, the app can still be selected , moved and copyed, bascily I want it so it shows the message if a user tryes to do any of the above.
---------------------------
Error Copying File or Folder
---------------------------
Cannot copy app.exe: It is being used by another person or program.
Now I was looking at LockFile API but I can;t seem to find an example, does anyone know were I may find one.
Thanks
When your dreams come true.
On error resume pulling hair out.
-
Aug 28th, 2006, 02:59 PM
#5
Thread Starter
Hyperactive Member
Re: Lock File
Sorted I figured it out very simple as well I feel such a Noob now. anyway if someone wants to know here is the code,
lets say you run Demo.exe and then you have some other app with the line of code in
Open "C:\demo.exe" For Binary Lock Read As #1
when you execute that code it will lock demo.exe when it running so even if you try t copy move, rename etc you get an error messae. o made sure in your program you also put close#1 somewere
anyway thanks; for the help.
When your dreams come true.
On error resume pulling hair out.
-
Aug 28th, 2006, 04:25 PM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|