mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-05-31 17:11:25 +00:00
Remove the unused and ugly HackChkStk()
This commit is contained in:
parent
5052f42c9e
commit
36c5b05f1f
1 changed files with 0 additions and 64 deletions
|
@ -1169,34 +1169,6 @@ void Win_Frame( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" { void _chkstk( int size ); };
|
|
||||||
void clrstk( void );
|
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
TestChkStk
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void TestChkStk( void ) {
|
|
||||||
int buffer[0x1000];
|
|
||||||
|
|
||||||
buffer[0] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
HackChkStk
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
void HackChkStk( void ) {
|
|
||||||
DWORD old;
|
|
||||||
VirtualProtect( _chkstk, 6, PAGE_EXECUTE_READWRITE, &old );
|
|
||||||
*(byte *)_chkstk = 0xe9;
|
|
||||||
*(int *)((int)_chkstk+1) = (int)clrstk - (int)_chkstk - 5;
|
|
||||||
|
|
||||||
TestChkStk();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
GetExceptionCodeInfo
|
GetExceptionCodeInfo
|
||||||
|
@ -1507,42 +1479,6 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
====================
|
|
||||||
clrstk
|
|
||||||
|
|
||||||
I tried to get the run time to call this at every function entry, but
|
|
||||||
====================
|
|
||||||
*/
|
|
||||||
static int parmBytes;
|
|
||||||
__declspec( naked ) void clrstk( void ) {
|
|
||||||
// eax = bytes to add to stack
|
|
||||||
__asm {
|
|
||||||
mov [parmBytes],eax
|
|
||||||
neg eax ; compute new stack pointer in eax
|
|
||||||
add eax,esp
|
|
||||||
add eax,4
|
|
||||||
xchg eax,esp
|
|
||||||
mov eax,dword ptr [eax] ; copy the return address
|
|
||||||
push eax
|
|
||||||
|
|
||||||
; clear to zero
|
|
||||||
push edi
|
|
||||||
push ecx
|
|
||||||
mov edi,esp
|
|
||||||
add edi,12
|
|
||||||
mov ecx,[parmBytes]
|
|
||||||
shr ecx,2
|
|
||||||
xor eax,eax
|
|
||||||
cld
|
|
||||||
rep stosd
|
|
||||||
pop ecx
|
|
||||||
pop edi
|
|
||||||
|
|
||||||
ret
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
idSysLocal::OpenURL
|
idSysLocal::OpenURL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue