HASP HL working demo needed for C#

后端 未结 1 796
轻奢々
轻奢々 2021-01-19 03:15

Okay. Well, I know this question has a good chance of being closed within the first 10 minutes, but I am going to ask it anyways for I have spent almost day and an half tryi

相关标签:
1条回答
  • 2021-01-19 04:02

    It might be that you aren't having all dependencies for the HASP runtime. I'm packing with the app:

    hasp_windows_NNNNN.dll (NNNNN = your number)
    hasp_net_windows.dll
    MSVCR71.DLL (added manually)
    msvc runtime 80
    

    One runtime library is required by HASP and it doesn't tell you which one unless you put it in the DEPENDS.EXE utility (you probably have you on your Visual Studio installation).

    To log in (and read some bytes):

                byte[] key = new byte[16];
                HaspFeature feature = HaspFeature.FromFeature(4);
                string vendorCode = "your vendor string, get it from your tools";
                Hasp hasp = new Hasp(feature);
                HaspStatus status = hasp.Login(vendorCode);
                if (HaspStatus.StatusOk != status)
                {
                    //  no license to run
                    return false;
                }
                else
                {
                    //  read some memory here
                    HaspFile mem = hasp.GetFile(HaspFileId.ReadOnly);
                    mem.Read(key, 0, 16);
                    status = hasp.Logout();
                    if (HaspStatus.StatusOk != status)
                    {
                        //handle error
                    }
                }
    

    Hope it helps. My HASPed software works like a charm. BTW, wasn't able to put envelope around .NET app under no combination of settings.

    0 讨论(0)
提交回复
热议问题