Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / rockey hasp dll comunication error

Author
Message
lms
9
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 4th Nov 2009 01:11
hi guys

Rockey4ND.dll that i use is made for vb

vb example


i tried to make it work in dbpro

the code like this works and i get that retcode = 4 when hasp is on pc and 3 when hasp is off pc thats cool
but the problem is that
when i put the call dll (12,"Rockey",fcode,handle< a fourth parameter the program crases i get the window with send report)
the thing is that the correct full syntaax to work is something like this
call dll (12,"Rockey",fcode,handle,lp1,lp2,p1,p2,p3,p4,buffer)

the byref commands in vb maby is the key but i dont understand what or how the hell means exactly or how to make it work almost everything i put after dll(12,"Rockey",fcode,crashes the prog

i put the dll so if u run the code u should get a 3 means not a hasp on pc
if u change value of fcode to 5 u get a 15 > is cant read hasp smthing

also passwords has Uint16bit integer &HC44C < how can i convert it to simple integer i cant say p1 = &HC44C ffs
thank u in advance

all os break

Attachments

Login to view attachments
Rudolpho
13
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 4th Nov 2009 12:05
I'm fairly certain you should substitute long with dword, not double integer

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Nov 2009 14:42
'byref' variables are actually variable addresses. You need to pass memory addresses where the DLL can write the results to. Use either MAKE MEMORY or MAKE MEMBBLOCK/GET MEMBLOCK ADDRESS for this.

lms
9
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 4th Nov 2009 21:06
can u give me a simple example with the make memory command
i cant make it work but it stopped crash
example.
i can take adress of a variable that i create a = make memory(4)
i cant take the variable handle adress which is in the hasp memory i always take 0
how to tell take adress handle in the hasp?


also make memblock/get memblock address command seems that i dont have it is it from the matrix.dll?

thanks in advanced

all os break
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Nov 2009 23:51
TBH, that interface is too complex and I'm too out-of-practice in that level of VB6 for me to try and put into an example.

&HC44C in VB6 is the same as 0xc44c in DBPro.

Make memory does not make a variable. It allocates a small chunk of memory and gives you its address so that you can pass it around into DLLs for example:


Strings are already memory addresses, as long as they contain something, so if you need to pass a string address, simply pass the string instead but make sure it's large enough to accept any changes that the DLL call makes to it.

lms
9
Years of Service
User Offline
Joined: 3rd Nov 2009
Location:
Posted: 7th Nov 2009 13:09
great thanks for the tips IT WORKED PERFECT

here is the code for rockey hasps first steps sample in dbpro
2 points of interest
a. use make memblock to get and "connect" a string adress > byref in other language
b. &HC44C in VB6 is the same as 0xc44c in DBPro


all os break
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Nov 2009 13:27
I noticed that you didn't initialise the memory for p3, p4, lp1 and lp2 - There's a good chance that initially any memory you allocate will be filled with zeros, but as your program runs and you free and allocate more memory that you will get memory that is not filled with zeros.

You also need to make sure that you use DELETE MEMORY on any memory addresses you are finished with so that you don't leak memory.

Login to post a reply

Server time is: 2019-10-18 22:33:48
Your offset time is: 2019-10-18 22:33:48