Página 1 de 1

UNRESOLVED EXTERNAL

Publicado: Mié Ago 15, 2012 10:38 am
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

UNRESOLVED EXTERNAL

Publicado: Mié Ago 15, 2012 4:48 pm
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,

UNRESOLVED EXTERNAL

Publicado: Mié Ago 15, 2012 5:03 pm
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

UNRESOLVED EXTERNAL

Publicado: Mié Ago 15, 2012 6:09 pm
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,

UNRESOLVED EXTERNAL

Publicado: Jue Ago 16, 2012 11:23 am
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 ();


UNRESOLVED EXTERNAL

Publicado: Jue Ago 16, 2012 6:39 pm
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

UNRESOLVED EXTERNAL

Publicado: Sab Ago 18, 2012 10:16 am
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

UNRESOLVED EXTERNAL

Publicado: Sab Ago 18, 2012 11:39 am
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

UNRESOLVED EXTERNAL

Publicado: Dom Ago 19, 2012 8:44 am
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

UNRESOLVED EXTERNAL

Publicado: Dom Ago 19, 2012 1:29 pm
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

UNRESOLVED EXTERNAL

Publicado: Mié Ago 22, 2012 5:16 pm
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

UNRESOLVED EXTERNAL

Publicado: Vie Ago 24, 2012 5:27 pm
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