From 5b975d571eaa727878067dff67d87e2cf5a7878d Mon Sep 17 00:00:00 2001 From: hearyldp Date: Sun, 9 Feb 2025 19:34:48 -0500 Subject: [PATCH 01/51] add null_terminated_c_str_v for a null terminated string literal --- include/fast_io_core_impl/literals/literal.h | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/fast_io_core_impl/literals/literal.h b/include/fast_io_core_impl/literals/literal.h index cfcaf2e38..6e075e746 100644 --- a/include/fast_io_core_impl/literals/literal.h +++ b/include/fast_io_core_impl/literals/literal.h @@ -22,6 +22,38 @@ inline constexpr ch_type char_literal(char8_t ch) noexcept template inline constexpr ch_type char_literal_v{char_literal(ch)}; +template <::std::integral ch_type> +inline constexpr ch_type const *null_terminated_c_str() noexcept +{ + if constexpr (::std::same_as) + { + return ""; + } + else if constexpr (::std::same_as) + { + return L""; + } + else if constexpr (::std::same_as) + { + return u8""; + } + else if constexpr (::std::same_as) + { + return u""; + } + else if constexpr (::std::same_as) + { + return U""; + } + else + { + return __builtin_addressof(::fast_io::char_literal_v); + } +} + +template <::std::integral ch_type> +inline constexpr ch_type const *null_terminated_c_str_v{::fast_io::null_terminated_c_str()}; + template <::std::integral ch_type> #if __has_cpp_attribute(__gnu__::__always_inline__) [[__gnu__::__always_inline__]] From 24101708af529cbfd1d3f40dacb31b334e10f702 Mon Sep 17 00:00:00 2001 From: hearyldp Date: Sun, 9 Feb 2025 19:36:29 -0500 Subject: [PATCH 02/51] fix __builtin_addressof(::fast_io::char_literal_v --- include/fast_io_core_impl/literals/literal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fast_io_core_impl/literals/literal.h b/include/fast_io_core_impl/literals/literal.h index 6e075e746..4ac8a837b 100644 --- a/include/fast_io_core_impl/literals/literal.h +++ b/include/fast_io_core_impl/literals/literal.h @@ -47,7 +47,7 @@ inline constexpr ch_type const *null_terminated_c_str() noexcept } else { - return __builtin_addressof(::fast_io::char_literal_v); + return __builtin_addressof(::fast_io::char_literal_v<0, ch_type>); } } From 7804627388f4e33c5332f19df89cb2f30be20b66 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sun, 9 Feb 2025 20:42:06 -0500 Subject: [PATCH 03/51] string_view uses null_terminated_c_str_v --- include/fast_io_dsal/impl/cstring_view.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fast_io_dsal/impl/cstring_view.h b/include/fast_io_dsal/impl/cstring_view.h index 6b74c9159..78b4b0e2a 100644 --- a/include/fast_io_dsal/impl/cstring_view.h +++ b/include/fast_io_dsal/impl/cstring_view.h @@ -30,11 +30,11 @@ class basic_cstring_view : private ::fast_io::containers::basic_string_view), 0) + : string_view_type(::fast_io::null_terminated_c_str_v, 0) {} inline constexpr void clear() noexcept { - this->ptr = __builtin_addressof(::fast_io::char_literal_v<0, char_type>); + this->ptr = ::fast_io::null_terminated_c_str_v; this->n = 0; } inline constexpr basic_cstring_view(::std::nullptr_t) = delete; From 1ff5b0190c29be4bf118382660beff3cc080c645 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sun, 9 Feb 2025 21:20:39 -0500 Subject: [PATCH 04/51] Fix warnings caused by macromodel Why do you not compile code with warnings enabled? this is so painful --- include/fast_io_hosted/filesystem/win32_9xa_at.h | 4 ++-- .../fast_io_hosted/process/ipc/win32/named_pipe_win32.h | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/fast_io_hosted/filesystem/win32_9xa_at.h b/include/fast_io_hosted/filesystem/win32_9xa_at.h index d02b86fd9..074f66fdc 100644 --- a/include/fast_io_hosted/filesystem/win32_9xa_at.h +++ b/include/fast_io_hosted/filesystem/win32_9xa_at.h @@ -364,9 +364,9 @@ inline auto win32_9xa_22_api_dispatcher(::fast_io::win32_9xa_dir_handle const &o } } -template <::fast_io::details::posix_api_12 dsp, typename... Args> +template <::fast_io::details::posix_api_12 dsp> inline auto win32_9xa_12_api_dispatcher(char8_t const *oldpath_c_str, ::std::size_t oldpath_size, - ::fast_io::win32_9xa_dir_handle const &newdirhd, char8_t const *newpath_c_str, ::std::size_t newpath_size, Args... args) + ::fast_io::win32_9xa_dir_handle const &newdirhd, char8_t const *newpath_c_str, ::std::size_t newpath_size) { if constexpr (dsp == ::fast_io::details::posix_api_12::symlinkat) { diff --git a/include/fast_io_hosted/process/ipc/win32/named_pipe_win32.h b/include/fast_io_hosted/process/ipc/win32/named_pipe_win32.h index 2d56167f5..403d351d5 100644 --- a/include/fast_io_hosted/process/ipc/win32/named_pipe_win32.h +++ b/include/fast_io_hosted/process/ipc/win32/named_pipe_win32.h @@ -58,8 +58,9 @@ inline void *win32_family_create_named_pipe_ipc_server_impl(win32_named_pipe_cha { // check filename using family_internal_char_type = win32_named_pipe_internal_char_type; +#if 0 using family_internal_str = win32_named_pipe_internal_str; - +#endif using family_internal_char_type_const_may_alias_ptr #if __has_cpp_attribute(__gnu__::__may_alias__) [[__gnu__::__may_alias__]] @@ -252,8 +253,9 @@ inline void *win32_family_ipc_named_pipe_client_connect_impl(win32_named_pipe_ch // check filename using family_char_type = win32_named_pipe_char_type; using family_internal_char_type = win32_named_pipe_internal_char_type; +#if 0 using family_internal_str = win32_named_pipe_internal_str; - +#endif using family_internal_char_type_const_may_alias_ptr #if __has_cpp_attribute(__gnu__::__may_alias__) [[__gnu__::__may_alias__]] @@ -347,7 +349,7 @@ inline void *win32_family_ipc_named_pipe_client_connect_impl(win32_named_pipe_ch ::fast_io::open_mode om{}; if ((mode & ::fast_io::ipc_mode::in) == ::fast_io::ipc_mode::in) { - om |= ::fast_io::open_mode::in; + om |= ::fast_io::open_mode::in; } if ((mode & ::fast_io::ipc_mode::out) == ::fast_io::ipc_mode::out) { From a61324623e11264efd3218e7d1a6fec2f7fd1c60 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 19:46:15 -0500 Subject: [PATCH 05/51] change string.h to lf --- include/fast_io_dsal/impl/string.h | 3646 ++++++++++++++-------------- 1 file changed, 1823 insertions(+), 1823 deletions(-) diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 32c6f1ce4..637e7f281 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -1,1823 +1,1823 @@ -#pragma once - -namespace fast_io -{ -namespace containers -{ - -namespace details -{ - -struct -#if __has_cpp_attribute(__gnu__::__may_alias__) - [[__gnu__::__may_alias__]] -#endif - string_model -{ - void *begin_ptr; - void *curr_ptr; - void *end_ptr; -}; - -template -struct string_internal -{ - T *begin_ptr; - T *curr_ptr; - T *end_ptr; -}; - -template -inline constexpr ::fast_io::basic_allocation_least_result string_allocate_init(chtype const *first, ::std::size_t n) noexcept -{ - using typed_allocator_type = typed_generic_allocator_adapter; - // n is not possible to SIZE_MAX since that would overflow the memory which is not possible - ::std::size_t np1{n + 1}; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; - *::fast_io::freestanding::non_overlapped_copy_n(first, n, ptr) = 0; - return {ptr, static_cast<::std::size_t>(allocn - 1u)}; -} - -template -inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details::string_internal &imp, ::std::size_t rsize, chtype *pnullterminate) noexcept -{ - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - - ::std::size_t const bfsize{static_cast<::std::size_t>(imp.end_ptr - imp.begin_ptr)}; - ::std::size_t const strsize{static_cast<::std::size_t>(imp.curr_ptr - imp.begin_ptr)}; - - chtype *ptr; - auto beginptr{imp.begin_ptr}; - bool const is_sso{beginptr == pnullterminate}; - if (beginptr == pnullterminate) - { - beginptr = nullptr; - } - if constexpr (typed_allocator_type::has_reallocate) - { - auto [newptr, newcap] = typed_allocator_type::reallocate_at_least(beginptr, rsize + 1u); - ptr = newptr; - rsize = newcap - 1u; - } - else - { - auto [newptr, newcap] = typed_allocator_type::reallocate_n_at_least(beginptr, bfsize, rsize + 1u); - ptr = newptr; - rsize = newcap - 1u; - } - if (is_sso) - { - *ptr = 0; - } - imp = {ptr, ptr + strsize, ptr + rsize}; -} - -template -inline constexpr void string_push_back_heap_grow_twice(::fast_io::containers::details::string_internal &imp, chtype *pnullterminate) noexcept -{ - - ::std::size_t const bfsize{static_cast<::std::size_t>(imp.end_ptr - imp.begin_ptr)}; - ::std::size_t const bfsizep1{bfsize + 1u}; - - constexpr ::std::size_t mxsz{SIZE_MAX / sizeof(chtype) / 2u}; - if (mxsz < bfsizep1) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - ::std::size_t const bfsizep1mul2{bfsizep1 << 1u}; - return ::fast_io::containers::details::string_heap_dilate_uncheck(imp, bfsizep1mul2, pnullterminate); -} - -} // namespace details - -template <::std::integral chtype, typename alloctype> -class -#if __has_cpp_attribute(clang::trivial_abi) - [[clang::trivial_abi]] -#endif - basic_string -{ -public: - using allocator_type = alloctype; - using char_type = chtype; - using value_type = char_type; - using size_type = ::std::size_t; - using difference_type = ::std::ptrdiff_t; - using pointer = char_type *; - using const_pointer = char_type const *; - using reference = char_type &; - using const_reference = char_type const &; - using iterator = pointer; - using const_iterator = const_pointer; - using reverse_iterator = ::std::reverse_iterator; - using const_reverse_iterator = ::std::reverse_iterator; - using string_view_type = ::fast_io::containers::basic_string_view; - using cstring_view_type = ::fast_io::containers::basic_cstring_view; - - ::fast_io::containers::details::string_internal imp; - char_type nullterminator; - - inline constexpr basic_string() noexcept - : imp{__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}, - nullterminator{} - { - } - - inline explicit constexpr basic_string(size_type n) noexcept - { - if (!n) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - else - { - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - if (n == mx) - { - ::fast_io::fast_terminate(); - } - auto [ptr, newcap]{typed_allocator_type::allocate_zero_at_least(n + 1u)}; - this->imp = {ptr, ptr + n, ptr + static_cast(newcap - 1u)}; - } - } - - inline explicit constexpr basic_string(size_type n, char_type ch) noexcept - { - if (!n) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - else - { - - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - if (n == mx) - { - ::fast_io::fast_terminate(); - } - auto [ptr, cap]{typed_allocator_type::allocate_at_least(n + 1u)}; - this->imp = {ptr, ptr + n, ptr + static_cast(cap - 1u)}; - *::fast_io::freestanding::uninitialized_fill(ptr, ptr + n, ch) = 0; - } - } - -private: - inline constexpr void construct_impl(char_type const *otherptr, size_type othern) noexcept - { - if (!othern) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - else - { - auto newres{::fast_io::containers::details::string_allocate_init(otherptr, othern)}; - auto ptrn{newres.ptr + othern}; - this->imp = {newres.ptr, ptrn, newres.ptr + newres.count}; - } - } - -public: - inline explicit constexpr basic_string(char_type const *f, char_type const *e) noexcept - { - this->construct_impl(f, static_cast(e - f)); - } - - inline explicit constexpr basic_string(string_view_type othervw) noexcept - { - this->construct_impl(othervw.data(), othervw.size()); - } - - inline constexpr const_pointer c_str() const noexcept - { - return imp.begin_ptr; - } - - inline constexpr pointer data() noexcept - { - return imp.begin_ptr; - } - - inline constexpr const_pointer data() const noexcept - { - return imp.begin_ptr; - } - - inline constexpr bool is_empty() const noexcept - { - return imp.begin_ptr == imp.curr_ptr; - } - - inline constexpr bool empty() const noexcept - { - return imp.begin_ptr == imp.curr_ptr; - } - - inline constexpr size_type size() const noexcept - { - return static_cast(imp.curr_ptr - imp.begin_ptr); - } - inline constexpr size_type size_bytes() const noexcept - { - return static_cast(imp.curr_ptr - imp.begin_ptr) * sizeof(value_type); - } - - inline constexpr size_type capacity() const noexcept - { - return static_cast(imp.end_ptr - imp.begin_ptr); - } - - inline constexpr size_type capacity_bytes() const noexcept - { - return static_cast(imp.end_ptr - imp.begin_ptr) * sizeof(value_type); - } - - static inline constexpr size_type max_size() noexcept - { - constexpr size_type n{SIZE_MAX / sizeof(value_type)}; - return n; - } - static inline constexpr size_type max_size_bytes() noexcept - { - constexpr size_type n{SIZE_MAX / sizeof(value_type) * sizeof(value_type)}; - return n; - } -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference back() noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (begin_ptr == curr_ptr) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return curr_ptr[-1]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference back() const noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (begin_ptr == curr_ptr) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return curr_ptr[-1]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference front() noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (begin_ptr == curr_ptr) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return *begin_ptr; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference front() const noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (begin_ptr == curr_ptr) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return *begin_ptr; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference back_unchecked() noexcept - { - return imp.curr_ptr[-1]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference back_unchecked() const noexcept - { - return imp.curr_ptr[-1]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference front_unchecked() noexcept - { - return *imp.begin_ptr; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference front_unchecked() const noexcept - { - return *imp.begin_ptr; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference operator[](size_type pos) const noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (static_cast(curr_ptr - begin_ptr) <= pos) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return begin_ptr[pos]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference operator[](size_type pos) noexcept - { - auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; - if (static_cast(curr_ptr - begin_ptr) <= pos) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return begin_ptr[pos]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr const_reference index_unchecked(size_type pos) const noexcept - { - return imp.begin_ptr[pos]; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - [[nodiscard]] - inline constexpr reference index_unchecked(size_type pos) noexcept - { - return imp.begin_ptr[pos]; - } - -private: - inline constexpr void moveconstructorcommon(basic_string &&other) noexcept - { - if (other.imp.begin_ptr == __builtin_addressof(other.nullterminator)) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - else - { - this->imp = other.imp; - other.imp = {__builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator)}; - other.nullterminator = 0; - } - } - -public: - inline constexpr basic_string(basic_string &&other) noexcept - { - this->moveconstructorcommon(::std::move(other)); - } - - inline constexpr basic_string &operator=(basic_string &&other) noexcept - { - if (__builtin_addressof(other) == this) [[unlikely]] - { - return *this; - } - this->destroy(); - this->moveconstructorcommon(::std::move(other)); - return *this; - } - - inline constexpr basic_string(basic_string const &other) noexcept - { - auto otherbegin{other.imp.begin_ptr}; - auto othercurr{other.imp.curr_ptr}; - if (otherbegin == othercurr) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - return; - } - ::std::size_t const stringlength{static_cast<::std::size_t>(othercurr - otherbegin)}; - auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherbegin, stringlength); - this->imp = {ptr, ptr + stringlength, ptr + allocn}; - } - -private: - inline constexpr void assign_impl(char_type const *otherptr, ::std::size_t othern) noexcept - { - auto thisbegin{this->imp.begin_ptr}; - auto thisend{this->imp.end_ptr}; - ::std::size_t const thiscap{static_cast<::std::size_t>(thisend - thisbegin)}; - if (thiscap < othern) - { - this->destroy(); - auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherptr, othern); - this->imp.end_ptr = (this->imp.begin_ptr = thisbegin = ptr) + allocn; - } - *(this->imp.curr_ptr = ::fast_io::freestanding::overlapped_copy_n(otherptr, othern, thisbegin)) = 0; - } - -public: - inline constexpr void assign(string_view_type myview) noexcept - { - this->assign_impl(myview.data(), myview.size()); - } - inline constexpr void assign_characters(size_type n, char_type ch) noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto endptr{this->imp.end_ptr}; - size_type const thiscap{static_cast(endptr - beginptr)}; - if (thiscap < n) - { - constexpr size_type mx{::std::numeric_limits::max()}; - if (n == mx) - { - ::fast_io::fast_terminate(); - } - this->destroy(); - size_type const np1{static_cast(n + 1u)}; - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; - this->imp.end_ptr = (this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u); - } - *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(beginptr, n, ch)) = 0; - } - inline constexpr void assign_characters(size_type n) noexcept - { - this->assign_characters(n, 0); - } - inline constexpr void assign_with_character(char_type ch) noexcept - { - this->assign_characters(1u, ch); - } - inline constexpr basic_string &operator=(basic_string const &other) noexcept - { - if (__builtin_addressof(other) == this) [[unlikely]] - { - return *this; - } - this->assign_impl(other.imp.begin_ptr, static_cast<::std::size_t>(other.imp.curr_ptr - other.imp.begin_ptr)); - return *this; - } - -private: -#if __has_cpp_attribute(__gnu__::__cold__) - [[__gnu__::__cold__]] -#endif - inline constexpr pointer insert_cold_impl(pointer insertpos, char_type const *otherptr, size_type othern) noexcept - { - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; - constexpr size_type mxm1{static_cast(mx - 1u)}; - - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type newsize{thissize + othern}; - - size_type bigcap; - if (mxdiv2 <= thiscap) - { - bigcap = mxm1; - } - else - { - bigcap = static_cast(thiscap << 1u); - } - size_type newcap{newsize}; - if (newcap < bigcap) - { - newcap = bigcap; - } - if (newcap == mx) - { - ::fast_io::fast_terminate(); - } - size_type const newcapp1{static_cast(newcap + 1u)}; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; - this->imp.begin_ptr = ptr; - this->imp.end_ptr = ptr + static_cast(allocn - 1u); - auto it{ptr}; - it = ::fast_io::freestanding::non_overlapped_copy(beginptr, insertpos, it); - auto retit{it}; - it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); - it = ::fast_io::freestanding::non_overlapped_copy(insertpos, currptr, it); - *it = 0; - this->imp.curr_ptr = it; - if (!is_sso) - { - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); - } - return retit; - } -#if __has_cpp_attribute(__gnu__::__cold__) - [[__gnu__::__cold__]] -#endif - inline constexpr void append_cold_impl(char_type const *otherptr, size_type othern) noexcept - { -#if 0 - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; - constexpr size_type mxm1{static_cast(mx - 1u)}; - - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type newsize{thissize + othern}; - - size_type bigcap; - if (mxdiv2 <= thiscap) - { - bigcap = mxm1; - } - else - { - bigcap = static_cast(thiscap << 1u); - } - size_type newcap{newsize}; - if (newcap < bigcap) - { - newcap = bigcap; - } - if (newcap == mx) - { - ::fast_io::fast_terminate(); - } - size_type const newcapp1{static_cast(newcap + 1u)}; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; - this->imp.begin_ptr = ptr; - this->imp.end_ptr = ptr + static_cast(allocn - 1u); - auto it{ptr}; - it = ::fast_io::freestanding::non_overlapped_copy(beginptr, currptr, it); - it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); - *it = 0; - this->imp.curr_ptr = it; - if (!is_sso) - { - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); - } -#else - this->insert_cold_impl(this->imp.curr_ptr, otherptr, othern); -#endif - } - inline constexpr void append_impl(char_type const *otherptr, size_type othern) noexcept - { - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type newsize{thissize + othern}; - bool const needreallocate{thiscap < newsize}; - if (needreallocate) [[unlikely]] - { - this->append_cold_impl(otherptr, othern); - return; - } - *(this->imp.curr_ptr = ::fast_io::freestanding::overlapped_copy_n(otherptr, othern, currptr)) = 0; - } - -public: - inline constexpr void append(string_view_type vw) noexcept - { - this->append_impl(vw.data(), vw.size()); - } - inline constexpr void append(basic_string const &other) noexcept - { - this->append_impl(other.data(), other.size()); - } - - inline constexpr void clear() noexcept - { - *(this->imp.curr_ptr = this->imp.begin_ptr) = 0; - } - - inline constexpr void clear_destroy() noexcept - { - this->destroy(); - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - - inline constexpr void push_back_unchecked(char_type ch) noexcept - { - *this->imp.curr_ptr = ch; - *++this->imp.curr_ptr = 0; - } - -private: -#if __has_cpp_attribute(__gnu__::__cold__) - [[__gnu__::__cold__]] -#endif - inline constexpr void grow_twice() noexcept - { - ::fast_io::containers::details::string_push_back_heap_grow_twice(this->imp, __builtin_addressof(this->nullterminator)); - } - -public: - inline constexpr const_iterator cbegin() const noexcept - { - return this->imp.begin_ptr; - } - - inline constexpr const_iterator cend() const noexcept - { - return this->imp.curr_ptr; - } - - inline constexpr const_iterator begin() const noexcept - { - return this->imp.begin_ptr; - } - - inline constexpr const_iterator end() const noexcept - { - return this->imp.curr_ptr; - } - - inline constexpr iterator begin() noexcept - { - return this->imp.begin_ptr; - } - - inline constexpr iterator end() noexcept - { - return this->imp.curr_ptr; - } - - inline constexpr const_reverse_iterator crbegin() const noexcept - { - return const_reverse_iterator(this->imp.curr_ptr); - } - - inline constexpr const_iterator crend() const noexcept - { - return const_reverse_iterator(this->imp.begin_ptr); - } - - inline constexpr const_iterator rbegin() const noexcept - { - return const_reverse_iterator(this->imp.curr_ptr); - } - - inline constexpr const_iterator rend() const noexcept - { - return const_reverse_iterator(this->imp.begin_ptr); - } - - inline constexpr reverse_iterator rbegin() noexcept - { - return reverse_iterator(this->imp.curr_ptr); - } - - inline constexpr reverse_iterator rend() noexcept - { - return reverse_iterator(this->imp.begin_ptr); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr void push_back(char_type ch) noexcept - { - if (this->imp.curr_ptr == this->imp.end_ptr) [[unlikely]] - { - this->grow_twice(); - } - *this->imp.curr_ptr = ch; - *++this->imp.curr_ptr = 0; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr void pop_back() noexcept - { - if (this->imp.curr_ptr == this->imp.begin_ptr) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - *--this->imp.curr_ptr = 0; - } - - inline constexpr void pop_back_unchecked() noexcept - { - *--this->imp.curr_ptr = 0; - } - - inline constexpr void reserve(size_type new_cap) noexcept - { - auto begin_ptr{this->imp.begin_ptr}; - if (new_cap <= static_cast(imp.end_ptr - begin_ptr)) - { - return; - } - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, new_cap, __builtin_addressof(this->nullterminator)); - } - - inline constexpr void shrink_to_fit() noexcept - { - if (this->imp.curr_ptr == this->imp.end_ptr) - { - return; - } - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, static_cast(this->imp.curr_ptr - this->imp.begin_ptr), __builtin_addressof(this->nullterminator)); - } - -private: - inline constexpr void destroy() noexcept - { - auto beginptr{this->imp.begin_ptr}; - - if (beginptr != __builtin_addressof(this->nullterminator)) - { - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(this->imp.end_ptr - beginptr) + 1u)); - } - } - -public: - inline constexpr ~basic_string() - { - this->destroy(); - } - -private: - inline constexpr pointer insert_impl(pointer ptr, char_type const *otherptr, size_type othern) noexcept - { - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type newsize{thissize + othern}; - bool const needreallocate{thiscap < newsize}; - if (needreallocate) [[unlikely]] - { - return this->insert_cold_impl(ptr, otherptr, othern); - } - auto newcurrptr{currptr + othern}; - *newcurrptr = 0; - auto lastptr{::fast_io::freestanding::copy_backward(ptr, currptr, newcurrptr)}; - auto retptr{::fast_io::freestanding::copy_backward(otherptr, otherptr + othern, lastptr)}; - this->imp.curr_ptr = newcurrptr; - return retptr; - } - inline constexpr void insert_index_impl(size_type idx, char_type const *otherptr, size_type othern) noexcept - { - auto beginptr{this->imp.begin_ptr}; - size_type sz{static_cast(this->imp.curr_ptr - beginptr)}; - if (sz < idx) - { - ::fast_io::fast_terminate(); - } - this->insert_impl(beginptr + idx, otherptr, othern); - } - -public: - inline constexpr void insert_index(size_type idx, string_view_type vw) noexcept - { - return this->insert_index_impl(idx, vw.data(), vw.size()); - } - inline constexpr iterator insert(const_iterator ptr, string_view_type vw) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - return this->insert_impl(this->imp.begin_ptr + (ptr - this->imp.begin_ptr), vw.data(), vw.size()); - } - else - { - return this->insert_impl(const_cast(ptr), vw.data(), vw.size()); - } - } - inline constexpr void insert_index(size_type idx, basic_string const &other) noexcept - { - return this->insert_index_impl(idx, other.data(), other.size()); - } - -private: - inline constexpr pointer erase_impl(pointer first, pointer last) noexcept - { - *(this->imp.curr_ptr = ::fast_io::freestanding::my_copy(last, this->imp.curr_ptr, first)) = 0; - return first; - } - - inline constexpr pointer erase_impl(pointer first) noexcept - { - return this->erase_impl(first, first + 1); - } - -public: - inline constexpr iterator erase(const_iterator first, const_iterator last) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - auto beginptr{this->imp.begin_ptr}; - return this->erase_impl(beginptr + (first - beginptr), beginptr + (last - beginptr)); - } - else - { - return this->erase_impl(const_cast(first), const_cast(last)); - } - } - inline constexpr void erase_index(size_type firstidx, size_type lastidx) noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const sz{static_cast(currptr - beginptr)}; - if (lastidx < firstidx || sz < lastidx) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - this->erase_impl(beginptr + firstidx, beginptr + lastidx); - } - inline constexpr iterator erase(const_iterator it) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - auto beginptr{this->imp.begin_ptr}; - return this->erase_impl(beginptr + (it - beginptr)); - } - else - { - return this->erase_impl(const_cast(it)); - } - } - inline constexpr void erase_index(size_type idx) noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const sz{static_cast(currptr - beginptr)}; - if (sz <= idx) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - this->erase_impl(beginptr + idx); - } - inline constexpr void swap(basic_string &other) noexcept - { - ::std::swap(other.imp, this->imp); - if (other.imp.begin_ptr == __builtin_addressof(this->nullterminator)) - { - other.imp = {__builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator)}; - other.nullterminator = 0; - } - if (this->imp.begin_ptr == __builtin_addressof(other.nullterminator)) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - } - inline constexpr iterator insert(const_iterator ptr, basic_string const &other) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - return this->insert_impl(this->imp.begin_ptr + (ptr - this->imp.begin_ptr), other.data(), other.size()); - } - else - { - return this->insert_impl(const_cast(ptr), other.data(), other.size()); - } - } - -private: -#if __has_cpp_attribute(__gnu__::__cold__) - [[__gnu__::__cold__]] -#endif - inline constexpr pointer replace_cold_impl(pointer first, pointer last, const_pointer otherptr, size_type othern) noexcept - { - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; - constexpr size_type mxm1{static_cast(mx - 1u)}; - - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type const toremoven{static_cast(last - first)}; - size_type newsize{thissize + othern - toremoven}; - - size_type bigcap; - if (mxdiv2 <= thiscap) - { - bigcap = mxm1; - } - else - { - bigcap = static_cast(thiscap << 1u); - } - size_type newcap{newsize}; - if (newcap < bigcap) - { - newcap = bigcap; - } - if (newcap == mx) - { - ::fast_io::fast_terminate(); - } - size_type const newcapp1{static_cast(newcap + 1u)}; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; - this->imp.begin_ptr = ptr; - this->imp.end_ptr = ptr + static_cast(allocn - 1u); - auto it{ptr}; - it = ::fast_io::freestanding::non_overlapped_copy(beginptr, first, it); - auto retit{it}; - it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); - it = ::fast_io::freestanding::non_overlapped_copy(last, currptr, it); - *it = 0; - this->imp.curr_ptr = it; - if (!is_sso) - { - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); - } - return retit; - } - inline constexpr pointer replace_impl(pointer first, pointer last, const_pointer otherdata, size_type othersize) noexcept - { - size_type const toremoven{static_cast(last - first)}; - auto currptr{this->imp.curr_ptr}; - if (othersize < toremoven) [[likely]] - { - auto itr{::fast_io::freestanding::overlapped_copy_n(otherdata, othersize, first)}; - if (itr != last) - { - *(this->imp.curr_ptr = ::fast_io::freestanding::copy_backward(itr, last, currptr)) = 0; - } - return first; - } - return this->replace_cold_impl(first, last, otherdata, othersize); - } - - inline constexpr void replace_index_impl(size_type firstidx, size_type lastidx, const_pointer otherdata, size_type othersize) noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const sz{static_cast(currptr - beginptr)}; - if (lastidx < firstidx || sz < lastidx) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - this->replace_impl(beginptr + firstidx, beginptr + lastidx, otherdata, othersize); - } - -public: -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr iterator replace(const_iterator first, const_iterator last, string_view_type view) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - auto beginptr{this->imp.begin_ptr}; - return this->replace_impl(beginptr + (first - beginptr), beginptr + (last - beginptr), view.data(), view.size()); - } - else - { - return this->replace_impl(const_cast(first), const_cast(last), view.data(), view.size()); - } - } -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr iterator replace(const_iterator first, const_iterator last, basic_string const &view) noexcept - { -#ifdef __cpp_if_consteval - if consteval -#else - if (__builtin_is_constant_evaluated()) -#endif - { - auto beginptr{this->imp.begin_ptr}; - return this->replace_impl(beginptr + (first - beginptr), beginptr + (last - beginptr), view.data(), view.size()); - } - else - { - return this->replace_impl(const_cast(first), const_cast(last), view.data(), view.size()); - } - } -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr void replace_index(size_type firstidx, size_type lastidx, string_view_type view) noexcept - { - return this->replace_index_impl(firstidx, lastidx, view.data(), view.size()); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr void replace_index(size_type firstidx, size_type lastidx, basic_string const &view) noexcept - { - return this->replace_index_impl(firstidx, lastidx, view.data(), view.size()); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr cstring_view_type subview_back(size_type count) const noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - if (thisn < count) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return cstring_view_type(::fast_io::containers::null_terminated, beginptr + (thisn - count), count); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr cstring_view_type subview_back_unchecked(size_type count) const noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - return cstring_view_type(::fast_io::containers::null_terminated, beginptr + (thisn - count), count); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr string_view_type subview_front(size_type count) const noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - if (thisn < count) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - return string_view_type(beginptr, count); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr string_view_type subview_front_unchecked(size_type count) const noexcept - { - return string_view_type(this->imp.begin_ptr, count); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr string_view_type subview(size_type pos, size_type count = ::fast_io::containers::npos) const noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - if (thisn < pos) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - size_type const val{thisn - pos}; - if (val < count) - { - if (count != ::fast_io::containers::npos) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - count = val; - } - return string_view_type(beginptr + pos, count); - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr string_view_type subview_unchecked(size_type pos, size_type count = ::fast_io::containers::npos) const noexcept - { - auto beginptr{this->imp.begin_ptr}; - if (count == ::fast_io::containers::npos) - { - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - size_type const val{thisn - pos}; - count = val; - } - return string_view_type(beginptr + pos, count); - } - - inline constexpr bool starts_with(string_view_type sv) const noexcept - { - return string_view_type(this->data(), this->size()).starts_with(sv); - } - inline constexpr bool starts_with(basic_string const &other) const noexcept - { - return this->starts_with(string_view_type(other)); - } - - inline constexpr bool starts_with_character(value_type ch) const noexcept - { - return string_view_type(this->data(), this->size()).starts_with_character(ch); - } - inline constexpr bool ends_with(string_view_type sv) const noexcept - { - return string_view_type(this->data(), this->size()).ends_with(sv); - } - inline constexpr bool ends_with(basic_string const &other) const noexcept - { - return this->ends_with(string_view_type(other)); - } - - inline constexpr bool ends_with_character(value_type ch) const noexcept - { - return string_view_type(this->data(), this->size()).ends_with_character(ch); - } - - inline constexpr void remove_suffix(size_type svn) noexcept - { - auto beginptr{this->imp.begin_ptr}; - auto currptr{this->imp.curr_ptr}; - size_type const thisn{static_cast(currptr - beginptr)}; - if (thisn < svn) [[unlikely]] - { - ::fast_io::fast_terminate(); - } - currptr -= svn; - *(this->imp.curr_ptr = currptr) = 0; - } - - inline constexpr void remove_suffix_unchecked(size_type svn) noexcept - { - *(this->imp.curr_ptr -= svn) = 0; - } - - inline constexpr bool contains(string_view_type vw) const noexcept - { - auto ed{this->imp.curr_ptr}; - return ::std::search(this->imp.begin_ptr, ed, vw.ptr, vw.ptr + vw.n) != ed; - } - inline constexpr bool contains(basic_string const &other) const noexcept - { - auto ed{this->imp.curr_ptr}; - return ::std::search(this->imp.begin_ptr, ed, other.cbegin(), other.cend()) != ed; - } - inline constexpr bool contains_character(char_type ch) const noexcept - { - auto ed{this->imp.curr_ptr}; - return ::std::find(this->imp.begin_ptr, ed, ch) != ed; - } - -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr size_type copy(char_type *dest, size_type count, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).copy(dest, count, pos); - } -#if __has_cpp_attribute(__gnu__::__always_inline__) - [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) - [[msvc::forceinline]] -#endif - inline constexpr size_type copy_unchecked(char_type *dest, size_type count, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).copy_unchecked(dest, count, pos); - } - - inline constexpr basic_string substr_back(size_type count) const noexcept - { - return basic_string(this->subview_back(count)); - } - - inline constexpr basic_string substr_front(size_type count) const noexcept - { - return basic_string(this->subview_front(count)); - } - - inline constexpr basic_string substr(size_type idx, size_type count = ::fast_io::containers::npos) const noexcept - { - return basic_string(this->subview(idx, count)); - } - - inline constexpr size_type find_character(char_type ch, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).find_character(ch, pos); - } - inline constexpr size_type find_not_character(char_type ch, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).find_not_character(ch, pos); - } - inline constexpr size_type rfind_character(char_type ch, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).rfind_character(ch, pos); - } - inline constexpr size_type rfind_not_character(char_type ch, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).rfind_not_character(ch, pos); - } - inline constexpr size_type find(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).find(s, pos, count); - } - inline constexpr size_type find(string_view_type v, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).find(v, pos); - } - inline constexpr size_type rfind(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).rfind(s, pos, count); - } - inline constexpr size_type rfind(string_view_type v, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).rfind(v.data(), v.size(), pos); - } - inline constexpr size_type rfind(basic_string const &v, size_type pos = 0) const noexcept - { - return string_view_type(this->data(), this->size()).rfind(v.data(), v.size(), pos); - } - - inline constexpr size_type find_first_of(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).find_first_of(s, pos, count); - } - inline constexpr size_type find_first_of(string_view_type s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_first_of(s, pos); - } - inline constexpr size_type find_first_not_of(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).find_first_of(s, pos, count); - } - inline constexpr size_type find_first_not_of(string_view_type s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_first_not_of(s, pos); - } - inline constexpr size_type find_first_not_of(basic_string const &s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_first_not_of(s.data(), s.size(), pos); - } - inline constexpr size_type find_last_of(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_of(s, pos, count); - } - inline constexpr size_type find_last_of(string_view_type s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_of(s, pos); - } - inline constexpr size_type find_last_of(basic_string const &s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_of(s.data(), pos, s.size()); - } - inline constexpr size_type find_last_not_of(const_pointer s, size_type pos, size_type count) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_not_of(s, pos, count); - } - inline constexpr size_type find_last_not_of(string_view_type s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_not_of(s.ptr, pos, s.n); - } - inline constexpr size_type find_last_not_of(basic_string const &s, size_type pos) const noexcept - { - return string_view_type(this->data(), this->size()).find_last_not_of(s.data(), pos, s.size()); - } - inline constexpr auto compare_three_way(size_type pos1, size_type count1, const_pointer s, size_type count2) const noexcept - { - return this->subview(pos1, count1) <=> string_view_type(s, count2); - } - inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, const_pointer s, size_type count2) const noexcept - { - return this->subview_unchecked(pos1, count1) <=> string_view_type(s, count2); - } - inline constexpr auto compare_three_way(size_type pos1, size_type count1, string_view_type other, size_type pos2, size_type count2) const noexcept - { - return this->subview(pos1, count1) <=> other.subview(pos2, count2); - } - inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, string_view_type other, size_type pos2, size_type count2) const noexcept - { - return this->subview_unchecked(pos1, count1) <=> other.subview_unchecked(pos2, count2); - } - inline constexpr auto compare_three_way(size_type pos1, size_type count1, basic_string const &other, size_type pos2, size_type count2) const noexcept - { - return this->subview(pos1, count1) <=> other.subview(pos2, count2); - } - inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, basic_string const &other, size_type pos2, size_type count2) const noexcept - { - return this->subview_unchecked(pos1, count1) <=> other.subview_unchecked(pos2, count2); - } - - template - inline constexpr void resize_and_overwrite(size_type count, Operation op) noexcept - { - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}; - size_type thissize{static_cast(currptr - beginptr)}; - if (thissize < count) - { - auto endptr{this->imp.end_ptr}; - size_type thiscap{static_cast(endptr - beginptr)}; - if (thiscap < count) - { - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); - beginptr = this->imp.begin_ptr; - } - } - *(this->imp.curr_ptr = (beginptr + op(beginptr, count))) = 0; - } - - inline constexpr void resize(size_type count, char_type ch) noexcept - { - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}; - size_type thissize{static_cast(currptr - beginptr)}; - if (count <= thissize) - { - if (count != thissize) - { - *(this->imp.curr_ptr -= static_cast(thissize - count)) = 0; - } - return; - } - auto endptr{this->imp.end_ptr}; - size_type thiscap{static_cast(endptr - beginptr)}; - if (thiscap < count) - { - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); - currptr = this->imp.curr_ptr; - } - *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(currptr, static_cast(count - thissize), ch)) = 0; - } - inline constexpr void resize(size_type count) noexcept - { - this->resize(count, 0); - } -}; - -template <::std::integral chtype, typename allocator1, typename U> -inline constexpr ::fast_io::containers::basic_string::size_type erase(::fast_io::containers::basic_string &c, U const &value) -{ - auto it = ::std::remove(c.begin(), c.end(), value); - auto r = c.end() - it; - c.erase(it, c.end()); - return static_cast<::fast_io::containers::basic_string::size_type>(r); -} - -template <::std::integral chtype, typename allocator1, typename Pred> -inline constexpr ::fast_io::containers::basic_string::size_type erase_if(::fast_io::containers::basic_string &c, Pred pred) -{ - auto it = ::std::remove_if(c.begin(), c.end(), pred); - auto r = c.end() - it; - c.erase(it, c.end()); - return static_cast<::fast_io::containers::basic_string::size_type>(r); -} - -template <::std::integral chtype, typename allocator1, typename allocator2> -inline constexpr bool operator==(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string const &rhs) noexcept -{ - return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); -} - -template <::std::integral chtype, typename allocator1> -inline constexpr bool operator==(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string_view rhs) noexcept -{ - return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); -} - -template <::std::integral chtype, typename allocator1> -inline constexpr bool operator==(::fast_io::containers::basic_string_view lhs, ::fast_io::containers::basic_string const &rhs) noexcept -{ - return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); -} - -template <::std::integral char_type, typename allocator1, ::std::size_t n> -inline constexpr bool operator==(::fast_io::containers::basic_string a, char_type const (&buffer)[n]) noexcept -{ - constexpr ::std::size_t nm1{n - 1u}; - return ::std::equal(a.cbegin(), a.cend(), buffer, buffer + nm1); -} - -template <::std::integral char_type, typename allocator1, ::std::size_t n> -inline constexpr bool operator==(char_type const (&buffer)[n], ::fast_io::containers::basic_string a) noexcept -{ - constexpr ::std::size_t nm1{n - 1u}; - return ::std::equal(buffer, buffer + nm1, a.cbegin(), a.cend()); -} - -#if __cpp_lib_three_way_comparison >= 201907L - -template <::std::integral chtype, typename allocator1, typename allocator2> -inline constexpr auto operator<=>(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string const &rhs) noexcept -{ - return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); -} - -template <::std::integral chtype, typename allocator1> -inline constexpr auto operator<=>(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string_view rhs) noexcept -{ - return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); -} - -template <::std::integral chtype, typename allocator1> -inline constexpr auto operator<=>(::fast_io::containers::basic_string_view lhs, ::fast_io::containers::basic_string const &rhs) noexcept -{ - return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); -} - -template <::std::integral char_type, typename allocator1, ::std::size_t n> -inline constexpr auto operator<=>(::fast_io::containers::basic_string a, char_type const (&buffer)[n]) noexcept -{ - constexpr ::std::size_t nm1{n - 1u}; - return ::fast_io::freestanding::lexicographical_compare_three_way(a.cbegin(), a.cend(), buffer, buffer + nm1, ::std::compare_three_way{}); -} - -template <::std::integral char_type, typename allocator1, ::std::size_t n> -inline constexpr auto operator<=>(char_type const (&buffer)[n], ::fast_io::containers::basic_string a) noexcept -{ - constexpr ::std::size_t nm1{n - 1u}; - return ::fast_io::freestanding::lexicographical_compare_three_way(buffer, buffer + nm1, a.cbegin(), a.cend(), ::std::compare_three_way{}); -} - -#endif - -template <::std::integral chtype, typename alloctype> -inline constexpr ::fast_io::basic_io_scatter_t -print_alias_define(io_alias_t, basic_string const &str) noexcept -{ - return {str.imp.begin_ptr, static_cast<::std::size_t>(str.imp.curr_ptr - str.imp.begin_ptr)}; -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr auto -strlike_construct_define(io_strlike_type_t>, - char_type const *first, char_type const *last) -{ - return basic_string(::fast_io::containers::basic_string_view(first, static_cast<::std::size_t>(last - first))); -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr auto strlike_construct_single_character_define( - io_strlike_type_t>, char_type ch) -{ - return basic_string(1, ch); -} - -template <::std::integral chtype, typename alloctype> -inline constexpr chtype *strlike_begin(::fast_io::io_strlike_type_t>, basic_string &str) noexcept -{ - return str.imp.begin_ptr; -} - -template <::std::integral chtype, typename alloctype> -inline constexpr chtype *strlike_curr(::fast_io::io_strlike_type_t>, basic_string &str) noexcept -{ - return str.imp.curr_ptr; -} - -template <::std::integral chtype, typename alloctype> -inline constexpr chtype *strlike_end(::fast_io::io_strlike_type_t>, basic_string &str) noexcept -{ - return str.imp.end_ptr; -} - -template <::std::integral chtype, typename alloctype> -inline constexpr void strlike_set_curr(::fast_io::io_strlike_type_t>, basic_string &str, chtype *p) noexcept -{ - *(str.imp.curr_ptr = p) = 0; -} - -template <::std::integral chtype, typename alloctype> -inline constexpr void strlike_reserve(::fast_io::io_strlike_type_t>, basic_string &str, ::std::size_t n) noexcept -{ - str.reserve(n); -} - -template <::std::integral chtype, typename alloctype> -inline constexpr ::fast_io::io_strlike_reference_wrapper> io_strlike_ref(::fast_io::io_alias_t, basic_string &str) noexcept -{ - return {__builtin_addressof(str)}; -} - -template <::std::integral chtype, typename alloctype> -inline constexpr void swap(::fast_io::containers::basic_string &a, ::fast_io::containers::basic_string &b) noexcept -{ - a.swap(b); -} - -template <::std::integral chtype, typename alloctype> -using basic_ostring_ref_fast_io = ::fast_io::io_strlike_reference_wrapper>; -// context scan - -struct scan_fast_io_string_context -{ - bool copying{}; -}; - -namespace details -{ - -template -inline constexpr ::fast_io::parse_result -scan_context_define_fast_io_string_impl(bool &skip_space_done, char_type const *first, char_type const *last, basic_string &ref) -{ - auto it{first}; - if constexpr (!noskipws && !line) - { - if (!skip_space_done) - { - it = ::fast_io::find_none_c_space(it, last); - if (it == last) - { - return {it, ::fast_io::parse_code::partial}; - } - skip_space_done = true; - ref.clear(); - } - } - auto it_space{it}; - if constexpr (line) - { - it_space = ::fast_io::find_lf(it_space, last); - } - else - { - it_space = ::fast_io::find_c_space(it_space, last); - } - if constexpr (noskipws || line) - { - if (!skip_space_done) - { - ref.assign(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); - skip_space_done = true; - } - else - { - ref.append(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); - } - } - else - { - ref.append(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); - } - if (it_space == last) - { - return {it_space, ::fast_io::parse_code::partial}; - } - if constexpr (line) - { - ++it_space; - } - return {it_space, ::fast_io::parse_code::ok}; -} - -inline constexpr ::fast_io::parse_code scan_context_eof_fast_io_string_define_impl(bool skip_space_done) noexcept -{ - if (skip_space_done) - { - return ::fast_io::parse_code::ok; - } - else - { - return ::fast_io::parse_code::end_of_file; - } -} - -template -inline constexpr ::fast_io::manipulators::scalar_flags fast_io_string_default_scalar_flags{.noskipws = noskipws, .line = line}; - -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::parse_result -scan_context_define_whole_fast_io_string_impl(bool ¬firstround, char_type const *first, char_type const *last, basic_string &ref) -{ - if (!notfirstround) [[unlikely]] - { - ref.assign(::fast_io::containers::basic_string_view{first, static_cast<::std::size_t>(last - first)}); - notfirstround = true; - } - else - { - ref.append(::fast_io::containers::basic_string_view{first, static_cast<::std::size_t>(last - first)}); - } - return {last, ::fast_io::parse_code::partial}; -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::parse_code -scan_context_define_whole_fast_io_string_eof_impl(bool notfirstround, basic_string &ref) -{ - if (!notfirstround) - { - ref.clear(); - } - return ::fast_io::parse_code::ok; -} - -} // namespace details - -template <::std::integral char_type, ::fast_io::manipulators::scalar_flags flags, typename allocator_type> -inline constexpr io_type_t scan_context_type( - io_reserve_type_t &>>) noexcept -{ - return {}; -} - -template <::std::integral char_type, ::fast_io::manipulators::scalar_flags flags, typename allocator_type> -inline constexpr parse_result scan_context_define( - io_reserve_type_t &>>, - scan_fast_io_string_context &skip_space_done, char_type const *first, char_type const *last, - ::fast_io::manipulators::scalar_manip_t &> str) -{ - return details::scan_context_define_fast_io_string_impl(skip_space_done.copying, first, last, str.reference); -} - -template <::fast_io::manipulators::scalar_flags flags, ::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::parse_code scan_context_eof_define( - io_reserve_type_t &>>, - scan_fast_io_string_context skip_space_done, - ::fast_io::manipulators::scalar_manip_t &> str) noexcept -{ - if constexpr (flags.line || flags.noskipws) - { - if (str.reference.empty()) - { - return ::fast_io::parse_code::end_of_file; - } - else - { - return ::fast_io::parse_code::ok; - } - } - else - { - return details::scan_context_eof_fast_io_string_define_impl(skip_space_done.copying); - } -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::manipulators::scalar_manip_t, - basic_string &> -scan_alias_define(io_alias_t, basic_string &t) noexcept -{ - return {t}; -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr io_type_t -scan_context_type(io_reserve_type_t &>>) noexcept -{ - return {}; -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr parse_result scan_context_define( - io_reserve_type_t &>>, - scan_fast_io_string_context &ctx, char_type const *first, char_type const *last, - ::fast_io::manipulators::whole_get_t &> str) -{ - return details::scan_context_define_whole_fast_io_string_impl(ctx.copying, first, last, str.reference); -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::parse_code scan_context_eof_define( - io_reserve_type_t &>>, - scan_fast_io_string_context ctx, - ::fast_io::manipulators::whole_get_t &> str) noexcept -{ - return details::scan_context_define_whole_fast_io_string_eof_impl(ctx.copying, str.reference); -} - -} // namespace containers - -namespace manipulators -{ -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::manipulators::scalar_manip_t<::fast_io::containers::details::fast_io_string_default_scalar_flags, - ::fast_io::containers::basic_string &> -line_get(::fast_io::containers::basic_string &line_str) noexcept -{ - return {line_str}; -} - -template <::std::integral char_type, typename allocator_type> -inline constexpr ::fast_io::manipulators::whole_get_t<::fast_io::containers::basic_string &> -whole_get(::fast_io::containers::basic_string &whole_str) noexcept -{ - return {whole_str}; -} -} // namespace manipulators -} // namespace fast_io +#pragma once + +namespace fast_io +{ +namespace containers +{ + +namespace details +{ + +struct +#if __has_cpp_attribute(__gnu__::__may_alias__) + [[__gnu__::__may_alias__]] +#endif + string_model +{ + void *begin_ptr; + void *curr_ptr; + void *end_ptr; +}; + +template +struct string_internal +{ + T *begin_ptr; + T *curr_ptr; + T *end_ptr; +}; + +template +inline constexpr ::fast_io::basic_allocation_least_result string_allocate_init(chtype const *first, ::std::size_t n) noexcept +{ + using typed_allocator_type = typed_generic_allocator_adapter; + // n is not possible to SIZE_MAX since that would overflow the memory which is not possible + ::std::size_t np1{n + 1}; + auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; + *::fast_io::freestanding::non_overlapped_copy_n(first, n, ptr) = 0; + return {ptr, static_cast<::std::size_t>(allocn - 1u)}; +} + +template +inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details::string_internal &imp, ::std::size_t rsize, chtype *pnullterminate) noexcept +{ + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + + ::std::size_t const bfsize{static_cast<::std::size_t>(imp.end_ptr - imp.begin_ptr)}; + ::std::size_t const strsize{static_cast<::std::size_t>(imp.curr_ptr - imp.begin_ptr)}; + + chtype *ptr; + auto beginptr{imp.begin_ptr}; + bool const is_sso{beginptr == pnullterminate}; + if (beginptr == pnullterminate) + { + beginptr = nullptr; + } + if constexpr (typed_allocator_type::has_reallocate) + { + auto [newptr, newcap] = typed_allocator_type::reallocate_at_least(beginptr, rsize + 1u); + ptr = newptr; + rsize = newcap - 1u; + } + else + { + auto [newptr, newcap] = typed_allocator_type::reallocate_n_at_least(beginptr, bfsize, rsize + 1u); + ptr = newptr; + rsize = newcap - 1u; + } + if (is_sso) + { + *ptr = 0; + } + imp = {ptr, ptr + strsize, ptr + rsize}; +} + +template +inline constexpr void string_push_back_heap_grow_twice(::fast_io::containers::details::string_internal &imp, chtype *pnullterminate) noexcept +{ + + ::std::size_t const bfsize{static_cast<::std::size_t>(imp.end_ptr - imp.begin_ptr)}; + ::std::size_t const bfsizep1{bfsize + 1u}; + + constexpr ::std::size_t mxsz{SIZE_MAX / sizeof(chtype) / 2u}; + if (mxsz < bfsizep1) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + ::std::size_t const bfsizep1mul2{bfsizep1 << 1u}; + return ::fast_io::containers::details::string_heap_dilate_uncheck(imp, bfsizep1mul2, pnullterminate); +} + +} // namespace details + +template <::std::integral chtype, typename alloctype> +class +#if __has_cpp_attribute(clang::trivial_abi) + [[clang::trivial_abi]] +#endif + basic_string +{ +public: + using allocator_type = alloctype; + using char_type = chtype; + using value_type = char_type; + using size_type = ::std::size_t; + using difference_type = ::std::ptrdiff_t; + using pointer = char_type *; + using const_pointer = char_type const *; + using reference = char_type &; + using const_reference = char_type const &; + using iterator = pointer; + using const_iterator = const_pointer; + using reverse_iterator = ::std::reverse_iterator; + using const_reverse_iterator = ::std::reverse_iterator; + using string_view_type = ::fast_io::containers::basic_string_view; + using cstring_view_type = ::fast_io::containers::basic_cstring_view; + + ::fast_io::containers::details::string_internal imp; + char_type nullterminator; + + inline constexpr basic_string() noexcept + : imp{__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator)}, + nullterminator{} + { + } + + inline explicit constexpr basic_string(size_type n) noexcept + { + if (!n) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + else + { + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + constexpr size_type mx{::std::numeric_limits::max()}; + if (n == mx) + { + ::fast_io::fast_terminate(); + } + auto [ptr, newcap]{typed_allocator_type::allocate_zero_at_least(n + 1u)}; + this->imp = {ptr, ptr + n, ptr + static_cast(newcap - 1u)}; + } + } + + inline explicit constexpr basic_string(size_type n, char_type ch) noexcept + { + if (!n) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + else + { + + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + constexpr size_type mx{::std::numeric_limits::max()}; + if (n == mx) + { + ::fast_io::fast_terminate(); + } + auto [ptr, cap]{typed_allocator_type::allocate_at_least(n + 1u)}; + this->imp = {ptr, ptr + n, ptr + static_cast(cap - 1u)}; + *::fast_io::freestanding::uninitialized_fill(ptr, ptr + n, ch) = 0; + } + } + +private: + inline constexpr void construct_impl(char_type const *otherptr, size_type othern) noexcept + { + if (!othern) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + else + { + auto newres{::fast_io::containers::details::string_allocate_init(otherptr, othern)}; + auto ptrn{newres.ptr + othern}; + this->imp = {newres.ptr, ptrn, newres.ptr + newres.count}; + } + } + +public: + inline explicit constexpr basic_string(char_type const *f, char_type const *e) noexcept + { + this->construct_impl(f, static_cast(e - f)); + } + + inline explicit constexpr basic_string(string_view_type othervw) noexcept + { + this->construct_impl(othervw.data(), othervw.size()); + } + + inline constexpr const_pointer c_str() const noexcept + { + return imp.begin_ptr; + } + + inline constexpr pointer data() noexcept + { + return imp.begin_ptr; + } + + inline constexpr const_pointer data() const noexcept + { + return imp.begin_ptr; + } + + inline constexpr bool is_empty() const noexcept + { + return imp.begin_ptr == imp.curr_ptr; + } + + inline constexpr bool empty() const noexcept + { + return imp.begin_ptr == imp.curr_ptr; + } + + inline constexpr size_type size() const noexcept + { + return static_cast(imp.curr_ptr - imp.begin_ptr); + } + inline constexpr size_type size_bytes() const noexcept + { + return static_cast(imp.curr_ptr - imp.begin_ptr) * sizeof(value_type); + } + + inline constexpr size_type capacity() const noexcept + { + return static_cast(imp.end_ptr - imp.begin_ptr); + } + + inline constexpr size_type capacity_bytes() const noexcept + { + return static_cast(imp.end_ptr - imp.begin_ptr) * sizeof(value_type); + } + + static inline constexpr size_type max_size() noexcept + { + constexpr size_type n{SIZE_MAX / sizeof(value_type)}; + return n; + } + static inline constexpr size_type max_size_bytes() noexcept + { + constexpr size_type n{SIZE_MAX / sizeof(value_type) * sizeof(value_type)}; + return n; + } +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference back() noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (begin_ptr == curr_ptr) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return curr_ptr[-1]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference back() const noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (begin_ptr == curr_ptr) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return curr_ptr[-1]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference front() noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (begin_ptr == curr_ptr) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return *begin_ptr; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference front() const noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (begin_ptr == curr_ptr) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return *begin_ptr; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference back_unchecked() noexcept + { + return imp.curr_ptr[-1]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference back_unchecked() const noexcept + { + return imp.curr_ptr[-1]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference front_unchecked() noexcept + { + return *imp.begin_ptr; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference front_unchecked() const noexcept + { + return *imp.begin_ptr; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference operator[](size_type pos) const noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (static_cast(curr_ptr - begin_ptr) <= pos) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return begin_ptr[pos]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference operator[](size_type pos) noexcept + { + auto begin_ptr{imp.begin_ptr}, curr_ptr{imp.curr_ptr}; + if (static_cast(curr_ptr - begin_ptr) <= pos) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return begin_ptr[pos]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr const_reference index_unchecked(size_type pos) const noexcept + { + return imp.begin_ptr[pos]; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + [[nodiscard]] + inline constexpr reference index_unchecked(size_type pos) noexcept + { + return imp.begin_ptr[pos]; + } + +private: + inline constexpr void moveconstructorcommon(basic_string &&other) noexcept + { + if (other.imp.begin_ptr == __builtin_addressof(other.nullterminator)) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + else + { + this->imp = other.imp; + other.imp = {__builtin_addressof(other.nullterminator), + __builtin_addressof(other.nullterminator), + __builtin_addressof(other.nullterminator)}; + other.nullterminator = 0; + } + } + +public: + inline constexpr basic_string(basic_string &&other) noexcept + { + this->moveconstructorcommon(::std::move(other)); + } + + inline constexpr basic_string &operator=(basic_string &&other) noexcept + { + if (__builtin_addressof(other) == this) [[unlikely]] + { + return *this; + } + this->destroy(); + this->moveconstructorcommon(::std::move(other)); + return *this; + } + + inline constexpr basic_string(basic_string const &other) noexcept + { + auto otherbegin{other.imp.begin_ptr}; + auto othercurr{other.imp.curr_ptr}; + if (otherbegin == othercurr) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + return; + } + ::std::size_t const stringlength{static_cast<::std::size_t>(othercurr - otherbegin)}; + auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherbegin, stringlength); + this->imp = {ptr, ptr + stringlength, ptr + allocn}; + } + +private: + inline constexpr void assign_impl(char_type const *otherptr, ::std::size_t othern) noexcept + { + auto thisbegin{this->imp.begin_ptr}; + auto thisend{this->imp.end_ptr}; + ::std::size_t const thiscap{static_cast<::std::size_t>(thisend - thisbegin)}; + if (thiscap < othern) + { + this->destroy(); + auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherptr, othern); + this->imp.end_ptr = (this->imp.begin_ptr = thisbegin = ptr) + allocn; + } + *(this->imp.curr_ptr = ::fast_io::freestanding::overlapped_copy_n(otherptr, othern, thisbegin)) = 0; + } + +public: + inline constexpr void assign(string_view_type myview) noexcept + { + this->assign_impl(myview.data(), myview.size()); + } + inline constexpr void assign_characters(size_type n, char_type ch) noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto endptr{this->imp.end_ptr}; + size_type const thiscap{static_cast(endptr - beginptr)}; + if (thiscap < n) + { + constexpr size_type mx{::std::numeric_limits::max()}; + if (n == mx) + { + ::fast_io::fast_terminate(); + } + this->destroy(); + size_type const np1{static_cast(n + 1u)}; + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; + this->imp.end_ptr = (this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u); + } + *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(beginptr, n, ch)) = 0; + } + inline constexpr void assign_characters(size_type n) noexcept + { + this->assign_characters(n, 0); + } + inline constexpr void assign_with_character(char_type ch) noexcept + { + this->assign_characters(1u, ch); + } + inline constexpr basic_string &operator=(basic_string const &other) noexcept + { + if (__builtin_addressof(other) == this) [[unlikely]] + { + return *this; + } + this->assign_impl(other.imp.begin_ptr, static_cast<::std::size_t>(other.imp.curr_ptr - other.imp.begin_ptr)); + return *this; + } + +private: +#if __has_cpp_attribute(__gnu__::__cold__) + [[__gnu__::__cold__]] +#endif + inline constexpr pointer insert_cold_impl(pointer insertpos, char_type const *otherptr, size_type othern) noexcept + { + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + constexpr size_type mx{::std::numeric_limits::max()}; + constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; + constexpr size_type mxm1{static_cast(mx - 1u)}; + + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; + bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + size_type thissize{static_cast(currptr - beginptr)}; + size_type thiscap{static_cast(endptr - beginptr)}; + size_type newsize{thissize + othern}; + + size_type bigcap; + if (mxdiv2 <= thiscap) + { + bigcap = mxm1; + } + else + { + bigcap = static_cast(thiscap << 1u); + } + size_type newcap{newsize}; + if (newcap < bigcap) + { + newcap = bigcap; + } + if (newcap == mx) + { + ::fast_io::fast_terminate(); + } + size_type const newcapp1{static_cast(newcap + 1u)}; + auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; + this->imp.begin_ptr = ptr; + this->imp.end_ptr = ptr + static_cast(allocn - 1u); + auto it{ptr}; + it = ::fast_io::freestanding::non_overlapped_copy(beginptr, insertpos, it); + auto retit{it}; + it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); + it = ::fast_io::freestanding::non_overlapped_copy(insertpos, currptr, it); + *it = 0; + this->imp.curr_ptr = it; + if (!is_sso) + { + typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); + } + return retit; + } +#if __has_cpp_attribute(__gnu__::__cold__) + [[__gnu__::__cold__]] +#endif + inline constexpr void append_cold_impl(char_type const *otherptr, size_type othern) noexcept + { +#if 0 + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + constexpr size_type mx{::std::numeric_limits::max()}; + constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; + constexpr size_type mxm1{static_cast(mx - 1u)}; + + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; + bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + size_type thissize{static_cast(currptr - beginptr)}; + size_type thiscap{static_cast(endptr - beginptr)}; + size_type newsize{thissize + othern}; + + size_type bigcap; + if (mxdiv2 <= thiscap) + { + bigcap = mxm1; + } + else + { + bigcap = static_cast(thiscap << 1u); + } + size_type newcap{newsize}; + if (newcap < bigcap) + { + newcap = bigcap; + } + if (newcap == mx) + { + ::fast_io::fast_terminate(); + } + size_type const newcapp1{static_cast(newcap + 1u)}; + auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; + this->imp.begin_ptr = ptr; + this->imp.end_ptr = ptr + static_cast(allocn - 1u); + auto it{ptr}; + it = ::fast_io::freestanding::non_overlapped_copy(beginptr, currptr, it); + it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); + *it = 0; + this->imp.curr_ptr = it; + if (!is_sso) + { + typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); + } +#else + this->insert_cold_impl(this->imp.curr_ptr, otherptr, othern); +#endif + } + inline constexpr void append_impl(char_type const *otherptr, size_type othern) noexcept + { + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; + size_type thissize{static_cast(currptr - beginptr)}; + size_type thiscap{static_cast(endptr - beginptr)}; + size_type newsize{thissize + othern}; + bool const needreallocate{thiscap < newsize}; + if (needreallocate) [[unlikely]] + { + this->append_cold_impl(otherptr, othern); + return; + } + *(this->imp.curr_ptr = ::fast_io::freestanding::overlapped_copy_n(otherptr, othern, currptr)) = 0; + } + +public: + inline constexpr void append(string_view_type vw) noexcept + { + this->append_impl(vw.data(), vw.size()); + } + inline constexpr void append(basic_string const &other) noexcept + { + this->append_impl(other.data(), other.size()); + } + + inline constexpr void clear() noexcept + { + *(this->imp.curr_ptr = this->imp.begin_ptr) = 0; + } + + inline constexpr void clear_destroy() noexcept + { + this->destroy(); + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + + inline constexpr void push_back_unchecked(char_type ch) noexcept + { + *this->imp.curr_ptr = ch; + *++this->imp.curr_ptr = 0; + } + +private: +#if __has_cpp_attribute(__gnu__::__cold__) + [[__gnu__::__cold__]] +#endif + inline constexpr void grow_twice() noexcept + { + ::fast_io::containers::details::string_push_back_heap_grow_twice(this->imp, __builtin_addressof(this->nullterminator)); + } + +public: + inline constexpr const_iterator cbegin() const noexcept + { + return this->imp.begin_ptr; + } + + inline constexpr const_iterator cend() const noexcept + { + return this->imp.curr_ptr; + } + + inline constexpr const_iterator begin() const noexcept + { + return this->imp.begin_ptr; + } + + inline constexpr const_iterator end() const noexcept + { + return this->imp.curr_ptr; + } + + inline constexpr iterator begin() noexcept + { + return this->imp.begin_ptr; + } + + inline constexpr iterator end() noexcept + { + return this->imp.curr_ptr; + } + + inline constexpr const_reverse_iterator crbegin() const noexcept + { + return const_reverse_iterator(this->imp.curr_ptr); + } + + inline constexpr const_iterator crend() const noexcept + { + return const_reverse_iterator(this->imp.begin_ptr); + } + + inline constexpr const_iterator rbegin() const noexcept + { + return const_reverse_iterator(this->imp.curr_ptr); + } + + inline constexpr const_iterator rend() const noexcept + { + return const_reverse_iterator(this->imp.begin_ptr); + } + + inline constexpr reverse_iterator rbegin() noexcept + { + return reverse_iterator(this->imp.curr_ptr); + } + + inline constexpr reverse_iterator rend() noexcept + { + return reverse_iterator(this->imp.begin_ptr); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr void push_back(char_type ch) noexcept + { + if (this->imp.curr_ptr == this->imp.end_ptr) [[unlikely]] + { + this->grow_twice(); + } + *this->imp.curr_ptr = ch; + *++this->imp.curr_ptr = 0; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr void pop_back() noexcept + { + if (this->imp.curr_ptr == this->imp.begin_ptr) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + *--this->imp.curr_ptr = 0; + } + + inline constexpr void pop_back_unchecked() noexcept + { + *--this->imp.curr_ptr = 0; + } + + inline constexpr void reserve(size_type new_cap) noexcept + { + auto begin_ptr{this->imp.begin_ptr}; + if (new_cap <= static_cast(imp.end_ptr - begin_ptr)) + { + return; + } + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, new_cap, __builtin_addressof(this->nullterminator)); + } + + inline constexpr void shrink_to_fit() noexcept + { + if (this->imp.curr_ptr == this->imp.end_ptr) + { + return; + } + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, static_cast(this->imp.curr_ptr - this->imp.begin_ptr), __builtin_addressof(this->nullterminator)); + } + +private: + inline constexpr void destroy() noexcept + { + auto beginptr{this->imp.begin_ptr}; + + if (beginptr != __builtin_addressof(this->nullterminator)) + { + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(this->imp.end_ptr - beginptr) + 1u)); + } + } + +public: + inline constexpr ~basic_string() + { + this->destroy(); + } + +private: + inline constexpr pointer insert_impl(pointer ptr, char_type const *otherptr, size_type othern) noexcept + { + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; + size_type thissize{static_cast(currptr - beginptr)}; + size_type thiscap{static_cast(endptr - beginptr)}; + size_type newsize{thissize + othern}; + bool const needreallocate{thiscap < newsize}; + if (needreallocate) [[unlikely]] + { + return this->insert_cold_impl(ptr, otherptr, othern); + } + auto newcurrptr{currptr + othern}; + *newcurrptr = 0; + auto lastptr{::fast_io::freestanding::copy_backward(ptr, currptr, newcurrptr)}; + auto retptr{::fast_io::freestanding::copy_backward(otherptr, otherptr + othern, lastptr)}; + this->imp.curr_ptr = newcurrptr; + return retptr; + } + inline constexpr void insert_index_impl(size_type idx, char_type const *otherptr, size_type othern) noexcept + { + auto beginptr{this->imp.begin_ptr}; + size_type sz{static_cast(this->imp.curr_ptr - beginptr)}; + if (sz < idx) + { + ::fast_io::fast_terminate(); + } + this->insert_impl(beginptr + idx, otherptr, othern); + } + +public: + inline constexpr void insert_index(size_type idx, string_view_type vw) noexcept + { + return this->insert_index_impl(idx, vw.data(), vw.size()); + } + inline constexpr iterator insert(const_iterator ptr, string_view_type vw) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + return this->insert_impl(this->imp.begin_ptr + (ptr - this->imp.begin_ptr), vw.data(), vw.size()); + } + else + { + return this->insert_impl(const_cast(ptr), vw.data(), vw.size()); + } + } + inline constexpr void insert_index(size_type idx, basic_string const &other) noexcept + { + return this->insert_index_impl(idx, other.data(), other.size()); + } + +private: + inline constexpr pointer erase_impl(pointer first, pointer last) noexcept + { + *(this->imp.curr_ptr = ::fast_io::freestanding::my_copy(last, this->imp.curr_ptr, first)) = 0; + return first; + } + + inline constexpr pointer erase_impl(pointer first) noexcept + { + return this->erase_impl(first, first + 1); + } + +public: + inline constexpr iterator erase(const_iterator first, const_iterator last) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + auto beginptr{this->imp.begin_ptr}; + return this->erase_impl(beginptr + (first - beginptr), beginptr + (last - beginptr)); + } + else + { + return this->erase_impl(const_cast(first), const_cast(last)); + } + } + inline constexpr void erase_index(size_type firstidx, size_type lastidx) noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const sz{static_cast(currptr - beginptr)}; + if (lastidx < firstidx || sz < lastidx) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + this->erase_impl(beginptr + firstidx, beginptr + lastidx); + } + inline constexpr iterator erase(const_iterator it) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + auto beginptr{this->imp.begin_ptr}; + return this->erase_impl(beginptr + (it - beginptr)); + } + else + { + return this->erase_impl(const_cast(it)); + } + } + inline constexpr void erase_index(size_type idx) noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const sz{static_cast(currptr - beginptr)}; + if (sz <= idx) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + this->erase_impl(beginptr + idx); + } + inline constexpr void swap(basic_string &other) noexcept + { + ::std::swap(other.imp, this->imp); + if (other.imp.begin_ptr == __builtin_addressof(this->nullterminator)) + { + other.imp = {__builtin_addressof(other.nullterminator), + __builtin_addressof(other.nullterminator), + __builtin_addressof(other.nullterminator)}; + other.nullterminator = 0; + } + if (this->imp.begin_ptr == __builtin_addressof(other.nullterminator)) + { + this->imp = {__builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator), + __builtin_addressof(this->nullterminator)}; + this->nullterminator = 0; + } + } + inline constexpr iterator insert(const_iterator ptr, basic_string const &other) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + return this->insert_impl(this->imp.begin_ptr + (ptr - this->imp.begin_ptr), other.data(), other.size()); + } + else + { + return this->insert_impl(const_cast(ptr), other.data(), other.size()); + } + } + +private: +#if __has_cpp_attribute(__gnu__::__cold__) + [[__gnu__::__cold__]] +#endif + inline constexpr pointer replace_cold_impl(pointer first, pointer last, const_pointer otherptr, size_type othern) noexcept + { + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + constexpr size_type mx{::std::numeric_limits::max()}; + constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; + constexpr size_type mxm1{static_cast(mx - 1u)}; + + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; + bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + size_type thissize{static_cast(currptr - beginptr)}; + size_type thiscap{static_cast(endptr - beginptr)}; + size_type const toremoven{static_cast(last - first)}; + size_type newsize{thissize + othern - toremoven}; + + size_type bigcap; + if (mxdiv2 <= thiscap) + { + bigcap = mxm1; + } + else + { + bigcap = static_cast(thiscap << 1u); + } + size_type newcap{newsize}; + if (newcap < bigcap) + { + newcap = bigcap; + } + if (newcap == mx) + { + ::fast_io::fast_terminate(); + } + size_type const newcapp1{static_cast(newcap + 1u)}; + auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; + this->imp.begin_ptr = ptr; + this->imp.end_ptr = ptr + static_cast(allocn - 1u); + auto it{ptr}; + it = ::fast_io::freestanding::non_overlapped_copy(beginptr, first, it); + auto retit{it}; + it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); + it = ::fast_io::freestanding::non_overlapped_copy(last, currptr, it); + *it = 0; + this->imp.curr_ptr = it; + if (!is_sso) + { + typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); + } + return retit; + } + inline constexpr pointer replace_impl(pointer first, pointer last, const_pointer otherdata, size_type othersize) noexcept + { + size_type const toremoven{static_cast(last - first)}; + auto currptr{this->imp.curr_ptr}; + if (othersize < toremoven) [[likely]] + { + auto itr{::fast_io::freestanding::overlapped_copy_n(otherdata, othersize, first)}; + if (itr != last) + { + *(this->imp.curr_ptr = ::fast_io::freestanding::copy_backward(itr, last, currptr)) = 0; + } + return first; + } + return this->replace_cold_impl(first, last, otherdata, othersize); + } + + inline constexpr void replace_index_impl(size_type firstidx, size_type lastidx, const_pointer otherdata, size_type othersize) noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const sz{static_cast(currptr - beginptr)}; + if (lastidx < firstidx || sz < lastidx) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + this->replace_impl(beginptr + firstidx, beginptr + lastidx, otherdata, othersize); + } + +public: +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr iterator replace(const_iterator first, const_iterator last, string_view_type view) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + auto beginptr{this->imp.begin_ptr}; + return this->replace_impl(beginptr + (first - beginptr), beginptr + (last - beginptr), view.data(), view.size()); + } + else + { + return this->replace_impl(const_cast(first), const_cast(last), view.data(), view.size()); + } + } +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr iterator replace(const_iterator first, const_iterator last, basic_string const &view) noexcept + { +#ifdef __cpp_if_consteval + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + auto beginptr{this->imp.begin_ptr}; + return this->replace_impl(beginptr + (first - beginptr), beginptr + (last - beginptr), view.data(), view.size()); + } + else + { + return this->replace_impl(const_cast(first), const_cast(last), view.data(), view.size()); + } + } +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr void replace_index(size_type firstidx, size_type lastidx, string_view_type view) noexcept + { + return this->replace_index_impl(firstidx, lastidx, view.data(), view.size()); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr void replace_index(size_type firstidx, size_type lastidx, basic_string const &view) noexcept + { + return this->replace_index_impl(firstidx, lastidx, view.data(), view.size()); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr cstring_view_type subview_back(size_type count) const noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + if (thisn < count) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return cstring_view_type(::fast_io::containers::null_terminated, beginptr + (thisn - count), count); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr cstring_view_type subview_back_unchecked(size_type count) const noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + return cstring_view_type(::fast_io::containers::null_terminated, beginptr + (thisn - count), count); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr string_view_type subview_front(size_type count) const noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + if (thisn < count) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + return string_view_type(beginptr, count); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr string_view_type subview_front_unchecked(size_type count) const noexcept + { + return string_view_type(this->imp.begin_ptr, count); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr string_view_type subview(size_type pos, size_type count = ::fast_io::containers::npos) const noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + if (thisn < pos) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + size_type const val{thisn - pos}; + if (val < count) + { + if (count != ::fast_io::containers::npos) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + count = val; + } + return string_view_type(beginptr + pos, count); + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr string_view_type subview_unchecked(size_type pos, size_type count = ::fast_io::containers::npos) const noexcept + { + auto beginptr{this->imp.begin_ptr}; + if (count == ::fast_io::containers::npos) + { + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + size_type const val{thisn - pos}; + count = val; + } + return string_view_type(beginptr + pos, count); + } + + inline constexpr bool starts_with(string_view_type sv) const noexcept + { + return string_view_type(this->data(), this->size()).starts_with(sv); + } + inline constexpr bool starts_with(basic_string const &other) const noexcept + { + return this->starts_with(string_view_type(other)); + } + + inline constexpr bool starts_with_character(value_type ch) const noexcept + { + return string_view_type(this->data(), this->size()).starts_with_character(ch); + } + inline constexpr bool ends_with(string_view_type sv) const noexcept + { + return string_view_type(this->data(), this->size()).ends_with(sv); + } + inline constexpr bool ends_with(basic_string const &other) const noexcept + { + return this->ends_with(string_view_type(other)); + } + + inline constexpr bool ends_with_character(value_type ch) const noexcept + { + return string_view_type(this->data(), this->size()).ends_with_character(ch); + } + + inline constexpr void remove_suffix(size_type svn) noexcept + { + auto beginptr{this->imp.begin_ptr}; + auto currptr{this->imp.curr_ptr}; + size_type const thisn{static_cast(currptr - beginptr)}; + if (thisn < svn) [[unlikely]] + { + ::fast_io::fast_terminate(); + } + currptr -= svn; + *(this->imp.curr_ptr = currptr) = 0; + } + + inline constexpr void remove_suffix_unchecked(size_type svn) noexcept + { + *(this->imp.curr_ptr -= svn) = 0; + } + + inline constexpr bool contains(string_view_type vw) const noexcept + { + auto ed{this->imp.curr_ptr}; + return ::std::search(this->imp.begin_ptr, ed, vw.ptr, vw.ptr + vw.n) != ed; + } + inline constexpr bool contains(basic_string const &other) const noexcept + { + auto ed{this->imp.curr_ptr}; + return ::std::search(this->imp.begin_ptr, ed, other.cbegin(), other.cend()) != ed; + } + inline constexpr bool contains_character(char_type ch) const noexcept + { + auto ed{this->imp.curr_ptr}; + return ::std::find(this->imp.begin_ptr, ed, ch) != ed; + } + +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr size_type copy(char_type *dest, size_type count, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).copy(dest, count, pos); + } +#if __has_cpp_attribute(__gnu__::__always_inline__) + [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) + [[msvc::forceinline]] +#endif + inline constexpr size_type copy_unchecked(char_type *dest, size_type count, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).copy_unchecked(dest, count, pos); + } + + inline constexpr basic_string substr_back(size_type count) const noexcept + { + return basic_string(this->subview_back(count)); + } + + inline constexpr basic_string substr_front(size_type count) const noexcept + { + return basic_string(this->subview_front(count)); + } + + inline constexpr basic_string substr(size_type idx, size_type count = ::fast_io::containers::npos) const noexcept + { + return basic_string(this->subview(idx, count)); + } + + inline constexpr size_type find_character(char_type ch, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).find_character(ch, pos); + } + inline constexpr size_type find_not_character(char_type ch, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).find_not_character(ch, pos); + } + inline constexpr size_type rfind_character(char_type ch, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).rfind_character(ch, pos); + } + inline constexpr size_type rfind_not_character(char_type ch, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).rfind_not_character(ch, pos); + } + inline constexpr size_type find(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).find(s, pos, count); + } + inline constexpr size_type find(string_view_type v, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).find(v, pos); + } + inline constexpr size_type rfind(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).rfind(s, pos, count); + } + inline constexpr size_type rfind(string_view_type v, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).rfind(v.data(), v.size(), pos); + } + inline constexpr size_type rfind(basic_string const &v, size_type pos = 0) const noexcept + { + return string_view_type(this->data(), this->size()).rfind(v.data(), v.size(), pos); + } + + inline constexpr size_type find_first_of(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).find_first_of(s, pos, count); + } + inline constexpr size_type find_first_of(string_view_type s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_first_of(s, pos); + } + inline constexpr size_type find_first_not_of(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).find_first_of(s, pos, count); + } + inline constexpr size_type find_first_not_of(string_view_type s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_first_not_of(s, pos); + } + inline constexpr size_type find_first_not_of(basic_string const &s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_first_not_of(s.data(), s.size(), pos); + } + inline constexpr size_type find_last_of(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_of(s, pos, count); + } + inline constexpr size_type find_last_of(string_view_type s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_of(s, pos); + } + inline constexpr size_type find_last_of(basic_string const &s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_of(s.data(), pos, s.size()); + } + inline constexpr size_type find_last_not_of(const_pointer s, size_type pos, size_type count) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_not_of(s, pos, count); + } + inline constexpr size_type find_last_not_of(string_view_type s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_not_of(s.ptr, pos, s.n); + } + inline constexpr size_type find_last_not_of(basic_string const &s, size_type pos) const noexcept + { + return string_view_type(this->data(), this->size()).find_last_not_of(s.data(), pos, s.size()); + } + inline constexpr auto compare_three_way(size_type pos1, size_type count1, const_pointer s, size_type count2) const noexcept + { + return this->subview(pos1, count1) <=> string_view_type(s, count2); + } + inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, const_pointer s, size_type count2) const noexcept + { + return this->subview_unchecked(pos1, count1) <=> string_view_type(s, count2); + } + inline constexpr auto compare_three_way(size_type pos1, size_type count1, string_view_type other, size_type pos2, size_type count2) const noexcept + { + return this->subview(pos1, count1) <=> other.subview(pos2, count2); + } + inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, string_view_type other, size_type pos2, size_type count2) const noexcept + { + return this->subview_unchecked(pos1, count1) <=> other.subview_unchecked(pos2, count2); + } + inline constexpr auto compare_three_way(size_type pos1, size_type count1, basic_string const &other, size_type pos2, size_type count2) const noexcept + { + return this->subview(pos1, count1) <=> other.subview(pos2, count2); + } + inline constexpr auto compare_three_way_unchecked(size_type pos1, size_type count1, basic_string const &other, size_type pos2, size_type count2) const noexcept + { + return this->subview_unchecked(pos1, count1) <=> other.subview_unchecked(pos2, count2); + } + + template + inline constexpr void resize_and_overwrite(size_type count, Operation op) noexcept + { + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}; + size_type thissize{static_cast(currptr - beginptr)}; + if (thissize < count) + { + auto endptr{this->imp.end_ptr}; + size_type thiscap{static_cast(endptr - beginptr)}; + if (thiscap < count) + { + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); + beginptr = this->imp.begin_ptr; + } + } + *(this->imp.curr_ptr = (beginptr + op(beginptr, count))) = 0; + } + + inline constexpr void resize(size_type count, char_type ch) noexcept + { + auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}; + size_type thissize{static_cast(currptr - beginptr)}; + if (count <= thissize) + { + if (count != thissize) + { + *(this->imp.curr_ptr -= static_cast(thissize - count)) = 0; + } + return; + } + auto endptr{this->imp.end_ptr}; + size_type thiscap{static_cast(endptr - beginptr)}; + if (thiscap < count) + { + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); + currptr = this->imp.curr_ptr; + } + *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(currptr, static_cast(count - thissize), ch)) = 0; + } + inline constexpr void resize(size_type count) noexcept + { + this->resize(count, 0); + } +}; + +template <::std::integral chtype, typename allocator1, typename U> +inline constexpr ::fast_io::containers::basic_string::size_type erase(::fast_io::containers::basic_string &c, U const &value) +{ + auto it = ::std::remove(c.begin(), c.end(), value); + auto r = c.end() - it; + c.erase(it, c.end()); + return static_cast<::fast_io::containers::basic_string::size_type>(r); +} + +template <::std::integral chtype, typename allocator1, typename Pred> +inline constexpr ::fast_io::containers::basic_string::size_type erase_if(::fast_io::containers::basic_string &c, Pred pred) +{ + auto it = ::std::remove_if(c.begin(), c.end(), pred); + auto r = c.end() - it; + c.erase(it, c.end()); + return static_cast<::fast_io::containers::basic_string::size_type>(r); +} + +template <::std::integral chtype, typename allocator1, typename allocator2> +inline constexpr bool operator==(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string const &rhs) noexcept +{ + return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); +} + +template <::std::integral chtype, typename allocator1> +inline constexpr bool operator==(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string_view rhs) noexcept +{ + return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); +} + +template <::std::integral chtype, typename allocator1> +inline constexpr bool operator==(::fast_io::containers::basic_string_view lhs, ::fast_io::containers::basic_string const &rhs) noexcept +{ + return ::std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); +} + +template <::std::integral char_type, typename allocator1, ::std::size_t n> +inline constexpr bool operator==(::fast_io::containers::basic_string a, char_type const (&buffer)[n]) noexcept +{ + constexpr ::std::size_t nm1{n - 1u}; + return ::std::equal(a.cbegin(), a.cend(), buffer, buffer + nm1); +} + +template <::std::integral char_type, typename allocator1, ::std::size_t n> +inline constexpr bool operator==(char_type const (&buffer)[n], ::fast_io::containers::basic_string a) noexcept +{ + constexpr ::std::size_t nm1{n - 1u}; + return ::std::equal(buffer, buffer + nm1, a.cbegin(), a.cend()); +} + +#if __cpp_lib_three_way_comparison >= 201907L + +template <::std::integral chtype, typename allocator1, typename allocator2> +inline constexpr auto operator<=>(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string const &rhs) noexcept +{ + return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); +} + +template <::std::integral chtype, typename allocator1> +inline constexpr auto operator<=>(::fast_io::containers::basic_string const &lhs, ::fast_io::containers::basic_string_view rhs) noexcept +{ + return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); +} + +template <::std::integral chtype, typename allocator1> +inline constexpr auto operator<=>(::fast_io::containers::basic_string_view lhs, ::fast_io::containers::basic_string const &rhs) noexcept +{ + return ::fast_io::freestanding::lexicographical_compare_three_way(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), ::std::compare_three_way{}); +} + +template <::std::integral char_type, typename allocator1, ::std::size_t n> +inline constexpr auto operator<=>(::fast_io::containers::basic_string a, char_type const (&buffer)[n]) noexcept +{ + constexpr ::std::size_t nm1{n - 1u}; + return ::fast_io::freestanding::lexicographical_compare_three_way(a.cbegin(), a.cend(), buffer, buffer + nm1, ::std::compare_three_way{}); +} + +template <::std::integral char_type, typename allocator1, ::std::size_t n> +inline constexpr auto operator<=>(char_type const (&buffer)[n], ::fast_io::containers::basic_string a) noexcept +{ + constexpr ::std::size_t nm1{n - 1u}; + return ::fast_io::freestanding::lexicographical_compare_three_way(buffer, buffer + nm1, a.cbegin(), a.cend(), ::std::compare_three_way{}); +} + +#endif + +template <::std::integral chtype, typename alloctype> +inline constexpr ::fast_io::basic_io_scatter_t +print_alias_define(io_alias_t, basic_string const &str) noexcept +{ + return {str.imp.begin_ptr, static_cast<::std::size_t>(str.imp.curr_ptr - str.imp.begin_ptr)}; +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr auto +strlike_construct_define(io_strlike_type_t>, + char_type const *first, char_type const *last) +{ + return basic_string(::fast_io::containers::basic_string_view(first, static_cast<::std::size_t>(last - first))); +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr auto strlike_construct_single_character_define( + io_strlike_type_t>, char_type ch) +{ + return basic_string(1, ch); +} + +template <::std::integral chtype, typename alloctype> +inline constexpr chtype *strlike_begin(::fast_io::io_strlike_type_t>, basic_string &str) noexcept +{ + return str.imp.begin_ptr; +} + +template <::std::integral chtype, typename alloctype> +inline constexpr chtype *strlike_curr(::fast_io::io_strlike_type_t>, basic_string &str) noexcept +{ + return str.imp.curr_ptr; +} + +template <::std::integral chtype, typename alloctype> +inline constexpr chtype *strlike_end(::fast_io::io_strlike_type_t>, basic_string &str) noexcept +{ + return str.imp.end_ptr; +} + +template <::std::integral chtype, typename alloctype> +inline constexpr void strlike_set_curr(::fast_io::io_strlike_type_t>, basic_string &str, chtype *p) noexcept +{ + *(str.imp.curr_ptr = p) = 0; +} + +template <::std::integral chtype, typename alloctype> +inline constexpr void strlike_reserve(::fast_io::io_strlike_type_t>, basic_string &str, ::std::size_t n) noexcept +{ + str.reserve(n); +} + +template <::std::integral chtype, typename alloctype> +inline constexpr ::fast_io::io_strlike_reference_wrapper> io_strlike_ref(::fast_io::io_alias_t, basic_string &str) noexcept +{ + return {__builtin_addressof(str)}; +} + +template <::std::integral chtype, typename alloctype> +inline constexpr void swap(::fast_io::containers::basic_string &a, ::fast_io::containers::basic_string &b) noexcept +{ + a.swap(b); +} + +template <::std::integral chtype, typename alloctype> +using basic_ostring_ref_fast_io = ::fast_io::io_strlike_reference_wrapper>; +// context scan + +struct scan_fast_io_string_context +{ + bool copying{}; +}; + +namespace details +{ + +template +inline constexpr ::fast_io::parse_result +scan_context_define_fast_io_string_impl(bool &skip_space_done, char_type const *first, char_type const *last, basic_string &ref) +{ + auto it{first}; + if constexpr (!noskipws && !line) + { + if (!skip_space_done) + { + it = ::fast_io::find_none_c_space(it, last); + if (it == last) + { + return {it, ::fast_io::parse_code::partial}; + } + skip_space_done = true; + ref.clear(); + } + } + auto it_space{it}; + if constexpr (line) + { + it_space = ::fast_io::find_lf(it_space, last); + } + else + { + it_space = ::fast_io::find_c_space(it_space, last); + } + if constexpr (noskipws || line) + { + if (!skip_space_done) + { + ref.assign(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); + skip_space_done = true; + } + else + { + ref.append(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); + } + } + else + { + ref.append(::fast_io::containers::basic_string_view{it, static_cast<::std::size_t>(it_space - it)}); + } + if (it_space == last) + { + return {it_space, ::fast_io::parse_code::partial}; + } + if constexpr (line) + { + ++it_space; + } + return {it_space, ::fast_io::parse_code::ok}; +} + +inline constexpr ::fast_io::parse_code scan_context_eof_fast_io_string_define_impl(bool skip_space_done) noexcept +{ + if (skip_space_done) + { + return ::fast_io::parse_code::ok; + } + else + { + return ::fast_io::parse_code::end_of_file; + } +} + +template +inline constexpr ::fast_io::manipulators::scalar_flags fast_io_string_default_scalar_flags{.noskipws = noskipws, .line = line}; + +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::parse_result +scan_context_define_whole_fast_io_string_impl(bool ¬firstround, char_type const *first, char_type const *last, basic_string &ref) +{ + if (!notfirstround) [[unlikely]] + { + ref.assign(::fast_io::containers::basic_string_view{first, static_cast<::std::size_t>(last - first)}); + notfirstround = true; + } + else + { + ref.append(::fast_io::containers::basic_string_view{first, static_cast<::std::size_t>(last - first)}); + } + return {last, ::fast_io::parse_code::partial}; +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::parse_code +scan_context_define_whole_fast_io_string_eof_impl(bool notfirstround, basic_string &ref) +{ + if (!notfirstround) + { + ref.clear(); + } + return ::fast_io::parse_code::ok; +} + +} // namespace details + +template <::std::integral char_type, ::fast_io::manipulators::scalar_flags flags, typename allocator_type> +inline constexpr io_type_t scan_context_type( + io_reserve_type_t &>>) noexcept +{ + return {}; +} + +template <::std::integral char_type, ::fast_io::manipulators::scalar_flags flags, typename allocator_type> +inline constexpr parse_result scan_context_define( + io_reserve_type_t &>>, + scan_fast_io_string_context &skip_space_done, char_type const *first, char_type const *last, + ::fast_io::manipulators::scalar_manip_t &> str) +{ + return details::scan_context_define_fast_io_string_impl(skip_space_done.copying, first, last, str.reference); +} + +template <::fast_io::manipulators::scalar_flags flags, ::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::parse_code scan_context_eof_define( + io_reserve_type_t &>>, + scan_fast_io_string_context skip_space_done, + ::fast_io::manipulators::scalar_manip_t &> str) noexcept +{ + if constexpr (flags.line || flags.noskipws) + { + if (str.reference.empty()) + { + return ::fast_io::parse_code::end_of_file; + } + else + { + return ::fast_io::parse_code::ok; + } + } + else + { + return details::scan_context_eof_fast_io_string_define_impl(skip_space_done.copying); + } +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::manipulators::scalar_manip_t, + basic_string &> +scan_alias_define(io_alias_t, basic_string &t) noexcept +{ + return {t}; +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr io_type_t +scan_context_type(io_reserve_type_t &>>) noexcept +{ + return {}; +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr parse_result scan_context_define( + io_reserve_type_t &>>, + scan_fast_io_string_context &ctx, char_type const *first, char_type const *last, + ::fast_io::manipulators::whole_get_t &> str) +{ + return details::scan_context_define_whole_fast_io_string_impl(ctx.copying, first, last, str.reference); +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::parse_code scan_context_eof_define( + io_reserve_type_t &>>, + scan_fast_io_string_context ctx, + ::fast_io::manipulators::whole_get_t &> str) noexcept +{ + return details::scan_context_define_whole_fast_io_string_eof_impl(ctx.copying, str.reference); +} + +} // namespace containers + +namespace manipulators +{ +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::manipulators::scalar_manip_t<::fast_io::containers::details::fast_io_string_default_scalar_flags, + ::fast_io::containers::basic_string &> +line_get(::fast_io::containers::basic_string &line_str) noexcept +{ + return {line_str}; +} + +template <::std::integral char_type, typename allocator_type> +inline constexpr ::fast_io::manipulators::whole_get_t<::fast_io::containers::basic_string &> +whole_get(::fast_io::containers::basic_string &whole_str) noexcept +{ + return {whole_str}; +} +} // namespace manipulators +} // namespace fast_io From dbd5b39f6611d7e8b4ee016d892758629b36a408 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 20:36:51 -0500 Subject: [PATCH 06/51] overhual the implementation of string.h to remove the self-referencing and make it trivially_relocatable --- include/fast_io_dsal/impl/string.h | 188 ++++++++++++++++------------- 1 file changed, 105 insertions(+), 83 deletions(-) diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 637e7f281..76e1f2a31 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -32,14 +32,14 @@ inline constexpr ::fast_io::basic_allocation_least_result string_alloc { using typed_allocator_type = typed_generic_allocator_adapter; // n is not possible to SIZE_MAX since that would overflow the memory which is not possible - ::std::size_t np1{n + 1}; + ::std::size_t const np1{static_cast<::std::size_t>(n + 1u)}; auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; *::fast_io::freestanding::non_overlapped_copy_n(first, n, ptr) = 0; return {ptr, static_cast<::std::size_t>(allocn - 1u)}; } template -inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details::string_internal &imp, ::std::size_t rsize, chtype *pnullterminate) noexcept +inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details::string_internal &imp, ::std::size_t rsize) noexcept { using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; @@ -49,8 +49,8 @@ inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details: chtype *ptr; auto beginptr{imp.begin_ptr}; - bool const is_sso{beginptr == pnullterminate}; - if (beginptr == pnullterminate) + bool const is_sso{!bfsize}; + if (is_sso) { beginptr = nullptr; } @@ -66,15 +66,11 @@ inline constexpr void string_heap_dilate_uncheck(::fast_io::containers::details: ptr = newptr; rsize = newcap - 1u; } - if (is_sso) - { - *ptr = 0; - } imp = {ptr, ptr + strsize, ptr + rsize}; } template -inline constexpr void string_push_back_heap_grow_twice(::fast_io::containers::details::string_internal &imp, chtype *pnullterminate) noexcept +inline constexpr void string_push_back_heap_grow_twice(::fast_io::containers::details::string_internal &imp) noexcept { ::std::size_t const bfsize{static_cast<::std::size_t>(imp.end_ptr - imp.begin_ptr)}; @@ -86,17 +82,13 @@ inline constexpr void string_push_back_heap_grow_twice(::fast_io::containers::de ::fast_io::fast_terminate(); } ::std::size_t const bfsizep1mul2{bfsizep1 << 1u}; - return ::fast_io::containers::details::string_heap_dilate_uncheck(imp, bfsizep1mul2, pnullterminate); + return ::fast_io::containers::details::string_heap_dilate_uncheck(imp, bfsizep1mul2); } } // namespace details template <::std::integral chtype, typename alloctype> -class -#if __has_cpp_attribute(clang::trivial_abi) - [[clang::trivial_abi]] -#endif - basic_string +class basic_string { public: using allocator_type = alloctype; @@ -116,23 +108,43 @@ class using cstring_view_type = ::fast_io::containers::basic_cstring_view; ::fast_io::containers::details::string_internal imp; - char_type nullterminator; +private: + constexpr void reset_imp() noexcept + { + +#if (__cpp_if_consteval >= 202106L || __cpp_lib_is_constant_evaluated >= 201811L) && __cpp_constexpr_dynamic_alloc >= 201907L +#if __cpp_if_consteval >= 202106L + if consteval +#else + if (__builtin_is_constant_evaluated()) +#endif + { + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + auto [ptr, cap]{typed_allocator_type::allocate_at_least(2)}; + *ptr = 0; + this->imp = {ptr, ptr, ptr + static_cast(cap - 1u)}; + } + else +#endif + { + char_type *const ncstr{const_cast(null_terminated_c_str_v)}; + this->imp = {ncstr, ncstr, ncstr}; + } + } + +public: inline constexpr basic_string() noexcept - : imp{__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}, - nullterminator{} { + this->reset_imp(); } inline explicit constexpr basic_string(size_type n) noexcept { if (!n) { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; + this->reset_imp(); } else { @@ -152,9 +164,7 @@ class { if (!n) { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; + this->reset_imp(); } else { @@ -177,9 +187,7 @@ class { if (!othern) { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; + this->reset_imp(); } else { @@ -419,21 +427,8 @@ class private: inline constexpr void moveconstructorcommon(basic_string &&other) noexcept { - if (other.imp.begin_ptr == __builtin_addressof(other.nullterminator)) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } - else - { - this->imp = other.imp; - other.imp = {__builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator)}; - other.nullterminator = 0; - } + this->imp = other.imp; + other.reset_imp(); } public: @@ -459,9 +454,7 @@ class auto othercurr{other.imp.curr_ptr}; if (otherbegin == othercurr) { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; + this->reset_imp(); return; } ::std::size_t const stringlength{static_cast<::std::size_t>(othercurr - otherbegin)}; @@ -481,6 +474,10 @@ class auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherptr, othern); this->imp.end_ptr = (this->imp.begin_ptr = thisbegin = ptr) + allocn; } + if (this->imp.begin_ptr == this->imp.end_ptr) [[unlikely]] + { + return; + } *(this->imp.curr_ptr = ::fast_io::freestanding::overlapped_copy_n(otherptr, othern, thisbegin)) = 0; } @@ -508,6 +505,10 @@ class auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; this->imp.end_ptr = (this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u); } + if (this->imp.begin_ptr == this->imp.end_ptr) [[unlikely]] + { + return; + } *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(beginptr, n, ch)) = 0; } inline constexpr void assign_characters(size_type n) noexcept @@ -534,6 +535,10 @@ class #endif inline constexpr pointer insert_cold_impl(pointer insertpos, char_type const *otherptr, size_type othern) noexcept { + if (!othern) + { + return insertpos; + } using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; constexpr size_type mx{::std::numeric_limits::max()}; @@ -541,7 +546,7 @@ class constexpr size_type mxm1{static_cast(mx - 1u)}; auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + bool const is_sso{this->imp.begin_ptr == this->imp.end_ptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; size_type newsize{thissize + othern}; @@ -594,7 +599,7 @@ class constexpr size_type mxm1{static_cast(mx - 1u)}; auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + bool const is_sso{beginptr == endptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; size_type newsize{thissize + othern}; @@ -661,16 +666,17 @@ class inline constexpr void clear() noexcept { + if (this->imp.begin_ptr == this->imp.end_ptr) [[unlikely]] + { + return; + } *(this->imp.curr_ptr = this->imp.begin_ptr) = 0; } inline constexpr void clear_destroy() noexcept { this->destroy(); - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; + this->reset_imp(); } inline constexpr void push_back_unchecked(char_type ch) noexcept @@ -685,7 +691,7 @@ class #endif inline constexpr void grow_twice() noexcept { - ::fast_io::containers::details::string_push_back_heap_grow_twice(this->imp, __builtin_addressof(this->nullterminator)); + ::fast_io::containers::details::string_push_back_heap_grow_twice(this->imp); } public: @@ -790,7 +796,7 @@ class { return; } - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, new_cap, __builtin_addressof(this->nullterminator)); + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, new_cap); } inline constexpr void shrink_to_fit() noexcept @@ -799,20 +805,22 @@ class { return; } - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, static_cast(this->imp.curr_ptr - this->imp.begin_ptr), __builtin_addressof(this->nullterminator)); + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, static_cast(this->imp.curr_ptr - this->imp.begin_ptr)); } private: inline constexpr void destroy() noexcept { auto beginptr{this->imp.begin_ptr}; + auto endptr{this->imp.end_ptr}; - if (beginptr != __builtin_addressof(this->nullterminator)) + if (beginptr == endptr) { - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(this->imp.end_ptr - beginptr) + 1u)); + return; } + using untyped_allocator_type = generic_allocator_adapter; + using typed_allocator_type = typed_generic_allocator_adapter; + typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); } public: @@ -824,6 +832,10 @@ class private: inline constexpr pointer insert_impl(pointer ptr, char_type const *otherptr, size_type othern) noexcept { + if (!othern) + { + return ptr; + } auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; @@ -879,7 +891,10 @@ class private: inline constexpr pointer erase_impl(pointer first, pointer last) noexcept { - *(this->imp.curr_ptr = ::fast_io::freestanding::my_copy(last, this->imp.curr_ptr, first)) = 0; + if (this->imp.begin_ptr != this->imp.end_ptr) [[likely]] + { + *(this->imp.curr_ptr = ::fast_io::freestanding::my_copy(last, this->imp.curr_ptr, first)) = 0; + } return first; } @@ -946,20 +961,6 @@ class inline constexpr void swap(basic_string &other) noexcept { ::std::swap(other.imp, this->imp); - if (other.imp.begin_ptr == __builtin_addressof(this->nullterminator)) - { - other.imp = {__builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator), - __builtin_addressof(other.nullterminator)}; - other.nullterminator = 0; - } - if (this->imp.begin_ptr == __builtin_addressof(other.nullterminator)) - { - this->imp = {__builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator), - __builtin_addressof(this->nullterminator)}; - this->nullterminator = 0; - } } inline constexpr iterator insert(const_iterator ptr, basic_string const &other) noexcept { @@ -986,11 +987,11 @@ class using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; constexpr size_type mx{::std::numeric_limits::max()}; - constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; + constexpr size_type mxdiv2{mx >> 1u}; constexpr size_type mxm1{static_cast(mx - 1u)}; auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{this->imp.begin_ptr == __builtin_addressof(this->nullterminator)}; + bool const is_sso{beginptr == endptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; size_type const toremoven{static_cast(last - first)}; @@ -1435,30 +1436,35 @@ class size_type thiscap{static_cast(endptr - beginptr)}; if (thiscap < count) { - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count); beginptr = this->imp.begin_ptr; } } - *(this->imp.curr_ptr = (beginptr + op(beginptr, count))) = 0; + this->imp.curr_ptr = (beginptr + op(beginptr, count)); + if (this->imp.end_ptr == this->imp.begin_ptr) [[unlikely]] + { + return; + } + *(this->imp.curr_ptr) = 0; } inline constexpr void resize(size_type count, char_type ch) noexcept { auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}; + auto endptr{this->imp.end_ptr}; size_type thissize{static_cast(currptr - beginptr)}; if (count <= thissize) { - if (count != thissize) + if (beginptr != endptr && count != thissize) { *(this->imp.curr_ptr -= static_cast(thissize - count)) = 0; } return; } - auto endptr{this->imp.end_ptr}; size_type thiscap{static_cast(endptr - beginptr)}; if (thiscap < count) { - ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count, __builtin_addressof(this->nullterminator)); + ::fast_io::containers::details::string_heap_dilate_uncheck(this->imp, count); currptr = this->imp.curr_ptr; } *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(currptr, static_cast(count - thissize), ch)) = 0; @@ -1598,6 +1604,10 @@ inline constexpr chtype *strlike_end(::fast_io::io_strlike_type_t inline constexpr void strlike_set_curr(::fast_io::io_strlike_type_t>, basic_string &str, chtype *p) noexcept { + if (str.imp.begin_ptr == str.imp.end_ptr) [[unlikely]] + { + return; + } *(str.imp.curr_ptr = p) = 0; } @@ -1820,4 +1830,16 @@ whole_get(::fast_io::containers::basic_string &whole_ return {whole_str}; } } // namespace manipulators -} // namespace fast_io + +namespace freestanding +{ + +template <::std::integral chtype, typename alloctype> +struct is_trivially_relocatable<::fast_io::containers::basic_string> +{ + inline static constexpr bool value = true; +}; + +} // namespace freestanding + +} // namespace fast_io \ No newline at end of file From f856ffc08cbbd095c6909be18bd7aa0053f5a05f Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 21:33:49 -0500 Subject: [PATCH 07/51] fix string append for empty string --- include/fast_io_dsal/impl/string.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 76e1f2a31..e7ae3cf51 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -641,6 +641,10 @@ class basic_string } inline constexpr void append_impl(char_type const *otherptr, size_type othern) noexcept { + if (!othern) + { + return; + } auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; From e8c68893c3c3e88dcb2abc820823e8bd32c1a18f Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 22:12:35 -0500 Subject: [PATCH 08/51] Add fuzzing tests for string Add basic_string_view, basic_cstring_view and basic_string in fast_io namespace --- fuzzing/0007.containers/string/string.cc | 175 +++++++++++++++++++++++ include/fast_io_dsal/string.h | 39 +++++ include/fast_io_dsal/string_view.h | 4 + 3 files changed, 218 insertions(+) create mode 100644 fuzzing/0007.containers/string/string.cc diff --git a/fuzzing/0007.containers/string/string.cc b/fuzzing/0007.containers/string/string.cc new file mode 100644 index 000000000..39c59fcd4 --- /dev/null +++ b/fuzzing/0007.containers/string/string.cc @@ -0,0 +1,175 @@ +/** + * This code was generated using Microsoft Copilot. + */ + +#include +#include +#include +#include + +template +inline void FuzzString(uint8_t const *data, size_t size) +{ + // Adjust size according to the character type + size /= sizeof(CharT); + + // Convert input data to a string view + fast_io::basic_string_view sv(reinterpret_cast(data), size); + + // Initialize your string with the string view + fast_io::basic_string s(sv); + + // Perform various operations on the string + s.append(sv); + + // Test insert method with a string view + if (s.size() >= 5) + { + s.insert(s.cbegin() + 3, sv); + s.insert_index(3, sv); + } + + // Test replace_index method within valid range + if (s.size() >= 10) + { + s.replace_index(2, 8, sv); + } + + // Access elements using bounds-checked indexing + if (s.size() > 0) + { + CharT first_char = s[0]; // Test element access with bounds checking + s[0] = 'x'; // Test element modification with bounds checking + } + + // Perform unchecked element access if size is valid + if (s.size() > 0) + { + CharT unchecked_char = s.index_unchecked(0); // Test unchecked element access + } + + // Test string comparison + if constexpr (std::is_same_v) + { + fast_io::basic_string_view other_string_view("test"); + fast_io::basic_string other_string(other_string_view); + bool is_equal = (s == other_string); + } + else if constexpr (std::is_same_v) + { + fast_io::basic_string_view other_string_view(L"test"); + fast_io::basic_string other_string(other_string_view); + bool is_equal = (s == other_string); + } + else if constexpr (std::is_same_v) + { + fast_io::basic_string_view other_string_view(u8"test"); + fast_io::basic_string other_string(other_string_view); + bool is_equal = (s == other_string); + } + else if constexpr (std::is_same_v) + { + fast_io::basic_string_view other_string_view(u"test"); + fast_io::basic_string other_string(other_string_view); + bool is_equal = (s == other_string); + } + else if constexpr (std::is_same_v) + { + fast_io::basic_string_view other_string_view(U"test"); + fast_io::basic_string other_string(other_string_view); + bool is_equal = (s == other_string); + } + + // Test clear method + s.clear(); + + // Test clear_destroy method + s.clear_destroy(); + + // Continue operations after clear_destroy to ensure correctness + if constexpr (std::is_same_v) + { + s.append("additional data after clear_destroy"); + } + else if constexpr (std::is_same_v) + { + s.append(L"additional data after clear_destroy"); + } + else if constexpr (std::is_same_v) + { + s.append(u8"additional data after clear_destroy"); + } + else if constexpr (std::is_same_v) + { + s.append(u"additional data after clear_destroy"); + } + else if constexpr (std::is_same_v) + { + s.append(U"additional data after clear_destroy"); + } + + s.insert(s.cbegin(), sv); + if (s.size() >= 15) + { + s.replace_index(5, 12, sv); + } + + // Test resize method + s.resize(50); + s.resize(0); + s.resize(100); + + // Test is_empty method + bool is_s_empty = s.is_empty(); + + // Test empty string operations + fast_io::basic_string empty_string; + empty_string.append(sv); + empty_string.insert(0, sv); + empty_string.insert_index(0, sv); + if (empty_string.size() >= 5) + { + empty_string.replace_index(0, 5, sv); + } + bool is_empty_string_empty = empty_string.is_empty(); + empty_string.clear(); + empty_string.clear_destroy(); + + // Final clear_destroy to test memory deallocation + s.clear_destroy(); + + // Perform some final operations + if constexpr (std::is_same_v) + { + s.append("final test"); + } + else if constexpr (std::is_same_v) + { + s.append(L"final test"); + } + else if constexpr (std::is_same_v) + { + s.append(u8"final test"); + } + else if constexpr (std::is_same_v) + { + s.append(u"final test"); + } + else if constexpr (std::is_same_v) + { + s.append(U"final test"); + } + + s.clear(); + s.clear_destroy(); +} + +extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size) +{ + FuzzString(data, size); + FuzzString(data, size); + FuzzString(data, size); + FuzzString(data, size); + FuzzString(data, size); + return 0; +} diff --git a/include/fast_io_dsal/string.h b/include/fast_io_dsal/string.h index c7c644023..30123c669 100644 --- a/include/fast_io_dsal/string.h +++ b/include/fast_io_dsal/string.h @@ -32,12 +32,16 @@ namespace fast_io { +template <::std::integral chartype, typename allocator = ::fast_io::native_global_allocator> +using basic_string = ::fast_io::containers::basic_string; using string = ::fast_io::containers::basic_string; using wstring = ::fast_io::containers::basic_string; using u8string = ::fast_io::containers::basic_string; using u16string = ::fast_io::containers::basic_string; using u32string = ::fast_io::containers::basic_string; +template <::std::integral chartype, typename allocator = ::fast_io::native_global_allocator> +using basic_ostring_ref_fast_io = ::fast_io::containers::basic_ostring_ref_fast_io; using ostring_ref_fast_io = ::fast_io::containers::basic_ostring_ref_fast_io; using wostring_ref_fast_io = ::fast_io::containers::basic_ostring_ref_fast_io; using u8ostring_ref_fast_io = ::fast_io::containers::basic_ostring_ref_fast_io; @@ -47,12 +51,16 @@ using u32ostring_ref_fast_io = ::fast_io::containers::basic_ostring_ref_fast_io< namespace tlc { +template <::std::integral chartype, typename allocator = ::fast_io::native_thread_local_allocator> +using basic_string = ::fast_io::containers::basic_string; using string = ::fast_io::containers::basic_string; using wstring = ::fast_io::containers::basic_string; using u8string = ::fast_io::containers::basic_string; using u16string = ::fast_io::containers::basic_string; using u32string = ::fast_io::containers::basic_string; +template <::std::integral chartype, typename allocator = ::fast_io::native_thread_local_allocator> +using basic_ostring_ref_fast_io_tlc = ::fast_io::containers::basic_ostring_ref_fast_io; using ostring_ref_fast_io_tlc = ::fast_io::containers::basic_ostring_ref_fast_io; using wostring_ref_fast_io_tlc = ::fast_io::containers::basic_ostring_ref_fast_io; using u8ostring_ref_fast_io_tlc = ::fast_io::containers::basic_ostring_ref_fast_io; @@ -61,6 +69,22 @@ using u32ostring_ref_fast_io_tlc = ::fast_io::containers::basic_ostring_ref_fast } // namespace tlc + +template <::std::integral char_type, typename... Args> +constexpr inline ::fast_io::basic_string basic_concat_fast_io(Args &&...args) +{ + constexpr bool type_error{::fast_io::operations::defines::print_freestanding_okay<::fast_io::details::dummy_buffer_output_stream, Args...>}; + if constexpr (type_error) + { + return ::fast_io::basic_general_concat>(::fast_io::io_print_forward(::fast_io::io_print_alias(args))...); + } + else + { + static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::basic_string"); + return {}; + } +} + template constexpr inline ::fast_io::string concat_fast_io(Args &&...args) { @@ -214,6 +238,21 @@ constexpr inline ::fast_io::u32string u32concatln_fast_io(Args &&...args) namespace tlc { +template <::std::integral char_type, typename... Args> +constexpr inline ::fast_io::tlc::basic_string basic_concat_fast_io_tlc(Args &&...args) +{ + constexpr bool type_error{::fast_io::operations::defines::print_freestanding_okay<::fast_io::details::dummy_buffer_output_stream, Args...>}; + if constexpr (type_error) + { + return ::fast_io::basic_general_concat>(::fast_io::io_print_forward(::fast_io::io_print_alias(args))...); + } + else + { + static_assert(type_error, "some types are not printable, so we cannot concat ::fast_io::tlc::basic_string"); + return {}; + } +} + template constexpr inline ::fast_io::tlc::string concat_fast_io_tlc(Args &&...args) { diff --git a/include/fast_io_dsal/string_view.h b/include/fast_io_dsal/string_view.h index 1aa7c1571..2f536b7f0 100644 --- a/include/fast_io_dsal/string_view.h +++ b/include/fast_io_dsal/string_view.h @@ -35,12 +35,14 @@ namespace fast_io using ::fast_io::containers::null_terminated; using ::fast_io::containers::null_terminated_t; +using ::fast_io::containers::basic_string_view; using string_view = ::fast_io::containers::basic_string_view; using wstring_view = ::fast_io::containers::basic_string_view; using u8string_view = ::fast_io::containers::basic_string_view; using u16string_view = ::fast_io::containers::basic_string_view; using u32string_view = ::fast_io::containers::basic_string_view; +using ::fast_io::containers::basic_cstring_view; using cstring_view = ::fast_io::containers::basic_cstring_view; using wcstring_view = ::fast_io::containers::basic_cstring_view; using u8cstring_view = ::fast_io::containers::basic_cstring_view; @@ -49,12 +51,14 @@ using u32cstring_view = ::fast_io::containers::basic_cstring_view; namespace tlc { +using ::fast_io::containers::basic_string_view; using string_view = ::fast_io::containers::basic_string_view; using wstring_view = ::fast_io::containers::basic_string_view; using u8string_view = ::fast_io::containers::basic_string_view; using u16string_view = ::fast_io::containers::basic_string_view; using u32string_view = ::fast_io::containers::basic_string_view; +using ::fast_io::containers::basic_cstring_view; using cstring_view = ::fast_io::containers::basic_cstring_view; using wcstring_view = ::fast_io::containers::basic_cstring_view; using u8cstring_view = ::fast_io::containers::basic_cstring_view; From 0b53b24b9eab4226803b6292291b2b17e809bb7f Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 23:23:15 -0500 Subject: [PATCH 09/51] fuzzing test for string.cc --- fuzzing/0007.containers/string/string.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzzing/0007.containers/string/string.cc b/fuzzing/0007.containers/string/string.cc index 39c59fcd4..a306352e7 100644 --- a/fuzzing/0007.containers/string/string.cc +++ b/fuzzing/0007.containers/string/string.cc @@ -125,7 +125,7 @@ inline void FuzzString(uint8_t const *data, size_t size) // Test empty string operations fast_io::basic_string empty_string; empty_string.append(sv); - empty_string.insert(0, sv); + empty_string.insert(empty_string.cbegin(), sv); empty_string.insert_index(0, sv); if (empty_string.size() >= 5) { From 1f258e94ae635399c45c0a533c9b321059f6666d Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 23:23:29 -0500 Subject: [PATCH 10/51] add potential zero test --- include/fast_io_dsal/impl/string.h | 73 ++++++++---------------------- 1 file changed, 18 insertions(+), 55 deletions(-) diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index e7ae3cf51..8fa2fcca0 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -535,10 +535,6 @@ class basic_string #endif inline constexpr pointer insert_cold_impl(pointer insertpos, char_type const *otherptr, size_type othern) noexcept { - if (!othern) - { - return insertpos; - } using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; constexpr size_type mx{::std::numeric_limits::max()}; @@ -558,7 +554,14 @@ class basic_string } else { - bigcap = static_cast(thiscap << 1u); + if (thiscap) + { + bigcap = static_cast(thiscap << 1u); + } + else + { + bigcap = 1u; + } } size_type newcap{newsize}; if (newcap < bigcap) @@ -570,9 +573,13 @@ class basic_string ::fast_io::fast_terminate(); } size_type const newcapp1{static_cast(newcap + 1u)}; + + // Allocate memory with the new capacity auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; this->imp.begin_ptr = ptr; this->imp.end_ptr = ptr + static_cast(allocn - 1u); + + // Perform the insertion auto it{ptr}; it = ::fast_io::freestanding::non_overlapped_copy(beginptr, insertpos, it); auto retit{it}; @@ -580,6 +587,8 @@ class basic_string it = ::fast_io::freestanding::non_overlapped_copy(insertpos, currptr, it); *it = 0; this->imp.curr_ptr = it; + + // Deallocate the old memory if it was not small string optimization (SSO) if (!is_sso) { typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); @@ -591,53 +600,7 @@ class basic_string #endif inline constexpr void append_cold_impl(char_type const *otherptr, size_type othern) noexcept { -#if 0 - using untyped_allocator_type = generic_allocator_adapter; - using typed_allocator_type = typed_generic_allocator_adapter; - constexpr size_type mx{::std::numeric_limits::max()}; - constexpr size_type mxdiv2{::std::numeric_limits::max() / 2u}; - constexpr size_type mxm1{static_cast(mx - 1u)}; - - auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; - bool const is_sso{beginptr == endptr}; - size_type thissize{static_cast(currptr - beginptr)}; - size_type thiscap{static_cast(endptr - beginptr)}; - size_type newsize{thissize + othern}; - - size_type bigcap; - if (mxdiv2 <= thiscap) - { - bigcap = mxm1; - } - else - { - bigcap = static_cast(thiscap << 1u); - } - size_type newcap{newsize}; - if (newcap < bigcap) - { - newcap = bigcap; - } - if (newcap == mx) - { - ::fast_io::fast_terminate(); - } - size_type const newcapp1{static_cast(newcap + 1u)}; - auto [ptr, allocn]{typed_allocator_type::allocate_at_least(newcapp1)}; - this->imp.begin_ptr = ptr; - this->imp.end_ptr = ptr + static_cast(allocn - 1u); - auto it{ptr}; - it = ::fast_io::freestanding::non_overlapped_copy(beginptr, currptr, it); - it = ::fast_io::freestanding::non_overlapped_copy_n(otherptr, othern, it); - *it = 0; - this->imp.curr_ptr = it; - if (!is_sso) - { - typed_allocator_type::deallocate_n(beginptr, static_cast(static_cast(endptr - beginptr) + 1u)); - } -#else this->insert_cold_impl(this->imp.curr_ptr, otherptr, othern); -#endif } inline constexpr void append_impl(char_type const *otherptr, size_type othern) noexcept { @@ -836,10 +799,6 @@ class basic_string private: inline constexpr pointer insert_impl(pointer ptr, char_type const *otherptr, size_type othern) noexcept { - if (!othern) - { - return ptr; - } auto beginptr{this->imp.begin_ptr}, currptr{this->imp.curr_ptr}, endptr{this->imp.end_ptr}; size_type thissize{static_cast(currptr - beginptr)}; size_type thiscap{static_cast(endptr - beginptr)}; @@ -849,6 +808,10 @@ class basic_string { return this->insert_cold_impl(ptr, otherptr, othern); } + if (!thiscap) [[unlikely]] + { + return beginptr; + } auto newcurrptr{currptr + othern}; *newcurrptr = 0; auto lastptr{::fast_io::freestanding::copy_backward(ptr, currptr, newcurrptr)}; From b7b82a14c863d83132795b5ba8a273f13fcfe207 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 23:36:59 -0500 Subject: [PATCH 11/51] fix warnings in string fuzzing --- fuzzing/0007.containers/string/string.cc | 51 ++++++++---------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/fuzzing/0007.containers/string/string.cc b/fuzzing/0007.containers/string/string.cc index a306352e7..6622f0328 100644 --- a/fuzzing/0007.containers/string/string.cc +++ b/fuzzing/0007.containers/string/string.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -38,46 +39,32 @@ inline void FuzzString(uint8_t const *data, size_t size) // Access elements using bounds-checked indexing if (s.size() > 0) { - CharT first_char = s[0]; // Test element access with bounds checking - s[0] = 'x'; // Test element modification with bounds checking + s[0] = 'x'; // Test element modification with bounds checking } // Perform unchecked element access if size is valid if (s.size() > 0) { - CharT unchecked_char = s.index_unchecked(0); // Test unchecked element access + s.index_unchecked(0) = 'y'; // Test unchecked element access } - // Test string comparison - if constexpr (std::is_same_v) - { - fast_io::basic_string_view other_string_view("test"); - fast_io::basic_string other_string(other_string_view); - bool is_equal = (s == other_string); - } - else if constexpr (std::is_same_v) - { - fast_io::basic_string_view other_string_view(L"test"); - fast_io::basic_string other_string(other_string_view); - bool is_equal = (s == other_string); - } - else if constexpr (std::is_same_v) - { - fast_io::basic_string_view other_string_view(u8"test"); - fast_io::basic_string other_string(other_string_view); - bool is_equal = (s == other_string); - } - else if constexpr (std::is_same_v) + // Test push_back and pop_back methods + if (s.size() > 0) { - fast_io::basic_string_view other_string_view(u"test"); - fast_io::basic_string other_string(other_string_view); - bool is_equal = (s == other_string); + CharT last_char = s[s.size() - 1]; // Store the last character + s.push_back(last_char); // Push back the last character + s.pop_back(); // Pop back the last character + + CharT last_char_back = s.back(); // Store the last character using back() + s.push_back(last_char_back); // Push back the last character using back() + s.pop_back(); // Pop back the last character } - else if constexpr (std::is_same_v) + + // Test string comparison + fast_io::basic_string other_string(s); + if ((s <=> other_string) != 0) { - fast_io::basic_string_view other_string_view(U"test"); - fast_io::basic_string other_string(other_string_view); - bool is_equal = (s == other_string); + std::abort(); } // Test clear method @@ -119,9 +106,6 @@ inline void FuzzString(uint8_t const *data, size_t size) s.resize(0); s.resize(100); - // Test is_empty method - bool is_s_empty = s.is_empty(); - // Test empty string operations fast_io::basic_string empty_string; empty_string.append(sv); @@ -131,7 +115,6 @@ inline void FuzzString(uint8_t const *data, size_t size) { empty_string.replace_index(0, 5, sv); } - bool is_empty_string_empty = empty_string.is_empty(); empty_string.clear(); empty_string.clear_destroy(); From 7369e830f992eb9b5f86077231834247b1cc98ef Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 10 Feb 2025 23:47:32 -0500 Subject: [PATCH 12/51] [vector] add resize and vecstring fuzzing test --- fuzzing/0007.containers/string/vecstring.cc | 78 +++++++++++++++++++++ include/fast_io_dsal/impl/vector.h | 47 +++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 fuzzing/0007.containers/string/vecstring.cc diff --git a/fuzzing/0007.containers/string/vecstring.cc b/fuzzing/0007.containers/string/vecstring.cc new file mode 100644 index 000000000..1b1f4c91b --- /dev/null +++ b/fuzzing/0007.containers/string/vecstring.cc @@ -0,0 +1,78 @@ +/** + * This code was generated using Microsoft Copilot. + */ + +#include +#include +#include +#include +#include +#include + +template +inline void FuzzVectorOfString(uint8_t const *data, size_t size) +{ + // Adjust size according to the character type + size /= sizeof(CharT); + + // Convert input data to a string view + fast_io::basic_string_view sv(reinterpret_cast(data), size); + + // Initialize your vector of strings + fast_io::vector> vec; + + // Perform various operations on the vector + vec.emplace_back(sv); // Emplace back a new string with the string view + + // Test emplace_back with a new string + fast_io::basic_string new_string(sv); + vec.emplace_back(new_string); + + // Test pop_back method + if (!vec.is_empty()) + { + vec.pop_back(); + } + + // Test insert_index method + if (!vec.is_empty()) + { + vec.insert_index(0, new_string); + } + + // Test element access using bounds-checked indexing + if (!vec.is_empty()) + { + vec[0] = new_string; + } + + // Test resize method + vec.resize(10); + vec.resize(0); + vec.resize(5); + + // Test clear method + vec.clear(); + + // Final clear_destroy to test memory deallocation + vec.clear_destroy(); + + // Perform some final operations + for (size_t i = 0; i < 10; ++i) + { + vec.emplace_back(sv); + } + + vec.clear(); + vec.clear_destroy(); +} + +extern "C" int LLVMFuzzerTestOneInput(uint8_t const *data, size_t size) +{ + FuzzVectorOfString(data, size); + FuzzVectorOfString(data, size); + FuzzVectorOfString(data, size); + FuzzVectorOfString(data, size); + FuzzVectorOfString(data, size); + return 0; +} diff --git a/include/fast_io_dsal/impl/vector.h b/include/fast_io_dsal/impl/vector.h index 3064958c4..e43417f82 100644 --- a/include/fast_io_dsal/impl/vector.h +++ b/include/fast_io_dsal/impl/vector.h @@ -1062,6 +1062,53 @@ class vector } this->erase_iters_common(beginptr + firstidx, beginptr + lastidx); } + + inline constexpr void resize(size_type n) noexcept(::std::is_nothrow_default_constructible_v) + { + auto beginptr{imp.begin_ptr}; + auto currptr{imp.curr_ptr}; + size_type sz{static_cast(currptr - beginptr)}; + if (sz < n) + { + this->reserve(n); + ::std::uninitialized_default_construct(imp.curr_ptr, imp.begin_ptr + n); + imp.curr_ptr = imp.begin_ptr + n; + } + else if (n < sz) + { + if constexpr (!::std::is_trivially_destructible_v) + { + ::std::destroy(imp.begin_ptr + n, imp.curr_ptr); + } + imp.curr_ptr = imp.begin_ptr + n; + } + } + + inline constexpr void resize(size_type n, const_reference val) noexcept(::std::is_nothrow_copy_constructible_v) + { + auto beginptr{imp.begin_ptr}; + auto currptr{imp.curr_ptr}; + size_type sz{static_cast(currptr - beginptr)}; + if (sz < n) + { + this->reserve(n); + ::std::uninitialized_fill(imp.curr_ptr, imp.begin_ptr + n, val); + imp.curr_ptr = imp.begin_ptr + n; + } + else if (n < sz) + { + if constexpr (!::std::is_trivially_destructible_v) + { + ::std::destroy(imp.begin_ptr + n, imp.curr_ptr); + } + imp.curr_ptr = imp.begin_ptr + n; + } + } + + inline constexpr void swap(vector &other) noexcept + { + ::std::swap(imp, other.imp); + } }; template From b8dbb1efb10ac0c60f2073813ed1279bfc5f50ae Mon Sep 17 00:00:00 2001 From: trcrsired Date: Tue, 11 Feb 2025 00:13:02 -0500 Subject: [PATCH 13/51] [Fix] vector resize --- .../freestanding/algorithm.h | 68 +++++++++++++++++++ include/fast_io_core_impl/freestanding/impl.h | 2 +- include/fast_io_dsal/impl/string.h | 7 +- include/fast_io_dsal/impl/vector.h | 4 +- 4 files changed, 75 insertions(+), 6 deletions(-) diff --git a/include/fast_io_core_impl/freestanding/algorithm.h b/include/fast_io_core_impl/freestanding/algorithm.h index ff743a039..e7c8fc671 100644 --- a/include/fast_io_core_impl/freestanding/algorithm.h +++ b/include/fast_io_core_impl/freestanding/algorithm.h @@ -752,6 +752,74 @@ uninitialized_move_n(InputIt first, ::std::size_t n, NoThrowForwardIt d_first) n return d_first; } +template <::std::input_iterator ForwardIt> +inline constexpr void uninitialized_default_construct(ForwardIt first, ForwardIt last) noexcept( + ::std::is_nothrow_default_constructible_v::value_type>) +{ + using T = typename ::std::iterator_traits::value_type; + if constexpr (::fast_io::freestanding::is_zero_default_constructible_v && + ::std::contiguous_iterator && !::std::is_volatile_v) + { +#if __cpp_if_consteval >= 202106L || __cpp_lib_is_constant_evaluated >= 201811L +#if __cpp_if_consteval >= 202106L + if !consteval +#else + if (!__builtin_is_constant_evaluated()) +#endif + { + ::fast_io::freestanding::my_memset(::std::to_address(first), 0, sizeof(T) * static_cast<::std::size_t>(last - first)); + return; + } +#endif + } + for (; first != last; ++first) + { + ::std::construct_at(::std::to_address(first)); + } +} + +template <::std::input_iterator ForwardIt> +inline constexpr void uninitialized_default_construct_n(ForwardIt first, ::std::size_t n) noexcept( + ::std::is_nothrow_default_constructible_v::value_type>) +{ + ::fast_io::freestanding::uninitialized_default_construct(first, first + n); +} + +template <::std::input_iterator ForwardIt, typename T> +inline constexpr void uninitialized_fill(ForwardIt first, ForwardIt last, T const &x) noexcept( + ::std::is_nothrow_copy_constructible_v::value_type>) +{ + using valuetype = typename ::std::iterator_traits::value_type; + + if constexpr (::std::integral && ::std::integral && + sizeof(T) == 1 && sizeof(valuetype) == 1 && ::std::contiguous_iterator) + { +#if __cpp_if_consteval >= 202106L || __cpp_lib_is_constant_evaluated >= 201811L +#if __cpp_if_consteval >= 202106L + if !consteval +#else + if (!__builtin_is_constant_evaluated()) +#endif + { + ::fast_io::freestanding::my_memset(::std::to_address(first), static_cast(static_cast<::std::uint_least8_t>(x)), sizeof(T) * static_cast<::std::size_t>(last - first)); + return; + } +#endif + } + + for (; first != last; ++first) + { + ::std::construct_at(::std::to_address(first), x); + } +} + +template <::std::input_iterator ForwardIt, typename T> +inline constexpr void uninitialized_fill_n(ForwardIt first, ::std::size_t n, T const &x) noexcept( + ::std::is_nothrow_copy_constructible_v::value_type>) +{ + ::fast_io::freestanding::uninitialized_fill(first, first + n, x); +} + template <::std::forward_iterator ForwardIt> inline constexpr ForwardIt rotate(ForwardIt first, ForwardIt middle, diff --git a/include/fast_io_core_impl/freestanding/impl.h b/include/fast_io_core_impl/freestanding/impl.h index b53aebfe4..2e09a8072 100644 --- a/include/fast_io_core_impl/freestanding/impl.h +++ b/include/fast_io_core_impl/freestanding/impl.h @@ -50,6 +50,6 @@ no ::std::array, ::std::copy and others #include "array.h" #include "cstr_len.h" #include "bytes.h" -#include "algorithm.h" #include "relocatable.h" +#include "algorithm.h" #include "ranges.h" diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 8fa2fcca0..6e32b1d2f 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -503,13 +503,14 @@ class basic_string using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; - this->imp.end_ptr = (this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u); + this->imp.end_ptr = endptr = ((this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u)); } - if (this->imp.begin_ptr == this->imp.end_ptr) [[unlikely]] + if (beginptr == endptr) [[unlikely]] { return; } - *(this->imp.curr_ptr = ::fast_io::freestanding::uninitialized_fill_n(beginptr, n, ch)) = 0; + ::fast_io::freestanding::uninitialized_fill_n(beginptr, n, ch); + *(this->imp.curr_ptr = beginptr + n) = 0; } inline constexpr void assign_characters(size_type n) noexcept { diff --git a/include/fast_io_dsal/impl/vector.h b/include/fast_io_dsal/impl/vector.h index e43417f82..a88631454 100644 --- a/include/fast_io_dsal/impl/vector.h +++ b/include/fast_io_dsal/impl/vector.h @@ -1071,7 +1071,7 @@ class vector if (sz < n) { this->reserve(n); - ::std::uninitialized_default_construct(imp.curr_ptr, imp.begin_ptr + n); + ::fast_io::freestanding::uninitialized_default_construct(imp.curr_ptr, imp.begin_ptr + n); imp.curr_ptr = imp.begin_ptr + n; } else if (n < sz) @@ -1092,7 +1092,7 @@ class vector if (sz < n) { this->reserve(n); - ::std::uninitialized_fill(imp.curr_ptr, imp.begin_ptr + n, val); + ::fast_io::freestanding::uninitialized_fill(imp.curr_ptr, imp.begin_ptr + n, val); imp.curr_ptr = imp.begin_ptr + n; } else if (n < sz) From 6f4f14477c1a091088189d801c0e64257ea7e9fc Mon Sep 17 00:00:00 2001 From: trcrsired Date: Tue, 11 Feb 2025 00:15:13 -0500 Subject: [PATCH 14/51] [vector] add assign --- include/fast_io_dsal/impl/vector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/fast_io_dsal/impl/vector.h b/include/fast_io_dsal/impl/vector.h index a88631454..4edcb81e3 100644 --- a/include/fast_io_dsal/impl/vector.h +++ b/include/fast_io_dsal/impl/vector.h @@ -1105,6 +1105,14 @@ class vector } } + inline constexpr void assign(size_type n, const_reference val) noexcept(::std::is_nothrow_copy_constructible_v) + { + this->clear(); + this->reserve(n); + ::fast_io::freestanding::uninitialized_fill(imp.begin_ptr, imp.begin_ptr + n, val); + imp.curr_ptr = imp.begin_ptr + n; + } + inline constexpr void swap(vector &other) noexcept { ::std::swap(imp, other.imp); From ca1322916e4186f10215e34886485e59e24325b8 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Tue, 11 Feb 2025 14:10:20 -0500 Subject: [PATCH 15/51] [string] update begin_ptr and end_ptr in assign --- include/fast_io_dsal/impl/string.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fast_io_dsal/impl/string.h b/include/fast_io_dsal/impl/string.h index 6e32b1d2f..564e5b693 100644 --- a/include/fast_io_dsal/impl/string.h +++ b/include/fast_io_dsal/impl/string.h @@ -472,9 +472,9 @@ class basic_string { this->destroy(); auto [ptr, allocn] = ::fast_io::containers::details::string_allocate_init(otherptr, othern); - this->imp.end_ptr = (this->imp.begin_ptr = thisbegin = ptr) + allocn; + this->imp.end_ptr = thisend = ((this->imp.curr_ptr = this->imp.begin_ptr = thisbegin = ptr) + allocn); } - if (this->imp.begin_ptr == this->imp.end_ptr) [[unlikely]] + if (thisbegin == thisend) [[unlikely]] { return; } @@ -503,7 +503,7 @@ class basic_string using untyped_allocator_type = generic_allocator_adapter; using typed_allocator_type = typed_generic_allocator_adapter; auto [ptr, allocn]{typed_allocator_type::allocate_at_least(np1)}; - this->imp.end_ptr = endptr = ((this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u)); + this->imp.end_ptr = endptr = ((this->imp.curr_ptr = this->imp.begin_ptr = beginptr = ptr) + static_cast(allocn - 1u)); } if (beginptr == endptr) [[unlikely]] { From bc59ac48d4e09077f78a44a954906b18443f9af1 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 13 Feb 2025 01:42:07 -0500 Subject: [PATCH 16/51] [libcxx] support -DLIBCXX_ENABLE_WIDE_CHARACTERS=Off when user builds LLVM libc++ with wide characters disabled, the library cannot compileany more. fix it --- include/fast_io_legacy_impl/filebuf/op_out.h | 2 ++ include/fast_io_legacy_impl/filebuf/streambuf_io_observer.h | 4 ++++ include/fast_io_unit/string_impl/concat.h | 5 +++++ include/fast_io_unit/string_impl/concat_std.h | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/include/fast_io_legacy_impl/filebuf/op_out.h b/include/fast_io_legacy_impl/filebuf/op_out.h index 4b66dff90..885c3ae45 100644 --- a/include/fast_io_legacy_impl/filebuf/op_out.h +++ b/include/fast_io_legacy_impl/filebuf/op_out.h @@ -37,6 +37,7 @@ inline ::std::string operator_output(Args const &...args) return {}; } +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS template requires(sizeof...(Args) != 0) inline ::std::basic_string woperator_output(Args const &...args) @@ -55,6 +56,7 @@ inline ::std::basic_string woperator_output(Args const &...args) } return {}; } +#endif } // namespace manipulators diff --git a/include/fast_io_legacy_impl/filebuf/streambuf_io_observer.h b/include/fast_io_legacy_impl/filebuf/streambuf_io_observer.h index 4816231bb..3e5d0a1ce 100644 --- a/include/fast_io_legacy_impl/filebuf/streambuf_io_observer.h +++ b/include/fast_io_legacy_impl/filebuf/streambuf_io_observer.h @@ -84,7 +84,9 @@ template <::std::integral CharT, typename Traits = ::std::char_traits> using basic_streambuf_io_observer = basic_general_streambuf_io_observer<::std::basic_streambuf>; using streambuf_io_observer = basic_streambuf_io_observer; +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS using wstreambuf_io_observer = basic_streambuf_io_observer; +#endif #if defined(_LIBCPP_VERSION) || defined(__GLIBCXX__) || defined(_MSVC_STL_UPDATE) @@ -108,7 +110,9 @@ inline constexpr decltype(auto) zero_copy_out_handle(basic_filebuf_io_observer> using basic_filebuf_io_observer = basic_general_streambuf_io_observer<::std::basic_filebuf>; using filebuf_io_observer = basic_filebuf_io_observer; +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS using wfilebuf_io_observer = basic_filebuf_io_observer; +#endif template <::std::integral ch_type, typename traits_type> requires requires(basic_c_io_observer piob) { status(piob); } diff --git a/include/fast_io_unit/string_impl/concat.h b/include/fast_io_unit/string_impl/concat.h index 979b5156a..774efcffe 100644 --- a/include/fast_io_unit/string_impl/concat.h +++ b/include/fast_io_unit/string_impl/concat.h @@ -26,6 +26,7 @@ template } } +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS template [[deprecated("use ::fast_io::wconcat_std instead"), nodiscard]] inline #if __cpp_lib_constexpr_string >= 201907L @@ -48,6 +49,7 @@ template return {}; } } +#endif template [[deprecated("use ::fast_io::u8concat_std instead"), nodiscard]] inline @@ -139,6 +141,8 @@ template } } +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS + template [[deprecated("use ::fast_io::wconcatln_std instead"), nodiscard]] inline #if __cpp_lib_constexpr_string >= 201907L @@ -161,6 +165,7 @@ template return {}; } } +#endif template [[deprecated("use ::fast_io::u8concatln_std instead"), nodiscard]] inline diff --git a/include/fast_io_unit/string_impl/concat_std.h b/include/fast_io_unit/string_impl/concat_std.h index 5e79e0fe5..16af5218b 100644 --- a/include/fast_io_unit/string_impl/concat_std.h +++ b/include/fast_io_unit/string_impl/concat_std.h @@ -26,6 +26,7 @@ template } } +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS template [[nodiscard]] inline #if __cpp_lib_constexpr_string >= 201907L @@ -48,6 +49,7 @@ template return {}; } } +#endif template [[nodiscard]] inline @@ -139,6 +141,7 @@ template } } +#if (!defined(_LIBCPP_VERSION)) || _LIBCPP_HAS_WIDE_CHARACTERS template [[nodiscard]] inline #if __cpp_lib_constexpr_string >= 201907L @@ -161,6 +164,7 @@ template return {}; } } +#endif template [[nodiscard]] inline From dfcd3b9ec0cb0303da32fd075399acb53e2f3544 Mon Sep 17 00:00:00 2001 From: hearyldp Date: Thu, 13 Feb 2025 15:38:15 -0500 Subject: [PATCH 17/51] [legacy example] add darwin version detect --- examples/0007.legacy/construct_fstream_from_syscall.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/0007.legacy/construct_fstream_from_syscall.cc b/examples/0007.legacy/construct_fstream_from_syscall.cc index af43d3be7..e59420bc3 100644 --- a/examples/0007.legacy/construct_fstream_from_syscall.cc +++ b/examples/0007.legacy/construct_fstream_from_syscall.cc @@ -73,6 +73,9 @@ FILE* or fstream apis fast_io::mnp::hex0x(__MSVCRT_VERSION__), "\n" #endif +#elif defined(__DARWIN_C_LEVEL) + "Darwin ", + __DARWIN_C_LEVEL, "\n" #endif #if defined(_LIBCPP_VERSION) "LLVM libc++ ", From bdfbded7c279435bb25696e9c490f8ec2f2b7947 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 04:53:53 -0500 Subject: [PATCH 18/51] add win-ldd as an example --- examples/0038.win-ldd/win-ldd.cc | 140 +++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 examples/0038.win-ldd/win-ldd.cc diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc new file mode 100644 index 000000000..2ec2dea10 --- /dev/null +++ b/examples/0038.win-ldd/win-ldd.cc @@ -0,0 +1,140 @@ +/* +Referenced from: +trcrsired/win-ldd +https://github.com/trcrsired/win-ldd/tree/master +greenjava/win-ldd +https://github.com/greenjava/win-ldd +*/ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIN32_LEAN_AND_MEAN 1 +#include +#include +#undef min +#undef max + +struct dll_ref_entry +{ + ::fast_io::string dll_name; + ::fast_io::string dll_path; +}; + +inline constexpr bool operator==(dll_ref_entry const &a, dll_ref_entry const &b) noexcept +{ + return a.dll_name == b.dll_name && a.dll_path == b.dll_path; +} + +inline constexpr auto operator<=>(dll_ref_entry const &a, dll_ref_entry const &b) noexcept +{ + auto ret{a.dll_name <=> b.dll_name}; + if (ret == 0) + { + return a.dll_path <=> b.dll_path; + } + return ret; +} + +namespace fast_io::freestanding +{ +template <> +struct is_trivially_relocatable<::dll_ref_entry> +{ + static inline constexpr bool value = true; +}; +} // namespace fast_io::freestanding + +inline auto getDependencies(HMODULE hMod) +{ + ::fast_io::vector deps; + + IMAGE_DOS_HEADER *pDosHeader = (IMAGE_DOS_HEADER *)hMod; + IMAGE_OPTIONAL_HEADER *pOptHeader = (IMAGE_OPTIONAL_HEADER *)((BYTE *)hMod + pDosHeader->e_lfanew + 24); + IMAGE_IMPORT_DESCRIPTOR *pImportDesc = (IMAGE_IMPORT_DESCRIPTOR *)((BYTE *)hMod + pOptHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + + for (; pImportDesc->FirstThunk; ++pImportDesc) + { + ::fast_io::string dllName(::fast_io::mnp::os_c_str((char const *)((BYTE *)hMod + pImportDesc->Name))); + std::unique_ptr::type, decltype(FreeLibrary) *> hModDep(::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES), FreeLibrary); + ::fast_io::string dllpath; + if (hModDep) + { + dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep = hModDep.get()](char *buffer, size_t len) { + if (!::GetModuleFileNameA(hmoddep, buffer, len)) + { + ::fast_io::throw_win32_error(); + } + return ::strnlen(buffer, len); + }); + } + deps.push_back(::dll_ref_entry{::std::move(dllName), ::std::move(dllpath)}); + } + ::std::ranges::sort(deps); + deps.erase(::std::unique(deps.begin(), deps.end()), deps.end()); + return deps; +} + +//------------------------------------------------------------------------------ + +inline void printDependencies(char const *libpath) +{ + using namespace ::fast_io::io; + std::unique_ptr::type, decltype(FreeLibrary) *> hMod(::LoadLibraryEx(libpath, NULL, DONT_RESOLVE_DLL_REFERENCES), FreeLibrary); + if (!hMod) + { + ::fast_io::throw_win32_error(); + } + println(::fast_io::mnp::os_c_str(libpath)); + for (auto &ele : getDependencies(hMod.get())) + { + println("\t", ele.dll_name, " => ", ele.dll_path); + } +} + +int main(int argc, char const **argv) +#if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 +try +#endif +{ + if (argc < 2) + { + if (argc == 0) + { + return 1; + } + ::fast_io::io::perr("Usage:\n", ::fast_io::mnp::os_c_str(*argv), " [...]\n"); + return 1; + } + ::fast_io::span args(argv + 1, argc - 1); + for (auto e : args) + { + printDependencies(e); + } +} +#if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 +catch (::fast_io::error e) +{ + ::fast_io::io::perrln(e); + return 1; +} +catch (...) +{ + ::fast_io::io::perr("Unknown EH\n"); + return 1; +} +#endif + + +#else + +int main() +{} + +#endif \ No newline at end of file From 082b92c75150ee6f3f1ad5ddb5dc7f664cfca8b7 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 05:04:15 -0500 Subject: [PATCH 19/51] use w api --- examples/0038.win-ldd/win-ldd.cc | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc index 2ec2dea10..c100b44c5 100644 --- a/examples/0038.win-ldd/win-ldd.cc +++ b/examples/0038.win-ldd/win-ldd.cc @@ -24,7 +24,7 @@ greenjava/win-ldd struct dll_ref_entry { ::fast_io::string dll_name; - ::fast_io::string dll_path; + ::fast_io::u16string dll_path; }; inline constexpr bool operator==(dll_ref_entry const &a, dll_ref_entry const &b) noexcept @@ -51,7 +51,7 @@ struct is_trivially_relocatable<::dll_ref_entry> }; } // namespace fast_io::freestanding -inline auto getDependencies(HMODULE hMod) +inline auto getDependencies(void *hMod) { ::fast_io::vector deps; @@ -62,16 +62,17 @@ inline auto getDependencies(HMODULE hMod) for (; pImportDesc->FirstThunk; ++pImportDesc) { ::fast_io::string dllName(::fast_io::mnp::os_c_str((char const *)((BYTE *)hMod + pImportDesc->Name))); - std::unique_ptr::type, decltype(FreeLibrary) *> hModDep(::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES), FreeLibrary); - ::fast_io::string dllpath; - if (hModDep) + void *hmoddep=::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES); + ::fast_io::u16string dllpath; + if (hmoddep) [[likely]] { - dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep = hModDep.get()](char *buffer, size_t len) { - if (!::GetModuleFileNameA(hmoddep, buffer, len)) + ::fast_io::win32_dll_file df(hmoddep); + dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep](char16_t *buffer, size_t len) { + if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), len)) { ::fast_io::throw_win32_error(); } - return ::strnlen(buffer, len); + return ::fast_io::cstr_nlen(buffer, len); }); } deps.push_back(::dll_ref_entry{::std::move(dllName), ::std::move(dllpath)}); @@ -86,15 +87,11 @@ inline auto getDependencies(HMODULE hMod) inline void printDependencies(char const *libpath) { using namespace ::fast_io::io; - std::unique_ptr::type, decltype(FreeLibrary) *> hMod(::LoadLibraryEx(libpath, NULL, DONT_RESOLVE_DLL_REFERENCES), FreeLibrary); - if (!hMod) - { - ::fast_io::throw_win32_error(); - } + ::fast_io::win32_dll_file wdllf(::fast_io::mnp::os_c_str(libpath), ::fast_io::dll_mode::win32_dont_resolve_dll_references); println(::fast_io::mnp::os_c_str(libpath)); - for (auto &ele : getDependencies(hMod.get())) + for (auto &ele : getDependencies(wdllf.native_handle())) { - println("\t", ele.dll_name, " => ", ele.dll_path); + println("\t", ele.dll_name, " => ", ::fast_io::mnp::code_cvt(ele.dll_path)); } } From 5d0d846d1a41d49b87ce81fbdec5bae58c30549f Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 05:10:53 -0500 Subject: [PATCH 20/51] [win-ldd] use out_buf_type to improve performance --- examples/0038.win-ldd/win-ldd.cc | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc index c100b44c5..097af4d43 100644 --- a/examples/0038.win-ldd/win-ldd.cc +++ b/examples/0038.win-ldd/win-ldd.cc @@ -51,7 +51,7 @@ struct is_trivially_relocatable<::dll_ref_entry> }; } // namespace fast_io::freestanding -inline auto getDependencies(void *hMod) +inline auto get_dependencies(void *hMod) { ::fast_io::vector deps; @@ -62,13 +62,13 @@ inline auto getDependencies(void *hMod) for (; pImportDesc->FirstThunk; ++pImportDesc) { ::fast_io::string dllName(::fast_io::mnp::os_c_str((char const *)((BYTE *)hMod + pImportDesc->Name))); - void *hmoddep=::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES); + void *hmoddep = ::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES); ::fast_io::u16string dllpath; if (hmoddep) [[likely]] { ::fast_io::win32_dll_file df(hmoddep); dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep](char16_t *buffer, size_t len) { - if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), len)) + if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), len)) { ::fast_io::throw_win32_error(); } @@ -82,19 +82,6 @@ inline auto getDependencies(void *hMod) return deps; } -//------------------------------------------------------------------------------ - -inline void printDependencies(char const *libpath) -{ - using namespace ::fast_io::io; - ::fast_io::win32_dll_file wdllf(::fast_io::mnp::os_c_str(libpath), ::fast_io::dll_mode::win32_dont_resolve_dll_references); - println(::fast_io::mnp::os_c_str(libpath)); - for (auto &ele : getDependencies(wdllf.native_handle())) - { - println("\t", ele.dll_name, " => ", ::fast_io::mnp::code_cvt(ele.dll_path)); - } -} - int main(int argc, char const **argv) #if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 try @@ -109,10 +96,16 @@ try ::fast_io::io::perr("Usage:\n", ::fast_io::mnp::os_c_str(*argv), " [...]\n"); return 1; } + ::fast_io::out_buf_type obf(::fast_io::out()); ::fast_io::span args(argv + 1, argc - 1); - for (auto e : args) + for (auto libpath : args) { - printDependencies(e); + ::fast_io::win32_dll_file wdllf(::fast_io::mnp::os_c_str(libpath), ::fast_io::dll_mode::win32_dont_resolve_dll_references); + ::fast_io::io::println(obf, ::fast_io::mnp::os_c_str(libpath)); + for (auto &ele : get_dependencies(wdllf.native_handle())) + { + ::fast_io::io::println(obf, "\t", ele.dll_name, " => ", ::fast_io::mnp::code_cvt(ele.dll_path)); + } } } #if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 From 3abf378e4ddad40ab4d3394b187bcb6d9b9687a9 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 05:12:41 -0500 Subject: [PATCH 21/51] [win-ldd] fix warning for DWORD --- examples/0038.win-ldd/win-ldd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc index 097af4d43..cf0d34058 100644 --- a/examples/0038.win-ldd/win-ldd.cc +++ b/examples/0038.win-ldd/win-ldd.cc @@ -68,7 +68,7 @@ inline auto get_dependencies(void *hMod) { ::fast_io::win32_dll_file df(hmoddep); dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep](char16_t *buffer, size_t len) { - if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), len)) + if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), static_cast<::std::uint_least32_t>(len))) { ::fast_io::throw_win32_error(); } From f6b5f86b522fa8c19617244afee400979f2c1d25 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 05:17:40 -0500 Subject: [PATCH 22/51] do not sort win-ldd --- examples/0038.win-ldd/win-ldd.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc index cf0d34058..84257d89c 100644 --- a/examples/0038.win-ldd/win-ldd.cc +++ b/examples/0038.win-ldd/win-ldd.cc @@ -77,8 +77,6 @@ inline auto get_dependencies(void *hMod) } deps.push_back(::dll_ref_entry{::std::move(dllName), ::std::move(dllpath)}); } - ::std::ranges::sort(deps); - deps.erase(::std::unique(deps.begin(), deps.end()), deps.end()); return deps; } From a5aaed56630e03a3b2a5f2408122fbaeced55a27 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 05:36:42 -0500 Subject: [PATCH 23/51] [win-ldd]fix compilation for libc++ --- examples/0038.win-ldd/win-ldd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc index 84257d89c..169663915 100644 --- a/examples/0038.win-ldd/win-ldd.cc +++ b/examples/0038.win-ldd/win-ldd.cc @@ -67,7 +67,7 @@ inline auto get_dependencies(void *hMod) if (hmoddep) [[likely]] { ::fast_io::win32_dll_file df(hmoddep); - dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep](char16_t *buffer, size_t len) { + dllpath.resize_and_overwrite(260, [hmoddep](char16_t *buffer, size_t len) { if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), static_cast<::std::uint_least32_t>(len))) { ::fast_io::throw_win32_error(); From 4dd2b8121da323f351860095cb3e24d2f67d6f5a Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 19:22:14 -0500 Subject: [PATCH 24/51] [win-ldd] should be win-ldd --- examples/0038.win-ldd/win-ldd.cc | 123 +++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 examples/0038.win-ldd/win-ldd.cc diff --git a/examples/0038.win-ldd/win-ldd.cc b/examples/0038.win-ldd/win-ldd.cc new file mode 100644 index 000000000..bbb578f44 --- /dev/null +++ b/examples/0038.win-ldd/win-ldd.cc @@ -0,0 +1,123 @@ +/* +Referenced from: +trcrsired/win-ldd +https://github.com/trcrsired/win-ldd/tree/master +greenjava/win-ldd +https://github.com/greenjava/win-ldd +*/ +#if defined(_WIN32) || defined(__CYGWIN__) +#include +#include +#include +#include +#include +#include +#include +#include + +#define WIN32_LEAN_AND_MEAN 1 +#include +#include +#undef min +#undef max + +struct dll_ref_entry +{ + ::fast_io::string dll_name; + ::fast_io::u16string dll_path; +}; + +inline constexpr bool operator==(dll_ref_entry const &a, dll_ref_entry const &b) noexcept +{ + return a.dll_name == b.dll_name && a.dll_path == b.dll_path; +} + +inline constexpr auto operator<=>(dll_ref_entry const &a, dll_ref_entry const &b) noexcept +{ + auto ret{a.dll_name <=> b.dll_name}; + if (ret == 0) + { + return a.dll_path <=> b.dll_path; + } + return ret; +} + +namespace fast_io::freestanding +{ +template <> +struct is_trivially_relocatable<::dll_ref_entry> +{ + static inline constexpr bool value = true; +}; +} // namespace fast_io::freestanding + +inline auto get_dependencies(void *hMod) +{ + ::fast_io::vector deps; + + IMAGE_DOS_HEADER *pDosHeader = (IMAGE_DOS_HEADER *)hMod; + IMAGE_OPTIONAL_HEADER *pOptHeader = (IMAGE_OPTIONAL_HEADER *)((BYTE *)hMod + pDosHeader->e_lfanew + 24); + IMAGE_IMPORT_DESCRIPTOR *pImportDesc = (IMAGE_IMPORT_DESCRIPTOR *)((BYTE *)hMod + pOptHeader->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + + for (; pImportDesc->FirstThunk; ++pImportDesc) + { + ::fast_io::string dllName(::fast_io::mnp::os_c_str((char const *)((BYTE *)hMod + pImportDesc->Name))); + void *hmoddep = ::LoadLibraryExA(dllName.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES); + ::fast_io::u16string dllpath; + if (hmoddep) [[likely]] + { + ::fast_io::win32_dll_file df(hmoddep); + dllpath.resize_and_overwrite(_MAX_PATH, [hmoddep](char16_t *buffer, size_t len) { + if (!::GetModuleFileNameW((HMODULE)hmoddep, reinterpret_cast(buffer), static_cast<::std::uint_least32_t>(len))) + { + ::fast_io::throw_win32_error(); + } + return ::fast_io::cstr_nlen(buffer, len); + }); + } + deps.push_back(::dll_ref_entry{::std::move(dllName), ::std::move(dllpath)}); + } + return deps; +} + +int main(int argc, char const **argv) +#if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 +try +#endif +{ + if (argc == 0) + { + return 1; + } + ::fast_io::out_buf_type obf(::fast_io::out()); + ::fast_io::span args(argv + 1, argc - 1); + for (auto libpath : args) + { + ::fast_io::win32_dll_file wdllf(::fast_io::mnp::os_c_str(libpath), ::fast_io::dll_mode::win32_dont_resolve_dll_references); + ::fast_io::io::println(obf, ::fast_io::mnp::os_c_str(libpath)); + for (auto &ele : get_dependencies(wdllf.native_handle())) + { + ::fast_io::io::println(obf, "\t", ele.dll_name, " => ", ::fast_io::mnp::code_cvt(ele.dll_path)); + } + } +} +#if (defined(__cpp_exceptions) && (!defined(_MSC_VER) || defined(__clang__))) || __HAS_EXCEPTIONS == 1 +catch (::fast_io::error e) +{ + ::fast_io::io::perrln(e); + return 1; +} +catch (...) +{ + ::fast_io::io::perr("Unknown EH\n"); + return 1; +} +#endif + + +#else + +int main() +{} + +#endif // defined(_WIN32) || defined(__CYGWIN__) \ No newline at end of file From 856cd147d48f4dd1cd4ea111b01f7593f8454b0c Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 19 Feb 2025 19:37:32 -0500 Subject: [PATCH 25/51] [intrinsics] Workaround of braindeath of Microsoft Visual C++ --- include/fast_io_core_impl/intrinsics.h | 6 +++--- include/fast_io_core_impl/secure_clear_guard.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fast_io_core_impl/intrinsics.h b/include/fast_io_core_impl/intrinsics.h index c627823e1..102792fca 100644 --- a/include/fast_io_core_impl/intrinsics.h +++ b/include/fast_io_core_impl/intrinsics.h @@ -680,8 +680,8 @@ inline } } #elif defined(_MSC_VER) && defined(_M_X64) && !defined(_M_ARM64EC) -#if __cpp_if_consteval >= 202106L - if consteval +#if __cpp_if_consteval >= 202106L && 0 + if !consteval { return umul_least_64_emulated(a, b, high); } @@ -743,7 +743,7 @@ inline }; return static_cast<::std::uint_least64_t>((static_cast<__uint128_t>(a) * b) >> ul64bits); #elif defined(_MSC_VER) && defined(_M_X64) && !defined(_M_ARM64EC) -#if __cpp_if_consteval >= 202106L +#if __cpp_if_consteval >= 202106L && 0 if consteval { return umul_least64_high_emulated(a, b); diff --git a/include/fast_io_core_impl/secure_clear_guard.h b/include/fast_io_core_impl/secure_clear_guard.h index 474248c19..7a67f7fdb 100644 --- a/include/fast_io_core_impl/secure_clear_guard.h +++ b/include/fast_io_core_impl/secure_clear_guard.h @@ -110,7 +110,7 @@ namespace freestanding inline constexpr ::std::byte *bytes_secure_clear_n(::std::byte *data, ::std::size_t size) noexcept { #if __cpp_if_consteval >= 202106L || __cpp_lib_is_constant_evaluated >= 201811L -#if __cpp_if_consteval >= 202106L +#if __cpp_if_consteval >= 202106L && (!defined(_MSC_VER) || defined(__clang__)) if consteval #elif __cpp_lib_is_constant_evaluated >= 201811L if (__builtin_is_constant_evaluated()) From 3464239e5368d50d0aec30183946abcd06acaaa4 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 20:54:34 -0500 Subject: [PATCH 26/51] [macros] add push/pop macros for win32 imports --- include/fast_io_core.h | 2 + .../allocation/nt_preliminary_definition.h | 163 +---------- .../allocation/win32_heapalloc.h | 266 +----------------- include/fast_io_core_impl/macros/pop_macros.h | 12 + .../fast_io_core_impl/macros/push_macros.h | 151 ++++++++++ 5 files changed, 183 insertions(+), 411 deletions(-) create mode 100644 include/fast_io_core_impl/macros/pop_macros.h create mode 100644 include/fast_io_core_impl/macros/push_macros.h diff --git a/include/fast_io_core.h b/include/fast_io_core.h index 7e3e0e594..b3e82ab6a 100644 --- a/include/fast_io_core.h +++ b/include/fast_io_core.h @@ -20,6 +20,7 @@ #include "fast_io_concept.h" #include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_core_impl/macros/push_macros.h" #include "fast_io_core_impl/empty.h" #if defined(_MSC_VER) && !defined(__clang__) @@ -97,6 +98,7 @@ #include "fast_io_core_impl/http_header.h" #include "fast_io_core_impl/io_lockable.h" +#include "fast_io_core_impl/macros/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" #endif diff --git a/include/fast_io_core_impl/allocation/nt_preliminary_definition.h b/include/fast_io_core_impl/allocation/nt_preliminary_definition.h index 852570765..fe35c7b52 100644 --- a/include/fast_io_core_impl/allocation/nt_preliminary_definition.h +++ b/include/fast_io_core_impl/allocation/nt_preliminary_definition.h @@ -282,150 +282,18 @@ struct teb ::std::uint_least64_t ExtendedFeatureDisableMask; }; -// func - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlAllocateHeap(void *, ::std::uint_least32_t, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlAllocateHeap@12") -#else - __asm__("_RtlAllocateHeap@12") -#endif -#else - __asm__("RtlAllocateHeap") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern char unsigned -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlFreeHeap(void *, ::std::uint_least32_t, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlFreeHeap@12") -#else - __asm__("_RtlFreeHeap@12") -#endif -#else - __asm__("RtlFreeHeap") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern peb * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlGetCurrentPeb() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlGetCurrentPeb@0") -#else - __asm__("_RtlGetCurrentPeb@0") -#endif -#else - __asm__("RtlGetCurrentPeb") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlReAllocateHeap(void *, ::std::uint_least32_t, void *, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlReAllocateHeap@16") -#else - __asm__("_RtlReAllocateHeap@16") -#endif -#else - __asm__("RtlReAllocateHeap") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlSizeHeap(void *, ::std::uint_least32_t, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlSizeHeap@12") -#else - __asm__("_RtlSizeHeap@12") -#endif -#else - __asm__("RtlSizeHeap") -#endif -#endif - ; +FAST_IO_DLLIMPORT FAST_IO_GNU_MALLOC extern void *FAST_IO_WINSTDCALL RtlAllocateHeap(void *, ::std::uint_least32_t, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(RtlAllocateHeap, 12); +FAST_IO_DLLIMPORT extern char unsigned FAST_IO_WINSTDCALL RtlFreeHeap(void *, ::std::uint_least32_t, void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlFreeHeap, 12); +FAST_IO_DLLIMPORT extern peb *FAST_IO_WINSTDCALL RtlGetCurrentPeb() noexcept FAST_IO_WINSTDCALL_RENAME(RtlGetCurrentPeb, 0); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL RtlReAllocateHeap(void *, ::std::uint_least32_t, void *, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(RtlReAllocateHeap, 16); +FAST_IO_DLLIMPORT extern ::std::size_t FAST_IO_WINSTDCALL RtlSizeHeap(void *, ::std::uint_least32_t, void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlSizeHeap, 12); #if (defined(__GNUC__) || defined(__clang__)) && \ (defined(__aarch64__) || defined(__arm64ec__)) register ::fast_io::win32::nt::teb *fast_io_nt_current_teb __asm__("x18"); #endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -inline peb *nt_get_current_peb() noexcept +FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST inline peb *nt_get_current_peb() noexcept { #if (defined(__GNUC__) || defined(__clang__)) #if defined(__aarch64__) || defined(__arm64ec__) @@ -474,10 +342,7 @@ inline peb *nt_get_current_peb() noexcept #endif } -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -inline teb *nt_current_teb() noexcept +FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST inline teb *nt_current_teb() noexcept { #if (defined(__GNUC__) || defined(__clang__)) #if defined(__aarch64__) || defined(__arm64ec__) @@ -526,19 +391,7 @@ inline teb *nt_current_teb() noexcept #endif } -#if __has_cpp_attribute(__gnu__::__always_inline__) -[[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -[[msvc::forceinline]] -#endif -[[nodiscard]] -#if __has_cpp_attribute(__gnu__::__artificial__) -[[__gnu__::__artificial__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -inline void *rtl_get_process_heap() noexcept +FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST inline void *rtl_get_process_heap() noexcept { return ::fast_io::win32::nt::nt_get_current_peb()->ProcessHeap; } diff --git a/include/fast_io_core_impl/allocation/win32_heapalloc.h b/include/fast_io_core_impl/allocation/win32_heapalloc.h index 1232807e0..f6506bede 100644 --- a/include/fast_io_core_impl/allocation/win32_heapalloc.h +++ b/include/fast_io_core_impl/allocation/win32_heapalloc.h @@ -10,7 +10,7 @@ struct memory_basic_information void *BaseAddress; void *AllocationBase; ::std::uint_least32_t AllocationProtect; -#if defined(_WIN64) +#if UINT_LEAST64_MAX <= SIZE_MAX ::std::uint_least16_t PartitionId; #endif ::std::size_t RegionSize; @@ -18,262 +18,16 @@ struct memory_basic_information ::std::uint_least32_t Protect; ::std::uint_least32_t Type; }; -} // namespace win32 - -namespace win32 -{ -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__malloc__) -[[__gnu__::__malloc__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - HeapAlloc(void *, ::std::uint_least32_t, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("HeapAlloc@12") -#else - __asm__("_HeapAlloc@12") -#endif -#else - __asm__("HeapAlloc") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - HeapFree(void *, ::std::uint_least32_t, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("HeapFree@12") -#else - __asm__("_HeapFree@12") -#endif -#else - __asm__("HeapFree") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetProcessHeap() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetProcessHeap@0") -#else - __asm__("_GetProcessHeap@0") -#endif -#else - __asm__("GetProcessHeap") -#endif -#endif - - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - HeapReAlloc(void *, ::std::uint_least32_t, void *, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("HeapReAlloc@16") -#else - __asm__("_HeapReAlloc@16") -#endif -#else - __asm__("HeapReAlloc") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - HeapSize(void *, ::std::uint_least32_t, void const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("HeapSize@12") -#else - __asm__("_HeapSize@12") -#endif -#else - __asm__("HeapSize") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - VirtualAlloc(void *, ::std::size_t, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("VirtualAlloc@16") -#else - __asm__("_VirtualAlloc@16") -#endif -#else - __asm__("VirtualAlloc") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - VirtualProtect(void *, ::std::size_t, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("VirtualProtect@16") -#else - __asm__("_VirtualProtect@16") -#endif -#else - __asm__("VirtualProtect") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - VirtualFree(void *, ::std::size_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("VirtualFree@12") -#else - __asm__("_VirtualFree@12") -#endif -#else - __asm__("VirtualFree") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -#if __has_cpp_attribute(__gnu__::__const__) -[[__gnu__::__const__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - VirtualQuery(void const *, memory_basic_information *, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("VirtualQuery@12") -#else - __asm__("_VirtualQuery@12") -#endif -#else - __asm__("VirtualQuery") -#endif -#endif - ; +FAST_IO_DLLIMPORT FAST_IO_GNU_MALLOC extern void *FAST_IO_WINSTDCALL HeapAlloc(void *, ::std::uint_least32_t, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(HeapAlloc, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL HeapFree(void *, ::std::uint_least32_t, void *) noexcept FAST_IO_WINSTDCALL_RENAME(HeapFree, 12); +FAST_IO_DLLIMPORT FAST_IO_GNU_CONST extern void *FAST_IO_WINSTDCALL GetProcessHeap() noexcept FAST_IO_WINSTDCALL_RENAME(GetProcessHeap, 0); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL HeapReAlloc(void *, ::std::uint_least32_t, void *, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(HeapReAlloc, 16); +FAST_IO_DLLIMPORT extern ::std::size_t FAST_IO_WINSTDCALL HeapSize(void *, ::std::uint_least32_t, void const *) noexcept FAST_IO_WINSTDCALL_RENAME(HeapSize, 12); +FAST_IO_DLLIMPORT FAST_IO_GNU_MALLOC extern void *FAST_IO_WINSTDCALL VirtualAlloc(void *, ::std::size_t, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(VirtualAlloc, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL VirtualProtect(void *, ::std::size_t, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(VirtualProtect, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL VirtualFree(void *, ::std::size_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(VirtualFree, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL VirtualQuery(void const *, memory_basic_information *, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(VirtualQuery, 12); } // namespace win32 namespace details diff --git a/include/fast_io_core_impl/macros/pop_macros.h b/include/fast_io_core_impl/macros/pop_macros.h new file mode 100644 index 000000000..13392abae --- /dev/null +++ b/include/fast_io_core_impl/macros/pop_macros.h @@ -0,0 +1,12 @@ +#pragma pop_macro("FAST_IO_GNU_RETURNS_NONNULL") +#pragma pop_macro("FAST_IO_GNU_MALLOC") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") +#pragma pop_macro("FAST_IO_GNU_ARTIFICIAL") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE") +#pragma pop_macro("FAST_IO_GNU_CONST") +#pragma pop_macro("FAST_IO_WINCDECL_RENAME") +#pragma pop_macro("FAST_IO_WINCDECL") +#pragma pop_macro("FAST_IO_WINSTDCALL_RENAME") +#pragma pop_macro("FAST_IO_WINSTDCALL") +#pragma pop_macro("FAST_IO_DLLIMPORT") diff --git a/include/fast_io_core_impl/macros/push_macros.h b/include/fast_io_core_impl/macros/push_macros.h new file mode 100644 index 000000000..fa559f4f8 --- /dev/null +++ b/include/fast_io_core_impl/macros/push_macros.h @@ -0,0 +1,151 @@ +#pragma push_macro("FAST_IO_DLLIMPORT") +#undef FAST_IO_DLLIMPORT +#pragma push_macro("FAST_IO_WINSTDCALL") +#undef FAST_IO_WINSTDCALL +#pragma push_macro("FAST_IO_WINSTDCALL_RENAME") +#undef FAST_IO_WINSTDCALL_RENAME +#pragma push_macro("FAST_IO_WINCDECL") +#undef FAST_IO_WINCDECL +#pragma push_macro("FAST_IO_WINCDECL_RENAME") +#undef FAST_IO_WINCDECL_RENAME +#pragma push_macro("FAST_IO_WINFASTCALL") +#undef FAST_IO_WINFASTCALL +#pragma push_macro("FAST_IO_WINFASTCALL_RENAME") +#undef FAST_IO_WINFASTCALL_RENAME +#pragma push_macro("FAST_IO_GNU_CONST") +#undef FAST_IO_GNU_CONST +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE") +#undef FAST_IO_GNU_ALWAYS_INLINE +#pragma push_macro("FAST_IO_GNU_ARTIFICIAL") +#undef FAST_IO_GNU_ARTIFICIAL +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") +#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") +#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST +#pragma push_macro("FAST_IO_GNU_MALLOC") +#undef FAST_IO_GNU_MALLOC +#pragma push_macro("FAST_IO_GNU_RETURNS_NONNULL") +#undef FAST_IO_GNU_RETURNS_NONNULL + +#if defined(_MSC_VER) && !defined(__clang__) +#define FAST_IO_DLLIMPORT __declspec(dllimport) +#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) +#define FAST_IO_DLLIMPORT [[__gnu__::__dllimport__]] +#else +#define FAST_IO_DLLIMPORT +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_WINSTDCALL __stdcall +#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_WINSTDCALL __attribute__((__stdcall__)) +#else +#define FAST_IO_WINSTDCALL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name "@" #count) +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("_" #name "@" #count) +#endif +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) +#define FAST_IO_WINCDECL __cdecl +#elif (__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) +#define FAST_IO_WINCDECL __attribute__((__cdecl__)) +#else +#define FAST_IO_WINCDECL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) +#else +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("_" #name) +#endif +#else +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINCDECL_RENAME(name, count) +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) +#define FAST_IO_WINFASTCALL __fastcall +#elif (__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) +#define FAST_IO_WINFASTCALL __attribute__((__fastcall__)) +#else +#define FAST_IO_WINFASTCALL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("@" #name "@" #count) +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("_@" #name "@" #count) +#endif +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) +#endif + +#if __has_cpp_attribute(__gnu__::__const__) +#define FAST_IO_GNU_CONST [[__gnu__::__const__]] +#else +#define FAST_IO_GNU_CONST +#endif + +#if __has_cpp_attribute(__gnu__::__always_inline__) +#define FAST_IO_GNU_ALWAYS_INLINE [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) +#define FAST_IO_GNU_ALWAYS_INLINE [[msvc::forceinline]] +#else +#define FAST_IO_GNU_ALWAYS_INLINE +#endif + +#if __has_cpp_attribute(__gnu__::__artificial__) +#define FAST_IO_GNU_ARTIFICIAL [[__gnu__::__artificial__]] +#else +#define FAST_IO_GNU_ARTIFICIAL +#endif + +#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL FAST_IO_GNU_ALWAYS_INLINE FAST_IO_GNU_ARTIFICIAL + +#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST \ + FAST_IO_GNU_ALWAYS_INLINE [[nodiscard]] FAST_IO_GNU_ARTIFICIAL FAST_IO_GNU_CONST + +#if __has_cpp_attribute(__gnu__::__malloc__) +#define FAST_IO_GNU_MALLOC [[__gnu__::__malloc__]] +#else +#define FAST_IO_GNU_MALLOC +#endif + +#if __has_cpp_attribute(__gnu__::__returns_nonnull__) +#define FAST_IO_GNU_RETURNS_NONNULL [[__gnu__::__returns_nonnull__]] +#else +#define FAST_IO_GNU_RETURNS_NONNULL +#endif From f4027974ff16df789c456f48b570962e82783b24 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 21:00:27 -0500 Subject: [PATCH 27/51] [macros] Add FAST_IO_STDCALL --- .../allocation/nt_preliminary_definition.h | 8 +------- include/fast_io_core_impl/macros/pop_macros.h | 1 + include/fast_io_core_impl/macros/push_macros.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/fast_io_core_impl/allocation/nt_preliminary_definition.h b/include/fast_io_core_impl/allocation/nt_preliminary_definition.h index fe35c7b52..7b50af359 100644 --- a/include/fast_io_core_impl/allocation/nt_preliminary_definition.h +++ b/include/fast_io_core_impl/allocation/nt_preliminary_definition.h @@ -8,13 +8,7 @@ namespace fast_io::win32::nt { struct peb_ldr_data; struct rtl_user_process_parameters; -using pps_post_process_init_routine = void( -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) - __stdcall -#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) - __attribute__((__stdcall__)) -#endif - *)(void) noexcept; +using pps_post_process_init_routine = void(FAST_IO_STDCALL *)(void) noexcept; struct peb { diff --git a/include/fast_io_core_impl/macros/pop_macros.h b/include/fast_io_core_impl/macros/pop_macros.h index 13392abae..eeaf88602 100644 --- a/include/fast_io_core_impl/macros/pop_macros.h +++ b/include/fast_io_core_impl/macros/pop_macros.h @@ -9,4 +9,5 @@ #pragma pop_macro("FAST_IO_WINCDECL") #pragma pop_macro("FAST_IO_WINSTDCALL_RENAME") #pragma pop_macro("FAST_IO_WINSTDCALL") +#pragma pop_macro("FAST_IO_STDCALL") #pragma pop_macro("FAST_IO_DLLIMPORT") diff --git a/include/fast_io_core_impl/macros/push_macros.h b/include/fast_io_core_impl/macros/push_macros.h index fa559f4f8..e93a8fc4a 100644 --- a/include/fast_io_core_impl/macros/push_macros.h +++ b/include/fast_io_core_impl/macros/push_macros.h @@ -1,5 +1,7 @@ #pragma push_macro("FAST_IO_DLLIMPORT") #undef FAST_IO_DLLIMPORT +#pragma push_macro("FAST_IO_STDCALL") +#undef FAST_IO_STDCALL #pragma push_macro("FAST_IO_WINSTDCALL") #undef FAST_IO_WINSTDCALL #pragma push_macro("FAST_IO_WINSTDCALL_RENAME") @@ -35,6 +37,14 @@ #define FAST_IO_DLLIMPORT #endif +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_STDCALL __stdcall +#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_STDCALL __attribute__((__stdcall__)) +#else +#define FAST_IO_STDCALL +#endif + #if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) #define FAST_IO_WINSTDCALL __stdcall #elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) From 2664a0bf4e72a4f79d9f1f90eb92013662bc9ac0 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 21:35:01 -0500 Subject: [PATCH 28/51] [macros] Fix push_macros and remove core/macros --- include/fast_io_core.h | 4 +- include/fast_io_dsal/array.h | 3 +- include/fast_io_dsal/deque.h | 5 +- include/fast_io_dsal/forward_list.h | 5 +- include/fast_io_dsal/impl/misc/pop_macros.h | 13 ++ include/fast_io_dsal/impl/misc/push_macros.h | 162 +++++++++++++++++++ include/fast_io_dsal/index_span.h | 3 +- include/fast_io_dsal/list.h | 5 +- include/fast_io_dsal/span.h | 5 +- include/fast_io_dsal/string.h | 5 +- include/fast_io_dsal/string_view.h | 5 +- include/fast_io_dsal/vector.h | 5 +- include/fast_io_freestanding.h | 2 + include/fast_io_hosted.h | 6 +- include/fast_io_hosted_crypto.h | 5 +- 15 files changed, 202 insertions(+), 31 deletions(-) diff --git a/include/fast_io_core.h b/include/fast_io_core.h index b3e82ab6a..1c4ed4290 100644 --- a/include/fast_io_core.h +++ b/include/fast_io_core.h @@ -20,7 +20,7 @@ #include "fast_io_concept.h" #include "fast_io_dsal/impl/misc/push_warnings.h" -#include "fast_io_core_impl/macros/push_macros.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #include "fast_io_core_impl/empty.h" #if defined(_MSC_VER) && !defined(__clang__) @@ -98,7 +98,7 @@ #include "fast_io_core_impl/http_header.h" #include "fast_io_core_impl/io_lockable.h" -#include "fast_io_core_impl/macros/pop_macros.h" +#include "fast_io_dsal/impl/misc/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" #endif diff --git a/include/fast_io_dsal/array.h b/include/fast_io_dsal/array.h index 81501f537..b10924865 100644 --- a/include/fast_io_dsal/array.h +++ b/include/fast_io_dsal/array.h @@ -8,10 +8,9 @@ #error "You must be using a C++ compiler" #endif +#include "../fast_io_core.h" #include "impl/misc/push_macros.h" #include "impl/misc/push_warnings.h" - -#include "../fast_io_core.h" #include "impl/array.h" namespace fast_io diff --git a/include/fast_io_dsal/deque.h b/include/fast_io_dsal/deque.h index f0beeff62..e3af9db9e 100644 --- a/include/fast_io_dsal/deque.h +++ b/include/fast_io_dsal/deque.h @@ -4,9 +4,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -18,6 +15,8 @@ #include #include #include +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "../fast_io_core_impl/freestanding/impl.h" #include "../fast_io_core_impl/terminate.h" #include "../fast_io_core_impl/intrinsics/msvc/impl.h" diff --git a/include/fast_io_dsal/forward_list.h b/include/fast_io_dsal/forward_list.h index 721404e69..52f0c453d 100644 --- a/include/fast_io_dsal/forward_list.h +++ b/include/fast_io_dsal/forward_list.h @@ -4,9 +4,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -18,6 +15,8 @@ #include #include #include +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "../fast_io_core_impl/freestanding/impl.h" #include "../fast_io_core_impl/terminate.h" #include "../fast_io_core_impl/intrinsics/msvc/impl.h" diff --git a/include/fast_io_dsal/impl/misc/pop_macros.h b/include/fast_io_dsal/impl/misc/pop_macros.h index f1ac4ef6f..93b15d2cd 100644 --- a/include/fast_io_dsal/impl/misc/pop_macros.h +++ b/include/fast_io_dsal/impl/misc/pop_macros.h @@ -1,4 +1,17 @@ // Please keep it in reverse order with the macros in push_macros.h +#pragma pop_macro("FAST_IO_GNU_RETURNS_NONNULL") +#pragma pop_macro("FAST_IO_GNU_MALLOC") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") +#pragma pop_macro("FAST_IO_GNU_ARTIFICIAL") +#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE") +#pragma pop_macro("FAST_IO_GNU_CONST") +#pragma pop_macro("FAST_IO_WINCDECL_RENAME") +#pragma pop_macro("FAST_IO_WINCDECL") +#pragma pop_macro("FAST_IO_WINSTDCALL_RENAME") +#pragma pop_macro("FAST_IO_WINSTDCALL") +#pragma pop_macro("FAST_IO_STDCALL") +#pragma pop_macro("FAST_IO_DLLIMPORT") #pragma pop_macro("refresh") #pragma pop_macro("new") #pragma pop_macro("move") diff --git a/include/fast_io_dsal/impl/misc/push_macros.h b/include/fast_io_dsal/impl/misc/push_macros.h index 829694e1f..9986d2881 100644 --- a/include/fast_io_dsal/impl/misc/push_macros.h +++ b/include/fast_io_dsal/impl/misc/push_macros.h @@ -18,3 +18,165 @@ #pragma push_macro("refresh") #undef refresh + +#pragma push_macro("FAST_IO_DLLIMPORT") +#undef FAST_IO_DLLIMPORT +#pragma push_macro("FAST_IO_STDCALL") +#undef FAST_IO_STDCALL +#pragma push_macro("FAST_IO_WINSTDCALL") +#undef FAST_IO_WINSTDCALL +#pragma push_macro("FAST_IO_WINSTDCALL_RENAME") +#undef FAST_IO_WINSTDCALL_RENAME +#pragma push_macro("FAST_IO_WINCDECL") +#undef FAST_IO_WINCDECL +#pragma push_macro("FAST_IO_WINCDECL_RENAME") +#undef FAST_IO_WINCDECL_RENAME +#pragma push_macro("FAST_IO_WINFASTCALL") +#undef FAST_IO_WINFASTCALL +#pragma push_macro("FAST_IO_WINFASTCALL_RENAME") +#undef FAST_IO_WINFASTCALL_RENAME +#pragma push_macro("FAST_IO_GNU_CONST") +#undef FAST_IO_GNU_CONST +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE") +#undef FAST_IO_GNU_ALWAYS_INLINE +#pragma push_macro("FAST_IO_GNU_ARTIFICIAL") +#undef FAST_IO_GNU_ARTIFICIAL +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") +#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL +#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") +#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST +#pragma push_macro("FAST_IO_GNU_MALLOC") +#undef FAST_IO_GNU_MALLOC +#pragma push_macro("FAST_IO_GNU_RETURNS_NONNULL") +#undef FAST_IO_GNU_RETURNS_NONNULL + +#if defined(_MSC_VER) && !defined(__clang__) +#define FAST_IO_DLLIMPORT __declspec(dllimport) +#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) +#define FAST_IO_DLLIMPORT [[__gnu__::__dllimport__]] +#else +#define FAST_IO_DLLIMPORT +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_STDCALL __stdcall +#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_STDCALL __attribute__((__stdcall__)) +#else +#define FAST_IO_STDCALL +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_WINSTDCALL __stdcall +#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) +#define FAST_IO_WINSTDCALL __attribute__((__stdcall__)) +#else +#define FAST_IO_WINSTDCALL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name "@" #count) +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("_" #name "@" #count) +#endif +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINSTDCALL_RENAME(name, count) +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) +#define FAST_IO_WINCDECL __cdecl +#elif (__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) +#define FAST_IO_WINCDECL __attribute__((__cdecl__)) +#else +#define FAST_IO_WINCDECL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) +#else +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("_" #name) +#endif +#else +#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINCDECL_RENAME(name, count) +#endif + +#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) +#define FAST_IO_WINFASTCALL __fastcall +#elif (__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) +#define FAST_IO_WINFASTCALL __attribute__((__fastcall__)) +#else +#define FAST_IO_WINFASTCALL +#endif + +#if defined(__clang__) || defined(__GNUC__) +#if defined(_M_HYBRID) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name "@" #count) +#elif defined(__arm64ec__) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name) +#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) +#if !defined(__clang__) +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("@" #name "@" #count) +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("_@" #name "@" #count) +#endif +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__(#name) +#endif +#else +#define FAST_IO_WINFASTCALL_RENAME(name, count) +#endif + +#if __has_cpp_attribute(__gnu__::__const__) +#define FAST_IO_GNU_CONST [[__gnu__::__const__]] +#else +#define FAST_IO_GNU_CONST +#endif + +#if __has_cpp_attribute(__gnu__::__always_inline__) +#define FAST_IO_GNU_ALWAYS_INLINE [[__gnu__::__always_inline__]] +#elif __has_cpp_attribute(msvc::forceinline) +#define FAST_IO_GNU_ALWAYS_INLINE [[msvc::forceinline]] +#else +#define FAST_IO_GNU_ALWAYS_INLINE +#endif + +#if __has_cpp_attribute(__gnu__::__artificial__) +#define FAST_IO_GNU_ARTIFICIAL [[__gnu__::__artificial__]] +#else +#define FAST_IO_GNU_ARTIFICIAL +#endif + +#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL FAST_IO_GNU_ALWAYS_INLINE FAST_IO_GNU_ARTIFICIAL + +#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST \ + FAST_IO_GNU_ALWAYS_INLINE [[nodiscard]] FAST_IO_GNU_ARTIFICIAL FAST_IO_GNU_CONST + +#if __has_cpp_attribute(__gnu__::__malloc__) +#define FAST_IO_GNU_MALLOC [[__gnu__::__malloc__]] +#else +#define FAST_IO_GNU_MALLOC +#endif + +#if __has_cpp_attribute(__gnu__::__returns_nonnull__) +#define FAST_IO_GNU_RETURNS_NONNULL [[__gnu__::__returns_nonnull__]] +#else +#define FAST_IO_GNU_RETURNS_NONNULL +#endif diff --git a/include/fast_io_dsal/index_span.h b/include/fast_io_dsal/index_span.h index 3c7160c1c..a84302349 100644 --- a/include/fast_io_dsal/index_span.h +++ b/include/fast_io_dsal/index_span.h @@ -8,10 +8,9 @@ #error "You must be using a C++ compiler" #endif +#include "span.h" #include "impl/misc/push_macros.h" #include "impl/misc/push_warnings.h" - -#include "span.h" #include "impl/index_span.h" namespace fast_io diff --git a/include/fast_io_dsal/list.h b/include/fast_io_dsal/list.h index 953e61b90..259a956c8 100644 --- a/include/fast_io_dsal/list.h +++ b/include/fast_io_dsal/list.h @@ -4,9 +4,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -18,6 +15,8 @@ #include #include #include +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "../fast_io_core_impl/freestanding/impl.h" #include "../fast_io_core_impl/terminate.h" #include "../fast_io_core_impl/intrinsics/msvc/impl.h" diff --git a/include/fast_io_dsal/span.h b/include/fast_io_dsal/span.h index 6c8481e7b..a8d6796e9 100644 --- a/include/fast_io_dsal/span.h +++ b/include/fast_io_dsal/span.h @@ -8,9 +8,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -24,6 +21,8 @@ #include #endif #include "../fast_io_core.h" +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "impl/common.h" #include "impl/span.h" diff --git a/include/fast_io_dsal/string.h b/include/fast_io_dsal/string.h index 30123c669..bf0b7cbc2 100644 --- a/include/fast_io_dsal/string.h +++ b/include/fast_io_dsal/string.h @@ -4,9 +4,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -19,6 +16,8 @@ #include #include #include "../fast_io_core.h" +#include "impl/misc/push_warnings.h" +#include "impl/misc/push_macros.h" #include "impl/freestanding.h" #include "impl/common.h" #include "impl/string_view.h" diff --git a/include/fast_io_dsal/string_view.h b/include/fast_io_dsal/string_view.h index 2f536b7f0..afbedf469 100644 --- a/include/fast_io_dsal/string_view.h +++ b/include/fast_io_dsal/string_view.h @@ -8,9 +8,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -25,6 +22,8 @@ #endif #include #include "../fast_io_core.h" +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "impl/common.h" #include "impl/string_view.h" #include "impl/cstring_view.h" diff --git a/include/fast_io_dsal/vector.h b/include/fast_io_dsal/vector.h index c72c15f35..d790964d4 100644 --- a/include/fast_io_dsal/vector.h +++ b/include/fast_io_dsal/vector.h @@ -4,9 +4,6 @@ #error "You must be using a C++ compiler" #endif -#include "impl/misc/push_macros.h" -#include "impl/misc/push_warnings.h" - #include #include #include @@ -18,6 +15,8 @@ #include #include #include +#include "impl/misc/push_macros.h" +#include "impl/misc/push_warnings.h" #include "../fast_io_core_impl/freestanding/impl.h" #include "../fast_io_core_impl/terminate.h" #include "../fast_io_core_impl/intrinsics/msvc/impl.h" diff --git a/include/fast_io_freestanding.h b/include/fast_io_freestanding.h index fce869e62..3062be328 100644 --- a/include/fast_io_freestanding.h +++ b/include/fast_io_freestanding.h @@ -12,6 +12,7 @@ #include "fast_io_core.h" #include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #include "fast_io_freestanding_impl/exception.h" // #include"fast_io_freestanding_impl/posix_error.h" @@ -35,6 +36,7 @@ #include "fast_io_unit/bitset.h" #endif +#include "fast_io_dsal/impl/misc/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" #endif diff --git a/include/fast_io_hosted.h b/include/fast_io_hosted.h index 6dc59d156..f8d2edce2 100644 --- a/include/fast_io_hosted.h +++ b/include/fast_io_hosted.h @@ -18,6 +18,8 @@ freestanding ones. #include "fast_io_freestanding.h" +#include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #if ((__STDC_HOSTED__ == 1 && (!defined(_GLIBCXX_HOSTED) || _GLIBCXX_HOSTED == 1) && \ !defined(_LIBCPP_FREESTANDING)) || \ defined(FAST_IO_ENABLE_HOSTED_FEATURES)) @@ -39,8 +41,6 @@ freestanding ones. #include "fast_io_hosted/platforms/errc_impl.h" #endif -#include "fast_io_dsal/impl/misc/push_warnings.h" - #include "fast_io_hosted/posix_error_scatter/impl.h" #include "fast_io_hosted/posix_error.h" #ifdef __MSDOS__ @@ -124,6 +124,8 @@ freestanding ones. #endif +#include "fast_io_dsal/impl/misc/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" + #endif diff --git a/include/fast_io_hosted_crypto.h b/include/fast_io_hosted_crypto.h index 437a6e513..b55ca7877 100644 --- a/include/fast_io_hosted_crypto.h +++ b/include/fast_io_hosted_crypto.h @@ -14,11 +14,12 @@ #include "fast_io_hosted.h" #include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #include "fast_io_crypto/platforms/impl.h" - +#include "fast_io_dsal/impl/misc/pop_macros.h" +#include "fast_io_dsal/impl/misc/pop_warnings.h" #endif -#include "fast_io_dsal/impl/misc/pop_warnings.h" #endif From d739b90b380bea4319222a5d5de3c71bdc0bef56 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 22:20:50 -0500 Subject: [PATCH 29/51] [win32 apis] use macros to import apis --- include/fast_io_hosted/platforms/win32/apis.h | 4238 +---------------- .../platforms/win32/win32_definitions.h | 1 + 2 files changed, 158 insertions(+), 4081 deletions(-) diff --git a/include/fast_io_hosted/platforms/win32/apis.h b/include/fast_io_hosted/platforms/win32/apis.h index 8ee2f909b..0cc036e8a 100644 --- a/include/fast_io_hosted/platforms/win32/apis.h +++ b/include/fast_io_hosted/platforms/win32/apis.h @@ -3,4086 +3,162 @@ namespace fast_io::win32 { -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetLastError() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetLastError@0") -#else - __asm__("_GetLastError@0") -#endif -#else - __asm__("GetLastError") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LoadLibraryA(char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LoadLibraryA@4") -#else - __asm__("_LoadLibraryA@4") -#endif -#else - __asm__("LoadLibraryA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LoadLibraryW(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LoadLibraryW@4") -#else - __asm__("_LoadLibraryW@4") -#endif -#else - __asm__("LoadLibraryW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LoadLibraryExA(char const *, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LoadLibraryExA@12") -#else - __asm__("_LoadLibraryExA@12") -#endif -#else - __asm__("LoadLibraryExA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LoadLibraryExW(char16_t const *, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LoadLibraryExW@12") -#else - __asm__("_LoadLibraryExW@12") -#endif -#else - __asm__("LoadLibraryExW") -#endif -#endif - ; - -// Used to retrieve a locale-specific message string for some error code -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FormatMessageA(::std::uint_least32_t, char const *, ::std::uint_least32_t, ::std::uint_least32_t, char *, - ::std::uint_least32_t, void /*va_list*/ *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FormatMessageA@28") -#else - __asm__("_FormatMessageA@28") -#endif -#else - __asm__("FormatMessageA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FormatMessageW(::std::uint_least32_t, char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, char16_t *, - ::std::uint_least32_t, void /*va_list*/ *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FormatMessageW@28") -#else - __asm__("_FormatMessageW@28") -#endif -#else - __asm__("FormatMessageW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateFileMappingA(void *, security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateFileMappingA@24") -#else - __asm__("_CreateFileMappingA@24") -#endif -#else - __asm__("CreateFileMappingA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateFileMappingW(void *, security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateFileMappingW@24") -#else - __asm__("_CreateFileMappingW@24") -#endif -#else - __asm__("CreateFileMappingW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - MapViewOfFile(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("MapViewOfFile@20") -#else - __asm__("_MapViewOfFile@20") -#endif -#else - __asm__("MapViewOfFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetEndOfFile(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetEndOfFile@4") -#else - __asm__("_SetEndOfFile@4") -#endif -#else - __asm__("SetEndOfFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - UnmapViewOfFile(void const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("UnmapViewOfFile@4") -#else - __asm__("_UnmapViewOfFile@4") -#endif -#else - __asm__("UnmapViewOfFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WriteFile(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WriteFile@20") -#else - __asm__("_WriteFile@20") -#endif -#else - __asm__("WriteFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ReadFile(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ReadFile@20") -#else - __asm__("_ReadFile@20") -#endif -#else - __asm__("ReadFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFilePointer(void *, ::std::int_least32_t, ::std::int_least32_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFilePointer@16") -#else - __asm__("_SetFilePointer@16") -#endif -#else - __asm__("SetFilePointer") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFilePointerEx(void *, ::std::int_least64_t, ::std::int_least64_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFilePointerEx@20") -#else - __asm__("_SetFilePointerEx@20") -#endif -#else - __asm__("SetFilePointerEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DuplicateHandle(void *, void *, void *, void **, ::std::uint_least32_t, int, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DuplicateHandle@28") -#else - __asm__("_DuplicateHandle@28") -#endif -#else - __asm__("DuplicateHandle") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetStdHandle(::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetStdHandle@4") -#else - __asm__("_GetStdHandle@4") -#endif -#else - __asm__("GetStdHandle") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreatePipe(void **, void **, security_attributes *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreatePipe@16") -#else - __asm__("_CreatePipe@16") -#endif -#else - __asm__("CreatePipe") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FreeLibrary(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FreeLibrary@4") -#else - __asm__("_FreeLibrary@4") -#endif -#else - __asm__("FreeLibrary") -#endif -#endif - ; - -using farproc = ptrdiff_t( -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) - __stdcall -#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) - __attribute__((__stdcall__)) -#endif - *)() noexcept; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern farproc -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetProcAddress(void *, char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetProcAddress@8") -#else - __asm__("_GetProcAddress@8") -#endif -#else - __asm__("GetProcAddress") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetModuleHandleA(char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetModuleHandleA@4") -#else - __asm__("_GetModuleHandleA@4") -#endif -#else - __asm__("GetModuleHandleA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetModuleHandleW(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetModuleHandleW@4") -#else - __asm__("_GetModuleHandleW@4") -#endif -#else - __asm__("GetModuleHandleW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WaitForSingleObject(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WaitForSingleObject@8") -#else - __asm__("_WaitForSingleObject@8") -#endif -#else - __asm__("WaitForSingleObject") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CancelIo(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CancelIo@4") -#else - __asm__("_CancelIo@4") -#endif -#else - __asm__("CancelIo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFileInformationByHandle(void *__restrict, by_handle_file_information *__restrict) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFileInformationByHandle@8") -#else - __asm__("_GetFileInformationByHandle@8") -#endif -#else - __asm__("GetFileInformationByHandle") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetUserDefaultLocaleName(char16_t *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetUserDefaultLocaleName@8") -#else - __asm__("_GetUserDefaultLocaleName@8") -#endif -#else - __asm__("GetUserDefaultLocaleName") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetUserDefaultLCID(void) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetUserDefaultLCID@0") -#else - __asm__("_GetUserDefaultLCID@0") -#endif -#else - __asm__("GetUserDefaultLCID") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetSystemTimePreciseAsFileTime(filetime *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetSystemTimePreciseAsFileTime@4") -#else - __asm__("_GetSystemTimePreciseAsFileTime@4") -#endif -#else - __asm__("GetSystemTimePreciseAsFileTime") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetSystemTimeAsFileTime(filetime *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetSystemTimeAsFileTime@4") -#else - __asm__("_GetSystemTimeAsFileTime@4") -#endif -#else - __asm__("GetSystemTimeAsFileTime") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - QueryUnbiasedInterruptTime(::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("QueryUnbiasedInterruptTime@4") -#else - __asm__("_QueryUnbiasedInterruptTime@4") -#endif -#else - __asm__("QueryUnbiasedInterruptTime") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - QueryPerformanceCounter(::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("QueryPerformanceCounter@4") -#else - __asm__("_QueryPerformanceCounter@4") -#endif -#else - __asm__("QueryPerformanceCounter") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - QueryPerformanceFrequency(::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("QueryPerformanceFrequency@4") -#else - __asm__("_QueryPerformanceFrequency@4") -#endif -#else - __asm__("QueryPerformanceFrequency") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetProcessTimes(void *, filetime *, filetime *, filetime *, filetime *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetProcessTimes@20") -#else - __asm__("_GetProcessTimes@20") -#endif -#else - __asm__("GetProcessTimes") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetThreadTimes(void *, filetime *, filetime *, filetime *, filetime *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetThreadTimes@20") -#else - __asm__("_GetThreadTimes@20") -#endif -#else - __asm__("GetThreadTimes") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetHandleInformation(void *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetHandleInformation@8") -#else - __asm__("_GetHandleInformation@8") -#endif -#else - __asm__("GetHandleInformation") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetHandleInformation(void *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetHandleInformation@12") -#else - __asm__("_SetHandleInformation@12") -#endif -#else - __asm__("SetHandleInformation") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetTempPathA(::std::uint_least32_t, char *buffer) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetTempPathA@8") -#else - __asm__("_GetTempPathA@8") -#endif -#else - __asm__("GetTempPathA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetTempPathW(::std::uint_least32_t, char16_t *buffer) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetTempPathW@8") -#else - __asm__("_GetTempPathW@8") -#endif -#else - __asm__("GetTempPathW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateFileA(char const *, ::std::uint_least32_t, ::std::uint_least32_t, security_attributes *, - ::std::uint_least32_t, ::std::uint_least32_t, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateFileA@28") -#else - __asm__("_CreateFileA@28") -#endif -#else - __asm__("CreateFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateFileW(char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, security_attributes *, - ::std::uint_least32_t, ::std::uint_least32_t, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateFileW@28") -#else - __asm__("_CreateFileW@28") -#endif -#else - __asm__("CreateFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateIoCompletionPort(void *, void *, ::std::size_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateIoCompletionPort@16") -#else - __asm__("_CreateIoCompletionPort@16") -#endif -#else - __asm__("CreateIoCompletionPort") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SystemFunction036(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SystemFunction036@8") -#else - __asm__("_SystemFunction036@8") -#endif -#else - __asm__("SystemFunction036") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CloseHandle(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CloseHandle@4") -#else - __asm__("_CloseHandle@4") -#endif -#else - __asm__("CloseHandle") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LockFileEx(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, - overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LockFileEx@24") -#else - __asm__("_LockFileEx@24") -#endif -#else - __asm__("LockFileEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - UnlockFileEx(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("UnlockFileEx@20") -#else - __asm__("_UnlockFileEx@20") -#endif -#else - __asm__("UnlockFileEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DeviceIoControl(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, - overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DeviceIoControl@32") -#else - __asm__("_DeviceIoControl@32") -#endif -#else - __asm__("DeviceIoControl") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFileType(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFileType@4") -#else - __asm__("_GetFileType@4") -#endif -#else - __asm__("GetFileType") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetACP() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetACP@0") -#else - __asm__("_GetACP@0") -#endif -#else - __asm__("GetACP") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetEnvironmentVariableA(char const *, char *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetEnvironmentVariableA@12") -#else - __asm__("_GetEnvironmentVariableA@12") -#endif -#else - __asm__("GetEnvironmentVariableA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetEnvironmentVariableW(char16_t const *, char16_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetEnvironmentVariableW@12") -#else - __asm__("_GetEnvironmentVariableW@12") -#endif -#else - __asm__("GetEnvironmentVariableW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - MessageBoxA(void *, char const *, char const *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("MessageBoxA@16") -#else - __asm__("_MessageBoxA@16") -#endif -#else - __asm__("MessageBoxA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - MessageBoxW(void *, char16_t const *, char16_t const *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("MessageBoxW@16") -#else - __asm__("_MessageBoxW@16") -#endif -#else - __asm__("MessageBoxW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetConsoleMode(void *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetConsoleMode@8") -#else - __asm__("_GetConsoleMode@8") -#endif -#else - __asm__("GetConsoleMode") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetConsoleMode(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetConsoleMode@8") -#else - __asm__("_SetConsoleMode@8") -#endif -#else - __asm__("SetConsoleMode") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ReadConsoleA(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ReadConsoleA@20") -#else - __asm__("_ReadConsoleA@20") -#endif -#else - __asm__("ReadConsoleA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ReadConsoleW(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ReadConsoleW@20") -#else - __asm__("_ReadConsoleW@20") -#endif -#else - __asm__("ReadConsoleW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WriteConsoleA(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WriteConsoleA@20") -#else - __asm__("_WriteConsoleA@20") -#endif -#else - __asm__("WriteConsoleA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WriteConsoleW(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WriteConsoleW@20") -#else - __asm__("_WriteConsoleW@20") -#endif -#else - __asm__("WriteConsoleW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetConsoleScreenBufferInfo(void *, console_screen_buffer_info *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetConsoleScreenBufferInfo@8") -#else - __asm__("_GetConsoleScreenBufferInfo@8") -#endif -#else - __asm__("GetConsoleScreenBufferInfo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ScrollConsoleScreenBufferA(void *, small_rect const *, small_rect const *, coord, char_info const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ScrollConsoleScreenBufferA@20") -#else - __asm__("_ScrollConsoleScreenBufferA@20") -#endif -#else - __asm__("ScrollConsoleScreenBufferA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ScrollConsoleScreenBufferW(void *, small_rect const *, small_rect const *, coord, char_info const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ScrollConsoleScreenBufferW@20") -#else - __asm__("_ScrollConsoleScreenBufferW@20") -#endif -#else - __asm__("ScrollConsoleScreenBufferW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetConsoleCursorPosition(void *, coord) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetConsoleCursorPosition@8") -#else - __asm__("_SetConsoleCursorPosition@8") -#endif -#else - __asm__("SetConsoleCursorPosition") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - InitializeCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("InitializeCriticalSection@4") -#else - __asm__("_InitializeCriticalSection@4") -#endif -#else - __asm__("InitializeCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - EnterCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("EnterCriticalSection@4") -#else - __asm__("_EnterCriticalSection@4") -#endif -#else - __asm__("EnterCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - TryEnterCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("TryEnterCriticalSection@4") -#else - __asm__("_TryEnterCriticalSection@4") -#endif -#else - __asm__("TryEnterCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - LeaveCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("LeaveCriticalSection@4") -#else - __asm__("_LeaveCriticalSection@4") -#endif -#else - __asm__("LeaveCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DeleteCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DeleteCriticalSection@4") -#else - __asm__("_DeleteCriticalSection@4") -#endif -#else - __asm__("DeleteCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSADuplicateSocketA(void *, ::std::uint_least32_t, wsaprotocol_infoa *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSADuplicateSocketA@12") -#else - __asm__("_WSADuplicateSocketA@12") -#endif -#else - __asm__("WSADuplicateSocketA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSADuplicateSocketW(void *, ::std::uint_least32_t, wsaprotocol_infow *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSADuplicateSocketW@12") -#else - __asm__("_WSADuplicateSocketW@12") -#endif -#else - __asm__("WSADuplicateSocketW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSACleanup() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSACleanup@0") -#else - __asm__("_WSACleanup@0") -#endif -#else - __asm__("WSACleanup") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSAStartup(::std::uint_least32_t, wsadata *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSAStartup@8") -#else - __asm__("_WSAStartup@8") -#endif -#else - __asm__("WSAStartup") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSAGetLastError() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSAGetLastError@0") -#else - __asm__("_WSAGetLastError@0") -#endif -#else - __asm__("WSAGetLastError") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - closesocket(::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("closesocket@4") -#else - __asm__("_closesocket@4") -#endif -#else - __asm__("closesocket") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSASocketW(int, int, int, wsaprotocol_infow *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSASocketW@24") -#else - __asm__("_WSASocketW@24") -#endif -#else - __asm__("WSASocketW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSASocketA(int, int, int, wsaprotocol_infoa *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSASocketA@24") -#else - __asm__("_WSASocketA@24") -#endif -#else - __asm__("WSASocketA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - bind(::std::size_t, void const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("bind@12") -#else - __asm__("_bind@12") -#endif -#else - __asm__("bind") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - listen(::std::size_t, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("listen@8") -#else - __asm__("_listen@8") -#endif -#else - __asm__("listen") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSAAccept(::std::size_t, void const *, int *, lpconditionproc, ::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSAAccept@20") -#else - __asm__("_WSAAccept@20") -#endif -#else - __asm__("WSAAccept") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ioctlsocket(::std::size_t, long, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ioctlsocket@12") -#else - __asm__("_ioctlsocket@12") -#endif -#else - __asm__("ioctlsocket") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - sendto(::std::size_t, char const *, int, int, void const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("sendto@24") -#else - __asm__("_sendto@24") -#endif -#else - __asm__("sendto") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSASend(::std::size_t, wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t, - overlapped *, lpwsaoverlapped_completion_routine) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSASend@28") -#else - __asm__("_WSASend@28") -#endif -#else - __asm__("WSASend") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSASendMsg(::std::size_t, wsamsg *, ::std::uint_least32_t, ::std::uint_least32_t *, overlapped *, - lpwsaoverlapped_completion_routine) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSASendMsg@24") -#else - __asm__("_WSASendMsg@24") -#endif -#else - __asm__("WSASendMsg") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSASendTo(::std::size_t, wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t, - void const *, int, overlapped *, lpwsaoverlapped_completion_routine) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSASendTo@36") -#else - __asm__("_WSASendTo@36") -#endif -#else - __asm__("WSASendTo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - recv(::std::size_t, char *buf, int len, int flags) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("recv@16") -#else - __asm__("_recv@16") -#endif -#else - __asm__("recv") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - recvfrom(::std::size_t, char *, int, int, void *, int *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("recvfrom@24") -#else - __asm__("_recvfrom@24") -#endif -#else - __asm__("recvfrom") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSARecv(::std::size_t, wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t *, - overlapped *, lpwsaoverlapped_completion_routine) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSARecv@28") -#else - __asm__("_WSARecv@28") -#endif -#else - __asm__("WSARecv") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSARecvFrom(::std::size_t, wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t *, - void *, int *, overlapped *, lpwsaoverlapped_completion_routine) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSARecvFrom@36") -#else - __asm__("_WSARecvFrom@36") -#endif -#else - __asm__("WSARecvFrom") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - connect(::std::size_t, void const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("connect@12") -#else - __asm__("_connect@12") -#endif -#else - __asm__("connect") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - WSAConnect(::std::size_t, void const *, int, wsabuf *, wsabuf *, qualityofservice *, qualityofservice *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("WSAConnect@28") -#else - __asm__("_WSAConnect@28") -#endif -#else - __asm__("WSAConnect") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - shutdown(::std::size_t, void const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("shutdown@12") -#else - __asm__("_shutdown@12") -#endif -#else - __asm__("shutdown") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetCurrentProcessId() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetCurrentProcessId@0") -#else - __asm__("_GetCurrentProcessId@0") -#endif -#else - __asm__("GetCurrentProcessId") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FlushFileBuffers(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FlushFileBuffers@4") -#else - __asm__("_FlushFileBuffers@4") -#endif -#else - __asm__("FlushFileBuffers") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetQueuedCompletionStatus(void *, ::std::uint_least32_t *, ::std::size_t *, overlapped *, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetQueuedCompletionStatus@20") -#else - __asm__("_GetQueuedCompletionStatus@20") -#endif -#else - __asm__("GetQueuedCompletionStatus") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - freeaddrinfo(win32_addrinfo_9xa *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("freeaddrinfo@4") -#else - __asm__("_freeaddrinfo@4") -#endif -#else - __asm__("freeaddrinfo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FreeAddrInfoW(win32_addrinfo_ntw *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FreeAddrInfoW@4") -#else - __asm__("_FreeAddrInfoW@4") -#endif -#else - __asm__("FreeAddrInfoW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - getaddrinfo(char const *, char const *, win32_addrinfo_9xa const *, win32_addrinfo_9xa **) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("getaddrinfo@16") -#else - __asm__("_getaddrinfo@16") -#endif -#else - __asm__("getaddrinfo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetAddrInfoW(char16_t const *, char16_t const *, win32_addrinfo_ntw const *, win32_addrinfo_ntw **) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetAddrInfoW@16") -#else - __asm__("_GetAddrInfoW@16") -#endif -#else - __asm__("GetAddrInfoW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CryptAcquireContextA(::std::size_t *, char8_t const *, char8_t const *, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CryptAcquireContextA@20") -#else - __asm__("_CryptAcquireContextA@20") -#endif -#else - __asm__("CryptAcquireContextA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CryptAcquireContextW(::std::size_t *, char16_t const *, char16_t const *, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CryptAcquireContextW@20") -#else - __asm__("_CryptAcquireContextW@20") -#endif -#else - __asm__("CryptAcquireContextW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CryptReleaseContext(::std::size_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CryptReleaseContext@8") -#else - __asm__("_CryptReleaseContext@8") -#endif -#else - __asm__("CryptReleaseContext") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CryptGenRandom(::std::size_t, ::std::uint_least32_t, char unsigned *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CryptGenRandom@12") -#else - __asm__("_CryptGenRandom@12") -#endif -#else - __asm__("CryptGenRandom") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RegOpenKeyA(::std::size_t, char8_t const *, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RegOpenKeyA@12") -#else - __asm__("_RegOpenKeyA@12") -#endif -#else - __asm__("RegOpenKeyA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RegOpenKeyW(::std::size_t, char16_t const *, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RegOpenKeyW@12") -#else - __asm__("_RegOpenKeyW@12") -#endif -#else - __asm__("RegOpenKeyW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RegQueryValueExA(::std::size_t, char8_t const *, ::std::uint_least32_t *, ::std::uint_least32_t *, void *, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RegQueryValueExA@24") -#else - __asm__("_RegQueryValueExA@24") -#endif -#else - __asm__("RegQueryValueExA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RegQueryValueExW(::std::size_t, char16_t const *, ::std::uint_least32_t *, ::std::uint_least32_t *, void *, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RegQueryValueExW@24") -#else - __asm__("_RegQueryValueExW@24") -#endif -#else - __asm__("RegQueryValueExW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RegCloseKey(::std::size_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RegCloseKey@4") -#else - __asm__("_RegCloseKey@4") -#endif -#else - __asm__("RegCloseKey") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetTimeZoneInformation(time_zone_information *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetTimeZoneInformation@4") -#else - __asm__("_GetTimeZoneInformation@4") -#endif -#else - __asm__("GetTimeZoneInformation") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetConsoleCP(::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetConsoleCP@4") -#else - __asm__("_SetConsoleCP@4") -#endif -#else - __asm__("SetConsoleCP") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetConsoleOutputCP(::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetConsoleOutputCP@4") -#else - __asm__("_SetConsoleOutputCP@4") -#endif -#else - __asm__("SetConsoleOutputCP") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetConsoleCP() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetConsoleCP@0") -#else - __asm__("_GetConsoleCP@0") -#endif -#else - __asm__("GetConsoleCP") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetConsoleOutputCP() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetConsoleOutputCP@0") -#else - __asm__("_GetConsoleOutputCP@0") -#endif -#else - __asm__("GetConsoleOutputCP") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetSystemInfo(::fast_io::win32::system_info *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetSystemInfo@4") -#else - __asm__("_GetSystemInfo@4") -#endif -#else - __asm__("GetSystemInfo") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFileInformationByHandle(void *, file_info_by_handle_class, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFileInformationByHandle@16") -#else - __asm__("_SetFileInformationByHandle@16") -#endif -#else - __asm__("SetFileInformationByHandle") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFileTime(void *, filetime const *, filetime const *, filetime const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFileTime@16") -#else - __asm__("_SetFileTime@16") -#endif -#else - __asm__("SetFileTime") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - AcquireSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("AcquireSRWLockExclusive@4") -#else - __asm__("_AcquireSRWLockExclusive@4") -#endif -#else - __asm__("AcquireSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - TryAcquireSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("TryAcquireSRWLockExclusive@4") -#else - __asm__("_TryAcquireSRWLockExclusive@4") -#endif -#else - __asm__("TryAcquireSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ReleaseSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ReleaseSRWLockExclusive@4") -#else - __asm__("_ReleaseSRWLockExclusive@4") -#endif -#else - __asm__("ReleaseSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateProcessW(char16_t const *, char16_t *, security_attributes *, security_attributes *, int, ::std::uint_least32_t, void *, char16_t const *, startupinfow *, process_information *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateProcessW@40") -#else - __asm__("_CreateProcessW@40") -#endif -#else - __asm__("CreateProcessW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateProcessA(char const *, char *, security_attributes *, security_attributes *, int, ::std::uint_least32_t, void *, char16_t const *, startupinfoa *, process_information *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateProcessA@40") -#else - __asm__("_CreateProcessA@40") -#endif -#else - __asm__("CreateProcessA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetMappedFileNameW(void *, void *, char16_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetMappedFileNameW@16") -#else - __asm__("_GetMappedFileNameW@16") -#endif -#else - __asm__("GetMappedFileNameW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetMappedFileNameA(void *, void *, char *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetMappedFileNameA@16") -#else - __asm__("_GetMappedFileNameA@16") -#endif -#else - __asm__("GetMappedFileNameA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - K32GetMappedFileNameW(void *, void *, char16_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("K32GetMappedFileNameW@16") -#else - __asm__("_K32GetMappedFileNameW@16") -#endif -#else - __asm__("K32GetMappedFileNameW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - K32GetMappedFileNameA(void *, void *, char *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("K32GetMappedFileNameA@16") -#else - __asm__("_K32GetMappedFileNameA@16") -#endif -#else - __asm__("K32GetMappedFileNameA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetExitCodeProcess(void *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetExitCodeProcess@8") -#else - __asm__("_GetExitCodeProcess@8") -#endif -#else - __asm__("GetExitCodeProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - QueryDosDeviceW(char16_t const *, char16_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("QueryDosDeviceW@12") -#else - __asm__("_QueryDosDeviceW@12") -#endif -#else - __asm__("QueryDosDeviceW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - QueryDosDeviceA(char const *, char *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("QueryDosDeviceA@12") -#else - __asm__("_QueryDosDeviceA@12") -#endif -#else - __asm__("QueryDosDeviceA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FindFirstFileW(char16_t const *, win32_find_dataw *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FindFirstFileW@8") -#else - __asm__("_FindFirstFileW@8") -#endif -#else - __asm__("FindFirstFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FindFirstFileA(char const *, win32_find_dataa *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FindFirstFileA@8") -#else - __asm__("_FindFirstFileA@8") -#endif -#else - __asm__("FindFirstFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FindNextFileW(void *, win32_find_dataw *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FindNextFileW@8") -#else - __asm__("_FindNextFileW@8") -#endif -#else - __asm__("FindNextFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FindNextFileA(void *, win32_find_dataa *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FindNextFileA@8") -#else - __asm__("_FindNextFileA@8") -#endif -#else - __asm__("FindNextFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - FindClose(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("FindClose@4") -#else - __asm__("_FindClose@4") -#endif -#else - __asm__("FindClose") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ShellExecuteW(void *, char16_t const *, char16_t const *, char16_t const *, char16_t const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ShellExecuteW@24") -#else - __asm__("_ShellExecuteW@24") -#endif -#else - __asm__("ShellExecuteW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ShellExecuteA(void *, char const *, char const *, char const *, char const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ShellExecuteA@24") -#else - __asm__("_ShellExecuteA@24") -#endif -#else - __asm__("ShellExecuteA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DeleteFileW(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DeleteFileW@4") -#else - __asm__("_DeleteFileW@4") -#endif -#else - __asm__("DeleteFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DeleteFileA(char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DeleteFileA@4") -#else - __asm__("_DeleteFileA@4") -#endif -#else - __asm__("DeleteFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RemoveDirectoryW(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RemoveDirectoryW@4") -#else - __asm__("_RemoveDirectoryW@4") -#endif -#else - __asm__("RemoveDirectoryW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RemoveDirectoryA(char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RemoveDirectoryA@4") -#else - __asm__("_RemoveDirectoryA@4") -#endif -#else - __asm__("RemoveDirectoryA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateDirectoryW(char16_t const *, security_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateDirectoryW@8") -#else - __asm__("_CreateDirectoryW@8") -#endif -#else - __asm__("CreateDirectoryW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateDirectoryA(char const *, security_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateDirectoryA@8") -#else - __asm__("_CreateDirectoryA@8") -#endif -#else - __asm__("CreateDirectoryA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFileAttributesW(char16_t const *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFileAttributesW@8") -#else - __asm__("_SetFileAttributesW@8") -#endif -#else - __asm__("SetFileAttributesW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - SetFileAttributesA(char const *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("SetFileAttributesA@8") -#else - __asm__("_SetFileAttributesA@8") -#endif -#else - __asm__("SetFileAttributesA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFileAttributesW(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFileAttributesW@4") -#else - __asm__("_GetFileAttributesW@4") -#endif -#else - __asm__("GetFileAttributesW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFileAttributesA(char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFileAttributesA@4") -#else - __asm__("_GetFileAttributesA@4") -#endif -#else - __asm__("GetFileAttributesA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CopyFileW(char16_t const *, char16_t const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CopyFileW@12") -#else - __asm__("_CopyFileW@12") -#endif -#else - __asm__("CopyFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CopyFileA(char const *, char const *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CopyFileA@12") -#else - __asm__("_CopyFileA@12") -#endif -#else - __asm__("CopyFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - MoveFileW(char16_t const *, char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("MoveFileW@8") -#else - __asm__("_MoveFileW@8") -#endif -#else - __asm__("MoveFileW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - MoveFileA(char const *, char const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("MoveFileA@8") -#else - __asm__("_MoveFileA@8") -#endif -#else - __asm__("MoveFileA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - TerminateProcess(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("TerminateProcess@8") -#else - __asm__("_TerminateProcess@8") -#endif -#else - __asm__("TerminateProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFinalPathNameByHandleW(void *, char16_t *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFinalPathNameByHandleW@16") -#else - __asm__("_GetFinalPathNameByHandleW@16") -#endif -#else - __asm__("GetFinalPathNameByHandleW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetFinalPathNameByHandleA(void *, char *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetFinalPathNameByHandleA@16") -#else - __asm__("_GetFinalPathNameByHandleA@16") -#endif -#else - __asm__("GetFinalPathNameByHandleA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - GetProcessId(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("GetProcessId@4") -#else - __asm__("_GetProcessId@4") -#endif -#else - __asm__("GetProcessId") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateNamedPipeW(char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, security_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateNamedPipeW@32") -#else - __asm__("_CreateNamedPipeW@32") -#endif -#else - __asm__("CreateNamedPipeW") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CreateNamedPipeA(char const *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, security_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CreateNamedPipeA@32") -#else - __asm__("_CreateNamedPipeA@32") -#endif -#else - __asm__("CreateNamedPipeA") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ConnectNamedPipe(void *, overlapped *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ConnectNamedPipe@8") -#else - __asm__("_ConnectNamedPipe@8") -#endif -#else - __asm__("ConnectNamedPipe") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - DisconnectNamedPipe(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DisconnectNamedPipe@4") -#else - __asm__("_DisconnectNamedPipe@4") -#endif -#else - __asm__("DisconnectNamedPipe") -#endif -#endif - ; +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetLastError() noexcept FAST_IO_WINSTDCALL_RENAME(GetLastError, 0); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL LoadLibraryA(char const *) noexcept FAST_IO_WINSTDCALL_RENAME(LoadLibraryA, 4); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL LoadLibraryW(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(LoadLibraryW, 4); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL LoadLibraryExA(char const *, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(LoadLibraryExA, 12); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL LoadLibraryExW(char16_t const *, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(LoadLibraryExW, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL FormatMessageA(::std::uint_least32_t, char const *, ::std::uint_least32_t, ::std::uint_least32_t, char *, ::std::uint_least32_t, void /*va_list*/ *) noexcept FAST_IO_WINSTDCALL_RENAME(FormatMessageA, 28); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL FormatMessageW(::std::uint_least32_t, char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, char16_t *, ::std::uint_least32_t, void /*va_list*/ *) noexcept FAST_IO_WINSTDCALL_RENAME(FormatMessageW, 28); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateFileMappingA(void *, ::fast_io::win32::security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, char const *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateFileMappingA, 24); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateFileMappingW(void *, ::fast_io::win32::security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateFileMappingW, 24); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL MapViewOfFile(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(MapViewOfFile, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetEndOfFile(void *) noexcept FAST_IO_WINSTDCALL_RENAME(SetEndOfFile, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL UnmapViewOfFile(void const *) noexcept FAST_IO_WINSTDCALL_RENAME(UnmapViewOfFile, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WriteFile(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(WriteFile, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ReadFile(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(ReadFile, 20); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL SetFilePointer(void *, ::std::int_least32_t, ::std::int_least32_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetFilePointer, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetFilePointerEx(void *, ::std::int_least64_t, ::std::int_least64_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetFilePointerEx, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL DuplicateHandle(void *, void *, void *, void **, ::std::uint_least32_t, int, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(DuplicateHandle, 28); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL GetStdHandle(::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetStdHandle, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CreatePipe(void **, void **, ::fast_io::win32::security_attributes *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CreatePipe, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL FreeLibrary(void *) noexcept FAST_IO_WINSTDCALL_RENAME(FreeLibrary, 4); +FAST_IO_DLLIMPORT extern ::fast_io::win32::farproc FAST_IO_WINSTDCALL GetProcAddress(void *, char const *) noexcept FAST_IO_WINSTDCALL_RENAME(GetProcAddress, 8); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL GetModuleHandleA(char const *) noexcept FAST_IO_WINSTDCALL_RENAME(GetModuleHandleA, 4); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL GetModuleHandleW(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(GetModuleHandleW, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL WaitForSingleObject(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(WaitForSingleObject, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL CancelIo(void *) noexcept FAST_IO_WINSTDCALL_RENAME(CancelIo, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetFileInformationByHandle(void *__restrict, ::fast_io::win32::by_handle_file_information *__restrict) noexcept FAST_IO_WINSTDCALL_RENAME(GetFileInformationByHandle, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetUserDefaultLocaleName(char16_t *, int) noexcept FAST_IO_WINSTDCALL_RENAME(GetUserDefaultLocaleName, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetUserDefaultLCID(void) noexcept FAST_IO_WINSTDCALL_RENAME(GetUserDefaultLCID, 0); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL GetSystemTimePreciseAsFileTime(::fast_io::win32::filetime *) noexcept FAST_IO_WINSTDCALL_RENAME(GetSystemTimePreciseAsFileTime, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL GetSystemTimeAsFileTime(::fast_io::win32::filetime *) noexcept FAST_IO_WINSTDCALL_RENAME(GetSystemTimeAsFileTime, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL QueryUnbiasedInterruptTime(::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(QueryUnbiasedInterruptTime, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL QueryPerformanceCounter(::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(QueryPerformanceCounter, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL QueryPerformanceFrequency(::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(QueryPerformanceFrequency, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetProcessTimes(void *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *) noexcept FAST_IO_WINSTDCALL_RENAME(GetProcessTimes, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetThreadTimes(void *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *, ::fast_io::win32::filetime *) noexcept FAST_IO_WINSTDCALL_RENAME(GetThreadTimes, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetHandleInformation(void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(GetHandleInformation, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetHandleInformation(void *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetHandleInformation, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetTempPathA(::std::uint_least32_t, char *buffer) noexcept FAST_IO_WINSTDCALL_RENAME(GetTempPathA, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetTempPathW(::std::uint_least32_t, char16_t *buffer) noexcept FAST_IO_WINSTDCALL_RENAME(GetTempPathW, 8); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateFileA(char const *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, void *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateFileA, 28); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateFileW(char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::security_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, void *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateFileW, 28); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateIoCompletionPort(void *, void *, ::std::size_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CreateIoCompletionPort, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SystemFunction036(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SystemFunction036, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CloseHandle(void *) noexcept FAST_IO_WINSTDCALL_RENAME(CloseHandle, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL LockFileEx(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(LockFileEx, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL UnlockFileEx(void *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(UnlockFileEx, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL DeviceIoControl(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(DeviceIoControl, 32); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetFileType(void *) noexcept FAST_IO_WINSTDCALL_RENAME(GetFileType, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetACP() noexcept FAST_IO_WINSTDCALL_RENAME(GetACP, 0); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetEnvironmentVariableA(char const *, char *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetEnvironmentVariableA, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetEnvironmentVariableW(char16_t const *, char16_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetEnvironmentVariableW, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL MessageBoxA(void *, char const *, char const *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(MessageBoxA, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL MessageBoxW(void *, char16_t const *, char16_t const *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(MessageBoxW, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetConsoleMode(void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(GetConsoleMode, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetConsoleMode(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleMode, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ReadConsoleA(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(ReadConsoleA, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ReadConsoleW(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(ReadConsoleW, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WriteConsoleA(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(WriteConsoleA, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WriteConsoleW(void *, void const *, ::std::uint_least32_t, ::std::uint_least32_t *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(WriteConsoleW, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetConsoleScreenBufferInfo(void *, ::fast_io::win32::console_screen_buffer_info *) noexcept FAST_IO_WINSTDCALL_RENAME(GetConsoleScreenBufferInfo, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ScrollConsoleScreenBufferA(void *, ::fast_io::win32::small_rect const *, ::fast_io::win32::small_rect const *, ::fast_io::win32::coord, ::fast_io::win32::char_info const *) noexcept FAST_IO_WINSTDCALL_RENAME(ScrollConsoleScreenBufferA, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ScrollConsoleScreenBufferW(void *, ::fast_io::win32::small_rect const *, ::fast_io::win32::small_rect const *, ::fast_io::win32::coord, ::fast_io::win32::char_info const *) noexcept FAST_IO_WINSTDCALL_RENAME(ScrollConsoleScreenBufferW, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetConsoleCursorPosition(void *, ::fast_io::win32::coord) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleCursorPosition, 8); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL InitializeCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(InitializeCriticalSection, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL EnterCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(EnterCriticalSection, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL TryEnterCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(TryEnterCriticalSection, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL LeaveCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(LeaveCriticalSection, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL DeleteCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(DeleteCriticalSection, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSADuplicateSocketA(void *, ::std::uint_least32_t, ::fast_io::win32::wsaprotocol_infoa *) noexcept FAST_IO_WINSTDCALL_RENAME(WSADuplicateSocketA, 12); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL WSADuplicateSocketW(void *, ::std::uint_least32_t, ::fast_io::win32::wsaprotocol_infow *) noexcept FAST_IO_WINSTDCALL_RENAME(WSADuplicateSocketW, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSACleanup() noexcept FAST_IO_WINSTDCALL_RENAME(WSACleanup, 0); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSAStartup(::std::uint_least32_t, ::fast_io::win32::wsadata *) noexcept FAST_IO_WINSTDCALL_RENAME(WSAStartup, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSAGetLastError() noexcept FAST_IO_WINSTDCALL_RENAME(WSAGetLastError, 0); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL closesocket(::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(closesocket, 4); +FAST_IO_DLLIMPORT extern ::std::size_t FAST_IO_WINSTDCALL WSASocketW(int, int, int, ::fast_io::win32::wsaprotocol_infow *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(WSASocketW, 24); +FAST_IO_DLLIMPORT extern ::std::size_t FAST_IO_WINSTDCALL WSASocketA(int, int, int, ::fast_io::win32::wsaprotocol_infoa *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(WSASocketA, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL bind(::std::size_t, void const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(bind, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL listen(::std::size_t, int) noexcept FAST_IO_WINSTDCALL_RENAME(listen, 8); +FAST_IO_DLLIMPORT extern ::std::size_t FAST_IO_WINSTDCALL WSAAccept(::std::size_t, void const *, int *, ::fast_io::win32::lpconditionproc, ::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(WSAAccept, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ioctlsocket(::std::size_t, long, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ioctlsocket, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL sendto(::std::size_t, char const *, int, int, void const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(sendto, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSASend(::std::size_t, ::fast_io::win32::wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t, ::fast_io::win32::overlapped *, ::fast_io::win32::lpwsaoverlapped_completion_routine) noexcept FAST_IO_WINSTDCALL_RENAME(WSASend, 28); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSASendMsg(::std::size_t, ::fast_io::win32::wsamsg *, ::std::uint_least32_t, ::std::uint_least32_t *, ::fast_io::win32::overlapped *, ::fast_io::win32::lpwsaoverlapped_completion_routine) noexcept FAST_IO_WINSTDCALL_RENAME(WSASendMsg, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSASendTo(::std::size_t, ::fast_io::win32::wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t, void const *, int, ::fast_io::win32::overlapped *, ::fast_io::win32::lpwsaoverlapped_completion_routine) noexcept FAST_IO_WINSTDCALL_RENAME(WSASendTo, 36); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL recv(::std::size_t, char *buf, int len, int flags) noexcept FAST_IO_WINSTDCALL_RENAME(recv, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL recvfrom(::std::size_t, char *, int, int, void *, int *) noexcept FAST_IO_WINSTDCALL_RENAME(recvfrom, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSARecv(::std::size_t, ::fast_io::win32::wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t *, ::fast_io::win32::overlapped *, ::fast_io::win32::lpwsaoverlapped_completion_routine) noexcept FAST_IO_WINSTDCALL_RENAME(WSARecv, 28); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSARecvFrom(::std::size_t, ::fast_io::win32::wsabuf *, ::std::uint_least32_t, ::std::uint_least32_t *, ::std::uint_least32_t *, void *, int *, ::fast_io::win32::overlapped *, ::fast_io::win32::lpwsaoverlapped_completion_routine) noexcept FAST_IO_WINSTDCALL_RENAME(WSARecvFrom, 36); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL connect(::std::size_t, void const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(connect, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL WSAConnect(::std::size_t, void const *, int, ::fast_io::win32::wsabuf *, ::fast_io::win32::wsabuf *, ::fast_io::win32::qualityofservice *, ::fast_io::win32::qualityofservice *) noexcept FAST_IO_WINSTDCALL_RENAME(WSAConnect, 28); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL shutdown(::std::size_t, void const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(shutdown, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetCurrentProcessId() noexcept FAST_IO_WINSTDCALL_RENAME(GetCurrentProcessId, 0); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL FlushFileBuffers(void *) noexcept FAST_IO_WINSTDCALL_RENAME(FlushFileBuffers, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetQueuedCompletionStatus(void *, ::std::uint_least32_t *, ::std::size_t *, ::fast_io::win32::overlapped *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetQueuedCompletionStatus, 20); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL freeaddrinfo(::fast_io::win32::win32_addrinfo_9xa *) noexcept FAST_IO_WINSTDCALL_RENAME(freeaddrinfo, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL FreeAddrInfoW(::fast_io::win32::win32_addrinfo_ntw *) noexcept FAST_IO_WINSTDCALL_RENAME(FreeAddrInfoW, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL getaddrinfo(char const *, char const *, ::fast_io::win32::win32_addrinfo_9xa const *, ::fast_io::win32::win32_addrinfo_9xa **) noexcept FAST_IO_WINSTDCALL_RENAME(getaddrinfo, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetAddrInfoW(char16_t const *, char16_t const *, ::fast_io::win32::win32_addrinfo_ntw const *, ::fast_io::win32::win32_addrinfo_ntw **) noexcept FAST_IO_WINSTDCALL_RENAME(GetAddrInfoW, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CryptAcquireContextA(::std::size_t *, char8_t const *, char8_t const *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CryptAcquireContextA, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CryptAcquireContextW(::std::size_t *, char16_t const *, char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CryptAcquireContextW, 20); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CryptReleaseContext(::std::size_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CryptReleaseContext, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CryptGenRandom(::std::size_t, ::std::uint_least32_t, char unsigned *) noexcept FAST_IO_WINSTDCALL_RENAME(CryptGenRandom, 12); +FAST_IO_DLLIMPORT extern ::std::int_least32_t FAST_IO_WINSTDCALL RegOpenKeyA(::std::size_t, char8_t const *, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RegOpenKeyA, 12); +FAST_IO_DLLIMPORT extern ::std::int_least32_t FAST_IO_WINSTDCALL RegOpenKeyW(::std::size_t, char16_t const *, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RegOpenKeyW, 12); +FAST_IO_DLLIMPORT extern ::std::int_least32_t FAST_IO_WINSTDCALL RegQueryValueExA(::std::size_t, char8_t const *, ::std::uint_least32_t *, ::std::uint_least32_t *, void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RegQueryValueExA, 24); +FAST_IO_DLLIMPORT extern ::std::int_least32_t FAST_IO_WINSTDCALL RegQueryValueExW(::std::size_t, char16_t const *, ::std::uint_least32_t *, ::std::uint_least32_t *, void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RegQueryValueExW, 24); +FAST_IO_DLLIMPORT extern ::std::int_least32_t FAST_IO_WINSTDCALL RegCloseKey(::std::size_t) noexcept FAST_IO_WINSTDCALL_RENAME(RegCloseKey, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetTimeZoneInformation(::fast_io::win32::time_zone_information *) noexcept FAST_IO_WINSTDCALL_RENAME(GetTimeZoneInformation, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetConsoleCP(::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleCP, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetConsoleOutputCP(::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetConsoleOutputCP, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetConsoleCP() noexcept FAST_IO_WINSTDCALL_RENAME(GetConsoleCP, 0); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetConsoleOutputCP() noexcept FAST_IO_WINSTDCALL_RENAME(GetConsoleOutputCP, 0); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL GetSystemInfo(::fast_io::win32::system_info *) noexcept FAST_IO_WINSTDCALL_RENAME(GetSystemInfo, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetFileInformationByHandle(void *, ::fast_io::win32::file_info_by_handle_class, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetFileInformationByHandle, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetFileTime(void *, ::fast_io::win32::filetime const *, ::fast_io::win32::filetime const *, ::fast_io::win32::filetime const *) noexcept FAST_IO_WINSTDCALL_RENAME(SetFileTime, 16); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL AcquireSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(AcquireSRWLockExclusive, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL TryAcquireSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(TryAcquireSRWLockExclusive, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINSTDCALL ReleaseSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(ReleaseSRWLockExclusive, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CreateProcessW(char16_t const *, char16_t *, ::fast_io::win32::security_attributes *, ::fast_io::win32::security_attributes *, int, ::std::uint_least32_t, void *, char16_t const *, ::fast_io::win32::startupinfow *, ::fast_io::win32::process_information *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateProcessW, 40); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CreateProcessA(char const *, char *, ::fast_io::win32::security_attributes *, ::fast_io::win32::security_attributes *, int, ::std::uint_least32_t, void *, char16_t const *, ::fast_io::win32::startupinfoa *, ::fast_io::win32::process_information *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateProcessA, 40); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetMappedFileNameW(void *, void *, char16_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetMappedFileNameW, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetMappedFileNameA(void *, void *, char *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetMappedFileNameA, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL K32GetMappedFileNameW(void *, void *, char16_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(K32GetMappedFileNameW, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL K32GetMappedFileNameA(void *, void *, char *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(K32GetMappedFileNameA, 16); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL GetExitCodeProcess(void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(GetExitCodeProcess, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL QueryDosDeviceW(char16_t const *, char16_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(QueryDosDeviceW, 12); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL QueryDosDeviceA(char const *, char *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(QueryDosDeviceA, 12); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL FindFirstFileW(char16_t const *, ::fast_io::win32::win32_find_dataw *) noexcept FAST_IO_WINSTDCALL_RENAME(FindFirstFileW, 8); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL FindFirstFileA(char const *, ::fast_io::win32::win32_find_dataa *) noexcept FAST_IO_WINSTDCALL_RENAME(FindFirstFileA, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL FindNextFileW(void *, ::fast_io::win32::win32_find_dataw *) noexcept FAST_IO_WINSTDCALL_RENAME(FindNextFileW, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL FindNextFileA(void *, ::fast_io::win32::win32_find_dataa *) noexcept FAST_IO_WINSTDCALL_RENAME(FindNextFileA, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL FindClose(void *) noexcept FAST_IO_WINSTDCALL_RENAME(FindClose, 4); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL ShellExecuteW(void *, char16_t const *, char16_t const *, char16_t const *, char16_t const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(ShellExecuteW, 24); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL ShellExecuteA(void *, char const *, char const *, char const *, char const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(ShellExecuteA, 24); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL DeleteFileW(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(DeleteFileW, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL DeleteFileA(char const *) noexcept FAST_IO_WINSTDCALL_RENAME(DeleteFileA, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL RemoveDirectoryW(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(RemoveDirectoryW, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL RemoveDirectoryA(char const *) noexcept FAST_IO_WINSTDCALL_RENAME(RemoveDirectoryA, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CreateDirectoryW(char16_t const *, ::fast_io::win32::security_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateDirectoryW, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CreateDirectoryA(char const *, ::fast_io::win32::security_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateDirectoryA, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetFileAttributesW(char16_t const *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetFileAttributesW, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL SetFileAttributesA(char const *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(SetFileAttributesA, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetFileAttributesW(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(GetFileAttributesW, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetFileAttributesA(char const *) noexcept FAST_IO_WINSTDCALL_RENAME(GetFileAttributesA, 4); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CopyFileW(char16_t const *, char16_t const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(CopyFileW, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL CopyFileA(char const *, char const *, int) noexcept FAST_IO_WINSTDCALL_RENAME(CopyFileA, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL MoveFileW(char16_t const *, char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(MoveFileW, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL MoveFileA(char const *, char const *) noexcept FAST_IO_WINSTDCALL_RENAME(MoveFileA, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL TerminateProcess(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(TerminateProcess, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetFinalPathNameByHandleW(void *, char16_t *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetFinalPathNameByHandleW, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetFinalPathNameByHandleA(void *, char *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(GetFinalPathNameByHandleA, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL GetProcessId(void *) noexcept FAST_IO_WINSTDCALL_RENAME(GetProcessId, 4); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateNamedPipeW(char16_t const *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::security_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateNamedPipeW, 32); +FAST_IO_DLLIMPORT extern void *FAST_IO_WINSTDCALL CreateNamedPipeA(char const *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::security_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(CreateNamedPipeA, 32); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ioctlsocket(::std::size_t, long, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ioctlsocket, 12); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL ConnectNamedPipe(void *, ::fast_io::win32::overlapped *) noexcept FAST_IO_WINSTDCALL_RENAME(ConnectNamedPipe, 8); +FAST_IO_DLLIMPORT extern int FAST_IO_WINSTDCALL DisconnectNamedPipe(void *) noexcept FAST_IO_WINSTDCALL_RENAME(DisconnectNamedPipe, 4); } // namespace fast_io::win32 diff --git a/include/fast_io_hosted/platforms/win32/win32_definitions.h b/include/fast_io_hosted/platforms/win32/win32_definitions.h index 39259c080..c71ceda21 100644 --- a/include/fast_io_hosted/platforms/win32/win32_definitions.h +++ b/include/fast_io_hosted/platforms/win32/win32_definitions.h @@ -424,5 +424,6 @@ struct win32_find_dataw #endif }; +using farproc = ::std::ptrdiff_t(FAST_IO_STDCALL *)() noexcept; } // namespace fast_io::win32 From cbd7768148dbe39401720fd4ecc427cf33bb4f67 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 22:22:03 -0500 Subject: [PATCH 30/51] [macros] remove push_macros in core. use dsal instead --- include/fast_io_core_impl/macros/pop_macros.h | 13 -- .../fast_io_core_impl/macros/push_macros.h | 161 ------------------ 2 files changed, 174 deletions(-) delete mode 100644 include/fast_io_core_impl/macros/pop_macros.h delete mode 100644 include/fast_io_core_impl/macros/push_macros.h diff --git a/include/fast_io_core_impl/macros/pop_macros.h b/include/fast_io_core_impl/macros/pop_macros.h deleted file mode 100644 index eeaf88602..000000000 --- a/include/fast_io_core_impl/macros/pop_macros.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma pop_macro("FAST_IO_GNU_RETURNS_NONNULL") -#pragma pop_macro("FAST_IO_GNU_MALLOC") -#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") -#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") -#pragma pop_macro("FAST_IO_GNU_ARTIFICIAL") -#pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE") -#pragma pop_macro("FAST_IO_GNU_CONST") -#pragma pop_macro("FAST_IO_WINCDECL_RENAME") -#pragma pop_macro("FAST_IO_WINCDECL") -#pragma pop_macro("FAST_IO_WINSTDCALL_RENAME") -#pragma pop_macro("FAST_IO_WINSTDCALL") -#pragma pop_macro("FAST_IO_STDCALL") -#pragma pop_macro("FAST_IO_DLLIMPORT") diff --git a/include/fast_io_core_impl/macros/push_macros.h b/include/fast_io_core_impl/macros/push_macros.h deleted file mode 100644 index e93a8fc4a..000000000 --- a/include/fast_io_core_impl/macros/push_macros.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma push_macro("FAST_IO_DLLIMPORT") -#undef FAST_IO_DLLIMPORT -#pragma push_macro("FAST_IO_STDCALL") -#undef FAST_IO_STDCALL -#pragma push_macro("FAST_IO_WINSTDCALL") -#undef FAST_IO_WINSTDCALL -#pragma push_macro("FAST_IO_WINSTDCALL_RENAME") -#undef FAST_IO_WINSTDCALL_RENAME -#pragma push_macro("FAST_IO_WINCDECL") -#undef FAST_IO_WINCDECL -#pragma push_macro("FAST_IO_WINCDECL_RENAME") -#undef FAST_IO_WINCDECL_RENAME -#pragma push_macro("FAST_IO_WINFASTCALL") -#undef FAST_IO_WINFASTCALL -#pragma push_macro("FAST_IO_WINFASTCALL_RENAME") -#undef FAST_IO_WINFASTCALL_RENAME -#pragma push_macro("FAST_IO_GNU_CONST") -#undef FAST_IO_GNU_CONST -#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE") -#undef FAST_IO_GNU_ALWAYS_INLINE -#pragma push_macro("FAST_IO_GNU_ARTIFICIAL") -#undef FAST_IO_GNU_ARTIFICIAL -#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL") -#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL -#pragma push_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") -#undef FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST -#pragma push_macro("FAST_IO_GNU_MALLOC") -#undef FAST_IO_GNU_MALLOC -#pragma push_macro("FAST_IO_GNU_RETURNS_NONNULL") -#undef FAST_IO_GNU_RETURNS_NONNULL - -#if defined(_MSC_VER) && !defined(__clang__) -#define FAST_IO_DLLIMPORT __declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -#define FAST_IO_DLLIMPORT [[__gnu__::__dllimport__]] -#else -#define FAST_IO_DLLIMPORT -#endif - -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -#define FAST_IO_STDCALL __stdcall -#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -#define FAST_IO_STDCALL __attribute__((__stdcall__)) -#else -#define FAST_IO_STDCALL -#endif - -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -#define FAST_IO_WINSTDCALL __stdcall -#elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -#define FAST_IO_WINSTDCALL __attribute__((__stdcall__)) -#else -#define FAST_IO_WINSTDCALL -#endif - -#if defined(__clang__) || defined(__GNUC__) -#if defined(_M_HYBRID) -#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name "@" #count) -#elif defined(__arm64ec__) -#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("#" #name) -#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) -#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name "@" #count) -#else -#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__("_" #name "@" #count) -#endif -#else -#define FAST_IO_WINSTDCALL_RENAME(name, count) __asm__(#name) -#endif -#else -#define FAST_IO_WINSTDCALL_RENAME(name, count) -#endif - -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) -#define FAST_IO_WINCDECL __cdecl -#elif (__has_cpp_attribute(__gnu__::__cdecl__) && !defined(__WINE__)) -#define FAST_IO_WINCDECL __attribute__((__cdecl__)) -#else -#define FAST_IO_WINCDECL -#endif - -#if defined(__clang__) || defined(__GNUC__) -#if defined(_M_HYBRID) -#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name "@" #count) -#elif defined(__arm64ec__) -#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("#" #name) -#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) -#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) -#else -#define FAST_IO_WINCDECL_RENAME(name, count) __asm__("_" #name) -#endif -#else -#define FAST_IO_WINCDECL_RENAME(name, count) __asm__(#name) -#endif -#else -#define FAST_IO_WINCDECL_RENAME(name, count) -#endif - -#if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) -#define FAST_IO_WINFASTCALL __fastcall -#elif (__has_cpp_attribute(__gnu__::__fastcall__) && !defined(__WINE__)) -#define FAST_IO_WINFASTCALL __attribute__((__fastcall__)) -#else -#define FAST_IO_WINFASTCALL -#endif - -#if defined(__clang__) || defined(__GNUC__) -#if defined(_M_HYBRID) -#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name "@" #count) -#elif defined(__arm64ec__) -#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("#" #name) -#elif SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) -#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("@" #name "@" #count) -#else -#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__("_@" #name "@" #count) -#endif -#else -#define FAST_IO_WINFASTCALL_RENAME(name, count) __asm__(#name) -#endif -#else -#define FAST_IO_WINFASTCALL_RENAME(name, count) -#endif - -#if __has_cpp_attribute(__gnu__::__const__) -#define FAST_IO_GNU_CONST [[__gnu__::__const__]] -#else -#define FAST_IO_GNU_CONST -#endif - -#if __has_cpp_attribute(__gnu__::__always_inline__) -#define FAST_IO_GNU_ALWAYS_INLINE [[__gnu__::__always_inline__]] -#elif __has_cpp_attribute(msvc::forceinline) -#define FAST_IO_GNU_ALWAYS_INLINE [[msvc::forceinline]] -#else -#define FAST_IO_GNU_ALWAYS_INLINE -#endif - -#if __has_cpp_attribute(__gnu__::__artificial__) -#define FAST_IO_GNU_ARTIFICIAL [[__gnu__::__artificial__]] -#else -#define FAST_IO_GNU_ARTIFICIAL -#endif - -#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL FAST_IO_GNU_ALWAYS_INLINE FAST_IO_GNU_ARTIFICIAL - -#define FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST \ - FAST_IO_GNU_ALWAYS_INLINE [[nodiscard]] FAST_IO_GNU_ARTIFICIAL FAST_IO_GNU_CONST - -#if __has_cpp_attribute(__gnu__::__malloc__) -#define FAST_IO_GNU_MALLOC [[__gnu__::__malloc__]] -#else -#define FAST_IO_GNU_MALLOC -#endif - -#if __has_cpp_attribute(__gnu__::__returns_nonnull__) -#define FAST_IO_GNU_RETURNS_NONNULL [[__gnu__::__returns_nonnull__]] -#else -#define FAST_IO_GNU_RETURNS_NONNULL -#endif From bfc84831fdbd44a124ec7588eedbb57a7f28fc14 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 22:38:55 -0500 Subject: [PATCH 31/51] [macros] further cleanup dllimport, particularly for cdecl calls --- include/fast_io.h | 2 + include/fast_io_dsal/impl/misc/push_macros.h | 6 ++ include/fast_io_hosted/platforms/posix.h | 20 +------ include/fast_io_legacy.h | 10 +--- include/fast_io_legacy_impl/c/impl.h | 56 ++----------------- .../filebuf/rtti_hack/msvc.h | 18 +----- 6 files changed, 19 insertions(+), 93 deletions(-) diff --git a/include/fast_io.h b/include/fast_io.h index fb4cf2d78..70f12248b 100644 --- a/include/fast_io.h +++ b/include/fast_io.h @@ -10,9 +10,11 @@ #include "fast_io_hosted.h" #include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #include "fast_io_legacy_impl/io.h" +#include "fast_io_dsal/impl/misc/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" #endif diff --git a/include/fast_io_dsal/impl/misc/push_macros.h b/include/fast_io_dsal/impl/misc/push_macros.h index 9986d2881..d54683dbb 100644 --- a/include/fast_io_dsal/impl/misc/push_macros.h +++ b/include/fast_io_dsal/impl/misc/push_macros.h @@ -58,6 +58,12 @@ #define FAST_IO_DLLIMPORT #endif +#if defined(_DLL) && !defined(__WINE__) +#define FAST_IO_DLL_DLLIMPORT FAST_IO_DLLIMPORT +#else +#define FAST_IO_DLL_DLLIMPORT +#endif + #if defined(_MSC_VER) && (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) #define FAST_IO_STDCALL __stdcall #elif (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) diff --git a/include/fast_io_hosted/platforms/posix.h b/include/fast_io_hosted/platforms/posix.h index ec774f535..fa8108e59 100644 --- a/include/fast_io_hosted/platforms/posix.h +++ b/include/fast_io_hosted/platforms/posix.h @@ -405,21 +405,7 @@ Warning! cygwin's _get_osfhandle has the same name as msvcrt or ucrt's name, but functions. Also, it returns long, not ::std::ptrdiff_t */ #if defined(__CYGWIN__) -#if (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -extern long cygwin_get_osfhandle(int fd) noexcept -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("_get_osfhandle") -#else - __asm__("__get_osfhandle") -#endif -#else - __asm__("_get_osfhandle") -#endif - ; -#endif +FAST_IO_DLLIMPORT extern long FAST_IO_WINCDECL cygwin_get_osfhandle(int) noexcept FAST_IO_WINCDECL_RENAME(_get_osfhandle, 4); inline void *my_get_osfile_handle(int fd) noexcept { @@ -1181,13 +1167,13 @@ class basic_posix_family_file : public basic_posix_family_io_observer inline explicit constexpr basic_posix_family_file(io_construct_t, basic_nt_family_io_observer hd, - open_mode m) noexcept + open_mode m) noexcept : basic_posix_family_io_observer{details::open_fd_from_handle(hd.handle, m)} { } template inline explicit constexpr basic_posix_family_file(io_construct_t, basic_win32_family_io_observer hd, - open_mode m) noexcept + open_mode m) noexcept : basic_posix_family_io_observer{details::open_fd_from_handle(hd.handle, m)} { } diff --git a/include/fast_io_legacy.h b/include/fast_io_legacy.h index 1aeb15a44..3211428be 100644 --- a/include/fast_io_legacy.h +++ b/include/fast_io_legacy.h @@ -11,25 +11,21 @@ !defined(_LIBCPP_FREESTANDING)) || \ defined(FAST_IO_ENABLE_HOSTED_FEATURES)) -#include "fast_io_dsal/impl/misc/push_warnings.h" #include #include #include -#if 1 #include "fast_io.h" -#else -#include "fast_io_hosted.h" -#include "fast_io_legacy_impl/c/impl.h" -#endif - +#include "fast_io_dsal/impl/misc/push_warnings.h" +#include "fast_io_dsal/impl/misc/push_macros.h" #include "fast_io_legacy_impl/filebuf/streambuf_io_observer.h" #if !defined(_LIBCPP_HAS_NO_FILESYSTEM) || defined(_LIBCPP_HAS_FSTREAM) #include "fast_io_legacy_impl/filebuf/filebuf_file.h" #endif #include "fast_io_legacy_impl/filebuf/op_out.h" +#include "fast_io_dsal/impl/misc/pop_macros.h" #include "fast_io_dsal/impl/misc/pop_warnings.h" #endif diff --git a/include/fast_io_legacy_impl/c/impl.h b/include/fast_io_legacy_impl/c/impl.h index 9ee6f4cf2..d338f0619 100644 --- a/include/fast_io_legacy_impl/c/impl.h +++ b/include/fast_io_legacy_impl/c/impl.h @@ -194,56 +194,10 @@ namespace details extern int fileno(FILE *) noexcept __asm__("_fileno"); extern FILE *fdopen(int, char const *) noexcept __asm__("_fdopen"); #elif defined(__CYGWIN__) -[[__gnu__::__dllimport__]] extern int fileno(FILE *) noexcept -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("fileno") -#else - __asm__("_fileno") -#endif -#else - __asm__("fileno") -#endif - ; -[[__gnu__::__dllimport__]] extern FILE *fdopen(int, char const *) noexcept -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("fdopen") -#else - __asm__("_fdopen") -#endif -#else - __asm__("fdopen") -#endif - ; - -#endif - -#if defined(__CYGWIN__) - -[[__gnu__::__dllimport__]] extern void my_cygwin_pthread_mutex_lock(void *) noexcept -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("pthread_mutex_lock") -#else - __asm__("_pthread_mutex_lock") -#endif -#else - __asm__("pthread_mutex_lock") -#endif - ; - -[[__gnu__::__dllimport__]] extern void my_cygwin_pthread_mutex_unlock(void *) noexcept -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("pthread_mutex_unlock") -#else - __asm__("_pthread_mutex_unlock") -#endif -#else - __asm__("pthread_mutex_unlock") -#endif - ; +FAST_IO_DLLIMPORT extern int FAST_IO_WINCDECL fileno(FILE *) noexcept FAST_IO_WINCDECL_RENAME(fileno, 4); +FAST_IO_DLLIMPORT extern FILE *FAST_IO_WINCDECL fdopen(int, char const *) noexcept FAST_IO_WINCDECL_RENAME(fdopen, 8); +FAST_IO_DLLIMPORT extern void FAST_IO_WINCDECL my_cygwin_pthread_mutex_lock(void *) noexcept FAST_IO_WINCDECL_RENAME(pthread_mutex_lock, 4); +FAST_IO_DLLIMPORT extern void FAST_IO_WINCDECL my_cygwin_pthread_mutex_unlock(void *) noexcept FAST_IO_WINCDECL_RENAME(pthread_mutex_unlock, 4); inline void my_cygwin_flockfile(FILE *fp) noexcept { @@ -252,7 +206,6 @@ inline void my_cygwin_flockfile(FILE *fp) noexcept my_cygwin_pthread_mutex_lock(fp->_lock); } } - inline void my_cygwin_funlockfile(FILE *fp) noexcept { if (!((fp->_flags) & __SSTR)) @@ -260,7 +213,6 @@ inline void my_cygwin_funlockfile(FILE *fp) noexcept my_cygwin_pthread_mutex_unlock(fp->_lock); } } - #endif #if (defined(_MSC_VER) || defined(_UCRT)) && !defined(__WINE__) && !defined(__CYGWIN__) diff --git a/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h b/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h index 5f0260ad5..07f3d664b 100644 --- a/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h +++ b/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h @@ -11,23 +11,7 @@ namespace fast_io { namespace msvc { -extern -#if defined(_DLL) && !defined(__WINE__) - __declspec(dllimport) -#endif - void *__cdecl msvc__RTtypeid(void *) noexcept -#if (defined(__GNUC__) || defined(__clang__)) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if defined(__GNUC__) - __asm__("__RTtypeid") -#else - __asm__("___RTtypeid") -#endif -#else - __asm__("__RTtypeid") -#endif -#endif - ; +FAST_IO_DLL_DLLIMPORT extern void *FAST_IO_WINCDECL msvc__RTtypeid(void *) noexcept FAST_IO_WINCDECL_RENAME(__RTtypeid, 4); } // namespace msvc From c7f07e1515462da0b46a2031d9079986e02ad5c6 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 22:41:41 -0500 Subject: [PATCH 32/51] [posix.h] Fix cygwin macro guard --- include/fast_io_hosted/platforms/posix.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/fast_io_hosted/platforms/posix.h b/include/fast_io_hosted/platforms/posix.h index fa8108e59..db8a7dfb8 100644 --- a/include/fast_io_hosted/platforms/posix.h +++ b/include/fast_io_hosted/platforms/posix.h @@ -406,6 +406,7 @@ functions. Also, it returns long, not ::std::ptrdiff_t */ #if defined(__CYGWIN__) FAST_IO_DLLIMPORT extern long FAST_IO_WINCDECL cygwin_get_osfhandle(int) noexcept FAST_IO_WINCDECL_RENAME(_get_osfhandle, 4); +#endif inline void *my_get_osfile_handle(int fd) noexcept { From 91092b729252d8cb6dbf4cc203fb845624b4f559 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 23:55:58 -0500 Subject: [PATCH 33/51] [NT] Cleanup API imports too --- include/fast_io_hosted/platforms/nt/impl.h | 3 +- include/fast_io_hosted/platforms/nt/nt_api.h | 138 ++++ include/fast_io_hosted/platforms/nt/nt_zw.h | 677 +++++++++++++++++++ 3 files changed, 817 insertions(+), 1 deletion(-) create mode 100644 include/fast_io_hosted/platforms/nt/nt_api.h create mode 100644 include/fast_io_hosted/platforms/nt/nt_zw.h diff --git a/include/fast_io_hosted/platforms/nt/impl.h b/include/fast_io_hosted/platforms/nt/impl.h index 709329045..1c2dc157d 100644 --- a/include/fast_io_hosted/platforms/nt/impl.h +++ b/include/fast_io_hosted/platforms/nt/impl.h @@ -1,7 +1,8 @@ #pragma once #include "nt_definitions.h" -#include "nt_linker.h" +#include "nt_api.h" +#include "nt_zw.h" #include "rtl_unicode_string_unique_ptr.h" #include "nt_code.h" #include "nt_path.h" \ No newline at end of file diff --git a/include/fast_io_hosted/platforms/nt/nt_api.h b/include/fast_io_hosted/platforms/nt/nt_api.h new file mode 100644 index 000000000..62dcc280b --- /dev/null +++ b/include/fast_io_hosted/platforms/nt/nt_api.h @@ -0,0 +1,138 @@ +#pragma once + +namespace fast_io::win32::nt +{ + +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL rtl_nt_status_to_dos_error(::std::uint_least32_t status) noexcept FAST_IO_WINSTDCALL_RENAME(RtlNtStatusToDosError, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtClose(void *) noexcept FAST_IO_WINSTDCALL_RENAME(NtClose, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwClose(void *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwClose, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateFile(void **, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateFile, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateFile(void **, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateFile, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateSection(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::std::uint_least64_t *, ::std::uint_least32_t, ::std::uint_least32_t, void *__restrict) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateSection, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateSection(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::std::uint_least64_t *, ::std::uint_least32_t, ::std::uint_least32_t, void *__restrict) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateSection, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryInformationProcess(void *__restrict, ::fast_io::win32::nt::process_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryInformationProcess, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryInformationProcess(void *__restrict, ::fast_io::win32::nt::process_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryInformationProcess, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtWriteFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void const *, ::std::uint_least32_t, ::std::int_least64_t *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtWriteFile, 36); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwWriteFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void const *, ::std::uint_least32_t, ::std::int_least64_t *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwWriteFile, 36); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtReadFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void const *, ::std::uint_least32_t, ::std::int_least64_t *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtReadFile, 36); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwReadFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void const *, ::std::uint_least32_t, ::std::int_least64_t *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwReadFile, 36); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryObject(void *, ::fast_io::win32::nt::object_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryObject, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryObject(void *, ::fast_io::win32::nt::object_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryObject, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryDirectoryFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void *, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class, int, ::fast_io::win32::nt::unicode_string *, int) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryDirectoryFile, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryDirectoryFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, void *, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class, int, ::fast_io::win32::nt::unicode_string *, int) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryDirectoryFile, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQuerySection(void *, ::fast_io::win32::nt::section_information_class, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQuerySection, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQuerySection(void *, ::fast_io::win32::nt::section_information_class, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQuerySection, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryInformationFile(void *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryInformationFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryInformationFile(void *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryInformationFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtSetInformationFile(void *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(NtSetInformationFile, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwSetInformationFile(void *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::file_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(ZwSetInformationFile, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtDuplicateObject(void *, void *, void *, void **, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtDuplicateObject, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwDuplicateObject(void *, void *, void *, void **, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwDuplicateObject, 28); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtWaitForSingleObject(void *, int, ::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtWaitForSingleObject, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwWaitForSingleObject(void *, int, ::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwWaitForSingleObject, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtSetSystemTime(::std::uint_least64_t *, ::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtSetSystemTime, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwSetSystemTime(::std::uint_least64_t *, ::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwSetSystemTime, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateProcess(void **, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, void *, ::std::uint_least32_t, void *, void *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateProcess, 32); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateProcess(void **, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, void *, ::std::uint_least32_t, void *, void *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateProcess, 32); +FAST_IO_DLLIMPORT char unsigned FAST_IO_WINSTDCALL rtl_dos_path_name_to_nt_path_name_u(char16_t const *, ::fast_io::win32::nt::unicode_string *, char16_t const **, ::fast_io::win32::nt::rtl_relative_name_u *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDosPathNameToNtPathName_U, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL rtl_dos_path_name_to_nt_path_name_u_with_status(char16_t const *, ::fast_io::win32::nt::unicode_string *, char16_t const **, ::fast_io::win32::nt::rtl_relative_name_u *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDosPathNameToNtPathName_U_WithStatus, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlNtPathNameToDosPathName(::std::uint_least32_t, ::fast_io::win32::nt::rtl_unicode_string_buffer *, ::std::uint_least32_t *, char16_t **) noexcept FAST_IO_WINSTDCALL_RENAME(RtlNtPathNameToDosPathName, 16); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL rtl_free_unicode_string(::fast_io::win32::nt::unicode_string *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlFreeUnicodeString, 4); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlInitializeCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlInitializeCriticalSection, 4); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlEnterCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlEnterCriticalSection, 4); +FAST_IO_DLLIMPORT int FAST_IO_WINSTDCALL RtlTryEnterCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlTryEnterCriticalSection, 4); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlLeaveCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlLeaveCriticalSection, 4); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlDeleteCriticalSection(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDeleteCriticalSection, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlCreateUserThread(void *, void *, int, ::std::uint_least32_t, ::std::size_t, ::std::size_t, void *, void *, void **, ::fast_io::win32::nt::client_id *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlCreateUserThread, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtResumeThread(void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtResumeThread, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwResumeThread(void *, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwResumeThread, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtLockFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, ::std::uint_least32_t, char unsigned, char unsigned) noexcept FAST_IO_WINSTDCALL_RENAME(NtLockFile, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwLockFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine, void *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, ::std::uint_least32_t, char unsigned, char unsigned) noexcept FAST_IO_WINSTDCALL_RENAME(ZwLockFile, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtUnlockFile(void *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtUnlockFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwUnlockFile(void *, ::fast_io::win32::nt::io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwUnlockFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtFlushBuffersFile(void *, ::fast_io::win32::nt::io_status_block *) noexcept FAST_IO_WINSTDCALL_RENAME(NtFlushBuffersFile, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFlushBuffersFile(void *, ::fast_io::win32::nt::io_status_block *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFlushBuffersFile, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtFlushBuffersFileEx(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, ::fast_io::win32::nt::io_status_block *) noexcept FAST_IO_WINSTDCALL_RENAME(NtFlushBuffersFileEx, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFlushBuffersFileEx(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, ::fast_io::win32::nt::io_status_block *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFlushBuffersFileEx, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINCDECL DbgPrint(char const *, ...) noexcept FAST_IO_WINCDECL_RENAME(DbgPrint, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINCDECL DbgPrintEx(::std::uint_least32_t, ::std::uint_least32_t, char const *, ...) noexcept FAST_IO_WINCDECL_RENAME(DbgPrintEx, 12); + +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlCreateProcessParameters(::fast_io::win32::nt::rtl_user_process_parameters **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, void *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlCreateProcessParameters, 40); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlCreateProcessParametersEx(::fast_io::win32::nt::rtl_user_process_parameters **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, void *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(RtlCreateProcessParametersEx, 44); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlDestroyProcessParameters(::fast_io::win32::nt::rtl_user_process_parameters *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDestroyProcessParameters, 4); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateUserProcess(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::object_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::rtl_user_process_parameters *, ::fast_io::win32::nt::ps_create_info *, ::fast_io::win32::nt::ps_attribute_list *) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateUserProcess, 44); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateUserProcess(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::object_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::rtl_user_process_parameters *, ::fast_io::win32::nt::ps_create_info *, ::fast_io::win32::nt::ps_attribute_list *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateUserProcess, 44); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtMapViewOfSection(void *, void *, void **, ::std::size_t, ::std::size_t, ::fast_io::win32::nt::large_integer const *, ::std::size_t *, ::fast_io::win32::nt::section_inherit, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtMapViewOfSection, 40); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwMapViewOfSection(void *, void *, void **, ::std::size_t, ::std::size_t, ::fast_io::win32::nt::large_integer const *, ::std::size_t *, ::fast_io::win32::nt::section_inherit, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwMapViewOfSection, 40); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtUnmapViewOfSection(void *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(NtUnmapViewOfSection, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwUnmapViewOfSection(void *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwUnmapViewOfSection, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtReadVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtReadVirtualMemory, 20); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwReadVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwReadVirtualMemory, 20); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtWriteVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtWriteVirtualMemory, 20); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwWriteVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwWriteVirtualMemory, 20); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlAcquirePebLock() noexcept FAST_IO_WINSTDCALL_RENAME(RtlAcquirePebLock, 0); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlReleasePebLock() noexcept FAST_IO_WINSTDCALL_RENAME(RtlReleasePebLock, 0); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtAllocateVirtualMemory(void *, void **, ::std::size_t, ::std::size_t *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtAllocateVirtualMemory, 24); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAllocateVirtualMemory(void *, void **, ::std::size_t, ::std::size_t *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAllocateVirtualMemory, 24); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtFreeVirtualMemory(void *, void **, ::std::size_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtFreeVirtualMemory, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFreeVirtualMemory(void *, void **, ::std::size_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFreeVirtualMemory, 16); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlInitUnicodeString(::fast_io::win32::nt::unicode_string *, char16_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlInitUnicodeString, 8); +FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL CsrClientCallServer(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CsrClientCallServer, 16); + +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQuerySystemInformation(::fast_io::win32::nt::system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQuerySystemInformation, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQuerySystemInformation(::fast_io::win32::nt::system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQuerySystemInformation, 16); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlAcquireSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlAcquireSRWLockExclusive, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlTryAcquireSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlTryAcquireSRWLockExclusive, 4); +FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlReleaseSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlReleaseSRWLockExclusive, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryVolumeInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::fs_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryVolumeInformationFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryVolumeInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::fs_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryVolumeInformationFile, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtFsControlFile(void *__restrict, void *__restrict, ::fast_io::win32::nt::pio_apc_routine *__restrict, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtFsControlFile, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFsControlFile(void *__restrict, void *__restrict, ::fast_io::win32::nt::pio_apc_routine *__restrict, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFsControlFile, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateNamedPipeFile, 56); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateNamedPipeFile, 56); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryPerformanceCounter, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryPerformanceCounter, 8); +FAST_IO_DLLIMPORT ::std::int_least64_t FAST_IO_WINSTDCALL RtlGetSystemTimePrecise() noexcept FAST_IO_WINSTDCALL_RENAME(RtlGetSystemTimePrecise, 0); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryInformationThread(void *__restrict, ::fast_io::win32::nt::thread_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryInformationThread, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryInformationThread(void *__restrict, ::fast_io::win32::nt::thread_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryInformationThread, 20); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlAdjustPrivilege(::std::uint_least32_t, ::std::uint_least8_t, ::std::uint_least8_t, ::std::uint_least8_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlAdjustPrivilege, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtSetInformationObject(void *__restrict, ::fast_io::win32::nt::object_information_class, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtSetInformationObject, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwSetInformationObject(void *__restrict, ::fast_io::win32::nt::object_information_class, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwSetInformationObject, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryAuxiliaryCounterFrequency(::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryAuxiliaryCounterFrequency, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryAuxiliaryCounterFrequency(::std::uint_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryAuxiliaryCounterFrequency, 4); +FAST_IO_DLLIMPORT ::fast_io::win32::nt::rtl_path_type FAST_IO_WINSTDCALL RtlDetermineDosPathNameType_U(char16_t const *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDetermineDosPathNameType_U, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL RtlGetFullPathName_U(char16_t const *, ::std::uint_least32_t, char16_t *, char16_t **) noexcept FAST_IO_WINSTDCALL_RENAME(RtlGetFullPathName_U, 16); +FAST_IO_DLLIMPORT void *FAST_IO_WINSTDCALL AlpcGetMessageAttribute(::fast_io::win32::nt::alpc_message_attributes *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(AlpcGetMessageAttribute, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL AlpcInitializeMessageAttribute(::std::uint_least32_t, ::fast_io::win32::nt::alpc_message_attributes *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(AlpcInitializeMessageAttribute, 16); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcCreatePort(void **, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcCreatePort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcCreatePort(void **, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcCreatePort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcConnectPort(void **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *, ::std::uint_least32_t, void *, ::fast_io::win32::nt::port_message *, ::std::size_t *, ::fast_io::win32::nt::alpc_message_attributes *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcConnectPort, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcConnectPort(void **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *, ::std::uint_least32_t, void *, ::fast_io::win32::nt::port_message *, ::std::size_t *, ::fast_io::win32::nt::alpc_message_attributes *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcConnectPort, 44); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcSendWaitReceivePort(void *, ::std::uint_least32_t, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_attributes *, ::fast_io::win32::nt::port_message *, ::std::size_t *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcSendWaitReceivePort, 32); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcSendWaitReceivePort(void *, ::std::uint_least32_t, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_attributes *, ::fast_io::win32::nt::port_message *, ::std::size_t *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcSendWaitReceivePort, 32); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcAcceptConnectPort(void **, void *, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *, void *, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::uint_least8_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcAcceptConnectPort, 36); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcAcceptConnectPort(void **, void *, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *, ::fast_io::win32::nt::alpc_port_attributes *, void *, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_attributes *, ::std::uint_least8_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcAcceptConnectPort, 36); +FAST_IO_DLLIMPORT ::std::size_t FAST_IO_WINSTDCALL AlpcGetHeaderSize(::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(AlpcGetHeaderSize, 4); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcImpersonateClientOfPort(void *, ::fast_io::win32::nt::port_message *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcImpersonateClientOfPort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcImpersonateClientOfPort(void *, ::fast_io::win32::nt::port_message *, void *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcImpersonateClientOfPort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcImpersonateClientContainerOfPort(void *, ::fast_io::win32::nt::port_message *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcImpersonateClientContainerOfPort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcImpersonateClientContainerOfPort(void *, ::fast_io::win32::nt::port_message *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcImpersonateClientContainerOfPort, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcDisconnectPort(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcDisconnectPort, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcDisconnectPort(void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcDisconnectPort, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcCreatePortSection(void *, ::std::uint_least32_t, void *, ::std::size_t, void **, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcCreatePortSection, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcCreatePortSection(void *, ::std::uint_least32_t, void *, ::std::size_t, void **, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcCreatePortSection, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcCreateSectionView(void *, ::std::uint_least32_t, ::fast_io::win32::nt::alpc_data_view_attr *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcCreateSectionView, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcCreateSectionView(void *, ::std::uint_least32_t, ::fast_io::win32::nt::alpc_data_view_attr *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcCreateSectionView, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL AlpcMaxAllowedMessageLength() noexcept FAST_IO_WINSTDCALL_RENAME(AlpcMaxAllowedMessageLength, 0); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcQueryInformationMessage(void *, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_information_class, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcQueryInformationMessage, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcQueryInformationMessage(void *, ::fast_io::win32::nt::port_message *, ::fast_io::win32::nt::alpc_message_information_class, void *, ::std::size_t, ::std::size_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcQueryInformationMessage, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcCreateSecurityContext(void *, ::std::uint_least32_t, ::fast_io::win32::nt::alpc_security_attr *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcCreateSecurityContext, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcCreateSecurityContext(void *, ::std::uint_least32_t, ::fast_io::win32::nt::alpc_security_attr *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcCreateSecurityContext, 12); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtAlpcOpenSenderThread(void **, void *, ::fast_io::win32::nt::port_message *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(NtAlpcOpenSenderThread, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwAlpcOpenSenderThread(void **, void *, ::fast_io::win32::nt::port_message *, ::std::uint_least32_t, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwAlpcOpenSenderThread, 24); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtTerminateProcess(void *, ::std::int_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtTerminateProcess, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwTerminateProcess(void *, ::std::int_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwTerminateProcess, 8); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtDeviceIoControlFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine *, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtDeviceIoControlFile, 40); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwDeviceIoControlFile(void *, void *, ::fast_io::win32::nt::pio_apc_routine *, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwDeviceIoControlFile, 40); + +} // namespace fast_io::win32::nt diff --git a/include/fast_io_hosted/platforms/nt/nt_zw.h b/include/fast_io_hosted/platforms/nt/nt_zw.h new file mode 100644 index 000000000..9c593b83f --- /dev/null +++ b/include/fast_io_hosted/platforms/nt/nt_zw.h @@ -0,0 +1,677 @@ +#pragma once + +namespace fast_io::win32::nt +{ + +template +inline ::std::uint_least32_t nt_close(void *handle) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwClose(handle); + } + else + { + return ::fast_io::win32::nt::NtClose(handle); + } +} + +template + requires(sizeof...(Args) == 11) +inline ::std::uint_least32_t nt_create_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwCreateFile(args...); + } + else + { + return ::fast_io::win32::nt::NtCreateFile(args...); + } +} + +template + requires(sizeof...(Args) == 7) +inline ::std::uint_least32_t nt_create_section(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwCreateSection(args...); + } + else + { + return ::fast_io::win32::nt::NtCreateSection(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_information_process(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryInformationProcess(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryInformationProcess(args...); + } +} + +template + requires(sizeof...(Args) == 9) +inline ::std::uint_least32_t nt_write_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwWriteFile(args...); + } + else + { + return ::fast_io::win32::nt::NtWriteFile(args...); + } +} + +template + requires(sizeof...(Args) == 9) +inline ::std::uint_least32_t nt_read_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwReadFile(args...); + } + else + { + return ::fast_io::win32::nt::NtReadFile(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_object(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryObject(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryObject(args...); + } +} + +template + requires(sizeof...(Args) == 11) +inline ::std::uint_least32_t nt_query_directory_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryDirectoryFile(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryDirectoryFile(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_section(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQuerySection(args...); + } + else + { + return ::fast_io::win32::nt::NtQuerySection(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_information_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryInformationFile(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryInformationFile(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_set_information_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwSetInformationFile(args...); + } + else + { + return ::fast_io::win32::nt::NtSetInformationFile(args...); + } +} + +template + requires(sizeof...(Args) == 7) +inline ::std::uint_least32_t nt_duplicate_object(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwDuplicateObject(args...); + } + else + { + return ::fast_io::win32::nt::NtDuplicateObject(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_wait_for_single_object(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwWaitForSingleObject(args...); + } + else + { + return ::fast_io::win32::nt::NtWaitForSingleObject(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_set_system_time(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwSetSystemTime(args...); + } + else + { + return ::fast_io::win32::nt::NtSetSystemTime(args...); + } +} + +template + requires(sizeof...(Args) == 8) +inline ::std::uint_least32_t nt_create_process(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::NtCreateProcess(args...); + } + else + { + return ::fast_io::win32::nt::ZwCreateProcess(args...); + } +} + +template + requires(sizeof...(Args) == 11) +inline ::std::uint_least32_t nt_create_user_process(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwCreateUserProcess(args...); + } + else + { + return ::fast_io::win32::nt::NtCreateUserProcess(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_resume_thread(Args... args) noexcept +{ + if constexpr (zw) + { + return ZwResumeThread(args...); + } + else + { + return NtResumeThread(args...); + } +} + +template + requires(sizeof...(Args) == 10) +inline ::std::uint_least32_t nt_lock_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ZwLockFile(args...); + } + else + { + return NtLockFile(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_unlock_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ZwUnlockFile(args...); + } + else + { + return NtUnlockFile(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_flush_buffers_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ZwFlushBuffersFile(args...); + } + else + { + return NtFlushBuffersFile(args...); + } +} + +template + requires(sizeof...(Args) == 10) +inline ::std::uint_least32_t nt_map_view_of_section(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwMapViewOfSection(args...); + } + else + { + return ::fast_io::win32::nt::NtMapViewOfSection(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_unmap_view_of_section(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwUnmapViewOfSection(args...); + } + else + { + return ::fast_io::win32::nt::NtUnmapViewOfSection(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_read_virtual_memory(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwReadVirtualMemory(args...); + } + else + { + return ::fast_io::win32::nt::NtReadVirtualMemory(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_write_virtual_memory(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwWriteVirtualMemory(args...); + } + else + { + return ::fast_io::win32::nt::NtWriteVirtualMemory(args...); + } +} + +template + requires(sizeof...(Args) == 6) +inline ::std::uint_least32_t nt_allocate_virtual_memory(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAllocateVirtualMemory(args...); + } + else + { + return ::fast_io::win32::nt::NtAllocateVirtualMemory(args...); + } +} + +template + requires(sizeof...(Args) == 4) +inline ::std::uint_least32_t nt_free_virtual_memory(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwFreeVirtualMemory(args...); + } + else + { + return ::fast_io::win32::nt::NtFreeVirtualMemory(args...); + } +} + +template + requires(sizeof...(Args) == 4) +inline ::std::uint_least32_t nt_query_system_information(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQuerySystemInformation(args...); + } + else + { + return ::fast_io::win32::nt::NtQuerySystemInformation(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_volume_information_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryVolumeInformationFile(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryVolumeInformationFile(args...); + } +} + +template + requires(sizeof...(Args) == 10) +inline ::std::uint_least32_t nt_fs_control_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwFsControlFile(args...); + } + else + { + return ::fast_io::win32::nt::NtFsControlFile(args...); + } +} + +template + requires(sizeof...(Args) == 14) +inline ::std::uint_least32_t nt_create_named_pipe_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwCreateNamedPipeFile(args...); + } + else + { + return ::fast_io::win32::nt::NtCreateNamedPipeFile(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_query_performance_counter(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryPerformanceCounter(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryPerformanceCounter(args...); + } +} + +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_query_information_thread(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryInformationThread(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryInformationThread(args...); + } +} + +template + requires(sizeof...(Args) == 4) +inline ::std::uint_least32_t nt_set_information_object(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwSetInformationObject(args...); + } + else + { + return ::fast_io::win32::nt::NtSetInformationObject(args...); + } +} + +template + requires(sizeof...(Args) == 1) +inline ::std::uint_least32_t nt_query_auxiliary_counter_frequency(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwQueryAuxiliaryCounterFrequency(args...); + } + else + { + return ::fast_io::win32::nt::NtQueryAuxiliaryCounterFrequency(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_alpc_create_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcCreatePort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcCreatePort(args...); + } +} + +template + requires(sizeof...(Args) == 11) +inline ::std::uint_least32_t nt_alpc_connect_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcConnectPort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcConnectPort(args...); + } +} + +template + requires(sizeof...(Args) == 8) +inline ::std::uint_least32_t nt_alpc_send_wait_receive_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcSendWaitReceivePort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcSendWaitReceivePort(args...); + } +} + +template + requires(sizeof...(Args) == 9) +inline ::std::uint_least32_t nt_alpc_accept_connect_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcAcceptConnectPort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcAcceptConnectPort(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_alpc_impersonate_client_of_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcImpersonateClientOfPort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcImpersonateClientOfPort(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_alpc_impersonate_client_container_of_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcImpersonateClientContainerOfPort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcImpersonateClientContainerOfPort(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_alpc_disconnect_port(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcDisconnectPort(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcDisconnectPort(args...); + } +} + +template + requires(sizeof...(Args) == 6) +inline ::std::uint_least32_t nt_alpc_create_port_section(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcCreatePortSection(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcCreatePortSection(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_alpc_create_section_view(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcCreateSectionView(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcCreateSectionView(args...); + } +} + +template + requires(sizeof...(Args) == 6) +inline ::std::uint_least32_t nt_alpc_query_information_message(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcQueryInformationMessage(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcQueryInformationMessage(args...); + } +} + +template + requires(sizeof...(Args) == 3) +inline ::std::uint_least32_t nt_alpc_create_security_context(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcCreateSecurityContext(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcCreateSecurityContext(args...); + } +} + +template + requires(sizeof...(Args) == 6) +inline ::std::uint_least32_t nt_alpc_open_sender_thread(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwAlpcOpenSenderThread(args...); + } + else + { + return ::fast_io::win32::nt::NtAlpcOpenSenderThread(args...); + } +} + +template + requires(sizeof...(Args) == 2) +inline ::std::uint_least32_t nt_terminate_process(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwTerminateProcess(args...); + } + else + { + return ::fast_io::win32::nt::NtTerminateProcess(args...); + } +} + +template + requires(sizeof...(Args) == 10) +inline ::std::uint_least32_t nt_device_io_control_file(Args... args) noexcept +{ + if constexpr (zw) + { + return ::fast_io::win32::nt::ZwDeviceIoControlFile(args...); + } + else + { + return ::fast_io::win32::nt::NtDeviceIoControlFile(args...); + } +} + +} // namespace fast_io::win32::nt From 40412a81cf6a8894e6e401dc5b2025113bd9b249 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 23:57:16 -0500 Subject: [PATCH 34/51] [NT] remove nt_linker.h since we have splitted it into two seperate files --- .../fast_io_hosted/platforms/nt/nt_linker.h | 4132 ----------------- 1 file changed, 4132 deletions(-) delete mode 100644 include/fast_io_hosted/platforms/nt/nt_linker.h diff --git a/include/fast_io_hosted/platforms/nt/nt_linker.h b/include/fast_io_hosted/platforms/nt/nt_linker.h deleted file mode 100644 index b1d5db7a4..000000000 --- a/include/fast_io_hosted/platforms/nt/nt_linker.h +++ /dev/null @@ -1,4132 +0,0 @@ -#pragma once - -namespace fast_io::win32::nt -{ - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - rtl_nt_status_to_dos_error(::std::uint_least32_t status) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlNtStatusToDosError@4") -#else - __asm__("_RtlNtStatusToDosError@4") -#endif -#else - __asm__("RtlNtStatusToDosError") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtClose(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtClose@4") -#else - __asm__("_NtClose@4") -#endif -#else - __asm__("NtClose") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwClose(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwClose@4") -#else - __asm__("_ZwClose@4") -#endif -#else - __asm__("ZwClose") -#endif -#endif - ; - -template -inline ::std::uint_least32_t nt_close(void *handle) noexcept -{ - if constexpr (zw) - { - return ZwClose(handle); - } - else - { - return NtClose(handle); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtCreateFile(void **, ::std::uint_least32_t, object_attributes *, io_status_block *, ::std::int_least64_t *, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, void *, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtCreateFile@44") -#else - __asm__("_NtCreateFile@44") -#endif -#else - __asm__("NtCreateFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwCreateFile(void **, ::std::uint_least32_t, object_attributes *, io_status_block *, ::std::int_least64_t *, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, void *, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwCreateFile@44") -#else - __asm__("_ZwCreateFile@44") -#endif -#else - __asm__("ZwCreateFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 11) -inline ::std::uint_least32_t nt_create_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwCreateFile(args...); - } - else - { - return NtCreateFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtCreateSection(void **__restrict, ::std::uint_least32_t, object_attributes *__restrict, ::std::uint_least64_t *, - ::std::uint_least32_t, ::std::uint_least32_t, void *__restrict) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtCreateSection@28") -#else - __asm__("_NtCreateSection@28") -#endif -#else - __asm__("NtCreateSection") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwCreateSection(void **__restrict, ::std::uint_least32_t, object_attributes *__restrict, ::std::uint_least64_t *, - ::std::uint_least32_t, ::std::uint_least32_t, void *__restrict) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwCreateSection@28") -#else - __asm__("_ZwCreateSection@28") -#endif -#else - __asm__("ZwCreateSection") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 7) -inline ::std::uint_least32_t nt_create_section(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwCreateSection(args...); - } - else - { - return NtCreateSection(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryInformationProcess(void *__restrict, process_information_class, void *, ::std::uint_least32_t, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryInformationProcess@20") -#else - __asm__("_NtQueryInformationProcess@20") -#endif -#else - __asm__("NtQueryInformationProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryInformationProcess(void *__restrict, process_information_class, void *, ::std::uint_least32_t, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryInformationProcess@20") -#else - __asm__("_ZwQueryInformationProcess@20") -#endif -#else - __asm__("ZwQueryInformationProcess") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_information_process(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryInformationProcess(args...); - } - else - { - return NtQueryInformationProcess(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtWriteFile(void *, void *, pio_apc_routine, void *, io_status_block *, void const *, ::std::uint_least32_t, - ::std::int_least64_t *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtWriteFile@36") -#else - __asm__("_NtWriteFile@36") -#endif -#else - __asm__("NtWriteFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwWriteFile(void *, void *, pio_apc_routine, void *, io_status_block *, void const *, ::std::uint_least32_t, - ::std::int_least64_t *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwWriteFile@36") -#else - __asm__("_ZwWriteFile@36") -#endif -#else - __asm__("ZwWriteFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 9) -inline ::std::uint_least32_t nt_write_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwWriteFile(args...); - } - else - { - return NtWriteFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtReadFile(void *, void *, pio_apc_routine, void *, io_status_block *, void const *, ::std::uint_least32_t, - ::std::int_least64_t *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtReadFile@36") -#else - __asm__("_NtReadFile@36") -#endif -#else - __asm__("NtReadFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwReadFile(void *, void *, pio_apc_routine, void *, io_status_block *, void const *, ::std::uint_least32_t, - ::std::int_least64_t *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwReadFile@36") -#else - __asm__("_ZwReadFile@36") -#endif -#else - __asm__("ZwReadFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 9) -inline ::std::uint_least32_t nt_read_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwReadFile(args...); - } - else - { - return NtReadFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryObject(void *, object_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryObject@20") -#else - __asm__("_NtQueryObject@20") -#endif -#else - __asm__("NtQueryObject") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryObject(void *, object_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryObject@20") -#else - __asm__("_ZwQueryObject@20") -#endif -#else - __asm__("ZwQueryObject") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_object(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryObject(args...); - } - else - { - return NtQueryObject(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryDirectoryFile(void *, void *, pio_apc_routine, void *, io_status_block *, void *, ::std::uint_least32_t, - file_information_class, int, unicode_string *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryDirectoryFile@44") -#else - __asm__("_NtQueryDirectoryFile@44") -#endif -#else - __asm__("NtQueryDirectoryFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryDirectoryFile(void *, void *, pio_apc_routine, void *, io_status_block *, void *, ::std::uint_least32_t, - file_information_class, int, unicode_string *, int) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryDirectoryFile@44") -#else - __asm__("_ZwQueryDirectoryFile@44") -#endif -#else - __asm__("ZwQueryDirectoryFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 11) -inline ::std::uint_least32_t nt_query_directory_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryDirectoryFile(args...); - } - else - { - return NtQueryDirectoryFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQuerySection(void *, section_information_class, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQuerySection@20") -#else - __asm__("_NtQuerySection@20") -#endif -#else - __asm__("NtQuerySection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQuerySection(void *, section_information_class, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQuerySection@20") -#else - __asm__("_ZwQuerySection@20") -#endif -#else - __asm__("ZwQuerySection") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_section(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQuerySection(args...); - } - else - { - return NtQuerySection(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - file_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryInformationFile@20") -#else - __asm__("_NtQueryInformationFile@20") -#endif -#else - __asm__("NtQueryInformationFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - file_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryInformationFile@20") -#else - __asm__("_ZwQueryInformationFile@20") -#endif -#else - __asm__("ZwQueryInformationFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_information_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryInformationFile(args...); - } - else - { - return NtQueryInformationFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtSetInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - file_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtSetInformationFile@28") -#else - __asm__("_NtSetInformationFile@28") -#endif -#else - __asm__("NtSetInformationFile") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwSetInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - file_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwSetInformationFile@28") -#else - __asm__("_ZwSetInformationFile@28") -#endif -#else - __asm__("ZwSetInformationFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_set_information_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwSetInformationFile(args...); - } - else - { - return NtSetInformationFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtDuplicateObject(void *, void *, void *, void **, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtDuplicateObject@28") -#else - __asm__("_NtDuplicateObject@28") -#endif -#else - __asm__("NtDuplicateObject") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwDuplicateObject(void *, void *, void *, void **, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwDuplicateObject@28") -#else - __asm__("_ZwDuplicateObject@28") -#endif -#else - __asm__("ZwDuplicateObject") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 7) -inline ::std::uint_least32_t nt_duplicate_object(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwDuplicateObject(args...); - } - else - { - return NtDuplicateObject(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtWaitForSingleObject(void *, int, ::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtWaitForSingleObject@12") -#else - __asm__("_NtWaitForSingleObject@12") -#endif -#else - __asm__("NtWaitForSingleObject") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwWaitForSingleObject(void *, int, ::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwWaitForSingleObject@12") -#else - __asm__("_ZwWaitForSingleObject@12") -#endif -#else - __asm__("ZwWaitForSingleObject") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_wait_for_single_object(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwWaitForSingleObject(args...); - } - else - { - return NtWaitForSingleObject(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtSetSystemTime(::std::uint_least64_t *, ::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtSetSystemTime@8") -#else - __asm__("_NtSetSystemTime@8") -#endif -#else - __asm__("NtSetSystemTime") -#endif -#endif - ; -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwSetSystemTime(::std::uint_least64_t *, ::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwSetSystemTime@8") -#else - __asm__("_ZwSetSystemTime@8") -#endif -#else - __asm__("ZwSetSystemTime") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_set_system_time(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwSetSystemTime(args...); - } - else - { - return NtSetSystemTime(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtCreateProcess(void **, ::std::uint_least32_t, object_attributes *, void *, ::std::uint_least32_t, void *, void *, - void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtCreateProcess@32") -#else - __asm__("_NtCreateProcess@32") -#endif -#else - __asm__("NtCreateProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwCreateProcess(void **, ::std::uint_least32_t, object_attributes *, void *, ::std::uint_least32_t, void *, void *, - void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwCreateProcess@32") -#else - __asm__("_ZwCreateProcess@32") -#endif -#else - __asm__("ZwCreateProcess") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 8) -inline ::std::uint_least32_t nt_create_process(Args... args) noexcept -{ - if constexpr (zw) - { - return NtCreateProcess(args...); - } - else - { - return ZwCreateProcess(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern char unsigned -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - rtl_dos_path_name_to_nt_path_name_u(char16_t const *, unicode_string *, char16_t const **, - rtl_relative_name_u *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlDosPathNameToNtPathName_U@16") -#else - __asm__("_RtlDosPathNameToNtPathName_U@16") -#endif -#else - __asm__("RtlDosPathNameToNtPathName_U") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - rtl_dos_path_name_to_nt_path_name_u_with_status(char16_t const *, unicode_string *, char16_t const **, - rtl_relative_name_u *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlDosPathNameToNtPathName_U_WithStatus@16") -#else - __asm__("_RtlDosPathNameToNtPathName_U_WithStatus@16") -#endif -#else - __asm__("RtlDosPathNameToNtPathName_U_WithStatus") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlNtPathNameToDosPathName(::std::uint_least32_t, rtl_unicode_string_buffer *, ::std::uint_least32_t *, char16_t **) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlNtPathNameToDosPathName@16") -#else - __asm__("_RtlNtPathNameToDosPathName@16") -#endif -#else - __asm__("RtlNtPathNameToDosPathName") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - rtl_free_unicode_string(unicode_string *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlFreeUnicodeString@4") -#else - __asm__("_RtlFreeUnicodeString@4") -#endif -#else - __asm__("RtlFreeUnicodeString") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlInitializeCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlInitializeCriticalSection@4") -#else - __asm__("_RtlInitializeCriticalSection@4") -#endif -#else - __asm__("RtlInitializeCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlEnterCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlEnterCriticalSection@4") -#else - __asm__("_RtlEnterCriticalSection@4") -#endif -#else - __asm__("RtlEnterCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern int -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlTryEnterCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlTryEnterCriticalSection@4") -#else - __asm__("_RtlTryEnterCriticalSection@4") -#endif -#else - __asm__("RtlTryEnterCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlLeaveCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlLeaveCriticalSection@4") -#else - __asm__("_RtlLeaveCriticalSection@4") -#endif -#else - __asm__("RtlLeaveCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlDeleteCriticalSection(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlDeleteCriticalSection@4") -#else - __asm__("_RtlDeleteCriticalSection@4") -#endif -#else - __asm__("RtlDeleteCriticalSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlCreateUserThread(void *, void *, int, ::std::uint_least32_t, ::std::size_t, ::std::size_t, void *, void *, - void **, client_id *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlCreateUserThread@40") -#else - __asm__("_RtlCreateUserThread@40") -#endif -#else - __asm__("RtlCreateUserThread") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtResumeThread(void *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtResumeThread@8") -#else - __asm__("_NtResumeThread@8") -#endif -#else - __asm__("NtResumeThread") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwResumeThread(void *, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwResumeThread@8") -#else - __asm__("_ZwResumeThread@8") -#endif -#else - __asm__("ZwResumeThread") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_resume_thread(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwResumeThread(args...); - } - else - { - return NtResumeThread(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtLockFile(void *, void *, pio_apc_routine, void *, io_status_block *, ::std::int_least64_t *, - ::std::int_least64_t *, ::std::uint_least32_t, char unsigned, char unsigned) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtLockFile@40") -#else - __asm__("_NtLockFile@40") -#endif -#else - __asm__("NtLockFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwLockFile(void *, void *, pio_apc_routine, void *, io_status_block *, ::std::int_least64_t *, - ::std::int_least64_t *, ::std::uint_least32_t, char unsigned, char unsigned) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwLockFile@40") -#else - __asm__("_ZwLockFile@40") -#endif -#else - __asm__("ZwLockFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 10) -inline ::std::uint_least32_t nt_lock_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwLockFile(args...); - } - else - { - return NtLockFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtUnlockFile(void *, io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtUnlockFile@20") -#else - __asm__("_NtUnlockFile@20") -#endif -#else - __asm__("NtUnlockFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwUnlockFile(void *, io_status_block *, ::std::int_least64_t *, ::std::int_least64_t *, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwUnlockFile@20") -#else - __asm__("_ZwUnlockFile@20") -#endif -#else - __asm__("ZwUnlockFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_unlock_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwUnlockFile(args...); - } - else - { - return NtUnlockFile(args...); - } -} - -/* -Available starting with Windows Vista??? -https://hfiref0x.github.io/syscalls.html -Actually this shows that it is available since the start of NT -*/ - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtFlushBuffersFile(void *, io_status_block *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtFlushBuffersFile@8") -#else - __asm__("_NtFlushBuffersFile@8") -#endif -#else - __asm__("NtFlushBuffersFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwFlushBuffersFile(void *, io_status_block *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwFlushBuffersFile@8") -#else - __asm__("_ZwFlushBuffersFile@8") -#endif -#else - __asm__("ZwFlushBuffersFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_flush_buffers_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwFlushBuffersFile(args...); - } - else - { - return NtFlushBuffersFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtFlushBuffersFileEx(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, io_status_block *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtFlushBuffersFileEx@20") -#else - __asm__("_NtFlushBuffersFileEx@20") -#endif -#else - __asm__("NtFlushBuffersFileEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwFlushBuffersFileEx(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, io_status_block *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwFlushBuffersFileEx@20") -#else - __asm__("_ZwFlushBuffersFileEx@20") -#endif -#else - __asm__("ZwFlushBuffersFileEx") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_flush_buffers_file_ex(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwFlushBuffersFileEx(args...); - } - else - { - return NtFlushBuffersFileEx(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if __has_cpp_attribute(__gnu__::__cdecl__) -[[__gnu__::__cdecl__]] -#endif -extern ::std::uint_least32_t -#if !__has_cpp_attribute(__gnu__::__cdecl__) && defined(_MSC_VER) - __cdecl -#endif - DbgPrint(char const *, ...) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DbgPrint") -#else - __asm__("_DbgPrint") -#endif -#else - __asm__("DbgPrint") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if __has_cpp_attribute(__gnu__::__cdecl__) -[[__gnu__::__cdecl__]] -#endif -extern ::std::uint_least32_t -#if !__has_cpp_attribute(__gnu__::__cdecl__) && defined(_MSC_VER) - __cdecl -#endif - DbgPrintEx(::std::uint_least32_t, ::std::uint_least32_t, char const *, ...) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("DbgPrintEx") -#else - __asm__("_DbgPrintEx") -#endif -#else - __asm__("DbgPrintEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlCreateProcessParameters(rtl_user_process_parameters **, unicode_string *, unicode_string *, unicode_string *, - unicode_string *, void *, unicode_string *, unicode_string *, unicode_string *, - unicode_string *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlCreateProcessParameters@40") -#else - __asm__("_RtlCreateProcessParameters@40") -#endif -#else - __asm__("RtlCreateProcessParameters") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlCreateProcessParametersEx(rtl_user_process_parameters **, unicode_string *, unicode_string *, unicode_string *, - unicode_string *, void *, unicode_string *, unicode_string *, unicode_string *, - unicode_string *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlCreateProcessParametersEx@44") -#else - __asm__("_RtlCreateProcessParametersEx@44") -#endif -#else - __asm__("RtlCreateProcessParametersEx") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlDestroyProcessParameters(rtl_user_process_parameters *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlDestroyProcessParameters@4") -#else - __asm__("_RtlDestroyProcessParameters@4") -#endif -#else - __asm__("RtlDestroyProcessParameters") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtCreateUserProcess(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t, object_attributes *, - object_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, - rtl_user_process_parameters *, ps_create_info *, ps_attribute_list *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtCreateUserProcess@44") -#else - __asm__("_NtCreateUserProcess@44") -#endif -#else - __asm__("NtCreateUserProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwCreateUserProcess(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t, object_attributes *, - object_attributes *, ::std::uint_least32_t, ::std::uint_least32_t, - rtl_user_process_parameters *, ps_create_info *, ps_attribute_list *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwCreateUserProcess@44") -#else - __asm__("_ZwCreateUserProcess@44") -#endif -#else - __asm__("ZwCreateUserProcess") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 11) -inline ::std::uint_least32_t nt_create_user_process(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwCreateUserProcess(args...); - } - else - { - return NtCreateUserProcess(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlCreateUserProcess(unicode_string *, ::std::uint_least32_t, rtl_user_process_parameters *, security_descriptor *, - security_descriptor *, void *, char unsigned, void *, void *, - rtl_user_process_information *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlCreateUserProcess@40") -#else - __asm__("_RtlCreateUserProcess@40") -#endif -#else - __asm__("RtlCreateUserProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtMapViewOfSection(void *, void *, void **, ::std::size_t, ::std::size_t, large_integer const *, ::std::size_t *, - section_inherit, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtMapViewOfSection@40") -#else - __asm__("_NtMapViewOfSection@40") -#endif -#else - __asm__("NtMapViewOfSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwMapViewOfSection(void *, void *, void **, ::std::size_t, ::std::size_t, large_integer const *, ::std::size_t *, - section_inherit, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwMapViewOfSection@40") -#else - __asm__("_ZwMapViewOfSection@40") -#endif -#else - __asm__("ZwMapViewOfSection") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 10) -inline ::std::uint_least32_t nt_map_view_of_section(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwMapViewOfSection(args...); - } - else - { - return NtMapViewOfSection(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtUnmapViewOfSection(void *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtUnmapViewOfSection@8") -#else - __asm__("_NtUnmapViewOfSection@8") -#endif -#else - __asm__("NtUnmapViewOfSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwUnmapViewOfSection(void *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwUnmapViewOfSection@8") -#else - __asm__("_ZwUnmapViewOfSection@8") -#endif -#else - __asm__("ZwUnmapViewOfSection") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_unmap_view_of_section(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwUnmapViewOfSection(args...); - } - else - { - return NtUnmapViewOfSection(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtReadVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtReadVirtualMemory@20") -#else - __asm__("_NtReadVirtualMemory@20") -#endif -#else - __asm__("NtReadVirtualMemory") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwReadVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwReadVirtualMemory@20") -#else - __asm__("_ZwReadVirtualMemory@20") -#endif -#else - __asm__("ZwReadVirtualMemory") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_read_virtual_memory(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwReadVirtualMemory(args...); - } - else - { - return NtReadVirtualMemory(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtWriteVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtWriteVirtualMemory@20") -#else - __asm__("_NtWriteVirtualMemory@20") -#endif -#else - __asm__("NtWriteVirtualMemory") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwWriteVirtualMemory(void *, void *, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwWriteVirtualMemory@20") -#else - __asm__("_ZwWriteVirtualMemory@20") -#endif -#else - __asm__("ZwWriteVirtualMemory") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_write_virtual_memory(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwWriteVirtualMemory(args...); - } - else - { - return NtWriteVirtualMemory(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlAcquirePebLock() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlAcquirePebLock@0") -#else - __asm__("_RtlAcquirePebLock@0") -#endif -#else - __asm__("RtlAcquirePebLock") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlReleasePebLock() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlReleasePebLock@0") -#else - __asm__("_RtlReleasePebLock@0") -#endif -#else - __asm__("RtlReleasePebLock") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAllocateVirtualMemory(void *, void **, ::std::size_t, ::std::size_t *, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAllocateVirtualMemory@24") -#else - __asm__("_NtAllocateVirtualMemory@24") -#endif -#else - __asm__("NtAllocateVirtualMemory") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAllocateVirtualMemory(void *, void **, ::std::size_t, ::std::size_t *, ::std::uint_least32_t, - ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAllocateVirtualMemory@24") -#else - __asm__("_ZwAllocateVirtualMemory@24") -#endif -#else - __asm__("ZwAllocateVirtualMemory") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 6) -inline ::std::uint_least32_t nt_allocate_virtual_memory(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAllocateVirtualMemory(args...); - } - else - { - return NtAllocateVirtualMemory(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtFreeVirtualMemory(void *, void **, ::std::size_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtFreeVirtualMemory@16") -#else - __asm__("_NtFreeVirtualMemory@16") -#endif -#else - __asm__("NtFreeVirtualMemory") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwFreeVirtualMemory(void *, void **, ::std::size_t *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwFreeVirtualMemory@16") -#else - __asm__("_ZwFreeVirtualMemory@16") -#endif -#else - __asm__("ZwFreeVirtualMemory") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 4) -inline ::std::uint_least32_t nt_free_virtual_memory(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwFreeVirtualMemory(args...); - } - else - { - return NtFreeVirtualMemory(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlInitUnicodeString(unicode_string *, char16_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlInitUnicodeString@8") -#else - __asm__("_RtlInitUnicodeString@8") -#endif -#else - __asm__("RtlInitUnicodeString") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - CsrClientCallServer(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("CsrClientCallServer@16") -#else - __asm__("_CsrClientCallServer@16") -#endif -#else - __asm__("CsrClientCallServer") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQuerySystemInformation(system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQuerySystemInformation@16") -#else - __asm__("_NtQuerySystemInformation@16") -#endif -#else - __asm__("NtQuerySystemInformation") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQuerySystemInformation(system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQuerySystemInformation@16") -#else - __asm__("_ZwQuerySystemInformation@16") -#endif -#else - __asm__("ZwQuerySystemInformation") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 4) -inline ::std::uint_least32_t nt_query_system_information(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQuerySystemInformation(args...); - } - else - { - return NtQuerySystemInformation(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlAcquireSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlAcquireSRWLockExclusive@4") -#else - __asm__("_RtlAcquireSRWLockExclusive@4") -#endif -#else - __asm__("RtlAcquireSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlTryAcquireSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlTryAcquireSRWLockExclusive@4") -#else - __asm__("_RtlTryAcquireSRWLockExclusive@4") -#endif -#else - __asm__("RtlTryAcquireSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlReleaseSRWLockExclusive(void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlReleaseSRWLockExclusive@4") -#else - __asm__("_RtlReleaseSRWLockExclusive@4") -#endif -#else - __asm__("RtlReleaseSRWLockExclusive") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryVolumeInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - fs_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryVolumeInformationFile@20") -#else - __asm__("_NtQueryVolumeInformationFile@20") -#endif -#else - __asm__("NtQueryVolumeInformationFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryVolumeInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, - fs_information_class) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryVolumeInformationFile@20") -#else - __asm__("_ZwQueryVolumeInformationFile@20") -#endif -#else - __asm__("ZwQueryVolumeInformationFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_volume_information_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryVolumeInformationFile(args...); - } - else - { - return NtQueryVolumeInformationFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtFsControlFile(void *__restrict, void *__restrict, pio_apc_routine *__restrict, void *, io_status_block *, - ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtFsControlFile@40") -#else - __asm__("_NtFsControlFile@40") -#endif -#else - __asm__("NtFsControlFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwFsControlFile(void *__restrict, void *__restrict, pio_apc_routine *__restrict, void *, io_status_block *, - ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwFsControlFile@40") -#else - __asm__("_ZwFsControlFile@40") -#endif -#else - __asm__("ZwFsControlFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 10) -inline ::std::uint_least32_t nt_fs_control_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwFsControlFile(args...); - } - else - { - return NtFsControlFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, object_attributes *__restrict, io_status_block *__restrict, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtCreateNamedPipeFile@56") -#else - __asm__("_NtCreateNamedPipeFile@56") -#endif -#else - __asm__("NtCreateNamedPipeFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, object_attributes *__restrict, io_status_block *__restrict, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, - ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwCreateNamedPipeFile@56") -#else - __asm__("_ZwCreateNamedPipeFile@56") -#endif -#else - __asm__("ZwCreateNamedPipeFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 14) -inline ::std::uint_least32_t nt_create_named_pipe_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwCreateNamedPipeFile(args...); - } - else - { - return NtCreateNamedPipeFile(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryPerformanceCounter@8") -#else - __asm__("_NtQueryPerformanceCounter@8") -#endif -#else - __asm__("NtQueryPerformanceCounter") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryPerformanceCounter@8") -#else - __asm__("_ZwQueryPerformanceCounter@8") -#endif -#else - __asm__("ZwQueryPerformanceCounter") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_query_performance_counter(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryPerformanceCounter(args...); - } - else - { - return NtQueryPerformanceCounter(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::int_least64_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlGetSystemTimePrecise() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlGetSystemTimePrecise@0") -#else - __asm__("_RtlGetSystemTimePrecise@0") -#endif -#else - __asm__("RtlGetSystemTimePrecise") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryInformationThread(void *__restrict, thread_information_class, void *, ::std::uint_least32_t, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryInformationThread@20") -#else - __asm__("_NtQueryInformationThread@20") -#endif -#else - __asm__("NtQueryInformationThread") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryInformationThread(void *__restrict, thread_information_class, void *, ::std::uint_least32_t, - ::std::uint_least32_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryInformationThread@20") -#else - __asm__("_ZwQueryInformationThread@20") -#endif -#else - __asm__("ZwQueryInformationThread") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 5) -inline ::std::uint_least32_t nt_query_information_thread(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryInformationThread(args...); - } - else - { - return NtQueryInformationThread(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlAdjustPrivilege(::std::uint_least32_t, ::std::uint_least8_t, ::std::uint_least8_t, ::std::uint_least8_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlAdjustPrivilege@16") -#else - __asm__("_RtlAdjustPrivilege@16") -#endif -#else - __asm__("RtlAdjustPrivilege") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtSetInformationObject(void *__restrict, object_information_class, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtSetInformationObject@16") -#else - __asm__("_NtSetInformationObject@16") -#endif -#else - __asm__("NtSetInformationObject") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwSetInformationObject(void *__restrict, object_information_class, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwSetInformationObject@16") -#else - __asm__("_ZwSetInformationObject@16") -#endif -#else - __asm__("ZwSetInformationObject") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 4) -inline ::std::uint_least32_t nt_set_information_object(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwSetInformationObject(args...); - } - else - { - return NtSetInformationObject(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtQueryAuxiliaryCounterFrequency(::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtQueryAuxiliaryCounterFrequency@4") -#else - __asm__("_NtQueryAuxiliaryCounterFrequency@4") -#endif -#else - __asm__("NtQueryAuxiliaryCounterFrequency") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwQueryAuxiliaryCounterFrequency(::std::uint_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwQueryAuxiliaryCounterFrequency@4") -#else - __asm__("_ZwQueryAuxiliaryCounterFrequency@4") -#endif -#else - __asm__("ZwQueryAuxiliaryCounterFrequency") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 1) -inline ::std::uint_least32_t nt_query_auxiliary_counter_frequency(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwQueryAuxiliaryCounterFrequency(args...); - } - else - { - return NtQueryAuxiliaryCounterFrequency(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern rtl_path_type -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlDetermineDosPathNameType_U(char16_t const *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlDetermineDosPathNameType_U@4") -#else - __asm__("_RtlDetermineDosPathNameType_U@4") -#endif -#else - __asm__("RtlDetermineDosPathNameType_U") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - RtlGetFullPathName_U(char16_t const *, ::std::uint_least32_t, char16_t *, char16_t **) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("RtlGetFullPathName_U@16") -#else - __asm__("_RtlGetFullPathName_U@16") -#endif -#else - __asm__("RtlGetFullPathName_U") -#endif -#endif - ; - - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern void * -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - AlpcGetMessageAttribute(alpc_message_attributes *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("AlpcGetMessageAttribute@8") -#else - __asm__("_AlpcGetMessageAttribute@8") -#endif -#else - __asm__("AlpcGetMessageAttribute") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - AlpcInitializeMessageAttribute(::std::uint_least32_t, alpc_message_attributes *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("AlpcInitializeMessageAttribute@16") -#else - __asm__("_AlpcInitializeMessageAttribute@16") -#endif -#else - __asm__("AlpcInitializeMessageAttribute") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcCreatePort(void **, object_attributes *, alpc_port_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcCreatePort@12") -#else - __asm__("_NtAlpcCreatePort@12") -#endif -#else - __asm__("NtAlpcCreatePort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcCreatePort(void **, object_attributes *, alpc_port_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcCreatePort@12") -#else - __asm__("_ZwAlpcCreatePort@12") -#endif -#else - __asm__("ZwAlpcCreatePort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_alpc_create_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcCreatePort(args...); - } - else - { - return NtAlpcCreatePort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcConnectPort(void **, unicode_string *, object_attributes *, alpc_port_attributes *, - ::std::uint_least32_t, void *, port_message *, ::std::size_t *, - alpc_message_attributes *, alpc_message_attributes *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcConnectPort@44") -#else - __asm__("_NtAlpcConnectPort@44") -#endif -#else - __asm__("NtAlpcConnectPort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcConnectPort(void **, unicode_string *, object_attributes *, alpc_port_attributes *, - ::std::uint_least32_t, void *, port_message *, ::std::size_t *, - alpc_message_attributes *, alpc_message_attributes *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcConnectPort@44") -#else - __asm__("_ZwAlpcConnectPort@44") -#endif -#else - __asm__("ZwAlpcConnectPort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 11) -inline ::std::uint_least32_t nt_alpc_connect_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcConnectPort(args...); - } - else - { - return NtAlpcConnectPort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcSendWaitReceivePort(void *, ::std::uint_least32_t, port_message *, alpc_message_attributes *, - port_message *, ::std::size_t *, alpc_message_attributes *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcSendWaitReceivePort@32") -#else - __asm__("_NtAlpcSendWaitReceivePort@32") -#endif -#else - __asm__("NtAlpcSendWaitReceivePort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcSendWaitReceivePort(void *, ::std::uint_least32_t, port_message *, alpc_message_attributes *, - port_message *, ::std::size_t *, alpc_message_attributes *, ::std::int_least64_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcSendWaitReceivePort@32") -#else - __asm__("_ZwAlpcSendWaitReceivePort@32") -#endif -#else - __asm__("ZwAlpcSendWaitReceivePort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 8) -inline ::std::uint_least32_t nt_alpc_send_wait_receive_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcSendWaitReceivePort(args...); - } - else - { - return NtAlpcSendWaitReceivePort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcAcceptConnectPort(void **, void *, ::std::uint_least32_t, - object_attributes *, alpc_port_attributes *, void *, port_message *, - alpc_message_attributes *, ::std::uint_least8_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcAcceptConnectPort@36") -#else - __asm__("_NtAlpcAcceptConnectPort@36") -#endif -#else - __asm__("NtAlpcAcceptConnectPort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcAcceptConnectPort(void **, void *, ::std::uint_least32_t, - object_attributes *, alpc_port_attributes *, void *, port_message *, - alpc_message_attributes *, ::std::uint_least8_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcAcceptConnectPort@36") -#else - __asm__("_ZwAlpcAcceptConnectPort@36") -#endif -#else - __asm__("ZwAlpcAcceptConnectPort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 9) -inline ::std::uint_least32_t nt_alpc_accept_connect_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcAcceptConnectPort(args...); - } - else - { - return NtAlpcAcceptConnectPort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::size_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - AlpcGetHeaderSize(::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("AlpcGetHeaderSize@4") -#else - __asm__("_AlpcGetHeaderSize@4") -#endif -#else - __asm__("AlpcGetHeaderSize") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcImpersonateClientOfPort(void *, port_message *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcImpersonateClientOfPort@12") -#else - __asm__("_NtAlpcImpersonateClientOfPort@12") -#endif -#else - __asm__("NtAlpcImpersonateClientOfPort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcImpersonateClientOfPort(void *, port_message *, void *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcImpersonateClientOfPort@12") -#else - __asm__("_ZwAlpcImpersonateClientOfPort@12") -#endif -#else - __asm__("ZwAlpcImpersonateClientOfPort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_alpc_impersonate_client_of_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcImpersonateClientOfPort(args...); - } - else - { - return NtAlpcImpersonateClientOfPort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcImpersonateClientContainerOfPort(void *, port_message *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcImpersonateClientContainerOfPort@12") -#else - __asm__("_NtAlpcImpersonateClientContainerOfPort@12") -#endif -#else - __asm__("NtAlpcImpersonateClientContainerOfPort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcImpersonateClientContainerOfPort(void *, port_message *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcImpersonateClientContainerOfPort@12") -#else - __asm__("_ZwAlpcImpersonateClientContainerOfPort@12") -#endif -#else - __asm__("ZwAlpcImpersonateClientContainerOfPort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_alpc_impersonate_client_container_of_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcImpersonateClientContainerOfPort(args...); - } - else - { - return NtAlpcImpersonateClientContainerOfPort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcDisconnectPort(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcDisconnectPort@8") -#else - __asm__("_NtAlpcDisconnectPort@8") -#endif -#else - __asm__("NtAlpcDisconnectPort") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcDisconnectPort(void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcDisconnectPort@8") -#else - __asm__("_ZwAlpcDisconnectPort@8") -#endif -#else - __asm__("ZwAlpcDisconnectPort") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_alpc_disconnect_port(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcDisconnectPort(args...); - } - else - { - return NtAlpcDisconnectPort(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcCreatePortSection(void *, ::std::uint_least32_t, void *, ::std::size_t, void **, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcCreatePortSection@24") -#else - __asm__("_NtAlpcCreatePortSection@24") -#endif -#else - __asm__("NtAlpcCreatePortSection") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcCreatePortSection(void *, ::std::uint_least32_t, void *, ::std::size_t, void **, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcCreatePortSection@24") -#else - __asm__("_ZwAlpcCreatePortSection@24") -#endif -#else - __asm__("ZwAlpcCreatePortSection") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 6) -inline ::std::uint_least32_t nt_alpc_create_port_section(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcCreatePortSection(args...); - } - else - { - return NtAlpcCreatePortSection(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcCreateSectionView(void *, ::std::uint_least32_t, alpc_data_view_attr *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcCreateSectionView@12") -#else - __asm__("_NtAlpcCreateSectionView@12") -#endif -#else - __asm__("NtAlpcCreateSectionView") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcCreateSectionView(void *, ::std::uint_least32_t, alpc_data_view_attr *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcCreateSectionView@12") -#else - __asm__("_ZwAlpcCreateSectionView@12") -#endif -#else - __asm__("ZwAlpcCreateSectionView") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_alpc_create_section_view(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcCreateSectionView(args...); - } - else - { - return NtAlpcCreateSectionView(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - AlpcMaxAllowedMessageLength() noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("AlpcMaxAllowedMessageLength@0") -#else - __asm__("_AlpcMaxAllowedMessageLength@0") -#endif -#else - __asm__("AlpcMaxAllowedMessageLength") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcQueryInformationMessage(void *, port_message *, alpc_message_information_class, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcQueryInformationMessage@24") -#else - __asm__("_NtAlpcQueryInformationMessage@24") -#endif -#else - __asm__("NtAlpcQueryInformationMessage") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcQueryInformationMessage(void *, port_message *, alpc_message_information_class, void *, ::std::size_t, ::std::size_t *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcQueryInformationMessage@24") -#else - __asm__("_ZwAlpcQueryInformationMessage@24") -#endif -#else - __asm__("ZwAlpcQueryInformationMessage") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 6) -inline ::std::uint_least32_t nt_alpc_query_information_message(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcQueryInformationMessage(args...); - } - else - { - return NtAlpcQueryInformationMessage(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcCreateSecurityContext(void *, ::std::uint_least32_t, alpc_security_attr *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcCreateSecurityContext@12") -#else - __asm__("_NtAlpcCreateSecurityContext@12") -#endif -#else - __asm__("NtAlpcCreateSecurityContext") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcCreateSecurityContext(void *, ::std::uint_least32_t, alpc_security_attr *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcCreateSecurityContext@12") -#else - __asm__("_ZwAlpcCreateSecurityContext@12") -#endif -#else - __asm__("ZwAlpcCreateSecurityContext") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 3) -inline ::std::uint_least32_t nt_alpc_create_security_context(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcCreateSecurityContext(args...); - } - else - { - return NtAlpcCreateSecurityContext(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtAlpcOpenSenderThread(void **, void *, port_message *, ::std::uint_least32_t, ::std::uint_least32_t, object_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtAlpcOpenSenderThread@24") -#else - __asm__("_NtAlpcOpenSenderThread@24") -#endif -#else - __asm__("NtAlpcOpenSenderThread") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwAlpcOpenSenderThread(void **, void *, port_message *, ::std::uint_least32_t, ::std::uint_least32_t, object_attributes *) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwAlpcOpenSenderThread@24") -#else - __asm__("_ZwAlpcOpenSenderThread@24") -#endif -#else - __asm__("ZwAlpcOpenSenderThread") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 6) -inline ::std::uint_least32_t nt_alpc_open_sender_thread(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwAlpcOpenSenderThread(args...); - } - else - { - return NtAlpcOpenSenderThread(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtTerminateProcess(void *, ::std::int_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtTerminateProcess@8") -#else - __asm__("_NtTerminateProcess@8") -#endif -#else - __asm__("NtTerminateProcess") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwTerminateProcess(void *, ::std::int_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("ZwTerminateProcess@8") -#else - __asm__("_ZwTerminateProcess@8") -#endif -#else - __asm__("ZwTerminateProcess") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 2) -inline ::std::uint_least32_t nt_terminate_process(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwTerminateProcess(args...); - } - else - { - return NtTerminateProcess(args...); - } -} - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - NtDeviceIoControlFile(void *, void *, pio_apc_routine *, void *, io_status_block *, ::std::uint_least32_t, - void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtDeviceIoControlFile@40") -#else - __asm__("_NtDeviceIoControlFile@40") -#endif -#else - __asm__("NtDeviceIoControlFile") -#endif -#endif - ; - -#if defined(_MSC_VER) && !defined(__clang__) -__declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) -[[__gnu__::__dllimport__]] -#endif -#if (__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) -[[__gnu__::__stdcall__]] -#endif -extern ::std::uint_least32_t -#if (!__has_cpp_attribute(__gnu__::__stdcall__) && !defined(__WINE__)) && defined(_MSC_VER) - __stdcall -#endif - ZwDeviceIoControlFile(void *, void *, pio_apc_routine *, void *, io_status_block *, ::std::uint_least32_t, - void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept -#if defined(__clang__) || defined(__GNUC__) -#if SIZE_MAX <= UINT_LEAST32_MAX && (defined(__x86__) || defined(_M_IX86) || defined(__i386__)) -#if !defined(__clang__) - __asm__("NtDeviceIoControlFile@40") -#else - __asm__("_NtDeviceIoControlFile@40") -#endif -#else - __asm__("NtDeviceIoControlFile") -#endif -#endif - ; - -template - requires(sizeof...(Args) == 10) -inline ::std::uint_least32_t nt_device_io_control_file(Args... args) noexcept -{ - if constexpr (zw) - { - return ZwDeviceIoControlFile(args...); - } - else - { - return NtDeviceIoControlFile(args...); - } -} -} // namespace fast_io::win32::nt From 416f7d8f85d976ffbae86fc0601f40537f97ec8b Mon Sep 17 00:00:00 2001 From: trcrsired Date: Thu, 20 Feb 2025 23:59:45 -0500 Subject: [PATCH 35/51] [nt] nt_api.h remove two empty lines --- include/fast_io_hosted/platforms/nt/nt_api.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/fast_io_hosted/platforms/nt/nt_api.h b/include/fast_io_hosted/platforms/nt/nt_api.h index 62dcc280b..a3b4d78f4 100644 --- a/include/fast_io_hosted/platforms/nt/nt_api.h +++ b/include/fast_io_hosted/platforms/nt/nt_api.h @@ -56,7 +56,6 @@ FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtFlushBuffersFileEx( FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFlushBuffersFileEx(void *, ::std::uint_least32_t, void *, ::std::uint_least32_t, ::fast_io::win32::nt::io_status_block *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFlushBuffersFileEx, 20); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINCDECL DbgPrint(char const *, ...) noexcept FAST_IO_WINCDECL_RENAME(DbgPrint, 4); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINCDECL DbgPrintEx(::std::uint_least32_t, ::std::uint_least32_t, char const *, ...) noexcept FAST_IO_WINCDECL_RENAME(DbgPrintEx, 12); - FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlCreateProcessParameters(::fast_io::win32::nt::rtl_user_process_parameters **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, void *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlCreateProcessParameters, 40); FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlCreateProcessParametersEx(::fast_io::win32::nt::rtl_user_process_parameters **, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, void *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::fast_io::win32::nt::unicode_string *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(RtlCreateProcessParametersEx, 44); FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlDestroyProcessParameters(::fast_io::win32::nt::rtl_user_process_parameters *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlDestroyProcessParameters, 4); @@ -78,7 +77,6 @@ FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL NtFreeVirtualM FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFreeVirtualMemory(void *, void **, ::std::size_t *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFreeVirtualMemory, 16); FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL RtlInitUnicodeString(::fast_io::win32::nt::unicode_string *, char16_t *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlInitUnicodeString, 8); FAST_IO_DLLIMPORT extern ::std::uint_least32_t FAST_IO_WINSTDCALL CsrClientCallServer(void *, void *, ::std::uint_least32_t, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(CsrClientCallServer, 16); - FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQuerySystemInformation(::fast_io::win32::nt::system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQuerySystemInformation, 16); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQuerySystemInformation(::fast_io::win32::nt::system_information_class, void *, ::std::uint_least32_t, ::std::uint_least32_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQuerySystemInformation, 16); FAST_IO_DLLIMPORT void FAST_IO_WINSTDCALL RtlAcquireSRWLockExclusive(void *) noexcept FAST_IO_WINSTDCALL_RENAME(RtlAcquireSRWLockExclusive, 4); From 24956f2937c5171bd0d5adfb9eedfd40fab5ed36 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 00:07:48 -0500 Subject: [PATCH 36/51] [nt] Missing nt_flush_buffers_file_ex --- include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h b/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h index 07f3d664b..ae1044693 100644 --- a/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h +++ b/include/fast_io_legacy_impl/filebuf/rtti_hack/msvc.h @@ -12,7 +12,6 @@ namespace fast_io namespace msvc { FAST_IO_DLL_DLLIMPORT extern void *FAST_IO_WINCDECL msvc__RTtypeid(void *) noexcept FAST_IO_WINCDECL_RENAME(__RTtypeid, 4); - } // namespace msvc namespace rtti_hack From 37e044e3711e565685d96625ee20095a3fc190f2 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 00:13:13 -0500 Subject: [PATCH 37/51] [NT] Fix missing apis --- include/fast_io_hosted/platforms/nt/nt_api.h | 4 ++-- include/fast_io_hosted/platforms/nt/nt_zw.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/fast_io_hosted/platforms/nt/nt_api.h b/include/fast_io_hosted/platforms/nt/nt_api.h index a3b4d78f4..5bbc6837b 100644 --- a/include/fast_io_hosted/platforms/nt/nt_api.h +++ b/include/fast_io_hosted/platforms/nt/nt_api.h @@ -86,8 +86,8 @@ FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryVolumeInformat FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryVolumeInformationFile(void *__restrict, io_status_block *__restrict, void *__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::fs_information_class) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryVolumeInformationFile, 20); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtFsControlFile(void *__restrict, void *__restrict, ::fast_io::win32::nt::pio_apc_routine *__restrict, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(NtFsControlFile, 40); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwFsControlFile(void *__restrict, void *__restrict, ::fast_io::win32::nt::pio_apc_routine *__restrict, void *, ::fast_io::win32::nt::io_status_block *, ::std::uint_least32_t, void *, ::std::uint_least32_t, void *, ::std::uint_least32_t) noexcept FAST_IO_WINSTDCALL_RENAME(ZwFsControlFile, 40); -FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateNamedPipeFile, 56); -FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateNamedPipeFile, 56); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtCreateNamedPipeFile, 56); +FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwCreateNamedPipeFile(void **__restrict, ::std::uint_least32_t, ::fast_io::win32::nt::object_attributes *__restrict, ::fast_io::win32::nt::io_status_block *__restrict, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::uint_least32_t, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwCreateNamedPipeFile, 56); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL NtQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(NtQueryPerformanceCounter, 8); FAST_IO_DLLIMPORT ::std::uint_least32_t FAST_IO_WINSTDCALL ZwQueryPerformanceCounter(::std::int_least64_t *, ::std::int_least64_t *) noexcept FAST_IO_WINSTDCALL_RENAME(ZwQueryPerformanceCounter, 8); FAST_IO_DLLIMPORT ::std::int_least64_t FAST_IO_WINSTDCALL RtlGetSystemTimePrecise() noexcept FAST_IO_WINSTDCALL_RENAME(RtlGetSystemTimePrecise, 0); diff --git a/include/fast_io_hosted/platforms/nt/nt_zw.h b/include/fast_io_hosted/platforms/nt/nt_zw.h index 9c593b83f..92ab4aa18 100644 --- a/include/fast_io_hosted/platforms/nt/nt_zw.h +++ b/include/fast_io_hosted/platforms/nt/nt_zw.h @@ -282,6 +282,20 @@ inline ::std::uint_least32_t nt_flush_buffers_file(Args... args) noexcept } } +template + requires(sizeof...(Args) == 5) +inline ::std::uint_least32_t nt_flush_buffers_file_ex(Args... args) noexcept +{ + if constexpr (zw) + { + return ZwFlushBuffersFileEx(args...); + } + else + { + return NtFlushBuffersFileEx(args...); + } +} + template requires(sizeof...(Args) == 10) inline ::std::uint_least32_t nt_map_view_of_section(Args... args) noexcept From c6d6da430201c7f9c8782eb269ecf8be688e6951 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 01:49:38 -0500 Subject: [PATCH 38/51] [msvc] fix linker symbols on x86_64 --- include/fast_io_core_impl/allocation/msvc/msvc_linker_64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fast_io_core_impl/allocation/msvc/msvc_linker_64.h b/include/fast_io_core_impl/allocation/msvc/msvc_linker_64.h index cc28ff169..a116c5bdf 100644 --- a/include/fast_io_core_impl/allocation/msvc/msvc_linker_64.h +++ b/include/fast_io_core_impl/allocation/msvc/msvc_linker_64.h @@ -14,7 +14,7 @@ #pragma comment(linker, "/alternatename:__imp_?VirtualAlloc@win32@fast_io@@YAPEAXPEAX_KII@Z=__imp_VirtualAlloc") #pragma comment(linker, "/alternatename:__imp_?VirtualProtect@win32@fast_io@@YAHPEAX_KIPEAI@Z=__imp_VirtualProtect") #pragma comment(linker, "/alternatename:__imp_?VirtualFree@win32@fast_io@@YAHPEAX_KI@Z=__imp_VirtualFree") -#pragma comment(linker, "/alternatename:__imp_?__imp_?VirtualQuery@win32@fast_io@@YAHPEBXPEAUmemory_basic_information@12@_K@Z=__imp_VirtualQuery") +#pragma comment(linker, "/alternatename:__imp_?VirtualQuery@win32@fast_io@@YAHPEBXPEAUmemory_basic_information@12@_K@Z=__imp_VirtualQuery") #pragma comment(linker, "/alternatename:__imp_?mi_malloc@mimalloc@fast_io@@YAPEAX_K@Z=mi_malloc") #pragma comment(linker, "/alternatename:__imp_?mi_free@mimalloc@fast_io@@YAXPEAX@Z=mi_free") From 8773a8201ddc171a46c8ec5664d060123e2865a7 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 02:44:19 -0500 Subject: [PATCH 39/51] [arm64ec] Experimental support for arm64ec --- .../fast_io_core_impl/allocation/msvc/impl.h | 3 + .../allocation/msvc/msvc_linker_arm64ec.h | 28 ++ .../platforms/win32/msvc_linker.h | 3 + .../platforms/win32/msvc_linker_arm64ec.h | 294 ++++++++++++++++++ 4 files changed, 328 insertions(+) create mode 100644 include/fast_io_core_impl/allocation/msvc/msvc_linker_arm64ec.h create mode 100644 include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h diff --git a/include/fast_io_core_impl/allocation/msvc/impl.h b/include/fast_io_core_impl/allocation/msvc/impl.h index d5dd3317c..df20714f0 100644 --- a/include/fast_io_core_impl/allocation/msvc/impl.h +++ b/include/fast_io_core_impl/allocation/msvc/impl.h @@ -2,6 +2,9 @@ #if SIZE_MAX > UINT_LEAST32_MAX #include "msvc_linker_64.h" +#if defined(__arm64ec__) || defined(_M_ARM64EC) +#include "msvc_linker_arm64ec.h" +#endif #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) #include "msvc_linker_32_i686.h" #else diff --git a/include/fast_io_core_impl/allocation/msvc/msvc_linker_arm64ec.h b/include/fast_io_core_impl/allocation/msvc/msvc_linker_arm64ec.h new file mode 100644 index 000000000..15209da0b --- /dev/null +++ b/include/fast_io_core_impl/allocation/msvc/msvc_linker_arm64ec.h @@ -0,0 +1,28 @@ +#pragma once +// clang-format off + +#pragma comment(linker, "/alternatename:?HeapAlloc@win32@fast_io@@$$hYAPEAXPEAXI_K@Z=#HeapAlloc") +#pragma comment(linker, "/alternatename:?HeapFree@win32@fast_io@@$$hYAHPEAXI0@Z=#HeapFree") +#pragma comment(linker, "/alternatename:?GetProcessHeap@win32@fast_io@@$$hYAPEAXXZ=#GetProcessHeap") +#pragma comment(linker, "/alternatename:?HeapReAlloc@win32@fast_io@@$$hYAPEAXPEAXI0_K@Z=#HeapReAlloc") +#pragma comment(linker, "/alternatename:?HeapSize@win32@fast_io@@$$hYA_KPEAXIPEBX@Z=#HeapSize") +#pragma comment(linker, "/alternatename:?RtlAllocateHeap@nt@win32@fast_io@@$$hYAPEAXPEAXI_K@Z=#RtlAllocateHeap") +#pragma comment(linker, "/alternatename:?RtlFreeHeap@nt@win32@fast_io@@$$hYAEPEAXI0@Z=#RtlFreeHeap") +#pragma comment(linker, "/alternatename:?RtlGetCurrentPeb@nt@win32@fast_io@@$$hYAPEAUpeb@123@XZ=#RtlGetCurrentPeb") +#pragma comment(linker, "/alternatename:?RtlReAllocateHeap@nt@win32@fast_io@@$$hYAPEAXPEAXI0_K@Z=#RtlReAllocateHeap") +#pragma comment(linker, "/alternatename:?RtlSizeHeap@nt@win32@fast_io@@$$hYA_KPEAXI0@Z=#RtlSizeHeap") +#pragma comment(linker, "/alternatename:?VirtualAlloc@win32@fast_io@@$$hYAPEAXPEAX_KII@Z=#VirtualAlloc") +#pragma comment(linker, "/alternatename:?VirtualProtect@win32@fast_io@@$$hYAHPEAX_KIPEAI@Z=#VirtualProtect") +#pragma comment(linker, "/alternatename:?VirtualFree@win32@fast_io@@$$hYAHPEAX_KI@Z=#VirtualFree") +#pragma comment(linker, "/alternatename:?VirtualQuery@win32@fast_io@@$$hYAHPEBXPEAUmemory_basic_information@12@_K@Z=#VirtualQuery") + +#pragma comment(linker, "/alternatename:?mi_malloc@mimalloc@fast_io@@$$hYAPEAX_K@Z=mi_malloc") +#pragma comment(linker, "/alternatename:?mi_free@mimalloc@fast_io@@$$hYAXPEAX@Z=mi_free") +#pragma comment(linker, "/alternatename:?mi_calloc@mimalloc@fast_io@@$$hYAPEAX_K0@Z=mi_calloc") +#pragma comment(linker, "/alternatename:?mi_realloc@mimalloc@fast_io@@$$hYAPEAXPEAX_K@Z=mi_realloc") +#pragma comment(linker, "/alternatename:?mi_malloc_aligned@mimalloc@fast_io@@$$hYAPEAX_K0@Z=mi_malloc_aligned") +#pragma comment(linker, "/alternatename:?mi_ralloc_aligned@mimalloc@fast_io@@$$hYAPEAXPEAX_K1@Z=mi_ralloc_aligned") +#pragma comment(linker, "/alternatename:?mi_calloc_aligned@mimalloc@fast_io@@$$hYAPEAX_K00@Z=mi_calloc_aligned") +#pragma comment(linker, "/alternatename:?mi_free_aligned@mimalloc@fast_io@@$$hYAPEAXPEAX_K@Z=mi_free_aligned") + +// clang-format on diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker.h b/include/fast_io_hosted/platforms/win32/msvc_linker.h index d5dd3317c..df20714f0 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker.h @@ -2,6 +2,9 @@ #if SIZE_MAX > UINT_LEAST32_MAX #include "msvc_linker_64.h" +#if defined(__arm64ec__) || defined(_M_ARM64EC) +#include "msvc_linker_arm64ec.h" +#endif #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) #include "msvc_linker_32_i686.h" #else diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h new file mode 100644 index 000000000..0f9699e26 --- /dev/null +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h @@ -0,0 +1,294 @@ +#pragma once + +// clang-format off +// WIN32 +#pragma comment(linker,"/alternatename:?GetLastError@win32@fast_io@@$$hYAIXZ=#GetLastError") +#pragma comment(linker,"/alternatename:?LoadLibraryA@win32@fast_io@@$$hYAPEAXPEBD@Z=#LoadLibraryA") +#pragma comment(linker,"/alternatename:?LoadLibraryW@win32@fast_io@@$$hYAPEAXPEB_S@Z=#LoadLibraryW") +#pragma comment(linker,"/alternatename:?LoadLibraryExA@win32@fast_io@@$$hYAPEAXPEBDPEAXI@Z=#LoadLibraryExA") +#pragma comment(linker,"/alternatename:?LoadLibraryExW@win32@fast_io@@$$hYAPEAXPEB_SPEAXI@Z=#LoadLibraryExW") +#pragma comment(linker,"/alternatename:?FormatMessageA@win32@fast_io@@$$hYAIIPEBDIIPEADIPEAX@Z=#FormatMessageA") +#pragma comment(linker,"/alternatename:?FormatMessageW@win32@fast_io@@$$hYAIIPEB_SIIPEA_SIPEAX@Z=#FormatMessageW") +#pragma comment(linker,"/alternatename:?CreateFileMappingA@win32@fast_io@@$$hYAPEAXPEAXPEAUsecurity_attributes@12@IIIPEBD@Z=#CreateFileMappingA") +#pragma comment(linker,"/alternatename:?CreateFileMappingW@win32@fast_io@@$$hYAPEAXPEAXPEAUsecurity_attributes@12@IIIPEB_S@Z=#CreateFileMappingW") +#pragma comment(linker,"/alternatename:?MapViewOfFile@win32@fast_io@@$$hYAPEAXPEAXIII_K@Z=#MapViewOfFile") +#pragma comment(linker,"/alternatename:?SetEndOfFile@win32@fast_io@@$$hYAHPEAX@Z=#SetEndOfFile") +#pragma comment(linker,"/alternatename:?UnmapViewOfFile@win32@fast_io@@$$hYAHPEBX@Z=#UnmapViewOfFile") +#pragma comment(linker,"/alternatename:?WriteFile@win32@fast_io@@$$hYAHPEAXPEBXIPEAIPEAUoverlapped@12@@Z=#WriteFile") +#pragma comment(linker,"/alternatename:?ReadFile@win32@fast_io@@$$hYAHPEAXPEBXIPEAIPEAUoverlapped@12@@Z=#ReadFile") +#pragma comment(linker,"/alternatename:?SetFilePointer@win32@fast_io@@$$hYAIPEAXHPEAHI@Z=#SetFilePointer") +#pragma comment(linker,"/alternatename:?SetFilePointerEx@win32@fast_io@@$$hYAHPEAX_JPEA_JI@Z=#SetFilePointerEx") +#pragma comment(linker,"/alternatename:?DuplicateHandle@win32@fast_io@@$$hYAHPEAX00PEAPEAXIHI@Z=#DuplicateHandle") +#pragma comment(linker,"/alternatename:?GetStdHandle@win32@fast_io@@$$hYAPEAXI@Z=#GetStdHandle") +#pragma comment(linker,"/alternatename:?CreatePipe@win32@fast_io@@$$hYAHPEAPEAX0PEAUsecurity_attributes@12@I@Z=#CreatePipe") +#pragma comment(linker,"/alternatename:?FreeLibrary@win32@fast_io@@$$hYAHPEAX@Z=#FreeLibrary") +#pragma comment(linker,"/alternatename:?GetProcAddress@win32@fast_io@@$$hYAP6A_JX_EPEAXPEBD@Z=#GetProcAddress") +#pragma comment(linker,"/alternatename:?GetModuleHandleA@win32@fast_io@@$$hYAPEAXPEBD@Z=#GetModuleHandleA") +#pragma comment(linker,"/alternatename:?GetModuleHandleW@win32@fast_io@@$$hYAPEAXPEB_S@Z=#GetModuleHandleW") +#pragma comment(linker,"/alternatename:?WaitForSingleObject@win32@fast_io@@$$hYAIPEAXI@Z=#WaitForSingleObject") +#pragma comment(linker,"/alternatename:?CancelIo@win32@fast_io@@$$hYAIPEAX@Z=#CancelIo") +#pragma comment(linker,"/alternatename:?GetFileInformationByHandle@win32@fast_io@@$$hYAHPEIAXPEIAUby_handle_file_information@12@@Z=#GetFileInformationByHandle") +#pragma comment(linker,"/alternatename:?GetUserDefaultLocaleName@win32@fast_io@@$$hYAHPEA_SH@Z=#GetUserDefaultLocaleName") +#pragma comment(linker,"/alternatename:?GetUserDefaultLCID@win32@fast_io@@$$hYAIXZ=#GetUserDefaultLCID") +#pragma comment(linker,"/alternatename:?GetSystemTimePreciseAsFileTime@win32@fast_io@@$$hYAXPEAUfiletime@12@@Z=#GetSystemTimePreciseAsFileTime") +#pragma comment(linker,"/alternatename:?GetSystemTimeAsFileTime@win32@fast_io@@$$hYAXPEAUfiletime@12@@Z=#GetSystemTimeAsFileTime") +#pragma comment(linker,"/alternatename:?QueryUnbiasedInterruptTime@win32@fast_io@@$$hYAHPEA_K@Z=#QueryUnbiasedInterruptTime") +#pragma comment(linker,"/alternatename:?QueryPerformanceCounter@win32@fast_io@@$$hYAHPEA_J@Z=#QueryPerformanceCounter") +#pragma comment(linker,"/alternatename:?QueryPerformanceFrequency@win32@fast_io@@$$hYAHPEA_J@Z=#QueryPerformanceFrequency") +#pragma comment(linker,"/alternatename:?GetProcessTimes@win32@fast_io@@$$hYAHPEAXPEAUfiletime@12@111@Z=#GetProcessTimes") +#pragma comment(linker,"/alternatename:?GetThreadTimes@win32@fast_io@@$$hYAHPEAXPEAUfiletime@12@111@Z=#GetThreadTimes") +#pragma comment(linker,"/alternatename:?GetHandleInformation@win32@fast_io@@$$hYAHPEAXPEAI@Z=#GetHandleInformation") +#pragma comment(linker,"/alternatename:?SetHandleInformation@win32@fast_io@@$$hYAHPEAXII@Z=#SetHandleInformation") +#pragma comment(linker,"/alternatename:?GetTempPathA@win32@fast_io@@$$hYAIIPEAD@Z=#GetTempPathA") +#pragma comment(linker,"/alternatename:?GetTempPathW@win32@fast_io@@$$hYAIIPEA_S@Z=#GetTempPathW") +#pragma comment(linker,"/alternatename:?CreateFileA@win32@fast_io@@$$hYAPEAXPEBDIIPEAUsecurity_attributes@12@IIPEAX@Z=#CreateFileA") +#pragma comment(linker,"/alternatename:?CreateFileW@win32@fast_io@@$$hYAPEAXPEB_SIIPEAUsecurity_attributes@12@IIPEAX@Z=#CreateFileW") +#pragma comment(linker,"/alternatename:?CreateIoCompletionPort@win32@fast_io@@$$hYAPEAXPEAX0_KI@Z=#CreateIoCompletionPort") +#pragma comment(linker,"/alternatename:?SystemFunction036@win32@fast_io@@$$hYAHPEAXI@Z=#SystemFunction036") +#pragma comment(linker,"/alternatename:?CloseHandle@win32@fast_io@@$$hYAHPEAX@Z=#CloseHandle") +#pragma comment(linker,"/alternatename:?LockFileEx@win32@fast_io@@$$hYAHPEAXIIIIPEAUoverlapped@12@@Z=#LockFileEx") +#pragma comment(linker,"/alternatename:?UnlockFileEx@win32@fast_io@@$$hYAHPEAXIIIPEAUoverlapped@12@@Z=#UnlockFileEx") +#pragma comment(linker,"/alternatename:?DeviceIoControl@win32@fast_io@@$$hYAHPEAXI0I0I0PEAUoverlapped@12@@Z=#DeviceIoControl") +#pragma comment(linker,"/alternatename:?GetFileType@win32@fast_io@@$$hYAIPEAX@Z=#GetFileType") +#pragma comment(linker,"/alternatename:?GetACP@win32@fast_io@@$$hYAIXZ=#GetACP") +#pragma comment(linker,"/alternatename:?GetEnvironmentVariableA@win32@fast_io@@$$hYAIPEBDPEADI@Z=#GetEnvironmentVariableA") +#pragma comment(linker,"/alternatename:?GetEnvironmentVariableW@win32@fast_io@@$$hYAIPEB_SPEA_SI@Z=#GetEnvironmentVariableW") +#pragma comment(linker,"/alternatename:?MessageBoxA@win32@fast_io@@$$hYAIPEAXPEBD1I@Z=#MessageBoxA") +#pragma comment(linker,"/alternatename:?MessageBoxW@win32@fast_io@@$$hYAIPEAXPEB_S1I@Z=#MessageBoxW") +#pragma comment(linker,"/alternatename:?GetConsoleMode@win32@fast_io@@$$hYAHPEAXPEAI@Z=#GetConsoleMode") +#pragma comment(linker,"/alternatename:?SetConsoleMode@win32@fast_io@@$$hYAHPEAXI@Z=#SetConsoleMode") +#pragma comment(linker,"/alternatename:?ReadConsoleA@win32@fast_io@@$$hYAHPEAX0IPEAI0@Z=#ReadConsoleA") +#pragma comment(linker,"/alternatename:?ReadConsoleW@win32@fast_io@@$$hYAHPEAX0IPEAI0@Z=#ReadConsoleW") +#pragma comment(linker,"/alternatename:?WriteConsoleA@win32@fast_io@@$$hYAHPEAXPEBXIPEAI0@Z=#WriteConsoleA") +#pragma comment(linker,"/alternatename:?WriteConsoleW@win32@fast_io@@$$hYAHPEAXPEBXIPEAI0@Z=#WriteConsoleW") +#pragma comment(linker,"/alternatename:?GetConsoleScreenBufferInfo@win32@fast_io@@$$hYAHPEAXPEAUconsole_screen_buffer_info@12@@Z=#GetConsoleScreenBufferInfo") +#pragma comment(linker,"/alternatename:?ScrollConsoleScreenBufferA@win32@fast_io@@$$hYAHPEAXPEBUsmall_rect@12@1Ucoord@12@PEBUchar_info@12@@Z=#ScrollConsoleScreenBufferA") +#pragma comment(linker,"/alternatename:?ScrollConsoleScreenBufferW@win32@fast_io@@$$hYAHPEAXPEBUsmall_rect@12@1Ucoord@12@PEBUchar_info@12@@Z=#ScrollConsoleScreenBufferW") +#pragma comment(linker,"/alternatename:?SetConsoleCursorPosition@win32@fast_io@@$$hYAHPEAXUcoord@12@@Z=#SetConsoleCursorPosition") +#pragma comment(linker,"/alternatename:?InitializeCriticalSection@win32@fast_io@@$$hYAXPEAX@Z=#InitializeCriticalSection") +#pragma comment(linker,"/alternatename:?EnterCriticalSection@win32@fast_io@@$$hYAXPEAX@Z=#EnterCriticalSection") +#pragma comment(linker,"/alternatename:?TryEnterCriticalSection@win32@fast_io@@$$hYAHPEAX@Z=#TryEnterCriticalSection") +#pragma comment(linker,"/alternatename:?LeaveCriticalSection@win32@fast_io@@$$hYAXPEAX@Z=#LeaveCriticalSection") +#pragma comment(linker,"/alternatename:?DeleteCriticalSection@win32@fast_io@@$$hYAXPEAX@Z=#DeleteCriticalSection") +#pragma comment(linker,"/alternatename:?WSADuplicateSocketA@win32@fast_io@@$$hYAHPEAXIPEAUwsaprotocol_infoa@12@@Z=#WSADuplicateSocketA") +#pragma comment(linker,"/alternatename:?WSADuplicateSocketW@win32@fast_io@@$$hYAXPEAXIPEAUwsaprotocol_infow@12@@Z=#WSADuplicateSocketW") +#pragma comment(linker,"/alternatename:?WSACleanup@win32@fast_io@@$$hYAHXZ=#WSACleanup") +#pragma comment(linker,"/alternatename:?WSAStartup@win32@fast_io@@$$hYAHIPEAUwsadata@12@@Z=#WSAStartup") +#pragma comment(linker,"/alternatename:?WSAGetLastError@win32@fast_io@@$$hYAHXZ=#WSAGetLastError") +#pragma comment(linker,"/alternatename:?closesocket@win32@fast_io@@$$hYAH_K@Z=#closesocket") +#pragma comment(linker,"/alternatename:?WSASocketW@win32@fast_io@@$$hYA_KHHHPEAUwsaprotocol_infow@12@II@Z=#WSASocketW") +#pragma comment(linker,"/alternatename:?WSASocketA@win32@fast_io@@$$hYA_KHHHPEAUwsaprotocol_infoa@12@II@Z=#WSASocketA") +#pragma comment(linker,"/alternatename:?bind@win32@fast_io@@$$hYAH_KPEBXH@Z=#bind") +#pragma comment(linker,"/alternatename:?listen@win32@fast_io@@$$hYAH_KH@Z=#listen") +#pragma comment(linker,"/alternatename:?WSAAccept@win32@fast_io@@$$hYA_K_KPEBXPEAHP6AXPEAUwsabuf@12@3PEAUqualityofservice@12@433PEAI0@_E0@Z=#WSAAccept") +#pragma comment(linker,"/alternatename:?ioctlsocket@win32@fast_io@@$$hYAH_KJPEAI@Z=#ioctlsocket") +#pragma comment(linker,"/alternatename:?sendto@win32@fast_io@@$$hYAH_KPEBDHHPEBXH@Z=#sendto") +#pragma comment(linker,"/alternatename:?WSASend@win32@fast_io@@$$hYAH_KPEAUwsabuf@12@IPEAIIPEAUoverlapped@12@P6AXII3I@_E@Z=#WSASend") +#pragma comment(linker,"/alternatename:?WSASendMsg@win32@fast_io@@$$hYAH_KPEAUwsamsg@12@IPEAIPEAUoverlapped@12@P6AXII3I@_E@Z=#WSASendMsg") +#pragma comment(linker,"/alternatename:?WSASendTo@win32@fast_io@@$$hYAH_KPEAUwsabuf@12@IPEAIIPEBXHPEAUoverlapped@12@P6AXII4I@_E@Z=#WSASendTo") +#pragma comment(linker,"/alternatename:?recv@win32@fast_io@@$$hYAH_KPEADHH@Z=#recv") +#pragma comment(linker,"/alternatename:?recvfrom@win32@fast_io@@$$hYAH_KPEADHHPEAXPEAH@Z=#recvfrom") +#pragma comment(linker,"/alternatename:?WSARecv@win32@fast_io@@$$hYAH_KPEAUwsabuf@12@IPEAI2PEAUoverlapped@12@P6AXII3I@_E@Z=#WSARecv") +#pragma comment(linker,"/alternatename:?WSARecvFrom@win32@fast_io@@$$hYAH_KPEAUwsabuf@12@IPEAI2PEAXPEAHPEAUoverlapped@12@P6AXII5I@_E@Z=#WSARecvFrom") +#pragma comment(linker,"/alternatename:?connect@win32@fast_io@@$$hYAH_KPEBXH@Z=#connect") +#pragma comment(linker,"/alternatename:?WSAConnect@win32@fast_io@@$$hYAH_KPEBXHPEAUwsabuf@12@2PEAUqualityofservice@12@3@Z=#WSAConnect") +#pragma comment(linker,"/alternatename:?shutdown@win32@fast_io@@$$hYAH_KPEBXH@Z=#shutdown") +#pragma comment(linker,"/alternatename:?GetCurrentProcessId@win32@fast_io@@$$hYAIXZ=#GetCurrentProcessId") +#pragma comment(linker,"/alternatename:?FlushFileBuffers@win32@fast_io@@$$hYAHPEAX@Z=#FlushFileBuffers") +#pragma comment(linker,"/alternatename:?GetQueuedCompletionStatus@win32@fast_io@@$$hYAHPEAXPEAIPEA_KPEAUoverlapped@12@I@Z=#GetQueuedCompletionStatus") +#pragma comment(linker,"/alternatename:?freeaddrinfo@win32@fast_io@@$$hYAXPEAU?$win32_family_addrinfo@$0A@@12@@Z=#freeaddrinfo") +#pragma comment(linker,"/alternatename:?FreeAddrInfoW@win32@fast_io@@$$hYAXPEAU?$win32_family_addrinfo@$00@12@@Z=#FreeAddrInfoW") +#pragma comment(linker,"/alternatename:?getaddrinfo@win32@fast_io@@$$hYAHPEBD0PEBU?$win32_family_addrinfo@$0A@@12@PEAPEAU312@@Z=#getaddrinfo") +#pragma comment(linker,"/alternatename:?GetAddrInfoW@win32@fast_io@@$$hYAHPEB_S0PEBU?$win32_family_addrinfo@$00@12@PEAPEAU312@@Z=#GetAddrInfoW") +#pragma comment(linker,"/alternatename:?CryptAcquireContextA@win32@fast_io@@$$hYAHPEA_KPEB_Q1II@Z=#CryptAcquireContextA") +#pragma comment(linker,"/alternatename:?CryptAcquireContextW@win32@fast_io@@$$hYAHPEA_KPEB_S1II@Z=#CryptAcquireContextW") +#pragma comment(linker,"/alternatename:?CryptReleaseContext@win32@fast_io@@$$hYAH_KI@Z=#CryptReleaseContext") +#pragma comment(linker,"/alternatename:?CryptGenRandom@win32@fast_io@@$$hYAH_KIPEAE@Z=#CryptGenRandom") +#pragma comment(linker,"/alternatename:?RegOpenKeyA@win32@fast_io@@$$hYAH_KPEB_QPEA_K@Z=#RegOpenKeyA") +#pragma comment(linker,"/alternatename:?RegOpenKeyW@win32@fast_io@@$$hYAH_KPEB_SPEA_K@Z=#RegOpenKeyW") +#pragma comment(linker,"/alternatename:?RegQueryValueExA@win32@fast_io@@$$hYAH_KPEB_QPEAI2PEAX2@Z=#RegQueryValueExA") +#pragma comment(linker,"/alternatename:?RegQueryValueExW@win32@fast_io@@$$hYAH_KPEB_SPEAI2PEAX2@Z=#RegQueryValueExW") +#pragma comment(linker,"/alternatename:?RegCloseKey@win32@fast_io@@$$hYAH_K@Z=#RegCloseKey") +#pragma comment(linker,"/alternatename:?GetTimeZoneInformation@win32@fast_io@@$$hYAIPEAUtime_zone_information@12@@Z=#GetTimeZoneInformation") +#pragma comment(linker,"/alternatename:?SetConsoleCP@win32@fast_io@@$$hYAHI@Z=#SetConsoleCP") +#pragma comment(linker,"/alternatename:?SetConsoleOutputCP@win32@fast_io@@$$hYAHI@Z=#SetConsoleOutputCP") +#pragma comment(linker,"/alternatename:?GetConsoleCP@win32@fast_io@@$$hYAIXZ=#GetConsoleCP") +#pragma comment(linker,"/alternatename:?GetConsoleOutputCP@win32@fast_io@@$$hYAIXZ=#GetConsoleOutputCP") +#pragma comment(linker,"/alternatename:?AcquireSRWLockExclusive@win32@fast_io@@$$hYAXPEAX@Z=#AcquireSRWLockExclusive") +#pragma comment(linker,"/alternatename:?TryAcquireSRWLockExclusive@win32@fast_io@@$$hYAIPEAX@Z=#TryAcquireSRWLockExclusive") +#pragma comment(linker,"/alternatename:?ReleaseSRWLockExclusive@win32@fast_io@@$$hYAXPEAX@Z=#ReleaseSRWLockExclusive") +#pragma comment(linker,"/alternatename:?GetSystemInfo@win32@fast_io@@$$hYAXPEAUsystem_info@12@@Z=#GetSystemInfo") +#pragma comment(linker,"/alternatename:?SetFileInformationByHandle@win32@fast_io@@$$hYAHPEAXW4file_info_by_handle_class@12@0I@Z=#SetFileInformationByHandle") +#pragma comment(linker,"/alternatename:?SetFileTime@win32@fast_io@@$$hYAHPEAXPEBUfiletime@12@11@Z=#SetFileTime") +#pragma comment(linker,"/alternatename:?CreateProcessW@win32@fast_io@@$$hYAHPEB_SPEA_SPEAUsecurity_attributes@12@2HIPEAX0PEAUstartupinfow@12@PEAUprocess_information@12@@Z=#CreateProcessW") +#pragma comment(linker,"/alternatename:?CreateProcessA@win32@fast_io@@$$hYAHPEBDPEADPEAUsecurity_attributes@12@2HIPEAXPEB_SPEAUstartupinfoa@12@PEAUprocess_information@12@@Z=#CreateProcessA") +#pragma comment(linker,"/alternatename:?K32GetMappedFileNameW@win32@fast_io@@$$hYAIPEAX0PEA_SI@Z=#K32GetMappedFileNameW") +#pragma comment(linker,"/alternatename:?K32GetMappedFileNameA@win32@fast_io@@$$hYAIPEAX0PEADI@Z=#K32GetMappedFileNameA") +#pragma comment(linker,"/alternatename:?GetMappedFileNameW@win32@fast_io@@$$hYAIPEAX0PEA_SI@Z=#GetMappedFileNameW") +#pragma comment(linker,"/alternatename:?GetMappedFileNameA@win32@fast_io@@$$hYAIPEAX0PEADI@Z=#GetMappedFileNameA") +#pragma comment(linker,"/alternatename:?GetExitCodeProcess@win32@fast_io@@$$hYAHPEAXPEAI@Z=#GetExitCodeProcess") +#pragma comment(linker,"/alternatename:?QueryDosDeviceW@win32@fast_io@@$$hYAIPEB_SPEA_SI@Z=#QueryDosDeviceW") +#pragma comment(linker,"/alternatename:?QueryDosDeviceA@win32@fast_io@@$$hYAIPEBDPEADI@Z=#QueryDosDeviceA") +#pragma comment(linker,"/alternatename:?FindFirstFileW@win32@fast_io@@$$hYAPEAXPEB_SPEAUwin32_find_dataw@12@@Z=#FindFirstFileW") +#pragma comment(linker,"/alternatename:?FindFirstFileA@win32@fast_io@@$$hYAPEAXPEBDPEAUwin32_find_dataa@12@@Z=#FindFirstFileA") +#pragma comment(linker,"/alternatename:?FindNextFileW@win32@fast_io@@$$hYAHPEAXPEAUwin32_find_dataw@12@@Z=#FindNextFileW") +#pragma comment(linker,"/alternatename:?FindNextFileA@win32@fast_io@@$$hYAHPEAXPEAUwin32_find_dataa@12@@Z=#FindNextFileA") +#pragma comment(linker,"/alternatename:?FindClose@win32@fast_io@@$$hYAHPEAX@Z=#FindClose") +#pragma comment(linker,"/alternatename:?ShellExecuteW@win32@fast_io@@$$hYAPEAXPEAXPEB_S111H@Z=#ShellExecuteW") +#pragma comment(linker,"/alternatename:?ShellExecuteA@win32@fast_io@@$$hYAPEAXPEAXPEBD111H@Z=#ShellExecuteA") +#pragma comment(linker,"/alternatename:?DeleteFileW@win32@fast_io@@$$hYAHPEB_S@Z=#DeleteFileW") +#pragma comment(linker,"/alternatename:?DeleteFileA@win32@fast_io@@$$hYAHPEBD@Z=#DeleteFileA") +#pragma comment(linker,"/alternatename:?RemoveDirectoryW@win32@fast_io@@$$hYAHPEB_S@Z=#RemoveDirectoryW") +#pragma comment(linker,"/alternatename:?RemoveDirectoryA@win32@fast_io@@$$hYAHPEBD@Z=#RemoveDirectoryA") +#pragma comment(linker,"/alternatename:?CreateDirectoryW@win32@fast_io@@$$hYAHPEB_SPEAUsecurity_attributes@12@@Z=#CreateDirectoryW") +#pragma comment(linker,"/alternatename:?CreateDirectoryA@win32@fast_io@@$$hYAHPEBDPEAUsecurity_attributes@12@@Z=#CreateDirectoryA") +#pragma comment(linker,"/alternatename:?SetFileAttributesW@win32@fast_io@@$$hYAHPEB_SI@Z=#SetFileAttributesW") +#pragma comment(linker,"/alternatename:?SetFileAttributesA@win32@fast_io@@$$hYAHPEBDI@Z=#SetFileAttributesA") +#pragma comment(linker,"/alternatename:?GetFileAttributesW@win32@fast_io@@$$hYAIPEB_S@Z=#GetFileAttributesW") +#pragma comment(linker,"/alternatename:?GetFileAttributesA@win32@fast_io@@$$hYAIPEBD@Z=#GetFileAttributesA") +#pragma comment(linker,"/alternatename:?CopyFileW@win32@fast_io@@$$hYAHPEB_S0H@Z=#CopyFileW") +#pragma comment(linker,"/alternatename:?CopyFileA@win32@fast_io@@$$hYAHPEBD0H@Z=#CopyFileA") +#pragma comment(linker,"/alternatename:?MoveFileW@win32@fast_io@@$$hYAHPEB_S0@Z=#MoveFileW") +#pragma comment(linker,"/alternatename:?MoveFileA@win32@fast_io@@$$hYAHPEBD0@Z=#MoveFileA") +#pragma comment(linker,"/alternatename:?TerminateProcess@win32@fast_io@@$$hYAHPEAXI@Z=#TerminateProcess") +#pragma comment(linker,"/alternatename:?GetFinalPathNameByHandleW@win32@fast_io@@$$hYAIPEAXPEA_SII@Z=#GetFinalPathNameByHandleW") +#pragma comment(linker,"/alternatename:?GetFinalPathNameByHandleA@win32@fast_io@@$$hYAIPEAXPEADII@Z=#GetFinalPathNameByHandleA") +#pragma comment(linker,"/alternatename:?GetProcessId@win32@fast_io@@$$hYAIPEAX@Z=#GetProcessId") +#pragma comment(linker,"/alternatename:?CreateNamedPipeW@win32@fast_io@@$$hYAPEAXPEB_SIIIIIIPEAUsecurity_attributes@12@@Z=#CreateNamedPipeW") +#pragma comment(linker,"/alternatename:?CreateNamedPipeA@win32@fast_io@@$$hYAPEAXPEBDIIIIIIPEAUsecurity_attributes@12@@Z=#CreateNamedPipeA") +#pragma comment(linker,"/alternatename:?ConnectNamedPipe@win32@fast_io@@$$hYAHPEAXPEAUoverlapped@12@@Z=#ConnectNamedPipe") +#pragma comment(linker,"/alternatename:?DisconnectNamedPipe@win32@fast_io@@$$hYAHPEAX@Z=#DisconnectNamedPipe") +// NT +#pragma comment(linker,"/alternatename:?rtl_nt_status_to_dos_error@nt@win32@fast_io@@$$hYAII@Z=#RtlNtStatusToDosError") +#pragma comment(linker,"/alternatename:?NtClose@nt@win32@fast_io@@$$hYAIPEAX@Z=#NtClose") +#pragma comment(linker,"/alternatename:?ZwClose@nt@win32@fast_io@@$$hYAIPEAX@Z=#ZwClose") +#pragma comment(linker,"/alternatename:?NtCreateFile@nt@win32@fast_io@@$$hYAIPEAPEAXIPEAUobject_attributes@123@PEAUio_status_block@123@PEA_JIIIIPEAXI@Z=#NtCreateFile") +#pragma comment(linker,"/alternatename:?ZwCreateFile@nt@win32@fast_io@@$$hYAIPEAPEAXIPEAUobject_attributes@123@PEAUio_status_block@123@PEA_JIIIIPEAXI@Z=#ZwCreateFile") +#pragma comment(linker,"/alternatename:?NtCreateSection@nt@win32@fast_io@@$$hYAIPEIAPEAXIPEIAUobject_attributes@123@PEA_KIIPEIAX@Z=#NtCreateSection") +#pragma comment(linker,"/alternatename:?ZwCreateSection@nt@win32@fast_io@@$$hYAIPEIAPEAXIPEIAUobject_attributes@123@PEA_KIIPEIAX@Z=#ZwCreateSection") +#pragma comment(linker,"/alternatename:?NtQueryInformationProcess@nt@win32@fast_io@@$$hYAIPEIAXW4process_information_class@123@PEAXIPEAI@Z=#NtQueryInformationProcess") +#pragma comment(linker,"/alternatename:?ZwQueryInformationProcess@nt@win32@fast_io@@$$hYAIPEIAXW4process_information_class@123@PEAXIPEAI@Z=#ZwQueryInformationProcess") +#pragma comment(linker,"/alternatename:?NtWriteFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEBXIPEA_JPEAI@Z=#NtWriteFile") +#pragma comment(linker,"/alternatename:?ZwWriteFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEBXIPEA_JPEAI@Z=#ZwWriteFile") +#pragma comment(linker,"/alternatename:?NtReadFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEBXIPEA_JPEAI@Z=#NtReadFile") +#pragma comment(linker,"/alternatename:?ZwReadFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEBXIPEA_JPEAI@Z=#ZwReadFile") +#pragma comment(linker,"/alternatename:?NtQueryDirectoryFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E010IW4file_information_class@123@HPEAUunicode_string@123@H@Z=#NtQueryDirectoryFile") +#pragma comment(linker,"/alternatename:?ZwQueryDirectoryFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E010IW4file_information_class@123@HPEAUunicode_string@123@H@Z=#ZwQueryDirectoryFile") +#pragma comment(linker,"/alternatename:?NtQuerySection@nt@win32@fast_io@@$$hYAIPEAXW4section_information_class@123@0_KPEA_K@Z=#NtQuerySection") +#pragma comment(linker,"/alternatename:?ZwQuerySection@nt@win32@fast_io@@$$hYAIPEAXW4section_information_class@123@0_KPEA_K@Z=#ZwQuerySection") +#pragma comment(linker,"/alternatename:?NtQueryInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4file_information_class@123@@Z=#NtQueryInformationFile") +#pragma comment(linker,"/alternatename:?ZwQueryInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4file_information_class@123@@Z=#ZwQueryInformationFile") +#pragma comment(linker,"/alternatename:?NtSetInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4file_information_class@123@@Z=#NtSetInformationFile") +#pragma comment(linker,"/alternatename:?ZwSetInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4file_information_class@123@@Z=#ZwSetInformationFile") +#pragma comment(linker,"/alternatename:?NtDuplicateObject@nt@win32@fast_io@@$$hYAIPEAX00PEAPEAXIII@Z=#NtDuplicateObject") +#pragma comment(linker,"/alternatename:?ZwDuplicateObject@nt@win32@fast_io@@$$hYAIPEAX00PEAPEAXIII@Z=#ZwDuplicateObject") +#pragma comment(linker,"/alternatename:?NtWaitForSingleObject@nt@win32@fast_io@@$$hYAIPEAXHPEA_K@Z=#NtWaitForSingleObject") +#pragma comment(linker,"/alternatename:?ZwWaitForSingleObject@nt@win32@fast_io@@$$hYAIPEAXHPEA_K@Z=#ZwWaitForSingleObject") +#pragma comment(linker,"/alternatename:?NtSetSystemTime@nt@win32@fast_io@@$$hYAIPEA_K0@Z=#NtSetSystemTime") +#pragma comment(linker,"/alternatename:?ZwSetSystemTime@nt@win32@fast_io@@$$hYAIPEA_K0@Z=#ZwSetSystemTime") +#pragma comment(linker,"/alternatename:?NtCreateProcess@nt@win32@fast_io@@$$hYAIPEAPEAXIPEAUobject_attributes@123@PEAXI222@Z=#NtCreateProcess") +#pragma comment(linker,"/alternatename:?ZwCreateProcess@nt@win32@fast_io@@$$hYAIPEAPEAXIPEAUobject_attributes@123@PEAXI222@Z=#ZwCreateProcess") +#pragma comment(linker,"/alternatename:?rtl_dos_path_name_to_nt_path_name_u@nt@win32@fast_io@@$$hYAEPEB_SPEAUunicode_string@123@PEAPEB_SPEAUrtl_relative_name_u@123@@Z=#RtlDosPathNameToNtPathName_U") +#pragma comment(linker,"/alternatename:?rtl_dos_path_name_to_nt_path_name_u_with_status@nt@win32@fast_io@@$$hYAIPEB_SPEAUunicode_string@123@PEAPEB_SPEAUrtl_relative_name_u@123@@Z=#RtlDosPathNameToNtPathName_U_WithStatus") +#pragma comment(linker,"/alternatename:?rtl_free_unicode_string@nt@win32@fast_io@@$$hYAXPEAUunicode_string@123@@Z=#RtlFreeUnicodeString") +#pragma comment(linker,"/alternatename:?RtlInitializeCriticalSection@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlInitializeCriticalSection") +#pragma comment(linker,"/alternatename:?RtlEnterCriticalSection@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlEnterCriticalSection") +#pragma comment(linker,"/alternatename:?RtlTryEnterCriticalSection@nt@win32@fast_io@@$$hYAHPEAX@Z=#RtlTryEnterCriticalSection") +#pragma comment(linker,"/alternatename:?RtlLeaveCriticalSection@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlLeaveCriticalSection") +#pragma comment(linker,"/alternatename:?RtlDeleteCriticalSection@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlDeleteCriticalSection") +#pragma comment(linker,"/alternatename:?RtlCreateUserThread@nt@win32@fast_io@@$$hYAIPEAX0HI_K100PEAPEAXPEAUclient_id@123@@Z=#RtlCreateUserThread") +#pragma comment(linker,"/alternatename:?NtResumeThread@nt@win32@fast_io@@$$hYAIPEAXPEAI@Z=#NtResumeThread") +#pragma comment(linker,"/alternatename:?ZwResumeThread@nt@win32@fast_io@@$$hYAIPEAXPEAI@Z=#ZwResumeThread") +#pragma comment(linker,"/alternatename:?NtLockFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEA_J3IEE@Z=#NtLockFile") +#pragma comment(linker,"/alternatename:?ZwLockFile@nt@win32@fast_io@@$$hYAIPEAX0P6AX0PEAUio_status_block@123@I@_E01PEA_J3IEE@Z=#ZwLockFile") +#pragma comment(linker,"/alternatename:?NtUnlockFile@nt@win32@fast_io@@$$hYAIPEAXPEAUio_status_block@123@PEA_J2I@Z=#NtUnlockFile") +#pragma comment(linker,"/alternatename:?ZwUnlockFile@nt@win32@fast_io@@$$hYAIPEAXPEAUio_status_block@123@PEA_J2I@Z=#ZwUnlockFile") +#pragma comment(linker,"/alternatename:?NtFlushBuffersFile@nt@win32@fast_io@@$$hYAIPEAXPEAUio_status_block@123@@Z=#NtFlushBuffersFile") +#pragma comment(linker,"/alternatename:?ZwFlushBuffersFile@nt@win32@fast_io@@$$hYAIPEAXPEAUio_status_block@123@@Z=#ZwFlushBuffersFile") +#pragma comment(linker,"/alternatename:?NtFlushBuffersFileEx@nt@win32@fast_io@@$$hYAIPEAXI0IPEAUio_status_block@123@@Z=#NtFlushBuffersFileEx") +#pragma comment(linker,"/alternatename:?ZwFlushBuffersFileEx@nt@win32@fast_io@@$$hYAIPEAXI0IPEAUio_status_block@123@@Z=#ZwFlushBuffersFileEx") +#pragma comment(linker,"/alternatename:?DbgPrint@nt@win32@fast_io@@$$hYAIPEBDZZ=#DbgPrint") +#pragma comment(linker,"/alternatename:?DbgPrintEx@nt@win32@fast_io@@$$hYAIIIPEBDZZ=#DbgPrintEx") +#pragma comment(linker,"/alternatename:?RtlCreateProcessParameters@nt@win32@fast_io@@$$hYAIPEAPEAUrtl_user_process_parameters@123@PEAUunicode_string@123@111PEAX1111@Z=#RtlCreateProcessParameters") +#pragma comment(linker,"/alternatename:?RtlCreateProcessParametersEx@nt@win32@fast_io@@$$hYAIPEAPEAUrtl_user_process_parameters@123@PEAUunicode_string@123@111PEAX1111I@Z=#RtlCreateProcessParametersEx") +#pragma comment(linker,"/alternatename:?RtlDestroyProcessParameters@nt@win32@fast_io@@$$hYAIPEAUrtl_user_process_parameters@123@@Z=#RtlDestroyProcessParameters") +#pragma comment(linker,"/alternatename:?NtCreateUserProcess@nt@win32@fast_io@@$$hYAIPEAX0IIPEAUobject_attributes@123@1IIPEAUrtl_user_process_parameters@123@PEAUps_create_info@123@PEAUps_attribute_list@123@@Z=#NtCreateUserProcess") +#pragma comment(linker,"/alternatename:?ZwCreateUserProcess@nt@win32@fast_io@@$$hYAIPEAX0IIPEAUobject_attributes@123@1IIPEAUrtl_user_process_parameters@123@PEAUps_create_info@123@PEAUps_attribute_list@123@@Z=#ZwCreateUserProcess") +#pragma comment(linker,"/alternatename:?RtlCreateUserProcess@nt@win32@fast_io@@$$hYAIPEAUunicode_string@123@IPEAUrtl_user_process_parameters@123@PEAUsecurity_descriptor@123@2PEAXE33PEAUrtl_user_process_information@123@@Z=#RtlCreateUserProcess") +#pragma comment(linker,"/alternatename:?NtMapViewOfSection@nt@win32@fast_io@@$$hYAIPEAX0PEAPEAX_K2PEBTlarge_integer@123@PEA_KW4section_inherit@123@II@Z=#NtMapViewOfSection") +#pragma comment(linker,"/alternatename:?ZwMapViewOfSection@nt@win32@fast_io@@$$hYAIPEAX0PEAPEAX_K2PEBTlarge_integer@123@PEA_KW4section_inherit@123@II@Z=#ZwMapViewOfSection") +#pragma comment(linker,"/alternatename:?NtUnmapViewOfSection@nt@win32@fast_io@@$$hYAIPEAX0@Z=#NtUnmapViewOfSection") +#pragma comment(linker,"/alternatename:?ZwUnmapViewOfSection@nt@win32@fast_io@@$$hYAIPEAX0@Z=#ZwUnmapViewOfSection") +#pragma comment(linker,"/alternatename:?NtReadVirtualMemory@nt@win32@fast_io@@$$hYAIPEAX00_KPEA_K@Z=#NtReadVirtualMemory") +#pragma comment(linker,"/alternatename:?ZwReadVirtualMemory@nt@win32@fast_io@@$$hYAIPEAX00_KPEA_K@Z=#ZwReadVirtualMemory") +#pragma comment(linker,"/alternatename:?NtWriteVirtualMemory@nt@win32@fast_io@@$$hYAIPEAX00_KPEA_K@Z=#NtWriteVirtualMemory") +#pragma comment(linker,"/alternatename:?ZwWriteVirtualMemory@nt@win32@fast_io@@$$hYAIPEAX00_KPEA_K@Z=#ZwWriteVirtualMemory") +#pragma comment(linker,"/alternatename:?RtlAcquirePebLock@nt@win32@fast_io@@$$hYAIXZ=#RtlAcquirePebLock") +#pragma comment(linker,"/alternatename:?RtlReleasePebLock@nt@win32@fast_io@@$$hYAIXZ=#RtlReleasePebLock") +#pragma comment(linker,"/alternatename:?NtAllocateVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXPEAPEAX_KPEA_KII@Z=#NtAllocateVirtualMemory") +#pragma comment(linker,"/alternatename:?ZwAllocateVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXPEAPEAX_KPEA_KII@Z=#ZwAllocateVirtualMemory") +#pragma comment(linker,"/alternatename:?RtlInitUnicodeString@nt@win32@fast_io@@$$hYAIPEAUunicode_string@123@PEA_S@Z=#RtlInitUnicodeString") +#pragma comment(linker,"/alternatename:?CsrClientCallServer@nt@win32@fast_io@@$$hYAIPEAX0II@Z=#CsrClientCallServer") +#pragma comment(linker,"/alternatename:?RtlAcquireSRWLockExclusive@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlAcquireSRWLockExclusive") +#pragma comment(linker,"/alternatename:?RtlTryAcquireSRWLockExclusive@nt@win32@fast_io@@$$hYAIPEAX@Z=#RtlTryAcquireSRWLockExclusive") +#pragma comment(linker,"/alternatename:?RtlReleaseSRWLockExclusive@nt@win32@fast_io@@$$hYAXPEAX@Z=#RtlReleaseSRWLockExclusive") +#pragma comment(linker,"/alternatename:?NtQueryObject@nt@win32@fast_io@@$$hYAIPEAXW4object_information_class@123@0IPEAI@Z=#NtQueryObject") +#pragma comment(linker,"/alternatename:?ZwQueryObject@nt@win32@fast_io@@$$hYAIPEAXW4object_information_class@123@0IPEAI@Z=#ZwQueryObject") +#pragma comment(linker,"/alternatename:?NtQuerySystemInformation@nt@win32@fast_io@@$$hYAIW4system_information_class@123@PEAXIPEAI@Z=#NtQuerySystemInformation") +#pragma comment(linker,"/alternatename:?NtFreeVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXPEAPEAXPEA_KI@Z=#NtFreeVirtualMemory") +#pragma comment(linker,"/alternatename:?ZwFreeVirtualMemory@nt@win32@fast_io@@$$hYAIPEAXPEAPEAXPEA_KI@Z=#ZwFreeVirtualMemory") +#pragma comment(linker,"/alternatename:?NtQueryVolumeInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4fs_information_class@123@@Z=#NtQueryVolumeInformationFile") +#pragma comment(linker,"/alternatename:?ZwQueryVolumeInformationFile@nt@win32@fast_io@@$$hYAIPEIAXPEIAUio_status_block@123@0IW4fs_information_class@123@@Z=#ZwQueryVolumeInformationFile") +#pragma comment(linker,"/alternatename:?NtFsControlFile@nt@win32@fast_io@@$$hYAIPEIAX0PEIAP6AXPEAXPEAUio_status_block@123@I@_E12I1I1I@Z=#NtFsControlFile") +#pragma comment(linker,"/alternatename:?ZwFsControlFile@nt@win32@fast_io@@$$hYAIPEIAX0PEIAP6AXPEAXPEAUio_status_block@123@I@_E12I1I1I@Z=#ZwFsControlFile") +#pragma comment(linker,"/alternatename:?NtCreateNamedPipeFile@nt@win32@fast_io@@$$hYAIPEIAPEAXIPEIAUobject_attributes@123@PEIAUio_status_block@123@IIIIIIIIIPEA_J@Z=#NtCreateNamedPipeFile") +#pragma comment(linker,"/alternatename:?ZwCreateNamedPipeFile@nt@win32@fast_io@@$$hYAIPEIAPEAXIPEIAUobject_attributes@123@PEIAUio_status_block@123@IIIIIIIIIPEA_J@Z=#ZwCreateNamedPipeFile") +#pragma comment(linker,"/alternatename:?NtQueryPerformanceCounter@nt@win32@fast_io@@$$hYAIPEA_J0@Z=#NtQueryPerformanceCounter") +#pragma comment(linker,"/alternatename:?ZwQueryPerformanceCounter@nt@win32@fast_io@@$$hYAIPEA_J0@Z=#ZwQueryPerformanceCounter") +#pragma comment(linker,"/alternatename:?RtlGetSystemTimePrecise@nt@win32@fast_io@@$$hYA_JXZ=#RtlGetSystemTimePrecise") +#pragma comment(linker,"/alternatename:?NtQueryInformationThread@nt@win32@fast_io@@$$hYAIPEIAXW4thread_information_class@123@PEAXIPEAI@Z=#NtQueryInformationThread") +#pragma comment(linker,"/alternatename:?ZwQueryInformationThread@nt@win32@fast_io@@$$hYAIPEIAXW4thread_information_class@123@PEAXIPEAI@Z=#ZwQueryInformationThread") +#pragma comment(linker,"/alternatename:?RtlAdjustPrivilege@nt@win32@fast_io@@$$hYAIIEEPEAE@Z=#RtlAdjustPrivilege") +#pragma comment(linker,"/alternatename:?NtSetInformationObject@nt@win32@fast_io@@$$hYAIPEIAXW4object_information_class@123@PEAXI@Z=#NtSetInformationObject") +#pragma comment(linker,"/alternatename:?ZwSetInformationObject@nt@win32@fast_io@@$$hYAIPEIAXW4object_information_class@123@PEAXI@Z=#ZwSetInformationObject") +#pragma comment(linker,"/alternatename:?NtQueryAuxiliaryCounterFrequency@nt@win32@fast_io@@$$hYAIPEA_K@Z=#NtQueryAuxiliaryCounterFrequency") +#pragma comment(linker,"/alternatename:?ZwQueryAuxiliaryCounterFrequency@nt@win32@fast_io@@$$hYAIPEA_K@Z=#ZwQueryAuxiliaryCounterFrequency") +#pragma comment(linker,"/alternatename:?RtlDetermineDosPathNameType_U@nt@win32@fast_io@@$$hYA?AW4rtl_path_type@123@PEB_S@Z=#RtlDetermineDosPathNameType_U") +#pragma comment(linker,"/alternatename:?RtlGetFullPathName_U@nt@win32@fast_io@@$$hYAIPEB_SIPEA_SPEAPEA_S@Z=#RtlGetFullPathName_U") +#pragma comment(linker,"/alternatename:?AlpcGetMessageAttribute@nt@win32@fast_io@@$$hYAPEAXPEAUalpc_message_attributes@123@I@Z=#AlpcGetMessageAttribute") +#pragma comment(linker,"/alternatename:?AlpcInitializeMessageAttribute@nt@win32@fast_io@@$$hYAIIPEAUalpc_message_attributes@123@_KPEA_K@Z=#AlpcInitializeMessageAttribute") +#pragma comment(linker,"/alternatename:?NtAlpcCreatePort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAUobject_attributes@123@PEAUalpc_port_attributes@123@@Z=#NtAlpcCreatePort") +#pragma comment(linker,"/alternatename:?ZwAlpcCreatePort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAUobject_attributes@123@PEAUalpc_port_attributes@123@@Z=#ZwAlpcCreatePort") +#pragma comment(linker,"/alternatename:?NtAlpcConnectPort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAUunicode_string@123@PEAUobject_attributes@123@PEAUalpc_port_attributes@123@IPEAXPEAUport_message@123@PEA_KPEAUalpc_message_attributes@123@7PEA_J@Z=#NtAlpcConnectPort") +#pragma comment(linker,"/alternatename:?ZwAlpcConnectPort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAUunicode_string@123@PEAUobject_attributes@123@PEAUalpc_port_attributes@123@IPEAXPEAUport_message@123@PEA_KPEAUalpc_message_attributes@123@7PEA_J@Z=#ZwAlpcConnectPort") +#pragma comment(linker,"/alternatename:?NtAlpcSendWaitReceivePort@nt@win32@fast_io@@$$hYAIPEAXIPEAUport_message@123@PEAUalpc_message_attributes@123@1PEA_K2PEA_J@Z=#NtAlpcSendWaitReceivePort") +#pragma comment(linker,"/alternatename:?ZwAlpcSendWaitReceivePort@nt@win32@fast_io@@$$hYAIPEAXIPEAUport_message@123@PEAUalpc_message_attributes@123@1PEA_K2PEA_J@Z=#ZwAlpcSendWaitReceivePort") +#pragma comment(linker,"/alternatename:?NtAlpcAcceptConnectPort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAXIPEAUobject_attributes@123@PEAUalpc_port_attributes@123@1PEAUport_message@123@PEAUalpc_message_attributes@123@E@Z=#NtAlpcAcceptConnectPort") +#pragma comment(linker,"/alternatename:?ZwAlpcAcceptConnectPort@nt@win32@fast_io@@$$hYAIPEAPEAXPEAXIPEAUobject_attributes@123@PEAUalpc_port_attributes@123@1PEAUport_message@123@PEAUalpc_message_attributes@123@E@Z=#ZwAlpcAcceptConnectPort") +#pragma comment(linker,"/alternatename:?AlpcGetHeaderSize@nt@win32@fast_io@@$$hYA_KI@Z=#AlpcGetHeaderSize") +#pragma comment(linker,"/alternatename:?NtAlpcImpersonateClientOfPort@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@0@Z=#NtAlpcImpersonateClientOfPort") +#pragma comment(linker,"/alternatename:?ZwAlpcImpersonateClientOfPort@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@0@Z=#ZwAlpcImpersonateClientOfPort") +#pragma comment(linker,"/alternatename:?NtAlpcImpersonateClientContainerOfPort@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@I@Z=#NtAlpcImpersonateClientContainerOfPort") +#pragma comment(linker,"/alternatename:?ZwAlpcImpersonateClientContainerOfPort@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@I@Z=#ZwAlpcImpersonateClientContainerOfPort") +#pragma comment(linker,"/alternatename:?NtAlpcDisconnectPort@nt@win32@fast_io@@$$hYAIPEAXI@Z=#NtAlpcDisconnectPort") +#pragma comment(linker,"/alternatename:?ZwAlpcDisconnectPort@nt@win32@fast_io@@$$hYAIPEAXI@Z=#ZwAlpcDisconnectPort") +#pragma comment(linker,"/alternatename:?NtAlpcCreatePortSection@nt@win32@fast_io@@$$hYAIPEAXI0_KPEAPEAXPEA_K@Z=#NtAlpcCreatePortSection") +#pragma comment(linker,"/alternatename:?ZwAlpcCreatePortSection@nt@win32@fast_io@@$$hYAIPEAXI0_KPEAPEAXPEA_K@Z=#ZwAlpcCreatePortSection") +#pragma comment(linker,"/alternatename:?NtAlpcCreateSectionView@nt@win32@fast_io@@$$hYAIPEAXIPEAUalpc_data_view_attr@123@@Z=#NtAlpcCreateSectionView") +#pragma comment(linker,"/alternatename:?ZwAlpcCreateSectionView@nt@win32@fast_io@@$$hYAIPEAXIPEAUalpc_data_view_attr@123@@Z=#ZwAlpcCreateSectionView") +#pragma comment(linker,"/alternatename:?AlpcMaxAllowedMessageLength@nt@win32@fast_io@@$$hYAIXZ=#AlpcMaxAllowedMessageLength") +#pragma comment(linker,"/alternatename:?NtAlpcQueryInformationMessage@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@W4alpc_message_information_class@123@0_KPEA_K@Z=#NtAlpcQueryInformationMessage") +#pragma comment(linker,"/alternatename:?ZwAlpcQueryInformationMessage@nt@win32@fast_io@@$$hYAIPEAXPEAUport_message@123@W4alpc_message_information_class@123@0_KPEA_K@Z=#ZwAlpcQueryInformationMessage") +#pragma comment(linker,"/alternatename:?NtAlpcCreateSecurityContext@nt@win32@fast_io@@$$hYAIPEAXIPEAUalpc_security_attr@123@@Z=#NtAlpcCreateSecurityContext") +#pragma comment(linker,"/alternatename:?ZwAlpcCreateSecurityContext@nt@win32@fast_io@@$$hYAIPEAXIPEAUalpc_security_attr@123@@Z=#ZwAlpcCreateSecurityContext") +#pragma comment(linker,"/alternatename:?NtAlpcOpenSenderThread@nt@win32@fast_io@@$$hYAIPEAPEAXPEAXPEAUport_message@123@IIPEAUobject_attributes@123@@Z=#NtAlpcOpenSenderThread") +#pragma comment(linker,"/alternatename:?ZwAlpcOpenSenderThread@nt@win32@fast_io@@$$hYAIPEAPEAXPEAXPEAUport_message@123@IIPEAUobject_attributes@123@@Z=#ZwAlpcOpenSenderThread") +#pragma comment(linker,"/alternatename:?NtTerminateProcess@nt@win32@fast_io@@$$hYAIPEAXH@Z=#NtTerminateProcess") +#pragma comment(linker,"/alternatename:?ZwTerminateProcess@nt@win32@fast_io@@$$hYAIPEAXH@Z=#ZwTerminateProcess") +#pragma comment(linker,"/alternatename:?RtlNtPathNameToDosPathName@nt@win32@fast_io@@$$hYAIIPEAUrtl_unicode_string_buffer@123@PEAIPEAPEA_S@Z=#RtlNtPathNameToDosPathName") +#pragma comment(linker,"/alternatename:?NtDeviceIoControlFile@nt@win32@fast_io@@$$hYAIPEAX0PEAP6AX0PEAUio_status_block@123@I@_E01I0I0I@Z=#NtDeviceIoControlFile") +#pragma comment(linker,"/alternatename:?ZwDeviceIoControlFile@nt@win32@fast_io@@$$hYAIPEAX0PEAP6AX0PEAUio_status_block@123@I@_E01I0I0I@Z=#ZwDeviceIoControlFile") +// msvc +#pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@$$hYAPEAXPEAX@Z=#__RTtypeid") +#pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@$$hYAPEAXPEAX@Z=#__RTtypeid") +// clang-format on From 7216ac015ad97861e8f7df48892df6e31a6cab4b Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 02:59:09 -0500 Subject: [PATCH 40/51] [arm64ec]#__RTtypeid is repeated --- include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h index 0f9699e26..b3296a6cc 100644 --- a/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h +++ b/include/fast_io_hosted/platforms/win32/msvc_linker_arm64ec.h @@ -290,5 +290,5 @@ #pragma comment(linker,"/alternatename:?ZwDeviceIoControlFile@nt@win32@fast_io@@$$hYAIPEAX0PEAP6AX0PEAUio_status_block@123@I@_E01I0I0I@Z=#ZwDeviceIoControlFile") // msvc #pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@$$hYAPEAXPEAX@Z=#__RTtypeid") -#pragma comment(linker,"/alternatename:?msvc__RTtypeid@msvc@fast_io@@$$hYAPEAXPEAX@Z=#__RTtypeid") + // clang-format on From cd4c065ba4fd5ac8d2b77f0814161b59a80fb49d Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 03:25:16 -0500 Subject: [PATCH 41/51] [arm64ec] push_macros for clang? --- include/fast_io_dsal/impl/misc/push_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fast_io_dsal/impl/misc/push_macros.h b/include/fast_io_dsal/impl/misc/push_macros.h index d54683dbb..b10947143 100644 --- a/include/fast_io_dsal/impl/misc/push_macros.h +++ b/include/fast_io_dsal/impl/misc/push_macros.h @@ -52,7 +52,7 @@ #if defined(_MSC_VER) && !defined(__clang__) #define FAST_IO_DLLIMPORT __declspec(dllimport) -#elif (__has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__)) +#elif __has_cpp_attribute(__gnu__::__dllimport__) && !defined(__WINE__) && !defined(__arm64ec__) #define FAST_IO_DLLIMPORT [[__gnu__::__dllimport__]] #else #define FAST_IO_DLLIMPORT From e31e5afbaef0e0c21c8fdc961c57c129dcb51186 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 06:21:43 -0500 Subject: [PATCH 42/51] add errors for arm64ec --- include/fast_io_core_impl/allocation/msvc/impl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/fast_io_core_impl/allocation/msvc/impl.h b/include/fast_io_core_impl/allocation/msvc/impl.h index df20714f0..45b0b4179 100644 --- a/include/fast_io_core_impl/allocation/msvc/impl.h +++ b/include/fast_io_core_impl/allocation/msvc/impl.h @@ -3,6 +3,7 @@ #if SIZE_MAX > UINT_LEAST32_MAX #include "msvc_linker_64.h" #if defined(__arm64ec__) || defined(_M_ARM64EC) +#error "We do not support ARM64EC. See reasons: https://github.com/trcrsired/Why-Microsoft-ARM64EC-ABI-MUST-DIE/blob/main/README.md" #include "msvc_linker_arm64ec.h" #endif #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) From c5e82c22ba11a64965df64d9d411be1578bc3cd3 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 21 Feb 2025 19:59:46 -0500 Subject: [PATCH 43/51] WTF with not finding the file? --- include/fast_io_core_impl/allocation/msvc/impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/fast_io_core_impl/allocation/msvc/impl.h b/include/fast_io_core_impl/allocation/msvc/impl.h index 45b0b4179..df20714f0 100644 --- a/include/fast_io_core_impl/allocation/msvc/impl.h +++ b/include/fast_io_core_impl/allocation/msvc/impl.h @@ -3,7 +3,6 @@ #if SIZE_MAX > UINT_LEAST32_MAX #include "msvc_linker_64.h" #if defined(__arm64ec__) || defined(_M_ARM64EC) -#error "We do not support ARM64EC. See reasons: https://github.com/trcrsired/Why-Microsoft-ARM64EC-ABI-MUST-DIE/blob/main/README.md" #include "msvc_linker_arm64ec.h" #endif #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) From 6d4f3512c142099357debb42ec7d6fb3faba56bc Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 24 Feb 2025 01:24:33 -0500 Subject: [PATCH 44/51] add fuzzing macro --- include/fast_io_dsal/impl/misc/pop_macros.h | 1 + include/fast_io_dsal/impl/misc/push_macros.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/fast_io_dsal/impl/misc/pop_macros.h b/include/fast_io_dsal/impl/misc/pop_macros.h index 605fcb875..250952013 100644 --- a/include/fast_io_dsal/impl/misc/pop_macros.h +++ b/include/fast_io_dsal/impl/misc/pop_macros.h @@ -1,5 +1,6 @@ // Please keep it in reverse order with the macros in push_macros.h +#pragma pop_macro("FAST_IO_ASSERTIONS") #pragma pop_macro("FAST_IO_GNU_RETURNS_NONNULL") #pragma pop_macro("FAST_IO_GNU_MALLOC") #pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") diff --git a/include/fast_io_dsal/impl/misc/push_macros.h b/include/fast_io_dsal/impl/misc/push_macros.h index 5a57e1641..4b350c969 100644 --- a/include/fast_io_dsal/impl/misc/push_macros.h +++ b/include/fast_io_dsal/impl/misc/push_macros.h @@ -189,3 +189,22 @@ #else #define FAST_IO_GNU_RETURNS_NONNULL #endif + +#pragma push_macro("FAST_IO_ASSERTIONS") +#undef FAST_IO_ASSERTIONS +/* +Internal assert macros for fuzzing fast_io. +*/ +#if defined(FAST_IO_ASSERTIONS) +#if defined(_MSC_VER) && !defined(__clang__) +#define FAST_IO_ASSERT(x) \ + if (!__builtin_is_constant_evaluated() && !(x)) \ + ::std::abort() +#else +#define FAST_IO_ASSERT(x) \ + if (!__builtin_is_constant_evaluated() && !(x)) \ + __builtin_trap() +#endif +#else +#define FAST_IO_ASSERT(x) ((void)0) +#endif From 6ac902fb719f49a6e76d752bc1f232c8a7ba5e7d Mon Sep 17 00:00:00 2001 From: trcrsired Date: Mon, 24 Feb 2025 02:09:57 -0500 Subject: [PATCH 45/51] it should be just called FAST_IO_DEBUG to avoid confusion. The code is NEVER meant for users to use but to test the library --- include/fast_io_dsal/impl/misc/pop_macros.h | 2 +- include/fast_io_dsal/impl/misc/push_macros.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fast_io_dsal/impl/misc/pop_macros.h b/include/fast_io_dsal/impl/misc/pop_macros.h index 250952013..b0fa84469 100644 --- a/include/fast_io_dsal/impl/misc/pop_macros.h +++ b/include/fast_io_dsal/impl/misc/pop_macros.h @@ -1,6 +1,6 @@ // Please keep it in reverse order with the macros in push_macros.h -#pragma pop_macro("FAST_IO_ASSERTIONS") +#pragma pop_macro("FAST_IO_ASSERT") #pragma pop_macro("FAST_IO_GNU_RETURNS_NONNULL") #pragma pop_macro("FAST_IO_GNU_MALLOC") #pragma pop_macro("FAST_IO_GNU_ALWAYS_INLINE_ARTIFICIAL_CONST") diff --git a/include/fast_io_dsal/impl/misc/push_macros.h b/include/fast_io_dsal/impl/misc/push_macros.h index 4b350c969..9b3493053 100644 --- a/include/fast_io_dsal/impl/misc/push_macros.h +++ b/include/fast_io_dsal/impl/misc/push_macros.h @@ -183,19 +183,19 @@ #endif #pragma push_macro("FAST_IO_GNU_RETURNS_NONNULL") -#undef FAST_IO_GNU_RETURNS_NONNULL #if __has_cpp_attribute(__gnu__::__returns_nonnull__) +#undef FAST_IO_GNU_RETURNS_NONNULL #define FAST_IO_GNU_RETURNS_NONNULL [[__gnu__::__returns_nonnull__]] #else #define FAST_IO_GNU_RETURNS_NONNULL #endif -#pragma push_macro("FAST_IO_ASSERTIONS") -#undef FAST_IO_ASSERTIONS +#pragma push_macro("FAST_IO_ASSERT") +#undef FAST_IO_ASSERT /* Internal assert macros for fuzzing fast_io. */ -#if defined(FAST_IO_ASSERTIONS) +#if defined(FAST_IO_DEBUG) #if defined(_MSC_VER) && !defined(__clang__) #define FAST_IO_ASSERT(x) \ if (!__builtin_is_constant_evaluated() && !(x)) \ From 46e5366ac3536715006eaf62d0ffa978750c32d9 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 1 Mar 2025 00:02:57 -0500 Subject: [PATCH 46/51] [DOS] fix massive amount of compilation errors --- include/fast_io_hosted.h | 6 +- include/fast_io_hosted/filesystem/dos.h | 2 +- include/fast_io_hosted/filesystem/dos_at.h | 130 ++++++++++----------- include/fast_io_hosted/platforms/posix.h | 20 ++-- 4 files changed, 76 insertions(+), 82 deletions(-) diff --git a/include/fast_io_hosted.h b/include/fast_io_hosted.h index f8d2edce2..f3d12bffd 100644 --- a/include/fast_io_hosted.h +++ b/include/fast_io_hosted.h @@ -60,11 +60,9 @@ freestanding ones. #endif #if !defined(__AVR__) -#include "fast_io_dsal/impl/common.h" +#include "fast_io_dsal/string.h" +#include "fast_io_dsal/string_view.h" #include "fast_io_dsal/impl/vector.h" -#include "fast_io_dsal/impl/string_view.h" -#include "fast_io_dsal/impl/cstring_view.h" -#include "fast_io_dsal/impl/string.h" #include "fast_io_hosted/platforms/native.h" #include "fast_io_hosted/file_loaders/impl.h" diff --git a/include/fast_io_hosted/filesystem/dos.h b/include/fast_io_hosted/filesystem/dos.h index 32e445fad..44a025c46 100644 --- a/include/fast_io_hosted/filesystem/dos.h +++ b/include/fast_io_hosted/filesystem/dos.h @@ -81,7 +81,7 @@ inline dos_DIR sys_dup_dir(dos_DIR dirp) throw_posix_error(); } auto newfd{details::sys_dup(fd)}; - auto newdir{posix::my_dos_fdopendir(newfd)}; + auto newdir{::fast_io::posix::my_dos_fdopendir(newfd)}; if (newdir == nullptr) [[unlikely]] { details::sys_close(newfd); diff --git a/include/fast_io_hosted/filesystem/dos_at.h b/include/fast_io_hosted/filesystem/dos_at.h index a5dfaab62..466a2b192 100644 --- a/include/fast_io_hosted/filesystem/dos_at.h +++ b/include/fast_io_hosted/filesystem/dos_at.h @@ -122,7 +122,7 @@ inline ::fast_io::tlc::string my_dos_concat_path(int dirfd, char const *pathname auto pathname_cstr{::fast_io::noexcept_call(::__get_fd_name, dirfd)}; if (pathname_cstr == nullptr) [[unlikely]] { - system_call_throw_error(-1); + ::fast_io::system_call_throw_error(-1); return {}; } @@ -130,51 +130,51 @@ inline ::fast_io::tlc::string my_dos_concat_path(int dirfd, char const *pathname ::fast_io::cstring_view para_pathname{::fast_io::mnp::os_c_str(pathname)}; if (auto const sz{para_pathname.size()}; sz == 0 || sz > 255) [[unlikely]] { - system_call_throw_error(-1); + ::fast_io::system_call_throw_error(-1); return {}; } - if (auto const fc{para_pathname.front_unchecked()}; fc == '+' || fc == '-' || fc == '.') [[unlikely]] + if (auto const fc{para_pathname.front_unchecked()}; fc == u8'+' || fc == u8'-' || fc == u8'.') [[unlikely]] { - system_call_throw_error(-1); + ::fast_io::system_call_throw_error(-1); return {}; } for (auto const fc : para_pathname) { - if (fc == '/' || fc == '\\' || fc == '\t' || fc == '\b' || fc == '@' || fc == '#' || fc == '$' || fc == '%' || fc == '^' || fc == '&' || - fc == '*' || fc == '(' || fc == ')' || fc == '[' || fc == ']') [[unlikely]] + if (fc == u8'/' || fc == u8'\\' || fc == u8'\t' || fc == u8'\b' || fc == u8'@' || fc == u8'#' || fc == u8'$' || fc == u8'%' || fc == u8'^' || fc == u8'&' || + fc == u8'*' || fc == u8'(' || fc == u8')' || fc == u8'[' || fc == u8']') [[unlikely]] { - system_call_throw_error(-1); + ::fast_io::system_call_throw_error(-1); return {}; } } // concat - return ::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), "\\", para_pathname); + return ::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), ::fast_io::mnp::chvw(u8'\\'), para_pathname); } } inline void dos_renameat_impl(int olddirfd, char const *oldpath, int newdirfd, char const *newpath) { - system_call_throw_error(posix::my_dos_rename(my_dos_concat_path(olddirfd, oldpath).c_str(), - my_dos_concat_path(newdirfd, newpath).c_str())); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_rename(::fast_io::details::my_dos_concat_path(olddirfd, oldpath).c_str(), + ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); } inline void dos_linkat_impl(int olddirfd, char const *oldpath, int newdirfd, char const *newpath) { - system_call_throw_error(posix::my_dos_link(my_dos_concat_path(olddirfd, oldpath).c_str(), - my_dos_concat_path(newdirfd, newpath).c_str())); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_link(::fast_io::details::my_dos_concat_path(olddirfd, oldpath).c_str(), + ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); } template inline auto dos22_api_dispatcher(int olddirfd, char const *oldpath, int newdirfd, char const *newpath, Args... args) { - if constexpr (dsp == posix_api_22::renameat) + if constexpr (dsp == ::fast_io::details::posix_api_22::renameat) { dos_renameat_impl(olddirfd, oldpath, newdirfd, newpath, args...); } - else if constexpr (dsp == posix_api_22::linkat) + else if constexpr (dsp == ::fast_io::details::posix_api_22::linkat) { dos_linkat_impl(olddirfd, oldpath, newdirfd, newpath, args...); } @@ -182,13 +182,13 @@ inline auto dos22_api_dispatcher(int olddirfd, char const *oldpath, int newdirfd inline void dos_symlinkat_impl(char const *oldpath, int newdirfd, char const *newpath) { - system_call_throw_error(posix::my_dos_symlink(oldpath, my_dos_concat_path(newdirfd, newpath).c_str())); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_symlink(oldpath, ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); } template inline auto dos12_api_dispatcher(char const *oldpath, int newdirfd, char const *newpath, Args... args) { - if constexpr (dsp == posix_api_12::symlinkat) + if constexpr (dsp == ::fast_io::details::posix_api_12::symlinkat) { dos_symlinkat_impl(oldpath, newdirfd, newpath, args...); } @@ -196,42 +196,40 @@ inline auto dos12_api_dispatcher(char const *oldpath, int newdirfd, char const * inline void dos_faccessat_impl(int dirfd, char const *pathname, int flags) { - system_call_throw_error(posix::my_dos_access(my_dos_concat_path(dirfd, pathname).c_str(), flags)); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_access(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), flags)); } inline void dos_fchownat_impl(int dirfd, char const *pathname, uintmax_t owner, uintmax_t group) { // chown does nothing under MS-DOS, so just check is_valid filename - system_call_throw_error(posix::my_dos_chown(my_dos_concat_path(dirfd, pathname).c_str(), + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_chown(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), static_cast(owner), static_cast(group))); } inline void dos_fchmodat_impl(int dirfd, char const *pathname, mode_t mode) { - system_call_throw_error(posix::my_dos_chmod(my_dos_concat_path(dirfd, pathname).c_str(), mode)); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_chmod(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), mode)); } inline posix_file_status dos_fstatat_impl(int dirfd, char const *pathname) { struct stat buf; - system_call_throw_error(posix::my_dos_stat(my_dos_concat_path(dirfd, pathname).c_str(), __builtin_addressof(buf))); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_stat(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), __builtin_addressof(buf))); return ::fast_io::details::struct_stat_to_posix_file_status(buf); } inline void dos_mkdirat_impl(int dirfd, char const *pathname, mode_t mode) { - system_call_throw_error(posix::my_dos_mkdir(my_dos_concat_path(dirfd, pathname).c_str(), mode)); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_mkdir(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), mode)); } inline void dos_unlinkat_impl(int dirfd, char const *pathname) { - system_call_throw_error(posix::my_dos_unlink(my_dos_concat_path(dirfd, pathname).c_str())); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_unlink(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str())); } -namespace details -{ -inline constexpr time_t unix_timestamp_to_time_t(unix_timestamp stmp) noexcept +inline constexpr ::std::time_t unix_timestamp_to_time_t(unix_timestamp stmp) noexcept { return static_cast(static_cast<::std::time_t>(stmp.seconds)); } @@ -240,7 +238,7 @@ inline #if defined(UTIME_NOW) && defined(UTIME_OMIT) constexpr #endif - time_t + ::std::time_t unix_timestamp_to_time_t(unix_timestamp_option opt) noexcept { switch (opt.flags) @@ -251,12 +249,10 @@ inline throw_posix_error(EINVAL); ::fast_io::unreachable(); default: - return unix_timestamp_to_time_t(opt.timestamp); + return ::fast_io::details::unix_timestamp_to_time_t(opt.timestamp); } } -} // namespace details - inline void dos_utimensat_impl(int dirfd, char const *pathname, unix_timestamp_option creation_time, unix_timestamp_option last_access_time, unix_timestamp_option last_modification_time) { @@ -265,42 +261,42 @@ inline void dos_utimensat_impl(int dirfd, char const *pathname, unix_timestamp_o throw_posix_error(EINVAL); } - posix::utimbuf ts{ - details::unix_timestamp_to_time_t(last_access_time), - details::unix_timestamp_to_time_t(last_modification_time), + ::fast_io::posix::utimbuf ts{ + ::fast_io::details::unix_timestamp_to_time_t(last_access_time), + ::fast_io::details::unix_timestamp_to_time_t(last_modification_time), }; - system_call_throw_error(posix::my_dos_utime(my_dos_concat_path(dirfd, pathname).c_str(), __builtin_addressof(ts))); + ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_utime(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), __builtin_addressof(ts))); } template inline auto dos1x_api_dispatcher(int dirfd, char const *path, Args... args) { - if constexpr (dsp == posix_api_1x::faccessat) + if constexpr (dsp == ::fast_io::details::posix_api_1x::faccessat) { dos_faccessat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::fchownat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::fchownat) { dos_fchownat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::fchmodat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::fchmodat) { dos_fchmodat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::fstatat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::fstatat) { return dos_fstatat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::mkdirat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::mkdirat) { dos_mkdirat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::unlinkat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::unlinkat) { dos_unlinkat_impl(dirfd, path, args...); } - else if constexpr (dsp == posix_api_1x::utimensat) + else if constexpr (dsp == ::fast_io::details::posix_api_1x::utimensat) { dos_utimensat_impl(dirfd, path, args...); } @@ -310,10 +306,10 @@ template inline auto dos_deal_with22(int olddirfd, old_path_type const &oldpath, int newdirfd, new_path_type const &newpath, Args... args) { - return fast_io::posix_api_common( + return ::fast_io::posix_api_common( oldpath, [&](char const *oldpath_c_str) { - return fast_io::posix_api_common( + return ::fast_io::posix_api_common( newpath, [&](char const *newpath_c_str) { return dos22_api_dispatcher(olddirfd, oldpath_c_str, newdirfd, newpath_c_str, args...); }); }); } @@ -322,10 +318,10 @@ template inline auto dos_deal_with12(old_path_type const &oldpath, int newdirfd, new_path_type const &newpath, Args... args) { - return fast_io::posix_api_common( + return ::fast_io::posix_api_common( oldpath, [&](char const *oldpath_c_str) { - return fast_io::posix_api_common( + return ::fast_io::posix_api_common( newpath, [&](char const *newpath_c_str) { return dos12_api_dispatcher(oldpath_c_str, newdirfd, newpath_c_str, args...); }); }); } @@ -333,7 +329,7 @@ inline auto dos_deal_with12(old_path_type const &oldpath, int newdirfd, new_path template inline auto dos_deal_with1x(int dirfd, path_type const &path, Args... args) { - return fast_io::posix_api_common(path, [&](char const *path_c_str) { return dos1x_api_dispatcher(dirfd, path_c_str, args...); }); + return ::fast_io::posix_api_common(path, [&](char const *path_c_str) { return dos1x_api_dispatcher(dirfd, path_c_str, args...); }); } } // namespace details @@ -342,40 +338,40 @@ template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constru inline void dos_renameat(posix_at_entry oldent, old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with22(oldent.fd, oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::renameat>(oldent.fd, oldpath, newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str new_path_type> inline void dos_renameat(posix_fs_dirent fs_dirent, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with22( + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::renameat>( fs_dirent.fd, ::fast_io::manipulators::os_c_str(fs_dirent.filename), newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constructible_to_os_c_str new_path_type> inline void dos_symlinkat(old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with12(oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with12<::fast_io::details::posix_api_12::symlinkat>(oldpath, newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constructible_to_os_c_str new_path_type> inline void native_renameat(posix_at_entry oldent, old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with22(oldent.fd, oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::renameat>(oldent.fd, oldpath, newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str new_path_type> inline void native_renameat(posix_fs_dirent fs_dirent, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with22( + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::renameat>( fs_dirent.fd, ::fast_io::manipulators::os_c_str(fs_dirent.filename), newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constructible_to_os_c_str new_path_type> inline void native_symlinkat(old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath) { - details::dos_deal_with12(oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with12<::fast_io::details::posix_api_12::symlinkat>(oldpath, newent.fd, newpath); } @@ -383,94 +379,94 @@ template <::fast_io::constructible_to_os_c_str path_type> inline void dos_faccessat(posix_at_entry ent, path_type const &path, [[maybe_unused]] access_how mode, dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, static_cast(flags)); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::faccessat>(ent.fd, path, static_cast(flags)); } template <::fast_io::constructible_to_os_c_str path_type> inline void native_faccessat(posix_at_entry ent, path_type const &path, [[maybe_unused]] access_how mode, dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, static_cast(flags)); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::faccessat>(ent.fd, path, static_cast(flags)); } template <::fast_io::constructible_to_os_c_str path_type> inline void dos_fchmodat(posix_at_entry ent, path_type const &path, perms mode, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, static_cast(mode)); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fchmodat>(ent.fd, path, static_cast(mode)); } template <::fast_io::constructible_to_os_c_str path_type> inline void native_fchmodat(posix_at_entry ent, path_type const &path, perms mode, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, static_cast(mode)); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fchmodat>(ent.fd, path, static_cast(mode)); } template <::fast_io::constructible_to_os_c_str path_type> inline void dos_fchownat(posix_at_entry ent, path_type const &path, ::std::uintmax_t owner, ::std::uintmax_t group, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, owner, group); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fchownat>(ent.fd, path, owner, group); } template <::fast_io::constructible_to_os_c_str path_type> inline void native_fchownat(posix_at_entry ent, path_type const &path, ::std::uintmax_t owner, ::std::uintmax_t group, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, owner, group); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fchownat>(ent.fd, path, owner, group); } template <::fast_io::constructible_to_os_c_str path_type> inline posix_file_status dos_fstatat(posix_at_entry ent, path_type const &path, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - return details::dos_deal_with1x(ent.fd, path); + return ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fstatat>(ent.fd, path); } template <::fast_io::constructible_to_os_c_str path_type> inline posix_file_status native_fstatat(posix_at_entry ent, path_type const &path, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - return details::dos_deal_with1x(ent.fd, path); + return ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::fstatat>(ent.fd, path); } template <::fast_io::constructible_to_os_c_str path_type> inline void dos_mkdirat(posix_at_entry ent, path_type const &path, perms perm = static_cast(509)) { - return details::dos_deal_with1x(ent.fd, path, static_cast(perm)); + return ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::mkdirat>(ent.fd, path, static_cast(perm)); } template <::fast_io::constructible_to_os_c_str path_type> inline void native_mkdirat(posix_at_entry ent, path_type const &path, perms perm = static_cast(509)) { - return details::dos_deal_with1x(ent.fd, path, static_cast(perm)); + return ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::mkdirat>(ent.fd, path, static_cast(perm)); } template <::fast_io::constructible_to_os_c_str path_type> inline void dos_unlinkat(posix_at_entry ent, path_type const &path, [[maybe_unused]] dos_at_flags flags = {}) { - details::dos_deal_with1x(ent.fd, path); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::unlinkat>(ent.fd, path); } template <::fast_io::constructible_to_os_c_str path_type> inline void native_unlinkat(posix_at_entry ent, path_type const &path, [[maybe_unused]] dos_at_flags flags = {}) { - details::dos_deal_with1x(ent.fd, path); + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::unlinkat>(ent.fd, path); } template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constructible_to_os_c_str new_path_type> inline void dos_linkat(posix_at_entry oldent, old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with22(oldent.fd, oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::linkat>(oldent.fd, oldpath, newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str old_path_type, ::fast_io::constructible_to_os_c_str new_path_type> inline void native_linkat(posix_at_entry oldent, old_path_type const &oldpath, posix_at_entry newent, new_path_type const &newpath, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with22(oldent.fd, oldpath, newent.fd, newpath); + ::fast_io::details::dos_deal_with22<::fast_io::details::posix_api_22::linkat>(oldent.fd, oldpath, newent.fd, newpath); } template <::fast_io::constructible_to_os_c_str path_type> @@ -478,7 +474,7 @@ inline void dos_utimensat(posix_at_entry ent, path_type const &path, unix_timest unix_timestamp_option last_access_time, unix_timestamp_option last_modification_time, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, creation_time, last_access_time, + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::utimensat>(ent.fd, path, creation_time, last_access_time, last_modification_time); } @@ -487,7 +483,7 @@ inline void native_utimensat(posix_at_entry ent, path_type const &path, unix_tim unix_timestamp_option last_access_time, unix_timestamp_option last_modification_time, [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { - details::dos_deal_with1x(ent.fd, path, creation_time, last_access_time, + ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::utimensat>(ent.fd, path, creation_time, last_access_time, last_modification_time); } diff --git a/include/fast_io_hosted/platforms/posix.h b/include/fast_io_hosted/platforms/posix.h index db8a7dfb8..5e4cc10a0 100644 --- a/include/fast_io_hosted/platforms/posix.h +++ b/include/fast_io_hosted/platforms/posix.h @@ -821,11 +821,11 @@ inline int open_fd_from_handle(void *handle, open_mode md) #else #if defined(__DARWIN_C_LEVEL) || defined(__MSDOS__) -extern unsigned int my_posix_open_noexcept(const char *pathname, int flags) noexcept __asm__("_open"); -extern unsigned int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("_open"); +extern int my_posix_open_noexcept(char const *pathname, int flags) noexcept __asm__("_open"); +extern int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("_open"); #else -extern unsigned int my_posix_open_noexcept(const char *pathname, int flags) noexcept __asm__("open"); -extern unsigned int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("open"); +extern int my_posix_open_noexcept(char const* pathname, int flags) noexcept __asm__("open"); +extern int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("open"); #endif #if defined(__MSDOS__) @@ -872,8 +872,8 @@ inline int my_posix_openat(int dirfd, char const *pathname, int flags, mode_t mo } // concat - ::fast_io::tlc::string pn{::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), "\\", para_pathname)}; - int fd{my_posix_open_noexcept(pn.c_str(), flags, mode)}; + ::fast_io::tlc::string pn{::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), ::fast_io::mnp::chvw(u8'\\'), para_pathname)}; + int fd{::fast_io::details::my_posix_open_noexcept(pn.c_str(), flags, mode)}; system_call_throw_error(fd); return fd; } @@ -976,17 +976,17 @@ inline int my_posix_open(char const *pathname, int flags, mode_t mode) { #if defined(__MSDOS__) || (defined(__NEWLIB__) && !defined(AT_FDCWD)) || defined(_PICOLIBC__) - int fd{my_posix_open_noexcept(pathname, flags, mode)}; - system_call_throw_error(fd); + int fd{::fast_io::details::my_posix_open_noexcept(pathname, flags, mode)}; + ::fast_io::system_call_throw_error(fd); return fd; #else - return my_posix_openat(AT_FDCWD, pathname, flags, mode); + return ::fast_io::details::my_posix_openat(AT_FDCWD, pathname, flags, mode); #endif } inline int my_posix_openat_file_internal_impl(int dirfd, char const *filepath, open_mode om, perms pm) { - return my_posix_openat(dirfd, filepath, details::calculate_posix_open_mode(om), static_cast(pm)); + return ::fast_io::details::my_posix_openat(dirfd, filepath, ::fast_io::details::calculate_posix_open_mode(om), static_cast(pm)); } struct my_posix_at_open_paramter From 692e8bb37efc1c7bc3ea66751739172c729e4b76 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 1 Mar 2025 00:41:52 -0500 Subject: [PATCH 47/51] [DOS] openat functions use a common implementation instead of template them merge duplicate code in filesystem and posix for dos --- include/fast_io_core_impl/char_category.h | 64 +++++++++++++++++++ include/fast_io_hosted/filesystem/dos_at.h | 52 ++++++++++------ include/fast_io_hosted/platforms/posix.h | 72 +++++----------------- 3 files changed, 113 insertions(+), 75 deletions(-) diff --git a/include/fast_io_core_impl/char_category.h b/include/fast_io_core_impl/char_category.h index 8d64e0b9b..cb10d7b32 100644 --- a/include/fast_io_core_impl/char_category.h +++ b/include/fast_io_core_impl/char_category.h @@ -2030,6 +2030,44 @@ inline constexpr bool is_html_whitespace_wide_impl(wchar_t ch) noexcept }; } +inline constexpr bool is_dos_path_invalid_character_impl(char32_t ch) noexcept +{ + switch (ch) + { + case U'/': + case U'\\': + case U'\t': + case U'\b': + case U'@': + case U'#': + case U'$': + case U'%': + case U'^': + case U'&': + case U'*': + case U'(': + case U')': + case U'[': + case U']': + return true; + default: + return false; + } +} + +inline constexpr bool is_dos_path_invalid_prefix_character_impl(char32_t ch) noexcept +{ + switch (ch) + { + case U'+': + case U'-': + case U'.': + return true; + default: + return false; + } +} + } // namespace details template <::std::integral char_type> @@ -2165,6 +2203,32 @@ inline constexpr char_type to_c_halfwidth(char_type ch) noexcept } } +template <::std::integral T> +inline constexpr bool is_dos_path_invalid_character(T ch) noexcept +{ + if constexpr (::std::signed_integral) + { + return ::fast_io::char_category::details::is_dos_path_invalid_character_impl(static_cast(static_cast<::std::make_unsigned_t>(ch))); + } + else + { + return ::fast_io::char_category::details::is_dos_path_invalid_character_impl(static_cast(ch)); + } +} + +template <::std::integral T> +inline constexpr bool is_dos_path_invalid_prefix_character(T ch) noexcept +{ + if constexpr (::std::signed_integral) + { + return ::fast_io::char_category::details::is_dos_path_invalid_prefix_character_impl(static_cast(static_cast<::std::make_unsigned_t>(ch))); + } + else + { + return ::fast_io::char_category::details::is_dos_path_invalid_prefix_character_impl(static_cast(ch)); + } +} + } // namespace fast_io::char_category namespace fast_io diff --git a/include/fast_io_hosted/filesystem/dos_at.h b/include/fast_io_hosted/filesystem/dos_at.h index 466a2b192..535c0de92 100644 --- a/include/fast_io_hosted/filesystem/dos_at.h +++ b/include/fast_io_hosted/filesystem/dos_at.h @@ -110,61 +110,73 @@ inline constexpr dos_at_flags &operator^=(dos_at_flags &x, dos_at_flags y) noexc namespace details { -template -inline ::fast_io::tlc::string my_dos_concat_path(int dirfd, char const *pathname) + +struct my_dos_concat_path_common_result +{ + bool failed{}; + ::fast_io::tlc::string path; +}; + +inline my_dos_concat_path_common_result my_dos_concat_path_common(int dirfd, char const *pathname) noexcept { if (dirfd == -100) { - return ::fast_io::tlc::string{::fast_io::mnp::os_c_str(pathname)}; + return {false, ::fast_io::tlc::string(::fast_io::mnp::os_c_str(pathname))}; } else { auto pathname_cstr{::fast_io::noexcept_call(::__get_fd_name, dirfd)}; if (pathname_cstr == nullptr) [[unlikely]] { - ::fast_io::system_call_throw_error(-1); - return {}; + return {true}; } // check vaildity ::fast_io::cstring_view para_pathname{::fast_io::mnp::os_c_str(pathname)}; if (auto const sz{para_pathname.size()}; sz == 0 || sz > 255) [[unlikely]] { - ::fast_io::system_call_throw_error(-1); - return {}; + return {true}; } - if (auto const fc{para_pathname.front_unchecked()}; fc == u8'+' || fc == u8'-' || fc == u8'.') [[unlikely]] + if (auto const fc{para_pathname.front_unchecked()}; ::fast_io::char_category::is_dos_path_invalid_prefix_character(fc)) [[unlikely]] { - ::fast_io::system_call_throw_error(-1); - return {}; + return {true}; } for (auto const fc : para_pathname) { - if (fc == u8'/' || fc == u8'\\' || fc == u8'\t' || fc == u8'\b' || fc == u8'@' || fc == u8'#' || fc == u8'$' || fc == u8'%' || fc == u8'^' || fc == u8'&' || - fc == u8'*' || fc == u8'(' || fc == u8')' || fc == u8'[' || fc == u8']') [[unlikely]] + if (::fast_io::char_category::is_dos_path_invalid_character(fc)) [[unlikely]] { - ::fast_io::system_call_throw_error(-1); - return {}; + return {true}; } } // concat - return ::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), ::fast_io::mnp::chvw(u8'\\'), para_pathname); + return {false, ::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), ::fast_io::mnp::chvw(u8'\\'), para_pathname)}; + } +} + +template +inline ::fast_io::tlc::string my_dos_concat_path(int dirfd, char const *pathname) noexcept(always_terminate) +{ + auto [failed, path] = ::fast_io::details::my_dos_concat_path_common(dirfd, pathname); + if (failed) [[unlikely]] + { + ::fast_io::system_call_throw_error(-1); } + return ::std::move(path); } inline void dos_renameat_impl(int olddirfd, char const *oldpath, int newdirfd, char const *newpath) { ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_rename(::fast_io::details::my_dos_concat_path(olddirfd, oldpath).c_str(), - ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); + ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); } inline void dos_linkat_impl(int olddirfd, char const *oldpath, int newdirfd, char const *newpath) { ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_link(::fast_io::details::my_dos_concat_path(olddirfd, oldpath).c_str(), - ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); + ::fast_io::details::my_dos_concat_path(newdirfd, newpath).c_str())); } template @@ -203,7 +215,7 @@ inline void dos_fchownat_impl(int dirfd, char const *pathname, uintmax_t owner, { // chown does nothing under MS-DOS, so just check is_valid filename ::fast_io::system_call_throw_error(::fast_io::posix::my_dos_chown(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), - static_cast(owner), static_cast(group))); + static_cast(owner), static_cast(group))); } inline void dos_fchmodat_impl(int dirfd, char const *pathname, mode_t mode) @@ -475,7 +487,7 @@ inline void dos_utimensat(posix_at_entry ent, path_type const &path, unix_timest [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::utimensat>(ent.fd, path, creation_time, last_access_time, - last_modification_time); + last_modification_time); } template <::fast_io::constructible_to_os_c_str path_type> @@ -484,7 +496,7 @@ inline void native_utimensat(posix_at_entry ent, path_type const &path, unix_tim [[maybe_unused]] dos_at_flags flags = dos_at_flags::symlink_nofollow) { ::fast_io::details::dos_deal_with1x<::fast_io::details::posix_api_1x::utimensat>(ent.fd, path, creation_time, last_access_time, - last_modification_time); + last_modification_time); } } // namespace fast_io diff --git a/include/fast_io_hosted/platforms/posix.h b/include/fast_io_hosted/platforms/posix.h index 5e4cc10a0..7a3adabe6 100644 --- a/include/fast_io_hosted/platforms/posix.h +++ b/include/fast_io_hosted/platforms/posix.h @@ -824,59 +824,21 @@ inline int open_fd_from_handle(void *handle, open_mode md) extern int my_posix_open_noexcept(char const *pathname, int flags) noexcept __asm__("_open"); extern int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("_open"); #else -extern int my_posix_open_noexcept(char const* pathname, int flags) noexcept __asm__("open"); +extern int my_posix_open_noexcept(char const *pathname, int flags) noexcept __asm__("open"); extern int my_posix_open_noexcept(char const *pathname, int flags, mode_t mode) noexcept __asm__("open"); #endif #if defined(__MSDOS__) + +template +inline ::fast_io::tlc::string my_dos_concat_path(int, char const *) noexcept(always_terminate); + template inline int my_posix_openat(int dirfd, char const *pathname, int flags, mode_t mode) { - if (dirfd == -100) - { - int fd(my_posix_open_noexcept(pathname, flags, mode)); - system_call_throw_error(fd); - return fd; - } - else - { - auto pathname_cstr{::fast_io::noexcept_call(::__get_fd_name, dirfd)}; - if (pathname_cstr == nullptr) [[unlikely]] - { - system_call_throw_error(-1); - return -1; - } - - // check vaildity - ::fast_io::cstring_view para_pathname{::fast_io::mnp::os_c_str(pathname)}; - if (auto const sz{para_pathname.size()}; sz == 0 || sz > 255) [[unlikely]] - { - system_call_throw_error(-1); - return -1; - } - - if (auto const fc{para_pathname.front_unchecked()}; fc == '+' || fc == '-' || fc == '.') [[unlikely]] - { - system_call_throw_error(-1); - return -1; - } - - for (auto const fc : para_pathname) - { - if (fc == '/' || fc == '\\' || fc == '\t' || fc == '\b' || fc == '@' || fc == '#' || fc == '$' || fc == '%' || fc == '^' || fc == '&' || - fc == '*' || fc == '(' || fc == ')' || fc == '[' || fc == ']') [[unlikely]] - { - system_call_throw_error(-1); - return -1; - } - } - - // concat - ::fast_io::tlc::string pn{::fast_io::tlc::concat_fast_io_tlc(::fast_io::mnp::os_c_str(pathname_cstr), ::fast_io::mnp::chvw(u8'\\'), para_pathname)}; - int fd{::fast_io::details::my_posix_open_noexcept(pn.c_str(), flags, mode)}; - system_call_throw_error(fd); - return fd; - } + int fd{::fast_io::details::my_posix_open_noexcept(::fast_io::details::my_dos_concat_path(dirfd, pathname).c_str(), flags, mode)}; + system_call_throw_error(fd); + return fd; } #elif defined(__NEWLIB__) || defined(_PICOLIBC__) @@ -996,7 +958,7 @@ struct my_posix_at_open_paramter mode_t pm{}; inline int operator()(char const *filename) const { - return my_posix_openat(dirfd, filename, om, pm); + return ::fast_io::details::my_posix_openat(dirfd, filename, om, pm); } }; @@ -1096,7 +1058,7 @@ struct { if (fd != -1) [[likely]] { - details::sys_close(fd); + ::fast_io::details::sys_close(fd); } } }; @@ -1120,7 +1082,7 @@ class basic_posix_family_file : public basic_posix_family_io_observer piob) - : basic_posix_family_io_observer{details::sys_dup(piob.fd)} + : basic_posix_family_io_observer{::fast_io::details::sys_dup(piob.fd)} { } inline explicit constexpr basic_posix_family_file(posix_file_factory &&factory) noexcept @@ -1227,7 +1189,7 @@ class basic_posix_family_file : public basic_posix_family_io_observer) noexcept = delete; inline basic_posix_family_file(basic_posix_family_file const &dp) - : basic_posix_family_io_observer{details::sys_dup(dp.fd)} + : basic_posix_family_io_observer{::fast_io::details::sys_dup(dp.fd)} {} inline basic_posix_family_file &operator=(basic_posix_family_file const &dp) { @@ -1235,7 +1197,7 @@ class basic_posix_family_file : public basic_posix_family_io_observerfd = details::sys_dup2(dp.fd, this->fd); + this->fd = ::fast_io::details::sys_dup2(dp.fd, this->fd); return *this; } inline constexpr basic_posix_family_file(basic_posix_family_file &&__restrict b) noexcept @@ -1251,7 +1213,7 @@ class basic_posix_family_file : public basic_posix_family_io_observerfd != -1) [[likely]] { - details::sys_close(this->fd); + ::fast_io::details::sys_close(this->fd); } this->fd = b.fd; b.fd = -1; @@ -1261,7 +1223,7 @@ class basic_posix_family_file : public basic_posix_family_io_observerfd != -1) [[likely]] { - details::sys_close(this->fd); + ::fast_io::details::sys_close(this->fd); } this->fd = newfd; } @@ -1269,14 +1231,14 @@ class basic_posix_family_file : public basic_posix_family_io_observerfd != -1) [[likely]] { - details::sys_close_throw_error(this->fd); + ::fast_io::details::sys_close_throw_error(this->fd); } } inline ~basic_posix_family_file() { if (this->fd != -1) [[likely]] { - details::sys_close(this->fd); + ::fast_io::details::sys_close(this->fd); } } }; From a684e38c09398668736c0194f761f462e450749c Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 1 Mar 2025 00:54:13 -0500 Subject: [PATCH 48/51] [DOS] Fix Warnings under -Wall -Wextra -Wpedantic -Wmisleading-indentation -Wunused -Wuninitialized -Wshadow -Wconversion --- include/fast_io_hosted/filesystem/dos.h | 4 ++-- include/fast_io_hosted/filesystem/dos_at.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fast_io_hosted/filesystem/dos.h b/include/fast_io_hosted/filesystem/dos.h index 44a025c46..97b9d3ceb 100644 --- a/include/fast_io_hosted/filesystem/dos.h +++ b/include/fast_io_hosted/filesystem/dos.h @@ -64,7 +64,7 @@ inline DIR *my_dos_fdopendir(int fd) noexcept { return my_dos_opendir(::fast_io::noexcept_call(::__get_fd_name, fd)); } -} // namespace details +} // namespace posix namespace details { @@ -245,7 +245,7 @@ inline ::fast_io::manipulators::basic_os_c_str_with_known_size u8filena return {reinterpret_cast(pioe.entry->d_name), pioe.d_namlen}; } -inline constexpr ::std::uint_least64_t inode_ul64(dos_directory_entry pioe) noexcept +inline constexpr ::std::uint_least64_t inode_ul64(dos_directory_entry) noexcept { return 0; } diff --git a/include/fast_io_hosted/filesystem/dos_at.h b/include/fast_io_hosted/filesystem/dos_at.h index 535c0de92..9705db5ad 100644 --- a/include/fast_io_hosted/filesystem/dos_at.h +++ b/include/fast_io_hosted/filesystem/dos_at.h @@ -114,7 +114,7 @@ namespace details struct my_dos_concat_path_common_result { bool failed{}; - ::fast_io::tlc::string path; + ::fast_io::tlc::string path = ::fast_io::tlc::string(); }; inline my_dos_concat_path_common_result my_dos_concat_path_common(int dirfd, char const *pathname) noexcept From 72a6d11252d01cce92bcbe7960d1e8eab8de3cc5 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Wed, 5 Mar 2025 11:46:40 -0500 Subject: [PATCH 49/51] linker? --- include/fast_io_core_impl/allocation/msvc/impl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/fast_io_core_impl/allocation/msvc/impl.h b/include/fast_io_core_impl/allocation/msvc/impl.h index 45b0b4179..df20714f0 100644 --- a/include/fast_io_core_impl/allocation/msvc/impl.h +++ b/include/fast_io_core_impl/allocation/msvc/impl.h @@ -3,7 +3,6 @@ #if SIZE_MAX > UINT_LEAST32_MAX #include "msvc_linker_64.h" #if defined(__arm64ec__) || defined(_M_ARM64EC) -#error "We do not support ARM64EC. See reasons: https://github.com/trcrsired/Why-Microsoft-ARM64EC-ABI-MUST-DIE/blob/main/README.md" #include "msvc_linker_arm64ec.h" #endif #elif defined(__x86__) || defined(_M_IX86) || defined(__i386__) From 0b620312ca12242b76e5ca039653287723aa5922 Mon Sep 17 00:00:00 2001 From: trcrsired Date: Fri, 14 Mar 2025 09:05:45 -0400 Subject: [PATCH 50/51] revert changes of wincrt --- include/fast_io_legacy_impl/c/wincrt.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/include/fast_io_legacy_impl/c/wincrt.h b/include/fast_io_legacy_impl/c/wincrt.h index 2697420aa..066e64740 100644 --- a/include/fast_io_legacy_impl/c/wincrt.h +++ b/include/fast_io_legacy_impl/c/wincrt.h @@ -213,22 +213,11 @@ inline void wincrt_fp_write_cold_normal_case_impl(FILE *__restrict fpp, char con #endif inline void wincrt_fp_write_cold_impl(FILE *__restrict fp, char const *first, char const *last) { - crt_iobuf *fpp{reinterpret_cast(fp)}; - ::std::size_t diff{static_cast<::std::size_t>(last - first)}; - + crt_iobuf *fpp{reinterpret_cast(fp)}; if (fpp->_base == nullptr) { - // The behavior of stdout and stderr on wincrt is consistent, and there is no line buffer - // stdout and stderr will not default to malloc buffer, but will use the existing buffer - if (auto const fd{fpp->_file}; fd == 1 || fd == 2) - { - ::fast_io::details::posix_write_bytes_impl(fd, reinterpret_cast<::std::byte const *>(first), reinterpret_cast<::std::byte const *>(last)); - } - else - { - wincrt_fp_write_cold_malloc_case_impl(fp, first, diff); - } + wincrt_fp_write_cold_malloc_case_impl(fp, first, diff); } else { From 8c878da5ba821c0394c23a7e460949e6f651b81a Mon Sep 17 00:00:00 2001 From: trcrsired Date: Sat, 22 Mar 2025 05:19:53 -0400 Subject: [PATCH 51/51] fix up musl bug? --- include/fast_io_hosted/timeutil/time.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/fast_io_hosted/timeutil/time.h b/include/fast_io_hosted/timeutil/time.h index 7f1bd0557..2fc913d9d 100644 --- a/include/fast_io_hosted/timeutil/time.h +++ b/include/fast_io_hosted/timeutil/time.h @@ -11,10 +11,16 @@ extern int libc_clock_getres(clockid_t clk_id, struct timespec *tp) noexcept __a extern int libc_clock_settime(clockid_t clk_id, struct timespec const *tp) noexcept __asm__("_clock_settime"); extern int libc_clock_gettime(clockid_t clk_id, struct timespec *tp) noexcept __asm__("_clock_gettime"); #else +#if _REDIR_TIME64 +extern int libc_clock_getres(clockid_t clk_id, struct timespec *tp) noexcept __asm__("__clock_getres64"); +extern int libc_clock_settime(clockid_t clk_id, struct timespec const *tp) noexcept __asm__("__clock_settime64"); +extern int libc_clock_gettime(clockid_t clk_id, struct timespec *tp) noexcept __asm__("__clock_gettime64"); +#else extern int libc_clock_getres(clockid_t clk_id, struct timespec *tp) noexcept __asm__("clock_getres"); extern int libc_clock_settime(clockid_t clk_id, struct timespec const *tp) noexcept __asm__("clock_settime"); extern int libc_clock_gettime(clockid_t clk_id, struct timespec *tp) noexcept __asm__("clock_gettime"); #endif +#endif #elif defined(__MSDOS__) struct tm *libc_localtime_r(::std::time_t const *timep, struct tm *result) noexcept #ifdef __MSDOS__ @@ -644,6 +650,7 @@ inline unix_timestamp posix_clock_gettime([[maybe_unused]] posix_clock_id pclk_i { throw_posix_error(); } + constexpr ::std::uint_least64_t mul_factor{uint_least64_subseconds_per_second / 1000000000u}; return {static_cast<::std::int_least64_t>(res.tv_sec), static_cast<::std::uint_least64_t>(res.tv_nsec) * mul_factor};