简体   繁体   English

在VC ++中创建程序的有限使用版本

[英]Creating a limited use version of a program in VC++

Our company helps migrate client software from other languages to C++. 我们公司帮助将客户端软件从其他语言迁移到C ++。 We provide them C++ source code for their application along with header files and compiled libraries for runtime support functions. 我们为他们的应用程序提供C ++源代码,以及用于运行时支持功能的头文件和已编译的库。 We charge for both the migration as well as the runtime. 我们负责迁移和运行时。 Recently a potential client asked to migrate one of a number of systems they have. 最近,一个潜在的客户要求迁移他们拥有的许多系统之一。 This system contains 7 programs and we would like to limit the runtime so only these 7 programs can acess it. 该系统包含7个程序,我们希望限制运行时,因此只有这7个程序可以使用它。 We can time limit the runtime by putting an encrypted expiration date in the object library but, since we have to provide the source code for the converted programs, we are having difficult coming up with a way to limit the access to a specific set of programs. 我们可以通过在对象库中放置一个加密的到期日期来限制运行时的时间,但是由于我们必须提供转换后的程序的源代码,因此我们很难提出一种方法来限制对特定程序集的访问。 Obviously, anything we put into the source code to identify the program could be copied to any other program so the only hope seems to be having the run time library discover some set of characteristics about the programs and then validating them against a set of characteristics embedded in the run time library. 显然,我们在源代码中添加的用于标识程序的任何内容都可以复制到任何其他程序,因此唯一的希望似乎是让运行时库发现有关程序的某些特征集,然后针对嵌入的一组特征进行验证在运行时库中。 As I understand it, C++ has very little reflection capability (RTTI is all I could find) so I wanted to ask if anyone has faced a similar problem and found a way to solve it. 据我了解,C ++几乎没有反射能力(我只能找到RTTI),所以我想问问是否有人遇到过类似的问题并找到了解决它的方法。 Thanks in advance for any suggestions. 在此先感谢您的任何建议。

Based on the two answers a little clarification seems in order. 基于这两个答案,似乎需要进行一些澄清。 We fully expect the client to modify the source code and normally we provide them an unrestricted version of the runtime libraries. 我们完全希望客户端修改源代码,并且通常我们会为他们提供运行时库的不受限制的版本。 This particular client requested a version that was limited to a single system and is happy to enter into a license that restricts the use of the runtime library to that system. 该特定客户端请求的版本仅限于单个系统,并乐于输入许可,以将运行时库的使用限制为该系统。 Therefore a discussion of the legal issues isn't relevant. 因此,对法律问题的讨论是不相关的。 The issue is a technical one -- given a license that is limited to a single system and given that the client has the source to the calling programs but not the runtime, is there a way to limit access to the runtime to the set of programs comprising that system thus enforcing the terms of the license. 问题是技术性的-给定许可证仅限于单个系统,并且考虑到客户端具有调用程序的源而不是运行时,是否有办法将对运行时的访问限制为一组程序包括该系统,从而强制执行许可条款。

If they're not supposed to make further changes to the programs, why did you give them the source code? 如果不应该对程序进行进一步的更改,为什么还要提供源代码? And if they are expected to continue changing the programs (ie maintenance), who decides whether a change constitutes a new program that's not allowed to use the library? 如果期望他们继续更改程序(即维护),谁来决定更改是否构成了不允许使用该库的新程序?

There's no technical way to enforce that licensing model. 没有任何技术方法可以强制执行该许可模型。

There's possibly a legal way -- in the code that loads/enables the library, write a comment "This is a copy protection measure". 可能有一种合法的方法-在加载/启用库的代码中,写一条注释“这是一个复制保护措施”。 Then DMCA forbids them from including that code into other programs (in the USA). 然后,DMCA禁止他们将该代码包含到其他程序中(在美国)。 But IANAL, and I don't think DMCA is valid anyway. 但是IANAL,我认为DMCA仍然无效。

Consult a lawyer to find out what rights you have under the contract/bill of sale to restrict their use. 咨询律师,以了解您在销售合同/销售单中拥有哪些权利以限制其使用。

The most obvious answer I could think of is to get the name and/or path of the calling process-- simply compare this name to the 7 "allowed" programs in your support library. 我能想到的最明显的答案是获取调用过程的名称和/或路径-只需将该名称与支持库中的7个“允许”程序进行比较即可。 Certainly, they could create a new process with the same name, but they might not know to do so. 当然,他们可以使用相同的名称创建一个新进程,但是他们可能不知道这样做。

Another level could be to further compare the executable size against the known size for that application. 另一个层次可能是将可执行文件的大小与该应用程序的已知大小进行进一步比较。 (You'll likely want to allow a reasonably wide range around the expected size, in case they make changes to the source code, and/or compile with different options.) (如果它们更改了源代码和/或使用不同的选项进行编译,则您可能希望在预期的大小范围内允许合理的范围。)

As another thought, you might try adding some seemingly benign strings into the app's resources. 另一个想法是,您可以尝试向应用程序的资源中添加一些看似良性的字符串。 ("Copyright 2011 ~Your Corporation Name~")-- You can then scan the parent executable for the magic strings. (“ Copyright 2011〜您的公司名称〜”)-然后,您可以在父可执行文件中扫描魔术字符串。 If they create a new product, they might not think to create this resource. 如果他们创建新产品,他们可能不考虑创建此资源。

Finally, as already noted by Ben, if you are giving them the source code, there are likely no foolproof solutions to this problem. 最后,正如Ben所指出的,如果您向他们提供源代码,则可能没有万无一失的解决方案。 (As he said, at what point does "modified" code become a new application?) The best you will likely be able to do is to add enough small roadblocks that they won't bother trying to use that lib for another product. (正如他所说,“修改后的”代码在什么时候成为新的应用程序?)您可能将要做的最好的事情是添加足够小的路障,以使他们不会为其他产品而尝试使用该lib。 It likely depends on how determined and/or lucky they are. 这可能取决于他们的决心和/或幸运程度。

Why not just technically limit the use of the runtime to one system? 为什么不从技术上将运行时的使用限制在一个系统上呢? There are many software protection solutions out there, one that comes to my mind is SmartDongle . 有很多软件保护解决方案,我想到的是SmartDongle

Now the runtime could still be used by any other program on that machine, but I think this should be a minor concern, no? 现在,运行时仍可以由该计算机上的任何其他程序使用,但是我认为这应该是一个小问题,不是吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM