DLL32 problem

DLL32 problem

Postby Roger Seiler » Fri Jan 25, 2008 4:21 am

Antonio,

I get an "error Base/1003 variable does not exst LPLONG" when calling a dll function via DLL32. I notice that in the fwcmd.chm docs, in the explanation for DLL32 it does not list LPLONG as a data type, though it does list LPSTR. Insofar as this seems to be a common C datatype, can LPLONG be added as a valid data type used in a C function that is included in a DLL?

Specifically, I'm getting this error with the Protection PLUS function calls to its 32 bits DLL when using the command DLL32. For example:

DLL32 FUNCTION pp_checksum(filename AS LPSTR, checksum AS LPLONG) AS LONG PASCAL LIB "keylib32.dll"

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Roger Seiler » Fri Jan 25, 2008 4:58 am

I tried using PTR in the DLL32 command instead of LPLONG and that didn't work either - didn't get an error message, but the test app acted like it was stuck in a never-ending loop.

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Antonio Linares » Fri Jan 25, 2008 10:31 am

Roger,

Please use a C function instead of the DLL FUNCTION command, just to be sure its right.

You may use #pragma BEGINDUMP ... #pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Roger Seiler » Fri Jan 25, 2008 12:36 pm

Antonio,

Do you mean that I can insert a C function into an FWH prg by:

1. preceding it with the line #pragma BEGINDUMP

2. then write in a line with the C function, and then

3. follow it with the line #pragma ENDDUMP, and then

4. continue with my FWH code?

Or does the C code have to be in a separate prg?

And if #pragma enables mixing C code with FWH code, are the variables used in the C function directly visible to the rest of the FWH code?

(Obviously, I'm not much of a C programmer or I'd already know this. I've never used the #pragma capability before, so I'm learning something new here.)

Thanks!

- Roger
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby Antonio Linares » Fri Jan 25, 2008 6:27 pm

Roger,

Yes, you can include a C function in your PRG as you have described it.

Please make a search for BEGINDUMP in these forums and you will find lots of samples :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

PRAGMA

Postby TimStone » Sat Jan 26, 2008 5:29 pm

Antonio,

I've been looking at the samples and it would appear your suggestion involves placing C code directly into FWH.

Our need is to call a C function in a DLL. The problem we encounter is the Data Type LPLONG is not supported in FWH.

So, the following call:

nReturn := pp_lfopen( 'test.lf', LFOPEN_NOCACHE, LF_FILE, 'password', nLFhandle )

With the following DLL:

DLL32 Function pp_lfopen( filename As LPSTR, lfflags As LONG, lftype As LONG, password As LPSTR, handle As LPLONG) As LONG PASCAL LIB "Keylib32.dll"

Will return the error Undefined LPLONG

Can you give a quick sample of how to access the function in the DLL ... and then we can rewrite all the functions in the same manner and make the result to other FWH users who wish to access the current SoftwareKey libraries.

Thank you ...
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: PRAGMA

Postby Enrico Maria Giordano » Sat Jan 26, 2008 6:12 pm

Try:

Code: Select all  Expand view  RUN
   nReturn := pp_lfopen( 'test.lf', LFOPEN_NOCACHE, LF_FILE, 'password', @nLFhandle )


Code: Select all  Expand view  RUN
DLL32 Function pp_lfopen( filename As LPSTR, lfflags As LONG, lftype As LONG, password As LPSTR, @handle As PTR) As LONG PASCAL LIB "Keylib32.dll"


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Thank you

Postby TimStone » Sat Jan 26, 2008 7:19 pm

We tried PTR but the culprit was the missin @ for nHandle. Thank you. I'll move ahead now ... it is much appreciated.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Postby hua » Mon Jan 28, 2008 8:08 am

I use only a few of the functions provided by SoftwareKey. This is what I have so far:
Code: Select all  Expand view  RUN
DLL32 FUNCTION pp_eztrial1(file AS LPSTR, password AS LPSTR,@errcode AS LONG,@hnd AS LONG) ;
    AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_errorstr(errorcode AS LONG, @buffer AS LPSTR) ;
    AS VOID PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_lfclose(hnd AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_bitclear(bit_field AS LONG, bit_number AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_bittest(bit_field AS LONG, bit_number AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_bitset(bit_field AS LONG, bit_number AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_getvarnum(hnd AS LONG, varno AS LONG, @value AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_setvarnum(hnd AS LONG, varno AS LONG, value AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_getvarchar(hnd AS LONG, varno AS LONG, @buffer AS LPSTR) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_lfopen(filename AS LPSTR, flags AS LONG, lfType AS LONG, password AS LPSTR, @lfhnd AS LONG) ;
    AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_lfalias(lfhnd AS LONG, filename AS LPSTR, flags AS LONG, lfType AS LONG, password AS LPSTR, @lfNewest AS LONG) ;
    AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_libtest(testnum AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_redir(drive AS LPSTR) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_compno(type AS LONG, filename AS LPSTR, hdd AS LPSTR) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_copycheckth(hnd AS LONG, flags AS LONG, compno AS LONG, b AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_semopen(hnd AS LONG, sem_type AS LONG, path AS LPSTR, prefix AS LPSTR, @shnd AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_semclose(shnd AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_semcount(hnd AS LONG, sem_type AS LONG, path AS LPSTR, prefix AS LPSTR, @kount AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_upddate(hnd AS LONG, flags AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_expired(hnd AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_countinc(hnd AS LONG, var_no AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_setvarchar(hnd AS LONG, varno AS LONG, string AS LPSTR) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_valdate(hnd AS LONG) AS LONG PASCAL LIB "keylib32.dll"

DLL32 FUNCTION pp_getvardate(hnd AS LONG, var_no AS LONG, @month_hours AS LONG, @day_minutes AS LONG, @year_secs AS LONG) AS LONG PASCAL LIB "keylib32.dll"
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi, Silvio.Falconi and 36 guests