mirror of
https://github.com/reactos/reactos.git
synced 2024-11-01 12:26:32 +00:00
5d361b602d
- The original code was just incrementing the reference counts (RefCounts) of the device objects or the device/file handles, without decrementing them when closing the handles. This is now fixed. Notice the following: * When opening a file on a device (disk), the device's (and its handle's) RefCount is incremented, and the file handle's RefCount is incremented as well. * When closing a file, the file handle's RefCount is decremented (and the file closed if the RefCount reaches zero), and the file's parent device handle is also closed, recursively. This has the effect of decrementing the parent device handle's RefCount, and the device's own RefCount is decremented as well. IMPORTANT NOTE: The usefulness of handle-level RefCount is still under question, and might be (consistently) removed in the future. - Fix opening a device (disk) in direct access, when this device is already opened. Indeed, we previously allowed direct access only if the device was opened as such for the very first time (its RefCount = 0 originally); no filesystem mounting was attempted as well. Then for any later open-operations on this device (while keeping an already-opened handle to it), filesystem access was assumed. Thus, this problem would show up in two ways: * Either the device is first opened for direct access, this succeeded and no filesystem was mounted. Then, for any other open-operations, the filesystem was NOT mounted, and opening files on it would fail. Direct accesses would succeed but would create an unnecessary second file handle. * Or, the device is first opened for file-access: a filesystem was mounted and file opening would succeed. Any other file opening operation would succeed as well (if the file exists). But, a direct access open-operation would fail, because now any open-operations on the device would be assumed to be a file opening. This is now correctly fixed. If direct-open is requested, just do it. If this is a file opening, we open the device, then try to mount a filesystem on it (if not already done), then we try to open the file. If file opening fails, derereference the device. - Pass the file path to the filesystem-specific Open() functions without truncating the leading path separator, if any. This has to be handled by the filesystem routines themselves. |
||
---|---|---|
.. | ||
armllb | ||
bcd | ||
bgfx | ||
bootdata | ||
environ | ||
freeldr | ||
rtl | ||
boot_images.cmake | ||
CMakeLists.txt |