|
-
Nov 7th, 2000, 08:42 PM
#1
Thread Starter
Hyperactive Member
Hi,
I will like to know if somebody knows how to retrive the
serial number of any hard disk installed, i don´t mean
the serial number generated by the format command, i need
the serial number like the one that the PIII processor has.
Back in the days when i used to make programs in Clipper for
DOS with Summer '87 i had a library that let me obtain it, but
i didn´t ever foud the source code of it.
If you have some idea how to get it i´ll be grateful if you tell
me how...
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Nov 7th, 2000, 09:10 PM
#2
Thread Starter
Hyperactive Member
Wait a second!
Hey,
If someone could possible translate the source code, i just
found it inside a backup copy inside a zip inside...etc.
here there is:
Code:
CLIPPER USAGE:
Passed numeric int, 0 or 1 i.e. IDEHDSNUM( 0 ) or IDEHDSNUM( 1 )
Where 0 = First Hard Drive
Where 1 = Second Hard Drive
Will return a "0" string if nothing is passed or int is greater that 1
Clipper source example:
? IDEHDSNUM(0) // Display serial number of first IDE Hard Drive
? IDEHDSNUM(1) // Display serial number of second IDE Hard Drive
? IDEHDSNUM(3) // Returns "0" Character
*/
#include "extend.h"
char *getascii (unsigned int in_data [], int off_start, int off_end);
CLIPPER idehdsnum()
{
unsigned int dd [256]; /* Disk Data */
unsigned int dd_off; /* Disk Data offset */
int hd; /* Hard Drive number parameter (0 or 1) */
if ( (PCOUNT == 1) && (ISNUM(1)) )
{
hd = _parni(1); /* Assign interger parameter from Clipper for
the Hard Drive to be checked */
if( hd > 1 )
{
_retclen( "0", 1 ); /* Nothing greater that 1 allowed */
return;
}
while (inp (0x1F7) != 0x50); /* Wait for controller not busy */
outp (0x1F6, ( hd == 0 ? 0xA0 : 0xB0)); /* Get first/second drive */
outp (0x1F7, 0xEC); /* Get drive info data */
while (inp (0x1F7) != 0x58); /* Wait for data ready */
for (dd_off = 0; dd_off != 256; dd_off++) /* Read "sector" */
dd [dd_off] = inpw (0x1F0);
/* Return Hard Drive serial number as a string back to Clipper */
_retclen( getascii (dd, 10, 19), strlen(getascii (dd, 10, 19)));
}
else
_retclen( "0", 1 ); /* Send string of "0" back to indicate and error */
return;
}
char *getascii( unsigned int in_data [], int off_start, int off_end )
{
static char ret_val [255];
int loop, loop1;
for (loop = off_start, loop1 = 0; loop <= off_end; loop++)
{
ret_val [loop1++] = (char) (in_data [loop] / 256); /* Get High byte */
ret_val [loop1++] = (char) (in_data [loop] % 256); /* Get Low byte */
}
ret_val [loop1] = '\0'; /* Make sure it ends in a NULL character */
return(ret_val);
}
/*** End of File IDE_SNUM.C ***/
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Nov 8th, 2000, 10:28 AM
#3
Thread Starter
Hyperactive Member
why this?
Hi,
The reason that i have to do this is the following:
-I have to do an app that will monitor all hard drives
in a network and verify that the HD of each computer is
the HD that supouse to be installed (in case that someone replace it)
and compare the HD Serial Number with the one in a Databse.
So, this can be a very reliable security method even to the
programmers that want to have a simple way to make shareware
apps.
hope to hear from you soon...
Saludos...
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
-
Jun 5th, 2001, 03:12 AM
#4
Addicted Member
Try this example to get real HDD S/N with some ActiveX (written on C++ with source code) and example on VB how to use it.
http://www.relib.com/code.asp?id=482
Unfortunately, this page on Russian... to download zip click to
http://www.relib.com/code/x482.zip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|