diff options
author | George Hazan <george.hazan@gmail.com> | 2024-09-29 20:20:39 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-09-29 20:20:39 +0300 |
commit | 35d047b7c37ce46c63f3c349220a594b45ec1a1c (patch) | |
tree | 47856ecd961b1be4868956548f0464f6ee596b36 /protocols/Telegram | |
parent | cebfc5c8facbf6ae335499f7f4b3dc57a60af999 (diff) |
compilation fix
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/tdlib/td/tdutils/td/utils/port/FileFd.cpp | 16 | ||||
-rw-r--r-- | protocols/Telegram/tdlib/td/tdutils/td/utils/port/FromApp.h | 7 |
2 files changed, 5 insertions, 18 deletions
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> 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<Stat> 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); |