I can get serial number of HDD, But i dont know how to change serial number. Could you please help. Sure but it has nothing to do with Visual Basic as you can't change the eeprom (Electrically Erasable Programmable Read-Only Memory) chip the hard disk drive serial number is on in any way, shape or form with code of any kind. You have to physically access the eeprom with an eeprom programmer to do that. HDD information include serial number, firmware, model name, drivetype (fixed, removable, etc.) Background. There are many ways to get HDD information in Windows such as win API, WMI, third party SDK, etc. Wmi is very slow and doesn't work on mini windows XP platform. Third party SDK or libs are generally charged. Native coding with C/C++, Delphi.

P: n/a | This is the exact same information WMI gives you that I posted (did you read through until about 1/2 way down where it explains how disk information works?).. Device type is on win32_diskpartition ... it explains the mapping with the logicaldisk record ..here is some simple code it was leading towards as an example (it explained the associators etc). using System; using System.Collections.Generic; using System.Text; using System.Management; namespace ConsoleApplication31 { class Program { static void Main(string[] args) { ManagementScope scope = new ManagementScope(@'rootcimv2'); ObjectQuery query = new ObjectQuery('select * from Win32_DiskPartition'); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); ManagementObjectCollection drives = searcher.Get(); foreach (ManagementObject current in drives) { Console.WriteLine('device id = ' + current['deviceid']); ObjectQuery associators = new ObjectQuery('ASSOCIATORS OF {Win32_DiskPartition.DeviceID=' + current['deviceid'] + '} where assocclass=Win32_LogicalDiskToPartition'); searcher = new ManagementObjectSearcher(scope, associators); ManagementObjectCollection disks = searcher.Get(); foreach (ManagementObject disk in disks) { Console.WriteLine('tdevice id = ' + disk['deviceid']); } } } } } Cheers, Greg Young MVP C# http://codebetter.com/blogs/gregyoung 'Zeeshan' <Ze*****@discussions.microsoft.comwrote in message news:BF**********************************@microsof t.com... Thanx for answering. I think you didnt get my question but as i solved my problem , it like that HANDLE hDeviceHandle = NULL; char drive[] = {', ', '.', ', 'A', ':', 0}; DWORD driveMask = GetLogicalDrives(); for(int i = 0; i < 26; i++) { BOOL b = (driveMask & 1); if( b ) { drive[4] = 'A' + i; //printf('Drive: %sn', drive); hDeviceHandle = CreateFile(drive , 0, 0, NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL); if (hDeviceHandle != (HANDLE)-1) { STORAGE_DEVICE_NUMBER sdn; DWORD returned; if (DeviceIoControl( hDeviceHandle,IOCTL_STORAGE_GET_DEVICE_NUMBER,NULL ,0,&sdn,sizeof(sdn),&returned,NULL)); { printf('tDevice type: %d number: %d partition: %dn',sdn.DeviceType, sdn.DeviceNumber, sdn.PartitionNumber); } } } } Regards :) |
|