| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
|
|
|
|
| #define BOOST_REGEX_SOURCE |
|
|
| #include <boost/regex/config.hpp> |
|
|
| #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD |
|
|
| #include <malloc.h> |
|
|
| #ifndef WIN32_LEAN_AND_MEAN |
| # define WIN32_LEAN_AND_MEAN |
| #endif |
| #ifndef NOMINMAX |
| # define NOMINMAX |
| #endif |
| #define NOGDI |
| #define NOUSER |
| #include <windows.h> |
| #include <stdexcept> |
| #include <boost/regex/pattern_except.hpp> |
| #include <boost/regex/v4/protected_call.hpp> |
|
|
| namespace boost { |
| namespace BOOST_REGEX_DETAIL_NS { |
|
|
| static void execute_eror() |
| { |
| |
| |
| |
| |
| reset_stack_guard_page(); |
| std::runtime_error err("Out of stack space, while attempting to match a regular expression."); |
| raise_runtime_error(err); |
| } |
|
|
| bool BOOST_REGEX_CALL abstract_protected_call::execute()const |
| { |
| __try{ |
| return this->call(); |
| }__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode()) |
| { |
| execute_eror(); |
| } |
| |
| return false; |
| } |
|
|
| BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page() |
| { |
| #if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300) |
| _resetstkoflw(); |
| #else |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| SYSTEM_INFO si; |
| GetSystemInfo(&si); |
| MEMORY_BASIC_INFORMATION mi; |
| DWORD previous_protection_status; |
| |
| |
| |
| LPBYTE page = (LPBYTE)&page; |
| |
| |
| |
| VirtualQuery(page, &mi, sizeof(mi)); |
| |
| |
| |
| page = (LPBYTE)(mi.BaseAddress)-si.dwPageSize; |
| |
| |
| |
| |
| |
| if (!VirtualFree(mi.AllocationBase, (LPBYTE)page - (LPBYTE)mi.AllocationBase, MEM_DECOMMIT) |
| || !VirtualProtect(page, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &previous_protection_status)) |
| { |
| throw std::bad_exception(); |
| } |
| #endif |
| } |
| } |
| } |
| #endif |
|
|
| #if defined(BOOST_RE_USE_VCL) && defined(BOOST_REGEX_DYN_LINK) |
|
|
| int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*) |
| { |
| return 1; |
| } |
| #endif |
|
|
|
|