HOWTO: Opening Volumes Under Windows 95

Last reviewed: February 20, 1997
Article ID: Q125712
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows 95 version 4.0

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



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 20, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.