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.

To Jose Gimenez

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

To Jose Gimenez

Mensaje por Xailer »

Helo again jose
How serious may be a suspicious pointer conversion, when a function works well with the above warning. This warning concerns this code

char_t *pLicenseHash = AnsiToWide(hb_parc( 1 ));
wchar_t *pUserName = AnsiToWide(hb_parc( 2 ) );
wchar_t *pOrganization = AnsiToWide(hb_parc( 3 ) );
wchar_t *pCustomData = AnsiToWide(hb_parc( 4 ) );
wchar_t *pMachineID = AnsiToWide(hb_parc( 5 ) );
sLicenseFeatures pF ;
wchar_t *pKeyName = AnsiToWide(hb_parc( 20 ));
wchar_t *pKeyValueName = AnsiToWide(hb_parc( 21 ));
int a ;
wchar_t pBuffer [2048];
// Initialize Strcture with 0's
pF.NumDays = 0 ;
pF.NumExec = 0 ;
pF.CountryId = 0 ;
pF.Runtime = 0 ;
pF.GlobalMinutes = 0 ;
pF.NetInstances = 0 ;
pF.EmbedLicenseInfoInKey = 0 ;
pF.EmbedCreationDate = 0 ;
pF.ExpDate.wYear = 0 ;
pF.ExpDate.wMonth= 0 ;
pF.ExpDate.wDay = 0 ;
pF.InstallDate.wYear = 0 ;
pF.InstallDate.wMonth = 0 ;
pF.InstallDate.wDay = 0 ;
pF.cb = sizeof(pF);
// Load structure with Real data
pF.NumDays = hb_parni( 6 ) ;
pF.NumExec = hb_parni( 7 ) ;
pF.CountryId = hb_parni( 8 ) ;
pF.Runtime = hb_parni( 9 ) ;
pF.GlobalMinutes = hb_parni( 10 ) ;
pF.NetInstances = hb_parni( 11 ) ;
pF.EmbedLicenseInfoInKey = hb_parni( 12 ) ;
pF.EmbedCreationDate = hb_parni( 13 );
pF.ExpDate.wYear = hb_parni( 14 ) ;
pF.ExpDate.wMonth= hb_parni( 15 ) ;
pF.ExpDate.wDay = hb_parni( 16 ) ;
pF.InstallDate.wYear = hb_parni( 17 ) ;
pF.InstallDate.wMonth =hb_parni( 18 ) ;
pF.InstallDate.wDay = hb_parni( 19 ) ;
// call the function
a = WLGenLicenseRegistryKeyExW(
pLicenseHash,
pUserName,
pOrganization,
pCustomData,
pMachineID,
&pF,
pKeyName,
pKeyValueName,
pBuffer);
switch (a)
{
case wlNone:
{
hb_storc("",22);
hb_retni(a);
} break ;
default:
{
hb_storclen( pBuffer,a, 22 ); <--- Here is the warning
hb_retni(a);
} break ;
}
}

If i use hb_storclen(WideToAnsi(pbuffer),a,22) the warning stops to exist but the function is not working.
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:

To Jose Gimenez

Mensaje por jfgimenez »

Dionisis,
> How serious may be a suspicious pointer conversion, when a
> function works well with the above warning. This warning
> concerns this code
>
>
> wchar_t pBuffer [2048];
> ...
> hb_storclen( pBuffer,a, 22 ); <--- Here is the
>
>
> If i use hb_storclen(WideToAnsi(pbuffer),a,22) the warning
> stops to exist but the function is not working.
The simplest way to avoid the warning is doing a 'casting':
hb_storclen( (LPSTR) pBuffer, a, 22 );
However, in this case, the warning is not important, since pBuffer is a
string (nevermind if it's a wide or ansi string), and you are returning
it from the function. It's the caller function who should care about its
format (ansi or wide).
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