Mochilas de protección Aladdin HASP HL Max
Publicado: Mar Oct 02, 2007 11:49 pm
/*
* Proyecto: Wrapper para mochilas Aladdin HASP HL Max.
* Fichero: Hasp.c
* Descripción:
* Autor: José Alfonso Suárez Moreno
* Fecha: 02/10/2007
*/
#include "windows.h"
#include "xailer.h"
#include "colors.ch"
#include "hasp_hl.h"
XA_FUNC( HASP_LOGIN )
{
unsigned char *vendor_code = hb_parc( 1 );
hasp_handle_t handle = 0;
hasp_status_t status;
status = hasp_login(HASP_PROGNUM_DEFAULT_FID, vendor_code, &handle);
if (status == HASP_STATUS_OK)
{
hb_retnl( handle );
}
else
{
hb_retnl( status );
}
}
XA_FUNC( HASP_LOGOUT )
{
unsigned long handle = hb_parnl( 1 );
hasp_status_t status;
status = hasp_logout(handle);
hb_retnl( status );
}
XA_FUNC( HASP_WRITE )
{
unsigned long handle = hb_parnl( 1 );
hasp_size_t offset = hb_parnl( 2 );
hasp_size_t len = hb_parnl( 3 );
unsigned char *data = hb_parc( 4 );
hasp_status_t status;
status = hasp_write(handle, HASP_FILEID_MAIN, offset, len, data);
hb_retnl( status );
}
XA_FUNC( HASP_READ )
{
unsigned long handle = hb_parnl( 1 );
hasp_size_t offset = hb_parnl( 2 );
hasp_size_t len = hb_parnl( 3 );
unsigned char *data = hb_parc( 4 );
hasp_status_t status;
status = hasp_read(handle, HASP_FILEID_MAIN, offset, len, data);
hb_retnl( status );
}
XA_FUNC( HASP_GET_SIZE )
{
unsigned long handle = hb_parnl( 1 );
hasp_status_t status;
hasp_status_t memSize;
status = hasp_get_size(handle, HASP_FILEID_MAIN, &memSize);
if (status == HASP_STATUS_OK)
{
hb_retnl( memSize );
}
else
{
hb_retnl( status );
}
}
XA_FUNC( HASP_ENCRYPT )
{
unsigned long handle = hb_parnl( 1 );
unsigned char *data = hb_parc( 2 );
hasp_size_t len = hb_parnl( 3 );
hasp_status_t status;
status = hasp_encrypt(handle, data, len);
hb_retnl( status );
}
XA_FUNC( HASP_DECRYPT )
{
unsigned long handle = hb_parnl( 1 );
unsigned char *data = hb_parc( 2 );
hasp_size_t len = hb_parnl( 3 );
hasp_status_t status;
status = hasp_decrypt(handle, data, len);
hb_retnl( status );
}
--
* Proyecto: Wrapper para mochilas Aladdin HASP HL Max.
* Fichero: Hasp.c
* Descripción:
* Autor: José Alfonso Suárez Moreno
* Fecha: 02/10/2007
*/
#include "windows.h"
#include "xailer.h"
#include "colors.ch"
#include "hasp_hl.h"
XA_FUNC( HASP_LOGIN )
{
unsigned char *vendor_code = hb_parc( 1 );
hasp_handle_t handle = 0;
hasp_status_t status;
status = hasp_login(HASP_PROGNUM_DEFAULT_FID, vendor_code, &handle);
if (status == HASP_STATUS_OK)
{
hb_retnl( handle );
}
else
{
hb_retnl( status );
}
}
XA_FUNC( HASP_LOGOUT )
{
unsigned long handle = hb_parnl( 1 );
hasp_status_t status;
status = hasp_logout(handle);
hb_retnl( status );
}
XA_FUNC( HASP_WRITE )
{
unsigned long handle = hb_parnl( 1 );
hasp_size_t offset = hb_parnl( 2 );
hasp_size_t len = hb_parnl( 3 );
unsigned char *data = hb_parc( 4 );
hasp_status_t status;
status = hasp_write(handle, HASP_FILEID_MAIN, offset, len, data);
hb_retnl( status );
}
XA_FUNC( HASP_READ )
{
unsigned long handle = hb_parnl( 1 );
hasp_size_t offset = hb_parnl( 2 );
hasp_size_t len = hb_parnl( 3 );
unsigned char *data = hb_parc( 4 );
hasp_status_t status;
status = hasp_read(handle, HASP_FILEID_MAIN, offset, len, data);
hb_retnl( status );
}
XA_FUNC( HASP_GET_SIZE )
{
unsigned long handle = hb_parnl( 1 );
hasp_status_t status;
hasp_status_t memSize;
status = hasp_get_size(handle, HASP_FILEID_MAIN, &memSize);
if (status == HASP_STATUS_OK)
{
hb_retnl( memSize );
}
else
{
hb_retnl( status );
}
}
XA_FUNC( HASP_ENCRYPT )
{
unsigned long handle = hb_parnl( 1 );
unsigned char *data = hb_parc( 2 );
hasp_size_t len = hb_parnl( 3 );
hasp_status_t status;
status = hasp_encrypt(handle, data, len);
hb_retnl( status );
}
XA_FUNC( HASP_DECRYPT )
{
unsigned long handle = hb_parnl( 1 );
unsigned char *data = hb_parc( 2 );
hasp_size_t len = hb_parnl( 3 );
hasp_status_t status;
status = hasp_decrypt(handle, data, len);
hb_retnl( status );
}
--