In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

UNRESOLVED EXTERNAL

Xailer professional forum in English
Responder
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Dear Jose
I use the following code inside a prg module. I already modify the path for OMF libraries -L [path] in project properties.
When link the above program i took the following message:
Unresolved External 'WLHardwareGetID'referenced from D:BetaOBJSupport.DBJ
The CC++ definition of the function is:
bool WLHardwareGetID (char* pHardwareId);


#pragma BEGINDUMP
#include "windows.h"
#include "xailer.h"
#include "winlicenseSDK.h"

XA_FUNC( WLHARDWAREGETID )
{
hb_retl(WLHardwareGetID(hb_parc( 1 ));

}
#pragma ENDDUMP

I sent a printscreen with the error

T.I.A
Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9445
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

UNRESOLVED EXTERNAL

Mensaje por ignacio »

Hello,
WINLICENSESDK.H is not part of Borland BCC 5.5. BTW it seems the API function you are trying to access is not part of the standard Windows API, but from a DLL who's name is WinLicenseSDK.DLL which I can not find in my system (Win 7 64). So probabily it will not exist on your clients systems.
In any case, to access a function inside a DLL you need to use the function LoadLibrary() and GetProcAdddress() to do the job.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Hello Ignacio
No that fuction is a part of a OMF library who's path is given with the linker parameter -L[PATH]. Also i iclude the header file in the top of the code.
The library seem to link corectly.
Any ideas.
T.I.A
Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9445
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

UNRESOLVED EXTERNAL

Mensaje por ignacio »

Xailer escribió el mié, 15 agosto 2012 17:03Hello Ignacio
No that fuction is a part of a OMF library who's path is given with the linker parameter -L[PATH]. Also i iclude the header file in the top of the code.
The library seem to link corectly.
Any ideas.
T.I.A

Based on then link report it seems the library is not correctly linked. BTW, searching a bit in Google, it seems that DLL is not legacy software from Microsoft but a virus. Be aware.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Hello Ignacio
I found what was wrong, and now works fine, the problem was that I forget to declare the libraries into project properties. Now i want to give me a clue about how to translate the following declarations to work in an xailer program.

void WLGetProtectionDate(SYSTEMTIME* pProtectionDate);
void WLBufferDecrypt(
void* pBuffer,
int BufferLength,
char* pPassword);
bool WLHardwareGetIDW (wchar_t* pHardwareId);
bool WLRestartApplication (void);
char* WLStringDecrypt (char* pString);
void WLSplashHide ();

Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

UNRESOLVED EXTERNAL

Mensaje por jfgimenez »

Dionisis,
> int WLGetCurrentCountry (void);
XA_FUNC( WLGETCURRENTCOUNTRY )
{
hb_retnl( WLGetCurrentCountry() );
}
> void WLBufferDecrypt(
> void* pBuffer, int BufferLength,
> char* pPassword);
XA_FUNC( WLBUFFERDECRYPT ) // WLBufferDecrypt( @cText, cPassword )
{
int nLen = hb_parclen( 1 );
char pBuffer = hb_xgrab( nLen );
strncpy( pBuffer, hb_parc( 1 ), nLen );
WLBufferDecrypt( pBuffer, nLen, hb_parc( 2 ) );
hb_storclen( pBuffer, nLen, 1 );
hb_xfree( pBuffer );
}
> bool WLHardwareGetIDW (wchar_t* pHardwareId);
XA_FUNC( WLHARDWAREGETIDW )
{
wchar_t * pHardwareId = AnsiToWide( hb_parc( 1 ) );
hb_retl( WLHardwareGetIDW( pHardwareId ) );
hb_xfree( pHardwareId );
}
> bool WLRestartApplication (void);
XA_FUNC( WLRESTARTAPPLICATION )
{
hb_retl( WLRestartApplication() );
}
> char* WLStringDecrypt (char* pString);
XA_FUNC( WLSTRINGDECRYPT )
{
hb_retc( WLStringDecrypt( hb_parc( 1 ) ) );
}
> void WLSplashHide ();
XA_FUNC( WLSPLASHHIDE )
{
WLSplashHide();
hb_ret();
}
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Hello Jose
Many many thanks for your valued help. A couple more things:
First for the XA_FUNC( WLBUFFERDECRYPT )
pBuffer [in] Pointer to a buffer to encrypt.
BufferLength [in] Size of buffer to encrypt.
pPassword [in] Pointer to a null terminated string with the encryption password.
REMARKS
The current encryption algorithm works with block multiplication factor 4 bytes. If the length of the buffer to encrypt is not factor 4 bytes, the remaining 3, 2 or 1 bytes won't be encrypted. You might want to padd first the buffer to 4 bytes multiple (adding garbage data at the end) <-- How can implemented?
Second for the function XA_FUNC( WLHARDWAREGETIDW )
With the above code return's an empty string (as declare in
parameters list to hold the ID)
C/C++ Function Declaration as follows:
bool WLHardwareGetIDW (wchar_t* pHardwareId);
Parameters
pHardwareId [out] Pointer to a buffer that will receive a UNICODE string with the hardware ID for the current machine.
And at last some help for this Q:
void WLGetProtectionDate(SYSTEMTIME* pProtectionDate);
pProtectionDate[out] Pointer to a SYSTEMTIME structure that receives the protection date.
Sorry for my ignorance for C
MANY - MANY
THANKS
Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

