| 1 | ; $Id: regfunc.asm,v 1.2 1999-11-09 09:54:47 phaller Exp $ | 
|---|
| 2 |  | 
|---|
| 3 | ;/* | 
|---|
| 4 | ; * register functions in NTDLL | 
|---|
| 5 | ; * | 
|---|
| 6 | ; * Copyright 1999 Patrick Haller | 
|---|
| 7 | ; * | 
|---|
| 8 | ; * | 
|---|
| 9 | ; * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | ; * | 
|---|
| 11 | ; */ | 
|---|
| 12 | .586P | 
|---|
| 13 | NAME    regfunc | 
|---|
| 14 |  | 
|---|
| 15 | CODE32         SEGMENT DWORD PUBLIC USE32 'CODE' | 
|---|
| 16 | align 4 | 
|---|
| 17 |  | 
|---|
| 18 | ; ---------------------------------------------------------------------------- | 
|---|
| 19 |  | 
|---|
| 20 | public  _chkstk      ; _alloca_probe seems to be the same | 
|---|
| 21 | public  DbgBreakPoint | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | ; ---------------------------------------------------------------------------- | 
|---|
| 25 |  | 
|---|
| 26 |  | 
|---|
| 27 | ; ---------------------------------------------------------------------------- | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 | ; ---------------------------------------------------------------------------- | 
|---|
| 31 | ; Name      : _alloca_probe, _chkstk | 
|---|
| 32 | ; Purpose   : | 
|---|
| 33 | ; Parameters: | 
|---|
| 34 | ; Variables : | 
|---|
| 35 | ; Result    : | 
|---|
| 36 | ; Remark    : NTDLL.938, NTDLL.946 | 
|---|
| 37 | ; Status    : VERIFIED | 
|---|
| 38 | ; | 
|---|
| 39 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 40 | ; ---------------------------------------------------------------------------- | 
|---|
| 41 | _chkstk proc near | 
|---|
| 42 |  | 
|---|
| 43 | arg_0          = byte ptr  8 | 
|---|
| 44 |  | 
|---|
| 45 | push    ecx             ; _alloca_probe | 
|---|
| 46 | cmp     eax, 1000h | 
|---|
| 47 | lea     ecx, [esp+arg_0] | 
|---|
| 48 | jb      short _chkstk_1 | 
|---|
| 49 |  | 
|---|
| 50 | _chkstk_2: | 
|---|
| 51 | sub     ecx, 1000h | 
|---|
| 52 | sub     eax, 1000h | 
|---|
| 53 | test    [ecx], eax | 
|---|
| 54 | cmp     eax, 1000h | 
|---|
| 55 | jnb     short _chkstk_2 | 
|---|
| 56 |  | 
|---|
| 57 | _chkstk_1: | 
|---|
| 58 | sub     ecx, eax | 
|---|
| 59 | mov     eax, esp | 
|---|
| 60 | test    [ecx], eax | 
|---|
| 61 | mov     esp, ecx | 
|---|
| 62 | mov     ecx, [eax] | 
|---|
| 63 | mov     eax, [eax+4] | 
|---|
| 64 | push    eax | 
|---|
| 65 | retn | 
|---|
| 66 | _chkstk        endp | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | ; ---------------------------------------------------------------------------- | 
|---|
| 70 | ; Name      : DbgBreakPoint | 
|---|
| 71 | ; Purpose   : | 
|---|
| 72 | ; Parameters: | 
|---|
| 73 | ; Variables : | 
|---|
| 74 | ; Result    : | 
|---|
| 75 | ; Remark    : NTDLL.20 | 
|---|
| 76 | ; Status    : VERIFIED | 
|---|
| 77 | ; | 
|---|
| 78 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 79 | ; ---------------------------------------------------------------------------- | 
|---|
| 80 | DbgBreakPoint  proc near | 
|---|
| 81 | int     3               ; Trap to Debugger | 
|---|
| 82 | retn | 
|---|
| 83 | DbgBreakPoint  endp | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 | ; ---------------------------------------------------------------------------- | 
|---|
| 87 | ; Name      : DbgUserBreakPoint | 
|---|
| 88 | ; Purpose   : | 
|---|
| 89 | ; Parameters: | 
|---|
| 90 | ; Variables : | 
|---|
| 91 | ; Result    : | 
|---|
| 92 | ; Remark    : NTDLL.28 | 
|---|
| 93 | ; Status    : VERIFIED | 
|---|
| 94 | ; | 
|---|
| 95 | ; Author    : Patrick Haller [Mon, 1999/11/08 23:44] | 
|---|
| 96 | ; ---------------------------------------------------------------------------- | 
|---|
| 97 | DbgUserBreakPoint proc near | 
|---|
| 98 | int     3               ; Trap to Debugger | 
|---|
| 99 | retn | 
|---|
| 100 | DbgUserBreakPoint endp | 
|---|
| 101 |  | 
|---|
| 102 |  | 
|---|
| 103 | ; ---------------------------------------------------------------------------- | 
|---|
| 104 | CODE32          ENDS | 
|---|
| 105 |  | 
|---|
| 106 | END | 
|---|