Hi Guys, Begging For help. How to Make a program run on only one or two computer?

JordanWhiteG

Solid State Member
Messages
19
Location
Australia
Hey everyone i'm new to this forum i look around it had good information so i thought i could post get help from here.
Just had a question---> Please Help me i really need to know------>I need a help Badly! So i just made a program and i want to protect it in this way. how can i make my application run on only one or two computers and so if the third one tries to use my application, it shuts down so third one automatically shuts down so the third one can't use it in other way if he attemps to use the program, he's copmuter will shut down. Please help me. i hope you get what i mean :p Appreciate it.
 
Are they connected to a network (internal or external)? Do you want it to run on any 2 of the 3 systems at anytime, or only a specific 2 of the 3 all the time? What language are you writing this in?
 
Um No sir no online and yes specific 2 computers or maybe 3 so the main idea is to:

put a file on those 2 specific computers and the program would check for the presence of the file. or some sort of hard-coding so maybe put a code on the Pc and make the program to verify when it first runs!
I just don't know how to do it :( i feel stupid. Please help me buddy.
Operating System: windows 7
 
Right, but what I'm asking is, say you have this scendario:

Computers A, B, C. Say A and B are using the program, so C cannot get on. But, if computer A were to quit using the program, would computer C be able to take it's place so computers B and C are running the program and A cannot get back in until B or C get off?

Using a simple check for the existence of a file is easily gotten around. Depending on what your answer is to the above scenario... you may have to have them connect to a database and check if there are already 2 systems logged into the software (set a bool field in a DB table saying it's in use or something). This is if you would like any 2 systems to be on.

If, however, you want only 2 specific systems (e.g. ONLY computers A and B can run the software, but NO other computer can run it). If this is what you want... then I've done something similar in a way. You could get the MAC address of say the ethernet adapter and use that as a hardcoded "license" to check if the software is running one of the approved MAC addresses. Now, this can be gotten around as well because people can try to spoof their MACs, but is a little more difficult to do than just checking for the existance of a file.

Also, you never said what programming language you're doing this is, because that also will affect what you could do.
 
Oh Man seems like you got what i mean awesome sir :angel:

Yes Only 2 specific Computers or maybe one . you got exactly what i mean it's like a copyright thingy but i've heard alot about hard-coding but i just don't know how to hard-code it and i'm just looking for some sort of help and maybe you can help me because it seems like it if you do it would be super super super super super awesome and i will truly appreciate it buddy!
and um about the language Umm i don't know cause i'm not really good at it i'm just learning how to do it if you could please please help me that would be awesome man!
Could you please tell me the steps on how i can do this (Either The MAC address Method Or the File thing method).
Again man thanks so much for your effort and your time and for your answer i really do appreciate it thanks alot!!

But umm i know it sounds weird but thanks you very much but Cold you please tell me how to this ??
 
Last edited by a moderator:
You wrote the program but don't know what language it's in?
Could we see the source code?

The best way would be to hardcode the MAC addresses into the program and compare the hard-coded address with one returned from the following function:
Code:
private string GetMacAddress()
{
    const int MIN_MAC_ADDR_LENGTH = 12;
    string macAddress = string.Empty;
    long maxSpeed = -1;

    foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
    {
        log.Debug(
            "Found MAC Address: " + nic.GetPhysicalAddress() +
            " Type: " + nic.NetworkInterfaceType);

        string tempMac = nic.GetPhysicalAddress().ToString();
        if (nic.Speed > maxSpeed &&
            !string.IsNullOrEmpty(tempMac) &&
            tempMac.Length >= MIN_MAC_ADDR_LENGTH)
        {
            log.Debug("New Max Speed = " + nic.Speed + ", MAC: " + tempMac);
            maxSpeed = nic.Speed;
            macAddress = tempMac;
        }
    }

    return macAddress;
}
(taken from here: Reliable method to get machine's MAC address in C# - Stack Overflow)

Then verify the returned Mac Address with one that's hard coded. And if they don't match, exit the program.

EDIT:
This will essentially whitelist computers to use your program. Every time you need to run the program on another computer, you'll have to recompile the program (unless you write the white-listed Mac Addresses to a file and read the file to match addresses)

EDIT 2: This is in C#. I Just took a Googled MAC address verification function in C# since I don't know what language you're using :tongue:
 
Last edited:
Oh boy man never seen anyone like you Gosh i dunno how to thank ya I just Wanna Kiss you But im not a gay definitely thank you and i of course Pressed the "Thanks" botton under your post :D :angel: :angel: <3 <3
U deserve bigger things !
And by the way I might use Visual Basic Or something BUT a huge thanks to you since you gave me the biggest idea.
Thanks man i'll Pm you to get more ideas from you if that's not a problem for you xD lol Sorry!
ANyways thanks so much Man!
i'll do the rest i just needed the code thing and the idea.
Again thanks for your time and help!
U can close this topic if you wish!!!!!!! LoooooooooooooVE U <3
OFF TOPIC- just a question that i'm curious plz answer OR don't answer if you don't feel like it :) : are a programmer? if so how many years have you been working on programming?
 
^ I haven't graduated yet. CarnageX up there is our resident C# expert -- I'm more of a C++ person :tongue: C++ and Linux / UNIX.

And I wouldn't suggest Visual Basic. Do something like Visual C# or Visual C++. Or just about any newer language (C++, Java, C# are just a few that come to mind). VB is outdated.

I'm fine with the PMs. However, if you need any more help, I'd suggest making another thread dealing with specific issues -- you're much more likely to get higher quality responses than I am able to provide myself.

I'm not quite a "professional" programmer -- for now it's hobbyist. I'm still a student :tongue: Been doing various languages for a few years, started with Java and HTML / CSS way back in high school.

Again, if you need any more help feel free to make another thread dealing with specific issues. You'll definitely find people willing to help out ;)
 
Back
Top Bottom