UNRESOLVED EXTERNAL

Mensaje por jfgimenez »

Dionisis,
> The current encryption algorithm works with block
> multiplication factor 4 bytes. If the length of the buffer
> to encrypt is not factor 4 bytes, the remaining 3, 2 or 1
> bytes won't be encrypted. You might want to padd first the
> buffer to 4 bytes multiple (adding garbage data at the end)
> <-- How can implemented?
Just add spaces to your string before passing it to the function. F.e.:
IF Len( cText ) % 4 != 0
cText += Space( 4 - ( Len( cText ) % 4 ) )
ENDIF
WLBufferDecrypt( @cText, cPassword )
> Second for the function XA_FUNC( WLHARDWAREGETIDW )
> With the above code return's an empty string (as declare in
>
> parameters list to hold the ID)
>
> C/C++ Function Declaration as follows:
> bool WLHardwareGetIDW (wchar_t* pHardwareId);
>
> Parameters
> pHardwareId [out] Pointer to a buffer that will receive a
> UNICODE string with the hardware ID for the current
> machine.
Then, the wrapper should be:
XA_FUNC( WLHARDWAREGETIDW )
{
wchar_t pHardwareId[1024]; // Resize it to the needed length
if( WLHardwareGetIDW( pHardwareId ) )
hb_retcAdopt( WideToAnsi( pHardwareId ) );
else
hb_retc( "" );
}
Now, it returns the resulting string or an empty string if the function
call fails.
> And at last some help for this Q:
> void WLGetProtectionDate(SYSTEMTIME* pProtectionDate);
> pProtectionDate[out] Pointer to a SYSTEMTIME structure that
> receives the protection date.
XA_FUNC( WLGETPROTECTIONDATE )
{
SYSTEMTIME st;
WLGetProtectionTime( &st );
hb_retdt( st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute,
(double) st.wSecond + st.wMilliseconds / 1000, 0 );
}
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Hello again jose
With your help and after few hours googling i make a few mods to your code to return a string date like this. This is my first attempt to write c code:

XA_FUNC(WLGETPROTECTIONDATE)
{
SYSTEMTIME pProtectionDate;
char buff [12];
WLGetProtectionDate(&pProtectionDate);
sprintf (buff, "%d/%d/%d", pProtectionDate.wDay, pProtectionDate.wMonth, pProtectionDate.wYear);
hb_retc(buff);
}

