Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rakakarakaka opened this issue Jun 25, 2024 · 3 comments

Comments

@rakakarakaka
Copy link

rakakarakaka commented Jun 25, 2024

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)

@RPG3D
Copy link

RPG3D commented Jun 26, 2024

same case

@qwe857359351a
Copy link

qwe857359351a commented Jul 1, 2024

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.

@qwe857359351a
Copy link

same case

See my answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants