diff options
author | midipix <writeonce@midipix.org> | 2016-12-23 04:35:58 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-23 04:37:02 -0500 |
commit | fe73cffbedd7b4bfedb6c258fdf9e7b0a0a2c40c (patch) | |
tree | d11fd2f80b585b498949257e339a63f31a3c2669 /src/fs | |
parent | b061d6a1daa4e0a91c40566162547fc050ebc5c2 (diff) | |
download | ntapi-fe73cffbedd7b4bfedb6c258fdf9e7b0a0a2c40c.tar.bz2 ntapi-fe73cffbedd7b4bfedb6c258fdf9e7b0a0a2c40c.tar.xz |
__ntapi_tt_statfs(): clean-up, simplify logic.
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/ntapi_tt_statfs.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c index 8b2285a..b499074 100644 --- a/src/fs/ntapi_tt_statfs.c +++ b/src/fs/ntapi_tt_statfs.c @@ -26,7 +26,6 @@ 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; @@ -41,7 +40,7 @@ int32_t __stdcall __ntapi_tt_statfs( /* hfile */ if (hfile) { - statfs->flags_out = 0; + statfs->flags = 0; } else { /* oa */ oa.len = sizeof(nt_oa); @@ -63,11 +62,10 @@ int32_t __stdcall __ntapi_tt_statfs( NT_FILE_SYNCHRONOUS_IO_ALERT))) return status; - statfs->flags_out = NT_STATFS_NEW_HANDLE; + statfs->flags = NT_STATFS_NEW_HANDLE; } - statfs->hfile = hfile; - statfs->flags_in = flags; + statfs->hfile = hfile; /* maximum component length, file system type */ if ((status = __ntapi->zw_query_volume_information_file( @@ -156,19 +154,21 @@ int32_t __stdcall __ntapi_tt_statfs( return NT_STATUS_INVALID_HANDLE; 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; + return NT_STATUS_INVALID_HANDLE; + + if ((wch[8]=='M') + && (wch[9]=='u') + && (wch[10]=='p') + && (wch[11]=='\\')) { + flags &= ~NT_STATFS_VOLUME_GUID; + statfs->flags |= NT_STATFS_MUP_DEVICE; - if (fmup) { + hash = __DEVICE_MUP_PREFIX_HASH; wch_mark = &wch[8]; - hash = __DEVICE_MUP_PREFIX_HASH; - flags &= ~NT_STATFS_VOLUME_GUID; + statfs->nt_drive_letter = 0; } else { wch_mark = &wch[8]; - hash = __DEVICE_PATH_PREFIX_HASH; + hash = __DEVICE_PATH_PREFIX_HASH; } for (wch=wch_mark; *wch!='\\'; wch++) @@ -200,16 +200,16 @@ int32_t __stdcall __ntapi_tt_statfs( fsid[0] = statfs->dev_name_hash; fsid[1] = 0; - /* f_flags, nt_attr, nt_control_flags (todo?) */ + /* f_flags, nt_attr */ statfs->f_flags = 0; statfs->nt_attr = 0; - statfs->nt_control_flags = fmup; statfs->nt_padding = 0; if (!(flags & NT_STATFS_VOLUME_GUID)) { statfs->nt_drive_letter = 0; - pguid = (uint64_t *)&(statfs->nt_volume_guid); - *pguid = 0; *(++pguid) = 0; + pguid = (uint64_t *)&(statfs->nt_volume_guid); + pguid[0] = 0; + pguid[1] = 0; return NT_STATUS_SUCCESS; } @@ -221,7 +221,7 @@ int32_t __stdcall __ntapi_tt_statfs( offset = sizeof(nt_unicode_string) + statfs->dev_name_strlen; if ((status = __ntapi->tt_get_dos_drive_mount_points( - (void *)0,0, + 0,0, (nt_mount_dev_name *)wch, mnt_points_buffer, buffer_size - offset))) @@ -231,8 +231,7 @@ int32_t __stdcall __ntapi_tt_statfs( mnt_points = (nt_mount_points *)((uintptr_t)mnt_points_buffer + offset); status = __ntapi->tt_dev_mount_points_to_statfs( - mnt_points, - statfs); + mnt_points,statfs); return status; } |