From 35d047b7c37ce46c63f3c349220a594b45ec1a1c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 29 Sep 2024 20:20:39 +0300 Subject: compilation fix --- .../Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp | 16 +++++----------- .../Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h | 7 ------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'protocols') diff --git a/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp b/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp index 23f7f33d2b..24091e7726 100644 --- a/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp +++ b/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp @@ -224,18 +224,10 @@ Result FileFd::open(CSlice filepath, int32 flags, int32 mode) { if (flags & WinStat) { native_flags |= FILE_FLAG_BACKUP_SEMANTICS; } -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) + auto handle = CreateFile(w_filepath.c_str(), desired_access, share_mode, nullptr, creation_disposition, native_flags, nullptr); -#else - CREATEFILE2_EXTENDED_PARAMETERS extended_parameters; - std::memset(&extended_parameters, 0, sizeof(extended_parameters)); - extended_parameters.dwSize = sizeof(extended_parameters); - extended_parameters.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - extended_parameters.dwFileFlags = native_flags; - auto handle = td::CreateFile2FromAppW(w_filepath.c_str(), desired_access, share_mode, creation_disposition, - &extended_parameters); -#endif + if (handle == INVALID_HANDLE_VALUE) { return OS_ERROR(PSLICE() << "File \"" << filepath << "\" can't be " << PrintFlags{flags}); } @@ -603,7 +595,9 @@ Result FileFd::stat() const { #elif TD_PORT_WINDOWS Stat res; - FILE_BASIC_INFO basic_info; + struct __boo : public FILE_BASIC_INFO { + DWORD __tmp; + } basic_info; auto status = GetFileInformationByHandleEx(get_native_fd().fd(), FileBasicInfo, &basic_info, sizeof(basic_info)); if (!status) { return OS_ERROR("Get FileBasicInfo failed"); diff --git a/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h b/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h index 23125b6c81..864cb4aac3 100644 --- a/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h +++ b/protocols/Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h @@ -53,13 +53,6 @@ T *get_from_app_function(const char *name, T *original_func) { #endif } -inline HANDLE CreateFile2FromAppW(_In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, - _In_ DWORD dwCreationDisposition, - _In_opt_ LPCREATEFILE2_EXTENDED_PARAMETERS pCreateExParams) { - auto func = get_from_app_function<0>("CreateFile2FromAppW", &CreateFile2); - return func(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, pCreateExParams); -} - inline BOOL CreateDirectoryFromAppW(_In_ LPCWSTR lpPathName, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes) { auto func = get_from_app_function<1>("CreateDirectoryFromAppW", &CreateDirectory); return func(lpPathName, lpSecurityAttributes); -- cgit v1.2.3