Оно то надо, но когда спрашуещь у ково-нить... То все посылают в Google где один мусор и нихрена полезного............ или дают бакапорные исходники......
nikto Такой вывод устроит? Исходник постить? Код (Text): C:\_temp\disc_para>dpara.exe Read from disk by index of cylinder/track/sector. Physical disk number: 0 Drive letter: с Volume Information: Cylinders: 60801 Tracks Per Cylinder: 255 Bytes Per Sector: 512
Toxasoft Под винду конечно, через интерфейс DeviceIoControl() На сpp пойдет? Код (Text): #define _WIN32_WINNT 0x0500 #include <windows.h> #include <stdio.h> #include <winioctl.h> int ReadSectorsFromDisk(int disk, DISK_GEOMETRY dg, HANDLE hDrive); int main(){ int disk; char dname; DISK_GEOMETRY dg; DWORD dJunk; printf("Read from disk by index of cylinder/track/sector.\n"); printf("\nPhysical disk number: "); scanf("%d", &disk); fflush(stdin); printf("\Drive letter: "); scanf("%c", &dname); char physdisk[24]; wsprintf(physdisk, "\\\\.\\PhysicalDrive%d", disk); HANDLE hDrive = CreateFile(physdisk, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (!DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dg, sizeof(dg), &dJunk, (LPOVERLAPPED)NULL)){ MessageBox(NULL, "deviceiocontrol failed", NULL, MB_OK); } CloseHandle(hDrive); ZeroMemory(physdisk, 24); wsprintf(physdisk, "\\\\.\\%c:", dname); hDrive = CreateFile(physdisk, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); ReadSectorsFromDisk(disk, dg, hDrive); printf("\n\n\n"); return 0; } int ReadSectorsFromDisk(int disk, DISK_GEOMETRY dg, HANDLE hDrive){ DWORD dCylinders, dTracksPerCylinder, dSectorsPerTrack, dBytesPerSector; dCylinders = dg.Cylinders.QuadPart; dTracksPerCylinder = dg.TracksPerCylinder; dSectorsPerTrack = dg.SectorsPerTrack; dBytesPerSector = dg.BytesPerSector; printf("\n\n\n"); printf("Volume Information:\n"); printf("Cylinders: %d\nTracks Per Cylinder: %d\nBytes Per Sector: %d\n\n", dCylinders, dTracksPerCylinder, dBytesPerSector); return 0; }
чтото не понятно _sheva740 и Booster говорят что можно. HCode говорит что нельзя. к тому же из C:\_temp\disc_para>dpara.exe Read from disk by index of cylinder/track/sector. Physical disk number: 0 Drive letter: с Volume Information: Cylinders: 60801 Tracks Per Cylinder: 255 Bytes Per Sector: 512 я не увидел количество секторов на дорожке!
Вы не можете узнать не только количество секторов на дорожке, но и количество самих дорожек, равно как и количество магнитных головок, если речь идет о их физическом (реальном) количестве.
nikto Спроси у гугла ))) Так например - "invoke DeviceIoControl" IOCTL_DISK_GET_DRIVE_GEOMETRY скобки - принципиально!
Ну, ну... ))) Сколько у вас получается в этом случае магнитных головок в жестком диске? Уверен что на вашем жестком диске 255 и на моем 255 и на Васином то же... как думаете, соответствует ли это действительности? )