Microsoft KB Archive/102554
FIX: File Attributes/Date/Time Fail to Set on Open File PSS ID Number: Q102554 Article last modified on 05-07-1994
|The information in this article applies to:|
|- Microsoft Windows Software Development Kit (SDK) version 3.1 - Microsoft Windows for Workgroups version 3.1|
When using MS-DOS function 5701h (set file date and time) along with function 4301h (set file attribute) while the file is currently open, the date and time fail to be set without error. This problem occurs when the file resides on a drive that is shared by Windows for Workgroups version 3.1.
To work around the problem, the application should set the time and date of the file while the file is open, close the file, and then set the file attribute.
Microsoft has confirmed this to be a problem in Windows for Workgroups version 3.1. This problem was corrected in Windows for Workgroups version 3.11.
This operation is commonly performed by copy-file routines implemented to preserve the time and date stamp as well as the file attributes of the source file when creating the destination file. The copy-file routine can read the file time, date, and attributes of the source file and then set the same on the destination file. If the file is being created on a network shared drive that is served by Windows for Workgroups version 3.1, the problem mentioned above will occur. The problem does not occur if only the file time and date are being set or if only the file attributes are being set while the file is still open. There is no reason to keep a file open when setting the attributes because the function refers to the file by a string containing the filename, and not by a file handle.
Additional reference words: 3.10 3.11 KBCategory: Prg KBSubcategory: KrFileIO
Copyright Microsoft Corporation 1994.