-
Notifications
You must be signed in to change notification settings - Fork 0
Commit 7be7c62
authored
Update WindowsUpdatePauser.cpp
// 1. НОВІ INCLUDES:
#include <tlhelp32.h>
// 2. НОВІ КОНСТАНТИ:
const int maxWaitTime = 2000; // 2 секунди максимум
const int checkInterval = 50; // Перевіряємо кожні 50ms
// 3. НОВІ ФУНКЦІЇ (повний код):
bool IsProcessRunning(const wchar_t* processName) {
bool found = false;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE) {
PROCESSENTRY32W pe32;
pe32.dwSize = sizeof(PROCESSENTRY32W);
if (Process32FirstW(hSnapshot, &pe32)) {
do {
if (_wcsicmp(pe32.szExeFile, processName) == 0) {
found = true;
break;
}
} while (Process32NextW(hSnapshot, &pe32));
}
CloseHandle(hSnapshot);
}
return found;
}
bool TerminateProcessByName(const wchar_t* processName) {
// [40+ рядків коду для завершення процесу]
}
// 4. НОВІ ОПЕРАЦІЇ В ApplyPause():
+ SetRegString(L"PauseUpdatesStartTime", startTime)
+ SetRegDWORD(updatePolicyKey, L"PausedFeatureStatus", 1)
+ SetRegDWORD(updatePolicyKey, L"PausedQualityStatus", 1)
+ SetRegString(updatePolicyKey, L"PausedQualityDate", endTime)
+ SetRegString(updatePolicyKey, L"PausedFeatureDate", endTime)
+ SetRegDWORD(L"SYSTEM\\CurrentControlSet\\Services\\WaaSMedicSvc", L"Start", 4)
// 5. НОВІ ОПЕРАЦІЇ В RemovePause():
+ DeleteRegValue(L"PauseUpdatesStartTime")
+ SetRegDWORD(updatePolicyKey, L"PausedFeatureStatus", 0)
+ SetRegDWORD(updatePolicyKey, L"PausedQualityStatus", 0)
+ DeleteRegValue(updatePolicyKey, L"PausedQualityDate")
+ DeleteRegValue(updatePolicyKey, L"PausedFeatureDate")
+ SetRegDWORD(L"SYSTEM\\CurrentControlSet\\Services\\WaaSMedicSvc", L"Start", 3)1 parent da9f921 commit 7be7c62Copy full SHA for 7be7c62
File tree
Expand file treeCollapse file tree
1 file changed
+251
-13
lines changedOpen diff view settings
Filter options
Expand file treeCollapse file tree
1 file changed
+251
-13
lines changedOpen diff view settings
0 commit comments