forked from aniani/vim
patch 8.2.4199: MS-Windows: Support for MSVC 2003 is not useful
Problem: MS-Windows: Support for MSVC 2003 is not useful. Solution: Remove the exceptions for MSVC 2003. (Ken Takata, closes #9616)
This commit is contained in:
@@ -7464,88 +7464,6 @@ mch_copy_file_attribute(char_u *from, char_u *to)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(MYRESETSTKOFLW) || defined(PROTO)
|
||||
/*
|
||||
* Recreate a destroyed stack guard page in win32.
|
||||
* Written by Benjamin Peterson.
|
||||
*/
|
||||
|
||||
// These magic numbers are from the MS header files
|
||||
# define MIN_STACK_WINNT 2
|
||||
|
||||
/*
|
||||
* This function does the same thing as _resetstkoflw(), which is only
|
||||
* available in DevStudio .net and later.
|
||||
* Returns 0 for failure, 1 for success.
|
||||
*/
|
||||
int
|
||||
myresetstkoflw(void)
|
||||
{
|
||||
BYTE *pStackPtr;
|
||||
BYTE *pGuardPage;
|
||||
BYTE *pStackBase;
|
||||
BYTE *pLowestPossiblePage;
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
SYSTEM_INFO si;
|
||||
DWORD nPageSize;
|
||||
DWORD dummy;
|
||||
|
||||
// We need to know the system page size.
|
||||
GetSystemInfo(&si);
|
||||
nPageSize = si.dwPageSize;
|
||||
|
||||
// ...and the current stack pointer
|
||||
pStackPtr = (BYTE*)_alloca(1);
|
||||
|
||||
// ...and the base of the stack.
|
||||
if (VirtualQuery(pStackPtr, &mbi, sizeof mbi) == 0)
|
||||
return 0;
|
||||
pStackBase = (BYTE*)mbi.AllocationBase;
|
||||
|
||||
// ...and the page that's min_stack_req pages away from stack base; this is
|
||||
// the lowest page we could use.
|
||||
pLowestPossiblePage = pStackBase + MIN_STACK_WINNT * nPageSize;
|
||||
|
||||
{
|
||||
// We want the first committed page in the stack Start at the stack
|
||||
// base and move forward through memory until we find a committed block.
|
||||
BYTE *pBlock = pStackBase;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (VirtualQuery(pBlock, &mbi, sizeof mbi) == 0)
|
||||
return 0;
|
||||
|
||||
pBlock += mbi.RegionSize;
|
||||
|
||||
if (mbi.State & MEM_COMMIT)
|
||||
break;
|
||||
}
|
||||
|
||||
// mbi now describes the first committed block in the stack.
|
||||
if (mbi.Protect & PAGE_GUARD)
|
||||
return 1;
|
||||
|
||||
// decide where the guard page should start
|
||||
if ((long_u)(mbi.BaseAddress) < (long_u)pLowestPossiblePage)
|
||||
pGuardPage = pLowestPossiblePage;
|
||||
else
|
||||
pGuardPage = (BYTE*)mbi.BaseAddress;
|
||||
|
||||
// allocate the guard page
|
||||
if (!VirtualAlloc(pGuardPage, nPageSize, MEM_COMMIT, PAGE_READWRITE))
|
||||
return 0;
|
||||
|
||||
// apply the guard attribute to the page
|
||||
if (!VirtualProtect(pGuardPage, nPageSize, PAGE_READWRITE | PAGE_GUARD,
|
||||
&dummy))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The command line arguments in UTF-16
|
||||
|
Reference in New Issue
Block a user