如何在Delphi中创建不可删除的文件

发布于 2024-11-03 20:04:43 字数 450 浏览 5 评论 0原文

[以下是我之前的问题的改写,该问题被认为含糊不清]。

我正在深入研究为演示应用程序创建基本许可机制。我的想法是这样的:应用程序在第一次运行时创建一个名为“0b1xa487x.ini”的空“许可证文件”,然后在首次执行后 30 天到期,并且不能再运行太久因为系统上存在该特定文件。

我正在寻找一种方法来保护该特定文件以阻止删除。因为它将是一个空白文件,没有任何内容,所以我不介意它被损坏,有损坏的标题,无效的日期,无论需要什么才能保持不可删除。

我在某处看到了基于文件属性的类似方法(该文件已设置 HX 属性);然而,属性方法没有任何结果,因为我找不到任何有关文件属性 X 存在的记录功能。

我还知道还有其他方法,包括 rootkit 驱动程序和作为系统用户启动的系统服务,但这个特定的方法似乎最适合这种情况。再次,我概述了该文件的内容也可能无法访问,我不打算使用该方法从该文件运行任何类型的恶意软件,因为我在下面被指控:)

[the following is a rephrase of my previous question, which was deemed ambiguous].

I'm digging into creating a basic licensing mechanism for a demo application. What I have in mind goes like that: the application creates an empty "license file" called, say "0b1xa487x.ini" upon the first run, then expires 30 days after it has been first executed and can't be run anymore as long as that specific file is present on the system.

What I'm looking for is a method to protect that specific file in a way to deter deletion. Since it will be a blank file, devoid of any content, I wouldn't mind it to be corrupt, have corrupt headers, invalid date, whatever it takes to stay undeletable.

I've seen a similar approach somewhere based on file attributes (the file had the HX attributes set in place); however, the attribute approach lead me nowhere, as I can't find any documented feature on the existence of a file attribute X.

I also know that there are other approaches including rootkit drivers and system services launched as system user, but this particular one seems to fit best in this scenario. Again, I outline that the file's contents may as well be inaccessible, I'm not planning to use the approach in running any kind of malware from the file, as I've been accused below :)

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

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

发布评论

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

评论(3

最终幸福 2024-11-10 20:04:43

腐败意味着不符合某些标准。空白文件没有标准。

Corrupt suggests not conforming to some standard. There are no standards for blank files.

红颜悴 2024-11-10 20:04:43

谢谢大家的建议。我找到了一种使我的文件无法访问的方法,即通过使用文件权限的幸运组合。缺点是这些东西不适用于非 NTFS 分区。好处是,我总是可以在应用程序后进行清理,只需以编程方式删除这些权限并随后删除所有内容即可。

Thanks everybody for your suggestions. I found a way to render my file inaccessible, namely by using fortunate combination of file permissions. The downside is that these things don't work on non-NTFS partitions. The good thing is that I can always clean up after my application by simply removing these permissions programatically and deleting everything afterwards.

廻憶裏菂餘溫 2024-11-10 20:04:43

关于您对 Henk 的最后回答,我相信创建一个服务,随操作系统自动启动它,并使用 TFileStream 打开 fmShareExclusive 中的文件更容易。

但是,您不能强制操作系统内核或防病毒软件使您的文件“不可删除”。

此致,

拉杜

Regarding your last answer to Henk, I believe it is more easier to create a service, start it automatically with the OS, and open the file in the fmShareExclusive by using a TFileStream.

But, you can not force the kernel of the OS, or an antivirus to make your file 'undeletable'.

Best regards,

Radu

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