Windows development details .....

Source: Internet
Author: User

I found that Windows APIs are generally not compatible with Windows APIs. Amazing...

The following functions are incompatible with each other.

For example, the getfiletime function. This is the read/write time of the obtained file. However, because Windows itself is very interesting, its read/write time is not actually the user's real read/write time. Of course, people may consider efficiency and other issues. The following section is excerpted from the introduction in msdn:

Not all file systems can record creation and last access times and not all file systems record them in the same manner. for example, on fat, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date ). therefore, the getfiletime function may not return the same file time information set using setfiletime. NTFS delays updates to the last access time for a file by up to one hour after the last access.

Not all file systems can record the creation time and the last access time. Not all file systems record them in the same way. For example, on fat, the creation time error is 10 microseconds, the write time error is 2 seconds, and the access time error is 1 day! (... I think hacker can do something on this day ..) therefore, if you use the setfiletime function, getfiletime cannot return the same time... NTFS will delay updating the last access time by one hour...

It's speechless ..

The findnextfile function has some minor issues, that is, the file cannot be returned in alphabetical order... the performance of fat and NTFS systems is different... the general reason is that the storage order of the file description table is different. fat is stored in chronological order, while NTFS is stored in alphabetical order. This findnextfile did not do anything at all, and it was read directly .. this API is only for efficiency... by the way .. it should actually develop another API called findsortednextfile... this is better .. but I don't think it can do either .. solution .. the upper layer is sorted first.

The order in which this function returns the file names is dependent on
File System type. With the NTFS file system and CDFs file systems, the names are
Returned in alphabetical order. With FAT file systems, the names are returned in
The order the files were written to the disk, which may or may not be in
Alphabetical order.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.