Improve mmap handling of IO errors on WIN32. Make MMAP gracefully handle IO errors on Windows by replacing the mapping with zeros using a vectored exception handler when an EXCEPTION_IN_PAGE_ERROR is raised. This is similar to how such errors are handled on non-Windows platforms. On Windows, this is implemented by first creating a placeholder allocation and then mapping the file into it. When an error occurs, the exception handler unmaps the file, keeping the placeholder intact, and creates an anonymous mapping into it, after which execution can continue. Since some required functions don't exist on older Windows versions, the error handling will only work on Windows 10, version 1803 or newer. Ref !139739
26 lines
387 B
C++
26 lines
387 B
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup imbuf
|
|
*/
|
|
|
|
#include <cstddef>
|
|
|
|
#include "IMB_colormanagement_intern.hh"
|
|
#include "IMB_filetype.hh"
|
|
#include "IMB_imbuf.hh"
|
|
|
|
void IMB_init()
|
|
{
|
|
imb_filetypes_init();
|
|
colormanagement_init();
|
|
}
|
|
|
|
void IMB_exit()
|
|
{
|
|
imb_filetypes_exit();
|
|
colormanagement_exit();
|
|
}
|