ReactOS
0.4.16-dev-470-g91b8923
stack.c
Go to the documentation of this file.
1
#include <precomp.h>
2
3
/*********************************************************************
4
* _chkesp (MSVCRT.@)
5
*
6
* Trap to a debugger if the value of the stack pointer has changed.
7
*
8
* PARAMS
9
* None.
10
*
11
* RETURNS
12
* Does not return.
13
*
14
* NOTES
15
* This function is available for iX86 only.
16
*
17
* When VC++ generates debug code, it stores the value of the stack pointer
18
* before calling any external function, and checks the value following
19
* the call. It then calls this function, which will trap if the values are
20
* not the same. Usually this means that the prototype used to call
21
* the function is incorrect. It can also mean that the .spec entry has
22
* the wrong calling convention or parameters.
23
*/
24
25
#ifdef __i386__
26
27
void
_chkesp_failed(
void
)
28
{
29
ERR
(
"stack got corrupted!\n"
);
30
__debugbreak
();
31
}
32
33
#endif
/* __i386__ */
34
35
/*********************************************************************
36
* _resetstkoflw (MSVCRT.@)
37
*/
38
int
CDECL
_resetstkoflw
(
void
)
39
{
40
int
stack_addr;
41
DWORD
oldprot;
42
43
/* causes stack fault that updates NtCurrentTeb()->Tib.StackLimit */
44
return
VirtualProtect
(&stack_addr, 1,
PAGE_GUARD
|
PAGE_READWRITE
, &oldprot);
45
}
ERR
#define ERR(fmt,...)
Definition:
precomp.h:57
CDECL
#define CDECL
Definition:
compat.h:29
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
__debugbreak
void __cdecl __debugbreak(void)
Definition:
intrin_ppc.h:698
PAGE_READWRITE
#define PAGE_READWRITE
Definition:
nt_native.h:1304
PAGE_GUARD
#define PAGE_GUARD
Definition:
nt_native.h:1310
_resetstkoflw
int CDECL _resetstkoflw(void)
Definition:
stack.c:38
VirtualProtect
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition:
virtmem.c:135
sdk
lib
crt
except
stack.c
Generated on Wed Jan 15 2025 06:13:30 for ReactOS by
1.9.6