myles
myles

Reputation: 1

Windows 7 How to write to "Programs Folder\app directory" using visual studio

I have developed software and am trying to protect it from being copied from one machine to another by writing all of the machine MAC addresses to a text file in the root apps folder for the program on the first run of the app. Everytime the app is run thereafter it checks to see if the text file is there and compares data in the text file to the mac addresses on the computer it is being run on. If they are differant the program fails to run.

If someone tried to just copy the directory they would also copy the text file and when they tried to run the app on another computer it would fail.

It is not a problem to write something to the virtual store but the program can then be copied and run on a unauthorized machine.

I need to write one text file one time.

Thanks, Myles

Upvotes: 0

Views: 743

Answers (2)

Hans Passant
Hans Passant

Reputation: 941377

You got only one shot at this, which is all you need. The setup.exe program for your app will run with admin privileges. Write a custom action to get that file created.

I'll avoid talking about the merits of security through obscurity. Or the enormous trouble you'll get into when an important client suddenly can't use mission critical software anymore because of a hardware upgrade.

Upvotes: 1

KristoferA
KristoferA

Reputation: 12397

With UAC enabled you can't do that without the user's permission. Write data files to the user's app data folder instead...

Upvotes: 1

Related Questions