BUG: WritePrivateProfileString Requires Delete Access on INI

Last reviewed: October 13, 1997
Article ID: Q175033
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT 4.0

SYMPTOMS

WritePrivateProfileString() fails to update the target INI file when the user's permissions on the file do not include "Delete" access. GetLastError() returns ACCESS_DENIED.

CAUSE

WritePrivateProfileString() invariably requests "Delete" access when attempting to open the INI file.

RESOLUTION

There are no workarounds short of taking direct control of the file I/O.

STATUS

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

MORE INFORMATION

Steps to Reproduce Behavior

  1. Set access for the subdirectory containing the .INI file to (RWX)(RW).

  2. Make certain that access on the .INI file is set to (RW). NOTE: You will not be able to delete the file.

  3. Attempts to write to the .INI file with WriteProfileString() will fail.

  4. Set access to the .INI file to (RWD).

  5. WritePrivateProfileString() succeeds.
Keywords          : UsrMisc
Version           : WINNT:4.0
Platform          : winnt
Issue type        : kbbug


================================================================================


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