ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
276 discussions
Start a n
N
ew thread
[tkreuzer] 51146: [USER32] Improve formatting
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Mar 26 01:20:11 2011 New Revision: 51146 URL:
http://svn.reactos.org/svn/reactos?rev=51146&view=rev
Log: [USER32] Improve formatting Modified: trunk/reactos/dll/win32/user32/misc/display.c Modified: trunk/reactos/dll/win32/user32/misc/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/disp…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] Sat Mar 26 01:20:11 2011 @@ -1,29 +1,8 @@ /* - * ReactOS kernel - * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * * PROJECT: ReactOS user32.dll * FILE: lib/user32/misc/dde.c * PURPOSE: DDE * PROGRAMMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net) - * UPDATE HISTORY: - * 09-05-2001 CSH Created */ /* INCLUDES ******************************************************************/ @@ -47,49 +26,52 @@ */ BOOL WINAPI EnumDisplayDevicesA( - LPCSTR lpDevice, - DWORD iDevNum, - PDISPLAY_DEVICEA lpDisplayDevice, - DWORD dwFlags) -{ - BOOL rc; - UNICODE_STRING Device; - DISPLAY_DEVICEW DisplayDeviceW; - - if ( !RtlCreateUnicodeStringFromAsciiz ( &Device, (PCSZ)lpDevice ) ) - { - SetLastError ( ERROR_OUTOFMEMORY ); - return FALSE; - } - - RtlZeroMemory(&DisplayDeviceW, sizeof(DISPLAY_DEVICEW)); - DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW); - rc = NtUserEnumDisplayDevices ( - &Device, - iDevNum, - &DisplayDeviceW, - dwFlags ); - if (rc) - { - /* Copy result from DisplayDeviceW to lpDisplayDevice. Buffers have the same size so result is always NULL terminated. */ - lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags; - WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceName, -1, - lpDisplayDevice->DeviceName, sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]), - NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceString, -1, - lpDisplayDevice->DeviceString, sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]), - NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceID, -1, - lpDisplayDevice->DeviceID, sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]), - NULL, NULL); - WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceKey, -1, - lpDisplayDevice->DeviceKey, sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]), - NULL, NULL); - } - - RtlFreeUnicodeString ( &Device ); - - return rc; + LPCSTR lpDevice, + DWORD iDevNum, + PDISPLAY_DEVICEA lpDisplayDevice, + DWORD dwFlags) +{ + BOOL rc; + UNICODE_STRING Device; + DISPLAY_DEVICEW DisplayDeviceW; + + if (!RtlCreateUnicodeStringFromAsciiz(&Device, (PCSZ)lpDevice)) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + + RtlZeroMemory(&DisplayDeviceW, sizeof(DISPLAY_DEVICEW)); + DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW); + rc = NtUserEnumDisplayDevices(&Device, + iDevNum, + &DisplayDeviceW, + dwFlags); + if (rc) + { + /* Copy result from DisplayDeviceW to lpDisplayDevice. Buffers have the same size so result is always NULL terminated. */ + lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags; + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceName, -1, + lpDisplayDevice->DeviceName, + sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceString, -1, + lpDisplayDevice->DeviceString, + sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceID, -1, + lpDisplayDevice->DeviceID, + sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceKey, -1, + lpDisplayDevice->DeviceKey, + sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]), + NULL, NULL); + } + + RtlFreeUnicodeString(&Device); + + return rc; } @@ -99,23 +81,23 @@ BOOL WINAPI EnumDisplayDevicesW( - LPCWSTR lpDevice, - DWORD iDevNum, - PDISPLAY_DEVICE lpDisplayDevice, - DWORD dwFlags) -{ - UNICODE_STRING Device; - BOOL rc; - - RtlInitUnicodeString ( &Device, lpDevice ); - - rc = NtUserEnumDisplayDevices ( - &Device, - iDevNum, - lpDisplayDevice, - dwFlags ); - - return rc; + LPCWSTR lpDevice, + DWORD iDevNum, + PDISPLAY_DEVICE lpDisplayDevice, + DWORD dwFlags) +{ + UNICODE_STRING Device; + BOOL rc; + + RtlInitUnicodeString(&Device, lpDevice); + + rc = NtUserEnumDisplayDevices( + &Device, + iDevNum, + lpDisplayDevice, + dwFlags); + + return rc; } @@ -125,71 +107,71 @@ BOOL WINAPI EnumDisplayMonitors( - HDC hdc, - LPCRECT lprcClip, - MONITORENUMPROC lpfnEnum, - LPARAM dwData) -{ - INT iCount, i; - HMONITOR *hMonitorList; - LPRECT pRectList; - HANDLE hHeap; - - /* get list of monitors/rects */ - iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, NULL, NULL, 0); - if (iCount < 0) - { - /* FIXME: SetLastError() */ - return FALSE; - } - if (iCount == 0) - { - return TRUE; - } - - hHeap = GetProcessHeap(); - hMonitorList = HeapAlloc(hHeap, 0, sizeof (HMONITOR) * iCount); - if (hMonitorList == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - pRectList = HeapAlloc(hHeap, 0, sizeof (RECT) * iCount); - if (pRectList == NULL) - { - HeapFree(hHeap, 0, hMonitorList); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, hMonitorList, pRectList, iCount); - if (iCount <= 0) - { - /* FIXME: SetLastError() */ - HeapFree(hHeap, 0, hMonitorList); - HeapFree(hHeap, 0, pRectList); - return FALSE; - } - - /* enumerate list */ - for (i = 0; i < iCount; i++) - { - HMONITOR hMonitor = hMonitorList[i]; - LPRECT pMonitorRect = pRectList + i; - HDC hMonitorDC = NULL; - - if (hdc != NULL) + HDC hdc, + LPCRECT lprcClip, + MONITORENUMPROC lpfnEnum, + LPARAM dwData) +{ + INT iCount, i; + HMONITOR *hMonitorList; + LPRECT pRectList; + HANDLE hHeap; + + /* get list of monitors/rects */ + iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, NULL, NULL, 0); + if (iCount < 0) + { + /* FIXME: SetLastError() */ + return FALSE; + } + if (iCount == 0) + { + return TRUE; + } + + hHeap = GetProcessHeap(); + hMonitorList = HeapAlloc(hHeap, 0, sizeof (HMONITOR) * iCount); + if (hMonitorList == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + pRectList = HeapAlloc(hHeap, 0, sizeof (RECT) * iCount); + if (pRectList == NULL) + { + HeapFree(hHeap, 0, hMonitorList); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, hMonitorList, pRectList, iCount); + if (iCount <= 0) + { + /* FIXME: SetLastError() */ + HeapFree(hHeap, 0, hMonitorList); + HeapFree(hHeap, 0, pRectList); + return FALSE; + } + + /* enumerate list */ + for (i = 0; i < iCount; i++) + { + HMONITOR hMonitor = hMonitorList[i]; + LPRECT pMonitorRect = pRectList + i; + HDC hMonitorDC = NULL; + + if (hdc != NULL) { - /* make monitor DC */ - hMonitorDC = hdc; + /* make monitor DC */ + hMonitorDC = hdc; } - if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData)) - break; - } - HeapFree(hHeap, 0, hMonitorList); - HeapFree(hHeap, 0, pRectList); - return TRUE; + if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData)) + break; + } + HeapFree(hHeap, 0, hMonitorList); + HeapFree(hHeap, 0, pRectList); + return TRUE; } @@ -240,13 +222,13 @@ COPYN(dmDriverVersion); switch (lpDevMode->dmSize) { - case SIZEOF_DEVMODEA_300: - case SIZEOF_DEVMODEA_400: - case SIZEOF_DEVMODEA_500: - break; - default: - lpDevMode->dmSize = SIZEOF_DEVMODEA_300; - break; + case SIZEOF_DEVMODEA_300: + case SIZEOF_DEVMODEA_400: + case SIZEOF_DEVMODEA_500: + break; + default: + lpDevMode->dmSize = SIZEOF_DEVMODEA_300; + break; } COPYN(dmDriverExtra); COPYN(dmFields); @@ -295,11 +277,11 @@ BOOL WINAPI EnumDisplaySettingsA( - LPCSTR lpszDeviceName, - DWORD iModeNum, - LPDEVMODEA lpDevMode) -{ - return EnumDisplaySettingsExA ( lpszDeviceName, iModeNum, lpDevMode, 0 ); + LPCSTR lpszDeviceName, + DWORD iModeNum, + LPDEVMODEA lpDevMode) +{ + return EnumDisplaySettingsExA ( lpszDeviceName, iModeNum, lpDevMode, 0 ); } @@ -335,11 +317,11 @@ BOOL WINAPI EnumDisplaySettingsW( - LPCWSTR lpszDeviceName, - DWORD iModeNum, - LPDEVMODEW lpDevMode) -{ - return EnumDisplaySettingsExW ( lpszDeviceName, iModeNum, lpDevMode, 0 ); + LPCWSTR lpszDeviceName, + DWORD iModeNum, + LPDEVMODEW lpDevMode) +{ + return EnumDisplaySettingsExW ( lpszDeviceName, iModeNum, lpDevMode, 0 ); } @@ -349,40 +331,40 @@ BOOL WINAPI GetMonitorInfoA( - HMONITOR hMonitor, - LPMONITORINFO lpmi) -{ - if (lpmi->cbSize == sizeof (MONITORINFO)) - { - return NtUserGetMonitorInfo(hMonitor, lpmi); - } - else if (lpmi->cbSize != sizeof (MONITORINFOEXA)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - else - { - MONITORINFOEXW miExW; - INT res; - - miExW.cbSize = sizeof (MONITORINFOEXW); - if (!NtUserGetMonitorInfo(hMonitor, (LPMONITORINFO)&miExW)) + HMONITOR hMonitor, + LPMONITORINFO lpmi) +{ + if (lpmi->cbSize == sizeof (MONITORINFO)) + { + return NtUserGetMonitorInfo(hMonitor, lpmi); + } + else if (lpmi->cbSize != sizeof (MONITORINFOEXA)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + else + { + MONITORINFOEXW miExW; + INT res; + + miExW.cbSize = sizeof (MONITORINFOEXW); + if (!NtUserGetMonitorInfo(hMonitor, (LPMONITORINFO)&miExW)) { - return FALSE; + return FALSE; } - memcpy(lpmi, &miExW, sizeof (MONITORINFO)); - res = WideCharToMultiByte(CP_THREAD_ACP, 0, miExW.szDevice, -1, - ((LPMONITORINFOEXA)lpmi)->szDevice, CCHDEVICENAME, - NULL, NULL); - if (res == 0) + memcpy(lpmi, &miExW, sizeof (MONITORINFO)); + res = WideCharToMultiByte(CP_THREAD_ACP, 0, miExW.szDevice, -1, + ((LPMONITORINFOEXA)lpmi)->szDevice, CCHDEVICENAME, + NULL, NULL); + if (res == 0) { - WARN("WideCharToMultiByte() failed!\n"); - return FALSE; + WARN("WideCharToMultiByte() failed!\n"); + return FALSE; } } - return TRUE; + return TRUE; } @@ -392,10 +374,10 @@ BOOL WINAPI GetMonitorInfoW( - HMONITOR hMonitor, - LPMONITORINFO lpmi) -{ - return NtUserGetMonitorInfo(hMonitor, lpmi); + HMONITOR hMonitor, + LPMONITORINFO lpmi) +{ + return NtUserGetMonitorInfo(hMonitor, lpmi); } @@ -405,10 +387,10 @@ HMONITOR WINAPI MonitorFromPoint( - IN POINT ptPoint, - IN DWORD dwFlags ) -{ - return NtUserMonitorFromPoint(ptPoint, dwFlags); + IN POINT ptPoint, + IN DWORD dwFlags ) +{ + return NtUserMonitorFromPoint(ptPoint, dwFlags); } @@ -418,10 +400,10 @@ HMONITOR WINAPI MonitorFromRect( - IN LPCRECT lpcRect, - IN DWORD dwFlags ) -{ - return NtUserMonitorFromRect(lpcRect, dwFlags); + IN LPCRECT lpcRect, + IN DWORD dwFlags ) +{ + return NtUserMonitorFromRect(lpcRect, dwFlags); } @@ -431,10 +413,10 @@ HMONITOR WINAPI MonitorFromWindow( - IN HWND hWnd, - IN DWORD dwFlags ) -{ - return NtUserMonitorFromWindow(hWnd, dwFlags); + IN HWND hWnd, + IN DWORD dwFlags ) +{ + return NtUserMonitorFromWindow(hWnd, dwFlags); } @@ -444,46 +426,46 @@ LONG WINAPI ChangeDisplaySettingsExA( - LPCSTR lpszDeviceName, - LPDEVMODEA lpDevMode, - HWND hwnd, - DWORD dwflags, - LPVOID lParam) -{ - LONG rc; - UNICODE_STRING DeviceName; - PUNICODE_STRING pDeviceName = &DeviceName; - - if (lpszDeviceName != NULL) - { - if ( !RtlCreateUnicodeStringFromAsciiz ( pDeviceName, (PCSZ)lpszDeviceName ) ) + LPCSTR lpszDeviceName, + LPDEVMODEA lpDevMode, + HWND hwnd, + DWORD dwflags, + LPVOID lParam) +{ + LONG rc; + UNICODE_STRING DeviceName; + PUNICODE_STRING pDeviceName = &DeviceName; + + if (lpszDeviceName != NULL) + { + if (!RtlCreateUnicodeStringFromAsciiz(pDeviceName, (PCSZ)lpszDeviceName)) { - SetLastError ( ERROR_OUTOFMEMORY ); - return DISP_CHANGE_BADPARAM; /* FIXME what to return? */ + SetLastError(ERROR_OUTOFMEMORY); + return DISP_CHANGE_BADPARAM; /* FIXME what to return? */ } } - else - pDeviceName = NULL; - - if (lpDevMode != NULL) - { - LPDEVMODEW pDevModeW; - pDevModeW = GdiConvertToDevmodeW(lpDevMode); - if(pDevModeW) - { - rc = NtUserChangeDisplaySettings ( pDeviceName, pDevModeW, hwnd, dwflags, lParam ); - RtlFreeHeap(GetProcessHeap(), 0, pDevModeW); - } else - rc = DISP_CHANGE_SUCCESSFUL; - } - else - rc = NtUserChangeDisplaySettings ( pDeviceName, NULL, hwnd, dwflags, lParam ); - - if (lpszDeviceName != NULL) - RtlFreeUnicodeString ( &DeviceName ); - - return rc; + pDeviceName = NULL; + + if (lpDevMode != NULL) + { + LPDEVMODEW pDevModeW; + pDevModeW = GdiConvertToDevmodeW(lpDevMode); + if(pDevModeW) + { + rc = NtUserChangeDisplaySettings(pDeviceName, pDevModeW, hwnd, dwflags, lParam); + RtlFreeHeap(GetProcessHeap(), 0, pDevModeW); + } + else + rc = DISP_CHANGE_SUCCESSFUL; + } + else + rc = NtUserChangeDisplaySettings(pDeviceName, NULL, hwnd, dwflags, lParam); + + if (lpszDeviceName != NULL) + RtlFreeUnicodeString(&DeviceName); + + return rc; } @@ -493,12 +475,12 @@ LONG WINAPI ChangeDisplaySettingsA( - LPDEVMODEA lpDevMode, - DWORD dwflags) -{ - if(lpDevMode) - lpDevMode->dmDriverExtra = 0; - return ChangeDisplaySettingsExA ( NULL, lpDevMode, NULL, dwflags, 0 ); + LPDEVMODEA lpDevMode, + DWORD dwflags) +{ + if(lpDevMode) + lpDevMode->dmDriverExtra = 0; + return ChangeDisplaySettingsExA ( NULL, lpDevMode, NULL, dwflags, 0 ); } @@ -508,24 +490,24 @@ LONG WINAPI ChangeDisplaySettingsExW( - LPCWSTR lpszDeviceName, - LPDEVMODEW lpDevMode, - HWND hwnd, - DWORD dwflags, - LPVOID lParam) -{ - LONG rc; - UNICODE_STRING DeviceName; - PUNICODE_STRING pDeviceName = &DeviceName; - - if (lpszDeviceName != NULL) - RtlInitUnicodeString ( pDeviceName, lpszDeviceName ); - else - pDeviceName = NULL; - - rc = NtUserChangeDisplaySettings ( pDeviceName, lpDevMode, hwnd, dwflags, lParam ); - - return rc; + LPCWSTR lpszDeviceName, + LPDEVMODEW lpDevMode, + HWND hwnd, + DWORD dwflags, + LPVOID lParam) +{ + LONG rc; + UNICODE_STRING DeviceName; + PUNICODE_STRING pDeviceName = &DeviceName; + + if (lpszDeviceName != NULL) + RtlInitUnicodeString(pDeviceName, lpszDeviceName); + else + pDeviceName = NULL; + + rc = NtUserChangeDisplaySettings(pDeviceName, lpDevMode, hwnd, dwflags, lParam); + + return rc; } @@ -535,10 +517,10 @@ LONG WINAPI ChangeDisplaySettingsW( - LPDEVMODEW lpDevMode, - DWORD dwflags) -{ - if(lpDevMode) - lpDevMode->dmDriverExtra = 0; - return ChangeDisplaySettingsExW ( NULL, lpDevMode, NULL, dwflags, 0 ); -} + LPDEVMODEW lpDevMode, + DWORD dwflags) +{ + if(lpDevMode) + lpDevMode->dmDriverExtra = 0; + return ChangeDisplaySettingsExW(NULL, lpDevMode, NULL, dwflags, 0); +}
13 years, 9 months
1
0
0
0
[jimtabor] 51145: [Csrss|Win32k] - Enable the desktop class and set the ReactOS variant of csrss back to local desktop class. Now all class tests pass, see bug 4778.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sat Mar 26 00:43:56 2011 New Revision: 51145 URL:
http://svn.reactos.org/svn/reactos?rev=51145&view=rev
Log: [Csrss|Win32k] - Enable the desktop class and set the ReactOS variant of csrss back to local desktop class. Now all class tests pass, see bug 4778. Modified: trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c trunk/reactos/subsystems/win32/win32k/ntuser/class.c Modified: trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c [iso-8859-1] Sat Mar 26 00:43:56 2011 @@ -136,7 +136,7 @@ * Create the desktop window class */ Class.cbSize = sizeof(WNDCLASSEXW); - Class.style = CS_GLOBALCLASS; + Class.style = 0; // Local Class Class.lpfnWndProc = DtbgWindowProc; Class.cbClsExtra = 0; Class.cbWndExtra = 0; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Sat Mar 26 00:43:56 2011 @@ -19,15 +19,15 @@ REGISTER_SYSCLASS DefaultServerClasses[] = { -/* { ((PWSTR)((ULONG_PTR)(WORD)(0x8001))), + { ((PWSTR)((ULONG_PTR)(WORD)(0x8001))), CS_GLOBALCLASS|CS_DBLCLKS, NULL, 0, IDC_ARROW, - (HBRUSH)(COLOR_BACKGROUND+1), + (HBRUSH)(COLOR_BACKGROUND + 1), FNID_DESKTOP, ICLS_DESKTOP - },*/ + }, { ((PWSTR)((ULONG_PTR)(WORD)(0x8003))), CS_VREDRAW|CS_HREDRAW|CS_SAVEBITS, NULL, // Use User32 procs
13 years, 9 months
1
0
0
0
[rharabien] 51144: [WIN32K] wcsncpy -> RtlStringCbCopyW (part 4/x) Avoid unneeded allocation
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 23:09:06 2011 New Revision: 51144 URL:
http://svn.reactos.org/svn/reactos?rev=51144&view=rev
Log: [WIN32K] wcsncpy -> RtlStringCbCopyW (part 4/x) Avoid unneeded allocation Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c Modified: trunk/reactos/subsystems/win32/win32k/objects/freetype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Fri Mar 25 23:09:06 2011 @@ -1078,12 +1078,16 @@ ExFreePoolWithTag(Otm, GDITAG_TEXT); - wcsncpy(Info->EnumLogFontEx.elfLogFont.lfFaceName, FaceName, LF_FACESIZE); - wcsncpy(Info->EnumLogFontEx.elfFullName, FaceName, LF_FULLFACESIZE); + RtlStringCbCopyW(Info->EnumLogFontEx.elfLogFont.lfFaceName, + sizeof(Info->EnumLogFontEx.elfLogFont.lfFaceName), + FaceName); + RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName, + sizeof(Info->EnumLogFontEx.elfFullName), + FaceName); RtlInitAnsiString(&StyleA, FontGDI->face->style_name); - RtlAnsiStringToUnicodeString(&StyleW, &StyleA, TRUE); - wcsncpy(Info->EnumLogFontEx.elfStyle, StyleW.Buffer, LF_FACESIZE); - RtlFreeUnicodeString(&StyleW); + StyleW.Buffer = Info->EnumLogFontEx.elfStyle; + StyleW.MaximumLength = sizeof(Info->EnumLogFontEx.elfStyle); + RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE); Info->EnumLogFontEx.elfLogFont.lfCharSet = DEFAULT_CHARSET; Info->EnumLogFontEx.elfScript[0] = L'\0'; @@ -1267,8 +1271,10 @@ if (InfoContext->Count < InfoContext->Size) { InfoContext->Info[InfoContext->Count] = InfoContext->Info[Existing]; - wcsncpy(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName, - RegistryName.Buffer, LF_FACESIZE); + RtlStringCbCopyNW(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName, + sizeof(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName), + RegistryName.Buffer, + RegistryName.Length); } InfoContext->Count++; return STATUS_SUCCESS; @@ -2643,7 +2649,7 @@ PFONT_ENTRY CurrentEntry; FONTGDI *FontGDI; UINT Score; - +ASSERT(FontObj && MatchScore && LogFont && FaceName && Head); Entry = Head->Flink; while (Entry != Head) {
13 years, 9 months
1
0
0
0
[rharabien] 51143: [WIN32K] wcsncpy -> safe api (part 3/x)
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:57:46 2011 New Revision: 51143 URL:
http://svn.reactos.org/svn/reactos?rev=51143&view=rev
Log: [WIN32K] wcsncpy -> safe api (part 3/x) Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c Modified: trunk/reactos/subsystems/win32/win32k/eng/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] Fri Mar 25 22:57:46 2011 @@ -84,12 +84,13 @@ pGraphicsDevice->FileObject = pFileObject; /* Copy device name */ - wcsncpy(pGraphicsDevice->szNtDeviceName, - pustrDeviceName->Buffer, - sizeof(pGraphicsDevice->szNtDeviceName) / sizeof(WCHAR)); + RtlStringCbCopyNW(pGraphicsDevice->szNtDeviceName, + sizeof(pGraphicsDevice->szNtDeviceName), + pustrDeviceName->Buffer, + pustrDeviceName->Length); /* Create a win device name (FIXME: virtual devices!) */ - swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\VIDEO%d", (CHAR)giDevNum); + swprintf(pGraphicsDevice->szWinDeviceName, L"\\\\.\\VIDEO%d", (int)giDevNum); /* Allocate a buffer for the strings */ cj = pustrDiplayDrivers->Length + pustrDescription->Length + sizeof(WCHAR); @@ -98,6 +99,8 @@ { DPRINT1("Could not allocate string buffer\n"); ASSERT(FALSE); // FIXME + ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE); + return NULL; } /* Copy display driver names */ @@ -160,7 +163,7 @@ if (!pGraphicsDevice->pdevmodeInfo || cModes == 0) { DPRINT1("No devmodes\n"); - ExFreePool(pGraphicsDevice); + ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE); return NULL; } @@ -172,7 +175,7 @@ if (!pGraphicsDevice->pDevModeList) { DPRINT1("No devmode list\n"); - ExFreePool(pGraphicsDevice); + ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE); return NULL; }
13 years, 9 months
1
0
0
0
[rharabien] 51142: [WIN32K] Fix GDITAG_LDE/TAG_LDE mess
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:49:30 2011 New Revision: 51142 URL:
http://svn.reactos.org/svn/reactos?rev=51142&view=rev
Log: [WIN32K] Fix GDITAG_LDE/TAG_LDE mess Modified: trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c trunk/reactos/subsystems/win32/win32k/include/ldevobj.h Modified: trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/ldevobj.c [iso-8859-1] Fri Mar 25 22:49:30 2011 @@ -103,7 +103,7 @@ ASSERT(pldev && pldev->pGdiDriverInfo == NULL); /* Free the memory */ - ExFreePoolWithTag(pldev, TAG_LDEV); + ExFreePoolWithTag(pldev, GDITAG_LDEV); } PDEVMODEINFO @@ -145,7 +145,7 @@ { /* Could not get modes */ DPRINT1("returned size %ld(%ld)\n", cbSize, pdminfo->cbdevmode); - ExFreePool(pdminfo); + ExFreePoolWithTag(pdminfo, GDITAG_DEVMODE); pdminfo = NULL; } @@ -192,7 +192,7 @@ pstrPathName->Buffer, Status); /* Free the allocated memory */ - ExFreePoolWithTag(pDriverInfo, TAG_LDEV); + ExFreePoolWithTag(pDriverInfo, GDITAG_LDEV); return FALSE; } Modified: trunk/reactos/subsystems/win32/win32k/include/ldevobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/ldevobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/ldevobj.h [iso-8859-1] Fri Mar 25 22:49:30 2011 @@ -4,9 +4,6 @@ #define __ImageBase _image_base__ #endif extern IMAGE_DOS_HEADER __ImageBase; - - -#define TAG_LDEV 'Gldv' #define GDI_ENGINE_VERSION DDI_DRIVER_VERSION_NT5_01
13 years, 9 months
1
0
0
0
[rharabien] 51141: [WIN32K] Forgotten in r51139...
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:45:59 2011 New Revision: 51141 URL:
http://svn.reactos.org/svn/reactos?rev=51141&view=rev
Log: [WIN32K] Forgotten in r51139... Modified: trunk/reactos/subsystems/win32/win32k/pch.h Modified: trunk/reactos/subsystems/win32/win32k/pch.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/pc…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/pch.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/pch.h [iso-8859-1] Fri Mar 25 22:45:59 2011 @@ -18,6 +18,7 @@ #include <ntifs.h> #include <tvout.h> #include <ntndk.h> +#include <ntstrsafe.h> /* Win32 Headers */ /* FIXME: Defines in winbase.h that we need... */
13 years, 9 months
1
0
0
0
[rharabien] 51140: [WIN32K] Change wcsncpy to safe functions (part 2/x)
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:36:37 2011 New Revision: 51140 URL:
http://svn.reactos.org/svn/reactos?rev=51140&view=rev
Log: [WIN32K] Change wcsncpy to safe functions (part 2/x) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/display.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/display.c [iso-8859-1] Fri Mar 25 22:36:37 2011 @@ -309,11 +309,11 @@ ZwClose(hkey); /* Copy device name, device string and StateFlags */ - wcsncpy(pdispdev->DeviceName, pGraphicsDevice->szWinDeviceName, 32); - wcsncpy(pdispdev->DeviceString, pGraphicsDevice->pwszDescription, 128); + RtlStringCbCopyW(pdispdev->DeviceName, sizeof(pdispdev->DeviceName), pGraphicsDevice->szWinDeviceName); + RtlStringCbCopyW(pdispdev->DeviceString, sizeof(pdispdev->DeviceString), pGraphicsDevice->pwszDescription); pdispdev->StateFlags = pGraphicsDevice->StateFlags; - // FIXME: fill in DEVICE ID + pdispdev->DeviceID[0] = UNICODE_NULL; return STATUS_SUCCESS; } @@ -339,7 +339,7 @@ if (pustrDevice && iDevNum != 0) return FALSE; - dispdev.cb = sizeof(DISPLAY_DEVICEW); + dispdev.cb = sizeof(dispdev); if (pustrDevice) {
13 years, 9 months
1
0
0
0
[rharabien] 51139: [WIN32K] Make sure strings returned by internal function RegQueryValue are NULL terminated
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:34:53 2011 New Revision: 51139 URL:
http://svn.reactos.org/svn/reactos?rev=51139&view=rev
Log: [WIN32K] Make sure strings returned by internal function RegQueryValue are NULL terminated Modified: trunk/reactos/subsystems/win32/win32k/misc/registry.c Modified: trunk/reactos/subsystems/win32/win32k/misc/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/mi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/misc/registry.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/misc/registry.c [iso-8859-1] Fri Mar 25 22:34:53 2011 @@ -58,7 +58,7 @@ ULONG cbInfoSize, cbDataSize; /* Check if the local buffer is sufficient */ - cbInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + *pcbValue; + cbInfoSize = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data) + *pcbValue; if (cbInfoSize <= sizeof(ajBuffer)) { pInfo = (PVOID)ajBuffer; @@ -89,8 +89,11 @@ /* Did we get the right type */ if (pInfo->Type == ulType) { - /* Copy the contents to the caller */ - RtlCopyMemory(pvData, pInfo->Data, min(*pcbValue, cbDataSize)); + /* Copy the contents to the caller. Make sure strings are null terminated */ + if (ulType == REG_SZ || ulType == REG_MULTI_SZ || ulType == REG_EXPAND_SZ) + RtlStringCbCopyNW((LPWSTR)pvData, *pcbValue, (LPWSTR)pInfo->Data, cbDataSize); + else + RtlCopyMemory(pvData, pInfo->Data, cbDataSize); } else Status = STATUS_OBJECT_TYPE_MISMATCH;
13 years, 9 months
1
0
0
0
[rharabien] 51138: [NTOSKRNL] Change strncpy calls to RtlStringSbCopyA (PART 1/x) Fix bug in MmLoadSystemImage which caused FileName parameter to be freed
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 22:28:15 2011 New Revision: 51138 URL:
http://svn.reactos.org/svn/reactos?rev=51138&view=rev
Log: [NTOSKRNL] Change strncpy calls to RtlStringSbCopyA (PART 1/x) Fix bug in MmLoadSystemImage which caused FileName parameter to be freed Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c trunk/reactos/ntoskrnl/ke/freeldr.c trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Fri Mar 25 22:28:15 2011 @@ -2490,14 +2490,12 @@ */ if (Buffer == Orig) { - strncpy(Buffer, LastCommand, Size); - Buffer[Size - 1] = '\0'; + RtlStringCbCopyA(Buffer, Size, LastCommand); } else { *Buffer = '\0'; - strncpy(LastCommand, Orig, sizeof (LastCommand)); - LastCommand[sizeof (LastCommand) - 1] = '\0'; + RtlStringCbCopyA(LastCommand, sizeof(LastCommand), Orig); } return; @@ -2614,8 +2612,7 @@ static PCH Argv[256]; static CHAR OrigCommand[1024]; - strncpy(OrigCommand, Command, sizeof(OrigCommand) - 1); - OrigCommand[sizeof(OrigCommand) - 1] = '\0'; + RtlStringCbCopyA(OrigCommand, sizeof(OrigCommand), Command); Argc = 0; p = Command; Modified: trunk/reactos/ntoskrnl/ke/freeldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/freeldr.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ke/freeldr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/freeldr.c [iso-8859-1] Fri Mar 25 22:28:15 2011 @@ -947,6 +947,8 @@ WCHAR PathSetup[] = L"\\SystemRoot\\"; CHAR DriverNameLow[256]; ULONG Base; + size_t Remaining; + WCHAR *StringEnd; #if defined(_PPC_) ULONG KernelBase = RosLoaderBlock->ModsAddr[0].ModStart; #endif @@ -1123,7 +1125,7 @@ /* Construct a correct full name */ BldrModuleStringsFull[i][0] = 0; - LdrEntry->FullDllName.MaximumLength = 260 * sizeof(WCHAR); + LdrEntry->FullDllName.MaximumLength = sizeof(BldrModuleStringsFull[i]); LdrEntry->FullDllName.Length = 0; LdrEntry->FullDllName.Buffer = BldrModuleStringsFull[i]; @@ -1256,25 +1258,26 @@ /* Find the first \, separating the ARC path from NT path */ BootPath = strchr(CommandLine, '\\'); *BootPath = ANSI_NULL; - strncpy(BldrArcBootPath, CommandLine, 63); + RtlStringCbCopyA(BldrArcBootPath, sizeof(BldrArcBootPath), CommandLine); LoaderBlock->ArcBootDeviceName = BldrArcBootPath; /* The rest of the string is the NT path */ HalPath = strchr(BootPath + 1, ' '); *HalPath = ANSI_NULL; - BldrNtBootPath[0] = '\\'; - strncat(BldrNtBootPath, BootPath + 1, 61); - strcat(BldrNtBootPath,"\\"); + Remaining = sizeof(BldrNtBootPath); + RtlStringCbCopyExA(BldrNtBootPath, Remaining, "\\", &StringEnd, &Remaining, 0); + RtlStringCbCopyExA(StringEnd, Remaining, BootPath + 1, &StringEnd, &Remaining, 0); + RtlStringCbCopyA(StringEnd, Remaining, "\\"); LoaderBlock->NtBootPathName = BldrNtBootPath; /* Set the HAL paths */ - strncpy(BldrArcHalPath, BldrArcBootPath, 63); + RtlStringCbCopyA(BldrArcHalPath, sizeof(BldrArcHalPath), BldrArcBootPath); LoaderBlock->ArcHalDeviceName = BldrArcHalPath; strcpy(BldrNtHalPath, "\\"); LoaderBlock->NtHalPathName = BldrNtHalPath; /* Use this new command line */ - strncpy(LoaderBlock->LoadOptions, HalPath + 2, 255); + RtlStringCbCopyA(LoaderBlock->LoadOptions, 255, HalPath + 2); /* Parse it and change every slash to a space */ BootPath = LoaderBlock->LoadOptions; Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Fri Mar 25 22:28:15 2011 @@ -710,9 +710,9 @@ NameImport = (PIMAGE_IMPORT_BY_NAME)Name->u1.AddressOfData; /* Copy the procedure name */ - strncpy(*MissingApi, - (PCHAR)&NameImport->Name[0], - MAXIMUM_FILENAME_LENGTH - 1); + RtlStringCbCopyA(*MissingApi, + MAXIMUM_FILENAME_LENGTH, + (PCHAR)&NameImport->Name[0]); /* Setup name tables */ DPRINT("Import name: %s\n", NameImport->Name); @@ -3000,8 +3000,8 @@ /* If we have a file handle, close it */ if (FileHandle) ZwClose(FileHandle); - /* Check if we had a prefix */ - if (NamePrefix) ExFreePool(PrefixName.Buffer); + /* Check if we had a prefix (not supported yet - PrefixName == *FileName now) */ + /* if (NamePrefix) ExFreePool(PrefixName.Buffer); */ /* Free the name buffer and return status */ ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
13 years, 9 months
1
0
0
0
[rharabien] 51137: [USER32] Fix bug causing no NULL termination of strings after conversion in EnumDisplayDevicesA. Fixes one usr32:monitor winetest
by rharabien@svn.reactos.org
Author: rharabien Date: Fri Mar 25 21:58:39 2011 New Revision: 51137 URL:
http://svn.reactos.org/svn/reactos?rev=51137&view=rev
Log: [USER32] Fix bug causing no NULL termination of strings after conversion in EnumDisplayDevicesA. Fixes one usr32:monitor winetest Modified: trunk/reactos/dll/win32/user32/misc/display.c Modified: trunk/reactos/dll/win32/user32/misc/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/disp…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] Fri Mar 25 21:58:39 2011 @@ -71,24 +71,20 @@ dwFlags ); if (rc) { - /* Copy result from DisplayDeviceW to lpDisplayDevice */ + /* Copy result from DisplayDeviceW to lpDisplayDevice. Buffers have the same size so result is always NULL terminated. */ lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags; - WideCharToMultiByte(CP_ACP,0, - DisplayDeviceW.DeviceName,wcslen(DisplayDeviceW.DeviceName), - lpDisplayDevice->DeviceName,sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]), - NULL,NULL); - WideCharToMultiByte(CP_ACP,0, - DisplayDeviceW.DeviceString,wcslen(DisplayDeviceW.DeviceString), - lpDisplayDevice->DeviceString,sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]), - NULL,NULL); - WideCharToMultiByte(CP_ACP,0, - DisplayDeviceW.DeviceID,wcslen(DisplayDeviceW.DeviceID), - lpDisplayDevice->DeviceID,sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]), - NULL,NULL); - WideCharToMultiByte(CP_ACP,0, - DisplayDeviceW.DeviceKey,wcslen(DisplayDeviceW.DeviceKey), - lpDisplayDevice->DeviceKey,sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]), - NULL,NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceName, -1, + lpDisplayDevice->DeviceName, sizeof(lpDisplayDevice->DeviceName) / sizeof(lpDisplayDevice->DeviceName[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceString, -1, + lpDisplayDevice->DeviceString, sizeof(lpDisplayDevice->DeviceString) / sizeof(lpDisplayDevice->DeviceString[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceID, -1, + lpDisplayDevice->DeviceID, sizeof(lpDisplayDevice->DeviceID) / sizeof(lpDisplayDevice->DeviceID[0]), + NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceKey, -1, + lpDisplayDevice->DeviceKey, sizeof(lpDisplayDevice->DeviceKey) / sizeof(lpDisplayDevice->DeviceKey[0]), + NULL, NULL); } RtlFreeUnicodeString ( &Device );
13 years, 9 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200