summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-05-27 16:21:17 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-05-27 16:21:17 +0300
commit189f6be24f11066a3c711b783cf98f79f703e3a5 (patch)
tree3acf7a0cf990f574d9edb0f8045b605d8e3ec024 /plugins
parente3179c1ef509482ff9b4c7d4fb89d0b208e84000 (diff)
as well as calls of GetVersionEx should be removed
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CryptoPP/src/GPGw/pipeexec.cpp215
-rw-r--r--plugins/HistoryStats/src/bandctrlimpl.cpp7
-rw-r--r--plugins/HistoryStats/src/dlgoption_subexclude.cpp2
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl.cpp2
-rw-r--r--plugins/HistoryStats/src/utils.cpp14
-rw-r--r--plugins/HistoryStats/src/utils.h4
-rw-r--r--plugins/KeyboardNotify/src/main.cpp14
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp57
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp17
-rw-r--r--plugins/Variables/src/enumprocs.cpp37
10 files changed, 144 insertions, 225 deletions
diff --git a/plugins/CryptoPP/src/GPGw/pipeexec.cpp b/plugins/CryptoPP/src/GPGw/pipeexec.cpp
index 3a04fd1697..f892c207a4 100644
--- a/plugins/CryptoPP/src/GPGw/pipeexec.cpp
+++ b/plugins/CryptoPP/src/GPGw/pipeexec.cpp
@@ -1,134 +1,101 @@
#include "../commonheaders.h"
#include "gpgw.h"
-BOOL isWindowsNT(void)
-{
- BOOL result;
- OSVERSIONINFO ovi;
-
- memset(&ovi, 0, sizeof(ovi));
- ovi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
- GetVersionEx(&ovi);
-
- if(ovi.dwPlatformId==VER_PLATFORM_WIN32_NT) result=TRUE;
- else result=FALSE;
-
- return result;
-}
-
-
void storeOutput(HANDLE ahandle, char **aoutput)
{
- DWORD success;
- char readbuffer[10];
- DWORD transfered;
- DWORD available;
-
- do
- {
- PeekNamedPipe(ahandle, NULL, 0, NULL, &available, NULL);
-
- if(available==0) continue;
-
- success=ReadFile(ahandle, readbuffer, sizeof(readbuffer), &transfered, NULL);
-
- if ((success)&&(transfered!=0))
- appendText(aoutput, readbuffer, transfered);
- }
- while(available>0);
+ DWORD available;
+ do {
+ PeekNamedPipe(ahandle, NULL, 0, NULL, &available, NULL);
+
+ if (available == 0) continue;
+
+ DWORD transfered;
+ char readbuffer[10];
+ DWORD success = ReadFile(ahandle, readbuffer, sizeof(readbuffer), &transfered, NULL);
+ if ((success) && (transfered != 0))
+ appendText(aoutput, readbuffer, transfered);
+ } while (available > 0);
}
-
pxResult pxExecute(char *acommandline, char *ainput, char **aoutput, LPDWORD aexitcode)
{
- BOOL success;
- STARTUPINFO startupinfo;
- SECURITY_ATTRIBUTES securityattributes;
- SECURITY_DESCRIPTOR securitydescriptor;
- PROCESS_INFORMATION processinformation;
- HANDLE newstdin, newstdout, readstdout, writestdin;
- char *inputpos;
- DWORD transfered;
- int size;
-
- LogMessage("commandline:\n", acommandline, "\n");
-
- memset(&securityattributes, 0, sizeof(securityattributes));
- securityattributes.nLength=sizeof(SECURITY_ATTRIBUTES);
- securityattributes.bInheritHandle=TRUE;
-
- if(isWindowsNT())
- {
- InitializeSecurityDescriptor(&securitydescriptor, SECURITY_DESCRIPTOR_REVISION);
- SetSecurityDescriptorDacl(&securitydescriptor, TRUE, NULL, FALSE);
- securityattributes.lpSecurityDescriptor=&securitydescriptor;
- }
- else securityattributes.lpSecurityDescriptor=NULL;
-
- success=CreatePipe(&newstdin, &writestdin ,&securityattributes ,0);
- if (! success)
- {
- LogMessage("--- ", "create pipe failed", "\n");
- return pxCreatePipeFailed;
- }
-
- success=CreatePipe(&readstdout, &newstdout, &securityattributes, 0);
- if (! success)
- {
- LogMessage("--- ", "create pipe failed", "\n");
- CloseHandle(newstdin);
- CloseHandle(writestdin);
- return pxCreatePipeFailed;
- }
-
- GetStartupInfo(&startupinfo);
- startupinfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
- startupinfo.wShowWindow=SW_HIDE;
- startupinfo.hStdOutput=newstdout;
- startupinfo.hStdError=newstdout;
- startupinfo.hStdInput=newstdin;
-
- success=CreateProcess(NULL, acommandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &startupinfo, &processinformation);
-
- if (! success)
- {
- LogMessage("--- ", "create process failed", "\n");
- CloseHandle(newstdin);
- CloseHandle(writestdin);
- CloseHandle(newstdout);
- CloseHandle(readstdout);
- return pxCreateProcessFailed;
- }
-
- inputpos=ainput;
-
- while(TRUE)
- {
- success=GetExitCodeProcess(processinformation.hProcess, aexitcode);
- if ((success)&&(*aexitcode!=STILL_ACTIVE)) break;
-
- storeOutput(readstdout, aoutput);
-
- if (*inputpos!='\0') size=1;
- else size=0;
-
- success=WriteFile(writestdin, inputpos, size, &transfered, NULL);
-
- inputpos+=transfered;
- }
-
- storeOutput(readstdout, aoutput);
- WaitForSingleObject(processinformation.hProcess, INFINITE);
-
- LogMessage("output:\n", *aoutput, "");
-
- CloseHandle(processinformation.hThread);
- CloseHandle(processinformation.hProcess);
- CloseHandle(newstdin);
- CloseHandle(newstdout);
- CloseHandle(readstdout);
- CloseHandle(writestdin);
-
- return pxSuccess;
+ LogMessage("commandline:\n", acommandline, "\n");
+
+ SECURITY_ATTRIBUTES securityattributes;
+ memset(&securityattributes, 0, sizeof(securityattributes));
+ securityattributes.nLength = sizeof(SECURITY_ATTRIBUTES);
+ securityattributes.bInheritHandle = TRUE;
+
+ SECURITY_DESCRIPTOR securitydescriptor;
+ InitializeSecurityDescriptor(&securitydescriptor, SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl(&securitydescriptor, TRUE, NULL, FALSE);
+ securityattributes.lpSecurityDescriptor = &securitydescriptor;
+
+ HANDLE newstdin, newstdout, readstdout, writestdin;
+ BOOL success = CreatePipe(&newstdin, &writestdin, &securityattributes, 0);
+ if (!success) {
+ LogMessage("--- ", "create pipe failed", "\n");
+ return pxCreatePipeFailed;
+ }
+
+ success = CreatePipe(&readstdout, &newstdout, &securityattributes, 0);
+ if (!success) {
+ LogMessage("--- ", "create pipe failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ return pxCreatePipeFailed;
+ }
+
+ STARTUPINFO startupinfo;
+ GetStartupInfo(&startupinfo);
+ startupinfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ startupinfo.wShowWindow = SW_HIDE;
+ startupinfo.hStdOutput = newstdout;
+ startupinfo.hStdError = newstdout;
+ startupinfo.hStdInput = newstdin;
+
+ PROCESS_INFORMATION processinformation;
+ success = CreateProcess(NULL, acommandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &startupinfo, &processinformation);
+ if (!success) {
+ LogMessage("--- ", "create process failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ return pxCreateProcessFailed;
+ }
+
+ char *inputpos = ainput;
+
+ while (TRUE) {
+ success = GetExitCodeProcess(processinformation.hProcess, aexitcode);
+ if ((success) && (*aexitcode != STILL_ACTIVE))
+ break;
+
+ storeOutput(readstdout, aoutput);
+
+ int size;
+ if (*inputpos != '\0')
+ size = 1;
+ else
+ size = 0;
+
+ DWORD transfered;
+ success = WriteFile(writestdin, inputpos, size, &transfered, NULL);
+ inputpos += transfered;
+ }
+
+ storeOutput(readstdout, aoutput);
+ WaitForSingleObject(processinformation.hProcess, INFINITE);
+
+ LogMessage("output:\n", *aoutput, "");
+
+ CloseHandle(processinformation.hThread);
+ CloseHandle(processinformation.hProcess);
+ CloseHandle(newstdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ CloseHandle(writestdin);
+
+ return pxSuccess;
}
-
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp
index 2c8f0286d3..f0553dd4c6 100644
--- a/plugins/HistoryStats/src/bandctrlimpl.cpp
+++ b/plugins/HistoryStats/src/bandctrlimpl.cpp
@@ -491,7 +491,7 @@ int BandCtrlImpl::onBCMAddButton(BCBUTTON *pButton)
DeleteObject(ii.hbmMask);
}
- m_hImageList = ImageList_Create(m_IconSize.cx, m_IconSize.cy, OS::imageListColor() | ILC_MASK, 5, 5);
+ m_hImageList = ImageList_Create(m_IconSize.cx, m_IconSize.cy, ILC_COLOR32 | ILC_MASK, 5, 5);
}
// insert icon into image list
@@ -501,9 +501,8 @@ int BandCtrlImpl::onBCMAddButton(BCBUTTON *pButton)
HICON hIconDisabled = convertToGray(pButton->hIcon);
if (hIconDisabled) {
- if (!m_hImageListD) {
- m_hImageListD = ImageList_Create(m_IconSize.cx, m_IconSize.cy, OS::imageListColor() | ILC_MASK, 5, 5);
- }
+ if (!m_hImageListD)
+ m_hImageListD = ImageList_Create(m_IconSize.cx, m_IconSize.cy, ILC_COLOR32 | ILC_MASK, 5, 5);
id.nIconD = ImageList_AddIcon(m_hImageListD, hIconDisabled);
diff --git a/plugins/HistoryStats/src/dlgoption_subexclude.cpp b/plugins/HistoryStats/src/dlgoption_subexclude.cpp
index 885cbb3d8a..6319c414e2 100644
--- a/plugins/HistoryStats/src/dlgoption_subexclude.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subexclude.cpp
@@ -111,7 +111,7 @@ void DlgOption::SubExclude::onWMInitDialog()
// init clist
HWND hCList = GetDlgItem(getHWnd(), IDC_CONTACTS);
- HIMAGELIST hIml = ImageList_Create(OS::smIconCX(), OS::smIconCY(), OS::imageListColor() | ILC_MASK, 2, 0);
+ HIMAGELIST hIml = ImageList_Create(OS::smIconCX(), OS::smIconCY(), ILC_COLOR32 | ILC_MASK, 2, 0);
SendMessage(hCList, CLM_SETEXTRAIMAGELIST, 0, reinterpret_cast<LPARAM>(hIml));
staticRecreateIcons(reinterpret_cast<LPARAM>(this));
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp
index 1c6c0149a2..b9a7927f95 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp
@@ -333,7 +333,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticTreeProc(HWND hTree, UINT msg, WPARAM wP
void OptionsCtrlImpl::staticInitStateImages()
{
if (m_nStateIconsRef++ == 0 && !m_hStateIcons) {
- m_hStateIcons = ImageList_Create(OS::smIconCX(), OS::smIconCY(), OS::imageListColor() | ILC_MASK, 16, 0);
+ m_hStateIcons = ImageList_Create(OS::smIconCX(), OS::smIconCY(), ILC_COLOR32 | ILC_MASK, 16, 0);
staticUpdateStateImages(0);
IconLib::registerCallback(staticUpdateStateImages, 0);
diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp
index 4e0a78400b..a199caa059 100644
--- a/plugins/HistoryStats/src/utils.cpp
+++ b/plugins/HistoryStats/src/utils.cpp
@@ -936,22 +936,10 @@ const ext::string& utils::getProfileName()
/*
* OS
*/
-OS::OS() : m_bIsXPPlus(false), m_ImageListColor(ILC_COLORDDB) // MEMO: maybe change this to ILC_COLOR{8,16,24}
+OS::OS()
{
m_SmIcon.cx = 16; // GetSystemMetrics(SM_CXSMICON);
m_SmIcon.cy = 16; // GetSystemMetrics(SM_CYSMICON);
-
- OSVERSIONINFO osvi = { 0 };
-
- osvi.dwOSVersionInfoSize = sizeof(osvi);
-
- if (GetVersionEx(&osvi)) {
- m_bIsXPPlus = ((osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1) || osvi.dwMajorVersion >= 6);
-
- if (m_bIsXPPlus) {
- m_ImageListColor = ILC_COLOR32;
- }
- }
}
OS OS::m_Data;
diff --git a/plugins/HistoryStats/src/utils.h b/plugins/HistoryStats/src/utils.h
index daae031316..8b5f6c3d9d 100644
--- a/plugins/HistoryStats/src/utils.h
+++ b/plugins/HistoryStats/src/utils.h
@@ -112,8 +112,6 @@ class OS
: private pattern::NotCopyable<OS>
{
private:
- bool m_bIsXPPlus;
- UINT m_ImageListColor;
SIZE m_SmIcon;
private:
@@ -123,8 +121,6 @@ private:
static OS m_Data;
public:
- static bool isXPPlus() { return m_Data.m_bIsXPPlus; }
- static UINT imageListColor() { return m_Data.m_ImageListColor; }
static int smIconCX() { return m_Data.m_SmIcon.cx; }
static int smIconCY() { return m_Data.m_SmIcon.cy; }
};
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index adbe79029d..def163577f 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -723,19 +723,6 @@ void LoadSettings(void)
}
-void GetWindowsVersion(void)
-{
- OSVERSIONINFOEX osvi = { sizeof(OSVERSIONINFOEX) };
- BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
-
- if (!bOsVersionInfoEx) {
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (!GetVersionEx((OSVERSIONINFO *)&osvi))
- osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
- }
-}
-
-
void updateXstatusProto(PROTOCOL_INFO *protoInfo)
{
if (!ProtoServiceExists(protoInfo->szProto, PS_GETCUSTOMSTATUSEX))
@@ -913,7 +900,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
int CMPlugin::Load()
{
- GetWindowsVersion();
OpenKeyboardDevice();
HookEvent(ME_MC_ENABLED, OnMetaChanged);
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 0cb5db79aa..807374542b 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -68,7 +68,7 @@ static void ApplyUpdates(void *param)
// 2) Download all plugins
HNETLIBCONN nlc = nullptr;
- for (int i=0; i < todo.getCount(); i++) {
+ for (int i = 0; i < todo.getCount(); i++) {
ListView_EnsureVisible(hwndList, i, FALSE);
if (!todo[i].bEnabled) {
SetStringText(hwndList, i, TranslateT("Skipped."));
@@ -115,7 +115,7 @@ static void ApplyUpdates(void *param)
BackupFile(tszSrcPath, tszBackFile);
}
- if ( unzip(it->File.tszDiskPath, tszMirandaPath, tszFileBack,true))
+ if (unzip(it->File.tszDiskPath, tszMirandaPath, tszFileBack, true))
SafeDeleteFile(it->File.tszDiskPath); // remove .zip after successful update
}
}
@@ -155,11 +155,11 @@ static void ApplyUpdates(void *param)
if (g_plugin.bChangePlatform) {
wchar_t mirstartpath[MAX_PATH];
- #ifdef _WIN64
- mir_snwprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
- #else
- mir_snwprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
- #endif
+#ifdef _WIN64
+ mir_snwprintf(mirstartpath, L"%s\\miranda32.exe", tszMirandaPath);
+#else
+ mir_snwprintf(mirstartpath, L"%s\\miranda64.exe", tszMirandaPath);
+#endif
CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile, (LPARAM)mirstartpath);
}
else CallServiceSync(MS_SYSTEM_RESTART, bRestartCurrentProfile);
@@ -185,9 +185,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
Window_SetIcon_IcoLib(hDlg, iconList[0].hIcolib);
{
- OSVERSIONINFO osver = { sizeof(osver) };
- if (GetVersionEx(&osver) && osver.dwMajorVersion >= 6)
- {
+ if (IsWinVerVistaPlus()) {
wchar_t szPath[MAX_PATH];
GetModuleFileName(nullptr, szPath, _countof(szPath));
wchar_t *ext = wcsrchr(szPath, '.');
@@ -198,16 +196,16 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
if (hFile == INVALID_HANDLE_VALUE)
// Running Windows Vista or later (major version >= 6).
Button_SetElevationRequiredState(GetDlgItem(hDlg, IDOK), !IsProcessElevated());
- else
- {
+ else {
CloseHandle(hFile);
DeleteFile(szPath);
}
}
- LVCOLUMN lvc = {0};
+
// Initialize the LVCOLUMN structure.
// The mask specifies that the format, width, text, and
// subitem members of the structure are valid.
+ LVCOLUMN lvc = {};
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvc.fmt = LVCFMT_LEFT;
@@ -249,11 +247,11 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
bool enableOk = false;
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)lParam;
for (auto &it : todo) {
- LVITEM lvI = {0};
+ LVITEM lvI = { 0 };
lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_GROUPID | LVIF_NORECOMPUTE;
lvI.iGroupId = (wcsstr(it->tszOldName, L"Plugins") != nullptr) ? 1 :
((wcsstr(it->tszOldName, L"Languages") != nullptr) ? 3 :
- ((wcsstr(it->tszOldName, L"Icons") != nullptr) ? 4 : 2));
+ ((wcsstr(it->tszOldName, L"Icons") != nullptr) ? 4 : 2));
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)it;
lvI.pszText = it->tszOldName;
@@ -266,7 +264,7 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
SetStringText(hwndList, lvI.iItem, it->bDeleteOnly ? TranslateT("Deprecated!") : TranslateT("Update found!"));
}
- if(enableOk)
+ if (enableOk)
EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
}
@@ -279,13 +277,13 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
return TRUE;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->hwndFrom == hwndList) {
- switch (((LPNMHDR) lParam)->code) {
+ if (((LPNMHDR)lParam)->hwndFrom == hwndList) {
+ switch (((LPNMHDR)lParam)->code) {
case LVN_ITEMCHANGED:
if (GetWindowLongPtr(hDlg, GWLP_USERDATA)) {
NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) {
- LVITEM lvI = {0};
+ LVITEM lvI = { 0 };
lvI.iItem = nmlv->iItem;
lvI.iSubItem = 0;
lvI.mask = LVIF_PARAM;
@@ -312,12 +310,12 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
break;
case WM_COMMAND:
- if (HIWORD( wParam ) == BN_CLICKED) {
- switch(LOWORD(wParam)) {
+ if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
case IDOK:
- EnableWindow( GetDlgItem(hDlg, IDOK), FALSE);
- EnableWindow( GetDlgItem(hDlg, IDC_SELALL), FALSE);
- EnableWindow( GetDlgItem(hDlg, IDC_SELNONE), FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_SELALL), FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_SELNONE), FALSE);
mir_forkthread(ApplyUpdates, hDlg);
return TRUE;
@@ -470,7 +468,7 @@ static void DlgUpdateSilent(void *param)
mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
if (Popup_Enabled())
- ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
+ ShowPopup(tszTitle, TranslateT("You need to restart your Miranda to apply installed updates."), POPUP_TYPE_MSG);
else {
if (Clist_TrayNotifyW(MODULEA, tszTitle, TranslateT("You need to restart your Miranda to apply installed updates."), NIIF_INFO, 30000)) {
// Error, let's try to show MessageBox as last way to inform user about successful update
@@ -635,7 +633,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
if (hFind == INVALID_HANDLE_VALUE)
return 0;
- Netlib_LogfW(hNetlibUser,L"Scanning folder %s", tszFolder);
+ Netlib_LogfW(hNetlibUser, L"Scanning folder %s", tszFolder);
int count = 0;
do {
@@ -759,8 +757,7 @@ static int ScanFolder(const wchar_t *tszFolder, size_t cbBaseLen, const wchar_t
if (!g_plugin.bSilent || FileInfo->bEnabled)
count++;
}
- }
- while (FindNextFile(hFind, &ffd) != 0);
+ } while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
return count;
@@ -816,7 +813,7 @@ static void DoCheck(bool bSilent = true)
g_plugin.bSilent = bSilent;
g_plugin.setDword(DB_SETTING_LAST_UPDATE, time(0));
-
+
hCheckThread = mir_forkthread(CheckUpdates);
}
}
@@ -873,7 +870,7 @@ static void CALLBACK TimerAPCProc(void *, DWORD, DWORD)
static LONGLONG PeriodToMilliseconds(const int period, int &periodMeasure)
{
LONGLONG result = period * 1000LL;
- switch(periodMeasure) {
+ switch (periodMeasure) {
case 1:
// day
result *= 60 * 60 * 24;
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index 9a8e0f11d9..99e53ade98 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -170,17 +170,12 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (GetVersionEx(&osvi)) {
- HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
- ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 0, 1);
- if (hImages != nullptr) {
- SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
- g_plugin.addImgListIcon(hImages, IDI_LST_MODULES);
- g_plugin.addImgListIcon(hImages, IDI_LST_FOLDER);
- bImagesLoaded = true;
- }
+ HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerVistaPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 0, 1);
+ if (hImages != nullptr) {
+ SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
+ g_plugin.addImgListIcon(hImages, IDI_LST_MODULES);
+ g_plugin.addImgListIcon(hImages, IDI_LST_FOLDER);
+ bImagesLoaded = true;
}
}
// do the translation stuff
diff --git a/plugins/Variables/src/enumprocs.cpp b/plugins/Variables/src/enumprocs.cpp
index ebe665c817..52b9c0ad83 100644
--- a/plugins/Variables/src/enumprocs.cpp
+++ b/plugins/Variables/src/enumprocs.cpp
@@ -41,35 +41,26 @@ struct EnumInfoStruct
BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam)
{
- // Retrieve the OS version
- OSVERSIONINFO osver;
- osver.dwOSVersionInfoSize = sizeof(osver);
- if (!GetVersionEx(&osver))
+ // Get a handle to a Toolhelp snapshot of all processes.
+ HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (hSnapShot == INVALID_HANDLE_VALUE)
return FALSE;
- if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || (osver.dwPlatformId == VER_PLATFORM_WIN32_NT && osver.dwMajorVersion > 4)) {
- // Get a handle to a Toolhelp snapshot of all processes.
- HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
- if (hSnapShot == INVALID_HANDLE_VALUE)
- return FALSE;
+ // Get the first process' information.
+ PROCESSENTRY32 procentry;
+ procentry.dwSize = sizeof(PROCESSENTRY32);
+ BOOL bFlag = Process32First(hSnapShot, &procentry);
- // Get the first process' information.
- PROCESSENTRY32 procentry;
- procentry.dwSize = sizeof(PROCESSENTRY32);
- BOOL bFlag = Process32First(hSnapShot, &procentry);
+ // While there are processes, keep looping.
+ while (bFlag) {
+ // Call the enum func with the filename and ProcID.
+ if (lpProc(procentry.th32ProcessID, 0, (char *)procentry.szExeFile, lParam)) {
+ procentry.dwSize = sizeof(PROCESSENTRY32);
+ bFlag = Process32Next(hSnapShot, &procentry);
- // While there are processes, keep looping.
- while (bFlag) {
- // Call the enum func with the filename and ProcID.
- if (lpProc(procentry.th32ProcessID, 0, (char *)procentry.szExeFile, lParam)) {
- procentry.dwSize = sizeof(PROCESSENTRY32);
- bFlag = Process32Next(hSnapShot, &procentry);
-
- }
- else bFlag = FALSE;
}
+ else bFlag = FALSE;
}
- else return FALSE;
return TRUE;
}