diff options
Diffstat (limited to 'src/fs/ntapi_tt_statfs.c')
-rw-r--r-- | src/fs/ntapi_tt_statfs.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c index b386c8b..8b2285a 100644 --- a/src/fs/ntapi_tt_statfs.c +++ b/src/fs/ntapi_tt_statfs.c @@ -26,6 +26,8 @@ int32_t __stdcall __ntapi_tt_statfs( wchar16_t * wch; wchar16_t * wch_mark; uint32_t offset; + uint32_t fmup; + uint32_t hash; void * mnt_points_buffer; nt_mount_points * mnt_points; nt_fsai * fsai; @@ -38,7 +40,9 @@ int32_t __stdcall __ntapi_tt_statfs( return NT_STATUS_INVALID_HANDLE; /* hfile */ - if (!hfile) { + if (hfile) { + statfs->flags_out = 0; + } else { /* oa */ oa.len = sizeof(nt_oa); oa.root_dir = hroot; @@ -151,17 +155,30 @@ int32_t __stdcall __ntapi_tt_statfs( || (wch[7] != '\\')) return NT_STATUS_INVALID_HANDLE; - wch_mark = &wch[8]; - wch = wch_mark; + if (sdev->strlen < __DEVICE_MUP_PREFIX_LEN) + fmup = 0; + else if ((wch[8]=='M') && (wch[9]=='u') && (wch[10]=='p') && (wch[11]=='\\')) + fmup = NT_STATFS_MUP_DEVICE; + else + fmup = 0; + + if (fmup) { + wch_mark = &wch[8]; + hash = __DEVICE_MUP_PREFIX_HASH; + flags &= ~NT_STATFS_VOLUME_GUID; + } else { + wch_mark = &wch[8]; + hash = __DEVICE_PATH_PREFIX_HASH; + } - while (*wch != '\\') - wch++; + for (wch=wch_mark; *wch!='\\'; wch++) + (void)0; statfs->dev_name_strlen = (uint16_t)((wch - sdev->buffer) * sizeof(uint16_t)); statfs->record_name_strlen = sdev->strlen - statfs->dev_name_strlen; statfs->dev_name_hash = __ntapi->tt_buffer_crc32( - __DEVICE_PATH_PREFIX_HASH, + hash, wch_mark, sizeof(wchar16_t) * (wch - wch_mark)); @@ -186,7 +203,7 @@ int32_t __stdcall __ntapi_tt_statfs( /* f_flags, nt_attr, nt_control_flags (todo?) */ statfs->f_flags = 0; statfs->nt_attr = 0; - statfs->nt_control_flags = 0; + statfs->nt_control_flags = fmup; statfs->nt_padding = 0; if (!(flags & NT_STATFS_VOLUME_GUID)) { |