2004-08-15 Casper S. Hornstrup <chorns@users.sourceforge.net>
[reactos.git] / reactos / ntoskrnl / io / process.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id: process.c,v 1.18 2004/08/15 16:39:03 chorns Exp $
20 *
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * FILE: ntoskrnl/io/process.c
24 * PURPOSE: Process functions that, bizarrely, are in the iomgr
25 * PROGRAMMER: David Welch (welch@mcmail.com)
26 * UPDATE HISTORY:
27 * Created 22/05/98
28 */
29
30 /* INCLUDES *****************************************************************/
31
32 #include <ntoskrnl.h>
33 #include <internal/debug.h>
34
35 /* FUNCTIONS *****************************************************************/
36
37 /*
38 * @implemented
39 */
40 PVOID STDCALL
41 IoGetInitialStack(VOID)
42 {
43 return(PsGetCurrentThread()->Tcb.InitialStack);
44 }
45
46
47 /*
48 * @implemented
49 */
50 VOID STDCALL
51 IoGetStackLimits(OUT PULONG LowLimit,
52 OUT PULONG HighLimit)
53 {
54 *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
55 *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
56 }
57
58 /*
59 * @unimplemented
60 */
61 STDCALL
62 BOOLEAN
63 IoIsSystemThread(
64 IN PETHREAD Thread
65 )
66 {
67 UNIMPLEMENTED;
68 return FALSE;
69 }
70
71 /*
72 * @implemented
73 */
74 PEPROCESS STDCALL
75 IoThreadToProcess(IN PETHREAD Thread)
76 {
77 return(Thread->ThreadsProcess);
78 }
79
80
81 /*
82 * @implemented
83 */
84 PEPROCESS STDCALL
85 IoGetRequestorProcess(IN PIRP Irp)
86 {
87 return(Irp->Tail.Overlay.Thread->ThreadsProcess);
88 }
89
90
91 /**********************************************************************
92 * NAME EXPORTED
93 * IoSetThreadHardErrorMode@4
94 *
95 * ARGUMENTS
96 * HardErrorEnabled
97 * TRUE : enable hard errors processing;
98 * FALSE: do NOT process hard errors.
99 *
100 * RETURN VALUE
101 * Previous value for the current thread's hard errors
102 * processing policy.
103 *
104 * @implemented
105 */
106 BOOLEAN STDCALL
107 IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
108 {
109 BOOLEAN PreviousHEM = (BOOLEAN)(NtCurrentTeb()->HardErrorDisabled);
110
111 NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ? FALSE : TRUE);
112
113 return((TRUE == PreviousHEM) ? FALSE : TRUE);
114 }
115
116 /* EOF */