Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting hardward serial number 2

Status
Not open for further replies.

GEThomas

Programmer
Nov 14, 2004
3
0
0
US
Is there any way in FoxPro that I can retrieve the serial number of the CPU or the hard drive. What I want to do is limit my program to running on a specific computer (a crude form of security). I figure if I check a hardware serial number that should do it.

Is there a DLL I could call? Any other suggestions?

Thanks.
 
Hi

Look in this link..
Copy protection routine... Your thoughts!!!!
thread184-520931

But there are other ways by which you can control even the number of users you can allow in your application. For example.. look in the FAQ..

How to limit the number of users for an application ? faq184-1263

My suggestion... limiting to harddisk.. is little cruel when the user has bought the software for use. However allowing the user to work for 'n' concurrent users as they might have taken the license is a welcome control.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
I am not selling this application. I am giving it to a few friends to evaluate and don't want it to be copied and used on another computer. If I feel that's it's worth selling, then I will implement a less strigent version of protection.

I will take a look at your suggestions.

Thanks.

 
This will work also:

? GetSerialNum("c")

FUNCTION GetSerialNum(cDrive)
* Return the HDD serial# of a Drive
local oFs, oDrive

oFs = CREATEOBJECT("Scripting.FileSystemObject")
oDrive = oFs.GetDrive(cDrive)

RETURN oDrive.SerialNumber
ENDFUNC

Darrell
 
Darrell,
Unfortunately that's the "soft" serial number that's easily changed of copied with Ghost or other similar programs.

Rick
 
Why not use WMI?
For example:

strComputer = "."
objWMIService = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive",,48)
For Each objItem in colItems
? "Caption: "
?? objItem.Caption
? "Manufacturer: "
?? objItem.Manufacturer
? "Model: "
?? objItem.Model
? "PNPDeviceID: "
?? objItem.PNPDeviceID
Next



Juri Shutenko
Municipality of Maardu, Estonia
 
Juris

I don't see a serial number in there. I must be getting old.

How about using FileScripting

Code:
On Error *
CLEAR 
loFSO = Createobject("Scripting.FileSystemObject")
Clear
colDrives = loFSO.Drives
For Each loDrive In colDrives
	If loDrive.DriveLetter = "C"
		?"Available space: " + Transform(loDrive.AvailableSpace)
		?"Drive letter: " + loDrive.DriveLetter
		?"Drive type: " + Iif(loDrive.Drivetype=1,"External",;
			IIF(loDrive.Drivetype=2,"Hard disk","CD ROM"))
		?"File system: " + loDrive.FileSystem
		?"Free space: " + Transform(loDrive.FreeSpace)
		?"Is ready: " + Transform(loDrive.IsReady)
		?"Path: " + loDrive.Path
		?"Is this a Root folder: " + Transform(loDrive.RootFolder.IsRootFolder)
		?"Serial number: " + Transform(loDrive.SerialNumber)
		?"Share name: " + loDrive.ShareName
		?"Total size: " + Transform(loDrive.TotalSize)
		?"Volume name: " + loDrive.VolumeName
	Endif
Next


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Good stuff Mike!

I would change the
?"Serial number: " + Transform(loDrive.SerialNumber)
to
?"Serial number: " + Transform(loDrive.SerialNumber,"@0")


Rob.
 
2Mike Gagnon.

FileSystemObject retuns "serial number" that is obtained by harddisk after formating.

WMI returns PNPDeviceId that contains model of the harddrive and part of the real serial number, that is set by manufacturer beside among other properties.

I think both methods FSO and WMI are suitable here.



Juri Shutenko
Municipality of Maardu, Estonia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top