Network copy-protection

Posted on 1998-12-02
Last Modified: 2013-11-20
I'm writing an application and don't want a user that bought a single user license to run my application on multiple computers in a LAN.
On a Mac it's "quite easy" to seek for a particular application and serial number on the network in order to check if the same licensed application is already running on another computer.
I would like to have the same kind of feature on my Windows MFC app.
Up to now I found the CSocket class which allows to communicate but it seems the "client" app needs the "server" computer address.
What I need is:
- broadcast my app name and serial number and make this information available all over the LAN, to "anyone"
- check the network for a broadcasting and get any serial number associated with my app name.
How is this possible with Windows (NT/95/98) computer and LAN ?
Question by:SergeDePauw
  • 8
  • 4
  • 2
  • +1

Expert Comment

ID: 1325634
I would look into the mailslot network communication process to do such a thing.

The way it works is that your app opens a mailslot for writing, sends its data.
Other apps periodically check the mailslot and may or may not find such data, if so then they would stop working.

Mailslots are easy to use and there are a couple of samples in MSDN. I have also done a simple mailslot demo program that I could maybe email you.

The second thing would be to look into Microsoft License API (LSAPI). It is designed specifically for your problem.
LVL 86

Expert Comment

ID: 1325635
plaroche - mailslots are not too bad, but the problem is that the LAN has to be a (NT) domain (when you want to use them in a 'broadcast' manner), which makes it inconvenient to use for an IP network (or, e.g. a Netware LAN)...
SergeDePauw - i'd like to point you to RPC, as it uses all network transports available for Win32 platforms. If you decide to take a look at it and find it usable, maybe we can discuss how to go on...

Author Comment

ID: 1325636
"plaroche", you're right Mailslots seems easy but as "jkr" says they also have a reduced "scope of use" because they depend on the kind of network used.

I checked LSAPI but it seems to be just an API that Microsoft would like to be used by "licensing" softwares packages. And, besides the fact that I don't want to develop it as a package, I want ot develop such capabilities. So LSAPI won't help in my case because I don't care about standardizing the API of my network copy-protection engine.

"jkr"'s idea seems more attractive to me. The only problem I have is that I can't find a place where I could download a "basic" sample application source code. I didn't find it in my Visual C++ environment and the Microsoft web site has a broken link to this sample code.
"jkr" could you help a bit more and tell me where to start ? (as I red the documentation, I would need to use only the very basic features of RPC, so a "very basic" sample code might directly solve my problem).

Thanks again for your help.
LVL 86

Expert Comment

ID: 1325637
Well, as a starting point, i'd recommend '\DEVSTUDIO\VC\SAMPLES\SDK\RPC\WHELLO' on the VC cdrom (but _really_ only as a starting point to get familiar with RPC - this example has nothing to do with licensing strategies). Just as a (strategical ;-) hint: We wrote a RPC-based license server for the same purposes 'bout half a year ago that accepts incoming connections limited to the number of clients that are allowed to run in the LAN...

Expert Comment

ID: 1325638

if a protocol which is base on connnectlessness, you can broadcast the serial to every host on the LAN when application starts. broadcast a few times to make sure every host can receive it.
when the host has a thread running to check the broadcast , when it receive , it can check whether the serial is same .

or you can build a serial check server process, every host send its serial to it and server check whether it is valid. but i think this is not a good idea .

LVL 86

Expert Comment

ID: 1325639
SergeDePauw - what did you think of the example?
wyy_cq - it's getting a bit annoying that you always lock questions without any consideration of the discussion before...

Author Comment

ID: 1325640
jkr: I've build the "DEVSTUDIO\VC\SAMPLES\SDK\RPC\WHELLO" sample and it works fine. It seems to be what I'm looking for.
The only question I have is:
when using the server and client on the same computer it works fine, but if the client is on another computer in the network I have to provide the server name. Does that mean my "protection" procedure should get the list of all computers in the network and then try to call the RPC on each of them ?

wyy_cq: sorry but I don't know what is connnectlessness, where can I find more info. about it ?

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

LVL 86

Expert Comment

ID: 1325641
This would also be a possibility, but 'browsing' a subnet isn't too easy. My idea would be to use one machine as a 'dedicated' license server which acceps as many connections as you allow - and if no more connection is accepted, the client application won't start.

PS: 'connectionless' protocols are for example UDP (another IP protocol such as TCP), and it means that network packets are simply sent to a destination address without knowing about an existing connection (i.e. if these packets are lost, nobody in the network layer cares ;-) - only works in IP based networks.

Expert Comment

ID: 1325642
UDP / IPX are the protocol need not connectness.
one process send the data to a host , and the protocol will not undertake the destination can receive the data.

so i recommend you send the data for a few times. general speaking the 80% data can reach the destination .
with the UDP /IPX protocol you can broadcast the data to all the hosts in the LAN.

"building a serial check server process" this solution will need a more host , and more your application need to know the server's IP address. this will make configuration be complication.

RPC need NT ,and M$ RPC are not compatible with the old-standard RPC protocol absolutely.

LVL 86

Expert Comment

ID: 1325643
>>RPC need NT ,and M$ RPC are not compatible with the old-
>>standard RPC protocol absolutely.

Sorry, that's simply wrong - RPC even works with Win3.x, fine with Win9x and even on UN*X

>>"building a serial check server process" this solution will
>>need a more host

This is also wrong - you can run it on any client machine...

Author Comment

ID: 1325644
jkr said:

"My idea would be to use one machine as a 'dedicated' license server"

As my application is a "out-of-the-shelf" package I can't dedicate a server as I know nothing about the network it will be running on (I even don't know if there will be a network).

So, my conclusion is that if I go for RPC I'll have to browse the network to get all potential servers. I guess I'll need to do the same as what happens when you open the "network neighborhood" window. Isn't there a way to do that easily by calling an OS proc somewhere ?

Is it true that "RPC needs NT" as wyy_cq says ?
I need something that runs on Win 95/98 as well.

wyy_cq: If the idea you're proposing works only for IP based network then it's not what I'm looking for.
LVL 86

Expert Comment

ID: 1325645
"RPC needs NT" is _definitely_ wrong (read my last comment ;-)
I can say that because we use a lot of (self-written) RPC apps, and they all run on NT (3.5x and 4.0), Win95 and Win98
(If you have doubts, check the freeware utility 'RpcExec' available at ;-)

And you don't need a 'dedicted' machine - i just thought of an _application_ that serves this purpose... (can also run on the same machine...)

>>So, my conclusion is that if I go for RPC I'll have to browse
>>the network to get all potential
You could use 'NetServerEnum()' to achieve this - if you don't provide an app that manages all licenses in a LAN, that's the way to go...

Author Comment

ID: 1325646
jkr - Great!

Thank you for your help.
I guess it will be able to have a good start from what you told me.

Now, I'd like to "transfer" you the points for this question so instead of "adding comments" to this question, you should send an answer so I can "accept" it.

Maybe you'll hear from me in the future asking for more detailed questions about RPC if I find a problem I can't solve by myself.

Thanks again.
LVL 86

Expert Comment

ID: 1325647
Fell free to ask further questions if you encounter any problems...
LVL 86

Accepted Solution

jkr earned 400 total points
ID: 1325648
Ooops - checked the wrong button, as i got used to commenting ;-)


Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 166
Folder Comparison 12 52
tripleUp challenge 7 67
Problem to event 3 52
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now