问题
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.
Thanks.
回答1:
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.
See: http://technet.microsoft.com/en-us/sysinternals/dd581628 for details and source code.
来源:https://stackoverflow.com/questions/4913258/how-to-create-a-undeletable-registry-key-or-file-in-c