cpp-httplib icon indicating copy to clipboard operation
cpp-httplib copied to clipboard

Fatal error can't compile for Windows 7 and Windows Vista and Windows XP

Open rakakarakaka opened this issue 1 year ago • 1 comments

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)

rakakarakaka avatar Jun 25 '24 13:06 rakakarakaka

same case

RPG3D avatar Jun 26 '24 16:06 RPG3D

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.

wolf-hunter404 avatar Jul 01 '24 05:07 wolf-hunter404

same case

See my answer

wolf-hunter404 avatar Jul 01 '24 05:07 wolf-hunter404

Fixed by #1869

yhirose avatar Jul 02 '24 15:07 yhirose