HASP HL ​​working demo needed for C #

Good. Well, I know that this question has a good chance of being closed for the first 10 minutes, but I'm going to ask about it anyway, because I spent almost a day and a half trying to find a solution. However, I cannot understand this. There is not much information about this on the Internet, even on the HASP (safenet) website, although they do have demos.

I have a HASP HL ​​USB dongle. I'm trying to convert their demo version and check it out, but for life I just can't get her to log in. He continues to raise the Aladdin.HASP.HaspStatus.HaspDotNetDllBroken exception .

However, if I run a version of their demo, it works fine.

Here is the version of my Csharp code:

Aladdin.HASP;
HASP myHasp = new HASP();
var thestatus = myHasp.Login(vender_code);
myHasp.Logout;

I would like to enter the USB HASP and get its HaspID and settings in my memory.

Thanks in advance,

+5
source share
1 answer

You may not have all the dependencies for the HASP runtime. I pack the application:

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

HASP requires one runtime library, and it does not tell you which one if you did not put it in the DEPENDS.EXE utility (you may have it installed on Visual Studio).

To enter (and read several 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 this helps. HASPed software works like a charm. BTW, could not place the envelope around the .NET application without a combination of settings.

+3
source

All Articles