PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → How I  can access an Wibu Codemeter (Dongle)
How I can access an Wibu Codemeter (Dongle)
Iniciado por satmax, 08,may. 2016 21:41 - 5 respuestas
Publicado el 08,mayo 2016 - 21:41
Hi!

I`m brand new with windev (at the moment I use the express edition), and will try to implement the wibu codemeter dongle in a project.

How I can access an Wibu Codemeter (Dongle)

In c:

CMACCESS cmAcc;
memset(&cmAcc, 0, sizeof(cmAcc));

cmAcc.mflCtrl |= CM_ACCESS_NOUSERLIMIT;
cmAcc.mulFirmCode = 104711;
cmAcc.mulProductCode = 114711;

HCMSysEntry hcmse = CmAccess(CM_ACCESS_LAN, &cmAcc);

IF(NULL == hcmse)
{
// No fitting license entry or CmContainer found.
}
ELSE
{
// The handle to the wanted license entry or CmContainer
// in the wanted subsystem is returned.
}


Here is my starting point:
hInst is int
hInst = LoadDLL("WibuCm32.DLL")
IF hInst = 0 THEN
Error(ErrorInfo())
ELSE
Info("DLL loaded")


CallDLL32("WibuCm32", "CmGetInfo", par1, par2)

FreeDLL(hInst)
END

How can I build a C structure like this:


typedef struct __CMACCESS {
CMULONG mflCtrl;
CMULONG mulFirmCode;
CMULONG mulProductCode;
CMULONG mulFeatureCode;
CMULONG mulUsedRuntimeVersion;
CMULONG midProcess;
CMUSHORT musProductItemReference;
CMUSHORT musSession;
unsigned char mabIPv4Address[4];
CMBOXINFO mcmBoxInfo;
} CMACCESS;
Miembro registrado
102 mensajes
Publicado el 09,mayo 2016 - 12:34
Hi Markus,

welcome to WinDev.

Please have a look at the API() function:

http://doc.windev.com/en-US/…

Struct is structure
sString is string
END
AStruct is Struct
API(<DLL>, <Function>, &AStruct)


Maybe you don't know, there also is a german speaking forum: http://www.windevforum.de

HTH
Sebastian

--
http://arnoldconsult.de
WinDev 20 with Oracle, WinDevMobile Android Apps and Motorola Windows CE Mobile Barcode Scanners, Python 3 with Oracle and MySQL
Publicado el 10,mayo 2016 - 15:25
THX, I found it before I see this post. :) Yes, I'm also on the windevforum.de. :)

I'm looking now for sizeof(stCmEntryInfo), I found no function for this.
Miembro registrado
102 mensajes
Publicado el 10,mayo 2016 - 16:10
Markus,

this sounds pretty much like length of a string. Try

Length( stCmEntryInfo )


http://doc.windev.com/en-US/…

HTH
Sebastian

--
http://arnoldconsult.de
WinDev 20 with Oracle, WinDevMobile Android Apps and Motorola Windows CE Mobile Barcode Scanners, Python 3 with Oracle and MySQL
Publicado el 10,mayo 2016 - 20:33
no, lenght() works only for strings. but not for structures or array of structures:

stCmEntryInfo is STCMBOXENTRY2
arrPBuffer is array of STCMENTRYDATA

nRet=Length(stCmEntryInfo) // wrong syntax.

But in principal I can read the data from the codemeter dongle, I calculate the size manually... :)
Publicado el 11,mayo 2016 - 15:22
PC Soft gives me the answer:
The size of a structure is returned by the Dimension() command.

http://doc.windev.com/en-US/…

for me:
API("WibuCM32.dll", "CmGetInfo", nHandleCm, CM_GEI_ENTRYDATA, &arrPBuffer, Dimension(arrPBuffer[1])*nItems)