FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC serial number SD CARD
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
serial number SD CARD
Posted: Wed Jul 01, 2009 04:44 PM

How to get serial number of a SD CARD?
Thanks in advance
Otto

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: serial number SD CARD
Posted: Thu Jul 02, 2009 03:04 AM
Otto

test anyfile on the sd

sample

NSER := NumserieTarjeta(Fopen(curdir()+"\CBATIPKSAV.EXE") )

hth

Richard

Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>

HB_FUNC( NUMSERIETARJETA )
{
BY_HANDLE_FILE_INFORMATION bHinfo;

memset( &bHinfo, 0 , sizeof(bHinfo) );

GetFileInformationByHandle( (HANDLE) hb_parnl(1), &bHinfo );
hb_retnl( bHinfo.dwVolumeSerialNumber );

}


#pragma ENDDUMP
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: serial number SD CARD
Posted: Thu Jul 02, 2009 10:30 AM

Hello Richard,

Thank you for your help. I get back a number. It is working.

Do I understand the code right: F_open creates a file handle which you pass to GetFileInformationByHandle.
DwVolumeSerialNumber is a volume serial number, all files on that volume will have the same dwVolumeSerialNumber.

Do you know what happens if you xCopy one SDCARD to another.
Does the dwVolumeSerialNumber remain on the copy the same?

Thanks again,
Otto

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: serial number SD CARD
Posted: Thu Jul 02, 2009 02:08 PM

Otto

Every SD card has its own serial number

if you "xcopy" all the files from one to another, you do not copy the serial number , you can just retreive it

HTH

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: serial number SD CARD
Posted: Thu Jul 02, 2009 04:40 PM

Richard, thank you. That is good, that is what I need.
So I can use this number to protect the software.
Thanks again,
Otto

Continue the discussion