Log in

View Full Version : hardlock emulation


Ziggy
May 8th, 2004, 15:32
Hi.
Does anybody can help to emulate such functions:
HLM_CHECKEXPDATE
HLM_CHECKALLSLOTS

i'm talking about kernel-mode (driver level) emulation.
thanks for you answers.

SysCall
May 10th, 2004, 13:46
Hi,

do you really need to go kernel mode?
Some years ago (almost forgot) i emulated the HL API at user mode level by implementing HL API providing my own hlvdd.dll.

About kernel mode ... a good disassembly/analysis/deadlist of the kernel mode driver and its user mode equivalent (hlvdd.dll) + the HL API SDK should give some hints...

Regards

Ziggy
May 13th, 2004, 07:36
Quote:
[Originally Posted by SysCall]Hi,

do you really need to go kernel mode?
Some years ago (almost forgot) i emulated the HL API at user mode level by implementing HL API providing my own hlvdd.dll.

I also tried to make HLM emulation in such way...
But I have no possibility to discover emulation for HLM_CHECKALLSLOTS, coz I have no information about... and also have no dongle to log it's requests\responses...
Have you emulated HLM_CHECKALLSLOTS in your's hlvdd.dll?
Maybe you could help me about this (we can talk in private)

Quote:
[Originally Posted by SysCall]
About kernel mode ... a good disassembly/analysis/deadlist of the kernel mode driver and its user mode equivalent (hlvdd.dll) + the HL API SDK should give some hints...

I'm fully agree with you, but as you know that it's a large amount of obfuscated code there... Now I'm trying to discover HLM_CHECKALLSLOTS in hlvdd. It needs a lot of time and patience...
but there is so few information about HLM (RUS) functions in SDK...

thanks.

SysCall
May 13th, 2004, 14:10
Hi,

Quote:
Have you emulated HLM_CHECKALLSLOTS in your's hlvdd.dll?


that was not necessary at the time i used to emulate the user mode driver.
(the app used a subset of HL API so i implemented only necessary stuff )

Look into the HL API SDK, the C data structures (HL_LIS) of the functions are described there (.pfd, the header files ...).

I quote the relevant info (which is freely available, i downloaded the SDK some years ago from their public ftp)...

There might have been some bits changed but should give you some hints/ direction ....

Quote:

HLM_CHECKALLSLOTS(BUFLEN,BUFFER)
Checks all slots (LiMaS only).
Arguments
BUFLEN After the function is performed, this variable returns the
actual buffer length occupied. The function only returns the
required buffer length if the value of the BUFLEN and
BUFFER variables is 0. (32-bit)
BUFFER Pointer to the HL_LIS data structure which contains the slot
and license information. Refer to "The HL-LIS Data
Structure" section for more information.
Return
The return value contains the API status.
Use
If you are using licensing, this function queries the current status of all slots.
Example
result =
HLM_LOGIN(29809,DONT_CARE,"HARDLOCK","@0=/&#s3",
RUS_VK, 0,"378p,IPX";
IF (result == STATUS_OK)
result = HLM_CHECKALLSLOTS(BUFLEN,BUFFER);
.
.
result = HL_LOGOUT();
ENDIF;


Quote:

HLM_CHECKEXPDATE(SLOT,YEAR,MONTH,DAY)

Returns the expiration date (HL-RUS/LiMaS).
Arguments
SLOT Defines the slot number. Slot number 0 indicates the global
expiration date for local modules and Hardlock Server modules. For
Hardlock Server the expiration dates for the single slots (1- 32767)
can also be checked. (32-bit)
YEAR Pointer for the variable in which the expiration year is returned.
(16-bit)
MONTH Pointer for the variable in which the expiration month is returned.
(16-bit)
DAY Pointer for the variable in which the expiration day is returned
(16-bit).
Return
The system returns the API status (see chapter 4.1).
Use
If you use the expiration date option, this function checks when the license
expires. This can be done separately for each slot if you are using Hardlock
Server. The global expiration date (local and server) is returned using slot 0.
Example
result = HLM_LOGIN(29809,DONT_CARE,"HARDLOCK","@0=/&#s3", RUS_VK, 0,"378p,IPX";
IF (result == STATUS_OK)
result = HLM_CHECKEXPDATE(0, &year, &month, &day);
IF (result == RUS_DATE_EXPIRED)
PRINT("Global expiration date exceeded";
.
.
result = HL_LOGOUT();
ENDIF;



Quote:

The HL-LIS Data Structure
The HL_LIS data structure contains the global license information.
current_date 16-bit Current date (days since 01.01.1999).
res 16-bit Reserved.
num_slots 32-bit Number of slots.
glob_exp_date 16-bit Global expiration date (days since
01.01.1999).
res2 16-bit Reserved.
slots[ ] Depending on
number of slots
Pointer to the first HL_SIS structure, see
below.
The HL_SIS data structure
The HL_SIS contains license information for the individual slots.
max_user 32-bit Maximum available licenses.
cur_user 32-bit Number of licenses currently being used.
exp_date 16-bit Expiration date for this slot.
flag 8-bit 0 No singularity: Multiple calls of the
slot on one computer take up the
equivalent number of licenses.
1 Singularity: Multiple calls of the slot
on one computer only take up one
license.
reserved 8-bit Reserved.


Quote:

typedef _PACKED struct ALIGN_ { /* HL_LIS slot information */
Long max_user;
Long cur_user;
Word exp_date;
Byte flag; /* singularity flag */
Byte res; /* filler to make structure size multiple of 4 bytes */
} ALIGN_GCC HL_SIS;

/* License Information Structure (HL_LIS) */
typedef _PACKED struct ALIGN_ {
Word current_date;
Word res;
Long num_slots;
Word glob_exp_date;
Word res2; /* filler to make size multiple of 4 bytes */
HL_SIS slots[1];
} ALIGN_GCC HL_LIS;


Regards