summaryrefslogtreecommitdiffstats
path: root/src/os_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index ae66652610..c24e2a606b 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -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