如何设置动态链接库的试用?

发布于 2024-08-13 10:11:20 字数 311 浏览 8 评论 0原文

我正在开发一个类似共享软件 sdk 的库(使用 C++)。该库是一个简单的dll,提供了一些功能。所以,我的第一个问题是简单的 dll 可以进行哪些类型的试验? 我不想削减试用dll的功能,所以我倾向于使用时间试用。

我大致了解如何跟踪lib的使用时间,所以第二个问题是如何指示试用期到期?

目前有两个想法:

  1. 评估期结束后,库将无法加载。

  2. 评估期结束后,库将成功加载,但会显示某种导航屏幕。

但这两个看起来都比较粗糙,所以请您给一些建议吗?

谢谢!

I'm developing a shareware sdk-like library (using C++). The library is a simple dll provides some functions. So, my first question is what types of trials are possible for simple dll?
I don't want to cut the functionality of the trial dll, so I tend to use time-trial.

I roughly understand how to track usage time of the lib, so the second question is how to indicate expiration of the trial period?

There are two ideas for the present:

  1. After evaluation period expires, the library will fail to load.

    or

  2. After evaluation period expires, the library will load successfully, but will display some kind of a nag-screen.

But both them seem quite rough, so could you please give some advices on this?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏末染殇 2024-08-20 10:11:20

当有人调用您的 DLL 函数之一时,您可能会引发“试用许可证过期”错误。它更加明确且易于用户理解。

my2cents

You can raise an "expired trial license" error when one calls one of your DLL function. It is more explicit and understandable by the user.

my2cents
年华零落成诗 2024-08-20 10:11:20

在 (1) 中,您将不得不在到期时 DllMain() 中失败。如果您的 DLL 存在于使用您的 DLL 的程序的导入表中,那就不太好了。

在(2)中,你有更多的选择,恕我直言,它更友好。

只需在过期时设置一个内部标志,然后显示一个提示对话框。

如果用户继续调用导出的函数,您将检查该标志并使对 DLL 的所有函数调用失败。

理想情况下,如果 DLL 中有 init 函数,则在调用 init() 时显示到期提示对话框并返回特殊代码,以便实现者知道并存在他的程序。

哈特哈,
埃利亚斯

In (1) you will have to fail in DllMain() on expiration. That is not that good if your DLL was present in the import table of the program that uses your DLL.

In (2) you have more choice and it is more friendly IMHO.

Just set an internal flag on expiration and then display a nag dialog.

If the user continues to call your exported functions, you check the flag and fail all the function calls to your DLL.

Ideally, if you have an init function in your DLL, then show the expiration nag dialog when init() is called and return a special code so that the implementor knows and exists his program as well.

HTH,
Elias

惟欲睡 2024-08-20 10:11:20

如果我理解正确的话,在过期之后,您不希望人们调用您的 Dll 导出表中的函数。

请注意,如果您的 Dll 加载成功,即使显示导航屏幕,人们仍然能够调用您的 Dll 代码。因此,您必须在时间检查时保护所有导出的函数。

使用导航屏幕有几个缺点:
a) 开发人员不喜欢第三方库弹出他们自己的烦人的屏幕。
b) 如果您的库在非 UI 应用程序中使用(例如在不与桌面交互的服务中使用)怎么办?

在我看来,最好的办法是允许加载库(对于您的 Dll 位于其他模块的 IAT 中的情况),但如果试用期满,则让界面中的所有导出函数返回错误代码。这样,使用您的库的应用程序可以选择忽略您的 Dll 的功能或显示一条消息,表明它已过期。

希望这有帮助。

If I understand you correctly after the expiration period you do not want that people call the functions in the export table of your Dll.

Please note that if your Dll loads successfully people will still be able to call your Dll code even if there is a nag screen displayed. Thus you would have to guard all your exported functions by the time check.

Going for the nag screen has several drawbacks:
a) Developers do not like 3rd party libraries popping up their own nagging screens.
b) What if you lib is used in a non UI app (for example used in a service that does not have interact with desktop)?

In my view the best would be to allow loading of the library (for the cases your Dll is in the IAT of other modules), but have all exported functions in your interface return an error code if the trial expired. That way the application using your library can choose to ignore the functionality of your Dll or display a message that it is expired.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文