diff options
author | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-12-26 20:31:39 +0300 |
commit | cddcd7483a7c472598af098e759e5d309024f606 (patch) | |
tree | b0a227d6e087c41958cc84d27bc323353248aae5 /plugins/AutoShutdown/src | |
parent | 1039b2829a264280493ba0fa979214fe024dc70c (diff) |
DWORD -> uint32_t
Diffstat (limited to 'plugins/AutoShutdown/src')
-rw-r--r-- | plugins/AutoShutdown/src/cpuusage.cpp | 12 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/cpuusage.h | 2 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/settingsdlg.cpp | 14 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/shutdownsvc.cpp | 14 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/utils.cpp | 6 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/utils.h | 2 | ||||
-rw-r--r-- | plugins/AutoShutdown/src/watcher.cpp | 2 |
7 files changed, 26 insertions, 26 deletions
diff --git a/plugins/AutoShutdown/src/cpuusage.cpp b/plugins/AutoShutdown/src/cpuusage.cpp index de331986d1..78c239c759 100644 --- a/plugins/AutoShutdown/src/cpuusage.cpp +++ b/plugins/AutoShutdown/src/cpuusage.cpp @@ -34,7 +34,7 @@ static BOOL WinNT_PerfStatsSwitch(wchar_t *pszServiceName, BOOL fDisable) if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services", 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyServices)) {
if (!RegOpenKeyEx(hKeyServices, pszServiceName, 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyService)) {
if (!RegOpenKeyEx(hKeyService, L"Performance", 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKeyPerf)) {
- dwDataSize = sizeof(DWORD);
+ dwDataSize = sizeof(uint32_t);
if (!RegQueryValueEx(hKeyPerf, L"Disable Performance Counters", nullptr, nullptr, (uint8_t*)&dwData, &dwDataSize))
if ((dwData != 0) != fDisable)
fSwitched = !RegSetValueEx(hKeyPerf, L"Disable Performance Counters", 0, REG_DWORD, (uint8_t*)&fDisable, dwDataSize);
@@ -50,11 +50,11 @@ static BOOL WinNT_PerfStatsSwitch(wchar_t *pszServiceName, BOOL fDisable) /************************* Poll Thread ********************************/
struct CpuUsageThreadParams
{
- DWORD dwDelayMillis;
+ uint32_t dwDelayMillis;
CPUUSAGEAVAILPROC pfnDataAvailProc;
LPARAM lParam;
HANDLE hFirstEvent;
- DWORD *pidThread;
+ uint32_t *pidThread;
};
static BOOL CallBackAndWait(struct CpuUsageThreadParams *param, uint8_t nCpuUsage)
@@ -82,7 +82,7 @@ static void WinNT_PollThread(CpuUsageThreadParams *param) PERF_COUNTER_DEFINITION *pPerfCounter;
PERF_INSTANCE_DEFINITION *pPerfInstance;
PERF_COUNTER_BLOCK *pPerfCounterBlock;
- DWORD dwObjectId, dwCounterId;
+ uint32_t dwObjectId, dwCounterId;
wchar_t wszValueName[11], *pwszInstanceName;
uint8_t nCpuUsage;
BOOL fSwitched, fFound, fIsFirst = FALSE;
@@ -180,9 +180,9 @@ static void WinNT_PollThread(CpuUsageThreadParams *param) /************************* Start Thread *******************************/
// returns poll thread id on success
-DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, DWORD dwDelayMillis)
+uint32_t PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc, LPARAM lParam, uint32_t dwDelayMillis)
{
- DWORD idThread = 0;
+ uint32_t idThread = 0;
/* init params */
CpuUsageThreadParams *param = (struct CpuUsageThreadParams*)mir_alloc(sizeof(struct CpuUsageThreadParams));
diff --git a/plugins/AutoShutdown/src/cpuusage.h b/plugins/AutoShutdown/src/cpuusage.h index 391832e059..4c20b9b3e9 100644 --- a/plugins/AutoShutdown/src/cpuusage.h +++ b/plugins/AutoShutdown/src/cpuusage.h @@ -23,4 +23,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Start Thread */
typedef BOOL (CALLBACK* CPUUSAGEAVAILPROC)(uint8_t nCpuUsage,LPARAM lParam);
-DWORD PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc,LPARAM lParam,DWORD dwDelayMillis);
+uint32_t PollCpuUsage(CPUUSAGEAVAILPROC pfnDataAvailProc,LPARAM lParam,uint32_t dwDelayMillis);
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index e162c374df..a1cf1356f2 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Services */
static HWND hwndSettingsDlg;
-const DWORD unitValues[] = { 1,60,60 * 60,60 * 60 * 24,60 * 60 * 24 * 7,60 * 60 * 24 * 31 };
+const uint32_t unitValues[] = { 1,60,60 * 60,60 * 60 * 24,60 * 60 * 24 * 7,60 * 60 * 24 * 31 };
const wchar_t *unitNames[] = { LPGENW("Second(s)"), LPGENW("Minute(s)"), LPGENW("Hour(s)"), LPGENW("Day(s)"), LPGENW("Week(s)"), LPGENW("Month(s)") };
/************************* Dialog *************************************/
@@ -48,7 +48,7 @@ static BOOL CALLBACK DisplayCpuUsageProc(uint8_t nCpuUsage, LPARAM lParam) return TRUE;
}
-static bool AnyProtoHasCaps(DWORD caps1)
+static bool AnyProtoHasCaps(uint32_t caps1)
{
for (auto &pa : Accounts())
if (CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & caps1)
@@ -100,7 +100,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(hwndDlg, M_CHECK_DATETIME, 0, 0);
}
{
- DWORD setting = g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
+ uint32_t setting = g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
if (setting < 1) setting = SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(UD_MAXVAL, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_COUNTDOWN, EM_SETLIMITTEXT, (WPARAM)10, 0);
@@ -109,7 +109,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_COUNTDOWNUNIT);
- DWORD lastUnit = g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ uint32_t lastUnit = g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_INITSTORAGE, _countof(unitNames), _countof(unitNames) * 16); /* approx. */
for (int i = 0; i < _countof(unitNames); ++i) {
@@ -351,7 +351,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, ×tamp))
timestamp = time(0);
- g_plugin.setDword("TimeStamp", (DWORD)timestamp);
+ g_plugin.setDword("TimeStamp", (uint32_t)timestamp);
}
/* shutdown type */
{
@@ -360,8 +360,8 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L g_plugin.setByte("ShutdownType", (uint8_t)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- g_plugin.setDword("CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
- g_plugin.setDword("Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
+ g_plugin.setDword("CountdownUnit", (uint32_t)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setDword("Countdown", (uint32_t)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
g_plugin.setByte("CpuUsageThreshold", (uint8_t)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index d071656ee0..ee2df56bc3 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -128,14 +128,14 @@ static BOOL IsShutdownTypeEnabled(uint8_t shutdownType) return bReturn;
}
-static DWORD ShutdownNow(uint8_t shutdownType)
+static uint32_t ShutdownNow(uint8_t shutdownType)
{
- DWORD dwErrCode = ERROR_SUCCESS;
+ uint32_t dwErrCode = ERROR_SUCCESS;
switch (shutdownType) {
case SDSDT_CLOSEMIRANDA:
if (!Miranda_IsTerminated()) {
/* waiting for short until ready (but not too long...) */
- DWORD dwLastTickCount = GetTickCount();
+ uint32_t dwLastTickCount = GetTickCount();
while (!Miranda_OkToExit()) {
/* infinite loop protection (max 5 sec) */
if (GetTickCount() - dwLastTickCount >= 5000) { /* wraparound works */
@@ -174,9 +174,9 @@ static DWORD ShutdownNow(uint8_t shutdownType) ShutdownNow(SDSDT_SETMIRANDAOFFLINE); /* set Miranda offline */
/* hang up all ras connections */
{
- DWORD dwRetries;
+ uint32_t dwRetries;
RASCONNSTATUS rcs;
- DWORD dw, dwLastTickCount;
+ uint32_t dw, dwLastTickCount;
DWORD dwConnSize = sizeof(RASCONN);
DWORD dwConnItems = 0;
@@ -357,7 +357,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_BUTTON_SHUTDOWNNOW))) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BUTTON_SHUTDOWNNOW), FALSE);
ShowWindow(hwndDlg, SW_HIDE); /* get rid of the dialog immediately */
- DWORD dwErrCode = ShutdownNow(shutdownType);
+ uint32_t dwErrCode = ShutdownNow(shutdownType);
if (dwErrCode != ERROR_SUCCESS) {
char *pszErr = GetWinErrorDescription(dwErrCode);
ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("The shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
@@ -433,7 +433,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam) return 0;
/* show error */
- DWORD dwErrCode = ShutdownNow((uint8_t)wParam);
+ uint32_t dwErrCode = ShutdownNow((uint8_t)wParam);
if (dwErrCode != ERROR_SUCCESS) {
char *pszErr = GetWinErrorDescription(dwErrCode);
ShowInfoMessage(NIIF_ERROR, Translate("Automatic shutdown error"), Translate("Initiating the shutdown process failed!\nReason: %s"), (pszErr != nullptr) ? pszErr : Translate("Unknown"));
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index ddd353f9aa..7324f0cbbe 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -59,10 +59,10 @@ void ShowInfoMessage(uint8_t flags, const char *pszTitle, const char *pszTextFmt }
// LocalFree() the return value
-char* GetWinErrorDescription(DWORD dwLastError)
+char* GetWinErrorDescription(uint32_t dwLastError)
{
char *buf = nullptr;
- DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
+ uint32_t flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
if (!FormatMessageA(flags, nullptr, dwLastError, LANGIDFROMLCID(Langpack_GetDefaultLocale()), (char*)&buf, 0, nullptr))
if (GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND)
FormatMessageA(flags, nullptr, dwLastError, 0, (char*)&buf, 0, nullptr);
@@ -108,7 +108,7 @@ BOOL TimeStampToSystemTime(time_t timestamp, SYSTEMTIME *st) BOOL GetFormatedCountdown(wchar_t *pszOut, int nSize, time_t countdown)
{
static BOOL fInited = FALSE;
- static int (WINAPI *pfnGetDurationFormat)(LCID, DWORD, const SYSTEMTIME*, double, wchar_t*, wchar_t*, int);
+ static int (WINAPI *pfnGetDurationFormat)(LCID, uint32_t, const SYSTEMTIME*, double, wchar_t*, wchar_t*, int);
/* Init */
if (!fInited && IsWinVerVistaPlus()) {
*(PROC*)&pfnGetDurationFormat = GetProcAddress(GetModuleHandleA("KERNEL32"), "GetDurationFormat");
diff --git a/plugins/AutoShutdown/src/utils.h b/plugins/AutoShutdown/src/utils.h index e3c05f51f9..52bd847c59 100644 --- a/plugins/AutoShutdown/src/utils.h +++ b/plugins/AutoShutdown/src/utils.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Error Output */
void ShowInfoMessage(uint8_t flags,const char *pszTitle,const char *pszTextFmt,...);
-char* GetWinErrorDescription(DWORD dwLastError);
+char* GetWinErrorDescription(uint32_t dwLastError);
/* Time */
BOOL SystemTimeToTimeStamp(SYSTEMTIME *st,time_t *timestamp);
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index a84253b536..b7135921f4 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -180,7 +180,7 @@ static int StatusSettingChanged(WPARAM wParam, LPARAM lParam) /************************* Cpu Shutdown *******************************/
-static DWORD idCpuUsageThread;
+static uint32_t idCpuUsageThread;
static BOOL CALLBACK CpuUsageWatcherProc(uint8_t nCpuUsage, LPARAM lParam)
{
|