BUG: DeleteFile Returns Wrong Value If VxD Removed from Memory

Last reviewed: November 28, 1995
Article ID: Q139999
The information in this article applies to:
  • Microsoft Windows Device Development Kit (DDK) for Windows 95

SYMPTOMS

If an application uses DeleteFile to remove a VxD from memory, DeleteFile will return 0 (false) if the function succeeds, and will return nonzero (true) if the function fails.

You may have used DeleteFile to remove a VxD from memory because of the following information from the Win32 SDK section titled "Closing a VxD" on the MSDN compact disc under Guides, Programmer's Guide to Windows 95, Using Windows 95 Features, Device I/O Control, Input and Output Control in Applications:

   In rare cases, you may need to use the DeleteFile function to remove a
   dynamically loadable VxD from memory. For example, you use DeleteFile if
   another application has loaded the VxD and you just want to unload it.
   You also use DeleteFile if you have successfully loaded a VxD by using
   CreateFile, but the VxD does not support the device IOCTL interface. In
   such cases, CreateFile loads the VxD but provides no handle to close and
   remove the VxD. The following example removes the VxD named SAMPLE from
   memory.

   DeleteFile("\\\\.\\SAMPLE");

WORKAROUND

In this example, SAMPLE is the module name of the VxD. (Do not specify the file name.) Be aware that the module name of a VxD is not necessarily the same as the VxD's file name without a filename extension. In general, avoid using DeleteFile to remove a VxD from memory.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The Win32 SDK reference for DeleteFile gives the following return values:

  • If the function succeeds, the return value is True.
  • If the function fails, the return value is False.

To get extended error information, call GetLastError.


Additional reference words: 4.00
KBCategory: kbprg kbbuglist
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: November 28, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.