Apply a fix for Win 7

This commit is contained in:
Sebastian Messmer 2018-12-22 10:25:47 +01:00
parent 0b03326ca2
commit fcc9d45f41
2 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include <codecvt>
#include <Windows.h>
#include <Winhttp.h>
#include <VersionHelpers.h>
using boost::none;
using boost::optional;
@ -212,7 +213,8 @@ namespace cpputils {
namespace {
cpputils::unique_ref<WinHttpSession> create_session() {
HttpHandleRAII session_handle = WinHttpOpen(L"cpputils::HttpClient", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
const DWORD dwAccessType = IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY : WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
HttpHandleRAII session_handle = WinHttpOpen(L"cpputils::HttpClient", dwAccessType, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
if(nullptr == session_handle.handle) {
throw std::runtime_error("Error calling WinHttpOpen. Error code: " + std::to_string(GetLastError()));
}

View File

@ -20,8 +20,8 @@ using std::cerr;
int main(int argc, const char *argv[]) {
#if defined(_MSC_VER)
if (!IsWindows10OrGreater()) {
std::cerr << "CryFS is currently only supported on Windows 10 (or later)." << std::endl;
if (!IsWindows7SP1OrGreater()) {
std::cerr << "CryFS is currently only supported on Windows 7 SP1 (or later)." << std::endl;
exit(1);
}
#endif