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
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.
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
To Jose Gimenez
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
> 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