Apply a fix for Win 7
This commit is contained in:
parent
0b03326ca2
commit
fcc9d45f41
@ -8,6 +8,7 @@
|
|||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <Winhttp.h>
|
#include <Winhttp.h>
|
||||||
|
#include <VersionHelpers.h>
|
||||||
|
|
||||||
using boost::none;
|
using boost::none;
|
||||||
using boost::optional;
|
using boost::optional;
|
||||||
@ -212,7 +213,8 @@ namespace cpputils {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
cpputils::unique_ref<WinHttpSession> create_session() {
|
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) {
|
if(nullptr == session_handle.handle) {
|
||||||
throw std::runtime_error("Error calling WinHttpOpen. Error code: " + std::to_string(GetLastError()));
|
throw std::runtime_error("Error calling WinHttpOpen. Error code: " + std::to_string(GetLastError()));
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ using std::cerr;
|
|||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
if (!IsWindows10OrGreater()) {
|
if (!IsWindows7SP1OrGreater()) {
|
||||||
std::cerr << "CryFS is currently only supported on Windows 10 (or later)." << std::endl;
|
std::cerr << "CryFS is currently only supported on Windows 7 SP1 (or later)." << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user