diff --git a/include/ntapi/nt_statfs.h b/include/ntapi/nt_statfs.h index 9bb5ce1..7370313 100644 --- a/include/ntapi/nt_statfs.h +++ b/include/ntapi/nt_statfs.h @@ -41,13 +41,11 @@ typedef struct _nt_statfs { uintptr_t f_spare[4]; uint32_t nt_fstype_hash; uint32_t nt_attr; - uint32_t nt_control_flags; wchar16_t nt_drive_letter; wchar16_t nt_padding; nt_guid nt_volume_guid; void * hfile; - uint32_t flags_in; - uint32_t flags_out; + uint32_t flags; uint16_t record_name_strlen; uint16_t dev_name_strlen; uint16_t dev_name_maxlen; 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; }