Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get and store volume serial and cpu sno
Message
From
08/12/2005 11:22:29
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01076127
Message ID:
01076211
Views:
20
From my library of functions. Hope it helps.

>i use to store V.S. in
>STORE "VOLUME SERIAL" TO GCFINDSTRING,
> i thing it is slow on some computer any other way to get harddrive sno,
FUNCTION GetVolumeNumber( lcVolume )

	*------------------------------------------------------------
	* Description: GetVolumeNumber - Get the unique number associated with the boot hard drive.
	* Parameters:  lcVolume, The hard drive drive letter.
	* Return:      HDD Identifier.
	* Use:
	*------------------------------------------------------------

	LOCAL lcFileSystemName, lcVolumeName, lnFileSystemFlags, lnFileSystemNameLen, ;
		lnMaxFileNameLen, lnVolumeNameLen, lnVolumeSerialNumber

	#DEFINE ccNULL                       CHR(0)
	#DEFINE cnFS_CASE_SENSITIVE           0
	#DEFINE cnFS_CASE_IS_PRESERVED        1
	#DEFINE cnFS_UNICODE_STORED_ON_DISK   2
	#DEFINE cnFS_PERSISTENT_ACLS          3
	#DEFINE cnFS_FILE_COMPRESSION         4
	#DEFINE cnFS_VOL_IS_COMPRESSED       15

	* Declare the API function and constants.

	DECLARE GetVolumeInformation IN Win32API ;
		STRING lpRootPathName, STRING @lpVolumeNameBuffer, ;
		INTEGER nVolumeNameSize, INTEGER @lpVolumeSerialNumber, ;
		INTEGER @lpMaximumComponentLength, INTEGER @lpFileSystemFlags, ;
		STRING @lpFileSystemNameBuffer, INTEGER nFileSystemNameSize

	lcVolumeName         = SPACE(255)
	lnVolumeNameLen      = LEN(lcVolumeName)
	lnVolumeSerialNumber = 0
	lnMaxFileNameLen     = 0
	lnFileSystemFlags    = 0
	lcFileSystemName     = SPACE(255)
	lnFileSystemNameLen  = LEN(lcFileSystemName)

	GetVolumeInformation(lcVolume, @lcVolumeName, lnVolumeNameLen, ;
		@lnVolumeSerialNumber, @lnMaxFileNameLen, @lnFileSystemFlags, ;
		@lcFileSystemName, lnFileSystemNameLen)

	RETURN lnVolumeSerialNumber
ENDFUNC
>
>2: How to get cpu sno
FUNCTION GetMotherBoardSerialNumber()
	LOCAL lcNumber, loboard, locolboard, loloc, loproperty, lowmi 
	
	loloc = CREATEOBJECT('WbemScripting.SWbemLocator')
	lowmi = loloc.ConnectServer()
	lcNumber = ""

	locolboard = lowmi.InstancesOf('Win32_Baseboard')
	FOR EACH loboard IN locolboard
		FOR EACH loproperty IN loboard.Properties_
			IF INLIST(UPPER(loproperty.NAME),'SERIALNUMBER') THEN
				lcNumber  = loproperty.VALUE
				EXIT
			ENDIF
			loproperty = .NULL.
		ENDFOR
		loboard = .NULL.
		IF NOT EMPTY(lcNumber)
			EXIT
		ENDIF
	ENDFOR

	RETURN lcNumber
ENDFUNC 
>thanks
Greg Reichert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform