Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2003.02.10;
Скачать: [xml.tar.bz2];

Вниз

Floppy   Найти похожие ветки 

 
MSAlex   (2002-12-08 15:00) [0]

Народ подскажите как можно по байтам считать информацию с дискеты.
Тоесть, работать с дискетой подобно тому как можно работать с файлом.


 
Ihor Osov'yak   (2002-12-08 15:15) [1]

Под нт открываешь как физический девайс, под w9x юзаешь то, что в MSDN можно найти по фразе Using VWIN32 to Carry Out MS-DOS Functions


 
msalex   (2002-12-08 15:19) [2]

Ihor Osov"yak > а как открыть физический девайс?


 
Ihor Osov'yak   (2002-12-08 16:09) [3]

К примеру

function OpenPhysicalDriveEx(drv: integer;dwDesiredAccess, dwShareMode: DWORD):THandle;
begin
result := CreateFile(pchar("\\.\PhysicalDrive"+IntToStr(drv)),
dwDesiredAccess,dwShareMode,
nil, OPEN_EXISTING, 0, 0);
end

Более подробно:


INFO: Direct Drive Access Under Win32
ID: Q100027



--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Win32 Application Programming Interface (API), used with:
Microsoft Windows NT versions 3.1, 3.5, 3.51, 4.0
Microsoft Windows 2000

--------------------------------------------------------------------------------


SUMMARY
To open a physical hard drive for direct disk access (raw I/O) in a Win32-based application, use a device name of the form

\\.\PhysicalDriveN
where N is 0, 1, 2, and so forth, representing each of the physical drives in the system.

To open a logical drive, direct access is of the form
\\.\X:
where X: is a hard-drive partition letter, floppy disk drive, or CD-ROM drive.



MORE INFORMATION
You can open a physical or logical drive using the CreateFile() application programming interface (API) with these device names provided that you have the appropriate access rights to the drive (that is, you must be an administrator). You must use both the CreateFile() FILE_SHARE_READ and FILE_SHARE_WRITE flags to gain access to the drive.

Once the logical or physical drive has been opened, you can then perform direct I/O to the data on the entire drive. When performing direct disk I/O, you must seek, read, and write in multiples of sector sizes of the device and on sector boundaries. Call DeviceIoControl() using IOCTL_DISK_GET_DRIVE_GEOMETRY to get the bytes per sector, number of sectors, sectors per track, and so forth, so that you can compute the size of the buffer that you will need.

Note that a Win32-based application cannot open a file by using internal Windows NT object names; for example, attempting to open a CD-ROM drive by opening

\Device\CdRom0
does not work because this is not a valid Win32 device name. An application can use the QueryDosDevice() API to get a list of all valid Win32 device names and see the mapping between a particular Win32 device name and an internal Windows NT object name. An application running at a sufficient privilege level can define, redefine, or delete Win32 device mappings by calling the DefineDosDevice() API.

Additional query words:

Keywords : kbAPI kbFileIO kbKernBase kbWinOS2000 kbDSupport kbGrpKernBase
Version : winnt:3.1,3.5,3.51,4.0
Platform : winnt
Issue type : kbinfo




Страницы: 1 вся ветка

Форум: "Система";
Текущий архив: 2003.02.10;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.008 c
7-29140
subdigger
2002-12-04 07:25
2003.02.10
ShutDown XP


3-28678
FLIZ
2003-01-24 12:01
2003.02.10
Почему MS-SQL не дает построть такую связь?


14-29089
Lancelot
2003-01-25 16:40
2003.02.10
:)))


4-29165
Big_Rom
2002-12-27 20:21
2003.02.10
как програмно поменять размер страницы принтера


1-28710
tga
2003-01-31 11:09
2003.02.10
XML + Delphi... как?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский