3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
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.
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.
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.
19 /* $Id: display.c,v 1.12 2004/08/15 21:36:28 chorns Exp $
21 * PROJECT: ReactOS user32.dll
22 * FILE: lib/user32/misc/dde.c
24 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
26 * 09-05-2001 CSH Created
29 /* INCLUDES ******************************************************************/
32 #include <rosrtl/devmode.h>
33 #include <win32k/ntuser.h>
37 /* FUNCTIONS *****************************************************************/
46 PDISPLAY_DEVICEA lpDisplayDevice
,
49 /* FIXME: This implementation doesn't convert the lpDisplayDevice structure! */
52 UNICODE_STRING Device
;
53 if ( !RtlCreateUnicodeStringFromAsciiz ( &Device
, (PCSZ
)lpDevice
) )
55 SetLastError ( ERROR_OUTOFMEMORY
);
59 rc
= NtUserEnumDisplayDevices (
65 RtlFreeUnicodeString ( &Device
);
82 PDISPLAY_DEVICE lpDisplayDevice
,
85 UNICODE_STRING Device
;
88 RtlInitUnicodeString ( &Device
, lpDevice
);
90 rc
= NtUserEnumDisplayDevices (
96 RtlFreeUnicodeString ( &Device
);
110 MONITORENUMPROC lpfnEnum
,
113 return NtUserEnumDisplayMonitors ( hdc
, lprcClip
, lpfnEnum
, dwData
);
122 EnumDisplaySettingsExA(
123 LPCSTR lpszDeviceName
,
125 LPDEVMODEA lpDevMode
,
129 UNICODE_STRING DeviceName
;
132 if ( !RtlCreateUnicodeStringFromAsciiz ( &DeviceName
, (PCSZ
)lpszDeviceName
) )
134 SetLastError ( ERROR_OUTOFMEMORY
);
138 RosRtlDevModeA2W ( &DevModeW
, lpDevMode
);
140 rc
= NtUserEnumDisplaySettings ( &DeviceName
, iModeNum
, &DevModeW
, dwFlags
);
142 RtlFreeUnicodeString ( &DeviceName
);
143 RosRtlDevModeW2A ( lpDevMode
, &DevModeW
);
154 EnumDisplaySettingsA(
155 LPCSTR lpszDeviceName
,
157 LPDEVMODEA lpDevMode
)
159 return EnumDisplaySettingsExA ( lpszDeviceName
, iModeNum
, lpDevMode
, 0 );
168 EnumDisplaySettingsExW(
169 LPCWSTR lpszDeviceName
,
171 LPDEVMODEW lpDevMode
,
175 UNICODE_STRING DeviceName
;
177 RtlInitUnicodeString ( &DeviceName
, lpszDeviceName
);
179 rc
= NtUserEnumDisplaySettings ( &DeviceName
, iModeNum
, lpDevMode
, dwFlags
);
181 RtlFreeUnicodeString ( &DeviceName
);
192 EnumDisplaySettingsW(
193 LPCWSTR lpszDeviceName
,
195 LPDEVMODEW lpDevMode
)
197 return EnumDisplaySettingsExW ( lpszDeviceName
, iModeNum
, lpDevMode
, 0 );
234 ChangeDisplaySettingsExA(
235 LPCSTR lpszDeviceName
,
236 LPDEVMODEA lpDevMode
,
242 UNICODE_STRING DeviceName
;
243 PUNICODE_STRING pDeviceName
= &DeviceName
;
245 LPDEVMODEW pDevModeW
= &DevModeW
;
247 if (lpszDeviceName
!= NULL
)
249 if ( !RtlCreateUnicodeStringFromAsciiz ( pDeviceName
, (PCSZ
)lpszDeviceName
) )
251 SetLastError ( ERROR_OUTOFMEMORY
);
252 return DISP_CHANGE_BADPARAM
; /* FIXME what to return? */
258 if (lpDevMode
!= NULL
)
259 RosRtlDevModeA2W ( pDevModeW
, lpDevMode
);
263 rc
= NtUserChangeDisplaySettings ( pDeviceName
, pDevModeW
, hwnd
, dwflags
, lParam
);
265 if (lpszDeviceName
!= NULL
)
266 RtlFreeUnicodeString ( &DeviceName
);
277 ChangeDisplaySettingsA(
278 LPDEVMODEA lpDevMode
,
281 return ChangeDisplaySettingsExA ( NULL
, lpDevMode
, NULL
, dwflags
, 0 );
290 ChangeDisplaySettingsExW(
291 LPCWSTR lpszDeviceName
,
292 LPDEVMODEW lpDevMode
,
298 UNICODE_STRING DeviceName
;
299 PUNICODE_STRING pDeviceName
= &DeviceName
;
301 if (lpszDeviceName
!= NULL
)
302 RtlInitUnicodeString ( pDeviceName
, lpszDeviceName
);
306 rc
= NtUserChangeDisplaySettings ( pDeviceName
, lpDevMode
, hwnd
, dwflags
, lParam
);
308 if (lpszDeviceName
!= NULL
)
309 RtlFreeUnicodeString ( pDeviceName
);
320 ChangeDisplaySettingsW(
321 LPDEVMODEW lpDevMode
,
324 return ChangeDisplaySettingsExW ( NULL
, lpDevMode
, NULL
, dwflags
, 0 );