Size on disk column in Explorer details
Adds a "Size on disk" column to File Explorer's details view for files and folders
Author: stoilms
Adds a Size on disk column to File Explorer's details view. The value
matches the "Size on disk" figure in a file or folder's Properties dialog as
closely as possible.

How to use
- Enable the mod and restart Explorer (or sign out and back in).
- Open a folder in Details view.
- Right-click any column header and tick Size on disk.
If it isn't in the short list, click More... and find it there.

The values match the Properties dialog:

How the value is calculated
- Files: the file's allocation size, as reported by the file system. For
NTFS-compressed, sparse and CompactOS/WOF-compressed files, the compressed
size rounded up to the volume's cluster size is used instead. Cloud
placeholders (OneDrive, etc.) report only what is stored locally and are
never downloaded.
- Folders: the sum of the size on disk of every file underneath,
calculated manually by walking the folder tree. Junctions and symbolic links
are not followed: they aren't counted inside a folder, and show no value
themselves. OneDrive and other cloud folders are walked.
Notes
- Folder calculation can be slow for large trees, so it always runs in the
background, at low priority and at most two folders at a time. A folder's
value appears as soon as its calculation finishes. Calculating a
folder also caches its subfolders (all of them, or only the direct ones -
see Remember subfolder sizes), so browsing into them is instant.
Cached values are shown immediately and refreshed in the background.
- Cloud folders whose contents aren't on this PC yet are counted as 0 bytes
without being listed, so OneDrive isn't asked to fetch anything.
- Network drives are skipped by default and the column stays empty there,
because querying them can make Explorer stop responding on slow
connections. Turn on Calculate sizes on network drives to include them.
- Only regular file-system folders are supported. Libraries, search results,
zip folders and the Recycle Bin are not.
- Hard links are counted once per link, as the Properties dialog does.
Showing the column in every folder
With Add to default folder layouts enabled, the column is added to
Explorer's built-in templates for regular file folders (general items,
documents, pictures, music, videos, downloads, the user folder and OneDrive).
Other views, such as Home, Gallery, libraries and search results, are left
alone. Templates only apply to folders that
don't have saved view settings, so after enabling it either reset saved views
(Folder Options > View > Reset Folders) or set the column up in one folder
and use Folder Options > View > Apply to Folders for each folder type.
How it works
Windows already defines a hidden System.FileAllocationSize property, and
Explorer's own getter for it (CFSFolder::_GetFileAllocationSize) just returns
the logical size. The mod exposes the property as a column and replaces that
getter with a real size on disk calculation.