Buenas tardes,
He comprobado que al hacer msginfo( SerialNumber() ), me aparecen caracteres extraños.
¿Será unicode? ¿Habrá que actualizar la función? ¿Alguna solución para saber el nº de serie de la pda en cristiano?
#include <uniqueid.h>
HB_FUNC( SERIALNUMBER )
{
DWORD dwOutBytes;
int nBuffSize = 4096;
char strDeviceInfo[ 200 ];
byte arrOutBuff[ 4096 ];
char strNextChar[ 20 ];
char SerialNo[ 18 ];
BOOL bRes = KernelIoControl( IOCTL_HAL_GET_DEVICEID, 0, 0, arrOutBuff, nBuffSize,
&dwOutBytes);
unsigned int i;
strDeviceInfo[ 0 ] = 0; // set zero to initialize string for next strcat()!
if( ! bRes )
{
bRes = KernelIoControl( IOCTL_HAL_GET_DEVICEID, 0, 0, arrOutBuff, nBuffSize,
&dwOutBytes);
}
if( ! bRes )
{
hb_retc( "00000000000000000" );
return;
}
for( i = 0; i < dwOutBytes; i++ )
{
StringCbPrintfA( strNextChar, 20, "%02X", arrOutBuff[ i ] );
fw_strcat( ( char * ) strDeviceInfo, ( char * ) strNextChar );
}
memcpy( ( char * ) SerialNo, strDeviceInfo + 40, 2 );
memcpy( ( char * ) SerialNo + 2, strDeviceInfo + 45, 9 );
memcpy( ( char * ) SerialNo + 11, strDeviceInfo + 70, 6 );
memcpy( ( char * ) SerialNo + 17, "\0", 1 );
hb_retc( ( char * ) SerialNo );
}
#include <uniqueid.h>
#include <fwppc.h>
char * fw_strcpy( char * s1, const char * s2 )
{
char * s = s1;
while( ( * s++ = * s2++ ) != 0 )
;
return s1;
}
char * fw_strcat( char * s1, const char * s2 )
{
fw_strcpy( &s1[ strlen( s1 ) ], s2 );
return s1;
}
HB_FUNC( PRUEBA_SERIALNUMBER )
{
DWORD dwOutBytes;
int nBuffSize = 4096;
char strDeviceInfo[ 200 ];
byte arrOutBuff[ 4096 ];
char strNextChar[ 20 ];
char SerialNo[ 18 ];
BOOL bRes = KernelIoControl( IOCTL_HAL_GET_DEVICEID, 0, 0, arrOutBuff, nBuffSize,
&dwOutBytes);
unsigned int i;
strDeviceInfo[ 0 ] = 0; // set zero to initialize string for next strcat()!
if( ! bRes )
{
bRes = KernelIoControl( IOCTL_HAL_GET_DEVICEID, 0, 0, arrOutBuff, nBuffSize,
&dwOutBytes);
}
if( ! bRes )
{
hb_retc( "00000000000000000" );
return;
}
for( i = 0; i < dwOutBytes; i++ )
{
StringCbPrintfA( strNextChar, 20, "%02X", arrOutBuff[ i ] );
fw_strcat( ( char * ) strDeviceInfo, ( char * ) strNextChar );
}
memcpy( ( char * ) SerialNo, strDeviceInfo + 40, 2 );
memcpy( ( char * ) SerialNo + 2, strDeviceInfo + 45, 9 );
memcpy( ( char * ) SerialNo + 11, strDeviceInfo + 70, 6 );
memcpy( ( char * ) SerialNo + 17, "\0", 1 );
hb_retc( ( char * ) SerialNo );
}
Return to FiveWin para Pocket PC
Users browsing this forum: No registered users and 7 guests