cpp-httplib
cpp-httplib copied to clipboard
Fatal error can't compile for Windows 7 and Windows Vista and Windows XP
CreateFile2 not found!!! CreateFileMappingFromApp not found!! MapViewOfFileFromApp not found!
Please fix it for support Windows 7! Thanks!
(use CreateFile1 and other original functions, #ifdef win7 and lower)
same case
I checked the commit history,the code was adjusted to adapt to UMP。 Because my program only runs on win7/win10/win11。 So,I pull the latest code,make the following changes。
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) ----- Delete
addr_ = ::MapViewOfFileFromApp(hMapping_, FILE_MAP_READ, 0, 0); ----- Delete
#else ----- Delete
addr_ = ::MapViewOfFile(hMapping_, FILE_MAP_READ, 0, 0, 0); -----save
#endif ----- Delete
search function: CreateFile2, The original code is:
hFile_ = ::CreateFile2(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING, NULL);
adjust to:
hFile_ = ::CreateFileW(wpath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
After recompiling, you can run it in win7/win10/win11 system.
same case
See my answer
Fixed by #1869