@@ -7464,88 +7464,6 @@ mch_copy_file_attribute(char_u *from, char_u *to)
74647464 return 0 ;
74657465}
74667466
7467- #if defined(MYRESETSTKOFLW ) || defined(PROTO )
7468- /*
7469- * Recreate a destroyed stack guard page in win32.
7470- * Written by Benjamin Peterson.
7471- */
7472-
7473- // These magic numbers are from the MS header files
7474- # define MIN_STACK_WINNT 2
7475-
7476- /*
7477- * This function does the same thing as _resetstkoflw(), which is only
7478- * available in DevStudio .net and later.
7479- * Returns 0 for failure, 1 for success.
7480- */
7481- int
7482- myresetstkoflw (void )
7483- {
7484- BYTE * pStackPtr ;
7485- BYTE * pGuardPage ;
7486- BYTE * pStackBase ;
7487- BYTE * pLowestPossiblePage ;
7488- MEMORY_BASIC_INFORMATION mbi ;
7489- SYSTEM_INFO si ;
7490- DWORD nPageSize ;
7491- DWORD dummy ;
7492-
7493- // We need to know the system page size.
7494- GetSystemInfo (& si );
7495- nPageSize = si .dwPageSize ;
7496-
7497- // ...and the current stack pointer
7498- pStackPtr = (BYTE * )_alloca (1 );
7499-
7500- // ...and the base of the stack.
7501- if (VirtualQuery (pStackPtr , & mbi , sizeof mbi ) == 0 )
7502- return 0 ;
7503- pStackBase = (BYTE * )mbi .AllocationBase ;
7504-
7505- // ...and the page that's min_stack_req pages away from stack base; this is
7506- // the lowest page we could use.
7507- pLowestPossiblePage = pStackBase + MIN_STACK_WINNT * nPageSize ;
7508-
7509- {
7510- // We want the first committed page in the stack Start at the stack
7511- // base and move forward through memory until we find a committed block.
7512- BYTE * pBlock = pStackBase ;
7513-
7514- for (;;)
7515- {
7516- if (VirtualQuery (pBlock , & mbi , sizeof mbi ) == 0 )
7517- return 0 ;
7518-
7519- pBlock += mbi .RegionSize ;
7520-
7521- if (mbi .State & MEM_COMMIT )
7522- break ;
7523- }
7524-
7525- // mbi now describes the first committed block in the stack.
7526- if (mbi .Protect & PAGE_GUARD )
7527- return 1 ;
7528-
7529- // decide where the guard page should start
7530- if ((long_u )(mbi .BaseAddress ) < (long_u )pLowestPossiblePage )
7531- pGuardPage = pLowestPossiblePage ;
7532- else
7533- pGuardPage = (BYTE * )mbi .BaseAddress ;
7534-
7535- // allocate the guard page
7536- if (!VirtualAlloc (pGuardPage , nPageSize , MEM_COMMIT , PAGE_READWRITE ))
7537- return 0 ;
7538-
7539- // apply the guard attribute to the page
7540- if (!VirtualProtect (pGuardPage , nPageSize , PAGE_READWRITE | PAGE_GUARD ,
7541- & dummy ))
7542- return 0 ;
7543- }
7544-
7545- return 1 ;
7546- }
7547- #endif
7548-
75497467
75507468/*
75517469 * The command line arguments in UTF-16
0 commit comments