da7b7cd80eabfd074e9e84c03e93a85e7a5e8ff3
[reactos.git] / 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$
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 <ddk/ntddk.h>
33 #include <internal/ps.h>
34
35 #include <internal/debug.h>
36
37 /* FUNCTIONS *****************************************************************/
38
39 /*
40  * @implemented
41  */
42 PVOID STDCALL
43 IoGetInitialStack(VOID)
44 {
45   return(PsGetCurrentThread()->Tcb.InitialStack);
46 }
47
48
49 /*
50  * @implemented
51  */
52 VOID STDCALL
53 IoGetStackLimits(OUT PULONG LowLimit,
54                  OUT PULONG HighLimit)
55 {
56   *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit;
57   *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase;
58 }
59
60
61 /*
62  * @implemented
63  */
64 PEPROCESS STDCALL
65 IoThreadToProcess(IN PETHREAD Thread)
66 {
67   return(Thread->ThreadsProcess);
68 }
69
70
71 /*
72  * @implemented
73  */
74 PEPROCESS STDCALL
75 IoGetRequestorProcess(IN PIRP Irp)
76 {
77   return(Irp->Tail.Overlay.Thread->ThreadsProcess);
78 }
79
80
81 /**********************************************************************
82  * NAME                                                 EXPORTED
83  *      IoSetThreadHardErrorMode@4
84  *
85  * ARGUMENTS
86  *      HardErrorEnabled
87  *              TRUE : enable hard errors processing;
88  *              FALSE: do NOT process hard errors.
89  *
90  * RETURN VALUE
91  *      Previous value for the current thread's hard errors
92  *      processing policy.
93  *
94  * @implemented
95  */
96 BOOLEAN STDCALL EXPORTED
97 IoSetThreadHardErrorMode(IN BOOLEAN HardErrorEnabled)
98 {
99   BOOLEAN PreviousHEM = NtCurrentTeb()->HardErrorDisabled;
100
101   NtCurrentTeb()->HardErrorDisabled = ((TRUE == HardErrorEnabled) ? FALSE : TRUE);
102
103   return((TRUE == PreviousHEM) ? FALSE : TRUE);
104 }
105
106 /* EOF */