HASP HL​​工作演示所需的C# [英] HASP HL working demo needed for C#

查看:955
本文介绍了HASP HL​​工作演示所需的C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好。好吧,我知道这个问题具有的前10分钟内被关闭一个很好的机会,但我要问它反正因为我已经花了差不多一天半,试图找到一个解决方案。不过,我不明白这一个。没有这个连上HASP(SafeNet公司)的网站,虽然他们有演示多的信息在互联网上。

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 trying to find a solution. Still, I can't figure this one out. There is not much info on this on the Internet not even on the HASP (safenet) website although they have demos.

我有一个HASP HL​​ USB加密狗。我尝试将他们的演示和测试运行,但对我的生活中,我根本无法得到它登陆均匀。它使提高的 Aladdin.HASP.HaspStatus.HaspDotNetDllBroken 例外。

I have a HASP HL USB dongle. I try to convert their demo and test run it but for the life of me I simply can't get it to login even. It keeps raising Aladdin.HASP.HaspStatus.HaspDotNetDllBroken exception.

不过,如果我跑他们的演示的C版本,它完美的作品。

However, if I run the C version of their demo, it works perfectly.

下面是Csharp的版本,我的code:

Here is the Csharp version of my code:

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

我想登录到USB HASP并获得其HaspID,并在其记忆中的设置。

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

在此先感谢,

推荐答案

这可能是你没有让所有依赖关系HASP运行。我的包装与应用程序:

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

一个运行时库需要通过HASP,它不会告诉你哪一个,除非你把它放在带的Depends.exe实用程序(你可能有您的Visual Studio安装的)。

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
                }
            }

希望它帮助。我HASPed软件的工作原理就像一个魅力。顺便说一句,是不是能够把周围的.NET应用程序包下的设置没有结合。

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.

这篇关于HASP HL​​工作演示所需的C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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