summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/lib/osdlib_win32.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-04-13 05:49:05 +1000
committer Vas Crabb <vas@vastheman.com>2023-04-13 05:49:05 +1000
commitb6b6c9b15c34471fd3938bdb9715754f09f10e00 (patch)
treeb77d63379d6fb1305ca64342f7e5ca7f9aff3d3c /src/osd/modules/lib/osdlib_win32.cpp
parent81dd75f7d7db2967d00075bd443c85e8b042251d (diff)
Allow loading PNG/JPEG/MS DIB bitmaps from Lua, and cleanup.
Use VirtualAlloc rather than VirtualProtect on Windows to change page protection, as the latter can cause severe performance issues with some antivirus software. Added noexcept to lots of hash- and bitmap-related things, and added a little more error checking. Yes, I realise it will abort if an allocation fails while printing a log message, but if you get to that point, you're probably screwed already.
Diffstat (limited to 'src/osd/modules/lib/osdlib_win32.cpp')
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index 067fbd1224f..23e75bf9dc2 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -356,12 +356,12 @@ void virtual_memory_allocation::do_free(void *start, std::size_t size)
bool virtual_memory_allocation::do_set_access(void *start, std::size_t size, unsigned access)
{
- DWORD p, o;
+ DWORD p;
if (access & EXECUTE)
p = (access & WRITE) ? PAGE_EXECUTE_READWRITE : (access & READ) ? PAGE_EXECUTE_READ : PAGE_EXECUTE;
else
p = (access & WRITE) ? PAGE_READWRITE : (access & READ) ? PAGE_READONLY : PAGE_NOACCESS;
- return VirtualProtect(start, size, p, &o) != 0;
+ return VirtualAlloc(start, size, MEM_COMMIT, p) != nullptr;
}