如何在C ++中创建一个不可删除的注册表项(或文件) [英] How to create a undeletable registry key (or file) in C++

查看:428
本文介绍了如何在C ++中创建一个不可删除的注册表项(或文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个游戏的时间限制版本我在C ++开发。
我已经满足一些程序创建文件我仍然无法删除,其他创建注册表键很难删除(因为有几个子键,并需要更改所有者更深入第一,删除它去

I would like to create time limited version of a game I am developping in C++. I already meet some program that create files I am still not able to delete, and other that created registry key very hard to delete (because there were several sub key and needed to change owner to the deeper first, delete it go up, change owner...).

然后我认为唯一的方法是在计算机中创建一个不是(或几乎)可删除的东西来标记开始试验。我知道如何创建密钥或文件,但不知道如何保护它们。

Then I think the only way is to create something in the computer that is not (or hardly) deletable to mark the beginning of trial. I know how to create key or file but not how to protect them.

谢谢。

推荐答案

标准Windows API无法处理键/值名称中的空字符,而本机API可以。因此,您可以创建一个在名称中包含一个或多个NULL字符的键,以存储您的许可数据,使用标准工具(如regedit)不能删除该数据。

The standard Windows API is unable to deal with null characters in key/value names, whereas the native API can. As such, you can create a key containing one or more NULL characters in the name to store your licensing data, which would not be deletable using standard tools like regedit.

请参阅: http://technet.microsoft.com/en-us/sysinternals/dd581628详情和源代码。

See: http://technet.microsoft.com/en-us/sysinternals/dd581628 for details and source code.

这篇关于如何在C ++中创建一个不可删除的注册表项(或文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