HaspFile.Write Method

Namespace: Aladdin.Hasp

Description

Writes to the memory of a Sentinel protection key.

Syntax

HaspStatus Write ( Boolean value )

Parameters

value

Boolean object to be written

Return Values

A HaspStatus status code.

Usage Notes

Use the HaspFile constructor to specify the file to write.

To start the write operation from an offset other than zero, set the property HaspFile.FilePos before you call the Write method.

When this method is called, a write cycle is performed for the Sentinel protection key. Sentinel HL keys are certified to withstand a specific number of write cycles. For information on the number of write cycles for which Sentinel HL keys are certified, see the Sentinel HL Data Sheet.

NOTE   To defeat a protection key emulator attempting to bypass software protection, you can check periodically that the protection key is available and that a session for the key exists. This should not be done using GetSessionInfo (this method does not detect a remote broken session). Instead, use one of the following methods: Encrypt, Decrypt, Read, Write. These methods will return HASP_BROKEN_SESSION if a session for the protection key does not exist.

Overloaded Methods

The following overloaded methods are provided. They differ from the method above only in the arguments that they accept.

HaspStatus Write ( Byte   value )

HaspStatus Write ( Char   value )

HaspStatus Write ( Double value )

HaspStatus Write ( Int16  value )

HaspStatus Write ( Int32  value )

HaspStatus Write ( Int64  value )

HaspStatus Write ( Single value )

HaspStatus Write ( String value )

HaspStatus Write ( UInt16 value )

HaspStatus Write ( UInt32 value )

HaspStatus Write ( UInt64 value )

The following additional overloaded method is provided:

public HaspStatus Write(Byte[] buffer,
                        Int32  index,
                        Int32  count)
Parameter Description

buffer

Byte array that contains the data to be written.

index

Index in the byte array from where data should be fetched to write. Do not confuse the index with the offset in the file from where the write operation starts.

count

Size of the data to be written in the file.

Related Topics

GetSize Method

Read Method