Now slowly i make wrappers for all easy functions in the library.
When i need help may i call you?
Where i can find the xHrbourb extend API call, because in the chm file nowhere found the hb_retcAdopt() call.
Once again many-many thanks
T.I.A
Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

UNRESOLVED EXTERNAL

Mensaje por jfgimenez »

Dionisis,
> With your help and after few hours googling i make a few
> mods to your code to return a string date like this. This
> is my first attempt to write c code:
>
>
> XA_FUNC(WLGETPROTECTIONDATE)
> {
> SYSTEMTIME pProtectionDate;
> char buff [12];
> WLGetProtectionDate(&pProtectionDate);
> sprintf (buff, "%d/%d/%d", pProtectionDate.wDay,
> pProtectionDate.wMonth, pProtectionDate.wYear);
> hb_retc(buff);
>
> }
This 'wrapper' returns a string value, while the one I wrote returns a
datetime value.
> Now slowly i make wrappers for all easy functions in the
> library.
> When i need help may i call you? :blush: Where i can find the xHrbourb
> extend API call, because in
> the chm file nowhere found the hb_retcAdopt() call.
the line:
hb_retcAdopt( WideToAnsi( pHardwareId ) );
could be changed into:
{
char *str = WideToAnsi( pHardwareId );
hb_retc( str );
hb_xfree( str );
}
as you can see, in the first case, the string is converted to ansi and
returned, leaving the task to free the used memory to the VM. In the
second case, the string is converted and returned, but the used memory
has to be freed before exiting the function. The first case is only one
line of code, and a tiny bit faster than the second case, since no new
buffer is allocated to return the string.
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Xailer
Mensajes: 328
Registrado: Mar Dic 23, 2008 5:40 pm

UNRESOLVED EXTERNAL

Mensaje por Xailer »

Hello Jose
Whith your help, already finished 50 of 150 functions in the library. One more and i am going to spend my annual vacations ( 3 weeks). I hope to catch the official announcement of Xailer 2.7 any way great job from the team.

bool WLTrialStringRead(wchar_t* pStringName,
wchar_t* pStringValue);
Parameters
pStringName [in] Name of the string to be accessed.
pStringValue [out] Value of the string stored under StringName

Once again many - many thanks
T.I.A
Dionisis Divaris
SGS-soft
Home Page :
Support at :support.sgs@gmail.com[/email]
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

UNRESOLVED EXTERNAL

Mensaje por jfgimenez »

Dionisis,
> Whith your help, already finished 50 of 150 functions in the
> library. One more and i am going to spend my annual
> vacations ( 3 weeks). I hope to catch the official
> announcement of Xailer 2.7 any way great job from the team.
>
>
> bool WLTrialStringRead(wchar_t* pStringName, wchar_t* pStringValue);
>
> Parameters
> pStringName [in] Name of the string to be accessed.
> pStringValue [out] Value of the string stored under
> StringName
I'm not sure about the second parameter. IMO, it should be wchar_t
**pStringValue, or there should be another way to obtain the required
size for the output buffer. Here you are both cases:
XA_FUNC( WLTRIALSTRINGREAD )
{
wchar_t *pStringName = AnsiToWide( hb_parc( 1 ) );
wchar_t pStringValue[1024]; // NOTICE the buffer size
if( WLTrialStringRead( pStringName, pStringValue ) )
hb_retcAdopt( WideToAnsi( pStringValue ) );
else
hb_retc( "" );
hb_xfree( pStringName );
}
XA_FUNC( WLTRIALSTRINGREAD )
{
wchar_t *pStringName = AnsiToWide( hb_parc( 1 ) );
wchar_t *pStringValue;
if( WLTrialStringRead( pStringName, &pStringValue ) )
hb_retcAdopt( WideToAnsi( pStringValue ) );
else
hb_retc( "" );
hb_xfree( pStringName );
}
Regards,
Jose F. Gimenez
http://www.xailer.com
http://www.xailer.info
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder