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
2025
January
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
May 2008
----- 2025 -----
January 2025
----- 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
25 participants
586 discussions
Start a n
N
ew thread
[jimtabor] 33509: Implement NtGdiSetVirtualResolution, SetSizeDevice and NtGdiScaleViewport/WindowExtEx. Getting ready to fix wine gdi mapping tests.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Tue May 13 18:26:02 2008 New Revision: 33509 URL:
http://svn.reactos.org/svn/reactos?rev=33509&view=rev
Log: Implement NtGdiSetVirtualResolution, SetSizeDevice and NtGdiScaleViewport/WindowExtEx. Getting ready to fix wine gdi mapping tests. Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h trunk/reactos/subsystems/win32/win32k/objects/coord.c trunk/reactos/subsystems/win32/win32k/stubs/stubs.c Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] Tue May 13 18:26:02 2008 @@ -31,4 +31,6 @@ CONST LPXFORM lpXForm, DWORD Mode); +VOID FASTCALL IntMirrorWindowOrg(PDC); + #endif Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Tue May 13 18:26:02 2008 @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id$ +/* * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -558,27 +558,167 @@ BOOL STDCALL NtGdiScaleViewportExtEx(HDC hDC, - int Xnum, - int Xdenom, - int Ynum, - int Ydenom, - LPSIZE Size) -{ - UNIMPLEMENTED; - return FALSE; + int Xnum, + int Xdenom, + int Ynum, + int Ydenom, + LPSIZE pSize) +{ + PDC pDC; + PDC_ATTR pDc_Attr; + BOOL Ret = FALSE; + LONG X, Y; + + pDC = DC_LockDc(hDC); + if (!pDC) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + pDc_Attr = pDC->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; + + if ( pSize ) + { + NTSTATUS Status = STATUS_SUCCESS; + + _SEH_TRY + { + ProbeForWrite(pSize, + sizeof(LPSIZE), + 1); + + pSize->cx = pDc_Attr->szlViewportExt.cx; + pSize->cy = pDc_Attr->szlViewportExt.cy; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + DC_UnlockDc(pDC); + return FALSE; + } + } + + if (pDc_Attr->iMapMode > MM_TWIPS) + { + if ( ( Xdenom ) && ( Ydenom ) ) + { + X = Xnum * pDc_Attr->szlViewportExt.cx / Xdenom; + if ( X ) + { + Y = Ynum * pDc_Attr->szlViewportExt.cy / Ydenom; + if ( Y ) + { + pDc_Attr->szlViewportExt.cx = X; + pDc_Attr->szlViewportExt.cy = Y; + + IntMirrorWindowOrg(pDC); + + pDc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); + + if (pDc_Attr->iMapMode == MM_ISOTROPIC) IntFixIsotropicMapping(pDC); + DC_UpdateXforms(pDC); + + Ret = TRUE; + } + } + } + } + else + Ret = TRUE; + + DC_UnlockDc(pDC); + return Ret; } BOOL STDCALL NtGdiScaleWindowExtEx(HDC hDC, - int Xnum, - int Xdenom, - int Ynum, - int Ydenom, - LPSIZE Size) -{ - UNIMPLEMENTED; - return FALSE; + int Xnum, + int Xdenom, + int Ynum, + int Ydenom, + LPSIZE pSize) +{ + PDC pDC; + PDC_ATTR pDc_Attr; + BOOL Ret = FALSE; + LONG X, Y; + + pDC = DC_LockDc(hDC); + if (!pDC) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + pDc_Attr = pDC->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; + + if ( pSize ) + { + NTSTATUS Status = STATUS_SUCCESS; + + _SEH_TRY + { + ProbeForWrite(pSize, + sizeof(LPSIZE), + 1); + + X = pDc_Attr->szlWindowExt.cx; + if (pDc_Attr->dwLayout & LAYOUT_RTL) X = -X; + pSize->cx = X; + pSize->cy = pDc_Attr->szlWindowExt.cy; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + DC_UnlockDc(pDC); + return FALSE; + } + } + + if (pDc_Attr->iMapMode > MM_TWIPS) + { + if (( Xdenom ) && ( Ydenom )) + { + X = Xnum * pDc_Attr->szlWindowExt.cx / Xdenom; + if ( X ) + { + Y = Ynum * pDc_Attr->szlWindowExt.cy / Ydenom; + if ( Y ) + { + pDc_Attr->szlWindowExt.cx = X; + pDc_Attr->szlWindowExt.cy = Y; + + IntMirrorWindowOrg(pDC); + + pDc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); + + if (pDc_Attr->iMapMode == MM_ISOTROPIC) IntFixIsotropicMapping(pDC); + DC_UpdateXforms(pDC); + + Ret = TRUE; + } + } + } + } + else + Ret = TRUE; + + DC_UnlockDc(pDC); + return Ret; } int @@ -1033,4 +1173,68 @@ return TRUE; } +/* + * @implemented + */ +BOOL +APIENTRY +NtGdiSetSizeDevice( + IN HDC hdc, + IN INT cxVirtualDevice, + IN INT cyVirtualDevice) +{ + PDC dc; + PDC_ATTR pDc_Attr; + + if (!cxVirtualDevice || + !cyVirtualDevice ) return FALSE; + + dc = DC_LockDc(hdc); + if (!dc) return FALSE; + + pDc_Attr = dc->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &dc->Dc_Attr; + + pDc_Attr->szlVirtualDeviceSize.cx = cxVirtualDevice; + pDc_Attr->szlVirtualDeviceSize.cy = cyVirtualDevice; + +// DC_UpdateXforms(dc); + DC_UnlockDc(dc); + + return TRUE; +} + +/* + * @implemented + */ +BOOL +APIENTRY +NtGdiSetVirtualResolution( + IN HDC hdc, + IN INT cxVirtualDevicePixel, + IN INT cyVirtualDevicePixel, + IN INT cxVirtualDeviceMm, + IN INT cyVirtualDeviceMm) +{ + PDC dc; + PDC_ATTR pDc_Attr; + + // Need test types for zeros and non zeros + + dc = DC_LockDc(hdc); + if (!dc) return FALSE; + + pDc_Attr = dc->pDc_Attr; + if(!pDc_Attr) pDc_Attr = &dc->Dc_Attr; + + pDc_Attr->szlVirtualDevicePixel.cx = cxVirtualDevicePixel; + pDc_Attr->szlVirtualDevicePixel.cy = cyVirtualDevicePixel; + pDc_Attr->szlVirtualDeviceMm.cx = cxVirtualDeviceMm; + pDc_Attr->szlVirtualDeviceMm.cy = cyVirtualDeviceMm; + +// DC_UpdateXforms(dc); + DC_UnlockDc(dc); + return TRUE; +} + /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/stubs/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/st…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] Tue May 13 18:26:02 2008 @@ -2559,37 +2559,7 @@ return 0; } - /* - * @unimplemented - */ -BOOL -APIENTRY -NtGdiSetSizeDevice( - IN HDC hdc, - IN INT cxVirtualDevice, - IN INT cyVirtualDevice) -{ - UNIMPLEMENTED; - return FALSE; -} - - /* - * @unimplemented - */ -BOOL -APIENTRY -NtGdiSetVirtualResolution( - IN HDC hdc, - IN INT cxVirtualDevicePixel, - IN INT cyVirtualDevicePixel, - IN INT cxVirtualDeviceMm, - IN INT cyVirtualDeviceMm) -{ - UNIMPLEMENTED; - return FALSE; -} - - /* +/* * @unimplemented */ INT
16 years, 8 months
1
0
0
0
[cfinck] 33508: Open the Explorer Shell Folder instead of providing a standalone Control Panel. This changed enables us to remove lots of files from the app :-)
by cfinck@svn.reactos.org
Author: cfinck Date: Tue May 13 16:39:25 2008 New Revision: 33508 URL:
http://svn.reactos.org/svn/reactos?rev=33508&view=rev
Log: Open the Explorer Shell Folder instead of providing a standalone Control Panel. This changed enables us to remove lots of files from the app :-) Removed: trunk/reactos/base/applications/control/lang/ trunk/reactos/base/applications/control/rsrc.rc Modified: trunk/reactos/base/applications/control/control.c trunk/reactos/base/applications/control/control.h trunk/reactos/base/applications/control/control.rbuild trunk/reactos/base/applications/control/control.rc trunk/reactos/base/applications/control/resource.h Modified: trunk/reactos/base/applications/control/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.c [iso-8859-1] Tue May 13 16:39:25 2008 @@ -37,298 +37,6 @@ return RUNDLL(szParameters); } -static VOID -PopulateCPLList(HWND hLisCtrl) -{ - WIN32_FIND_DATA fd; - HANDLE hFind; - TCHAR pszSearchPath[MAX_PATH]; - HIMAGELIST hImgListSmall; - HIMAGELIST hImgListLarge; - HMODULE hDll; - CPLAPPLETFUNC pFunc; - TCHAR pszPath[MAX_PATH]; - TCHAR szPanelNum[CCH_UINT_MAX + 1]; - DEVMODE pDevMode; - - /* Icon drawing mode */ - pDevMode.dmSize = sizeof(DEVMODE); - pDevMode.dmDriverExtra = 0; - - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode); - hImgListSmall = ImageList_Create(16, 16, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5); - hImgListLarge = ImageList_Create(32, 32, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5); - - GetSystemDirectory(pszSearchPath, MAX_PATH); - _tcscat(pszSearchPath, _T("\\*.cpl")); - - hFind = FindFirstFile(pszSearchPath, &fd); - - while (hFind != INVALID_HANDLE_VALUE) - { - _tcscpy(pszPath, pszSearchPath); - *_tcsrchr(pszPath, '\\') = 0; - _tcscat(pszPath, _T("\\")); - _tcscat(pszPath, fd.cFileName); - - hDll = LoadLibrary(pszPath); - pFunc = (CPLAPPLETFUNC)GetProcAddress(hDll, "CPlApplet"); - - if (pFunc && pFunc(hLisCtrl, CPL_INIT, 0, 0)) - { - UINT i, uPanelCount; - - uPanelCount = (UINT)pFunc(hLisCtrl, CPL_GETCOUNT, 0, 0); - - for (i = 0; i < uPanelCount; i++) - { - CPLINFO CplInfo; - HICON hIcon; - TCHAR Name[MAX_PATH]; - int index; - LPTSTR pszCmd; - - pszCmd = (LPTSTR) HeapAlloc(hProcessHeap, 0, MAX_PATH * sizeof(TCHAR)); - if(!pszCmd) - return; - - /* Build the command, which is later passed to RunControlPanel */ - _tcscpy(pszCmd, fd.cFileName); - _tcscat(pszCmd, _T(" @")); - _itot(i, szPanelNum, 10); - _tcscat(pszCmd, szPanelNum); - - pFunc(hLisCtrl, CPL_INQUIRE, (LPARAM)i, (LPARAM)&CplInfo); - - hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - index = ImageList_AddIcon(hImgListSmall, hIcon); - DestroyIcon(hIcon); - - hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - ImageList_AddIcon(hImgListLarge, hIcon); - DestroyIcon(hIcon); - - if (LoadString(hDll, CplInfo.idName, Name, MAX_PATH)) - { - INT nIndex; - LV_ITEM lvi = {0}; - - lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; - lvi.pszText = Name; - lvi.state = 0; - lvi.iImage = index; - lvi.lParam = (LPARAM)pszCmd; - nIndex = ListView_InsertItem(hLisCtrl, &lvi); - - if (LoadString(hDll, CplInfo.idInfo, Name, MAX_PATH)) - ListView_SetItemText(hLisCtrl, nIndex, 1, Name); - } - } - } - - if (!FindNextFile(hFind, &fd)) - hFind = INVALID_HANDLE_VALUE; - } - - (void)ListView_SetImageList(hLisCtrl, hImgListSmall, LVSIL_SMALL); - (void)ListView_SetImageList(hLisCtrl, hImgListLarge, LVSIL_NORMAL); -} - -LRESULT CALLBACK -MyWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - static HWND hListView; - TCHAR szBuf[1024]; - - switch (uMsg) - { - case WM_CREATE: - { - RECT rect; - LV_COLUMN column = {0}; - - GetClientRect(hWnd, &rect); - hListView = CreateWindow(WC_LISTVIEW, NULL, LVS_REPORT | LVS_ALIGNLEFT | LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, rect.right, rect.bottom, hWnd, NULL, hInst, 0); - - column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; - column.fmt = LVCFMT_LEFT; - column.cx = (rect.right - rect.left) / 3; - column.iSubItem = 0; - LoadString(hInst, IDS_NAME, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - column.pszText = szBuf; - (void)ListView_InsertColumn(hListView, 0, &column); - - column.cx = (rect.right - rect.left) - ((rect.right - rect.left) / 3) - 1; - column.iSubItem = 1; - LoadString(hInst, IDS_COMMENT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - column.pszText = szBuf; - (void)ListView_InsertColumn(hListView, 1, &column); - - PopulateCPLList(hListView); - - (void)ListView_SetColumnWidth(hListView, 2, LVSCW_AUTOSIZE_USEHEADER); - (void)ListView_Update(hListView, 0); - - SetFocus(hListView); - - return 0; - } - - case WM_DESTROY: - { - LV_ITEM lvi; - INT nItems; - - lvi.mask = LVIF_PARAM; - - /* Free the memory used for the command strings */ - for(nItems = ListView_GetItemCount(hListView); --nItems >= 0;) - { - lvi.iItem = nItems; - (void)ListView_GetItem(hListView, &lvi); - HeapFree(hProcessHeap, 0, (LPVOID)lvi.lParam); - } - - PostQuitMessage(0); - return 0; - } - - case WM_SIZE: - { - RECT rect; - - GetClientRect(hWnd, &rect); - MoveWindow(hListView, 0, 0, rect.right, rect.bottom, TRUE); - - return 0; - } - - case WM_NOTIFY: - { - NMHDR *phdr; - phdr = (NMHDR*)lParam; - - switch(phdr->code) - { - case NM_RETURN: - case NM_DBLCLK: - { - int nSelect; - LV_ITEM lvi = {0}; - LPTSTR pszCmd; - - nSelect = SendMessage(hListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_FOCUSED); - - if (nSelect == -1) - { - /* no items */ - LoadString(hInst, IDS_NO_ITEMS, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - MessageBox(hWnd, (LPCTSTR)szBuf, NULL, MB_OK | MB_ICONINFORMATION); - break; - } - - lvi.iItem = nSelect; - lvi.mask = LVIF_PARAM; - (void)ListView_GetItem(hListView, &lvi); - - pszCmd = (LPTSTR)lvi.lParam; - - if (pszCmd) - RunControlPanel(pszCmd); - - return 0; - } - } - } - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDM_LARGEICONS: - SetWindowLong(hListView,GWL_STYLE,LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - return 0; - - case IDM_SMALLICONS: - SetWindowLong(hListView,GWL_STYLE,LVS_SMALLICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - return 0; - - case IDM_LIST: - SetWindowLong(hListView,GWL_STYLE,LVS_LIST | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - return 0; - - case IDM_DETAILS: - SetWindowLong(hListView,GWL_STYLE,LVS_REPORT | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - return 0; - - case IDM_CLOSE: - DestroyWindow(hWnd); - return 0; - - case IDM_ABOUT: - { - TCHAR Title[256]; - - LoadString(hInst, IDS_ABOUT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - LoadString(hInst, IDS_ABOUT_TITLE, Title, sizeof(Title) / sizeof(TCHAR)); - - MessageBox(hWnd, (LPCTSTR)szBuf, (LPCTSTR)Title, MB_OK | MB_ICONINFORMATION); - - return 0; - } - } - } - - return DefWindowProc(hWnd, uMsg, wParam, lParam); -} - - -static INT -RunControlPanelWindow(int nCmdShow) -{ - MSG msg; - HWND hMainWnd; - INITCOMMONCONTROLSEX icex; - WNDCLASSEX wcex = {0}; - TCHAR szBuf[256]; - - wcex.cbSize = sizeof(wcex); - wcex.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAINICON)); - wcex.lpszClassName = MYWNDCLASS; - wcex.lpfnWndProc = MyWindowProc; - RegisterClassEx(&wcex); - - icex.dwSize = sizeof(icex); - icex.dwICC = ICC_LISTVIEW_CLASSES; - InitCommonControlsEx(&icex); - - LoadString(hInst, IDS_WINDOW_TITLE, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - - hMainWnd = CreateWindowEx(WS_EX_CLIENTEDGE, - MYWNDCLASS, - (LPCTSTR)szBuf, - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - LoadMenu(hInst, MAKEINTRESOURCE(IDM_MAINMENU)), - hInst, - 0); - if (!hMainWnd) - return 1; - - ShowWindow(hMainWnd, nCmdShow); - - while (GetMessage(&msg, 0, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return 0; -} - int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { @@ -339,7 +47,7 @@ /* Show the control panel window if no argument or "panel" was passed */ if(lpCmdLine[0] == 0 || !_tcsicmp(lpCmdLine, _T("panel"))) - return RunControlPanelWindow(nCmdShow); + return OpenShellFolder(_T("")); /* Check one of the built-in control panel handlers */ if (!_tcsicmp(lpCmdLine, _T("admintools"))) return OpenShellFolder(_T("\\::{D20EA4E1-3957-11d2-A40B-0C5020524153}")); Modified: trunk/reactos/base/applications/control/control.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.h [iso-8859-1] Tue May 13 16:39:25 2008 @@ -7,14 +7,8 @@ */ #include <windows.h> -#include <commctrl.h> -#include <cpl.h> #include <tchar.h> - #include "resource.h" - -#define MYWNDCLASS _T("CTLPANELCLASS") -typedef LONG (CALLBACK *CPLAPPLETFUNC)(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2); #define CCH_UINT_MAX 11 #define MAX_VALUE_NAME 16383 Modified: trunk/reactos/base/applications/control/control.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] Tue May 13 16:39:25 2008 @@ -2,13 +2,9 @@ <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <module name="control" type="win32gui" baseaddress="${BASEADDRESS_CONTROL}" installbase="system32" installname="control.exe" unicode="yes"> <include base="control">.</include> - <define name="_WIN32_IE">0x600</define> - <define name="_WIN32_WINNT">0x501</define> <library>advapi32</library> - <library>comctl32</library> <library>kernel32</library> <library>shell32</library> - <library>user32</library> <file>control.c</file> <file>control.rc</file> </module> Modified: trunk/reactos/base/applications/control/control.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.rc [iso-8859-1] Tue May 13 16:39:25 2008 @@ -1,23 +1,8 @@ -//Microsoft Developer Studio generated resource script. -// #include "resource.h" -#include <windows.h> #define REACTOS_STR_FILE_DESCRIPTION "ReactOS System Control Panel\0" #define REACTOS_STR_INTERNAL_NAME "control\0" #define REACTOS_STR_ORIGINAL_FILENAME "control.exe\0" #include <reactos/version.rc> - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. IDI_MAINICON ICON DISCARDABLE "resources/config.ico" -///////////////////////////////////////////////////////////////////////////// - - -#include "rsrc.rc" Modified: trunk/reactos/base/applications/control/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/resource.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/resource.h [iso-8859-1] Tue May 13 16:39:25 2008 @@ -1,31 +1,1 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by control.rc -// #define IDI_MAINICON 100 -#define IDM_MAINMENU 101 -#define IDM_LARGEICONS 40000 -#define IDM_SMALLICONS 40001 -#define IDM_LIST 40002 -#define IDM_DETAILS 40003 -#define IDM_ABOUT 40004 -#define IDM_CLOSE 40005 - -/* Strings */ -#define IDS_WINDOW_TITLE 5000 -#define IDS_ABOUT 5001 -#define IDS_ABOUT_TITLE 5002 -#define IDS_NO_ITEMS 5003 -#define IDS_NAME 5004 -#define IDS_COMMENT 5005 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40006 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif Removed: trunk/reactos/base/applications/control/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/rsrc.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/rsrc.rc (removed) @@ -1,36 +1,0 @@ - - -#include <windows.h> -#include "resource.h" - -/* define language neutral resources */ - -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL - -/* include localised resources */ -#include "lang/bg-BG.rc" -#include "lang/ca-ES.rc" -#include "lang/cs-CZ.rc" -#include "lang/da-DK.rc" -#include "lang/de-DE.rc" -#include "lang/el-GR.rc" -#include "lang/en-US.rc" -#include "lang/es-ES.rc" -#include "lang/fi-FI.rc" -#include "lang/fr-FR.rc" -#include "lang/hu-HU.rc" -#include "lang/id-ID.rc" -#include "lang/it-IT.rc" -#include "lang/ja-JP.rc" -#include "lang/ko-KO.rc" -#include "lang/lt-LT.rc" -#include "lang/nb-NO.rc" -#include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" -#include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" -#include "lang/th-TH.rc" -#include "lang/uk-UA.rc" -#include "lang/zh-CN.rc"
16 years, 8 months
1
0
0
0
[cfinck] 33507: Completely revamped "control.exe": - Now uses shell32 functions for loading the control panel applets, so that the mutex is used as well (see bug #781) - Supports all built-in command-line parameters, which are supported by the WinXP version. This also added support for opening shell folders. - Loads other possible parameters from the registry. - Only passes the command for RunControlPanel to each ListView item, not a whole struct whose members aren't needed later. - Fixed memory
by cfinck@svn.reactos.org
Author: cfinck Date: Tue May 13 16:30:55 2008 New Revision: 33507 URL:
http://svn.reactos.org/svn/reactos?rev=33507&view=rev
Log: Completely revamped "control.exe": - Now uses shell32 functions for loading the control panel applets, so that the mutex is used as well (see bug #781) - Supports all built-in command-line parameters, which are supported by the WinXP version. This also added support for opening shell folders. - Loads other possible parameters from the registry. - Only passes the command for RunControlPanel to each ListView item, not a whole struct whose members aren't needed later. - Fixed memory leaks - Added a header file - Fixed indentation This is the last version of the standalone Control Panel. I will change it to call the Explorer shell folder in my next commit. See issue #781 for more details. Added: trunk/reactos/base/applications/control/control.h (with props) Modified: trunk/reactos/base/applications/control/control.c (contents, props changed) trunk/reactos/base/applications/control/control.rbuild Modified: trunk/reactos/base/applications/control/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.c [iso-8859-1] Tue May 13 16:30:55 2008 @@ -1,458 +1,418 @@ /* - * ReactOS - * Copyright (C) 2004 ReactOS Team - * Copyright (C) 2004 GkWare e.K. - * - * 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. + * PROJECT: ReactOS System Control Panel + * FILE: base/applications/control/control.c + * PURPOSE: ReactOS System Control Panel + * PROGRAMMERS: Gero Kuehn (reactos.filter(a)gkware.com) + * Colin Finck (mail(a)colinfinck.de) */ -/* $Id$ - * - * PROJECT: ReactOS System Control Panel - * FILE: lib/cpl/system/control.c - * PURPOSE: ReactOS System Control Panel - * PROGRAMMER: Gero Kuehn (reactos.filter(a)gkware.com) - * UPDATE HISTORY: - * 06-13-2004 Created - */ -#include <windows.h> -#include <commctrl.h> -#include <cpl.h> - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <tchar.h> - -#include "resource.h" - -//#define CONTROL_DEBUG_ENABLE - -#ifdef CONTROL_DEBUG_ENABLE -#define CTL_DEBUG(x) dbgprint x -#else -#define CTL_DEBUG(x) -#endif - -#define MYWNDCLASS _T("CTLPANELCLASS") - -typedef LONG (CALLBACK *CPLAPPLETFUNC)(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2); - -typedef struct CPLLISTENTRY -{ - TCHAR pszPath[MAX_PATH]; - HMODULE hDll; - CPLAPPLETFUNC pFunc; - CPLINFO CplInfo; - int nIndex; -} CPLLISTENTRY, *PCPLLISTENTRY; - - -HWND hListView; + +#include "control.h" + +static const TCHAR szWindowClass[] = _T("DummyControlClass"); + +HANDLE hProcessHeap; HINSTANCE hInst; -HWND hMainWnd; -DEVMODE pDevMode; - -VOID dbgprint(TCHAR *format,...) -{ - TCHAR buf[1000]; - va_list va; - - va_start(va,format); - _vstprintf(buf,format,va); - OutputDebugString(buf); - va_end(va); -} - -VOID PopulateCPLList(HWND hLisCtrl) -{ - WIN32_FIND_DATA fd; - HANDLE hFind; - TCHAR pszSearchPath[MAX_PATH]; - HIMAGELIST hImgListSmall; - HIMAGELIST hImgListLarge; - int ColorDepth; - HMODULE hDll; - CPLAPPLETFUNC pFunc; - TCHAR pszPath[MAX_PATH]; - - /* Icon drawing mode */ - pDevMode.dmSize = sizeof(DEVMODE); - pDevMode.dmDriverExtra = 0; - - EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&pDevMode); - switch (pDevMode.dmBitsPerPel) - { - case 32: ColorDepth = ILC_COLOR32; break; - case 24: ColorDepth = ILC_COLOR24; break; - case 16: ColorDepth = ILC_COLOR16; break; - case 8: ColorDepth = ILC_COLOR8; break; - case 4: ColorDepth = ILC_COLOR4; break; - default: ColorDepth = ILC_COLOR; break; - } - - hImgListSmall = ImageList_Create(16,16,ColorDepth | ILC_MASK,5,5); - hImgListLarge = ImageList_Create(32,32,ColorDepth | ILC_MASK,5,5); - - GetSystemDirectory(pszSearchPath,MAX_PATH); - _tcscat(pszSearchPath,_T("\\*.cpl")); - - hFind = FindFirstFile(pszSearchPath,&fd); - while (hFind != INVALID_HANDLE_VALUE) - { - PCPLLISTENTRY pEntry; - CTL_DEBUG((_T("Found %s\r\n"), fd.cFileName)); - - _tcscpy(pszPath, pszSearchPath); - *_tcsrchr(pszPath, '\\')=0; - _tcscat(pszPath, _T("\\")); - _tcscat(pszPath, fd.cFileName); - - hDll = LoadLibrary(pszPath); - CTL_DEBUG((_T("Handle %08X\r\n"), hDll)); - - pFunc = (CPLAPPLETFUNC)GetProcAddress(hDll, "CPlApplet"); - CTL_DEBUG((_T("CPLFunc %08X\r\n"), pFunc)); - - if (pFunc && pFunc(hLisCtrl, CPL_INIT, 0, 0)) - { - UINT i, uPanelCount; - - uPanelCount = (UINT)pFunc(hLisCtrl, CPL_GETCOUNT, 0, 0); - for (i = 0; i < uPanelCount; i++) - { - HICON hIcon; - TCHAR Name[MAX_PATH]; - int index; - - pEntry = (PCPLLISTENTRY)malloc(sizeof(CPLLISTENTRY)); - if (pEntry == NULL) - return; - - memset(pEntry, 0, sizeof(CPLLISTENTRY)); - pEntry->hDll = hDll; - pEntry->pFunc = pFunc; - _tcscpy(pEntry->pszPath, pszPath); - - pEntry->pFunc(hLisCtrl, CPL_INQUIRE, (LPARAM)i, (LPARAM)&pEntry->CplInfo); - hIcon = LoadImage(pEntry->hDll,MAKEINTRESOURCE(pEntry->CplInfo.idIcon),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); - index = ImageList_AddIcon(hImgListSmall,hIcon); - DestroyIcon(hIcon); - hIcon = LoadImage(pEntry->hDll,MAKEINTRESOURCE(pEntry->CplInfo.idIcon),IMAGE_ICON,32,32,LR_DEFAULTCOLOR); - ImageList_AddIcon(hImgListLarge,hIcon); - DestroyIcon(hIcon); - - if (LoadString(pEntry->hDll, pEntry->CplInfo.idName, Name, MAX_PATH)) - { - LV_ITEM lvi; - - memset(&lvi,0x00,sizeof(lvi)); - lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; - lvi.pszText = Name; - lvi.state = 0; - lvi.iImage = index; - lvi.lParam = (LPARAM)pEntry; - pEntry->nIndex = ListView_InsertItem(hLisCtrl,&lvi); - - if (LoadString(pEntry->hDll, pEntry->CplInfo.idInfo, Name, MAX_PATH)) - ListView_SetItemText(hLisCtrl, pEntry->nIndex, 1, Name); - } - } - } - - if (!FindNextFile(hFind,&fd)) - hFind = INVALID_HANDLE_VALUE; - } - - (void)ListView_SetImageList(hLisCtrl,hImgListSmall,LVSIL_SMALL); - (void)ListView_SetImageList(hLisCtrl,hImgListLarge,LVSIL_NORMAL); -} - -LRESULT CALLBACK MyWindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) -{ - TCHAR szBuf[1024]; - - switch (uMsg) - { - case WM_CREATE: - { - RECT rect; - LV_COLUMN column; - - GetClientRect(hWnd,&rect); - hListView = CreateWindow(WC_LISTVIEW,_T(""),LVS_REPORT | LVS_ALIGNLEFT | LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD | WS_TABSTOP,0,0,rect.right ,rect.bottom,hWnd,NULL,hInst,0); - CTL_DEBUG((_T("Listview Window %08X\r\n"),hListView)); - - memset(&column,0x00,sizeof(column)); - column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; - column.fmt = LVCFMT_LEFT; - column.cx = (rect.right - rect.left) / 3; - column.iSubItem = 0; - LoadString(hInst, IDS_NAME, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - column.pszText = szBuf; - (void)ListView_InsertColumn(hListView,0,&column); - column.cx = (rect.right - rect.left) - ((rect.right - rect.left) / 3) - 1; - column.iSubItem = 1; - LoadString(hInst, IDS_COMMENT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - column.pszText = szBuf; - (void)ListView_InsertColumn(hListView,1,&column); - PopulateCPLList(hListView); - (void)ListView_SetColumnWidth(hListView,2,LVSCW_AUTOSIZE_USEHEADER); - (void)ListView_Update(hListView,0); - - SetFocus(hListView); - } - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - case WM_SIZE: - { - RECT rect; - - GetClientRect(hWnd,&rect); - MoveWindow(hListView,0,0,rect.right,rect.bottom,TRUE); - } - break; - - case WM_NOTIFY: - { - NMHDR *phdr; - phdr = (NMHDR*)lParam; - switch(phdr->code) - { - case NM_RETURN: - case NM_DBLCLK: - { - int nSelect; - LV_ITEM lvi; - PCPLLISTENTRY pEntry; - - nSelect=SendMessage(hListView,LVM_GETNEXTITEM,(WPARAM)-1,LVNI_FOCUSED); - - if (nSelect==-1) - { - /* no items */ - LoadString(hInst, IDS_NO_ITEMS, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - MessageBox(hWnd,(LPCTSTR)szBuf,NULL,MB_OK|MB_ICONINFORMATION); - break; - } - - CTL_DEBUG((_T("Select %d\r\n"),nSelect)); - memset(&lvi,0x00,sizeof(lvi)); - lvi.iItem = nSelect; - lvi.mask = LVIF_PARAM; - (void)ListView_GetItem(hListView,&lvi); - pEntry = (PCPLLISTENTRY)lvi.lParam; - CTL_DEBUG((_T("Listview DblClk Entry %08X\r\n"),pEntry)); - if (pEntry) - { - CTL_DEBUG((_T("Listview DblClk Entry Func %08X\r\n"),pEntry->pFunc)); - } - - if (pEntry && pEntry->pFunc) - pEntry->pFunc(hListView,CPL_DBLCLK,pEntry->CplInfo.lData,0); - } - } - } - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDM_LARGEICONS: - SetWindowLong(hListView,GWL_STYLE,LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - break; - case IDM_SMALLICONS: - SetWindowLong(hListView,GWL_STYLE,LVS_SMALLICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - break; - case IDM_LIST: - SetWindowLong(hListView,GWL_STYLE,LVS_LIST | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - break; - case IDM_DETAILS: - SetWindowLong(hListView,GWL_STYLE,LVS_REPORT | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); - break; - case IDM_CLOSE: - DestroyWindow(hWnd); - break; - case IDM_ABOUT: - { - TCHAR Title[256]; - - LoadString(hInst, IDS_ABOUT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - LoadString(hInst, IDS_ABOUT_TITLE, Title, sizeof(Title) / sizeof(TCHAR)); - - MessageBox(hWnd,(LPCTSTR)szBuf,(LPCTSTR)Title,MB_OK | MB_ICONINFORMATION); - } - break; - } - break; - - default: - return DefWindowProc(hWnd,uMsg,wParam,lParam); - } - - return 0; + +static INT +OpenShellFolder(LPTSTR lpFolderCLSID) +{ + TCHAR szParameters[MAX_PATH]; + + /* Open a shell folder using "explorer.exe". + The passed CLSID's are all subfolders of the "Control Panel" shell folder. */ + _tcscpy(szParameters, _T("/n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}")); + _tcscat(szParameters, lpFolderCLSID); + + return (int)ShellExecute(NULL, _T("open"), _T("explorer.exe"), szParameters, NULL, SW_SHOWDEFAULT) > 32; +} + +static INT +RunControlPanel(LPTSTR lpCmd) +{ + TCHAR szParameters[MAX_PATH]; + + _tcscpy(szParameters, _T("shell32.dll,Control_RunDLL ")); + _tcscat(szParameters, lpCmd); + + return RUNDLL(szParameters); +} + +static VOID +PopulateCPLList(HWND hLisCtrl) +{ + WIN32_FIND_DATA fd; + HANDLE hFind; + TCHAR pszSearchPath[MAX_PATH]; + HIMAGELIST hImgListSmall; + HIMAGELIST hImgListLarge; + HMODULE hDll; + CPLAPPLETFUNC pFunc; + TCHAR pszPath[MAX_PATH]; + TCHAR szPanelNum[CCH_UINT_MAX + 1]; + DEVMODE pDevMode; + + /* Icon drawing mode */ + pDevMode.dmSize = sizeof(DEVMODE); + pDevMode.dmDriverExtra = 0; + + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode); + hImgListSmall = ImageList_Create(16, 16, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5); + hImgListLarge = ImageList_Create(32, 32, pDevMode.dmBitsPerPel | ILC_MASK, 5, 5); + + GetSystemDirectory(pszSearchPath, MAX_PATH); + _tcscat(pszSearchPath, _T("\\*.cpl")); + + hFind = FindFirstFile(pszSearchPath, &fd); + + while (hFind != INVALID_HANDLE_VALUE) + { + _tcscpy(pszPath, pszSearchPath); + *_tcsrchr(pszPath, '\\') = 0; + _tcscat(pszPath, _T("\\")); + _tcscat(pszPath, fd.cFileName); + + hDll = LoadLibrary(pszPath); + pFunc = (CPLAPPLETFUNC)GetProcAddress(hDll, "CPlApplet"); + + if (pFunc && pFunc(hLisCtrl, CPL_INIT, 0, 0)) + { + UINT i, uPanelCount; + + uPanelCount = (UINT)pFunc(hLisCtrl, CPL_GETCOUNT, 0, 0); + + for (i = 0; i < uPanelCount; i++) + { + CPLINFO CplInfo; + HICON hIcon; + TCHAR Name[MAX_PATH]; + int index; + LPTSTR pszCmd; + + pszCmd = (LPTSTR) HeapAlloc(hProcessHeap, 0, MAX_PATH * sizeof(TCHAR)); + if(!pszCmd) + return; + + /* Build the command, which is later passed to RunControlPanel */ + _tcscpy(pszCmd, fd.cFileName); + _tcscat(pszCmd, _T(" @")); + _itot(i, szPanelNum, 10); + _tcscat(pszCmd, szPanelNum); + + pFunc(hLisCtrl, CPL_INQUIRE, (LPARAM)i, (LPARAM)&CplInfo); + + hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); + index = ImageList_AddIcon(hImgListSmall, hIcon); + DestroyIcon(hIcon); + + hIcon = LoadImage(hDll, MAKEINTRESOURCE(CplInfo.idIcon), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); + ImageList_AddIcon(hImgListLarge, hIcon); + DestroyIcon(hIcon); + + if (LoadString(hDll, CplInfo.idName, Name, MAX_PATH)) + { + INT nIndex; + LV_ITEM lvi = {0}; + + lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = Name; + lvi.state = 0; + lvi.iImage = index; + lvi.lParam = (LPARAM)pszCmd; + nIndex = ListView_InsertItem(hLisCtrl, &lvi); + + if (LoadString(hDll, CplInfo.idInfo, Name, MAX_PATH)) + ListView_SetItemText(hLisCtrl, nIndex, 1, Name); + } + } + } + + if (!FindNextFile(hFind, &fd)) + hFind = INVALID_HANDLE_VALUE; + } + + (void)ListView_SetImageList(hLisCtrl, hImgListSmall, LVSIL_SMALL); + (void)ListView_SetImageList(hLisCtrl, hImgListLarge, LVSIL_NORMAL); +} + +LRESULT CALLBACK +MyWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + static HWND hListView; + TCHAR szBuf[1024]; + + switch (uMsg) + { + case WM_CREATE: + { + RECT rect; + LV_COLUMN column = {0}; + + GetClientRect(hWnd, &rect); + hListView = CreateWindow(WC_LISTVIEW, NULL, LVS_REPORT | LVS_ALIGNLEFT | LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, rect.right, rect.bottom, hWnd, NULL, hInst, 0); + + column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT; + column.fmt = LVCFMT_LEFT; + column.cx = (rect.right - rect.left) / 3; + column.iSubItem = 0; + LoadString(hInst, IDS_NAME, szBuf, sizeof(szBuf) / sizeof(TCHAR)); + column.pszText = szBuf; + (void)ListView_InsertColumn(hListView, 0, &column); + + column.cx = (rect.right - rect.left) - ((rect.right - rect.left) / 3) - 1; + column.iSubItem = 1; + LoadString(hInst, IDS_COMMENT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); + column.pszText = szBuf; + (void)ListView_InsertColumn(hListView, 1, &column); + + PopulateCPLList(hListView); + + (void)ListView_SetColumnWidth(hListView, 2, LVSCW_AUTOSIZE_USEHEADER); + (void)ListView_Update(hListView, 0); + + SetFocus(hListView); + + return 0; + } + + case WM_DESTROY: + { + LV_ITEM lvi; + INT nItems; + + lvi.mask = LVIF_PARAM; + + /* Free the memory used for the command strings */ + for(nItems = ListView_GetItemCount(hListView); --nItems >= 0;) + { + lvi.iItem = nItems; + (void)ListView_GetItem(hListView, &lvi); + HeapFree(hProcessHeap, 0, (LPVOID)lvi.lParam); + } + + PostQuitMessage(0); + return 0; + } + + case WM_SIZE: + { + RECT rect; + + GetClientRect(hWnd, &rect); + MoveWindow(hListView, 0, 0, rect.right, rect.bottom, TRUE); + + return 0; + } + + case WM_NOTIFY: + { + NMHDR *phdr; + phdr = (NMHDR*)lParam; + + switch(phdr->code) + { + case NM_RETURN: + case NM_DBLCLK: + { + int nSelect; + LV_ITEM lvi = {0}; + LPTSTR pszCmd; + + nSelect = SendMessage(hListView, LVM_GETNEXTITEM, (WPARAM)-1, LVNI_FOCUSED); + + if (nSelect == -1) + { + /* no items */ + LoadString(hInst, IDS_NO_ITEMS, szBuf, sizeof(szBuf) / sizeof(TCHAR)); + MessageBox(hWnd, (LPCTSTR)szBuf, NULL, MB_OK | MB_ICONINFORMATION); + break; + } + + lvi.iItem = nSelect; + lvi.mask = LVIF_PARAM; + (void)ListView_GetItem(hListView, &lvi); + + pszCmd = (LPTSTR)lvi.lParam; + + if (pszCmd) + RunControlPanel(pszCmd); + + return 0; + } + } + } + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDM_LARGEICONS: + SetWindowLong(hListView,GWL_STYLE,LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); + return 0; + + case IDM_SMALLICONS: + SetWindowLong(hListView,GWL_STYLE,LVS_SMALLICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); + return 0; + + case IDM_LIST: + SetWindowLong(hListView,GWL_STYLE,LVS_LIST | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); + return 0; + + case IDM_DETAILS: + SetWindowLong(hListView,GWL_STYLE,LVS_REPORT | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | WS_VISIBLE | WS_CHILD|WS_BORDER|WS_TABSTOP); + return 0; + + case IDM_CLOSE: + DestroyWindow(hWnd); + return 0; + + case IDM_ABOUT: + { + TCHAR Title[256]; + + LoadString(hInst, IDS_ABOUT, szBuf, sizeof(szBuf) / sizeof(TCHAR)); + LoadString(hInst, IDS_ABOUT_TITLE, Title, sizeof(Title) / sizeof(TCHAR)); + + MessageBox(hWnd, (LPCTSTR)szBuf, (LPCTSTR)Title, MB_OK | MB_ICONINFORMATION); + + return 0; + } + } + } + + return DefWindowProc(hWnd, uMsg, wParam, lParam); } static INT RunControlPanelWindow(int nCmdShow) { - MSG msg; - WNDCLASS wc; - TCHAR szBuf[256]; - - memset(&wc,0x00,sizeof(wc)); - wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAINICON)); - wc.lpszClassName = MYWNDCLASS; - wc.lpszMenuName = _T("MAINMENU"); - wc.lpfnWndProc = MyWindowProc; - RegisterClass(&wc); - - InitCommonControls(); - - LoadString(hInst, IDS_WINDOW_TITLE, szBuf, sizeof(szBuf) / sizeof(TCHAR)); - hMainWnd = CreateWindowEx(WS_EX_CLIENTEDGE, - MYWNDCLASS, - (LPCTSTR)szBuf, - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - LoadMenu(hInst, MAKEINTRESOURCE(IDM_MAINMENU)), - hInst, - 0); - if (!hMainWnd) + MSG msg; + HWND hMainWnd; + INITCOMMONCONTROLSEX icex; + WNDCLASSEX wcex = {0}; + TCHAR szBuf[256]; + + wcex.cbSize = sizeof(wcex); + wcex.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAINICON)); + wcex.lpszClassName = MYWNDCLASS; + wcex.lpfnWndProc = MyWindowProc; + RegisterClassEx(&wcex); + + icex.dwSize = sizeof(icex); + icex.dwICC = ICC_LISTVIEW_CLASSES; + InitCommonControlsEx(&icex); + + LoadString(hInst, IDS_WINDOW_TITLE, szBuf, sizeof(szBuf) / sizeof(TCHAR)); + + hMainWnd = CreateWindowEx(WS_EX_CLIENTEDGE, + MYWNDCLASS, + (LPCTSTR)szBuf, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + LoadMenu(hInst, MAKEINTRESOURCE(IDM_MAINMENU)), + hInst, + 0); + if (!hMainWnd) + return 1; + + ShowWindow(hMainWnd, nCmdShow); + + while (GetMessage(&msg, 0, 0, 0)) { - CTL_DEBUG((_T("Unable to create window\r\n"))); - return -1; + TranslateMessage(&msg); + DispatchMessage(&msg); } - ShowWindow(hMainWnd, nCmdShow); - while (GetMessage(&msg, 0, 0, 0)) + return 0; +} + +int WINAPI +_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + HKEY hKey; + + hInst = hInstance; + hProcessHeap = GetProcessHeap(); + + /* Show the control panel window if no argument or "panel" was passed */ + if(lpCmdLine[0] == 0 || !_tcsicmp(lpCmdLine, _T("panel"))) + return RunControlPanelWindow(nCmdShow); + + /* Check one of the built-in control panel handlers */ + if (!_tcsicmp(lpCmdLine, _T("admintools"))) return OpenShellFolder(_T("\\::{D20EA4E1-3957-11d2-A40B-0C5020524153}")); + else if (!_tcsicmp(lpCmdLine, _T("color"))) return RunControlPanel(_T("desk.cpl")); /* TODO: Switch to the "Apperance" tab */ + else if (!_tcsicmp(lpCmdLine, _T("date/time"))) return RunControlPanel(_T("timedate.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("desktop"))) return RunControlPanel(_T("desk.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("folders"))) return RUNDLL(_T("shell32.dll,Options_RunDLL")); + else if (!_tcsicmp(lpCmdLine, _T("fonts"))) return OpenShellFolder(_T("\\::{D20EA4E1-3957-11d2-A40B-0C5020524152}")); + else if (!_tcsicmp(lpCmdLine, _T("infrared"))) return RunControlPanel(_T("irprops.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("international"))) return RunControlPanel(_T("intl.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("keyboard"))) return RunControlPanel(_T("main.cpl @1")); + else if (!_tcsicmp(lpCmdLine, _T("mouse"))) return RunControlPanel(_T("main.cpl @0")); + else if (!_tcsicmp(lpCmdLine, _T("netconnections"))) return OpenShellFolder(_T("\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")); + else if (!_tcsicmp(lpCmdLine, _T("netware"))) return RunControlPanel(_T("nwc.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("ports"))) return RunControlPanel(_T("sysdm.cpl")); /* TODO: Switch to the "Computer Name" tab */ + else if (!_tcsicmp(lpCmdLine, _T("printers"))) return OpenShellFolder(_T("\\::{2227A280-3AEA-1069-A2DE-08002B30309D}")); + else if (!_tcsicmp(lpCmdLine, _T("scannercamera"))) return OpenShellFolder(_T("\\::{E211B736-43FD-11D1-9EFB-0000F8757FCD}")); + else if (!_tcsicmp(lpCmdLine, _T("schedtasks"))) return OpenShellFolder(_T("\\::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}")); + else if (!_tcsicmp(lpCmdLine, _T("telephony"))) return RunControlPanel(_T("telephon.cpl")); + else if (!_tcsicmp(lpCmdLine, _T("userpasswords"))) return RunControlPanel(_T("nusrmgr.cpl")); /* Graphical User Account Manager */ + else if (!_tcsicmp(lpCmdLine, _T("userpasswords2"))) return RUNDLL(_T("netplwiz.dll,UsersRunDll")); /* Dialog based advanced User Account Manager */ + + /* It is none of them, so look for a handler in the registry */ + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { - TranslateMessage(&msg); - DispatchMessage(&msg); + DWORD dwIndex; + + for(dwIndex = 0; ; ++dwIndex) + { + DWORD dwDataSize; + DWORD dwValueSize = MAX_VALUE_NAME; + TCHAR szValueName[MAX_VALUE_NAME]; + + /* Get the value name and data size */ + if(RegEnumValue(hKey, dwIndex, szValueName, &dwValueSize, 0, NULL, NULL, &dwDataSize) != ERROR_SUCCESS) + break; + + /* Check if the parameter is the value name */ + if(!_tcsicmp(lpCmdLine, szValueName)) + { + LPTSTR pszData; + + /* Allocate memory for the data plus two more characters, so we can quote the file name if required */ + pszData = (LPTSTR) HeapAlloc(hProcessHeap, 0, dwDataSize + 2 * sizeof(TCHAR)); + ++pszData; + + /* This value is the one we are looking for, so get the data. It is the path to a .cpl file */ + if(RegQueryValueEx(hKey, szValueName, 0, NULL, (LPBYTE)pszData, &dwDataSize) == ERROR_SUCCESS) + { + INT nReturnValue; + + /* Quote the file name if required */ + if(*pszData != '\"') + { + *(--pszData) = '\"'; + pszData[dwDataSize / sizeof(TCHAR)] = '\"'; + pszData[(dwDataSize / sizeof(TCHAR)) + 1] = 0; + } + + nReturnValue = RunControlPanel(pszData); + HeapFree(hProcessHeap, 0, pszData); + RegCloseKey(hKey); + + return nReturnValue; + } + + HeapFree(hProcessHeap, 0, pszData); + } + } + + RegCloseKey(hKey); } - return 0; -} - - -static INT -RunControlPanel(LPCTSTR lpName, UINT uIndex) -{ - CPLINFO CplInfo; - HMODULE hDll; - CPLAPPLETFUNC pFunc; - UINT uPanelCount; - - hDll = LoadLibrary(lpName); - if (hDll == 0) - { - return -1; - } - CTL_DEBUG((_T("Handle %08X\r\n"), hDll)); - - pFunc = (CPLAPPLETFUNC)GetProcAddress(hDll, "CPlApplet"); - if (pFunc == NULL) - { - FreeLibrary(hDll); - return -1; - } - CTL_DEBUG((_T("CPLFunc %08X\r\n"), pFunc)); - - if (!pFunc(NULL, CPL_INIT, 0, 0)) - { - FreeLibrary(hDll); - return -1; - } - - uPanelCount = (UINT)pFunc(NULL, CPL_GETCOUNT, 0, 0); - if (uIndex >= uPanelCount) - { - FreeLibrary(hDll); - return -1; - } - - pFunc(NULL, CPL_INQUIRE, (LPARAM)uIndex, (LPARAM)&CplInfo); - - pFunc(NULL, CPL_DBLCLK, CplInfo.lData, 0); - - FreeLibrary(hDll); - - return 0; -} - -int -_tmain(int argc, const TCHAR *argv[]) -{ - STARTUPINFO si; - TCHAR * szExt; - - si.cb = sizeof(si); - GetStartupInfo(&si); - - hInst = GetModuleHandle(NULL); - - if (argc <= 1) - { - /* No argument on the command line */ - return RunControlPanelWindow(si.wShowWindow); - } - - if (_tcsicmp(argv[1], _T("desktop")) == 0) - { - return RunControlPanel(_T("desk.cpl"), 0); - } - else if (_tcsicmp(argv[1], _T("date/time")) == 0) - { - return RunControlPanel(_T("timedate.cpl"), 0); - } - else if (_tcsicmp(argv[1], _T("international")) == 0) - { - return RunControlPanel(_T("intl.cpl"), 0); - } - else if (_tcsicmp(argv[1], _T("mouse")) == 0) - { - return RunControlPanel(_T("main.cpl"), 0); - } - else if (_tcsicmp(argv[1], _T("keyboard")) == 0) - { - return RunControlPanel(_T("main.cpl"), 1); - } - else if ((szExt = _tcsstr(argv[1], _T(".cpl")))) - { - TCHAR * szSep; - TCHAR szCPL[MAX_PATH]; - UINT selPage = 0; - - _tcscpy(szCPL, argv[1]); - szSep = _tcsstr(szCPL, _T(".cpl,")); - - if (szSep) - { - /* FIXME for now ignore page index */ - szSep[4] = _T('\0'); - } - return RunControlPanel(szCPL, selPage); - } - - return 0; -} + /* It's none of the known parameters, so interpret the parameter as the file name of a control panel applet */ + return RunControlPanel(lpCmdLine); +} Propchange: trunk/reactos/base/applications/control/control.c ------------------------------------------------------------------------------ --- svn:keywords (original) +++ svn:keywords (removed) @@ -1,1 +1,0 @@ -author date id revision Added: trunk/reactos/base/applications/control/control.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.h (added) +++ trunk/reactos/base/applications/control/control.h [iso-8859-1] Tue May 13 16:30:55 2008 @@ -1,0 +1,24 @@ +/* + * PROJECT: ReactOS System Control Panel + * FILE: base/applications/control/control.h + * PURPOSE: ReactOS System Control Panel + * PROGRAMMERS: Gero Kuehn (reactos.filter(a)gkware.com) + * Colin Finck (mail(a)colinfinck.de) + */ + +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include <tchar.h> + +#include "resource.h" + +#define MYWNDCLASS _T("CTLPANELCLASS") +typedef LONG (CALLBACK *CPLAPPLETFUNC)(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2); + +#define CCH_UINT_MAX 11 +#define MAX_VALUE_NAME 16383 + +/* Macro for calling "rundll32.exe" + According to MSDN, ShellExecute returns a value greater than 32 if the operation was successful. */ +#define RUNDLL(param) ((int)ShellExecute(NULL, _T("open"), _T("rundll32.exe"), (param), NULL, SW_SHOWDEFAULT) > 32) Propchange: trunk/reactos/base/applications/control/control.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/base/applications/control/control.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
============================================================================== --- trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] (original) +++ trunk/reactos/base/applications/control/control.rbuild [iso-8859-1] Tue May 13 16:30:55 2008 @@ -4,9 +4,11 @@ <include base="control">.</include> <define name="_WIN32_IE">0x600</define> <define name="_WIN32_WINNT">0x501</define> + <library>advapi32</library> + <library>comctl32</library> <library>kernel32</library> + <library>shell32</library> <library>user32</library> - <library>comctl32</library> <file>control.c</file> <file>control.rc</file> </module>
16 years, 8 months
1
0
0
0
[martinf] 33506: display available command line options when started with "-?"
by martinf@svn.reactos.org
Author: martinf Date: Tue May 13 16:01:09 2008 New Revision: 33506 URL:
http://svn.reactos.org/svn/reactos?rev=33506&view=rev
Log: display available command line options when started with "-?" Modified: trunk/reactos/base/shell/explorer/explorer.cpp Modified: trunk/reactos/base/shell/explorer/explorer.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explor…
============================================================================== --- trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] Tue May 13 16:01:09 2008 @@ -633,12 +633,11 @@ IconCache::~IconCache() { - for (int index = s_next_id; index >= 0; index--) - { +/* We don't need to free cached resources - they are automatically freed at process termination + for (int index = s_next_id; index >= 0; index--) { IconMap::iterator found = _icons.find(index); - if (found != _icons.end()) - { + if (found != _icons.end()) { Icon& icon = found->second; if ((icon.get_icontype() == IT_DYNAMIC) || @@ -649,6 +648,7 @@ } } } +*/ } void IconCache::free_icon(int icon_id) @@ -726,7 +726,7 @@ XMLPos explorer_options = g_Globals.get_cfg("general/explorer"); XS_String mdiStr = XMLString(explorer_options, "mdi"); - // If there isn't yet the "mdi" setting in the configuration, display MDI/SDI dialog. + // If there isn't yet the "mdi" setting in the configuration, display the MDI/SDI dialog. if (mdiStr.empty()) Dialog::DoModal(IDD_MDI_SDI, WINDOW_CREATOR(MdiSdiDlg), g_Globals._hwndDesktop); @@ -1201,6 +1201,31 @@ #endif } + if (_tcsstr(ext_options,TEXT("-?"))) { + MessageBoxA(g_Globals._hwndDesktop, + "/e open cabinet window in explorer mode\r\n" + "/root open cabinet window in rooted mode\r\n" + "/mdi open cabinet window in MDI mode\r\n" + "/sdi open cabinet window in SDI mode\r\n" + "\r\n" + "-? display command line options\r\n" + "\r\n" + "-desktop start in desktop mode regardless of an already running shell\r\n" + "-nodesktop disable desktop mode\r\n" + "-explorer display cabinet window regardless of enabled desktop mode\r\n" + "\r\n" + "-install replace previous shell application with ROS Explorer\r\n" + "\r\n" + "-noautostart disable autostarts\r\n" + "-autostart enable autostarts regardless of debug build\r\n" + "\r\n" + "-console open debug console\r\n" + "\r\n" + "-debug activate GDB remote debugging stub\r\n" + "-break activate debugger breakpoint\r\n", + "ROS Explorer - command line options", MB_OK); + } + Thread* pSSOThread = NULL; if (startup_desktop) {
16 years, 8 months
1
0
0
0
[ekohl] 33505: - Implement the creation and removal of user accounts. - User name and passwords are NOT checked upon the creation of a new user account. - Disable all unimplemented popup menu items.
by ekohl@svn.reactos.org
Author: ekohl Date: Tue May 13 15:55:37 2008 New Revision: 33505 URL:
http://svn.reactos.org/svn/reactos?rev=33505&view=rev
Log: - Implement the creation and removal of user accounts. - User name and passwords are NOT checked upon the creation of a new user account. - Disable all unimplemented popup menu items. Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc trunk/reactos/dll/cpl/usrmgr/resource.h trunk/reactos/dll/cpl/usrmgr/users.c Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc [iso-8859-1] Tue May 13 15:55:37 2008 @@ -46,18 +46,41 @@ END - IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74 -STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT CAPTION "Change Password" FONT 8, "MS Shell Dlg" BEGIN - EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD RTEXT "New Password:", -1,7,10,96,8 - EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL | ES_PASSWORD RTEXT "Repeat Password:", -1,7,28,96,8 DEFPUSHBUTTON "OK",IDOK,156,53,50,14 PUSHBUTTON "Cancel",IDCANCEL,210,53,50,14 +END + + +IDD_USER_NEW DIALOGEX DISCARDABLE 0, 0, 267, 200 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "New User" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL + RTEXT "User name:", -1,7,10,96,8 + EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL + RTEXT "Full user name:", -1,7,28,96,8 + EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL + RTEXT "Description:", -1,7,46,96,8 + EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Password:", -1,7,70,96,8 + EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD + RTEXT "Repeat Password:", -1,7,88,96,8 + AUTOCHECKBOX "User must change the password upon first logon",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 + AUTOCHECKBOX "User cannot change the password",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED + AUTOCHECKBOX "Password never expires",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED + AUTOCHECKBOX "Account is disabled",IDC_USER_NEW_DISABLED,7,151,200,10 + DEFPUSHBUTTON "OK",IDOK,156,179,50,14,WS_DISABLED + PUSHBUTTON "Cancel",IDCANCEL,210,179,50,14 END @@ -67,16 +90,16 @@ BEGIN POPUP "" BEGIN - MENUITEM "New Group...", IDM_GROUP_NEW + MENUITEM "New Group...", IDM_GROUP_NEW, GRAYED END POPUP "" BEGIN - MENUITEM "Add Member", IDM_GROUP_ADD_MEMBER + MENUITEM "Add Member", IDM_GROUP_ADD_MEMBER, GRAYED MENUITEM SEPARATOR - MENUITEM "Delete", IDM_GROUP_DELETE - MENUITEM "Rename", IDM_GROUP_RENAME + MENUITEM "Delete", IDM_GROUP_DELETE, GRAYED + MENUITEM "Rename", IDM_GROUP_RENAME, GRAYED MENUITEM SEPARATOR - MENUITEM "Properties", IDM_GROUP_PROPERTIES + MENUITEM "Properties", IDM_GROUP_PROPERTIES, GRAYED END END @@ -94,7 +117,7 @@ MENUITEM "Delete", IDM_USER_DELETE MENUITEM "Rename", IDM_USER_RENAME MENUITEM SEPARATOR - MENUITEM "Properties", IDM_USER_PROPERTIES + MENUITEM "Properties", IDM_USER_PROPERTIES, GRAYED END END Modified: trunk/reactos/dll/cpl/usrmgr/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resource.h?…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/resource.h [iso-8859-1] Tue May 13 15:55:37 2008 @@ -51,6 +51,18 @@ #define IDC_EDIT_PASSWORD2 352 +#define IDD_USER_NEW 360 +#define IDC_USER_NEW_NAME 361 +#define IDC_USER_NEW_FULL_NAME 362 +#define IDC_USER_NEW_DESCRIPTION 363 +#define IDC_USER_NEW_PASSWORD1 364 +#define IDC_USER_NEW_PASSWORD2 365 +#define IDC_USER_NEW_FORCE_CHANGE 366 +#define IDC_USER_NEW_CANNOT_CHANGE 367 +#define IDC_USER_NEW_NEVER_EXPIRES 368 +#define IDC_USER_NEW_DISABLED 369 + + /* Strings */ #define IDS_CPLNAME 2000 Modified: trunk/reactos/dll/cpl/usrmgr/users.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/users.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/usrmgr/users.c [iso-8859-1] Tue May 13 15:55:37 2008 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS User Manager Control Panel * FILE: dll/cpl/usrmgr/users.c @@ -8,6 +7,16 @@ * PROGRAMMERS: Eric Kohl */ +/* + * TODO: + * - Add new user to the users group. + * - Check a new users name for illegal characters. + * - Check whether both passwords are the same for a new user. + * - Remove a user from all groups. + * - Implement user property pages. + * - Use localized messages. + */ + #include "usrmgr.h" @@ -22,15 +31,17 @@ static BOOL -SetPassword(HWND hwndDlg) +CheckPasswords(HWND hwndDlg, + INT nIdDlgItem1, + INT nIdDlgItem2) { TCHAR szPassword1[256]; TCHAR szPassword2[256]; UINT uLen1; UINT uLen2; - uLen1 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD1, szPassword1, 256); - uLen2 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD2, szPassword2, 256); + uLen1 = GetDlgItemText(hwndDlg, nIdDlgItem1, szPassword1, 256); + uLen2 = GetDlgItemText(hwndDlg, nIdDlgItem2, szPassword2, 256); /* Check the passwords */ if (uLen1 != uLen2 || _tcscmp(szPassword1, szPassword2) != 0) @@ -64,7 +75,7 @@ switch (LOWORD(wParam)) { case IDOK: - if (SetPassword(hwndDlg)) + if (CheckPasswords(hwndDlg, IDC_EDIT_PASSWORD1, IDC_EDIT_PASSWORD2)) EndDialog(hwndDlg, 0); break; @@ -81,6 +92,204 @@ return TRUE; } + +INT_PTR CALLBACK +NewUserDlgProc(HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + PUSER_INFO_3 userInfo; + INT nLength; + + UNREFERENCED_PARAMETER(wParam); + + switch (uMsg) + { + case WM_INITDIALOG: + SetWindowLongPtr(hwndDlg, DWLP_USER, lParam); + CheckDlgButton(hwndDlg, IDC_USER_NEW_FORCE_CHANGE, BST_CHECKED); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_USER_NEW_NAME: + if (HIWORD(wParam) == EN_CHANGE) + { + nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, WM_GETTEXTLENGTH, 0, 0); + EnableWindow(GetDlgItem(hwndDlg, IDOK), (nLength > 0)); + } + break; + + case IDOK: + userInfo = (LPUSER_INFO_3)GetWindowLongPtr(hwndDlg, DWLP_USER); + + nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_NAME, WM_GETTEXTLENGTH, 0, 0); + if (nLength > 0) + { + userInfo->usri3_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_NEW_NAME, userInfo->usri3_name, nLength + 1); + } + + nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_FULL_NAME, WM_GETTEXTLENGTH, 0, 0); + if (nLength > 0) + { + userInfo->usri3_full_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_NEW_FULL_NAME, userInfo->usri3_full_name, nLength + 1); + } + + nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_DESCRIPTION, WM_GETTEXTLENGTH, 0, 0); + if (nLength > 0) + { + userInfo->usri3_comment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_NEW_DESCRIPTION, userInfo->usri3_comment, nLength + 1); + } + + /* Store the password */ + nLength = SendDlgItemMessage(hwndDlg, IDC_USER_NEW_PASSWORD1, WM_GETTEXTLENGTH, 0, 0); + if (nLength > 0) + { + userInfo->usri3_password = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR)); + GetDlgItemText(hwndDlg, IDC_USER_NEW_PASSWORD1, userInfo->usri3_password, nLength + 1); + } + + if (IsDlgButtonChecked(hwndDlg, IDC_USER_NEW_FORCE_CHANGE) == BST_CHECKED) + userInfo->usri3_password_expired = TRUE; + + if (IsDlgButtonChecked(hwndDlg, IDC_USER_NEW_DISABLED) == BST_CHECKED) + userInfo->usri3_flags |= UF_ACCOUNTDISABLE; + + EndDialog(hwndDlg, IDOK); + break; + + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + break; + } + break; + + default: + return FALSE; + } + + return TRUE; +} + + +static VOID +UserNew(HWND hwndDlg) +{ + USER_INFO_3 user; + NET_API_STATUS status; + LV_ITEM lvi; + INT iItem; + HWND hwndLV; + + ZeroMemory(&user, sizeof(USER_INFO_3)); + + user.usri3_priv = USER_PRIV_USER; + user.usri3_flags = UF_SCRIPT; + user.usri3_acct_expires = TIMEQ_FOREVER; + user.usri3_max_storage = USER_MAXSTORAGE_UNLIMITED; + user.usri3_primary_group_id = DOMAIN_GROUP_RID_USERS; + + if (DialogBoxParam(hApplet, + MAKEINTRESOURCE(IDD_USER_NEW), + hwndDlg, + NewUserDlgProc, + (LPARAM)&user) == IDOK) + { +#if 0 + status = NetUserAdd(NULL, + 3, + (LPBYTE)&user, + NULL); +#else + status = NERR_Success; +#endif + if (status != NERR_Success) + { + TCHAR szText[256]; + wsprintf(szText, TEXT("Error: %u"), status); + MessageBox(NULL, szText, TEXT("NetUserAdd"), MB_ICONERROR | MB_OK); + return; + } + + hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST); + + ZeroMemory(&lvi, sizeof(lvi)); + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; + lvi.pszText = user.usri3_name; + lvi.state = 0; + lvi.iImage = (user.usri3_flags & UF_ACCOUNTDISABLE) ? 1 : 0; + iItem = ListView_InsertItem(hwndLV, &lvi); + + ListView_SetItemText(hwndLV, iItem, 1, + user.usri3_full_name); + + ListView_SetItemText(hwndLV, iItem, 2, + user.usri3_comment); + } + + if (user.usri3_name) + HeapFree(GetProcessHeap, 0, user.usri3_name); + + if (user.usri3_full_name) + HeapFree(GetProcessHeap, 0, user.usri3_full_name); + + if (user.usri3_comment) + HeapFree(GetProcessHeap, 0, user.usri3_comment); + + if (user.usri3_password) + HeapFree(GetProcessHeap, 0, user.usri3_password); +} + + +static BOOL +UserDelete(HWND hwndDlg) +{ + TCHAR szUserName[UNLEN]; + TCHAR szText[256]; + INT nItem; + HWND hwndLV; + NET_API_STATUS status; + + hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST); + nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED); + if (nItem == -1) + return FALSE; + + /* Get the new user name */ + ListView_GetItemText(hwndLV, + nItem, 0, + szUserName, + UNLEN); + + /* Display a warning message because the delete operation cannot be reverted */ + wsprintf(szText, TEXT("Dou you really want to delete the user \"%s\"?"), szUserName); + if (MessageBox(NULL, szText, TEXT("User Accounts"), MB_ICONWARNING | MB_YESNO) == IDNO) + return FALSE; + + /* Delete the user */ +#if 0 + status = NetUserDel(NULL, szUserName); +#else + status = NERR_Success; +#endif + if (status != NERR_Success) + { + TCHAR szText[256]; + wsprintf(szText, TEXT("Error: %u"), status); + MessageBox(NULL, szText, TEXT("NetUserDel"), MB_ICONERROR | MB_OK); + return FALSE; + } + + /* Delete the user from the list */ + (void)ListView_DeleteItem(hwndLV, nItem); + + return TRUE; +} static VOID @@ -124,7 +333,6 @@ DWORD totalentries; DWORD resume_handle = 0; DWORD i; - LV_ITEM lvi; INT iItem; @@ -141,10 +349,9 @@ for (i = 0; i < entriesread; i++) { memset(&lvi, 0x00, sizeof(lvi)); - lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; // | LVIF_PARAM; -// lvi.lParam = (LPARAM)VarData; + lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE; lvi.pszText = pBuffer[i].usri20_name; - lvi.state = 0; //(i == 0) ? LVIS_SELECTED : 0; + lvi.state = 0; lvi.iImage = (pBuffer[i].usri20_flags & UF_ACCOUNTDISABLE) ? 1 : 0; iItem = ListView_InsertItem(hwndListView, &lvi); @@ -189,9 +396,6 @@ SetUsersListColumns(hwndListView); UpdateUsersList(hwndListView); - -// (void)ListView_SetColumnWidth(hwndListView, 3, LVSCW_AUTOSIZE_USEHEADER); -// (void)ListView_Update(hwndListView, 0); } @@ -337,6 +541,14 @@ } break; + case IDM_USER_NEW: + UserNew(hwndDlg); + break; + + case IDM_USER_DELETE: + UserDelete(hwndDlg); + break; + case IDM_USER_PROPERTIES: MessageBeep(-1); break;
16 years, 8 months
1
0
0
0
[dchapyshev] 33504: - Implement "Input language Properties" dialog
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue May 13 15:23:23 2008 New Revision: 33504 URL:
http://svn.reactos.org/svn/reactos?rev=33504&view=rev
Log: - Implement "Input language Properties" dialog Removed: trunk/reactos/dll/cpl/input/inputlangprop.c Modified: trunk/reactos/dll/cpl/input/add.c trunk/reactos/dll/cpl/input/input.h trunk/reactos/dll/cpl/input/input.rbuild trunk/reactos/dll/cpl/input/lang/bg-BG.rc trunk/reactos/dll/cpl/input/lang/de-DE.rc trunk/reactos/dll/cpl/input/lang/el-GR.rc trunk/reactos/dll/cpl/input/lang/en-US.rc trunk/reactos/dll/cpl/input/lang/es-ES.rc trunk/reactos/dll/cpl/input/lang/fr-FR.rc trunk/reactos/dll/cpl/input/lang/it-IT.rc trunk/reactos/dll/cpl/input/lang/pl-PL.rc trunk/reactos/dll/cpl/input/lang/ru-RU.rc trunk/reactos/dll/cpl/input/lang/sk-SK.rc trunk/reactos/dll/cpl/input/lang/uk-UA.rc trunk/reactos/dll/cpl/input/resource.h trunk/reactos/dll/cpl/input/settings.c Modified: trunk/reactos/dll/cpl/input/add.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/add.c?rev=33…
============================================================================== --- trunk/reactos/dll/cpl/input/add.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/add.c [iso-8859-1] Tue May 13 15:23:23 2008 @@ -36,7 +36,7 @@ } } -static INT +INT GetLayoutCount(LPTSTR szLang) { HKEY hKey; @@ -84,7 +84,7 @@ iLayout = SendMessage(hLayoutList, CB_GETCURSEL, 0, 0); if (iLayout == CB_ERR) return; - if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) { if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &cValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { @@ -111,7 +111,7 @@ if (_tcslen(SubPath) != 0) { if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL, - REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WRITE, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hSubKey, NULL) == ERROR_SUCCESS) { if (RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)pts, @@ -123,7 +123,7 @@ } RegCloseKey(hSubKey); } - pts = SubPath; + lstrcpy(pts, SubPath); } if (RegSetValueEx(hKey, @@ -141,7 +141,7 @@ } VOID -CreateKeyboardLayoutList(VOID) +CreateKeyboardLayoutList(HWND hItemsList) { HKEY hKey; PTSTR pstrLayoutID; @@ -157,16 +157,16 @@ { GetLayoutName(szLayoutID, KeyName); - INT iIndex = (INT) SendMessage(hLayoutList, CB_ADDSTRING, 0, (LPARAM)KeyName); + INT iIndex = (INT) SendMessage(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName); pstrLayoutID = (PTSTR)HeapAlloc(hProcessHeap, 0, sizeof(szLayoutID)); lstrcpy(pstrLayoutID, szLayoutID); - SendMessage(hLayoutList, CB_SETITEMDATA, iIndex, (LPARAM)pstrLayoutID); + SendMessage(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)pstrLayoutID); // FIXME! if (_tcscmp(szLayoutID, _T("00000409")) == 0) { - SendMessage(hLayoutList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0); + SendMessage(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0); } dwIndex++; @@ -220,7 +220,7 @@ hLangList = GetDlgItem(hDlg, IDC_INPUT_LANG_COMBO); hLayoutList = GetDlgItem(hDlg, IDC_KEYBOARD_LO_COMBO); EnumSystemLocales(LanguagesEnumProc, LCID_INSTALLED); - CreateKeyboardLayoutList(); + CreateKeyboardLayoutList(hLayoutList); } break; Modified: trunk/reactos/dll/cpl/input/input.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.h?rev=…
============================================================================== --- trunk/reactos/dll/cpl/input/input.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/input.h [iso-8859-1] Tue May 13 15:23:23 2008 @@ -50,15 +50,13 @@ INT_PTR CALLBACK AddDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam); VOID -CreateKeyboardLayoutList(VOID); +CreateKeyboardLayoutList(HWND hItemsList); +INT +GetLayoutCount(LPTSTR szLang); /* changekeyseq.c */ INT_PTR CALLBACK ChangeKeySeqDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam); - -/* inputlangprop.c */ -INT_PTR CALLBACK -InputLangPropDlgProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam); void ShowLastWin32Error(HWND hWndOwner); Modified: trunk/reactos/dll/cpl/input/input.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/input.rbuild…
============================================================================== --- trunk/reactos/dll/cpl/input/input.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/input.rbuild [iso-8859-1] Tue May 13 15:23:23 2008 @@ -16,6 +16,5 @@ <file>keysettings.c</file> <file>add.c</file> <file>changekeyseq.c</file> - <file>inputlangprop.c</file> <file>input.rc</file> </module> Removed: trunk/reactos/dll/cpl/input/inputlangprop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/inputlangpro…
============================================================================== --- trunk/reactos/dll/cpl/input/inputlangprop.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/inputlangprop.c (removed) @@ -1,45 +1,0 @@ -/* - * - * PROJECT: input.dll - * FILE: dll/win32/input/inputlangprop.c - * PURPOSE: input.dll - * PROGRAMMER: Dmitry Chapyshev (lentind(a)yandex.ru) - * Colin Finck - * UPDATE HISTORY: - * 06-09-2007 Created - */ - -#include "resource.h" -#include "input.h" - -INT_PTR CALLBACK -InputLangPropDlgProc(HWND hDlg, - UINT message, - WPARAM wParam, - LPARAM lParam) -{ - UNREFERENCED_PARAMETER(lParam); - - switch (message) - { - case WM_INITDIALOG: - CreateKeyboardLayoutList(); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) - { - case IDOK: - break; - - case IDCANCEL: - EndDialog(hDlg,LOWORD(wParam)); - break; - } - break; - } - - return FALSE; -} - -/* EOF */ Modified: trunk/reactos/dll/cpl/input/lang/bg-BG.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/bg-BG.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/bg-BG.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/bg-BG.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Åçèê íà ïèñàíå", -1, 7, 7, 55, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "Êëàâèàòóðíà ïîäðåäáà/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "Äîáðå", IDOK, 116, 53, 52, 14 PUSHBUTTON "Îòêàç", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/de-DE.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/de-DE.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/de-DE.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/de-DE.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Eingabesprache:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Tastaturlayout/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Abbrechen", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/el-GR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/el-GR.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/el-GR.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/el-GR.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Ãëþóóá åéóáãùãÞò:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&ÄéÜôáîç ðëçêôñïëïãßïõ/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "¢êõñï", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/en-US.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/en-US.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Input language:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Keyboard layout/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Cancel", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/es-ES.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/es-ES.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/es-ES.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/es-ES.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -72,9 +72,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "&Idioma de dispositivo de entrada:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Distribución del teclado/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "Aceptar", IDOK, 116, 53, 52, 14 PUSHBUTTON "Cancelar", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/fr-FR.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/fr-FR.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/fr-FR.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Langue de saisie :", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "Configuration clavier/IME :", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Annuler", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/it-IT.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/it-IT.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/it-IT.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/it-IT.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Lingua:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Disposizione/IME tastiera:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Annulla", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/pl-PL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/pl-PL.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/pl-PL.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/pl-PL.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -74,9 +74,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Jêzyk:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Uk³ad klawiatury/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Anuluj", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/ru-RU.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/ru-RU.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -67,9 +67,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "ßçûê ââîäà:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Ðàñêëàäêà êëàâèàòóðû:", -1, 7, 21, 170, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 114, 53, 52, 14 PUSHBUTTON "Îòìåíà", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/sk-SK.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/sk-SK.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/sk-SK.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/sk-SK.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -71,9 +71,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Input language:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Keyboard layout/IME:", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Zrui", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/lang/uk-UA.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/lang/uk-UA.r…
============================================================================== --- trunk/reactos/dll/cpl/input/lang/uk-UA.rc [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/lang/uk-UA.rc [iso-8859-1] Tue May 13 15:23:23 2008 @@ -75,9 +75,9 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "Ìîâà ââîäó:", -1, 7, 7, 61, 8 - LTEXT "", -1, 73, 7, 129, 8 + LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 LTEXT "&Ðîçêëàäêà êëàâ³àòóðè àáî çàñ³á ââîäó (IME):", -1, 7, 21, 110, 10 - COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 60, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL + COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Ñêàñóâàòè", IDCANCEL, 169, 53, 52, 14 END Modified: trunk/reactos/dll/cpl/input/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/resource.h?r…
============================================================================== --- trunk/reactos/dll/cpl/input/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/resource.h [iso-8859-1] Tue May 13 15:23:23 2008 @@ -38,6 +38,7 @@ #define IDC_KEYBOARD_LO_COMBO 1011 #define IDC_USE_SK 1012 #define IDC_KB_LAYOUT_IME_COMBO 1013 +#define IDC_INPUT_LANG_STR 1014 /* IDS */ #define IDS_CPLSYSTEMNAME 1 Modified: trunk/reactos/dll/cpl/input/settings.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/input/settings.c?r…
============================================================================== --- trunk/reactos/dll/cpl/input/settings.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/input/settings.c [iso-8859-1] Tue May 13 15:23:23 2008 @@ -14,6 +14,8 @@ static HWND MainDlgWnd; static HIMAGELIST hImgList; +// for SaveInputLang() +static INT OldLayoutNum; typedef struct { @@ -24,6 +26,15 @@ TCHAR IndName[MAX_PATH]; } LAYOUT_ITEM, *LPLAYOUT_ITEM; + +static INT +IsLayoutSelected() +{ + INT iIndex = (INT) SendMessage(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), + LVM_GETNEXTITEM, -1, LVNI_FOCUSED); + + return iIndex; +} static HICON CreateLayoutIcon(LPTSTR szInd) @@ -83,6 +94,51 @@ DeleteObject(hBitmap); return hIcon; +} + +static BOOL +GetLayoutID(LPTSTR szLayoutNum, LPTSTR szLCID) +{ + DWORD dwBufLen; + DWORD dwRes; + HKEY hKey; + TCHAR szTempLCID[CCH_LAYOUT_ID + 1]; + + // Get the Layout ID + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + dwBufLen = sizeof(szTempLCID); + dwRes = RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szTempLCID, &dwBufLen); + + if (dwRes != ERROR_SUCCESS) + { + RegCloseKey(hKey); + return FALSE; + } + + RegCloseKey(hKey); + } + + // Look for a substitude of this layout + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + dwBufLen = sizeof(szTempLCID); + + if (RegQueryValueEx(hKey, szTempLCID, NULL, NULL, (LPBYTE)szLCID, &dwBufLen) != ERROR_SUCCESS) + { + // No substitute found, then use the old LCID + lstrcpy(szLCID, szTempLCID); + } + + RegCloseKey(hKey); + } + else + { + // Substitutes key couldn't be opened, so use the old LCID + lstrcpy(szLCID, szTempLCID); + } + + return TRUE; } BOOL @@ -312,6 +368,195 @@ } } +static VOID +SaveInputLang(HWND hDlg) +{ + HKEY hKey, hSubKey; + TCHAR szLayoutID[CCH_LAYOUT_ID + 1], szLayoutNum[CCH_ULONG_DEC + 1], + szPreload[CCH_LAYOUT_ID + 1], LangID[CCH_LAYOUT_ID + 1], + Lang[MAX_PATH], SubPath[MAX_PATH]; + PTSTR pts; + INT iLayout; + DWORD dwSize; + LANGID langid; + + iLayout = SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), CB_GETCURSEL, 0, 0); + if (iLayout == CB_ERR) return; + + pts = (PTSTR) SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), CB_GETITEMDATA, iLayout, 0); + + _ultot(OldLayoutNum, szLayoutNum, 10); + if (!GetLayoutID(szLayoutNum, szLayoutID)) return; + + // if old layout = selected layout + if (_tcscmp(szLayoutID, pts) == 0) return; + + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, + KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) + { + dwSize = sizeof(szPreload); + if (RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize) != ERROR_SUCCESS) + { + RegCloseKey(hKey); + return; + } + + langid = (LANGID)_tcstoul(szPreload, NULL, 16); + GetLocaleInfo(langid, LOCALE_ILANGUAGE, Lang, sizeof(Lang) / sizeof(TCHAR)); + wsprintf(LangID, _T("0000%s"), Lang); + + if (szPreload[0] == 'd') + { + if (_tcscmp(LangID, pts) == 0) + { + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, + KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) + { + if (RegDeleteValue(hSubKey, szPreload) != ERROR_SUCCESS) + { + RegCloseKey(hSubKey); + RegCloseKey(hKey); + return; + } + RegCloseKey(hSubKey); + + RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)pts, + (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))); + } + } + else + { + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, + KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) + { + RegSetValueEx(hSubKey, szPreload, 0, REG_SZ, (LPBYTE)pts, + (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))); + + RegCloseKey(hSubKey); + } + } + } + else + { + if (_tcscmp(LangID, pts) == 0) + { + RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)pts, + (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))); + } + else + { + if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, NULL, + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, + NULL, &hSubKey, NULL) == ERROR_SUCCESS) + { + wsprintf(SubPath, _T("d%03d%s"), GetLayoutCount(Lang)-1, Lang); + + RegSetValueEx(hSubKey, SubPath, 0, REG_SZ, (LPBYTE)pts, + (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))); + + RegSetValueEx(hKey, szLayoutNum, 0, REG_SZ, (LPBYTE)SubPath, + (DWORD)((CCH_LAYOUT_ID + 1) * sizeof(TCHAR))); + + RegCloseKey(hSubKey); + } + } + } + + RegCloseKey(hKey); + } +} + +static VOID +InitInputLangPropDlg(HWND hDlg) +{ + HKEY hKey, hSubKey; + LVITEM item; + INT LayoutNum; + TCHAR szLayoutNum[10 + 1], szPreload[CCH_LAYOUT_ID + 1], + szTmp[CCH_LAYOUT_ID + 1], szName[MAX_PATH]; + DWORD dwSize; + LANGID langid; + + ZeroMemory(&item, sizeof(LVITEM)); + + item.mask = LVIF_PARAM; + item.iItem = IsLayoutSelected(); + + (VOID) ListView_GetItem(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), &item); + LayoutNum = (INT) item.lParam; + OldLayoutNum = LayoutNum; + + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"), 0, + KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) + { + _ultot(LayoutNum, szLayoutNum, 10); + + dwSize = sizeof(szPreload); + RegQueryValueEx(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szPreload, &dwSize); + + langid = (LANGID)_tcstoul(szPreload, NULL, 16); + GetLocaleInfo(langid, LOCALE_SLANGUAGE, (LPTSTR)szName, sizeof(szName) / sizeof(TCHAR)); + SetWindowText(GetDlgItem(hDlg, IDC_INPUT_LANG_STR), szName); + + if (szPreload[0] == 'd') + { + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Substitutes"), 0, + KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) + { + if (RegQueryValueEx(hSubKey, szPreload, NULL, NULL, (LPBYTE)szTmp, &dwSize) != ERROR_SUCCESS) + { + RegCloseKey(hSubKey); + RegCloseKey(hKey); + return; + } + lstrcpy(szPreload, szTmp); + RegCloseKey(hSubKey); + } + } + + if (GetLayoutName(szPreload, szName)) + { + SendMessage(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO), + CB_SELECTSTRING, (WPARAM)-1, (LPARAM)szName); + } + } + RegCloseKey(hKey); +} + +INT_PTR CALLBACK +InputLangPropDlgProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + + switch (message) + { + case WM_INITDIALOG: + CreateKeyboardLayoutList(GetDlgItem(hDlg, IDC_KB_LAYOUT_IME_COMBO)); + InitInputLangPropDlg(hDlg); + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + SaveInputLang(hDlg); + UpdateLayoutsList(); + EndDialog(hDlg,LOWORD(wParam)); + break; + + case IDCANCEL: + EndDialog(hDlg,LOWORD(wParam)); + break; + } + break; + } + + return FALSE; +} + /* Property page dialog callback */ INT_PTR CALLBACK SettingPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) @@ -329,8 +574,6 @@ hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 0, 1); InitLangList(hwndDlg); (VOID) ListView_SetImageList(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), hImgList, LVSIL_SMALL); - EnableWindow(GetDlgItem(hwndDlg, IDC_PROP_BUTTON),FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_SET_DEFAULT),FALSE); } break; case WM_NOTIFY: @@ -363,11 +606,16 @@ break; case IDC_PROP_BUTTON: + if (IsLayoutSelected() != -1) DialogBox(hApplet, MAKEINTRESOURCE(IDD_INPUT_LANG_PROP), hwndDlg, InputLangPropDlgProc); break; + + case IDC_SET_DEFAULT: + + break; } break; case WM_DESTROY:
16 years, 8 months
1
0
0
0
[gbrunmar] 33503: Hopefully fixes bug #1110. Requested fixed by amine48rz. See issue #1110 for more details.
by gbrunmar@svn.reactos.org
Author: gbrunmar Date: Tue May 13 15:14:30 2008 New Revision: 33503 URL:
http://svn.reactos.org/svn/reactos?rev=33503&view=rev
Log: Hopefully fixes bug #1110. Requested fixed by amine48rz. See issue #1110 for more details. Modified: trunk/reactos/dll/win32/user32/controls/combo.c trunk/reactos/dll/win32/user32/controls/edit.c trunk/reactos/dll/win32/user32/controls/listbox.c trunk/reactos/dll/win32/user32/misc/exticon.c trunk/reactos/dll/win32/user32/misc/wsprintf.c trunk/reactos/dll/win32/user32/windows/dialog.c trunk/reactos/dll/win32/user32/windows/mdi.c Modified: trunk/reactos/dll/win32/user32/controls/combo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/combo.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -1847,7 +1847,8 @@ len = strlen(str); ret = HeapAlloc(GetProcessHeap(), 0, len + 1); - memcpy(ret, str, len + 1); + if (ret != NULL) + memcpy(ret, str, len + 1); return ret; } Modified: trunk/reactos/dll/win32/user32/controls/edit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/edit.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -656,7 +656,7 @@ LPSTR textA = (LPSTR)lParam; INT countW = MultiByteToWideChar(CP_ACP, 0, textA, -1, NULL, 0); if((textW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR)))) - MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW); + MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, countW); } EDIT_EM_ReplaceSel(es, (BOOL)wParam, textW, TRUE, TRUE); @@ -930,9 +930,9 @@ LPWSTR nameW = NULL; if(nameA) { - INT countW = MultiByteToWideChar(CP_ACP, 0, nameA, -1, NULL, 0); - if((nameW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR)))) - MultiByteToWideChar(CP_ACP, 0, nameA, -1, nameW, countW); + INT countW = MultiByteToWideChar(CP_ACP, 0, nameA, -1, NULL, 0); + if((nameW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR)))) + MultiByteToWideChar(CP_ACP, 0, nameA, -1, nameW, countW); } result = EDIT_WM_Create(es, nameW); HeapFree(GetProcessHeap(), 0, nameW); @@ -1222,6 +1222,8 @@ /* The buffer has been expanded, create a new line and insert it into the link list */ LINEDEF *new_line = HeapAlloc(GetProcessHeap(), 0, sizeof(LINEDEF)); + if (new_line == NULL) + break; new_line->next = previous_line->next; previous_line->next = new_line; current_line = new_line; @@ -1517,6 +1519,8 @@ countA = WideCharToMultiByte(CP_ACP, 0, es->text + start, count, NULL, 0, NULL, NULL); textA = HeapAlloc(GetProcessHeap(), 0, countA); + if (textA == NULL) + return 0; WideCharToMultiByte(CP_ACP, 0, es->text + start, count, textA, countA, NULL, NULL); TRACE_(relay)("(ANSI wordbrk=%p,str=%s,idx=%d,cnt=%d,act=%d)\n", es->word_break_proc, debugstr_an(textA, countA), index, countA, action); @@ -1723,6 +1727,8 @@ if (es->style & ES_PASSWORD) { INT len = get_text_length(es); LPWSTR text = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + if (text == NULL) + return NULL; text[len] = '\0'; while(len) text[--len] = es->password_char; return text; @@ -3958,6 +3964,11 @@ es->tabs = NULL; else { es->tabs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(INT)); + if (es->tabs == NULL) + { + es->tabs_count = 0; + return FALSE; + } memcpy(es->tabs, tabs, count * sizeof(INT)); } return TRUE; @@ -4051,6 +4062,8 @@ ulength = strlenW(es->undo_text); utext = HeapAlloc(GetProcessHeap(), 0, (ulength + 1) * sizeof(WCHAR)); + if (utext == NULL) + return FALSE; strcpyW(utext, es->undo_text); Modified: trunk/reactos/dll/win32/user32/controls/listbox.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/controls/…
============================================================================== --- trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/controls/listbox.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -1620,8 +1620,15 @@ /* We need to grow the array */ max_items += LB_ARRAY_GRANULARITY; if (descr->items) + { item = HeapReAlloc( GetProcessHeap(), 0, descr->items, max_items * sizeof(LB_ITEMDATA) ); + if (!item) + { + SEND_NOTIFICATION( descr, LBN_ERRSPACE ); + return LB_ERRSPACE; + } + } else item = HeapAlloc( GetProcessHeap(), 0, max_items * sizeof(LB_ITEMDATA) ); Modified: trunk/reactos/dll/win32/user32/misc/exticon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/exti…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/exticon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/exticon.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -630,6 +630,8 @@ UINT ret; INT len = MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, NULL, 0); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (lpwstrFile == NULL) + return 0; MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, lpwstrFile, len); ret = PrivateExtractIconsW(lpwstrFile, nIndex, sizeX, sizeY, phicon, piconid, nIcons, flags); @@ -709,6 +711,8 @@ UINT ret; INT len = MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, NULL, 0); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (lpwstrFile == NULL) + return 0; TRACE("%s %d %p %p %d\n", lpstrFile, nIndex, phIconLarge, phIconSmall, nIcons); Modified: trunk/reactos/dll/win32/user32/misc/wsprintf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/wspr…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/wsprintf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/wsprintf.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -553,7 +553,10 @@ } if (Allocate) { - *MBString = RtlAllocateHeap(GetProcessHeap(), 0, MBSize); + LPSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, MBSize); + if (SafeString == NULL) + return 0; + *MBString = SafeString; } if (CodePage == 0) { @@ -585,7 +588,10 @@ } if (Allocate) { - *UnicodeString = RtlAllocateHeap(GetProcessHeap(), 0, UnicodeSize); + LPWSTR SafeString = RtlAllocateHeap(GetProcessHeap(), 0, UnicodeSize); + if (SafeString == NULL) + return 0; + *UnicodeString = SafeString; } UnicodeSize *= sizeof(WCHAR); if (CodePage == 0) Modified: trunk/reactos/dll/win32/user32/windows/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -244,8 +244,15 @@ if (GET_WORD(p) == 0xffff) /* Is it an integer id? */ { info->windowName = HeapAlloc( GetProcessHeap(), 0, sizeof(L"#65535") ); - swprintf((LPWSTR)info->windowName, L"#%d", GET_WORD(p + 1)); - info->windowNameFree = TRUE; + if (info->windowName != NULL) + { + swprintf((LPWSTR)info->windowName, L"#%d", GET_WORD(p + 1)); + info->windowNameFree = TRUE; + } + else + { + info->windowNameFree = FALSE; + } p += 2; } else @@ -280,7 +287,7 @@ HWND hwndCtrl, hwndDefButton = 0; INT items = dlgTemplate->nbItems; - if (!(dlgInfo = GETDLGINFO(hwnd))) return -1; + if (!(dlgInfo = GETDLGINFO(hwnd))) return FALSE; while (items--) { @@ -313,22 +320,30 @@ { DWORD len = WideCharToMultiByte( CP_ACP, 0, info.className, -1, NULL, 0, NULL, NULL ); class = HeapAlloc( GetProcessHeap(), 0, len ); - WideCharToMultiByte( CP_ACP, 0, info.className, -1, class, len, NULL, NULL ); + if (class != NULL) + WideCharToMultiByte( CP_ACP, 0, info.className, -1, class, len, NULL, NULL ); } if (HIWORD(caption)) { DWORD len = WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, NULL, 0, NULL, NULL ); caption = HeapAlloc( GetProcessHeap(), 0, len ); - WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption, len, NULL, NULL ); + if (caption != NULL) + WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption, len, NULL, NULL ); } - hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY, - class, caption, info.style | WS_CHILD, - MulDiv(info.x, dlgInfo->xBaseUnit, 4), - MulDiv(info.y, dlgInfo->yBaseUnit, 8), - MulDiv(info.cx, dlgInfo->xBaseUnit, 4), - MulDiv(info.cy, dlgInfo->yBaseUnit, 8), - hwnd, (HMENU)info.id, - hInst, (LPVOID)info.data ); + + if (class != NULL && caption != NULL) + { + hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY, + class, caption, info.style | WS_CHILD, + MulDiv(info.x, dlgInfo->xBaseUnit, 4), + MulDiv(info.y, dlgInfo->yBaseUnit, 8), + MulDiv(info.cx, dlgInfo->xBaseUnit, 4), + MulDiv(info.cy, dlgInfo->yBaseUnit, 8), + hwnd, (HMENU)info.id, + hInst, (LPVOID)info.data ); + } + else + hwndCtrl = NULL; if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class ); if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption ); } @@ -750,19 +765,27 @@ { DWORD len = WideCharToMultiByte( CP_ACP, 0, template.className, -1, NULL, 0, NULL, NULL ); class = HeapAlloc( GetProcessHeap(), 0, len ); - WideCharToMultiByte( CP_ACP, 0, template.className, -1, class, len, NULL, NULL ); + if (class != NULL) + WideCharToMultiByte( CP_ACP, 0, template.className, -1, class, len, NULL, NULL ); } if (HIWORD(caption)) { DWORD len = WideCharToMultiByte( CP_ACP, 0, template.caption, -1, NULL, 0, NULL, NULL ); caption = HeapAlloc( GetProcessHeap(), 0, len ); - WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL ); - } - hwnd = User32CreateWindowEx(template.exStyle, class, caption, - template.style & ~WS_VISIBLE, - rect.left, rect.top, rect.right, rect.bottom, - owner, hMenu, hInst, NULL, - FALSE); + if (caption != NULL) + WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL ); + } + + if (class != NULL && caption != NULL) + { + hwnd = User32CreateWindowEx(template.exStyle, class, caption, + template.style & ~WS_VISIBLE, + rect.left, rect.top, rect.right, rect.bottom, + owner, hMenu, hInst, NULL, + FALSE); + } + else + hwnd = NULL; if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class ); if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption ); } @@ -1272,6 +1295,8 @@ { INT ret, len = MultiByteToWideChar( CP_ACP, 0, spec, -1, NULL, 0 ); LPWSTR specW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + if (specW == NULL) + return FALSE; MultiByteToWideChar( CP_ACP, 0, spec, -1, specW, len ); ret = DIALOG_DlgDirListW( hDlg, specW, idLBox, idStatic, attrib, combo ); WideCharToMultiByte( CP_ACP, 0, specW, -1, spec, 0x7fffffff, NULL, NULL ); Modified: trunk/reactos/dll/win32/user32/windows/mdi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/mdi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/mdi.c [iso-8859-1] Tue May 13 15:14:30 2008 @@ -592,11 +592,22 @@ if (ci->child[i] == child) { HWND *new_child = HeapAlloc(GetProcessHeap(), 0, (ci->nActiveChildren - 1) * sizeof(HWND)); - memcpy(new_child, ci->child, i * sizeof(HWND)); - if (i + 1 < ci->nActiveChildren) - memcpy(new_child + i, ci->child + i + 1, (ci->nActiveChildren - i - 1) * sizeof(HWND)); - HeapFree(GetProcessHeap(), 0, ci->child); - ci->child = new_child; + if (new_child != NULL) + { + memcpy(new_child, ci->child, i * sizeof(HWND)); + if (i + 1 < ci->nActiveChildren) + memcpy(new_child + i, ci->child + i + 1, (ci->nActiveChildren - i - 1) * sizeof(HWND)); + HeapFree(GetProcessHeap(), 0, ci->child); + ci->child = new_child; + } + else + { + UINT c; + for (c = i; c < ci->nActiveChildren - 1; c++) + { + ci->child[c] = ci->child[c+1]; + } + } ci->nActiveChildren--; break; @@ -1248,15 +1259,17 @@ case WM_CREATE: if (GetWindowLongW((HWND)lParam, GWL_EXSTYLE) & WS_EX_MDICHILD) { - ci->nTotalCreated++; - ci->nActiveChildren++; - if (!ci->child) ci->child = HeapAlloc(GetProcessHeap(), 0, sizeof(HWND)); else - ci->child = HeapReAlloc(GetProcessHeap(), 0, ci->child, sizeof(HWND) * ci->nActiveChildren); - - ci->child[ci->nActiveChildren - 1] = (HWND)lParam; + ci->child = HeapReAlloc(GetProcessHeap(), 0, ci->child, sizeof(HWND) * (ci->nActiveChildren + 1)); + + if (ci->child != NULL) + { + ci->child[ci->nActiveChildren] = (HWND)lParam; + ci->nTotalCreated++; + ci->nActiveChildren++; + } } break; @@ -1343,6 +1356,8 @@ { DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0 ); LPWSTR text = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + if (text == NULL) + return 0; MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, text, len ); MDI_UpdateFrameText( hwnd, hwndMDIClient, text ); HeapFree( GetProcessHeap(), 0, text );
16 years, 8 months
1
0
0
0
[fireball] 33502: - Remove a leftover.
by fireball@svn.reactos.org
Author: fireball Date: Tue May 13 14:29:20 2008 New Revision: 33502 URL:
http://svn.reactos.org/svn/reactos?rev=33502&view=rev
Log: - Remove a leftover. Modified: trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S Modified: trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/i386/fastinter…
============================================================================== --- trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S [iso-8859-1] Tue May 13 14:29:20 2008 @@ -539,7 +539,6 @@ * IN ULONG Value) */ .global @Exfi386InterlockedExchangeUlong@8 -.global @InterlockedExchange@8 @Exfi386InterlockedExchangeUlong@8: #ifdef CONFIG_SMP
16 years, 8 months
1
0
0
0
[gbrunmar] 33501: Fixed spelling mistake from previous checkin
by gbrunmar@svn.reactos.org
Author: gbrunmar Date: Tue May 13 13:12:08 2008 New Revision: 33501 URL:
http://svn.reactos.org/svn/reactos?rev=33501&view=rev
Log: Fixed spelling mistake from previous checkin Modified: trunk/reactos/include/reactos/win32k/ntuser.h Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Tue May 13 13:12:08 2008 @@ -490,7 +490,7 @@ ULONG dwThreadId, ULONG lParam, HWND* pWnd, - ULONG* nBufSize); + ULONG* pBufSize); NTSTATUS NTAPI NtUserBuildNameList(
16 years, 8 months
1
0
0
0
[gbrunmar] 33500: NtUserBuildHwndList() returns NTSTATUS, not ULONG. More correct fix than 33483 to some of the winetest problems. Pass return value as out parameter instead.
by gbrunmar@svn.reactos.org
Author: gbrunmar Date: Tue May 13 13:09:08 2008 New Revision: 33500 URL:
http://svn.reactos.org/svn/reactos?rev=33500&view=rev
Log: NtUserBuildHwndList() returns NTSTATUS, not ULONG. More correct fix than 33483 to some of the winetest problems. Pass return value as out parameter instead. Modified: trunk/reactos/dll/win32/user32/windows/mdi.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/dll/win32/user32/windows/mdi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/mdi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/mdi.c [iso-8859-1] Tue May 13 13:09:08 2008 @@ -133,12 +133,11 @@ DWORD dwCount = 0; HWND* pHwnd = NULL; HANDLE hHeap; - - SetLastError(0); - - dwCount = NtUserBuildHwndList ( NULL, hWndparent, FALSE, 0, 0, NULL, 0 ); - - if ( !dwCount || GetLastError() ) + NTSTATUS Status; + + Status = NtUserBuildHwndList ( NULL, hWndparent, FALSE, 0, 0, NULL, &dwCount ); + + if ( !NT_SUCCESS( Status ) ) return 0; /* allocate buffer to receive HWND handles */ @@ -152,12 +151,12 @@ } /* now call kernel again to fill the buffer this time */ - dwCount = NtUserBuildHwndList (NULL, hWndparent, FALSE, 0, 0, pHwnd, dwCount ); - - if ( !dwCount || GetLastError() ) + Status = NtUserBuildHwndList (NULL, hWndparent, FALSE, 0, 0, pHwnd, &dwCount ); + + if ( !NT_SUCCESS( Status ) ) { if ( pHwnd ) - HeapFree ( hHeap, 0, pHwnd ); + HeapFree ( hHeap, 0, pHwnd ); return 0; } Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Tue May 13 13:09:08 2008 @@ -558,6 +558,7 @@ DWORD i, dwCount = 0; HWND* pHwnd = NULL; HANDLE hHeap; + NTSTATUS Status; if ( !lpfn ) { @@ -569,9 +570,9 @@ sort of persistent buffer and only grow it ( requiring a 2nd call ) when the buffer wasn't already big enough? */ /* first get how many window entries there are */ - dwCount = NtUserBuildHwndList ( - hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, 0 ); - if ( !dwCount ) + Status = NtUserBuildHwndList ( + hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, &dwCount ); + if ( !NT_SUCCESS( Status ) ) return FALSE; /* allocate buffer to receive HWND handles */ @@ -584,9 +585,9 @@ } /* now call kernel again to fill the buffer this time */ - dwCount = NtUserBuildHwndList ( - hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, dwCount ); - if ( !dwCount ) + Status = NtUserBuildHwndList ( + hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, &dwCount ); + if ( !NT_SUCCESS( Status ) ) { if ( pHwnd ) HeapFree ( hHeap, 0, pHwnd ); Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Tue May 13 13:09:08 2008 @@ -481,7 +481,7 @@ NtUserBlockInput( BOOL BlockIt); -ULONG +NTSTATUS NTAPI NtUserBuildHwndList( HDESK hDesktop, @@ -490,7 +490,7 @@ ULONG dwThreadId, ULONG lParam, HWND* pWnd, - ULONG nBufSize); + ULONG* nBufSize); NTSTATUS NTAPI NtUserBuildNameList( Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Tue May 13 13:09:08 2008 @@ -1212,7 +1212,7 @@ /* * @implemented */ -ULONG +NTSTATUS STDCALL NtUserBuildHwndList( HDESK hDesktop, @@ -1221,11 +1221,14 @@ ULONG dwThreadId, ULONG lParam, HWND* pWnd, - ULONG nBufSize) + ULONG* pBufSize) { NTSTATUS Status; ULONG dwCount = 0; + if (pBufSize == 0) + return ERROR_INVALID_PARAMETER; + if (hwndParent || !dwThreadId) { PDESKTOP_OBJECT Desktop; @@ -1235,8 +1238,7 @@ { if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop())) { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; + return ERROR_INVALID_HANDLE; } if(hDesktop) @@ -1247,8 +1249,7 @@ &Desktop); if(!NT_SUCCESS(Status)) { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; + return ERROR_INVALID_HANDLE; } } hwndParent = Desktop->DesktopWindow; @@ -1268,7 +1269,7 @@ { if (bGoDown) { - if(dwCount++ < nBufSize && pWnd) + if(dwCount++ < *pBufSize && pWnd) { _SEH_TRY { @@ -1323,15 +1324,13 @@ Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread); if(!NT_SUCCESS(Status)) { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; + return ERROR_INVALID_PARAMETER; } if(!(W32Thread = (PW32THREAD)Thread->Tcb.Win32Thread)) { ObDereferenceObject(Thread); DPRINT("Thread is not a GUI Thread!\n"); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; + return ERROR_INVALID_PARAMETER; } Current = W32Thread->WindowListHead.Flink; @@ -1342,7 +1341,7 @@ if(bChildren || Window->hOwner != NULL) { - if(dwCount < nBufSize && pWnd) + if(dwCount < *pBufSize && pWnd) { Status = MmCopyToCaller(pWnd++, &Window->hSelf, sizeof(HWND)); if(!NT_SUCCESS(Status)) @@ -1359,7 +1358,8 @@ ObDereferenceObject(Thread); } - return dwCount; + *pBufSize = dwCount; + return STATUS_SUCCESS; }
16 years, 8 months
1
0
0
0
← Newer
1
...
26
27
28
29
30
31
32
...
59
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Results per page:
10
25
50
100
200