Search code examples
c#exefile-rename

C# Prevent my .exe win application on being renamed?


Hi is it possible to prevent my .exe application on being renamed..?

here is the senario(my problem)

After i Run my program, (lets say i run MyApp.exe) a unfriendly user suddenly for fun, renamed my MyApp.exe to ... lets say Goodtime.exe

after that. he log-off windows(xp) and then when my program is attempting to run on startup MyApp.exe , i wont because it got renamed

is it possible to prevent this through codes?

thanks to anyone who would help =)


Solution

  • That is not possible.

    However there is an alternative to do that. You can set the user to have limited rights on his user account to the computer. In that case he cannot rename files in such a way he wanted. This is a restriction provided by the operating system in which only the administrators of the computer can set these restrictions to user accounts.

    EDIT What I mean here is if you are the administrator of the computer, as an alternative you can manually limit the privileges of the users who logs-in to the computer. For a better understanding on what I mean, please read the replies on my post. :)