Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to know Hard drive Serial Number?

18 views
Skip to first unread message

Mota

unread,
Aug 4, 2005, 9:37:36 PM8/4/05
to
Hi;
To make a security system to prevent copying,i want to use some information
from the current
system (that my program will be installed on) hardwares.
Can anyone please help me to get for example Serial Number of the hard drive
or the BIOS serial no?
Any help is appreciated.Thank you.

david epsom dot com dot au

unread,
Aug 4, 2005, 10:01:03 PM8/4/05
to

Private Declare Function GetVolumeInformation _
Lib "kernel32.dll" Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) _
As Long

Dim SerialNum As Long

Res = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0, 0, Temp2,
Len(Temp2))


(david)

"Mota" <tavas...@hotmail.com> wrote in message
news:uiM9H5Vm...@TK2MSFTNGP12.phx.gbl...

Mota

unread,
Aug 5, 2005, 5:42:28 PM8/5/05
to
Thnak you for your attention
Have you tested this API?
I put API in a Standard Module and replaced the word "Private" with
"Public",and put the following code in a Click Event of a command button of
a form:
Dim SerialNum as long

Res = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0, 0, Temp2,
Len(Temp2))
MsgBox SerialNum
but i got zero in MsgBox.What is wrong here?Can you help me please?
In addition,I need a constant serial Number,e.g. a hard drive.Is the Volume
Serial No countable enough to be used in a Locking system of a program?Does
not it change after formating or partitioning a Hard Drive?
Thank you again for this useful API.
Waiting for its correction.

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...

Mota

unread,
Aug 5, 2005, 8:23:31 PM8/5/05
to
Waiting for your reply.

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...
>
>

WSF

unread,
Aug 6, 2005, 4:39:45 AM8/6/05
to
be patient

Mota

unread,
Aug 7, 2005, 7:34:07 PM8/7/05
to
Dear David;
Im still waiting.This API wont work and returns zero for the SerialNum.Help
me please.

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message
news:uhkkKGWm...@TK2MSFTNGP12.phx.gbl...
>
>

david epsom dot com dot au

unread,
Aug 7, 2005, 8:05:11 PM8/7/05
to

"Mota" <tavas...@hotmail.com> wrote in message
news:uNA$fdgmFH...@tk2msftngp13.phx.gbl...

> Thnak you for your attention
> Have you tested this API?

Yes.

> I put API in a Standard Module and replaced the word "Private" with
> "Public",and put the following code in a Click Event of a command button
> of a form:
> Dim SerialNum as long

dim Temp1 as string
dim Temp2 as string

Temp1 = space(250)
Temp2 = space(250)

> Res = GetVolumeInformation("c:\", Temp1, Len(Temp1), SerialNum, 0, 0,
> Temp2, Len(Temp2))

if res = 0 then
> MsgBox SerialNum
else
msgbox "Response:" & vbtab & res
endif

> but i got zero in MsgBox.What is wrong here?Can you help me please?
> In addition,I need a constant serial Number,e.g. a hard drive.Is the
> Volume Serial No countable enough to be used in a Locking system of a
> program?Does not it change after formating or partitioning a Hard Drive?

Yes, but all copy protection systems are faulty in one way or another.

Microsoft.public.access.formscoding is a good place to ask about
coding Access forms. I used this API as part of an Audit Record,
and, 7 years ago, as part of a home-grown text based replication
system, and I've passed it on to you for your consideration, but
I leave the question "how to write a good copy protection system"

(david)

Mota

unread,
Aug 7, 2005, 10:09:40 PM8/7/05
to
Its not a good or global copy protection system.I want it just for a few
untrained users that i know tham all.But in some reasons need a small
protecting system.
By the way,it doesnt work again.Just says "Response=1"
in fact,i have doubt this API work in Win XP platforms.I think need WMI to
get a full hardware infoes from win xp thru its query method,that im not so
familiar with it.
Anyway,thank you for your help.

"david epsom dot com dot au" <david@epsomdotcomdotau> wrote in message

news:eus9Zz6m...@TK2MSFTNGP12.phx.gbl...

david epsom dot com dot au

unread,
Aug 7, 2005, 10:58:28 PM8/7/05
to
It works on my copy of Windows XP.

If all the requested information is retrieved, the return value is nonzero.

If not all the requested information is retrieved, the return value is 0
(zero). To get extended error information, call GetLastError.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp

I see that WMI returns the manufacturers serial number: that wasn't so
easily available when I was using the volume serical number. You can get
WMI information from a WMI object or probably from an OLEDB provider through
ADO

(david)

"Mota" <tavas...@hotmail.com> wrote in message

news:uuiLB77m...@TK2MSFTNGP10.phx.gbl...

John Nurick

unread,
Aug 8, 2005, 1:38:39 AM8/8/05
to
On Mon, 8 Aug 2005 12:58:28 +1000, "david epsom dot com dot au"
<david@epsomdotcomdotau> wrote:

>It works on my copy of Windows XP.

On mine, too.

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.

Mota

unread,
Aug 8, 2005, 7:20:32 PM8/8/05
to
This is a Drive serial no,that changes when formatting.I need HDD
manufacurer serial no,that is accessible thru WMI.
any way,Thank you for ur attention.

"John Nurick" <j.mapSo...@dial.pipex.com> wrote in message
news:iurdf11dn8iri070a...@4ax.com...

0 new messages