source: golgotha/src/i4/error/msvc_exec.cc

Last change on this file was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.7 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "inc/arch.hh"
10
11#ifdef _WINDOWS
12
13void null_function() {}
14
15w32 MSVC_p[20];
16w32 MSVC_params=0;
17void (*MSVC_func)()=&null_function;
18static char FP_SAVE[120];
19
20typedef void (*func0)(void);
21typedef void (*func1)(w32 a);
22typedef void (*func2)(w32 a,w32 b);
23typedef void (*func3)(w32 a,w32 b,w32 c);
24typedef void (*func4)(w32 a,w32 b,w32 c,w32 d);
25typedef void (*func5)(w32 a,w32 b,w32 c,w32 d,w32 e);
26
27void MSVC_exec()
28{
29  __asm {
30    pushfd
31    pushad
32    fsave FP_SAVE
33    frstor FP_SAVE   
34
35    push ebp
36    mov  ebp, esp
37    push ecx
38    push ebx
39    push esi
40    push edi
41  }
42
43  switch (MSVC_params)
44  {
45    case 1: (*((func1)MSVC_func))(MSVC_p[0]); break;
46    case 2: (*((func2)MSVC_func))(MSVC_p[0],MSVC_p[1]); break;
47    case 3: (*((func3)MSVC_func))(MSVC_p[0],MSVC_p[1],MSVC_p[2]); break;
48    case 4: (*((func4)MSVC_func))(MSVC_p[0],MSVC_p[1],MSVC_p[2],MSVC_p[3]); break;
49    case 5: (*((func5)MSVC_func))(MSVC_p[0],MSVC_p[1],MSVC_p[2],MSVC_p[3],MSVC_p[4]); break;
50    default:(*((func0)MSVC_func))(); break;
51  }
52  MSVC_func = &null_function;
53  MSVC_params = 0;
54
55  __asm {
56    pop edi
57    pop esi
58    pop ebx
59    pop ecx
60    mov esp, ebp
61    pop ebp
62
63    frstor FP_SAVE   
64    popad
65    popfd
66  }
67}
68#endif
Note: See TracBrowser for help on using the repository browser.