Unique ID code

cpp.net Portugal
  • 13 years ago

    Hi,

    I just finished my application (with c++/CLI) and now I inserted the licence code, It worked perfectly until I tried it in another computer with a non administrator user login. The licence was basically a key calculated form the registry value
    ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography’ ‘MachineGuid’. With this key I calculated a string that is used to crossreference with the cliente’s name and create the activation password.

    The code used to obtain the key from registry is as follows:

    RegistryKey ^MyKey2 = Registry::LocalMachine->CreateSubKey("SOFTWARE\\Microsoft\\Cryptography");
    CriptString = MyKey2->GetValue("MachineGuid")->ToString();

    Again, it works fine until I change the user. Is ther a way to obtain this key? Maybe trough ‘System.Security.Cryptography’?

    One other way I thought was with ‘System.Guid‘ if I could generate always the same GUID in the same machine, or find if it was created on that particular machine would be fine to.

    The third way I found was with ‘GetVolumeInformation API’ and use the disk serial to create my installation key. But the problem I found here is that I have to call unmanaged c++ code in my c++/CLI program and I’ve been getting these errors:

    Error 39 error C2872: 'IDataObject' : ambiguous symbol c:\...\include\oleidl.h 1760
    Error 43 error C2371: 'IDropTarget' : redefinition; different basic types c:\...\include\oleidl.h 4448
    And so on.

    Or is there another value in the registry that is on a accessible part of the registry am I can use to the licensing code?

    I’m a vb6/little VB.NET user and I just started with C++/CLI.

    Thanks in advance

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“XML is like violence - if it's not working for you, you're not using enough of it.”