update for HEAD-2003091401
[reactos.git] / lib / user32 / misc / display.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  * PROJECT:         ReactOS user32.dll
22  * FILE:            lib/user32/misc/dde.c
23  * PURPOSE:         DDE
24  * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
25  * UPDATE HISTORY:
26  *      09-05-2001  CSH  Created
27  */
28
29 /* INCLUDES ******************************************************************/
30
31 #include <windows.h>
32 #include <user32.h>
33 #include <debug.h>
34 #include <rosrtl/devmode.h>
35
36 /* FUNCTIONS *****************************************************************/
37
38 /*
39  * @implemented
40  */
41 WINBOOL STDCALL
42 EnumDisplayDevicesA(
43   LPCSTR lpDevice,
44   DWORD iDevNum,
45   PDISPLAY_DEVICE lpDisplayDevice,
46   DWORD dwFlags)
47 {
48   WINBOOL rc;
49   UNICODE_STRING Device;
50   if ( !RtlCreateUnicodeStringFromAsciiz ( &Device, (PCSZ)lpDevice ) )
51     {
52       SetLastError ( ERROR_OUTOFMEMORY );
53       return FALSE;
54     }
55
56   rc = NtUserEnumDisplayDevices (
57     &Device,
58     iDevNum,
59     lpDisplayDevice,
60     dwFlags );
61
62   RtlFreeUnicodeString ( &Device );
63
64   return rc;
65 }
66
67
68 /*
69  * @implemented
70  */
71 WINBOOL
72 STDCALL
73 EnumDisplayDevicesW(
74   LPCWSTR lpDevice,
75   DWORD iDevNum,
76   PDISPLAY_DEVICE lpDisplayDevice,
77   DWORD dwFlags)
78 {
79   UNICODE_STRING Device;
80   WINBOOL rc;
81
82   RtlInitUnicodeString ( &Device, lpDevice );
83
84   rc = NtUserEnumDisplayDevices (
85     &Device,
86     iDevNum,
87     lpDisplayDevice,
88     dwFlags );
89
90   RtlFreeUnicodeString ( &Device );
91
92   return rc;
93 }
94
95
96 /*
97  * @implemented
98  */
99 WINBOOL
100 STDCALL
101 EnumDisplayMonitors(
102   HDC hdc,
103   LPCRECT lprcClip,
104   MONITORENUMPROC lpfnEnum,
105   LPARAM dwData)
106 {
107   return NtUserEnumDisplayMonitors ( hdc, lprcClip, lpfnEnum, dwData );
108 }
109
110
111 /*
112  * @implemented
113  */
114 WINBOOL
115 STDCALL
116 EnumDisplaySettingsExA(
117   LPCSTR lpszDeviceName,
118   DWORD iModeNum,
119   LPDEVMODEA lpDevMode,
120   DWORD dwFlags)
121 {
122   WINBOOL rc;
123   UNICODE_STRING DeviceName;
124   DEVMODEW DevModeW;
125
126   if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
127     {
128       SetLastError ( ERROR_OUTOFMEMORY );
129       return FALSE;
130     }
131
132   RosRtlDevModeA2W ( &DevModeW, lpDevMode );
133
134   rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &DevModeW, dwFlags );
135
136   RtlFreeUnicodeString ( &DeviceName );
137
138   return rc;
139 }
140
141
142 /*
143  * @implemented
144  */
145 WINBOOL
146 STDCALL
147 EnumDisplaySettingsA(
148   LPCSTR lpszDeviceName,
149   DWORD iModeNum,
150   LPDEVMODEA lpDevMode)
151 {
152         return EnumDisplaySettingsExA ( lpszDeviceName, iModeNum, lpDevMode, 0 );
153 }
154
155
156 /*
157  * @implemented
158  */
159 WINBOOL
160 STDCALL
161 EnumDisplaySettingsExW(
162   LPCWSTR lpszDeviceName,
163   DWORD iModeNum,
164   LPDEVMODEW lpDevMode,
165   DWORD dwFlags)
166 {
167   WINBOOL rc;
168   UNICODE_STRING DeviceName;
169
170   RtlInitUnicodeString ( &DeviceName, lpszDeviceName );
171
172   rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, lpDevMode, dwFlags );
173
174   RtlFreeUnicodeString ( &DeviceName );
175
176   return rc;
177 }
178
179
180 /*
181  * @implemented
182  */
183 WINBOOL
184 STDCALL
185 EnumDisplaySettingsW(
186   LPCWSTR lpszDeviceName,
187   DWORD iModeNum,
188   LPDEVMODEW lpDevMode)
189 {
190         return EnumDisplaySettingsExW ( lpszDeviceName, iModeNum, lpDevMode, 0 );
191 }
192
193
194 /*
195  * @unimplemented
196  */
197 WINBOOL
198 STDCALL
199 GetMonitorInfoA(
200   HMONITOR hMonitor,
201   LPMONITORINFO lpmi)
202 {
203   UNIMPLEMENTED;
204   return FALSE;
205 }
206
207
208 /*
209  * @unimplemented
210  */
211 WINBOOL
212 STDCALL
213 GetMonitorInfoW(
214   HMONITOR hMonitor,
215   LPMONITORINFO lpmi)
216 {
217   UNIMPLEMENTED;
218   return FALSE;
219 }
220
221
222 /*
223  * @implemented
224  */
225 LONG
226 STDCALL
227 ChangeDisplaySettingsExA(
228   LPCSTR lpszDeviceName,
229   LPDEVMODEA lpDevMode,
230   HWND hwnd,
231   DWORD dwflags,
232   LPVOID lParam)
233 {
234   LONG rc;
235   UNICODE_STRING DeviceName;
236   DEVMODEW DevModeW;
237
238   if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName, (PCSZ)lpszDeviceName ) )
239     {
240       SetLastError ( ERROR_OUTOFMEMORY );
241       return DISP_CHANGE_BADPARAM; /* FIXME what to return? */
242     }
243
244   RosRtlDevModeA2W ( &DevModeW, lpDevMode );
245
246   rc = NtUserChangeDisplaySettings ( &DeviceName, &DevModeW, hwnd, dwflags, lParam );
247
248   RtlFreeUnicodeString ( &DeviceName );
249
250   return rc;
251 }
252
253
254 /*
255  * @implemented
256  */
257 LONG
258 STDCALL
259 ChangeDisplaySettingsA(
260   LPDEVMODEA lpDevMode,
261   DWORD dwflags)
262 {
263   return ChangeDisplaySettingsExA ( NULL, lpDevMode, NULL, dwflags, 0 );
264 }
265
266
267 /*
268  * @implemented
269  */
270 LONG
271 STDCALL
272 ChangeDisplaySettingsExW(
273   LPCWSTR lpszDeviceName,
274   LPDEVMODEW lpDevMode,
275   HWND hwnd,
276   DWORD dwflags,
277   LPVOID lParam)
278 {
279   LONG rc;
280   UNICODE_STRING DeviceName;
281
282   RtlInitUnicodeString ( &DeviceName, lpszDeviceName );
283
284   rc = NtUserChangeDisplaySettings ( &DeviceName, lpDevMode, hwnd, dwflags, lParam );
285
286   RtlFreeUnicodeString ( &DeviceName );
287
288   return rc;
289 }
290
291
292 /*
293  * @implemented
294  */
295 LONG
296 STDCALL
297 ChangeDisplaySettingsW(
298   LPDEVMODEW lpDevMode,
299   DWORD dwflags)
300 {
301   return ChangeDisplaySettingsExW ( NULL, lpDevMode, NULL, dwflags, 0 );
302 }