Page 1 of 1

serial number SD CARD

Posted: Wed Jul 01, 2009 4:44 pm
by Otto
How to get serial number of a SD CARD?
Thanks in advance
Otto

Re: serial number SD CARD

Posted: Thu Jul 02, 2009 3:04 am
by Richard Chidiak
Otto

test anyfile on the sd

sample

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

hth

Richard

Code: Select all


#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



 

Re: serial number SD CARD

Posted: Thu Jul 02, 2009 10:30 am
by Otto
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

Re: serial number SD CARD

Posted: Thu Jul 02, 2009 2:08 pm
by Richard Chidiak
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

Re: serial number SD CARD

Posted: Thu Jul 02, 2009 4:40 pm
by Otto
Richard, thank you. That is good, that is what I need.
So I can use this number to protect the software.
Thanks again,
Otto