in

Support Portal

HASP dialog boxes

Last post 02-20-2008 11:10 AM by Jeremy Freed. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 08-24-2007 5:03 PM

    • jsavage
    • Top 25 Contributor
    • Joined on 08-24-2007
    • Patch Code
    • Points 16

    HASP dialog boxes

    How can the HASP dialog boxes for driver not installed and missing dongle be suppressed?  I am running as a service on Windows XP and having a dialog box pop up is unacceptable. 

    • Post Points: 7
  • 08-27-2007 2:35 PM In reply to

    Re: HASP dialog boxes

    We have no control over those HASP dialog boxes. They are produced by the vendor that supplies our protection software. Our only suggestion is to make sure the driver is properly installed and a dongle is attached before running.

    Bob Dunphy 

     

    • Post Points: 4
  • 10-02-2007 10:45 PM In reply to

    Re: HASP dialog boxes

    I'm not sure if this will address your problem or not, but I believe you are referring to the dialog box that appears when using the trial version of the software.  In my setup, I was using the trial version and I saw this dialog box pop up.  Once I purchased the software and attached the HASP dongle, the pop-up boxes no longer appeared.

    I hope this helps at least a little bit.

    James
     

    • Post Points: 1
  • 10-03-2007 10:42 AM In reply to

    • jsavage
    • Top 25 Contributor
    • Joined on 08-24-2007
    • Patch Code
    • Points 16

    Re: HASP dialog boxes

    I have avoided the dialog box by using the HASP sdk.  Obviously Omniplanar could could do the same thing and not force their customers to do it.

    • Post Points: 4
  • 10-04-2007 10:53 AM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • UPC
    • Points 95

    Re: HASP dialog boxes

    What is the obvious thing you did with the HASP SDK to suppress the dialog boxes?

    • Post Points: 4
  • 10-04-2007 11:17 AM In reply to

    • jsavage
    • Top 25 Contributor
    • Joined on 08-24-2007
    • Patch Code
    • Points 16

    Re: HASP dialog boxes

     bool
    HaspKey::Check( imaging::Logger& theLogger )
    {
        int keyFound = 0;
        int actualPortNumber = 0;
        int status = 0;
        int p4 = 0;
        int  portNumber = 0;  // check all ports

        hasp( LOCALHASP_ISHASP, 0, portNumber, 0, 0, &keyFound, &actualPortNumber, &status, &p4 );

        if( status )
        {
            switch( status )
            {

            case HASPERR_CANT_OPEN_HDD:
                theLogger.Error( "HASP driver not found - please install driver.");
                break;

            case HASPERR_VERSION_MISMATCH:
                theLogger.Error( "Old HASP driver found - please update driver.");
                break;
            
            default:
                theLogger.Error( "HASP key error.");
                break;
            }

            return false;
        }

        if( !keyFound )
        {
            theLogger.Error( "No HASP key found.");

            return false;
        }

        return true;
    }


     

    • Post Points: 4
  • 10-04-2007 11:19 AM In reply to

    • jsavage
    • Top 25 Contributor
    • Joined on 08-24-2007
    • Patch Code
    • Points 16

    Re: HASP dialog boxes

     I also used the delay load linker option on the sd2.dll

    • Post Points: 1
  • 10-04-2007 11:24 AM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • UPC
    • Points 95

    Re: HASP dialog boxes

    Thank you for posting the code.  Hopefully it will be useful for anyone else with this same problem.

    We cannot do this with SwiftDecoder because it uses the envelope protection provided by Aladdin.  When a dll is envelope protected, the envelope protection code is run before any of our own code.  As a result, if a key is not connected when the dll is loaded, the envelope protection runs and checks for a key and, since no key is connected an error is raised, and the dll is unloaded. 

     

    • Post Points: 4
  • 02-19-2008 4:02 PM In reply to

    Re: HASP dialog boxes

    I need to do the same thing.  What do I need to #include and link to get access to the hasp() function?

    • Post Points: 4
  • 02-19-2008 4:40 PM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • UPC
    • Points 95

    Re: HASP dialog boxes

    You can find API documentation and samples on the Aladdin web page: http://www.aladdin.com/support/hasp/hasp4/vendor.aspx.  For specific Win32 examples, the downloads are located here: http://www.aladdin.com/support/hasp/hasp4/Win32api.aspx.

    • Post Points: 4
  • 02-19-2008 6:04 PM In reply to

    Re: HASP dialog boxes

    Okay, I got the hasp() function to return with success and detect the dongle, but then I call SD_Create() and it fails.  It throws an exception, I think during the library load.  (I can't tell for sure whether the delay loader is throwing the exception, or if it loads the library, then the actual call to SD_Create fails.)  No dialog boxes appear.

    • Post Points: 4
  • 02-20-2008 7:35 AM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • UPC
    • Points 95

    Re: HASP dialog boxes

    A few questions:

    What is the exception that is thrown when you call SD_Create?

    What is the error code returned by SD_GetLastError?

    What version of SwiftDecoder are you using?

    • Post Points: 4
  • 02-20-2008 10:43 AM In reply to

    Re: HASP dialog boxes

    I did some more tracing, and it looks like when I run under the debugger, I get this exception during the library load.  (I can't even call SD_GetLastError, because it's the LoadLibrary call that throws it.)  The exception code is 0xc06d007e.  I can't find a symbolic definition for this code.

    However, when I just execute the project, everything works fine.  It even detects whether or not the dongle is present, and bypasses the dialog boxes by not loading the library.

    Previously, it was working when I stepped through in the debugger, as long as I commented out the hasp-checking code and just called SD_Create().

    I've been through several uninstalls and reinstalls of the HASP drivers, using haspdinst.exe and hinstall.exe, and am using SwiftDecoder 7.11.  Is there a particular version of the HASP drivers I need to be using?

     Thanks for the help.

    • Post Points: 4
  • 02-20-2008 10:55 AM In reply to

    Re: HASP dialog boxes

    Part of the HASP protection mechanism looks for a debugger running before it loads our software. If it detects a debugger, it aborts the load. If you want to run a debugger for testing your code, you will need to write a software stub which provides minimum function definitions for the various SwiftDecoder methods and use this stub rather than the protected SwiftDecoder library. You can then add whatever functionality you need to these stubs to debug your code.

    • Post Points: 4
  • 02-20-2008 11:10 AM In reply to

    Re: HASP dialog boxes

    That's good to know.  That answers my questions, then.  Thanks for your help!

    • Post Points: 1
Page 1 of 1 (15 items)
Copyright Omniplanar, Inc. 2007
Powered by Community Server (Commercial Edition), by Telligent Systems