diff options
author | George Hazan <ghazan@miranda.im> | 2022-01-10 18:12:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-01-10 18:12:15 +0300 |
commit | dcaae5dea7a22183576ee6ce3045cacab085a56c (patch) | |
tree | 8b5edf03e7a8c8fa2e3d74ab54de2932fb6566d8 /plugins/PluginUpdater/src/DlgListNew.cpp | |
parent | 26b0b0cc55d29b549bd364e622e95c55ef6ea24d (diff) |
PU::IsMirandaFolderWritable - core function to detect if need to draw a shield on buttons that require escalation
Diffstat (limited to 'plugins/PluginUpdater/src/DlgListNew.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/DlgListNew.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp index 8dcbc35592..bcc050163f 100644 --- a/plugins/PluginUpdater/src/DlgListNew.cpp +++ b/plugins/PluginUpdater/src/DlgListNew.cpp @@ -129,21 +129,8 @@ public: ImageList_AddIconFromIconLib(hIml, IDI_INFO);
m_list.SetImageList(hIml, LVSIL_SMALL);
- if (IsWinVer7Plus()) {
- TFileName szPath;
- GetModuleFileNameW(nullptr, szPath, _countof(szPath));
- wchar_t *ext = wcsrchr(szPath, '.');
- if (ext != nullptr)
- *ext = '\0';
- wcscat(szPath, L".test");
- HANDLE hFile = CreateFileW(szPath, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
- if (hFile == INVALID_HANDLE_VALUE)
- Button_SetElevationRequiredState(GetDlgItem(m_hwnd, IDOK), !PU::IsProcessElevated());
- else {
- CloseHandle(hFile);
- DeleteFile(szPath);
- }
- }
+ if (!PU::IsMirandaFolderWritable())
+ Button_SetElevationRequiredState(GetDlgItem(m_hwnd, IDOK), !PU::IsProcessElevated());
//////////////////////////////////////////////////////////////////////////////////////
LVCOLUMN lvc = { 0 };
|