Skip to content

Commit

Permalink
Merge pull request cppfastio#16 from MacroModel/trcrsired-master
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
MacroModel authored Nov 8, 2024
2 parents 5dd54ab + 7666ffb commit 1064292
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
26 changes: 15 additions & 11 deletions include/fast_io_hosted/platforms/nt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1295,14 +1295,14 @@ inline file_type file_type_impl(::std::uint_least32_t DeviceType)
return file_type::regular;
}


template <nt_family family>
inline posix_file_status nt_status_impl(void *__restrict handle)
{
::fast_io::win32::nt::io_status_block isb{};
::fast_io::win32::nt::io_status_block isb;

::fast_io::win32::nt::file_fs_device_type ffdt{};
auto status{::fast_io::win32::nt::nt_query_volume_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(ffdt), sizeof(ffdt),
::fast_io::win32::nt::file_fs_device_type ffdt;
auto status{::fast_io::win32::nt::nt_query_volume_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(ffdt),
static_cast<::std::uint_least32_t>(sizeof(ffdt)),
::fast_io::win32::nt::fs_information_class::FileFsDeviceInformation)};
if (status) [[unlikely]]
{
Expand Down Expand Up @@ -1332,17 +1332,19 @@ inline posix_file_status nt_status_impl(void *__restrict handle)
0};
}

::fast_io::win32::nt::file_basic_information fbi{};
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fbi), sizeof(fbi),
::fast_io::win32::nt::file_basic_information fbi;
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fbi),
static_cast<::std::uint_least32_t>(sizeof(fbi)),
::fast_io::win32::nt::file_information_class::FileBasicInformation);

if (status) [[unlikely]]
{
throw_nt_error(status);
}

::fast_io::win32::nt::file_internal_information fii{};
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fii), sizeof(fii),
::fast_io::win32::nt::file_internal_information fii;
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fii),
static_cast<::std::uint_least32_t>(sizeof(fii)),
::fast_io::win32::nt::file_information_class::FileInternalInformation);

if (status) [[unlikely]]
Expand All @@ -1356,15 +1358,17 @@ inline posix_file_status nt_status_impl(void *__restrict handle)
char16_t Name[255];
} ffvi;

status = ::fast_io::win32::nt::nt_query_volume_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(ffvi), sizeof(ffvi),
status = ::fast_io::win32::nt::nt_query_volume_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb),
__builtin_addressof(ffvi), static_cast<::std::uint_least32_t>(sizeof(ffvi)),
::fast_io::win32::nt::fs_information_class::FileFsVolumeInformation);
if (status) [[unlikely]]
{
throw_nt_error(status);
}

::fast_io::win32::nt::file_standard_information fsi{};
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fsi), sizeof(fsi),
::fast_io::win32::nt::file_standard_information fsi;
status = ::fast_io::win32::nt::nt_query_information_file<family == ::fast_io::nt_family::zw>(handle, __builtin_addressof(isb), __builtin_addressof(fsi),
static_cast<::std::uint_least32_t>(sizeof(fsi)),
::fast_io::win32::nt::file_information_class::FileStandardInformation);

if (status) [[unlikely]]
Expand Down
14 changes: 14 additions & 0 deletions tests/0035.process/process.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <fast_io.h>

int main(int argc, char** argv)
{
if (argc != 2)
{
if (argc == 0) [[unlikely]]
{
return -1;
}
::fast_io::io::perr("Usage: <exe>\n");
}
::fast_io::native_process p{::fast_io::mnp::os_c_str(argv[1]), {}, {}, {}};
}

0 comments on commit 1064292

Please sign in to comment.