:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / ntoskrnl / ps / win32.c
1 /*
2  *  ReactOS kernel
3  *  Copyright (C) 2002 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/ps/win32.c
24  * PURPOSE:                win32k support
25  * PROGRAMMER:             Eric Kohl (ekohl@rz-online.de)
26  * REVISION HISTORY: 
27  *               04/01/2002: Created
28  */
29
30 /* INCLUDES ****************************************************************/
31
32 #include <ddk/ntddk.h>
33 #include <internal/ps.h>
34 #include <napi/win32.h>
35
36 /* TYPES *******************************************************************/
37
38 /* GLOBALS ******************************************************************/
39
40 static ULONG PspWin32ProcessSize = 0;
41 static ULONG PspWin32ThreadSize = 0;
42
43 /* FUNCTIONS ***************************************************************/
44
45 PW32THREAD STDCALL
46 PsGetWin32Thread(VOID)
47 {
48   return(PsGetCurrentThread()->Win32Thread);
49 }
50
51 NTSTATUS STDCALL
52 PsCreateWin32Thread(PETHREAD Thread)
53 {
54   if (Thread->Win32Thread != NULL)
55     return(STATUS_SUCCESS);
56
57   Thread->Win32Thread = ExAllocatePool(NonPagedPool,
58                                         PspWin32ThreadSize);
59   if (Thread->Win32Thread == NULL)
60     return(STATUS_NO_MEMORY);
61
62   RtlZeroMemory(Thread->Win32Thread,
63                 PspWin32ThreadSize);
64
65   return(STATUS_SUCCESS);
66 }
67
68 PW32PROCESS STDCALL
69 PsGetWin32Process(VOID)
70 {
71   return(PsGetCurrentProcess()->Win32Process);
72 }
73
74 NTSTATUS STDCALL
75 PsCreateWin32Process(PEPROCESS Process)
76 {
77   if (Process->Win32Process != NULL)
78     return(STATUS_SUCCESS);
79
80   Process->Win32Process = ExAllocatePool(NonPagedPool,
81                                          PspWin32ProcessSize);
82   if (Process->Win32Process == NULL)
83     return(STATUS_NO_MEMORY);
84
85   RtlZeroMemory(Process->Win32Process,
86                 PspWin32ProcessSize);
87
88   return(STATUS_SUCCESS);
89 }
90
91
92 VOID STDCALL
93 PsEstablishWin32Callouts(PVOID Param1,
94                          PVOID Param2,
95                          PVOID Param3,
96                          PVOID Param4,
97                          ULONG W32ThreadSize,
98                          ULONG W32ProcessSize)
99 {
100   PspWin32ProcessSize = W32ProcessSize;
101   PspWin32ThreadSize = W32ThreadSize;
102 }
103
104 /* EOF */