From e4807e49256e09d3c3b1a9dfce428749a24bc2c8 Mon Sep 17 00:00:00 2001 From: felikcat <29991266+felikcat@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:23:20 -0700 Subject: [PATCH] Version 1.1 --- src/.clang-format => .clang-format | 0 .gitignore | 11 +- CMakeLists.txt | 1 + README.adoc | 2 +- src/CMakeLists.txt | 43 ++++ src/Common.c | 225 ++++++++++++++++ src/Common.h | 50 ++++ src/Common.ixx | 187 -------------- src/Edits.c | 301 ++++++++++++++++++++++ src/Edits.ixx | 312 ----------------------- src/MSStore.c | 84 ++++++ src/MSStore.ixx | 86 ------- src/PrivacyMode.c | 140 ++++++++++ src/PrivacyMode.ixx | 146 ----------- src/Resource.h | 40 ++- src/{RestorePoint.ixx => RestorePoint.c} | 59 ++--- src/W11Boost.aps | Bin 2848 -> 0 bytes src/{W11Boost.cpp => W11Boost.c} | 96 +++---- src/W11Boost.rc | Bin 3938 -> 5548 bytes src/W11Boost.sln | 31 --- src/W11Boost.vcxproj | 203 --------------- src/W11Boost.vcxproj.filters | 56 ---- src/W11Boost.vcxproj.user | 4 - src/app.manifest | 16 ++ src/targetver.h | 6 +- 25 files changed, 954 insertions(+), 1145 deletions(-) rename src/.clang-format => .clang-format (100%) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/Common.c create mode 100644 src/Common.h delete mode 100644 src/Common.ixx create mode 100644 src/Edits.c delete mode 100644 src/Edits.ixx create mode 100644 src/MSStore.c delete mode 100644 src/MSStore.ixx create mode 100644 src/PrivacyMode.c delete mode 100644 src/PrivacyMode.ixx rename src/{RestorePoint.ixx => RestorePoint.c} (84%) delete mode 100644 src/W11Boost.aps rename src/{W11Boost.cpp => W11Boost.c} (79%) delete mode 100644 src/W11Boost.sln delete mode 100644 src/W11Boost.vcxproj delete mode 100644 src/W11Boost.vcxproj.filters delete mode 100644 src/W11Boost.vcxproj.user create mode 100644 src/app.manifest diff --git a/src/.clang-format b/.clang-format similarity index 100% rename from src/.clang-format rename to .clang-format diff --git a/.gitignore b/.gitignore index 4c4b431..f4c5e5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -.vs/ -src/.vs -src/ARM -src/x64 -src/W11Boost -src/Release -src/Debug \ No newline at end of file +.vs +.vscode +.cache +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..032d4ed --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(src/CMakeLists.txt) diff --git a/README.adoc b/README.adoc index 8155b3b..dbc2591 100644 --- a/README.adoc +++ b/README.adoc @@ -125,7 +125,7 @@ This is outdated and needs to be rewritten. .*Other* -. Importing/setting wallpapers is set to 100% of JPEG's quality; less compression, therefore less "blurriness". + ==== diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..95fe8e2 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.29.5) +project(W11Boost VERSION 1.1 LANGUAGES CXX C) + +function(replace_manifest TARGET_NAME MANIFEST_FILE) + if(NOT TARGET_NAME) + message(FATAL_ERROR "You must provide a target") + endif() + + if(NOT MANIFEST_FILE) + message(FATAL_ERROR "You must provide a manifest file") + endif() + + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND "mt.exe" -manifest \"${MANIFEST_FILE}\" \"-outputresource:$\" -nologo + ) +endfunction() + +file(GLOB SRC_FILES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/*.c") + +add_executable(W11Boost WIN32 ${SRC_FILES} W11Boost.rc) + +target_compile_features(W11Boost PUBLIC c_std_23) +set_target_properties(W11Boost PROPERTIES + CMAKE_C_STANDARD 23 + CMAKE_C_STANDARD_REQUIRED ON + CMAKE_C_EXTENSIONS OFF +) +replace_manifest(W11Boost ${CMAKE_SOURCE_DIR}/app.manifest) +add_definitions(-DUNICODE -D_UNICODE) +target_link_options(W11Boost PRIVATE -municode -mwindows) +target_compile_options(W11Boost PRIVATE -Wall -Wextra -Werror -Wno-missing-field-initializers) + +# Include headers +target_include_directories(W11Boost PRIVATE ${CMAKE_SOURCE_DIR}) + +target_link_libraries(W11Boost PRIVATE + gpedit.lib + userenv.lib + wininet.lib + shlwapi.lib +) diff --git a/src/Common.c b/src/Common.c new file mode 100644 index 0000000..1226063 --- /dev/null +++ b/src/Common.c @@ -0,0 +1,225 @@ +#define __STDC_WANT_LIB_EXT1__ 1 +#include "Common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const CLSID _CLSID_GroupPolicyObject = { + 0xea502722, 0xa23d, 0x11d1, {0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}}; +const IID _IID_IGroupPolicyObject = { + 0xea502723, 0xa23d, 0x11d1, {0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}}; +const CLSID _CLSID_GPESnapIn = { + 0x8fc0b734, 0xa0e1, 0x11d1, {0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}}; +GUID RegistryID = {0x35378EAC, + 0x683F, + 0x11D2, + {0xA8, 0x9A, 0x00, 0xC0, 0x4F, 0xBB, 0xCF, 0xA2}}; +GUID RegistryID; +IGroupPolicyObject *pGPO; +HKEY hKey; +HKEY hSubKey; +LONG result; + +wchar_t *get_log_directory() { + wchar_t currentPath[MAX_PATH]; + GetModuleFileNameW(NULL, currentPath, MAX_PATH); + + wchar_t *removeExe = wcsrchr(currentPath, L'\\'); + if (removeExe != NULL) { + *removeExe = L'\0'; + } + + const wchar_t *dirName = L"W11Boost Logs"; + wchar_t *fullPath = (wchar_t *)malloc(MAX_PATH * sizeof(wchar_t)); + swprintf_s(fullPath, MAX_PATH, L"%s\\%s", currentPath, dirName); + + // Ensure double-null termination + size_t len = wcslen(fullPath); + if (len + 2 < MAX_PATH) { + fullPath[len + 1] = L'\0'; + } + return fullPath; +} + +utf8_result wide_string_to_utf8(const wchar_t *wide_string) { + if (wide_string == NULL || *wide_string == U'\0') + return (utf8_result){NULL, false}; + + size_t wide_length = 0; + while (wide_string[wide_length] != U'\0') + wide_length++; + + size_t size_needed = WideCharToMultiByte(CP_UTF8, 0, wide_string, wide_length, + NULL, 0, NULL, NULL); + if (size_needed <= 0) + return (utf8_result){NULL, false}; + + char *result = (char *)malloc(size_needed + 1); + if (result == NULL) + return (utf8_result){NULL, false}; + + int converted_result = + WideCharToMultiByte(CP_UTF8, 0, wide_string, (int)wide_length, &result[0], + size_needed, NULL, NULL); + if (converted_result <= 0) { + free(result); + return (utf8_result){NULL, true}; + } + result[size_needed] = '\0'; + return (utf8_result){result, false}; // if SUCCESS (0), proceed +} + +int log_registry(const wchar_t *subKey, const wchar_t *valueName, + const char *typeName) { + wchar_t *currentDir = get_log_directory(); + wchar_t logLocation[MAX_PATH]; + swprintf_s(logLocation, MAX_PATH, L"%s\\Registry.log", currentDir); + + FILE *logFile = NULL; + errno_t err = _wfopen_s(&logFile, logLocation, L"a"); + if (err != 0 || logFile == NULL) + return EXIT_FAILURE; + + if (logFile) { + time_t now; + time(&now); + + struct tm timeInfo; + localtime_s(&timeInfo, &now); + + char timeString[20]; // 19 char + 1 null terminator + strftime(timeString, sizeof(timeString), "%d-%m-%Y %H:%M:%S", &timeInfo); + + utf8_result narrow_subKey = wide_string_to_utf8(subKey); + utf8_result narrow_valueName = wide_string_to_utf8(valueName); + + if (!narrow_subKey.error && !narrow_valueName.error) { + fprintf_s(logFile, "%s %s %s\\%s\n", timeString, typeName, + narrow_subKey.string, narrow_valueName.string); + } + } + fclose(logFile); + free(currentDir); + return EXIT_SUCCESS; +} + +LSTATUS set_dword(HKEY hKey, const wchar_t *subKey, const wchar_t *valueName, + const DWORD value) { + result = RegCreateKeyExW(hKey, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &hSubKey, NULL); + + if (result == ERROR_SUCCESS) + result = RegSetValueExW(hSubKey, valueName, 0, REG_DWORD, + (const BYTE *)&value, sizeof(DWORD)); + + const char *typeName = " - DWORD: "; + log_registry(subKey, valueName, typeName); + + result = RegCloseKey(hSubKey); + return result; +} + +LSTATUS set_string(HKEY hKey, const wchar_t *subKey, const wchar_t *valueName, + const wchar_t *value) { + result = RegCreateKeyExW(hKey, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &hSubKey, NULL); + + if (result != ERROR_SUCCESS) + return EXCEPTION_EXECUTE_HANDLER; + + result = RegSetValueExW(hSubKey, valueName, 0, REG_SZ, (const BYTE *)value, + sizeof(wchar_t)); + + if (result != ERROR_SUCCESS) + return EXCEPTION_EXECUTE_HANDLER; + + result = RegCloseKey(hSubKey); + + if (result != ERROR_SUCCESS) + return EXCEPTION_EXECUTE_HANDLER; + + const char *typeName = " - SZ: "; + log_registry(subKey, valueName, typeName); + return EXIT_SUCCESS; +} + +LSTATUS set_environment(HKEY hKey, const wchar_t *valueName, + const wchar_t *value) { + const wchar_t *subKey = + L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"; + result = RegOpenKeyExW(hKey, subKey, 0, KEY_ALL_ACCESS, &hSubKey); + + if (result == ERROR_SUCCESS) + result = + RegSetValueExW(hSubKey, valueName, 0, REG_EXPAND_SZ, + (const BYTE *)value, (wcslen(value) * sizeof(wchar_t))); + + const char *typeName = " - EXPAND_SZ: "; + log_registry(subKey, valueName, typeName); + + result = RegCloseKey(hSubKey); + return result; +} + +LSTATUS remove_subkey(HKEY hKey, const wchar_t *subKey, + const wchar_t *valueName) { + HKEY hSubKey; + result = RegOpenKeyExW(hKey, subKey, 0, KEY_WRITE, &hSubKey); + + if (result == ERROR_SUCCESS) + result = RegDeleteValueW(hSubKey, valueName); + + const char *typeName = " - Removed subkey: "; + log_registry(subKey, valueName, typeName); + + result = RegCloseKey(hSubKey); + return result; +} + +void gp_cleanup(HRESULT hr) { + RegCloseKey(hKey); + + if (SUCCEEDED(hr)) + hr = pGPO->lpVtbl->Save(pGPO, TRUE, TRUE, &RegistryID, + (GUID *)&_CLSID_GPESnapIn); + + // Apply new policy objects to the registry + RefreshPolicyEx(TRUE, RP_FORCE); + + if (pGPO) + pGPO->lpVtbl->Release(pGPO); +} + +int start_command_and_wait(wchar_t *cmdLine) { + STARTUPINFOW si; + PROCESS_INFORMATION pi; + + SecureZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + SecureZeroMemory(&pi, sizeof(pi)); + + if (!CreateProcessW(NULL, cmdLine, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, + NULL, &si, &pi)) + return EXIT_FAILURE; + + WaitForSingleObject(pi.hProcess, INFINITE); + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return EXIT_SUCCESS; +} + +bool append_wchar_t(const wchar_t *original, const wchar_t *append, + wchar_t *result) { + wcscpy_s(result, MAX_PATH, original); + if (SUCCEEDED(PathAppendW(result, append))) + return true; + + return false; +}; diff --git a/src/Common.h b/src/Common.h new file mode 100644 index 0000000..bf764a8 --- /dev/null +++ b/src/Common.h @@ -0,0 +1,50 @@ +#ifndef COMMON_H +#define COMMON_H + +#define WIN32_LEAN_AND_MEAN +#include // Always first +#include +#include +#include // Requires prsht.h first; not unused +#include + +extern const CLSID _CLSID_GroupPolicyObject; +extern const IID _IID_IGroupPolicyObject; +extern const CLSID _CLSID_GPESnapIn; + +extern GUID RegistryID; +extern IGroupPolicyObject *pGPO; +extern HKEY hKey; +extern HKEY hSubKey; +extern LONG result; + +typedef struct { + char *string; + bool error; +} utf8_result; + +int install_privacy_mode(); +utf8_result wide_string_to_utf8(const wchar_t *wide_string); +int log_registry(const wchar_t *subKey, const wchar_t *valueName, + const char *typeName); +LSTATUS set_dword(HKEY hKey, const wchar_t *subKey, const wchar_t *valueName, + const DWORD value); + +LSTATUS set_string(HKEY hKey, const wchar_t *subKey, const wchar_t *valueName, + const wchar_t *value); +LSTATUS set_environment(HKEY hKey, const wchar_t *valueName, + const wchar_t *value); +LSTATUS remove_subkey(HKEY hKey, const wchar_t *subKey, + const wchar_t *valueName); +void gp_cleanup(HRESULT hr); +int start_command_and_wait(wchar_t *cmdLine); +bool append_wchar_t(const wchar_t *original, const wchar_t *append, + wchar_t *result); +int download_file(const wchar_t *url, const wchar_t *destination); +int install_microsoft_store(); +void restorepoint_prep(); +int create_restore_point(); +int gp_edits(); +wchar_t *get_log_directory(); + +#endif // COMMON_H diff --git a/src/Common.ixx b/src/Common.ixx deleted file mode 100644 index 2c6cc27..0000000 --- a/src/Common.ixx +++ /dev/null @@ -1,187 +0,0 @@ -module; -#include -#include -#include -#include -#include -#include -export module Common; -import ; -import ; -import ; -import ; -import ; -import ; - -export constexpr CLSID _CLSID_GroupPolicyObject = { - 0xea502722, 0xa23d, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}; -export constexpr IID _IID_IGroupPolicyObject = { - 0xea502723, 0xa23d, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}; -export constexpr CLSID _CLSID_GPESnapIn = { - 0x8fc0b734, 0xa0e1, 0x11d1, 0xa7, 0xd3, 0x0, 0x0, 0xf8, 0x75, 0x71, 0xe3}; -export GUID RegistryID = REGISTRY_EXTENSION_GUID; -export IGroupPolicyObject *pGPO; -export HKEY hKey; -export HKEY hSubKey; -export LONG result; - -export std::string wide_string_to_utf8(const std::wstring &wideString) { - if (wideString.empty()) - return std::string(); - - size_t size_needed = - WideCharToMultiByte(CP_UTF8, 0, wideString.c_str(), - (size_t)wideString.size(), NULL, 0, NULL, NULL); - if (size_needed <= 0) - return {std::string(), true}; - - std::string result(size_needed, 0); - WideCharToMultiByte(CP_UTF8, 0, wideString.c_str(), (size_t)wideString.size(), - &result[0], size_needed, NULL, NULL); - return {result, false}; // if 0, proceed -} - -auto log_registry(const wchar_t *subKey, const wchar_t *valueName, - std::string typeName) { - std::ofstream logFile(R"(W11Boost Logs\Registry.log)", std::ios::app); - - if (logFile.is_open()) { - auto now = std::chrono::system_clock::now(); - auto convert = std::chrono::system_clock::to_time_t(now); - tm timeInfo; - localtime_s(&timeInfo, &convert); - - std::string narrow_subKey = wide_string_to_utf8(subKey); - std::string narrow_valueName = wide_string_to_utf8(valueName); - - logFile << std::put_time(&timeInfo, "%d-%m-%Y %H:%M:%S") << typeName - << narrow_subKey << "\\" << narrow_valueName << "\n"; - } -} - -export LSTATUS set_dword(HKEY hKey, const wchar_t *subKey, - const wchar_t *valueName, const DWORD value) { - result = RegCreateKeyExW(hKey, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WRITE, NULL, &hSubKey, NULL); - - if (result == ERROR_SUCCESS) - result = - RegSetValueExW(hSubKey, valueName, 0, REG_DWORD, - reinterpret_cast(value), sizeof(DWORD)); - - std::string typeName = " - DWORD: "; - log_registry(subKey, valueName, typeName); - - result = RegCloseKey(hSubKey); - return result; -} - -export LSTATUS set_string(HKEY hKey, const wchar_t *subKey, - const wchar_t *valueName, const wchar_t *value) { - using namespace std; - result = RegCreateKeyExW(hKey, subKey, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_WRITE, NULL, &hSubKey, NULL); - - if (result == ERROR_SUCCESS) - result = - RegSetValueExW(hSubKey, valueName, 0, REG_SZ, - reinterpret_cast(value), sizeof(wchar_t)); - - std::string typeName = " - SZ: "; - log_registry(subKey, valueName, typeName); - - result = RegCloseKey(hSubKey); - return result; -} - -export LSTATUS set_environment(HKEY hKey, const wchar_t *valueName, - const wchar_t *value) { - const wchar_t *subKey = - LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Environment)"; - result = RegOpenKeyExW(hKey, subKey, 0, KEY_ALL_ACCESS, &hSubKey); - - if (result == ERROR_SUCCESS) - result = RegSetValueExW(hSubKey, valueName, 0, REG_EXPAND_SZ, - reinterpret_cast(value), - (wcslen(value) * sizeof(wchar_t))); - - std::string typeName = " - EXPAND_SZ: "; - log_registry(subKey, valueName, typeName); - - result = RegCloseKey(hSubKey); - return result; -} - -export LSTATUS remove_key(HKEY hKey, const wchar_t *subKey) { - result = RegDeleteKeyW(hKey, subKey); - - std::ofstream logFile(R"(W11Boost Logs\Registry.log)", std::ios::app); - - if (logFile.is_open()) { - auto now = std::chrono::system_clock::now(); - auto convert = std::chrono::system_clock::to_time_t(now); - tm timeInfo; - localtime_s(&timeInfo, &convert); - - std::string narrow_subKey = wide_string_to_utf8(subKey); - - logFile << std::put_time(&timeInfo, "%d-%m-%Y %H:%M:%S") - << " - Removed key: " << narrow_subKey << "\n"; - } - return result; -} - -export LSTATUS remove_subkey(HKEY hKey, const wchar_t *subKey, - const wchar_t *valueName) { - HKEY hSubKey; - result = RegOpenKeyExW(hKey, subKey, 0, KEY_WRITE, &hSubKey); - - if (result == ERROR_SUCCESS) - result = RegDeleteValueW(hSubKey, valueName); - - std::string typeName = " - Removed subkey: "; - log_registry(subKey, valueName, typeName); - - result = RegCloseKey(hSubKey); - return result; -} - -export void gp_cleanup(HRESULT hr) { - RegCloseKey(hKey); - - if (SUCCEEDED(hr)) - hr = pGPO->Save(TRUE, TRUE, &RegistryID, (GUID *)&_CLSID_GPESnapIn); - - // Apply new policy objects to the registry - RefreshPolicyEx(TRUE, RP_FORCE); - - if (pGPO) - pGPO->Release(); -} - -export size_t start_command_and_wait(wchar_t *cmdLine) { - STARTUPINFOW si; - PROCESS_INFORMATION pi; - - SecureZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - SecureZeroMemory(&pi, sizeof(pi)); - - if (!CreateProcessW(NULL, cmdLine, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, - NULL, &si, &pi)) - return 1; - - WaitForSingleObject(pi.hProcess, INFINITE); - - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - return 0; -} - -export bool os_64bit_check() { - SYSTEM_INFO sysInfo; - GetNativeSystemInfo(&sysInfo); - - return (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || - sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64); -} diff --git a/src/Edits.c b/src/Edits.c new file mode 100644 index 0000000..a07a693 --- /dev/null +++ b/src/Edits.c @@ -0,0 +1,301 @@ +#include "Common.h" +#include +#include + +int gp_edits() { + // The apartment thread model is required for GPOs + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) + return EXIT_FAILURE; + + //---- HKEY_LOCAL_MACHINE ----// + CoCreateInstance(&_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, + &_IID_IGroupPolicyObject, (void **)&pGPO); + + hr = pGPO->lpVtbl->OpenLocalMachineGPO(pGPO, GPO_OPEN_LOAD_REGISTRY); + if (FAILED(hr)) + return EXIT_FAILURE; + + hKey = HKEY_LOCAL_MACHINE; + pGPO->lpVtbl->GetRegistryKey(pGPO, GPO_SECTION_MACHINE, &hKey); + + // If allowed (1): unused apps would be uninstalled with their user data left + // intact, then reinstalled if launched afterwards at any point in time. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Appx", + L"AllowAutomaticAppArchiving", 0); + + // Shows what's slowing down bootups and shutdowns. + set_dword(hKey, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", + L"verbosestatus", 1); + + // Ask to not allow execution of experiments by Microsoft. + set_dword(hKey, + L"SOFTWARE\\Microsoft\\PolicyManager\\current\\device\\System", + L"AllowExperimentation", 0); + + // Power Throttling causes severe performance reduction for VMWare + // Workstation 17. + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Control\\Power\\PowerThrottling", + L"PowerThrottlingOff", 1); + + // https://docs.microsoft.com/en-us/windows/desktop/win7appqual/fault-tolerant-heap + // FTH being enabled causes issues with specific apps such as Assetto Corsa. + set_dword(hKey, L"SOFTWARE\\Microsoft\\FTH", L"Enabled", 0); + + // [P1] Automated file cleanup without user interaction is a bad idea, even if + // ran only on low-disk space events. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Appx", + L"AllowStorageSenseGlobal", 0); + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\StorageSense", + L"AllowStorageSenseGlobal", 0); + + // Allocate more RAM to NTFS' paged pool. + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Policies", + L"NtfsForceNonPagedPoolAllocation", 0); + wchar_t raisePoolLimit[] = L"fsutil.exe behavior set memoryusage 2"; + start_command_and_wait(raisePoolLimit); + + // Disable automatic repair to instead ask for a repair. Does not disable + // Windows' Recovery environment thankfully. + wchar_t disableAutoRepair[] = + L"bcdedit.exe /set \"{default}\" recoveryenabled no"; + start_command_and_wait(disableAutoRepair); + + // Do not page drivers and other system code to a disk, keep it in memory. + set_dword( + hKey, + L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management", + L"DisablePagingExecutive", 1); + + //---- Disables "Fast startup". + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", + L"HiberbootEnabled", 0); + + const wchar_t *filePath = + L"C:\\Windows\\System32\\SleepStudy\\UserNotPresentSession.etl"; + + // Incase the file doesn't exist. + FILE *file = NULL; + errno_t err = _wfopen_s(&file, filePath, L"w"); + if (err != 0 || file == NULL) + return EXIT_FAILURE; + + DWORD attributes = GetFileAttributesW(filePath); + attributes |= FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY; + + if (!SetFileAttributesW(filePath, attributes)) + return EXIT_FAILURE; + //----- + + // Visual Studio 2017 up to 2022: PerfWatson2 (VSCEIP; telemetry) is + // intensive on resources, disable it. + set_dword(hKey, L"SOFTWARE\\Wow6432Node\\Microsoft\\VSCommon\\15.0\\SQM", + L"OptIn", 0); + set_dword(hKey, L"SOFTWARE\\Wow6432Node\\Microsoft\\VSCommon\\16.0\\SQM", + L"OptIn", 0); + set_dword(hKey, L"SOFTWARE\\Wow6432Node\\Microsoft\\VSCommon\\17.0\\SQM", + L"OptIn", 0); + + //---- [P1] Disable various forms of telemetry. + set_dword( + hKey, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\DataCollection", + L"AllowTelemetry", 0); + + set_dword( + hKey, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\DataCollection", + L"MaxTelemetryAllowed", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AdvertisingInfo", + L"DisabledByGroupPolicy", 1); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection", + L"AllowDeviceNameInTelemetry", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection", + L"AllowTelemetry", 0); + + // https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#31-services-configuration + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection", + L"DisableOneSettingsDownloads", 1); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection", + L"DisableTelemetryOptInChangeNotification", 1); + + // Disable "Connected User Experiences and Telemetry" service + set_dword( + hKey, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Diagnostics\\DiagTrack", + L"ShowedToastAtLevel", 1); + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Services\\DiagTrack", L"Start", + 4); + + // Disable "Diagnostic Policy Service". + // Logs tons of information to be sent off and analyzed by Microsoft, and in + // some cases caused noticeable performance slowdown. + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Services\\DPS", L"Start", 4); + + // Disable "Customer Experience Improvement Program"; also implies turning off + // the Inventory Collector. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\AppV\\CEIP", L"CEIPEnable", + 0); + set_dword(hKey, L"SOFTWARE\\Microsoft\\SQMClient\\Windows", L"CEIPEnable", 0); + + //-- [P1] Disable "Windows Error Reporting" service. + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"Disabled", 1); + + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"AutoApproveOSDumps", 0); + + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"DefaultConsent", 1); + + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"DefaultOverrideBehavior", 0); + + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"DontSendAdditionalData", 1); + + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting", + L"LoggingDisabled", 1); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"AllOrNone", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"IncludeKernelFaults", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"IncludeMicrosoftApps", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"IncludeShutdownErrs", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"IncludeWindowsApps", 0); + + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"DoReport", 0); + + set_dword(hKey, + L"SOFTWARE\\Policies\\Microsoft\\Windows\\DeviceInstall\\Settings", + L"DisableSendGenericDriverNotFoundToWER", 1); + + set_dword(hKey, + L"SOFTWARE\\Policies\\Microsoft\\Windows\\DeviceInstall\\Settings", + L"DisableSendRequestAdditionalSoftwareToWER", 1); + + set_dword(hKey, + L"SOFTWARE\\Policies\\Microsoft\\Windows\\Windows Error Reporting", + L"Disabled", 1); + + set_string(hKey, + L"SOFTWARE\\Policies\\Microsoft\\Windows\\Windows Error " + L"Reporting\\ExcludedApplications", + L"*", L"*"); + + set_string( + hKey, + L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting\\ExclusionList", + L"*", L"*"); + + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Services\\WerSvc", L"Start", 4); + //-- + + // Disable telemetry for Tablet PC's handwriting recognition. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\TabletPC", + L"PreventHandwritingDataSharing", 1); + //---- + + // [P1] Disable feedback reminders. + set_dword(hKey, L"Software\\Policies\\Microsoft\\Windows\\DataCollection", + L"DoNotShowFeedbackNotifications", 1); + + // Ask OneDrive to only generate network traffic if signed in to OneDrive. + set_dword(hKey, L"SOFTWARE\\Microsoft\\OneDrive", + L"PreventNetworkTrafficPreUserSignIn", 1); + + // Don't ask to change the current privacy settings after applying a major + // Windows update. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\OOBE", + L"DisablePrivacyExperience", 1); + + //---- HKEY_CURRENT_USER ----// + gp_cleanup(hr); + CoCreateInstance(&_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, + &_IID_IGroupPolicyObject, (LPVOID *)&pGPO); + + hr = pGPO->lpVtbl->OpenLocalMachineGPO(pGPO, GPO_OPEN_LOAD_REGISTRY); + if (FAILED(hr)) + return EXIT_FAILURE; + + hKey = HKEY_CURRENT_USER; + pGPO->lpVtbl->GetRegistryKey(pGPO, GPO_SECTION_USER, &hKey); + + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\AdvertisingInfo", + L"Enabled", 0); + set_dword( + hKey, + L"Software\\Microsoft\\Speech_OneCore\\Settings\\OnlineSpeechPrivacy", + L"HasAccepted", 0); + set_dword(hKey, L"Software\\Microsoft\\InputPersonalization", + L"RestrictImplicitInkCollection", 1); + set_dword(hKey, L"Software\\Microsoft\\InputPersonalization", + L"RestrictImplicitTextCollection", 1); + + // Disable the language list fingerprinting method; useful for bypassing + // geolocation restrictions. + set_dword(hKey, L"Control Panel\\International\\User Profile", + L"HttpAcceptLanguageOptOut", 1); + + // [P2] Disable feedback reminders. + set_dword(hKey, L"SOFTWARE\\Microsoft\\Siuf\\Rules", L"NumberOfSIUFInPeriod", + 0); + set_dword(hKey, L"SOFTWARE\\Microsoft\\Siuf\\Rules", L"PeriodInNanoSeconds", + 0); + + // Enable multiple processes for explorer.exe for increased stability and + // performance. + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + L"SeparateProcess", 1); + + // Hidden file extensions are abused to hide the real file format, example: + // an executable (.exe, .scr, .com) pretending to be a PDF. + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + L"HideFileExt", 0); + + // Visual Studio 2022: disable other telemetry. + set_dword(hKey, L"Software\\Microsoft\\VisualStudio\\Telemetry", + L"TurnOffSwitch", 1); + + gp_cleanup(hr); + + //---- Outside of GPO ----// + + // [P2] Disable "Windows Error Reporting" service. + remove_subkey(hKey, + L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"InclusionList"); + remove_subkey(hKey, + L"SOFTWARE\\Policies\\Microsoft\\PCHealth\\ErrorReporting", + L"Consent"); + + // [P2] Automated file cleanup without user interaction is a bad idea, even if + // ran only on low-disk space events. + remove_subkey(hKey, L"Software\\Microsoft\\Windows\\CurrentVersion", + L"StorageSense"); + + // Random disconnection fix for specific network adapters, such as Intel's + // I225-V. + wchar_t setWFL[] = L"powershell.exe Set-NetAdapterAdvancedProperty -Name '*' " + L"-DisplayName 'Wait for Link' -RegistryValue 0"; + start_command_and_wait(setWFL); + + return EXIT_SUCCESS; +} diff --git a/src/Edits.ixx b/src/Edits.ixx deleted file mode 100644 index decb739..0000000 --- a/src/Edits.ixx +++ /dev/null @@ -1,312 +0,0 @@ -module; -#include -#include -#include -#include -#include -export module Edits; -import Common; -import ; -import ; -import ; - -export size_t gp_edits() { - // Apartment-threaded required for GPOs - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - if (FAILED(hr)) - return 1; - - //---- HKEY_LOCAL_MACHINE ----// - CoCreateInstance(_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, - _IID_IGroupPolicyObject, (LPVOID *)&pGPO); - - hr = pGPO->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY); - if (FAILED(hr)) - return 1; - - hKey = HKEY_LOCAL_MACHINE; - pGPO->GetRegistryKey(GPO_SECTION_MACHINE, &hKey); - - // If allowed (1): unused apps would be uninstalled with their user data left - // intact, then reinstalled if launched afterwards at any point in time. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\Appx)", - L"AllowAutomaticAppArchiving", 0); - - // Shows what's slowing down bootups and shutdowns. - set_dword(hKey, - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System)", - L"verbosestatus", 1); - - // Ask to not allow execution of experiments by Microsoft. - set_dword(hKey, LR"(SOFTWARE\Microsoft\PolicyManager\current\device\System)", - L"AllowExperimentation", 0); - - // Power Throttling causes severe performance reduction for VMWare - // Workstation 17. - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Control\Power\PowerThrottling)", - L"PowerThrottlingOff", 1); - - // https://docs.microsoft.com/en-us/windows/desktop/win7appqual/fault-tolerant-heap - // FTH being enabled causes issues with specific apps such as Assetto Corsa. - set_dword(hKey, LR"(SOFTWARE\Microsoft\FTH)", L"Enabled", 0); - - // [P1] Automated file cleanup without user interaction is a bad idea, even if - // ran only on low-disk space events. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\Appx)", - L"AllowStorageSenseGlobal", 0); - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\StorageSense)", - L"AllowStorageSenseGlobal", 0); - - // Allocate more RAM to NTFS' paged pool. - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Policies)", - L"NtfsForceNonPagedPoolAllocation", 0); - wchar_t raisePoolLimit[] = L"fsutil.exe behavior set memoryusage 2"; - start_command_and_wait(raisePoolLimit); - - // Disable automatic repair to instead ask for a repair. Does not disable - // Windows' Recovery environment thankfully. - wchar_t disableAutoRepair[] = - LR"(bcdedit.exe /set "{default}" recoveryenabled no)"; - start_command_and_wait(disableAutoRepair); - - // Do not page drivers and other system code to a disk, keep it in memory. - set_dword( - hKey, - LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management)", - L"DisablePagingExecutive", 1); - - //---- Disables "Fast startup". - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Power)", - L"HiberbootEnabled", 0); - - std::wstring filePath = - LR"(C:\Windows\System32\SleepStudy\UserNotPresentSession.etl)"; - - // Incase the file doesn't exist. - std::ofstream file(filePath); - file.close(); - - DWORD attributes = GetFileAttributesW(filePath.c_str()); - attributes |= FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_READONLY; - - if (SetFileAttributesW(filePath.c_str(), attributes)) - return 1; - //----- - - //---- Visual Studio 2017 up to 2022: PerfWatson2 (VSCEIP; telemetry) is - // intensive on resources, disable it. - if (!os_64bit_check()) { - set_dword(hKey, LR"(Software\Microsoft\VSCommon\15.0\SQM)", L"OptIn", 0); - set_dword(hKey, LR"(Software\Microsoft\VSCommon\16.0\SQM)", L"OptIn", 0); - set_dword(hKey, LR"(Software\Microsoft\VSCommon\17.0\SQM)", L"OptIn", 0); - } - // 64-bit / x86_64 - set_dword(hKey, LR"(SOFTWARE\Wow6432Node\Microsoft\VSCommon\15.0\SQM)", - L"OptIn", 0); - set_dword(hKey, LR"(SOFTWARE\Wow6432Node\Microsoft\VSCommon\16.0\SQM)", - L"OptIn", 0); - set_dword(hKey, LR"(SOFTWARE\Wow6432Node\Microsoft\VSCommon\17.0\SQM)", - L"OptIn", 0); - //---- - - //---- [P1] Disable various forms of telemetry. - set_dword( - hKey, - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection)", - L"AllowTelemetry", 0); - - set_dword( - hKey, - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection)", - L"MaxTelemetryAllowed", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo)", - L"DisabledByGroupPolicy", 1); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\DataCollection)", - L"AllowDeviceNameInTelemetry", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\DataCollection)", - L"AllowTelemetry", 0); - - // https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#31-services-configuration - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\DataCollection)", - L"DisableOneSettingsDownloads", 1); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\DataCollection)", - L"DisableTelemetryOptInChangeNotification", 1); - - // Disable "Connected User Experiences and Telemetry" service - set_dword( - hKey, - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack)", - L"ShowedToastAtLevel", 1); - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Services\DiagTrack)", L"Start", - 4); - - // Disable "Diagnostic Policy Service". - // Logs tons of information to be sent off and analyzed by Microsoft, and in - // some cases caused noticeable performance slowdown. - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Services\DPS)", L"Start", 4); - - // Disable "Customer Experience Improvement Program"; also implies turning off - // the Inventory Collector. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\AppV\CEIP)", L"CEIPEnable", - 0); - set_dword(hKey, LR"(SOFTWARE\Microsoft\SQMClient\Windows)", L"CEIPEnable", 0); - - //-- [P1] Disable "Windows Error Reporting" service. - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"Disabled", 1); - - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"AutoApproveOSDumps", 0); - - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"DefaultConsent", 1); - - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"DefaultOverrideBehavior", 0); - - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"DontSendAdditionalData", 1); - - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows\Windows Error Reporting)", - L"LoggingDisabled", 1); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"AllOrNone", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"IncludeKernelFaults", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"IncludeMicrosoftApps", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"IncludeShutdownErrs", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"IncludeWindowsApps", 0); - - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting)", - L"DoReport", 0); - - set_dword(hKey, - LR"(SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Settings)", - L"DisableSendGenericDriverNotFoundToWER", 1); - - set_dword(hKey, - LR"(SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Settings)", - L"DisableSendRequestAdditionalSoftwareToWER", 1); - - set_dword(hKey, - LR"(SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting)", - L"Disabled", 1); - - set_string( - hKey, - LR"(SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting\ExcludedApplications)", - L"*", L"*"); - - set_string( - hKey, - LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting\ExclusionList)", - L"*", L"*"); - - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Services\WerSvc)", L"Start", 4); - //-- - - // Disable telemetry for Tablet PC's handwriting recognition. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\TabletPC)", - L"PreventHandwritingDataSharing", 1); - //---- - - // [P1] Disable feedback reminders. - set_dword(hKey, LR"(Software\Policies\Microsoft\Windows\DataCollection)", - L"DoNotShowFeedbackNotifications", 1); - - // Ask OneDrive to only generate network traffic if signed in to OneDrive. - set_dword(hKey, LR"(SOFTWARE\Microsoft\OneDrive)", - L"PreventNetworkTrafficPreUserSignIn", 1); - - // Don't ask to change the current privacy settings after applying a major - // Windows update. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\OOBE)", - L"DisablePrivacyExperience", 1); - - //---- HKEY_CURRENT_USER ----// - gp_cleanup(hr); - CoCreateInstance(_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, - _IID_IGroupPolicyObject, (LPVOID *)&pGPO); - - hr = pGPO->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY); - if (FAILED(hr)) - return 1; - - hKey = HKEY_CURRENT_USER; - pGPO->GetRegistryKey(GPO_SECTION_USER, &hKey); - - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo)", - L"Enabled", 0); - set_dword( - hKey, - LR"(Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy)", - L"HasAccepted", 0); - set_dword(hKey, LR"(Software\Microsoft\InputPersonalization)", - L"RestrictImplicitInkCollection", 1); - set_dword(hKey, LR"(Software\Microsoft\InputPersonalization)", - L"RestrictImplicitTextCollection", 1); - - // Disable the language list fingerprinting method; useful for bypassing - // geolocation restrictions. - set_dword(hKey, LR"(Control Panel\International\User Profile)", - L"HttpAcceptLanguageOptOut", 1); - - // [P2] Disable feedback reminders. - set_dword(hKey, LR"(SOFTWARE\Microsoft\Siuf\Rules)", L"NumberOfSIUFInPeriod", - 0); - set_dword(hKey, LR"(SOFTWARE\Microsoft\Siuf\Rules)", L"PeriodInNanoSeconds", - 0); - - // Enable multiple processes for explorer.exe for increased stability and - // performance. - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced)", - L"SeparateProcess", 1); - - // Hidden file extensions are abused to hide the real file format, example: - // an executable (.exe, .scr, .com) pretending to be a PDF. - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced)", - L"HideFileExt", 0); - - // Visual Studio 2022: disable other telemetry. - set_dword(hKey, LR"(Software\Microsoft\VisualStudio\Telemetry)", - L"TurnOffSwitch", 1); - - gp_cleanup(hr); - - //---- Outside of GPO ----// - - // [P2] Disable "Windows Error Reporting" service. - remove_key( - hKey, - LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting\InclusionList)"); - remove_key(hKey, - LR"(SOFTWARE\Policies\Microsoft\PCHealth\ErrorReporting\Consent)"); - - // [P2] Automated file cleanup without user interaction is a bad idea, even if - // ran only on low-disk space events. - remove_key(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\StorageSense)"); - - // Random disconnection fix for specific network adapters, such as Intel's - // I225-V. - wchar_t setWFL[] = - LR"(powershell.exe Set-NetAdapterAdvancedProperty -Name '*' -DisplayName 'Wait for Link' -RegistryValue 0)"; - start_command_and_wait(setWFL); - - return 0; -} diff --git a/src/MSStore.c b/src/MSStore.c new file mode 100644 index 0000000..854459d --- /dev/null +++ b/src/MSStore.c @@ -0,0 +1,84 @@ +#include "Common.h" +#include +#include +#include +#include + +int download_file(const wchar_t *url, const wchar_t *destination) { + const wchar_t *userAgent = + L"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, " + L"like Gecko) Chrome/129.0.0.0 Safari/537.3"; + void *hInternet = + InternetOpenW(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); + if (!hInternet) + return EXIT_FAILURE; + + void *hUrl = InternetOpenUrlW(hInternet, url, NULL, 0, + INTERNET_FLAG_RELOAD | INTERNET_FLAG_SECURE, 0); + if (!hUrl) { + InternetCloseHandle(hInternet); + return EXIT_FAILURE; + } + + void *hFile = CreateFileW(destination, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + + if (hFile == INVALID_HANDLE_VALUE) { + InternetCloseHandle(hUrl); + InternetCloseHandle(hInternet); + return EXIT_FAILURE; + } + + const int length = 4096; + char *buffer = (char *)malloc(length); + if (buffer == NULL) { + InternetCloseHandle(hUrl); + InternetCloseHandle(hInternet); + return EXIT_FAILURE; + } + + unsigned long bytesRead, bytesWritten; + + while (InternetReadFile(hUrl, buffer, (size_t)buffer, &bytesRead) && + bytesRead > 0) { + + if (!WriteFile(hFile, buffer, bytesRead, &bytesWritten, NULL) || + bytesWritten != bytesRead) { + CloseHandle(hFile); + InternetCloseHandle(hUrl); + InternetCloseHandle(hInternet); + return EXIT_FAILURE; + } + } + + CloseHandle(hFile); + InternetCloseHandle(hUrl); + InternetCloseHandle(hInternet); + return EXIT_SUCCESS; +} + +int install_microsoft_store() { + + wchar_t cmdLine1[] = L"wsreset.exe -i"; + start_command_and_wait(cmdLine1); + + // .appx and winget support + const wchar_t *url = + L"https://github.com/microsoft/winget-cli/releases/latest/download/" + L"Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"; + + PWSTR desktopPath; + SHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &desktopPath); + const wchar_t *appName = + L"Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"; + wchar_t destination[MAX_PATH]; + append_wchar_t(desktopPath, appName, destination); + + if (download_file(url, destination)) + return EXIT_FAILURE; + + wchar_t cmdLine2[] = L"powershell.exe Add -AppxPackage -Path '${home}\\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'"; + start_command_and_wait(cmdLine2); + + return EXIT_SUCCESS; +}; diff --git a/src/MSStore.ixx b/src/MSStore.ixx deleted file mode 100644 index b395d41..0000000 --- a/src/MSStore.ixx +++ /dev/null @@ -1,86 +0,0 @@ -module; -#include -#include -export module MSStore; -import Common; -import ; -import ; -import ; -import ; -import ; - - -std::optional download_file(const std::wstring &url, - const std::filesystem::path &destination, - const std::wstring &userAgent) {; - void *hInternet = InternetOpenW( - userAgent.c_str(), - INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); - if (!hInternet) - return std::nullopt; - - void *hUrl = - InternetOpenUrlW(hInternet, url.c_str(), NULL, 0, - INTERNET_FLAG_RELOAD | INTERNET_FLAG_SECURE, 0); - if (!hUrl) { - InternetCloseHandle(hInternet); - return std::nullopt; - } - - std::filesystem::create_directories(destination.parent_path()); - void *hFile = CreateFileW(destination.c_str(), GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - - if (hFile == INVALID_HANDLE_VALUE) { - InternetCloseHandle(hUrl); - InternetCloseHandle(hInternet); - return std::nullopt; - } - - std::vector buffer(4096); - unsigned long bytesRead, bytesWritten; - - while (InternetReadFile(hUrl, buffer.data(), - static_cast(buffer.size()), - &bytesRead) && - bytesRead > 0) { - std::span writeSpan = std::span(buffer.data(), bytesRead); - if (!WriteFile(hFile, writeSpan.data(), - static_cast(writeSpan.size()), &bytesWritten, - NULL) || - bytesWritten != bytesRead) { - CloseHandle(hFile); - InternetCloseHandle(hUrl); - InternetCloseHandle(hInternet); - return std::nullopt; - } - } - - CloseHandle(hFile); - InternetCloseHandle(hUrl); - InternetCloseHandle(hInternet); - return 0; -} - -export size_t install_microsoft_store() { - wchar_t cmdLine1[] = LR"(wsreset.exe -i)"; - start_command_and_wait(cmdLine1); - - // .appx and winget support - const wchar_t *url = - L"https://github.com/microsoft/winget-cli/releases/latest/download/" - L"Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"; - const wchar_t *destination = - LR"(C:\Windows\Temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle)"; - const wchar_t *userAgent = - LR"(Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.3)"; - - download_file(url, destination, userAgent); - - wchar_t cmdLine2[] = - LR"(powershell.exe Add-AppxPackage -Path 'C:\Windows\Temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle')"; - - start_command_and_wait(cmdLine2); - - return 0; -}; diff --git a/src/PrivacyMode.c b/src/PrivacyMode.c new file mode 100644 index 0000000..a8a3d03 --- /dev/null +++ b/src/PrivacyMode.c @@ -0,0 +1,140 @@ +#include "Common.h" +#include + +int install_privacy_mode() { + // Apartment-threaded required for GPOs + HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) + return EXIT_FAILURE; + + CoCreateInstance(&_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, + &_IID_IGroupPolicyObject, (LPVOID *)&pGPO); + + hr = pGPO->lpVtbl->OpenLocalMachineGPO(pGPO, GPO_OPEN_LOAD_REGISTRY); + if (FAILED(hr)) + return EXIT_FAILURE; + + HKEY hKey = HKEY_LOCAL_MACHINE; + pGPO->lpVtbl->GetRegistryKey(pGPO, GPO_SECTION_MACHINE, &hKey); + + // Do not analyze apps' execution time data. + set_dword(hKey, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", + L"Disable Performance Counters", 1); + + // Do not keep track of recently opened files. + set_dword(hKey, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", + L"NoRecentDocsHistory", 1); + + // Disable Superfetch. + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Services\\SysMain", L"Start", 4); + set_dword( + hKey, + L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Management", + L"EnableSuperfetch", 0); + + // Disable Prefetch. + set_dword( + hKey, + L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management\\PrefetchParameters", + L"EnablePrefetcher", 0); + + // Do not use "Last Access Time Stamp Updates" by default; apps can still + // explicitly update these timestamps for themself. + wchar_t disableFileTimestamps[] = + L"fsutil.exe behavior set disablelastaccess 3"; + start_command_and_wait(disableFileTimestamps); + + // Disable "Application Impact Telemetry". + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"AITEnable", 0); + + // Disable "Program Compatibility Assistant" + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"DisablePCA", 1); + + // Disable "Application Compatibility Engine" + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"DisableEngine", 1); + + // Disable "SwitchBack Compatibility Engine" + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"SbEnable", 0); + + // Disable "User Steps Recorder" + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"DisableUAR", 1); + + // Disable "Inventory Collector" + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", + L"DisableInventory", 1); + + // Disable "Program Compatibility Assistant" service + set_dword(hKey, L"SYSTEM\\CurrentControlSet\\Services", L"PcaSvc", 4); + + // Disable PerfTrack. + set_dword( + hKey, + L"SOFTWARE\\Policies\\Microsoft\\Windows\\WDI\\{9c5a40da-b965-4fc3-8781-88dd50a6299d}", + L"ScenarioExecutionEnabled", 0); + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Messenger\\Client", L"CEIP", + 2); + + // [P1] Disable tracking of application startups. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\EdgeUI", + L"DisableMFUTracking", 1); + + // Fully disable the activity feed. + set_dword(hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows\\System", + L"EnableActivityFeed", 0); + set_dword(hKey, L"(SOFTWARE\\Policies\\Microsoft\\Windows\\System", + L"PublishUserActivities", 0); + set_dword(hKey, L"(SOFTWARE\\Policies\\Microsoft\\Windows\\System", + L"UploadUserActivities", 0); + + gp_cleanup(hr); + + //---- HKEY_CURRENT_USER ----// + CoCreateInstance(&_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, + &_IID_IGroupPolicyObject, (LPVOID *)&pGPO); + + hr = pGPO->lpVtbl->OpenLocalMachineGPO(pGPO, GPO_OPEN_LOAD_REGISTRY); + if (FAILED(hr)) + return EXIT_FAILURE; + + hKey = HKEY_CURRENT_USER; + pGPO->lpVtbl->GetRegistryKey(pGPO, GPO_SECTION_USER, &hKey); + + // Do not search disks to attempt fixing a missing shortcut. + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer)", + L"LinkResolveIgnoreLinkInfo", 1); + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer)", + L"NoResolveSearch", 1); + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer)", + L"NoResolveTrack", 1); + + // Disable Device Search History. + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\SearchSettings", + L"IsDeviceSearchHistoryEnabled", 0); + + // By default Windows does not automatically back-up the registry, but just in + // case they change this.. + set_dword( + hKey, + L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Configuration Manager", + L"EnablePeriodicBackup", 0); + + // [P2] Disable tracking of application startups. + set_dword(hKey, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + L"Start_TrackProgs", 0); + set_dword(hKey, L"Software\\Policies\\Microsoft\\Windows\\EdgeUI)", + L"DisableMFUTracking", 1); + + gp_cleanup(hr); + return 0; +}; diff --git a/src/PrivacyMode.ixx b/src/PrivacyMode.ixx deleted file mode 100644 index 60b803e..0000000 --- a/src/PrivacyMode.ixx +++ /dev/null @@ -1,146 +0,0 @@ -module; -#include -#include -#include -#include -#include -export module PrivacyMode; -import Common; - -export size_t install_privacy_mode() { - // Apartment-threaded required for GPOs - HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - if (FAILED(hr)) - return 1; - - CoCreateInstance(_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, - _IID_IGroupPolicyObject, (LPVOID *)&pGPO); - - hr = pGPO->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY); - if (FAILED(hr)) - return 1; - - HKEY hKey = HKEY_LOCAL_MACHINE; - pGPO->GetRegistryKey(GPO_SECTION_MACHINE, &hKey); - - // Do not analyze apps' execution time data. - set_dword(hKey, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib)", - L"Disable Performance Counters", 1); - - // Do not keep track of recently opened files. - set_dword(hKey, - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer)", - L"NoRecentDocsHistory", 1); - - // Disable Superfetch. - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Services\SysMain)", L"Start", 4); - set_dword( - hKey, - LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management)", - L"EnableSuperfetch", 0); - - // Disable Prefetch. - set_dword( - hKey, - LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters)", - L"EnablePrefetcher", 0); - - // Do not use "Last Access Time Stamp Updates" by default; apps can still - // explicitly update these timestamps for themself. - wchar_t disableFileTimestamps[] = - L"fsutil.exe behavior set disablelastaccess 3"; - start_command_and_wait(disableFileTimestamps); - - // Disable "Application Impact Telemetry". - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"AITEnable", 0); - - // Disable "Program Compatibility Assistant" - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"DisablePCA", 1); - - // Disable "Application Compatibility Engine" - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"DisableEngine", 1); - - // Disable "SwitchBack Compatibility Engine" - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"SbEnable", 0); - - // Disable "User Steps Recorder" - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"DisableUAR", 1); - - // Disable "Inventory Collector" - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\AppCompat)", - L"DisableInventory", 1); - - // Disable "Program Compatibility Assistant" service - set_dword(hKey, LR"(SYSTEM\CurrentControlSet\Services)", L"PcaSvc", 4); - - // Disable PerfTrack. - set_dword( - hKey, - LR"(SOFTWARE\Policies\Microsoft\Windows\WDI\{9c5a40da-b965-4fc3-8781-88dd50a6299d})", - L"ScenarioExecutionEnabled", 0); - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Messenger\Client)", L"CEIP", - 2); - - // [P1] Disable tracking of application startups. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\EdgeUI)", - L"DisableMFUTracking", 1); - - // Fully disable the activity feed. - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\System)", - L"EnableActivityFeed", 0); - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\System)", - L"PublishUserActivities", 0); - set_dword(hKey, LR"(SOFTWARE\Policies\Microsoft\Windows\System)", - L"UploadUserActivities", 0); - - gp_cleanup(hr); - - //---- HKEY_CURRENT_USER ----// - CoCreateInstance(_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, - _IID_IGroupPolicyObject, (LPVOID *)&pGPO); - - hr = pGPO->OpenLocalMachineGPO(GPO_OPEN_LOAD_REGISTRY); - if (FAILED(hr)) - return 1; - - hKey = HKEY_CURRENT_USER; - pGPO->GetRegistryKey(GPO_SECTION_USER, &hKey); - - // Do not search disks to attempt fixing a missing shortcut. - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Policies\Explorer)", - L"LinkResolveIgnoreLinkInfo", 1); - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Policies\Explorer)", - L"NoResolveSearch", 1); - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Policies\Explorer)", - L"NoResolveTrack", 1); - - // Disable Device Search History. - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\SearchSettings)", - L"IsDeviceSearchHistoryEnabled", 0); - - // By default Windows does not automatically back-up the registry, but just in - // case they change this.. - set_dword( - hKey, - LR"(SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager)", - L"EnablePeriodicBackup", 0); - - // [P2] Disable tracking of application startups. - set_dword(hKey, - LR"(Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced)", - L"Start_TrackProgs", 0); - set_dword(hKey, LR"(Software\Policies\Microsoft\Windows\EdgeUI)", - L"DisableMFUTracking", 1); - - gp_cleanup(hr); - return 0; -}; diff --git a/src/Resource.h b/src/Resource.h index 83e0bac..1e22a60 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -1,31 +1,27 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by W11Boost.rc +// +#define IDC_MYICON 2 +#define IDD_W11BOOST_DIALOG 102 +#define IDS_APP_TITLE 103 +#define IDI_W11BOOST 107 +#define IDC_W11BOOST 109 +#define IDR_MAINFRAME 128 +#define IDC_APPLY_W11BOOST 200 +#define IDC_CREATE_RESTORE_POINT 201 +#define IDC_PRIVACY_MODE 202 +#define IDC_INSTALL_MICROSOFT_STORE 203 +#define IDC_STATIC -1 -#define IDS_APP_TITLE 103 - -#define IDR_MAINFRAME 128 -#define IDD_W11BOOST_DIALOG 102 -#define IDI_W11BOOST 107 -#define IDI_SMALL 108 -#define IDC_W11BOOST 109 -#define IDC_MYICON 2 -#ifndef IDC_STATIC -#define IDC_STATIC -1 -#define IDC_APPLY_W11BOOST 200 -#define IDC_CREATE_RESTORE_POINT 201 -#define IDC_PRIVACY_MODE 202 -#define IDC_INSTALL_MICROSOFT_STORE 203 -#endif // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS - -#define _APS_NO_MFC 130 -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 135 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 #endif #endif diff --git a/src/RestorePoint.ixx b/src/RestorePoint.c similarity index 84% rename from src/RestorePoint.ixx rename to src/RestorePoint.c index 68876dc..3826744 100644 --- a/src/RestorePoint.ixx +++ b/src/RestorePoint.c @@ -1,10 +1,7 @@ -module; -#include -#include -#include -#include -export module RestorePoint; -import Common; +#include "Common.h" +#include +#include +#include typedef bool(WINAPI *PFN_SETRESTOREPTW)(PRESTOREPOINTINFOW, PSTATEMGRSTATUS); @@ -14,7 +11,7 @@ bool InitializeCOMSecurity() { // returned by ConvertStringSecurityDescriptorToSecurityDescriptor(). SECURITY_DESCRIPTOR securityDesc = {0}; - EXPLICIT_ACCESS ea[5] = {0}; + EXPLICIT_ACCESS ea[5] = {{0}}; ACL *pAcl = NULL; unsigned __int64 rgSidBA[(SECURITY_MAX_SID_SIZE + sizeof(unsigned __int64) - 1) / @@ -44,7 +41,7 @@ bool InitializeCOMSecurity() { // // Initialize the security descriptor. - fRet = ::InitializeSecurityDescriptor(&securityDesc, + fRet = InitializeSecurityDescriptor(&securityDesc, SECURITY_DESCRIPTOR_REVISION); if (!fRet) goto exit; @@ -52,31 +49,31 @@ bool InitializeCOMSecurity() { // Create an administrator group security identifier (SID). cbSid = sizeof(rgSidBA); fRet = - ::CreateWellKnownSid(WinBuiltinAdministratorsSid, NULL, rgSidBA, &cbSid); + CreateWellKnownSid(WinBuiltinAdministratorsSid, NULL, rgSidBA, &cbSid); if (!fRet) goto exit; // Create a local service security identifier (SID). cbSid = sizeof(rgSidLS); - fRet = ::CreateWellKnownSid(WinLocalServiceSid, NULL, rgSidLS, &cbSid); + fRet = CreateWellKnownSid(WinLocalServiceSid, NULL, rgSidLS, &cbSid); if (!fRet) goto exit; // Create a network service security identifier (SID). cbSid = sizeof(rgSidNS); - fRet = ::CreateWellKnownSid(WinNetworkServiceSid, NULL, rgSidNS, &cbSid); + fRet = CreateWellKnownSid(WinNetworkServiceSid, NULL, rgSidNS, &cbSid); if (!fRet) goto exit; // Create a personal account security identifier (SID). cbSid = sizeof(rgSidPS); - fRet = ::CreateWellKnownSid(WinSelfSid, NULL, rgSidPS, &cbSid); + fRet = CreateWellKnownSid(WinSelfSid, NULL, rgSidPS, &cbSid); if (!fRet) goto exit; // Create a local service security identifier (SID). cbSid = sizeof(rgSidSY); - fRet = ::CreateWellKnownSid(WinLocalSystemSid, NULL, rgSidSY, &cbSid); + fRet = CreateWellKnownSid(WinLocalSystemSid, NULL, rgSidSY, &cbSid); if (!fRet) goto exit; @@ -130,24 +127,24 @@ bool InitializeCOMSecurity() { ea[4].Trustee.ptstrName = (LPTSTR)rgSidSY; // Create an access control list (ACL) using this ACE list. - dwRet = ::SetEntriesInAcl(ARRAYSIZE(ea), ea, NULL, &pAcl); + dwRet = SetEntriesInAcl(ARRAYSIZE(ea), ea, NULL, &pAcl); if (dwRet != ERROR_SUCCESS || pAcl == NULL) { fRet = FALSE; goto exit; } // Set the security descriptor owner to Administrators. - fRet = ::SetSecurityDescriptorOwner(&securityDesc, rgSidBA, FALSE); + fRet = SetSecurityDescriptorOwner(&securityDesc, rgSidBA, FALSE); if (!fRet) goto exit; // Set the security descriptor group to Administrators. - fRet = ::SetSecurityDescriptorGroup(&securityDesc, rgSidBA, FALSE); + fRet = SetSecurityDescriptorGroup(&securityDesc, rgSidBA, FALSE); if (!fRet) goto exit; // Set the discretionary access control list (DACL) to the ACL. - fRet = ::SetSecurityDescriptorDacl(&securityDesc, TRUE, pAcl, FALSE); + fRet = SetSecurityDescriptorDacl(&securityDesc, TRUE, pAcl, FALSE); if (!fRet) goto exit; @@ -155,7 +152,7 @@ bool InitializeCOMSecurity() { // CoInitializeSecurity() for your application. Note that an // explicit security descriptor is being passed down. - hrRet = ::CoInitializeSecurity( + hrRet = CoInitializeSecurity( &securityDesc, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT_PRIVACY, RPC_C_IMP_LEVEL_IDENTIFY, NULL, EOAC_DISABLE_AAA | EOAC_NO_CUSTOM_MARSHAL, NULL); @@ -168,7 +165,7 @@ bool InitializeCOMSecurity() { exit: - ::LocalFree(pAcl); + LocalFree(pAcl); return fRet; } @@ -177,7 +174,7 @@ void restorepoint_prep() { HKEY hKey = HKEY_LOCAL_MACHINE; result = RegCreateKeyExW( - hKey, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore)", 0, + hKey, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, NULL); if (result == ERROR_SUCCESS) { @@ -187,7 +184,7 @@ void restorepoint_prep() { } result = RegCreateKeyExW( - hKey, LR"(SOFTWARE\Policies\Microsoft\Windows NT\SystemRestore)", 0, NULL, + hKey, L"SOFTWARE\\Policies\\Microsoft\\Windows NT\\SystemRestore", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, NULL); if (result == ERROR_SUCCESS) { @@ -203,7 +200,7 @@ void restorepoint_prep_revert() { HKEY hKey = HKEY_LOCAL_MACHINE; result = RegCreateKeyExW( - hKey, LR"(SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore)", 0, + hKey, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\SystemRestore", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hSubKey, NULL); if (result == ERROR_SUCCESS) { @@ -213,21 +210,21 @@ void restorepoint_prep_revert() { RegCloseKey(hKey); } -export size_t create_restore_point() { +int create_restore_point() { STATEMGRSTATUS SMgrStatus; // COINIT_MULTITHREADED seems to cause race conditions HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(hr)) - return 1; + return EXIT_FAILURE; bool fRet = InitializeCOMSecurity(); if (FAILED(fRet)) - return 1; + return EXIT_FAILURE; HMODULE hSrClient = LoadLibraryW(L"srclient.dll"); if (NULL == hSrClient) - return 1; + return EXIT_FAILURE; RESTOREPOINTINFOW RestorePtInfo = {.dwEventType = BEGIN_SYSTEM_CHANGE, .dwRestorePtType = APPLICATION_INSTALL, @@ -240,7 +237,7 @@ export size_t create_restore_point() { (PFN_SETRESTOREPTW)GetProcAddress(hSrClient, "SRSetRestorePointW"); if (NULL == fnSRSetRestorePointW) { goto exit; - return 1; + return EXIT_FAILURE; } restorepoint_prep(); @@ -250,11 +247,11 @@ export size_t create_restore_point() { if (!fRet) { // Either SR is off, or restore point creation failed outright goto exit; - return 1; + return EXIT_FAILURE; } - RestorePtInfo = {.dwEventType = END_SYSTEM_CHANGE, - .llSequenceNumber = SMgrStatus.llSequenceNumber}; + RestorePtInfo.dwEventType = END_SYSTEM_CHANGE; + RestorePtInfo.llSequenceNumber = SMgrStatus.llSequenceNumber; // End System Restore point fRet = fnSRSetRestorePointW(&RestorePtInfo, &SMgrStatus); diff --git a/src/W11Boost.aps b/src/W11Boost.aps deleted file mode 100644 index cce0d357e54aaea75702b4a8582e0f6c29da2f63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2848 zcmb_eO>^5s7=GL)ZBm*NX37j-2lrz-z<{xwgd{ycWl2fY$dbpBlXS*|Cd5i&NbF!I z6mA)&M-Cm%+_-V#X9Ujt1O5Ovj^f!}Ig;!)oiMEC-QD;5)$Y6RE&vn>ajbyTTw5S^ zpRk5aR5`|RA>mI?Boo}628@TT<{;`1THEczPPaAao%DC2RzEuG4O*L;R_*l$$LEt$ ze@Ey(CKL&AJV7|*3@Fd0b_G6*2UtM|2Z)HBa%Pe89miwh&pBTs=Kx2NyH8xlm+0Yy z{31&7Ba3#1zNS-ONPW%XbL>;*IX;o&Jb$xDJdP&`dz|HCE08LQ?9Om@sutr{d?tz6 z7&f8tt1_k@1~Td?AycTqrw5Tkqs-8I(W5_oQ_g+rC`Y_pyTyXrn?4 z70l{h(>uUTC`;-nwPZ+_=~2?i`%7qvGA; z?fzbL{B6`P?cXIm>b5((9I4jnMyckSZJL%F`cGlf?9I##;1Ov>LL6TssFfc*(_|-YidALwbd2*n=7-O{5bZ}Mz=`t_Dj{aIG&y`@DMGYwLwy?TG&P#hpata(g&vqklsb1V`)OLkB`w$G5BXk>MK6L;IQ3w6@ -#include -#include -#include -#include -import Edits; -import RestorePoint; -import PrivacyMode; -import MSStore; +#include "resource.h" +#include "Common.h" +#include +#include /* Type notes: - void * = HINTERNET; - const wchar_t * = LPCWSTR; - unsigned long = DWORD; - unsigned __int64 = ULONGLONG; + HINTERNET = void * + LPCWSTR = const wchar_t * + DWORD = unsigned long + ULONGLONG = unsigned __int64 WCHAR = wchar_t ATOM = WORD = unsigned short - UINT = size_t + UINT = unsigned int TCHAR = WCHAR = wchar_t */ #define MAX_LOADSTRING 100 // Global Variables: -HINSTANCE hInst; // current instance -wchar_t szTitle[MAX_LOADSTRING]; // The title bar text -wchar_t szWindowClass[MAX_LOADSTRING]; // the main window class name +HINSTANCE hInst; // Current instance +wchar_t szTitle[MAX_LOADSTRING]; // The title bar text +wchar_t szWindowClass[MAX_LOADSTRING]; // The main window class name // Forward declarations of functions included in this code module: unsigned short MyRegisterClass(HINSTANCE hInstance); -bool InitInstance(HINSTANCE, size_t); -LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +bool InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, unsigned int, WPARAM, LPARAM); int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, @@ -39,24 +33,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(lpCmdLine); // Place code that should always be ran here: - wchar_t currentPath[260]; // MAX_PATH = 260 - GetModuleFileNameW(NULL, currentPath, 260); - - wchar_t *removeExe = wcsrchr(currentPath, L'\\'); - if (removeExe != NULL) { - *removeExe = L'\0'; - } - - const wchar_t *dirName = L"W11Boost Logs"; - wchar_t fullPath[260]; - swprintf_s(fullPath, 260, L"%s\\%s", currentPath, dirName); - - // Ensure double-null termination - size_t len = wcslen(fullPath); - if (len + 2 < MAX_PATH) { - fullPath[len + 1] = L'\0'; - } - + wchar_t *fullPath = get_log_directory(); if (PathFileExistsW(fullPath)) { SHFILEOPSTRUCTW dir = {0}; dir.wFunc = FO_DELETE; @@ -64,8 +41,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, dir.fFlags = FOF_NO_UI | FOF_NOERRORUI; SHFileOperationW(&dir); } - CreateDirectoryW(fullPath, NULL); + free(fullPath); // Initialize global strings LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); @@ -90,7 +67,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, } } - return (size_t)msg.wParam; + return (int)msg.wParam; } // @@ -125,11 +102,11 @@ unsigned short MyRegisterClass(HINSTANCE hInstance) { // In this function, we save the instance handle in a global variable and // create and display the main program window. // -bool InitInstance(HINSTANCE hInstance, size_t nCmdShow) { +bool InitInstance(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // Store instance handle in our global variable - size_t width = 640; - size_t height = 480; + int width = 640; + int height = 480; HWND hWnd = CreateWindowExW( 0, szWindowClass, szTitle, WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU, @@ -145,8 +122,8 @@ bool InitInstance(HINSTANCE hInstance, size_t nCmdShow) { // Puts W11Boost's window in the center of the current monitor if (GetMonitorInfoW(monitor, &mi)) { RECT rcWork = mi.rcWork; - size_t x = rcWork.left + (rcWork.right - rcWork.left - width) / 2; - size_t y = rcWork.top + (rcWork.bottom - rcWork.top - height) / 2; + int x = rcWork.left + (rcWork.right - rcWork.left - width) / 2; + int y = rcWork.top + (rcWork.bottom - rcWork.top - height) / 2; SetWindowPos(hWnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER); } @@ -167,13 +144,13 @@ bool InitInstance(HINSTANCE hInstance, size_t nCmdShow) { // WM_DESTROY - post a quit message and return // // -LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, +LRESULT CALLBACK WndProc(HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: { - size_t fontSize = 30; - size_t dpi = GetDpiForWindow(hWnd); - size_t fontDpi = 96; + int fontSize = 30; + int dpi = GetDpiForWindow(hWnd); + int fontDpi = 96; HFONT hFont = CreateFontW(MulDiv(fontSize, dpi, fontDpi), 0, 0, 0, FW_LIGHT, FALSE, FALSE, 0, ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_NATURAL_QUALITY, @@ -182,8 +159,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, RECT rcClient; GetClientRect(hWnd, &rcClient); - size_t buttonWidth = rcClient.right / 2; - size_t buttonHeight = rcClient.bottom / 2; + int buttonWidth = rcClient.right / 2; + int buttonHeight = rcClient.bottom / 2; HWND hButton1 = CreateWindowW( L"BUTTON", L"Apply W11Boost", @@ -216,13 +193,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, SendMessageW(hButton4, WM_SETFONT, (WPARAM)hFont, TRUE); } break; case WM_COMMAND: { - size_t wmId = LOWORD(wParam); + int wmId = LOWORD(wParam); // Parse the selections: switch (wmId) { case IDC_APPLY_W11BOOST: if (MessageBoxW(hWnd, L"Are you sure you want to apply W11Boost?", L"W11Boost", MB_YESNO) == IDYES) { - size_t gpResult = gp_edits(); + int gpResult = gp_edits(); if (gpResult == 0) { MessageBoxW(hWnd, L"Complete. Manually reboot to apply all changes.", L"W11Boost", MB_OK); @@ -235,7 +212,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, if (MessageBoxW( hWnd, L"Are you sure you want to create a System Restore point?", L"W11Boost", MB_YESNO) == IDYES) { - size_t srResult = create_restore_point(); + int srResult = create_restore_point(); if (srResult == 0) { MessageBoxW(hWnd, L"System Restore point successfully created.", L"W11Boost", MB_OK); @@ -250,7 +227,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, L"This will hide as much activity as possible on your " L"PC, do you want this?", L"W11Boost", MB_YESNO) == IDYES) { - size_t pmResult = install_privacy_mode(); + int pmResult = install_privacy_mode(); if (pmResult == 0) { MessageBoxW(hWnd, L"Successfully installed Privacy Mode.", @@ -266,7 +243,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, L"Do you wish to install the Microsoft Store and .appx + " L".appxbundle support?", L"W11Boost", MB_YESNO) == IDYES) { - size_t msResult = install_microsoft_store(); + int msResult = install_microsoft_store(); if (msResult == 0) { MessageBoxW(hWnd, @@ -274,7 +251,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, L"additional minutes to show up.", L"W11Boost", MB_OK); } else { - MessageBoxW(hWnd, L"The App Installer likely failed to install!", + MessageBoxW(hWnd, L"The 'App Installer' failed to install!", L"W11Boost", MB_OK); } } @@ -285,6 +262,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); + if (hdc == NULL) { + MessageBoxW(hWnd, L"BeginPaint failed", L"W11Boost -> Error", + MB_OK | MB_ICONERROR); + return -1; + } EndPaint(hWnd, &ps); } break; case WM_DESTROY: diff --git a/src/W11Boost.rc b/src/W11Boost.rc index e7bf689fb5fbc9986037427d61ed2e0995aa0973..7a6ab429bc0a71e6bb7e22925bcc515ff1500b63 100644 GIT binary patch literal 5548 zcmdUzU2hsk6o$`rrT&NQ`leAM18#2GJKJDl6&qwe+Dev?8w|1HfW<;Sr2L`$$t2G^ z!(>_5C5H5ZXf->tvoq)WymNLxe=1qYBD=6Vdtp3*B>xD=IuSJ2X1Y=w*SyxTI^P9 z=Yd-{bo)g6*jm=Mj&-eS=hn2oU0IFUD&tFQ*uTuQxnI}`GY!Upzhv0ID@Ygm$m-Z- z)y6}tG_lv{Kf^k*LkF$@;eL+Rr|2nr)R;e_t$JkL2SYf>{zF!;TU0cASnn?=Rtx<$ zBL=1}B4+jmT2p)-Ja^!97~r+xV!!7m@8^5*Ihs_R4wtze%!{12E-D6C<}ER|%zeI5 zzi;shzSzHLkwlX2fc)9y!N=sp{%a|1BVuq&l-=X&g!qc=S7Lq4Q^21#BacRjJ;{mw z#97Q+P4O7nFBwc3K=Ihl$R>{^Z6d!5s+_{PPeeAjME3(%RJgMPjVp4u&#p`MKXF_e z%w96vrLXfQf|j50>*_q8gHg}zDeu~>J1Jbz=dDMxRF`dXct4{#MD%iBgl-{X)vHyo zSrHEE{RtMYJA~9zw7Bw5oNFsDP96Erqn>sNPj}%VyxIn3uffl2;@Y2lsjPXp7rThh z!`>JgMRatkctkE<^F1hCOm+Rtk3nqBX0dyd^qcW+6QUQ%RpjyCcl7wSe3sA1;BSw3 zk2#SQn`%E&R`*<$kl^_Vz7Ns|O?sePpSq(4j<(5K)pLE9y=RP7kuJYcjiPz&ju@ST zo3)iS5eV_rwK9Eqv9<;MCK=uZ;X9Ao5vZRzY_22S1t{L8K8m3Fj@EFrea;6=*4a@5 zgSuc)R?3u)-(UH<|CVzu!AhIgr~J~K&hBU;T~@Z#Mjfi-7Lpac_oq<)s(eJ%nbpLa zvPTT(85pGO9^sceG`ht*W6*H2f^PZLLM~*fmhBmK{)6_+{^Op-$#hR1;)l1P@8LaF z%(6j@+^Vb}s3FGoo~XLv>6Uq&$T3pOCwKOWuNGAq`F!&!2kooSSpFvR@gF$6gz60b ziT&xac?36A`E&FUkS`4jn*q!q3{z|Kw5UcAm*^KL9r|DO#?UKRSJnKMBIhNoH zWzupM2t|E<%l{P@9|5nuys5P5NSLSgBb|ZE=%~u_hAbCC20emK`p0qQPQN;%WA|N9 zbF1=EQ(wR+E$^o1dUNhg4NI(gq4w?CaFnFE=_H5cZcSN;?dHQ zQ@FJC2Wo6`iiW7p_jpS2!Mpd|d(OS*d*99cTf+bIok8Z#d^V&rnQ%UglyUXmk%!TB z>H99sWh_8pQ69th?Hu-Tj4H-425Q_m$Q1@%g%(O^;E1|1`7IPtC)SKLeos+gy~(OV zjah+Hi#Q-Ur0&GyHmFprSBaaflHDe?=1NMG6gaZv+EI-EjVV`9A*bXHP+q@ItgYy= z+K|4CBCE`!*g5mM6~^?x>uKvoPLg)g%wZK<*p$~$RK6niY}#9&8vYke&S4kZ*uV<% z$dfxI{ZR0)HkRTNZBZ{D&Tt&RWk@$LEw=%mELm~+3}gqnvtzy(9=LRR;Sob-?1bd) hxI9JDG!vJgH6iC#NV?XwQ;W{&H%&<|+>yOl_7^5;Zn^*f diff --git a/src/W11Boost.sln b/src/W11Boost.sln deleted file mode 100644 index cadb00c..0000000 --- a/src/W11Boost.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.11.35327.3 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "W11Boost", "W11Boost.vcxproj", "{1B11C0FF-A062-4120-B316-09A2959D7AB3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM64 = Debug|ARM64 - Debug|x86 = Debug|x86 - Release|ARM64 = Release|ARM64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Debug|ARM64.ActiveCfg = Debug|ARM - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Debug|ARM64.Build.0 = Debug|ARM - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Debug|x86.ActiveCfg = Debug|Win32 - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Debug|x86.Build.0 = Debug|Win32 - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Release|ARM64.ActiveCfg = Release|ARM - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Release|ARM64.Build.0 = Release|ARM - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Release|x86.ActiveCfg = Release|Win32 - {1B11C0FF-A062-4120-B316-09A2959D7AB3}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6F57A559-D51A-4A1D-9234-12D7965820CB} - EndGlobalSection -EndGlobal diff --git a/src/W11Boost.vcxproj b/src/W11Boost.vcxproj deleted file mode 100644 index dd2172b..0000000 --- a/src/W11Boost.vcxproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - Debug - ARM - - - Debug - Win32 - - - Release - ARM - - - Release - Win32 - - - - 17.0 - Win32Proj - {1b11c0ff-a062-4120-b316-09a2959d7ab3} - W11Boost - 10.0.22621.0 - - - - Application - true - v143 - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - Level3 - true - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - stdcpplatest - stdclatest - Disabled - true - /kernel /D_HAS_EXCEPTIONS=0 /GR- %(AdditionalOptions) - NotUsing - - - Windows - true - $(CoreLibraryDependencies);gpedit.lib;userenv.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies) - RequireAdministrator - - - - PerMonitorHighDPIAware - - - - - Level3 - true - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - stdcpplatest - stdclatest - Disabled - true - /kernel /D_HAS_EXCEPTIONS=0 /GR- %(AdditionalOptions) - NotUsing - - - Windows - true - $(CoreLibraryDependencies);gpedit.lib;userenv.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies) - RequireAdministrator - MachineARM64 - - - - PerMonitorHighDPIAware - - - - - Level3 - true - true - true - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - stdcpplatest - stdclatest - Speed - true - /kernel /D_HAS_EXCEPTIONS=0 /GR- %(AdditionalOptions) - NotUsing - MaxSpeed - - - Windows - true - true - true - $(CoreLibraryDependencies);gpedit.lib;userenv.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies) - RequireAdministrator - - - - PerMonitorHighDPIAware - - - - - Level3 - true - true - true - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - stdcpplatest - stdclatest - Speed - true - /kernel /D_HAS_EXCEPTIONS=0 /GR- %(AdditionalOptions) - NotUsing - MaxSpeed - - - Windows - true - true - true - $(CoreLibraryDependencies);gpedit.lib;userenv.lib;wininet.lib;shlwapi.lib;%(AdditionalDependencies) - RequireAdministrator - MachineARM64 - - - - PerMonitorHighDPIAware - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/W11Boost.vcxproj.filters b/src/W11Boost.vcxproj.filters deleted file mode 100644 index e5f0ca6..0000000 --- a/src/W11Boost.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {5a058c83-dc3a-4a6f-8512-42910a3c6e10} - - - - - Header Files - - - Header Files - - - - - Source Files - - - Module Files - - - Module Files - - - Module Files - - - Module Files - - - Module Files - - - - - Resource Files - - - - - - \ No newline at end of file diff --git a/src/W11Boost.vcxproj.user b/src/W11Boost.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/src/W11Boost.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/app.manifest b/src/app.manifest new file mode 100644 index 0000000..c92ae83 --- /dev/null +++ b/src/app.manifest @@ -0,0 +1,16 @@ + + + + + + + + + + + + True/PM + PerMonitorV2, PerMonitor + + + \ No newline at end of file diff --git a/src/targetver.h b/src/targetver.h index c69cf51..2dbec30 100644 --- a/src/targetver.h +++ b/src/targetver.h @@ -1,7 +1,9 @@ -#pragma once - +#ifndef TARGETVER_H +#define TARGETVER_H // Including SDKDDKVer.h defines the highest available Windows platform. // If you wish to build your application for a previous Windows platform, // include WinSDKVer.h and set the _WIN32_WINNT macro to the platform you wish // to support before including SDKDDKVer.h. #include + +#endif // TARGETVER_H