serial number SD CARD

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

serial number SD CARD

Post by Otto »

How to get serial number of a SD CARD?
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: serial number SD CARD

Post 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



 
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: serial number SD CARD

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: serial number SD CARD

Post 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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: serial number SD CARD

Post 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply