Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: получить служебные поля дискеты  (Прочитано 5998 раз)
0 Пользователей и 1 Гость смотрят эту тему.
temir
Гость
« : 15-05-2006 17:08 » 

Подскажите пожалуйста, каким образом считать служебные поля дискеты. Я слышал, что можно перенастроить ReadFile и WriteFile для этой цели.
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #1 : 15-05-2006 17:50 » 

( temir, не стоит повторять темы , копию я удалил )
Записан

Finch
Спокойный
Администратор

il
Offline Offline
Пол: Мужской
Пролетал мимо


« Ответ #2 : 15-05-2006 18:46 » 

Вот отрывок из MSDN
Цитата
Physical Disks and Volumes

You can use the CreateFile function to open a physical disk drive or a volume. The function returns a handle that can be used with the DeviceIoControl function. This enables you to access the disk partition table. However, it is potentially dangerous to do so, because an incorrect write to a disk could make its contents inaccessible. The following requirements must be met for such a call to succeed:

    * The caller must have administrative privileges. For more information, see Running with Special Privileges.
    * The dwCreationDisposition parameter must have the OPEN_EXISTING flag.
    * When opening a volume or floppy disk, the dwShareMode parameter must have the FILE_SHARE_WRITE flag.

When opening a physical drive x, the lpFileName string should be the following form: \\.\PHYSICALDRIVE<x>. Hard disk numbers start at 0 (zero). The following table shows some examples of physical drive strings.
String    Meaning
\\.\PHYSICALDRIVE0    Opens the first physical drive.
\\.\PHYSICALDRIVE2    Opens the third physical drive.

For an example of opening a physical drive, see Calling DeviceIoControl.

When opening a volume or floppy drive, the lpFileName string should be the following form: \\.\<x>:. Do not use a trailing backslash, which indicates the root directory of a drive. The following table shows some examples of drive strings.
String    Meaning
\\.\A:    Opens drive A (floppy drive).
\\.\C:    Opens drive C (volume).

You can also open a volume by referring to its volume name. For more information, see Naming a Volume.

Volume handles can be opened as noncached at the discretion of the file system, even when the noncached option is not specified in CreateFile. You should assume that all Microsoft file systems open volume handles as noncached. The restrictions on noncached I/O for files also apply to volumes.

A file system may or may not require buffer alignment even though the data is noncached. However, if the noncached option is specified when opening a volume, buffer alignment is enforced regardless of the file system on the volume. It is recommended on all file systems that you open volume handles as noncached, and follow the noncached I/O restrictions.

To read or write to the last few sectors of the volume, you must call Calling DeviceIoControl and specify FSCTL_ALLOW_EXTENDED_DASD_IO. This signals the file system driver not to perform any I/O boundary checks on partition read or write calls. Instead, boundary checks are performed by the device driver.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp
Записан

Не будите спашяго дракона.
             Джаффар (Коша)
Finch
Спокойный
Администратор

il
Offline Offline
Пол: Мужской
Пролетал мимо


« Ответ #3 : 15-05-2006 18:53 » 

Вот пример из MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/calling_deviceiocontrol.asp как раз для твоего вопроса. Только там для диска C:
Записан

Не будите спашяго дракона.
             Джаффар (Коша)
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines