Reading HDD serialNo

E

ezelsari85

Hi all,

Could you help me please to find out how to read the harddisk serial
number in java ?

Thanks a lot!!
 
E

ezelsari85

No matter learning how to do it in C or Java . I want to get the source
code of reading the serial number of HDD.
Is there another way to find the source code of reading serial number
or the HDD?

thanx!!
 
G

Gordon Beaton

Could you help me please to find out how to read the harddisk serial
number in java ?

Three simple steps:

1: learn how to do it in C
2: learn about JNI
3: write a native method that invokes the code from step 1

/gordon
 
G

Gordon Beaton

No matter learning how to do it in C or Java . I want to get the
source code of reading the serial number of HDD. Is there another
way to find the source code of reading serial number or the HDD?

Use Runtime.exec(). Run "vol" on windows or "hdparm -i /dev/hda" as
root on Linux. Parse the output to get the serial number.

Hope that the system doesn't have SCSI disks, which don't have serial
numbers.

Google "HDD serial number" would have found this information for you.

/gordon
 
J

James McGill

thank you!!
I am trying to import the source code to java by using JNI.

That might be more work than you're anticipating. Make a JNI "Hello
World" first.
 
R

Roedy Green

Could you help me please to find out how to read the harddisk serial
number in java ?

If you can't find it predone, I would be willing to research and write
the code for you for a fee. The trick is to do it in C and provide JNI
glue. I did it years ago in DOS using assembler. However, over the
years security closes holes. It may not be possible to do it anymore
unless the OS has an API for it. Getting the volser should be easier
-- the name you assign yourself to the volume.

I presume you are doing this for some sort of copy protection scheme.
You might be interested in http://mindprod.com/products1.html#PENTIUM
which will give you the Pentium CPU serial number.
 
R

Real Gagnon

(e-mail address removed) wrote in @g10g2000cwb.googlegroups.com:
thank you!!
I am trying to import the source code to java by using JNI.

For Windows, use the following API wrapped in a JNI routine :

FUNCTION long GetVolumeInformationA &
(string lpRootPathName, REF string lpVolumeNameBuffer,
long nVolumeNameSize,
REF long lpVolumeSerialNumber, REF long lpMaximumComponentLength,
REF long lpFileSystemFlags, REF string lpFileSystemNameBuffer,
long nFileSystemNameSize)
LIBRARY "Kernel32.dll"

Bye.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top