Implement network disk identification on Windows #1824
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.37) × (1 − Review Confidence (0.86)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 291 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.340
Real PR Conversation Timeline
11 items
Took me while a to parse it. What about:
if !matches!(drive_type, DRIVE_FIXED | DRIVE_REMOVABLE | DRIVE_CDROM)
|| (drive_type == DRIVE_REMOTE && !refreshes.network())
Or we could even use variables like:
let is_local_drive = matches!(drive_type, DRIVE_FIXED | DRIVE_REMOVABLE | DRIVE_CDROM);
let is remote_and_allowed = drive_type == DRIVE_REMOTE && refreshes.network();
if !is_local_drive && !is_remote_and_allowed {
continue;
}
Although this second approach makes the DRIVE_REMOTE comparison all the time (which likely doesn't matter much).
Instead of using zeroed, use MaybeUninit::uninit instead.
if let Some(handle) = CreateFileW(
PCWSTR(mount_path.as_ptr()),
0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
None,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
None,
).ok().and_then(HandleWrapper::new) {
We have a HandleWrapper type which handles the CloseHandle for us, so let's put it into use.
Unneeded with HandleWrapper.
Good handling for len == 0, however for len > required, we should likely extend the buffer size (although it'd be weird that such a case would happen).
From the function docs:
If the function succeeds, the return value is the length, in characters, of the strings copied to the buffer, not including the terminating null character. Note that an ANSI-ASCII null character uses one byte, but a Unicode (UTF-16) null character uses two bytes.
I think it needs to be required as usze + 1.
Changes Requested
Good start, little things to be modified.
Please add as a code comment what I explained for the + 1.
Would be better as a for _ in 0..3 loop.
GuillaumeGomez
jheanlee
Closes #1384.
Related stale PR #1745.
The original approach,
FindFirstVolumeWenumerates volumes using volume GUID paths, which SMB does not support.This PR uses
GetLogicalDriveStringsW, which enumerates drives in the MS-DOS Device namespaces. So valid mapped drives with a drive letter will be returned, including network shares.Tested on a virtual machine.