30 _ASSERTE((
"Invalid file descriptor. File possibly closed by a different thread", 0));
38 __crt_cached_ptd_host
ptd;
72 if (seek_guard.
place == -1 || seek_guard.
end == -1)
83 __crt_unique_heap_ptr<char>
const zero_buffer(_calloc_crt_t(
char,
_INTERNAL_BUFSIZ));
95 :
static_cast<int>(seek_guard.
extend);
97 int const bytes_written =
_write_nolock(fh, zero_buffer.get(), bytes_to_write,
ptd);
98 if (bytes_written == -1)
106 return ptd.get_errno().value_or(0);
109 seek_guard.
extend -= bytes_written;
110 }
while (seek_guard.
extend > 0);
112#pragma warning(suppress:6031)
115 else if (seek_guard.
extend < 0)
121 return ptd.get_errno().value_or(0);
137 __crt_cached_ptd_host
ptd;
static errno_t __cdecl _chsize_s_internal(int const fh, __int64 const size, __crt_cached_ptd_host &ptd)
int __cdecl _chsize(int const fh, long const size)
errno_t __cdecl _chsize_s(int const fh, __int64 const size)
errno_t __cdecl _chsize_nolock(int const fh, __int64 const size)
errno_t __cdecl _chsize_nolock_internal(int const fh, __int64 const size, __crt_cached_ptd_host &ptd)
_Check_return_ int __cdecl _write_nolock(_In_ int _FileHandle, _In_reads_bytes_(_MaxCharCount) const void *_Buf, _In_ unsigned int _MaxCharCount, __crt_cached_ptd_host &_Ptd)
_Check_return_ int __cdecl _setmode_nolock(_In_ int _FileHandle, _In_ int _Mode)
auto __acrt_lowio_lock_fh_and_call(int const fh, Action &&action) -> decltype(action())
_Check_return_opt_ __int64 __cdecl _lseeki64_nolock(_In_ int _FileHandle, _In_ __int64 _Offset, _In_ int _Origin)
#define _UCRT_CHECK_FH_CLEAR_OSSERR_RETURN_ERRCODE(ptd, handle, retexpr)
#define _UCRT_VALIDATE_CLEAR_OSSERR_RETURN_ERRCODE(ptd, expr, errorcode)
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
#define ERROR_ACCESS_DENIED
BOOL WINAPI SetEndOfFile(HANDLE hFile)
_CRTIMP intptr_t __cdecl _get_osfhandle(_In_ int _FileHandle)
__crt_seek_guard(__crt_seek_guard const &)=delete
__crt_seek_guard(int const fh, __int64 const size)
__crt_seek_guard & operator=(__crt_seek_guard const &)=delete
DWORD WINAPI GetLastError(void)