.decls-files question

Blitz3D Forums/Blitz3D Programming/.decls-files question

maverick69(Posted 2004) [#1]
Hello!

I want to protect my software using Armadillo and the ArmAccess.DLL. I've found the C/C++ Declarations that look like this:

/* These typedefs show the compiler the formats of the functions. */ 
typedef bool (__stdcall *CheckCodeFn)(const char *name, const char *code); 
typedef bool (__stdcall *VerifyKeyFn)(const char *name, const char *code); 
typedef bool (__stdcall *InstallKeyFn)(const char *name, const char *code); 
typedef bool (__stdcall *InstallKeyLaterFn)(const char *name, const char *code); 
typedef bool (__stdcall *UninstallKeyFn)(void); 
typedef bool (__stdcall *SetDefaultKeyFn)(void); 
typedef bool (__stdcall *UpdateEnvironmentFn)(void); 
typedef bool (__stdcall *IncrementCounterFn)(void); 
typedef int  (__stdcall *CopiesRunningFn)(void); 
typedef bool (__stdcall *ChangeHardwareLockFn)(void); 
typedef DWORD (__stdcall *GetShellProcessIDFn)(void); 
typedef bool (__stdcall *FixClockFn)(const char *fixclockkey); 
typedef DWORD (__stdcall *RawFingerprintInfoFn)(DWORD item); 
typedef bool (__stdcall *SetUserStringFn)(int which, const char *string); 
typedef DWORD (__stdcall *GetUserStringFn)(int which, char *buffer, DWORD bufferlength); 
typedef bool (__stdcall *WriteHardwareChangeLogFn)(const char *filename); 
typedef bool (__stdcall *ConnectedToServerFn)(void); 
typedef bool (__stdcall *CallBuyNowURLFn)(HWND parent); 
typedef void (__stdcall *ShowReminderMessageFn)(HWND parent); 
typedef void (__stdcall *ShowReminderMessage2Fn)(HWND parent); 
typedef bool (__stdcall *ExpireCurrentKeyFn)(void); 
typedef bool (__stdcall *ShowEnterKeyDialogFn)(HWND parent); 


I now tried to write a decls-file for it to get access to these function from within blitz, but I always get "Userlib function not found".

Hope someone can help me!


Dreamora(Posted 2004) [#2]
Several questions:

1) Are they exportet?
2) I'm not sure but might be that the *function might be a problem as well ... never tried it this way, I normally have

DLLEXPORT bool __stdcall function ( params );

ends with undecorated functions for usage in userlibs etc.


Boiled Sweets(Posted 2004) [#3]
Silly questions perhaps but...

1) have you put the decls file into the Blitz3d\userlibs directory?
2) what does you written decls look like? Please post it.
3) where is the .dll located?


maverick69(Posted 2004) [#4]
Yes, I have located everything correctly.

My decls-file is probably wrong because I've never had made one before:

.lib "ArmAccess.dll"
CheckCode%(name$, code$)
VerifyKey%(name$, code$)
InstallKey%(name$, code$)
InstallKeyLater%(name$, code$)
UninstallKey%()
SetDefaultKey%()
UpdateEnvironment%()
IncrementCounter%()
CopiesRunning%()
ChangeHardwareLock%()
GetShellProcessID%()
FixClock%()
RawFingerprintInfo% ( item% )
SetUserString% ( which%, string$ )
GetUserString% ( whcih%, buffer$, bufferlength% )
WriteHardwareChangeLog% ( filename$)
ConnectedToServer%()
CallBuyNowURL% ( parent% )
ShowReminderMessage% ( parent% )
ShowReminderMessage2% ( parent% )
ExpireCurrentKey% ()
ShowEnterKeyDialog% ( parent% )


Blitz now "finds" every function of the DLL, but it seems that Blitz doen't execute it. For example I always get zero back, and functions like "ShowEnterKeyDialog" does nothing.

In the Help-File of "SoftwarePassport/Armadillo" are always Declarations for Delphi, Visual Basic and Visual FoxPro. So if someone need those to help me I can post them here.


Tom(Posted 2004) [#5]
You have to let BB/the DLL know the size of the data types being passed. At a guess, try the following. (note: the 2 show reminder messages don't return anything, you you remove the % after the first funtion name else blitz will think you're returning an Int)

.lib "ArmAccess.dll"
CheckCode%(name$, code$):"_CheckCode@8"
VerifyKey%(name$, code$):"_VerifyKey@8"
InstallKey%(name$, code$):"_InstallKey@8"
InstallKeyLater%(name$, code$):"InstallKeyLater@8"
UninstallKey%():"_UninstallKey@0"
SetDefaultKey%():"_SetDefaultKey@0"
UpdateEnvironment%():"_UpdateEnvironment@0"
IncrementCounter%():"_IncrementCounter@0"
CopiesRunning%():"_CopiesRunning@0"
ChangeHardwareLock%():"_ChangeHardwareLock@0"
GetShellProcessID%():"_GetShellProcessID@0"
FixClock%():"_FixClock@0"
RawFingerprintInfo%( item% ):"_RawFingerprintInfo@4"
SetUserString%( which%, string$ ):"_SetUserString@8"
GetUserString%( which%, buffer$, bufferlength% ):"_GetUserString@12"
WriteHardwareChangeLog%( filename$):"_WriteHardwareChangeLog@4"
ConnectedToServer%():"_ConnectedToServer@0"
CallBuyNowURL%( parent% ):"_CallBuyNowURL@4"
ShowReminderMessage( parent% ):"_ShowReminderMessage@4"
ShowReminderMessage2( parent% ):"_ShowReminderMessage2@4"
ExpireCurrentKey%():"_ExpireCurrentKey@0"
ShowEnterKeyDialog%( parent% ):"_ShowEnterKeyDialog@4"


'Should' work :)
Tom


maverick69(Posted 2004) [#6]
Thank you for your post, but it doesn't work.

As soon as I let Blitz know about the size I get the Message "Userlib Function not found" during Runtime. (so proabably something with the function name is wrong???). If I remove the DLL-file I get the messeage "Userlib not found", so one thing is for sure: Blitz knows about the DLL-File.

If this helps I've uploaded the DLL to my webspace at

http://www.webart-design.de/ArmAccess.dll

and also the API Helpfile

http://www.webart-design.de/API.chm

I've also opened the DLL with PEView and everything looks fine (as far as I can see).