Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Reading HDD serialNo

Thread view: 
ezelsari85@gmail.com - 31 Mar 2006 13:16 GMT
Hi all,

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

Thanks a lot!!
Gordon Beaton - 31 Mar 2006 13:24 GMT
> 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

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

ezelsari85@gmail.com - 31 Mar 2006 13:30 GMT
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!!
Gordon Beaton - 31 Mar 2006 13:40 GMT
> 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

Signature

[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e

ezelsari85@gmail.com - 31 Mar 2006 14:46 GMT
thank you!!
I am trying to import the source code to java by using JNI.
James McGill - 31 Mar 2006 17:24 GMT
> 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.
Real Gagnon - 01 Apr 2006 00:05 GMT
ezelsari85@gmail.com wrote in news:1143812782.462105.118020
@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.

Signature

Real Gagnon  from  Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to  
* http://www.rgagnon.com/howto.html

Roedy Green - 31 Mar 2006 19:16 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.