|
|
|
| Здравствуйте! При помощи какой функции можно получить размер сектора любого диска? | |
|
|
|
|
|
|
|
для: AVS
(27.10.2007 в 23:29)
| | Это скорее всего через DDK нужно обращаться, что-то никакой подходящей API-функции найти не могу... или в реестре порыться - может там где имеется. | |
|
|
|
|
|
|
|
для: AVS
(27.10.2007 в 23:29)
| | Еще можно например через WMI
нармер Свойство BytesPerSector объекта Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE0"
Как работать в WMI в Windows можно почитать здесь
http://www.codeproject.com/system/Using_WMI_in_Visual_C__.asp | |
|
|
|
|
|
|
|
для: like-nix
(30.10.2007 в 00:24)
| | вообще это было где-то в MSDN. есть функция которая принимает несколько переменных и в них записывает: рзмер сектора в байтах, размер кластера в секторах, количество кластеров (перемножив 3 числа получим разпер диска в байтах). еще возвращает тип диска. | |
|
|
|
|
|
|
|
для: alex19921992
(08.11.2007 в 00:17)
| | Времени мало, поэтому даю копипаст из мсдн:
BOOL GetDiskFreeSpace(
LPCTSTR lpRootPathName,
LPDWORD lpSectorsPerCluster,
LPDWORD lpBytesPerSector,
LPDWORD lpNumberOfFreeClusters,
LPDWORD lpTotalNumberOfClusters
);
|
Parameters
lpRootPathName
[in] Pointer to a null-terminated string that specifies the root directory of the disk for which information is to be returned. If this parameter is NULL, the function uses the root of the current disk. If this parameter is a UNC name, it must include a trailing backslash (for example, \\MyServer\MyShare\). Furthermore, a drive specification must have a trailing backslash (for example, C:\).
Windows 95: The initial release of Windows 95 does not support UNC paths. Therefore, you must temporarily map the UNC path to a drive letter, query the free disk space on the drive, then remove the temporary mapping. Windows 95 OSR2 and later support UNC paths.
lpSectorsPerCluster
[out] Pointer to a variable that receives the number of sectors per cluster.
lpBytesPerSector
[out] Pointer to a variable that receives the number of bytes per sector.
lpNumberOfFreeClusters
[out] Pointer to a variable for the total number of free clusters on the disk that are available to the user associated with the calling thread.
If per-user disk quotas are in use, this value may be less than the total number of free clusters on the disk.
lpTotalNumberOfClusters
[out] Pointer to a variable for the total number of clusters on the disk that are available to the user associated with the calling thread.
If per-user disk quotas are in use, this value may be less than the total number of clusters on the disk.
Return Values
If the function succeeds, the return value is nonzero. | |
|
|
|
|
|
|
|
для: Фитч
(09.11.2007 в 05:03)
| | Тоже хотел её посоветовать, но почему-то показалось, что не то... хотя наверное это самое подходящее решение. Вычислить количество байт в кластере можно через общее количество класстеров lpTotalNumberOfClusters и полный объём диска. | |
|
|
|