Add information letting us know creation deletion of services has worked.
[reactos.git] / reactos / subsys / win32k / ntuser / metric.c
1 /*
2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 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 * PURPOSE: Window classes
24 * FILE: subsys/win32k/ntuser/metric.c
25 * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
26 * REVISION HISTORY:
27 * 06-06-2001 CSH Created
28 */
29
30 /* INCLUDES ******************************************************************/
31
32 #include <w32k.h>
33
34 #define NDEBUG
35 #include <debug.h>
36
37 /* FUNCTIONS *****************************************************************/
38
39 /* FIXME: Alot of thse values should NOT be hardcoded but they are */
40 ULONG FASTCALL
41 UserGetSystemMetrics(ULONG Index)
42 {
43 NTSTATUS Status;
44 PWINSTATION_OBJECT WinStaObject;
45 ULONG Width, Height, Result;
46
47 Result = 0;
48 switch (Index)
49 {
50 case SM_ARRANGE:
51 return(8);
52 case SM_CLEANBOOT:
53 return(0);
54 case SM_CMOUSEBUTTONS:
55 return(2);
56 case SM_CXBORDER:
57 case SM_CYBORDER:
58 return(1);
59 case SM_CXCURSOR:
60 case SM_CYCURSOR:
61 return(32);
62 case SM_CXDLGFRAME:
63 case SM_CYDLGFRAME:
64 return(3);
65 case SM_CXDOUBLECLK:
66 case SM_CYDOUBLECLK:
67 case SM_SWAPBUTTON:
68 {
69 PSYSTEM_CURSORINFO CurInfo;
70 Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
71 KernelMode,
72 0,
73 &WinStaObject);
74 if (!NT_SUCCESS(Status))
75 return 0xFFFFFFFF;
76
77 CurInfo = IntGetSysCursorInfo(WinStaObject);
78 switch(Index)
79 {
80 case SM_CXDOUBLECLK:
81 Result = CurInfo->DblClickWidth;
82 break;
83 case SM_CYDOUBLECLK:
84 Result = CurInfo->DblClickWidth;
85 break;
86 case SM_SWAPBUTTON:
87 Result = (UINT)CurInfo->SwapButtons;
88 break;
89 }
90
91 ObDereferenceObject(WinStaObject);
92 return Result;
93 }
94
95 case SM_CXDRAG:
96 case SM_CYDRAG:
97 return(2);
98 case SM_CXEDGE:
99 case SM_CYEDGE:
100 return(2);
101 case SM_CXFRAME:
102 case SM_CYFRAME:
103 return(4);
104 case SM_CXFULLSCREEN:
105 /* FIXME: shouldn't we take borders etc into account??? */
106 return UserGetSystemMetrics(SM_CXSCREEN);
107 case SM_CYFULLSCREEN:
108 return UserGetSystemMetrics(SM_CYSCREEN);
109 case SM_CXHSCROLL:
110 case SM_CYHSCROLL:
111 return(16);
112 case SM_CYVTHUMB:
113 case SM_CXHTHUMB:
114 return(16);
115 case SM_CXICON:
116 case SM_CYICON:
117 return(32);
118 case SM_CXICONSPACING:
119 case SM_CYICONSPACING:
120 return(64);
121 case SM_CXMAXIMIZED:
122 return(UserGetSystemMetrics(SM_CXSCREEN) + 8); /* This seems to be 8
123 pixels greater than
124 the screen width */
125 case SM_CYMAXIMIZED:
126 return(UserGetSystemMetrics(SM_CYSCREEN) - 20); /* This seems to be 20
127 pixels less than
128 the screen height,
129 taskbar maybe? */
130 case SM_CXMAXTRACK:
131 return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
132 case SM_CYMAXTRACK:
133 return(UserGetSystemMetrics(SM_CYSCREEN) + 12);
134 case SM_CXMENUCHECK:
135 case SM_CYMENUCHECK:
136 return(13);
137 case SM_CXMENUSIZE:
138 case SM_CYMENUSIZE:
139 return(18);
140 case SM_CXMIN:
141 return(112);
142 case SM_CYMIN:
143 return(27);
144 case SM_CXMINIMIZED:
145 return(160);
146 case SM_CYMINIMIZED:
147 return(24);
148 case SM_CXMINSPACING:
149 return(160);
150 case SM_CYMINSPACING:
151 return(24);
152 case SM_CXMINTRACK:
153 return(112);
154 case SM_CYMINTRACK:
155 return(27);
156 case SM_CXSCREEN:
157 case SM_CYSCREEN:
158 {
159 HDC ScreenDCHandle;
160 PDC ScreenDC;
161
162 Width = 640;
163 Height = 480;
164 ScreenDCHandle = IntGdiCreateDC(NULL, NULL, NULL, NULL, TRUE);
165 if (NULL != ScreenDCHandle)
166 {
167 ScreenDC = DC_LockDc(ScreenDCHandle);
168 if (NULL != ScreenDC)
169 {
170 Width = ScreenDC->GDIInfo->ulHorzRes;
171 Height = ScreenDC->GDIInfo->ulVertRes;
172 DC_UnlockDc(ScreenDC);
173 }
174 NtGdiDeleteDC(ScreenDCHandle);
175 }
176 return SM_CXSCREEN == Index ? Width : Height;
177 }
178 case SM_CXSIZE:
179 case SM_CYSIZE:
180 return(18);
181 case SM_CXSMICON:
182 case SM_CYSMICON:
183 return(16);
184 case SM_CXSMSIZE:
185 return(12);
186 case SM_CYSMSIZE:
187 return(14);
188 case SM_CXVSCROLL:
189 case SM_CYVSCROLL:
190 return(16);
191 case SM_CYCAPTION:
192 return(19);
193 case SM_CYKANJIWINDOW:
194 return 0;
195 case SM_CYMENU:
196 return(19);
197 case SM_CYSMCAPTION:
198 return(15);
199 case SM_DBCSENABLED:
200 case SM_DEBUG:
201 case SM_MENUDROPALIGNMENT:
202 case SM_MIDEASTENABLED:
203 return(0);
204 case SM_MOUSEPRESENT:
205 return(1);
206 case SM_NETWORK:
207 return(3);
208 case SM_PENWINDOWS:
209 case SM_SECURE:
210 case SM_SHOWSOUNDS:
211 case SM_SLOWMACHINE:
212 return(0);
213 case SM_CMONITORS:
214 return(1);
215
216 default:
217 return(0xFFFFFFFF);
218 }
219 }
220
221
222
223 /* FIXME: Alot of thse values should NOT be hardcoded but they are */
224 ULONG STDCALL
225 NtUserGetSystemMetrics(ULONG Index)
226 {
227 DECLARE_RETURN(ULONG);
228
229 DPRINT("Enter NtUserGetSystemMetrics\n");
230 UserEnterShared();
231
232 RETURN(UserGetSystemMetrics(Index));
233
234 CLEANUP:
235 DPRINT("Leave NtUserGetSystemMetrics, ret=%i\n",_ret_);
236 UserLeave();
237 END_CLEANUP;
238 }
239 /* EOF */