C# exe 与 exec 的返回值

发布于 2024-12-21 04:36:38 字数 599 浏览 3 评论 0原文

我在使用 inno setup 时遇到问题。我正在使用 inno 安装更新,并且使用 update.exe 用户会获得一个带有许可证号的 txt 文件。在他的设备上,该许可证号可由 dll 函数读取。

在安装过程之前,我必须比较这些数字。仅当这些数字相同时,用户才会尝试使用正确的许可证在正确的计算机上安装更新。

如果我将这个检查放入一个单独的exe中,那么通过更改exe而不执行任何操作(没有错误代码)就很容易破解它。所以我想将检查分成单独的exe(我在其中检查其他一些东西,例如安装的版本号等)和update.exe

在更新exe中,我想读取updatepackage内的txt文件 - 这很容易。 在 check.exe 中,我想调用内部 dll 并获取机器的许可证号。我必须以 int 形式返回这个数字。 C# 允许我这样做。

但是我怎样才能在 innosetup 中得到这个数字呢?

我尝试获取此错误代码(0 =错误 - 版本不正确等,XXXXXXXXX =机器的许可证号)。但错误代码在 inno.h 中只有 2 个字符。我只得到 2 个字符...

将数字保存在另一个文件中不是解决方案,因为用户可以通过这种方式破解它...是否可以将数字放入 inno 而不给用户操作的机会?

i have a problem using inno setup. I'm installing an update with inno, and with the update.exe the user get a txtfile with a licencenumber. On his Unit this licencenumber readable by a dll function.

Before the installingprocess i have to compare these numbers. Only if this numbers are identical the user is trying to installing the update on the right machine with the right licence.

If i would put this check into an seperate exe, it would be easy to crack it by change the exe with one just doing nothing (no errorcode). So i want to split the checking into the seperated exe (where i check some other things like installed version number etc.) and the update.exe

In update exe, i want to read the txtfile inside the updatepackage - this is easy.
In check.exe i want to call the internal dll and get the licencenumber of the machine. I have to return this number as an int. C# allows me to do that.

But how can i get this number in innosetup?

I tried to take the errorcode for this (0=error - not right version etc, XXXXXXXXX = licencenumber of machine). But the errorcode is just 2 chars in inno. I get only 2 chars...

Saving the number in another file would'nt be a solution cause the user can crack it this way... Is it possible to get the number into inno without giving the user the chance to manilpulate??

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

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

发布评论

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

评论(1

原谅过去的我 2024-12-28 04:36:38

如果将代码移动到 DLL(COM 或普通的 stdcall DLL)中,那么 Inno 可以使用它并在它们之间传递额外的数据,包括完整的字符串等。

If you move the code into a DLL (either COM or a plain stdcall DLL) then it can be used by Inno and pass extra data between them including full strings, etc.

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