diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e27b8e..b0f5969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,4 +35,4 @@ add_executable (${PROJECT_NAME} src/main.cpp ) -target_link_libraries(${PROJECT_NAME} PowrProf Tbs) +target_link_libraries(${PROJECT_NAME} PowrProf WinInet Tbs) diff --git a/src/main.cpp b/src/main.cpp index cea1cf9..4f729de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -503,6 +504,29 @@ int main(int, char* argv[]) std::cout << "WDDM check passed!" << std::endl; } + // Internet connection + { + std::cout << "Internet connection checking..." << std::endl; + + DWORD dwFlags = 0; + if (!InternetGetConnectedState(&dwFlags, 0)) + { + std::cerr << "InternetGetConnectedState failed with error: " << GetLastError() << std::endl; + std::system("PAUSE"); + return EXIT_FAILURE; + } + + const auto dwTestConnectionRet = InternetAttemptConnect(0); + if (dwTestConnectionRet != ERROR_SUCCESS) + { + std::cerr << "InternetAttemptConnect failed with error: " << GetLastError() << std::endl; + std::system("PAUSE"); + return EXIT_FAILURE; + } + + std::cout << "Internet connection check passed!" << std::endl; + } + std::cout << "All checks passed! Your system can be upgradable to Windows 11" << std::endl; std::system("PAUSE"); return EXIT_SUCCESS;