HOWTO: Opening Volumes Under Windows 95

ID: Q125712

4.00 WINDOWS kbprg kbhowto

The information in this article applies to:

SUMMARY

Windows 95 does not support opening disk drives or disk partitions with CreateFile(), as Windows NT does. Windows 95 also does not support the DeviceIoControl() IOCTL APIs, as Windows NT does. Instead, low-level disk access in Windows 95 can be achieved through DeviceIoControl() calls to the VWIN32 VxD.

MORE INFORMATION

Windows NT supports obtaining a handle to a disk drive or disk partition by using CreateFile() and specifying the name of the drive or partition as the filename (e.g. "\\.\PHYSICALDRIVE0" or "\\.\C:"). This handle can then be used in the DeviceIoControl() Win32 API.

Windows 95 differs in the following ways:

1. Obtaining a disk drive or disk partition handle is not supported.

   The call to CreateFile() will fail, and GetLastError() will return
   error code 2, ERROR_FILE_NOT_FOUND.

2. The DeviceIoControl IOCTL functions (such as IOCTL_DISK_FORMAT_TRACKS)
   are not supported. These IOCTLs require the handle to a disk drive or
   disk partition and thus can't be used.

3. DeviceIoControl() is called using a handle to a VxD rather than a
   handle to a disk drive or disk partition. Obtain a handle to
   VWIN32.VXD by using CreateFile( "\\\\.\\VWIN32", ... ). Use this
   handle in calls to DeviceIoControl() to perform volume locking
   (Int 21h Function 440Dh, Subfunctions 4Ah and 4Bh), and then to
   perform BIOS calls (Int 13h), Absolute Disk Reads/Writes (Int 25h
   and 26h), or MS-DOS IOCTL functions (Int 21h Function 440Dh).

REFERENCES

For information on using DeviceIoControl() in Windows 95 and the IOCTL functions supported by the VWIN32 VxD, please see the help file "Windows 95 Guide to Programming". Go to "Using Windows 95 features" and select "Using Device I/O Control."

For information on using CreateFile() to obtain disk drive or disk partition handles under Windows NT, see the description for CreateFile() in the Microsoft Windows Programmer's Reference, Volume 3.

For information on Windows 95 extensions to the MS-DOS interrupts, please see the help file "Windows 95 Guide to Programming." Go to "Using Microsoft MS-DOS Extensions" and select "Exclusive Volume Locking", then "About Exclusive Volume Locking", then "Exclusive Use Lock".

For a complete list of IOCTLs, see the description of the DeviceIoControl() function in the Microsoft Windows Programmer's Reference, Volume 3.

KBCategory: kbprg kbhowto KBSubcategory: BseFileio Additional reference words: 4.00

Keywords          : kbAPI kbKernBase kbGrpKernBase 
Version           : 4.00
Platform          : WINDOWS

Last Reviewed: February 22, 1997