which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@5943 c028cbd2-c16b-5b4b-a496-9718f37d4682
302 lines
5.4 KiB
C
Executable File
302 lines
5.4 KiB
C
Executable File
#ifdef DUMBFLL
|
||
#include "../foxlck/pro_ext.h"
|
||
#else
|
||
#include <windows.h>
|
||
|
||
/* Visual Basic interface with OLE 2 */
|
||
#ifdef DUMBDLLVB
|
||
#include <compobj.h>
|
||
#include <dispatch.h>
|
||
#include <variant.h>
|
||
#include <olenls.h>
|
||
#endif
|
||
|
||
#endif
|
||
|
||
#include <stdio.h>
|
||
|
||
#ifdef _MSC_VER
|
||
#define _BreakPoint() __asm \
|
||
{ \
|
||
int 3h \
|
||
}
|
||
#endif
|
||
|
||
#include "hlapi_c.h"
|
||
|
||
#define MODULE 26952
|
||
#define REFKEY "CAMPOKEY"
|
||
#define VERKEY "ìpÙˆ¬cê<"
|
||
|
||
unsigned int getser();
|
||
int CGetAut(int);
|
||
|
||
#ifdef DUMBFLL
|
||
int FAR Fox_HL_LOGIN()
|
||
#else
|
||
int far pascal _export hl_login()
|
||
#endif
|
||
{
|
||
int status;
|
||
#ifdef DBG
|
||
_BreakPoint();
|
||
#endif
|
||
status = HL_LOGIN(MODULE, DONT_CARE, REFKEY, VERKEY);
|
||
getser();
|
||
#ifdef DUMBFLL
|
||
_RetInt(status,10);
|
||
#endif
|
||
return status;
|
||
}
|
||
|
||
#ifdef DUMBFLL
|
||
int FAR Fox_HL_LOGOUT()
|
||
#else
|
||
int far pascal _export hl_logout()
|
||
#endif
|
||
{
|
||
HL_LOGOUT();
|
||
return 0;
|
||
}
|
||
|
||
#ifdef DUMBFLL
|
||
static void load_string(char * str_to_load, ParamBlk far * param)
|
||
{
|
||
Value val;
|
||
Locator loc;
|
||
int i;
|
||
|
||
loc = param->p[0].loc;
|
||
loc.l_subs = _ALen(param->p[0].loc.l_NTI, AL_ELEMENTS);
|
||
for (i = 0; i < 16; i++)
|
||
{
|
||
loc.l_sub1 = i+1;
|
||
_Load(&loc,&val);
|
||
if (val.ev_type == 'N')
|
||
str_to_load[i] = (char) (long)val.ev_real;
|
||
}
|
||
str_to_load[16] = '\0';
|
||
}
|
||
|
||
|
||
static void store_string(char * str_to_store, ParamBlk far * param)
|
||
{
|
||
Value val;
|
||
Locator loc;
|
||
int i;
|
||
|
||
loc = param->p[0].loc;
|
||
loc.l_subs = _ALen(param->p[0].loc.l_NTI, AL_ELEMENTS);
|
||
|
||
for (i = 0; i < 16 ; i++)
|
||
{
|
||
loc.l_sub1 = i+1;
|
||
_Load(&loc,&val);
|
||
if (val.ev_type == 'N')
|
||
{
|
||
val.ev_long = (unsigned char)str_to_store[i];
|
||
val.ev_real = (double) val.ev_long;
|
||
_Store(&loc,&val);
|
||
}
|
||
}
|
||
}
|
||
#endif
|
||
|
||
#ifdef DUMBDLLVB
|
||
static void load_string(char * str_to_load, SAFEARRAY FAR** sa)
|
||
{
|
||
long lLb, lUlb,l;
|
||
int i;
|
||
unsigned char element;
|
||
|
||
if (*sa == NULL)
|
||
return ;
|
||
|
||
if ((*sa)->cDims != 1)
|
||
return ;
|
||
|
||
if (FAILED(SafeArrayGetLBound(*sa, 1, &lLb)) ||
|
||
FAILED(SafeArrayGetUBound(*sa, 1, &lUlb)))
|
||
return ;
|
||
|
||
for (l = lLb, i = 0; l <= lUlb && i < 18; l++, i++)
|
||
if (FAILED(SafeArrayGetElement(*sa, &l, &element)))
|
||
return;
|
||
else
|
||
str_to_load[i] = element;
|
||
}
|
||
|
||
|
||
static void store_string(char * str_to_store, SAFEARRAY FAR** sa)
|
||
{
|
||
long lLb, lUlb,l;
|
||
int i;
|
||
unsigned char element;
|
||
|
||
if (*sa == NULL)
|
||
return ;
|
||
|
||
if ((*sa)->cDims != 1)
|
||
return ;
|
||
|
||
if (FAILED(SafeArrayGetLBound(*sa, 1, &lLb)) ||
|
||
FAILED(SafeArrayGetUBound(*sa, 1, &lUlb)))
|
||
return ;
|
||
|
||
for (l = lLb, i = 0; l <= lUlb && i < 18; l++, i++)
|
||
if (FAILED(SafeArrayPutElement(*sa, &l, &str_to_store[i])))
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
#ifdef DUMBFLL
|
||
int FAR Fox_HL_CODE(ParamBlk far *param)
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
int far pascal _export hl_code(SAFEARRAY FAR** sa)
|
||
#else
|
||
int far pascal _export hl_code(char * kk)
|
||
#endif
|
||
#endif
|
||
{
|
||
char data [18];
|
||
|
||
#ifdef DUMBFLL
|
||
load_string(data, param);
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
load_string(data, sa);
|
||
#else
|
||
strncpy(data,kk,18);
|
||
#endif
|
||
#endif
|
||
HL_CODE(EYECAST data,2);
|
||
#ifdef DUMBFLL
|
||
store_string(data, param);
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
store_string(data, sa);
|
||
#else
|
||
strncpy(kk,data,18);
|
||
#endif
|
||
#endif
|
||
}
|
||
|
||
|
||
#ifdef DUMBFLL
|
||
int FAR Fox_GETSER()
|
||
#else
|
||
int far pascal _export hl_getser()
|
||
#endif
|
||
{
|
||
int r;
|
||
r = getser();
|
||
#ifdef DUMBFLL
|
||
_RetInt(r, 10);
|
||
#endif
|
||
return r;
|
||
}
|
||
|
||
|
||
#ifdef DUMBFLL
|
||
int FAR Fox_GETSTR(ParamBlk FAR *parm)
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
int far pascal _export hl_getstr(SAFEARRAY FAR ** sa)
|
||
#else
|
||
int far pascal _export hl_getstr(char * kk)
|
||
#endif
|
||
#endif
|
||
{
|
||
char chiave[18];
|
||
char tmp_str[18];
|
||
char chiave_segreta[8];
|
||
int i;
|
||
int j;
|
||
int module;
|
||
int ok ;
|
||
|
||
#ifdef DUMBFLL
|
||
load_string(chiave, parm);
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
load_string(chiave, sa);
|
||
#else
|
||
strncpy(chiave,kk,18);
|
||
#endif
|
||
#endif
|
||
HL_CODE(EYECAST chiave, 2);
|
||
|
||
strcpy(chiave_segreta,"P39S41");
|
||
module = 0;
|
||
ok = 0;
|
||
for (i = 0; i<9;i++)
|
||
if (i>5)
|
||
chiave[i] = chiave[i] - chiave[i-6];
|
||
else
|
||
chiave[i] = chiave[i] - chiave_segreta[i];
|
||
strncpy(tmp_str,chiave+6,3);
|
||
tmp_str[3] = '\0';
|
||
module = atoi(tmp_str);
|
||
ok = CGetAut(module);
|
||
strcpy(tmp_str,chiave);
|
||
for (i = 0, j=5;i<6; i++, j--)
|
||
chiave[i] = tmp_str[j];
|
||
chiave[6] = '0';chiave[7] = '0';
|
||
chiave[8] = ok ? '1': '0';
|
||
for (i=8;i>=0;i--)
|
||
if (i>5)
|
||
chiave[i] = chiave[i] + chiave[i-6];
|
||
else
|
||
chiave[i] = chiave[i] + chiave_segreta[i];
|
||
for (i=9;i<16;i++) chiave[i] = ' ';
|
||
chiave[16] = '\0';
|
||
HL_CODE(EYECAST chiave,2);
|
||
#ifdef DUMBFLL
|
||
store_string(chiave, parm);
|
||
#else
|
||
#ifdef DUMBDLLVB
|
||
store_string(chiave, sa);
|
||
#else
|
||
strncpy(kk,chiave,18);
|
||
#endif
|
||
#endif
|
||
return 0;
|
||
}
|
||
|
||
#ifdef DUMBFLL
|
||
|
||
FoxInfo DumbFoxInfo[] =
|
||
{
|
||
{ "HL_LOGIN", (FPFI)Fox_HL_LOGIN, CALLONLOAD, "" },
|
||
{ "HL_LOGOUT", (FPFI)Fox_HL_LOGOUT, CALLONUNLOAD, "" },
|
||
{ "HL_CODE", (FPFI)Fox_HL_CODE, 1, "R" },
|
||
{ "HL_GETSER", (FPFI)Fox_GETSER, 0, "" },
|
||
{ "HL_GETSTR", (FPFI)Fox_GETSTR, 1, "R" }
|
||
};
|
||
|
||
FoxTable _FoxTable =
|
||
{
|
||
(FoxTable FAR *)0,
|
||
sizeof(DumbFoxInfo)/sizeof(FoxInfo),
|
||
DumbFoxInfo
|
||
};
|
||
|
||
|
||
#else
|
||
|
||
int CALLBACK LibMain (HINSTANCE hinst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
|
||
{
|
||
int rt = hl_login();
|
||
return rt == STATUS_OK;
|
||
}
|
||
|
||
int CALLBACK WEP (int nExitType)
|
||
{
|
||
if (nExitType == WEP_FREE_DLL)
|
||
hl_logout();
|
||
return 1;
|
||
}
|
||
#endif
|
||
|