Long Dir/File Names Not Supported by CreateFile to Open VxDs

Last reviewed: December 13, 1995
Article ID: Q141146
The information in this article applies to:
  • Microsoft Win32 Device Development Kit (DDK) for Windows, version 4.0

SUMMARY

To dynamically load your VxD in Windows 95, you can use CreateFile as documented in the Win32 SDK; follow this structure:

   Guides
      Programmer's Guide to Windows 95
         Using Windows 95 Features
            Device I/O Control
               Input and Output Control in Applications
                  Opening the VxD.

This section of the Win32 SDK states:

   CreateFile checks for a file name extension to determine whether VxDName
   specifies a file. If a file name extension (such as .vxd) is present,
   the function looks for the file in the standard search path.

You can specify the path to the dynamically loadable VxD explicitly. For example, a 32-bit application can load a VxD named Driver.vxd in the C:\Mydir directory by using the following call. Note that The CREATE_NEW flag is not necessary.

    hCVxD = CreateFile("\\\\.\\C:\\MYDIR\\DRIVER.VXD", 0,0,0,
                        CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);

In your CreateFile call, you can only use directory names and file names that have eight or fewer characters with extensions of three or fewer characters. Long names prevent the VxD from loading.

You can make use of long directory names by using the search path instead of explicitly specifying the path in the CreateFile call. You may include long directory names in your Autoexec.bat "PATH=" statement, restarting the computer to make the new path effective.

MORE INFORMATION

The Win32 SDK also states:

   If VxDName has no file name extension, CreateFile checks the registry to
   see if the name is also a value name under the KnownVxDs key in
   HKLM\System\CurrentControlSet\Control\SessionManager. If it is a value
   name, CreateFile uses the current value associated with the name as the
   full path of the VxD file. This method is useful for specifying VxDs
   that are not in the standard search path. In the following example,
   CreateFile searches the registry for the MYVXDPATH value.

   hDevice = CreateFile("\\\\.\\MYVXDPATH", 0, 0, NULL, 0,
       FILE_FLAG_DELETE_ON_CLOSE, NULL);

Again, the restriction on long names applies. MYVXDPATH cannot contain long names; if it does, the VxD will not load.


Additional reference words: 4.00 Windows 95 kbinf
KBCategory: kbprg
KBSubcategory: DdkMisc


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: December 13, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.