ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2017
----- 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
19 participants
213 discussions
Start a n
N
ew thread
[ashaposhnikov] 75434: [RAPPS] Incorrect symbol replaced (why was it there though)
by ashaposhnikov@svn.reactos.org
Author: ashaposhnikov Date: Fri Jul 28 22:42:00 2017 New Revision: 75434 URL:
http://svn.reactos.org/svn/reactos?rev=75434&view=rev
Log: [RAPPS] Incorrect symbol replaced (why was it there though) Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] Fri Jul 28 22:42:00 2017 @@ -251,7 +251,7 @@ if (!DeleteCurrentAppsDB()) return FALSE; - ÑDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); + CDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); if (m_szPath.IsEmpty()) return FALSE; @@ -280,7 +280,7 @@ if (hFind == INVALID_HANDLE_VALUE) { if (GetFileAttributesW(m_szCabPath) == INVALID_FILE_ATTRIBUTES) - ÑDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); + CDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); ExtractFilesFromCab(m_szCabPath, m_szAppsPath); hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData);
7 years, 4 months
1
0
0
0
[ashaposhnikov] 75433: [RAPPS] Bulk install! - Added ListView class - Added ListView to a dialog Dialog shows the install progress of individual apps. It also waits for an installator to finish bef...
by ashaposhnikov@svn.reactos.org
Author: ashaposhnikov Date: Fri Jul 28 22:37:24 2017 New Revision: 75433 URL:
http://svn.reactos.org/svn/reactos?rev=75433&view=rev
Log: [RAPPS] Bulk install! - Added ListView class - Added ListView to a dialog Dialog shows the install progress of individual apps. It also waits for an installator to finish before issuing another download-install cycle. - Fixed: Downloads pointing to "\" - Fixed: Selection data is not retrieved correctly - Yet again replacing some macros to wide functions - Minor improvements Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/ (props changed) branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h branches/GSoC_2017/rapps/reactos/base/applications/rapps/resource.h Propchange: branches/GSoC_2017/rapps/reactos/base/applications/rapps/ ------------------------------------------------------------------------------ --- svn:global-ignores (added) +++ svn:global-ignores Fri Jul 28 22:37:24 2017 @@ -0,0 +1 @@ +CMakeFiles Propchange: branches/GSoC_2017/rapps/reactos/base/applications/rapps/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Fri Jul 28 22:37:24 2017 @@ -0,0 +1,3 @@ +CMakeCache.txt +RCa10764 +rapps.aps Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -251,7 +251,7 @@ if (!DeleteCurrentAppsDB()) return FALSE; - DownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); + ÑDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); if (m_szPath.IsEmpty()) return FALSE; @@ -280,7 +280,7 @@ if (hFind == INVALID_HANDLE_VALUE) { if (GetFileAttributesW(m_szCabPath) == INVALID_FILE_ATTRIBUTES) - DownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); + ÑDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); ExtractFilesFromCab(m_szCabPath, m_szAppsPath); hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData); Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -235,31 +235,31 @@ switch (idButton) { case ID_EXIT: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_EXIT); break; case ID_INSTALL: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_INSTALL); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_INSTALL); break; case ID_UNINSTALL: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UNINSTALL); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL); break; case ID_MODIFY: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_MODIFY); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_MODIFY); break; case ID_SETTINGS: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_SETTINGS); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_SETTINGS); break; case ID_REFRESH: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_REFRESH); break; case ID_RESETDB: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_UPDATE_DB); + lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UPDATE_DB); break; } } @@ -380,7 +380,7 @@ BOOL AddColumn(INT Index, LPWSTR lpText, INT Width, INT Format) { - LV_COLUMNW Column; + LVCOLUMNW Column; ZeroMemory(&Column, sizeof(Column)); @@ -395,7 +395,7 @@ INT AddItem(INT ItemIndex, INT IconIndex, LPWSTR lpText, LPARAM lParam) { - LV_ITEMW Item; + LVITEMW Item; ZeroMemory(&Item, sizeof(Item)); @@ -484,6 +484,12 @@ } } return list; + } + + PAPPLICATION_INFO GetSelectedData() + { + INT item = GetSelectionMark(); + return (PAPPLICATION_INFO) GetItemData(item); } }; @@ -767,7 +773,7 @@ RECT rBottom; /* Size status bar */ - m_StatusBar->SendMessage(WM_SIZE, 0, 0); + m_StatusBar->SendMessageW(WM_SIZE, 0, 0); /* Size tool bar */ m_Toolbar->AutoSize(); @@ -1258,10 +1264,10 @@ case ID_INSTALL: if (nSelectedApps) { - DownloadManager::DownloadListOfApplications(m_ListView->GetCheckedItems()); + СDownloadManager::DownloadListOfApplications(m_ListView->GetCheckedItems()); UpdateApplicationsList(-1); } - else if(DownloadManager::DownloadApplication((PAPPLICATION_INFO) m_ListView->GetSelectionMark())) + else if(СDownloadManager::DownloadApplication(m_ListView->GetSelectedData())) { UpdateApplicationsList(-1); } Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/installed.cpp [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -197,7 +197,7 @@ PINSTALLED_INFO Info; WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"; ATL::CStringW szMsgText, szMsgTitle; - INT ItemIndex = SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); + INT ItemIndex = SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); if (!IS_INSTALLED_ENUM(SelectedEnumType)) return; Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -90,7 +90,7 @@ PUSHBUTTON "Cancel", IDCANCEL, 150, 78, 60, 14 END -IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 +IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE CAPTION "Downloading %ls..." FONT 8, "MS Shell Dlg" @@ -202,6 +202,7 @@ IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!" IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet Connection!" IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" + IDS_UNABLE_TO_INSTALL "Unable to open installer!" IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed." IDS_INTEG_CHECK_TITLE "Verifying package integrity..." IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have been corrupted or tampered with during downloading. Running the software is not recommended." @@ -219,6 +220,8 @@ IDS_STATUS_UPDATE_AVAILABLE "Update available" IDS_STATUS_DOWNLOADING "Downloadingâ¦" IDS_STATUS_INSTALLING "Installingâ¦" + IDS_STATUS_WAITING "Waiting to installâ¦" + IDS_STATUS_FINISHED "Finished" END STRINGTABLE Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -90,7 +90,7 @@ PUSHBUTTON "ÐÑмена", IDCANCEL, 150, 78, 60, 14 END -IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 +IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE CAPTION "ÐагÑÑзка %ls..." FONT 8, "MS Shell Dlg" @@ -200,6 +200,7 @@ IDS_INFORMATION "ÐнÑоÑмаÑиÑ" IDS_UNABLE_TO_DOWNLOAD "Ðе ÑдалоÑÑ ÑкаÑаÑÑ Ð¿Ñиложение! Ðе найден адÑеÑ!" IDS_UNABLE_TO_DOWNLOAD2 "Ðе ÑдалоÑÑ ÑкаÑаÑÑ Ð¿Ñиложение! ÐÑовеÑÑÑе подклÑÑение к ÑеÑи ÐнÑеÑнеÑ!" + IDS_UNABLE_TO_INSTALL "Unable to open installer!" IDS_UNABLE_TO_REMOVE "Ðе ÑдалоÑÑ ÑдалиÑÑ Ð´Ð°Ð½Ð½Ñе о пÑогÑамме из ÑееÑÑÑа!" IDS_CERT_DOES_NOT_MATCH "ÐÑибка пÑовеÑки SSL ÑеÑÑиÑикаÑа." IDS_INTEG_CHECK_TITLE "ÐÑовеÑка ÑелоÑÑноÑÑи пÑиложениÑ..." @@ -216,6 +217,8 @@ IDS_STATUS_UPDATE_AVAILABLE "ÐÑÑÑ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ" IDS_STATUS_DOWNLOADING "ÐагÑÑжаеÑÑÑâ¦" IDS_STATUS_INSTALLING "УÑÑановкаâ¦" + IDS_STATUS_WAITING "Ðжидание ÑÑÑановкиâ¦" + IDS_STATUS_FINISHED "ÐавеÑÑено" END STRINGTABLE Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -98,7 +98,7 @@ PUSHBUTTON "СкаÑÑваÑи", IDCANCEL, 150, 78, 60, 14 END -IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 +IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 220 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE CAPTION "ÐаванÑÐ°Ð¶ÐµÐ½Ð½Ñ %ls..." FONT 8, "MS Shell Dlg" @@ -208,6 +208,7 @@ IDS_INFORMATION "ÐнÑоÑмаÑÑÑ" IDS_UNABLE_TO_DOWNLOAD "Ðеможливо заванÑажиÑи додаÑок! ÐдÑеÑÑ Ð½Ðµ знайдено!" IDS_UNABLE_TO_DOWNLOAD2 "Ðеможливо заванÑажиÑи додаÑок! ÐеÑевÑÑÑе пÑдклÑÑÐµÐ½Ð½Ñ Ð´Ð¾ меÑÐµÐ¶Ñ ÐнÑеÑнеÑ!" + IDS_UNABLE_TO_INSTALL "Unable to open installer!" IDS_UNABLE_TO_REMOVE "Ðе вдалоÑÑ Ð²Ð¸Ð´Ð°Ð»Ð¸Ñи Ð´Ð°Ð½Ñ Ð¿Ñо пÑогÑÐ°Ð¼Ñ Ð· ÑеÑÑÑÑÑ!" IDS_CERT_DOES_NOT_MATCH "Ðомилка пеÑевÑки ÑеÑÑиÑÑкаÑÑ SSL." IDS_INTEG_CHECK_TITLE "ÐеÑевÑÑка ÑÑлÑÑÑноÑÑÑ Ð´Ð¾Ð´Ð°ÑкÑ..." @@ -224,6 +225,8 @@ IDS_STATUS_UPDATE_AVAILABLE "РоновленнÑ" IDS_STATUS_DOWNLOADING "ÐаванÑажÑÑÑÑÑÑâ¦" IDS_STATUS_INSTALLING "ÐÑÑановлÑÑÑÑÑÑâ¦" + IDS_STATUS_WAITING "ÐÑÑкÑÐ²Ð°Ð½Ð½Ñ Ð·Ð°Ð²Ð°Ð½ÑаженнÑâ¦" + IDS_STATUS_FINISHED "ÐавеÑÑено" END STRINGTABLE Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -10,23 +10,23 @@ * Copyright 2017 Alexander Shaposhnikov (chaez.san(a)gmail.com) */ -/* - * Based on Wine dlls/shdocvw/shdocvw_main.c - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ + /* + * Based on Wine dlls/shdocvw/shdocvw_main.c + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include "rapps.h" @@ -35,9 +35,31 @@ #include <atlbase.h> #include <atlcom.h> +#include <atlwin.h> #include <wininet.h> #include <shellutils.h> + +#include <rosctrls.h> #include <windowsx.h> + +#include "rosui.h" + +typedef enum +{ + DLWaiting = IDS_STATUS_WAITING, + DLDownloading = IDS_STATUS_DOWNLOADING, + DLWaitingToInstall = IDS_STATUS_DOWNLOADED, + DLInstalling = IDS_STATUS_INSTALLING, + DLInstalled = IDS_STATUS_INSTALLED, + DLFinished = IDS_STATUS_FINISHED +} DOWNLOAD_STATUS; + +ATL::CStringW LoadStatusString(DOWNLOAD_STATUS StatusParam) +{ + ATL::CStringW szString; + szString.LoadStringW(StatusParam); + return szString; +} class CDownloadDialog : public CComObjectRootEx<CComMultiThreadModelNoCS>, @@ -50,7 +72,7 @@ public: ~CDownloadDialog() { - DestroyWindow(m_hDialog); + //DestroyWindow(m_hDialog); } HRESULT Initialize(HWND Dlg, BOOL *pbCancelled) @@ -179,6 +201,75 @@ BEGIN_COM_MAP(CDownloadDialog) COM_INTERFACE_ENTRY_IID(IID_IBindStatusCallback, IBindStatusCallback) END_COM_MAP() +}; + +class CDowloadingAppsListView + : public CUiWindow<CListView> +{ +public: + HWND Create(HWND hwndParent) + { + RECT r = {10, 150, 320, 350}; + const DWORD style = WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_SINGLESEL + | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | LVS_NOCOLUMNHEADER; + + HWND hwnd = CListView::Create(hwndParent, r, NULL, style, WS_EX_CLIENTEDGE); + + AddColumn(0, 150, LVCFMT_LEFT); + AddColumn(1, 120, LVCFMT_LEFT); + + return hwnd; + } + + VOID LoadList(ATL::CSimpleArray<PAPPLICATION_INFO> arrInfo) + { + for (INT i = 0; i < arrInfo.GetSize(); ++i) + { + PAPPLICATION_INFO AppInfo = arrInfo[i]; + AddRow(i, AppInfo->szName.GetString(), DOWNLOAD_STATUS::DLWaiting); + } + } + + VOID SetDownloadStatus(INT ItemIndex, DOWNLOAD_STATUS Status) + { + HWND hListView = GetWindow(); + ATL::CStringW szBuffer = LoadStatusString(Status); + ListView_SetItemText(hListView, ItemIndex, 1, const_cast<LPWSTR>(szBuffer.GetString())); + } + + BOOL AddItem(INT ItemIndex, LPWSTR lpText) + { + LVITEMW Item; + + ZeroMemory(&Item, sizeof(Item)); + + Item.mask = LVIF_TEXT | LVIF_STATE; + Item.pszText = lpText; + Item.iItem = ItemIndex; + + return InsertItem(&Item); + } + + VOID AddRow(INT RowIndex, LPCWSTR szAppName, const DOWNLOAD_STATUS Status) + { + ATL::CStringW szStatus = LoadStatusString(Status); + AddItem(RowIndex, + const_cast<LPWSTR>(szAppName)); + SetDownloadStatus(RowIndex, Status); + } + + BOOL AddColumn(INT Index, INT Width, INT Format) + { + LVCOLUMNW Column; + ZeroMemory(&Column, sizeof(Column)); + + Column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; + Column.iSubItem = Index; + Column.cx = Width; + Column.fmt = Format; + + return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE; + } }; extern "C" @@ -245,26 +336,31 @@ { ATL::CString szMsgText; if (szMsgText.LoadStringW(hInst, StringID)) + { MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); -} - -// DownloadManager - -PAPPLICATION_INFO DownloadManager::AppInfo = NULL; - -INT_PTR CALLBACK DownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) + } +} + +// ÑDownloadManager +PAPPLICATION_INFO ÑDownloadManager::AppInfo; +ATL::CSimpleArray<PAPPLICATION_INFO> ÑDownloadManager::AppsToInstallList; +CDowloadingAppsListView ÑDownloadManager::DownloadsListView; +INT ÑDownloadManager::iCurrentApp; + +#define DL_START_NEW WM_APP + 1 + +INT_PTR CALLBACK ÑDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { HANDLE Thread; DWORD ThreadId; HWND Item; + static WCHAR szCaption[MAX_PATH]; switch (uMsg) { case WM_INITDIALOG: { HICON hIconSm, hIconBg; - WCHAR szCaption[MAX_PATH]; - ATL::CStringW szNewCaption; hIconBg = (HICON) GetClassLongW(hMainWnd, GCLP_HICON); hIconSm = (HICON) GetClassLongW(hMainWnd, GCLP_HICONSM); @@ -274,11 +370,6 @@ SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg); SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm); } - - // Change caption to show the currently downloaded app - GetWindowTextW(Dlg, szCaption, MAX_PATH); - szNewCaption.Format(szCaption, AppInfo->szName.GetString()); - SetWindowTextW(Dlg, szNewCaption.GetString()); SetWindowLongW(Dlg, GWLP_USERDATA, 0); Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS); @@ -288,28 +379,77 @@ // and subclass it so that it learns to print a status text SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); SendMessageW(Item, PBM_SETPOS, 0, 0); - + SetWindowSubclass(Item, DownloadProgressProc, 0, 0); } - - // add a neat placeholder until the download URL is retrieved - SetDlgItemTextW(Dlg, IDC_DOWNLOAD_STATUS, L"\x2022 \x2022 \x2022"); - - Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId); - if (!Thread) + // Get a dlg string for later use + GetWindowTextW(Dlg, szCaption, MAX_PATH); + + // Add a ListView + HWND hListView = DownloadsListView.Create(Dlg); + if (!hListView) + { return FALSE; - CloseHandle(Thread); + } + DownloadsListView.LoadList(AppsToInstallList); + iCurrentApp = -1; + + ShowWindow(Dlg, SW_SHOW); + + //Start new download + SendMessageW(Dlg, DL_START_NEW, 0, 0); + return TRUE; } case WM_COMMAND: if (wParam == IDCANCEL) { - SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1); + SetWindowLongW(Dlg, GWLP_USERDATA, 1); PostMessageW(Dlg, WM_CLOSE, 0, 0); } return FALSE; + case DL_START_NEW: + + ++iCurrentApp; + // If some downloads left we issue it + if (iCurrentApp < AppsToInstallList.GetSize()) + { + AppInfo = AppsToInstallList[iCurrentApp]; + if (!AppInfo) + { + return FALSE; + } + + ATL::CStringW szNewCaption; + + // Reset progress bar + Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS); + if (Item) + { + SendMessageW(Item, PBM_SETPOS, 0, 0); + } + + // Change caption to show the currently downloaded app + szNewCaption.Format(szCaption, AppInfo->szName.GetString()); + SetWindowTextW(Dlg, szNewCaption.GetString()); + + // Add a neat placeholder until the download URL is retrieved + SetDlgItemTextW(Dlg, IDC_DOWNLOAD_STATUS, L"\x2022 \x2022 \x2022"); + Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId); + + if (!Thread) + { + return FALSE; + } + + CloseHandle(Thread); + return TRUE; + } + // No downloads left, closing (fallthrough) + case WM_CLOSE: + EndDialog(Dlg, 0); DestroyWindow(Dlg); return TRUE; @@ -318,7 +458,7 @@ } } -LRESULT CALLBACK DownloadManager::DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) +LRESULT CALLBACK ÑDownloadManager::DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) { static ATL::CStringW szProgressText; @@ -381,6 +521,7 @@ /* Raymond Chen says that we should safely unsubclass all the things! (
http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx
) */ + case WM_NCDESTROY: { szProgressText.Empty(); @@ -392,41 +533,49 @@ } } -DWORD WINAPI DownloadManager::ThreadFunc(LPVOID Context) +DWORD WINAPI ÑDownloadManager::ThreadFunc(LPVOID Context) { CComPtr<IBindStatusCallback> dl; ATL::CStringW Path; PWSTR p, q; HWND Dlg = (HWND) Context; + ULONG dwContentLen, dwBytesWritten, dwBytesRead, dwStatus; ULONG dwCurrentBytesRead = 0; ULONG dwStatusLen = sizeof(dwStatus); + BOOL bCancelled = FALSE; BOOL bTempfile = FALSE; BOOL bCab = FALSE; + HINTERNET hOpen = NULL; HINTERNET hFile = NULL; HANDLE hOut = INVALID_HANDLE_VALUE; + unsigned char lpBuffer[4096]; LPCWSTR lpszAgent = L"RApps/1.0"; URL_COMPONENTS urlComponents; size_t urlLength, filenameLength; + const INT iAppId = iCurrentApp; + const PAPPLICATION_INFO pCurrentInfo = AppInfo; if (!AppInfo) { MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_DOWNLOAD); goto end; } - /* build the path for the download */ - p = wcsrchr(AppInfo->szUrlDownload.GetString(), L'/'); - q = wcsrchr(AppInfo->szUrlDownload.GetString(), L'?'); - - /* do we have a final slash separator? */ + DownloadsListView.SetDownloadStatus(iAppId, DOWNLOAD_STATUS::DLDownloading); + + // build the path for the download + p = wcsrchr(pCurrentInfo->szUrlDownload.GetString(), L'/'); + q = wcsrchr(pCurrentInfo->szUrlDownload.GetString(), L'?'); + + // do we have a final slash separator? if (!p) goto end; - /* prepare the tentative length of the filename, maybe we've to remove part of it later on */ + // prepare the tentative length of the filename, maybe we've to remove part of it later on filenameLength = wcslen(p) * sizeof(WCHAR); /* do we have query arguments in the target URL after the filename? account for them @@ -434,8 +583,8 @@ if (q && q > p && (q - p) > 0) filenameLength -= wcslen(q - 1) * sizeof(WCHAR); - /* is this URL an update package for RAPPS? if so store it in a different place */ - if (AppInfo->szUrlDownload == APPLICATION_DATABASE_URL) + // is this URL an update package for RAPPS? if so store it in a different place + if (pCurrentInfo->szUrlDownload == APPLICATION_DATABASE_URL) { bCab = TRUE; if (!GetStorageDirectory(Path)) @@ -446,24 +595,25 @@ Path = SettingsInfo.szDownloadDir; } - /* is the path valid? can we access it? */ + // is the path valid? can we access it? if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES) { if (!CreateDirectoryW(Path.GetString(), NULL)) goto end; } - /* append a \ to the provided file system path, and the filename portion from the URL after that */ - Path.Format(L"\\%ls", (p + 1)); - - if (!bCab && AppInfo->szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES) - { - /* only open it in case of total correctness */ - if (VerifyInteg(AppInfo->szSHA1, Path)) + // append a \ to the provided file system path, and the filename portion from the URL after that + Path += L"\\"; + Path += (LPWSTR) (p + 1); + + if (!bCab && pCurrentInfo->szSHA1[0] && GetFileAttributesW(Path.GetString()) != INVALID_FILE_ATTRIBUTES) + { + // only open it in case of total correctness + if (VerifyInteg(pCurrentInfo->szSHA1, Path)) goto run; } - /* download it */ + // download it bTempfile = TRUE; CDownloadDialog_Constructor(Dlg, &bCancelled, IID_PPV_ARG(IBindStatusCallback, &dl)); @@ -473,16 +623,16 @@ /* FIXME: this should just be using the system-wide proxy settings */ switch (SettingsInfo.Proxy) { - case 0: /* preconfig */ + case 0: // preconfig hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); break; - case 1: /* direct (no proxy) */ + case 1: // direct (no proxy) hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); break; - case 2: /* use proxy */ + case 2: // use proxy hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PROXY, SettingsInfo.szProxyServer, SettingsInfo.szNoProxyFor, 0); break; - default: /* preconfig */ + default: // preconfig hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); break; } @@ -490,7 +640,7 @@ if (!hOpen) goto end; - hFile = InternetOpenUrlW(hOpen, AppInfo->szUrlDownload, NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION, 0); + hFile = InternetOpenUrlW(hOpen, pCurrentInfo->szUrlDownload, NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION, 0); if (!hFile) { MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_DOWNLOAD2); @@ -511,25 +661,25 @@ memset(&urlComponents, 0, sizeof(urlComponents)); urlComponents.dwStructSize = sizeof(urlComponents); - urlLength = AppInfo->szUrlDownload.GetLength(); + urlLength = pCurrentInfo->szUrlDownload.GetLength(); urlComponents.dwSchemeLength = urlLength + 1; urlComponents.lpszScheme = (LPWSTR) malloc(urlComponents.dwSchemeLength * sizeof(WCHAR)); urlComponents.dwHostNameLength = urlLength + 1; urlComponents.lpszHostName = (LPWSTR) malloc(urlComponents.dwHostNameLength * sizeof(WCHAR)); - if (!InternetCrackUrlW(AppInfo->szUrlDownload, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents)) + if (!InternetCrackUrlW(pCurrentInfo->szUrlDownload, urlLength + 1, ICU_DECODE | ICU_ESCAPE, &urlComponents)) goto end; if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) - HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatus, 0); + HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatus, 0); if (urlComponents.nScheme == INTERNET_SCHEME_FTP) dwContentLen = FtpGetFileSize(hFile, &dwStatus); #ifdef USE_CERT_PINNING - /* are we using HTTPS to download the RAPPS update package? check if the certificate is original */ + // are we using HTTPS to download the RAPPS update package? check if the certificate is original if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) && - (wcscmp(AppInfo->szUrlDownload, APPLICATION_DATABASE_URL) == 0) && + (wcscmp(pCurrentInfo->szUrlDownload, APPLICATION_DATABASE_URL) == 0) && (!CertIsValid(hOpen, urlComponents.lpszHostName))) { MessageBox_LoadString(hMainWnd, IDS_CERT_DOES_NOT_MATCH); @@ -560,7 +710,7 @@ } dwCurrentBytesRead += dwBytesRead; - dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, AppInfo->szUrlDownload); + dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, pCurrentInfo->szUrlDownload); } while (dwBytesRead && !bCancelled); CloseHandle(hOut); @@ -571,19 +721,19 @@ /* if this thing isn't a RAPPS update and it has a SHA-1 checksum verify its integrity by using the native advapi32.A_SHA1 functions */ - if (!bCab && AppInfo->szSHA1[0] != 0) + if (!bCab && pCurrentInfo->szSHA1[0] != 0) { ATL::CStringW szMsgText; - /* change a few strings in the download dialog to reflect the verification process */ + // change a few strings in the download dialog to reflect the verification process if (!szMsgText.LoadStringW(hInst, IDS_INTEG_CHECK_TITLE)) goto end; - SetWindowText(Dlg, szMsgText.GetString()); + SetWindowTextW(Dlg, szMsgText.GetString()); SendMessageW(GetDlgItem(Dlg, IDC_DOWNLOAD_STATUS), WM_SETTEXT, 0, (LPARAM) Path.GetString()); - /* this may take a while, depending on the file size */ - if (!VerifyInteg(AppInfo->szSHA1, Path.GetString())) + // this may take a while, depending on the file size + if (!VerifyInteg(pCurrentInfo->szSHA1, Path.GetString())) { if (!szMsgText.LoadStringW(hInst, IDS_INTEG_CHECK_FAIL)) goto end; @@ -593,12 +743,33 @@ } } - ShowWindow(Dlg, SW_HIDE); run: - /* run it */ + DownloadsListView.SetDownloadStatus(iAppId, DOWNLOAD_STATUS::DLWaitingToInstall); + + // run it if (!bCab) - ShellExecuteW(NULL, L"open", Path.GetString(), NULL, NULL, SW_SHOWNORMAL); + { + SHELLEXECUTEINFOW shExInfo = {0}; + shExInfo.cbSize = sizeof(shExInfo); + shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; + shExInfo.lpVerb = L"open"; + shExInfo.lpFile = Path.GetString(); + shExInfo.lpParameters = L""; + shExInfo.nShow = SW_SHOW; + + if (ShellExecuteExW(&shExInfo)) + { + DownloadsListView.SetDownloadStatus(iAppId, DOWNLOAD_STATUS::DLInstalling); + //TODO: issue an install operation separately so that the apps could be downloaded in the background + WaitForSingleObject(shExInfo.hProcess, INFINITE); + CloseHandle(shExInfo.hProcess); + } + else + { + MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_INSTALL); + } + } end: if (hOut != INVALID_HANDLE_VALUE) @@ -612,55 +783,55 @@ if (bCancelled || (SettingsInfo.bDelInstaller && !bCab)) DeleteFileW(Path.GetString()); } - - EndDialog(Dlg, 0); - + DownloadsListView.SetDownloadStatus(iAppId, DOWNLOAD_STATUS::DLFinished); + SendMessageW(Dlg, DL_START_NEW, 0, 0); return 0; } -//TODO: Maybe launch this (similar function) in a seperate thread, so the list could be updated -BOOL DownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList) -{ - BOOL bResult = TRUE; - - for (INT i = 0; i < AppsList.GetSize(); ++i) - { - bResult = DownloadApplication(AppsList[i]) && bResult; - } - return bResult; -} - -BOOL DownloadManager::DownloadApplication(PAPPLICATION_INFO pAppInfo) +BOOL ÑDownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList) +{ + if (AppsList.GetSize() == 0) + { + return FALSE; + } + + // Initialize shared variables + AppsToInstallList = AppsList; + + // Create a dialog and issue a download process + LaunchDownloadDialog(); + + return TRUE; +} + +BOOL ÑDownloadManager::DownloadApplication(PAPPLICATION_INFO pAppInfo) { if (!pAppInfo) { return FALSE; } - // Create a dialog and issue a download process - AppInfo = pAppInfo; + AppsToInstallList.RemoveAll(); + AppsToInstallList.Add(pAppInfo); LaunchDownloadDialog(); - WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, AppInfo->szName.GetString()); - return TRUE; } -VOID DownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) +VOID ÑDownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) { APPLICATION_INFO IntInfo; IntInfo.szUrlDownload = lpUrl; - AppInfo = &IntInfo; - - LaunchDownloadDialog(); + DownloadApplication(&IntInfo); } //TODO: Reuse the dialog -VOID DownloadManager::LaunchDownloadDialog() +VOID ÑDownloadManager::LaunchDownloadDialog() { CreateDialogW(hInst, MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), hMainWnd, DownloadDlgProc); -} +} +// CDownloadManager Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -46,7 +46,6 @@ typedef HRESULT(WINAPI *fnExtract)(SESSION *dest, LPCSTR szCabName); fnExtract pfnExtract; - INT GetSystemColorDepth(VOID) { @@ -56,7 +55,7 @@ pDevMode.dmSize = sizeof(pDevMode); pDevMode.dmDriverExtra = 0; - if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode)) + if (!EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &pDevMode)) { /* TODO: Error message */ return ILC_COLOR; @@ -170,7 +169,7 @@ ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_STATE; - GetMenuItemInfo(hPopupMenu, DefaultItem, FALSE, &mii); + GetMenuItemInfoW(hPopupMenu, DefaultItem, FALSE, &mii); if (!(mii.fState & MFS_GRAYED)) SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE); Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -249,12 +249,15 @@ VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo); /* loaddlg.cpp */ - -class DownloadManager +class CDowloadingAppsListView; + +class ÑDownloadManager { static PAPPLICATION_INFO AppInfo; + static ATL::CSimpleArray<PAPPLICATION_INFO> AppsToInstallList; + static CDowloadingAppsListView DownloadsListView; + static INT iCurrentApp; public: - static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, UINT uMsg, Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/resource.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/resource.h [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/resource.h [iso-8859-1] Fri Jul 28 22:37:24 2017 @@ -107,6 +107,7 @@ #define IDS_UNABLE_TO_WRITE 125 #define IDS_SELECT_ALL 126 #define IDS_INSTALL_SELECTED 127 +#define IDS_UNABLE_TO_INSTALL 128 /* Tooltips */ #define IDS_TOOLTIP_INSTALL 200 @@ -176,6 +177,8 @@ #define IDS_STATUS_UPDATE_AVAILABLE 803 #define IDS_STATUS_DOWNLOADING 804 #define IDS_STATUS_INSTALLING 805 +#define IDS_STATUS_WAITING 806 +#define IDS_STATUS_FINISHED 807 /* App license names */ #define IDS_LICENSE_OPENSOURCE 900
7 years, 4 months
1
0
0
0
[mjansen] 75432: [APPHELP] Various cleanup tasks - Move debug heap functionality to a separate file - Clean includes - Remove msvcrt dependency - Clean up string usage - Remove some higher level fu...
by mjansen@svn.reactos.org
Author: mjansen Date: Fri Jul 28 19:00:27 2017 New Revision: 75432 URL:
http://svn.reactos.org/svn/reactos?rev=75432&view=rev
Log: [APPHELP] Various cleanup tasks - Move debug heap functionality to a separate file - Clean includes - Remove msvcrt dependency - Clean up string usage - Remove some higher level functions in favor of their ntdll counterparts (wip). Added: trunk/reactos/dll/appcompat/apphelp/dbgheap.c (with props) Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt trunk/reactos/dll/appcompat/apphelp/hsdb.c trunk/reactos/dll/appcompat/apphelp/layer.c trunk/reactos/dll/appcompat/apphelp/sdbapi.c trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c trunk/reactos/dll/appcompat/apphelp/sdbread.c trunk/reactos/dll/appcompat/apphelp/sdbwrite.c Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMak…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -9,6 +9,7 @@ list(APPEND SOURCE apphelp.c + dbgheap.c hsdb.c layer.c sdbapi.c @@ -26,8 +27,7 @@ apphelp.rc ${CMAKE_CURRENT_BINARY_DIR}/apphelp.def) -set_module_type(apphelp win32dll) -target_link_libraries(apphelp wine) +set_module_type(apphelp win32dll UNICODE ENTRYPOINT DllMain 12) add_delay_importlibs(apphelp version) -add_importlibs(apphelp msvcrt kernel32 ntdll) +add_importlibs(apphelp kernel32 ntdll) add_cd_file(TARGET apphelp DESTINATION reactos/system32 FOR all) Added: trunk/reactos/dll/appcompat/apphelp/dbgheap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/dbgh…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/dbgheap.c (added) +++ trunk/reactos/dll/appcompat/apphelp/dbgheap.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -0,0 +1,177 @@ +/* + * Copyright 2017 Mark Jansen (mark.jansen(a)reactos.org) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WIN32_NO_STATUS +#include "ntndk.h" + + +#if SDBAPI_DEBUG_ALLOC + +#define TRACE_ALL_FREE_CALLS 1 + +typedef struct SHIM_ALLOC_ENTRY +{ + PVOID Address; + SIZE_T Size; + int Line; + const char* File; + PVOID Next; + PVOID Prev; +} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY; + +static RTL_CRITICAL_SECTION g_SdbpAllocationLock; +static RTL_AVL_TABLE g_SdbpAllocationTable; +static HANDLE g_PrivAllocationHeap; + +static RTL_GENERIC_COMPARE_RESULTS +NTAPI ShimAllocCompareRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID FirstStruct, _In_ PVOID SecondStruct) +{ + PVOID First = ((PSHIM_ALLOC_ENTRY)FirstStruct)->Address; + PVOID Second = ((PSHIM_ALLOC_ENTRY)SecondStruct)->Address; + + if (First < Second) + return GenericLessThan; + else if (First == Second) + return GenericEqual; + return GenericGreaterThan; +} + +static PVOID NTAPI ShimAllocAllocateRoutine(_In_ PRTL_AVL_TABLE Table, _In_ CLONG ByteSize) +{ + return RtlAllocateHeap(g_PrivAllocationHeap, HEAP_ZERO_MEMORY, ByteSize); +} + +static VOID NTAPI ShimAllocFreeRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID Buffer) +{ + RtlFreeHeap(g_PrivAllocationHeap, 0, Buffer); +} + +void SdbpInsertAllocation(PVOID address, SIZE_T size, int line, const char* file) +{ + SHIM_ALLOC_ENTRY Entry = {0}; + + Entry.Address = address; + Entry.Size = size; + Entry.Line = line; + Entry.File = file; + + RtlEnterCriticalSection(&g_SdbpAllocationLock); + RtlInsertElementGenericTableAvl(&g_SdbpAllocationTable, &Entry, sizeof(Entry), NULL); + RtlLeaveCriticalSection(&g_SdbpAllocationLock); +} + +void SdbpUpdateAllocation(PVOID address, PVOID newaddress, SIZE_T size, int line, const char* file) +{ + SHIM_ALLOC_ENTRY Lookup = {0}; + PSHIM_ALLOC_ENTRY Entry; + Lookup.Address = address; + + RtlEnterCriticalSection(&g_SdbpAllocationLock); + Entry = RtlLookupElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup); + + if (address == newaddress) + { + Entry->Size = size; + } + else + { + Lookup.Address = newaddress; + Lookup.Size = size; + Lookup.Line = line; + Lookup.File = file; + Lookup.Prev = address; + RtlInsertElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup, sizeof(Lookup), NULL); + Entry->Next = newaddress; + } + RtlLeaveCriticalSection(&g_SdbpAllocationLock); +} + +static void SdbpPrintSingleAllocation(PSHIM_ALLOC_ENTRY Entry) +{ + DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Entry->File, Entry->Line, + Entry->Next ? "Invalidated " : "", Entry->Prev ? "Re" : "", Entry->Size, Entry->Address); + +} + +void SdbpRemoveAllocation(PVOID address, int line, const char* file) +{ + SHIM_ALLOC_ENTRY Lookup = {0}; + PSHIM_ALLOC_ENTRY Entry; + +#if TRACE_ALL_FREE_CALLS + DbgPrint("\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line); +#endif + + Lookup.Address = address; + RtlEnterCriticalSection(&g_SdbpAllocationLock); + while (Lookup.Address) + { + Entry = RtlLookupElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup); + if (Entry) + { + Lookup = *Entry; + RtlDeleteElementGenericTableAvl(&g_SdbpAllocationTable, Entry); + +#if TRACE_ALL_FREE_CALLS + SdbpPrintSingleAllocation(&Lookup); +#endif + Lookup.Address = Lookup.Prev; + } + else + { + Lookup.Address = NULL; + } + } + RtlLeaveCriticalSection(&g_SdbpAllocationLock); +#if TRACE_ALL_FREE_CALLS + DbgPrint("===============\r\n"); +#endif +} + +void SdbpDebugHeapInit(HANDLE privateHeapPtr) +{ + g_PrivAllocationHeap = privateHeapPtr; + + RtlInitializeCriticalSection(&g_SdbpAllocationLock); + RtlInitializeGenericTableAvl(&g_SdbpAllocationTable, ShimAllocCompareRoutine, + ShimAllocAllocateRoutine, ShimAllocFreeRoutine, NULL); +} + +void SdbpDebugHeapDeinit(void) +{ + if (g_SdbpAllocationTable.NumberGenericTableElements != 0) + { + PSHIM_ALLOC_ENTRY Entry; + + DbgPrint("\r\n===============\r\n===============\r\nSdbpHeapDeinit: Dumping leaks\r\n"); + RtlEnterCriticalSection(&g_SdbpAllocationLock); + Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, TRUE); + + while (Entry) + { + SdbpPrintSingleAllocation(Entry); + Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, FALSE); + } + RtlLeaveCriticalSection(&g_SdbpAllocationLock); + DbgPrint("===============\r\n===============\r\n"); + } + /*__debugbreak();*/ + /*RtlDeleteCriticalSection(&g_SdbpAllocationLock);*/ +} + +#endif Propchange: trunk/reactos/dll/appcompat/apphelp/dbgheap.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav BlaževiÄ - * Copyright 2015-2017 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,6 @@ #include "strsafe.h" #include "apphelp.h" -#include "wine/unicode.h" #define MAX_LAYER_LENGTH 256 #define GPLK_USER 1 @@ -385,8 +384,8 @@ SdbReleaseDatabase(hsdb); return NULL; } - SdbGetAppPatchDir(NULL, buffer, 128); - memcpy(buffer + lstrlenW(buffer), name, SdbpStrsize(name)); + SdbGetAppPatchDir(NULL, buffer, _countof(buffer)); + StringCchCatW(buffer, _countof(buffer), name); flags = HID_DOS_PATHS; } @@ -481,7 +480,7 @@ /* Extract file name */ - file_name = strrchrW(DosApplicationName.String.Buffer, '\\'); + file_name = wcsrchr(DosApplicationName.String.Buffer, '\\'); if (!file_name) { SHIM_ERR("Failed to find Exe name in %wZ.", &DosApplicationName.String); @@ -578,7 +577,7 @@ if (!default_dir) { WCHAR* tmp; - UINT len = GetSystemWindowsDirectoryW(NULL, 0) + lstrlenW(szAppPatch); + UINT len = GetSystemWindowsDirectoryW(NULL, 0) + SdbpStrlen(szAppPatch); tmp = SdbAlloc((len + 1)* sizeof(WCHAR)); if (tmp) { Modified: trunk/reactos/dll/appcompat/apphelp/layer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/laye…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/layer.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -1,5 +1,5 @@ /* - * Copyright 2015 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -159,7 +159,7 @@ FindClose(FindHandle); SdbpResizeTempStr(LongPath, (LongPath->Str.Length >> 1) + 20); StringCbPrintfW(LongPath->Str.Buffer, LongPath->Str.MaximumLength, SIGN_MEDIA_FMT, SignMedia, Scratch.Str.Buffer + 3); - LongPath->Str.Length = (USHORT)wcslen(LongPath->Str.Buffer) * sizeof(WCHAR); + LongPath->Str.Length = (USHORT)SdbpStrlen(LongPath->Str.Buffer) * sizeof(WCHAR); SdbpFreeTempStr(&Scratch); return TRUE; } @@ -217,7 +217,7 @@ return Status; } } - FullPath->MaximumLength = (USHORT)(BasePath.Length + (wcslen(LayersKey) + 1) * sizeof(WCHAR)); + FullPath->MaximumLength = (USHORT)(BasePath.Length + SdbpStrsize(LayersKey)); FullPath->Buffer = SdbAlloc(FullPath->MaximumLength); FullPath->Length = 0; RtlAppendUnicodeStringToString(FullPath, &BasePath); @@ -447,7 +447,7 @@ Status = SdbpOpenKey(&FullKey, bMachine, KEY_SET_VALUE, &KeyHandle); if (NT_SUCCESS(Status)) { - Status = NtSetValueKey(KeyHandle, &LongPath.Str, 0, REG_SZ, (PVOID)wszLayers, (wcslen(wszLayers)+1) * sizeof(WCHAR)); + Status = NtSetValueKey(KeyHandle, &LongPath.Str, 0, REG_SZ, (PVOID)wszLayers, SdbpStrsize(wszLayers)); if (!NT_SUCCESS(Status)) { SHIM_INFO("Failed to write a value to Key \"%wZ\" Status 0x%lx\n", &FullKey, Status); Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -18,15 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#include "windows.h" #include "ntndk.h" #include "strsafe.h" #include "apphelp.h" #include "sdbstringtable.h" -#include "wine/unicode.h" - static const GUID GUID_DATABASE_MSI = {0xd8ff6d16,0x6a3a,0x468a, {0x8b,0x44,0x01,0x71,0x4d,0xdc,0x49,0xea}}; static const GUID GUID_DATABASE_SHIM = {0x11111111,0x1111,0x1111, {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}}; @@ -36,139 +32,30 @@ #if SDBAPI_DEBUG_ALLOC -typedef struct SHIM_ALLOC_ENTRY -{ - PVOID Address; - SIZE_T Size; - int Line; - const char* File; - PVOID Next; - PVOID Prev; -} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY; - -/* FIXME: This is not threadsafe */ -static RTL_AVL_TABLE g_SdbpAllocationTable; - - -static RTL_GENERIC_COMPARE_RESULTS -NTAPI ShimAllocCompareRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID FirstStruct, _In_ PVOID SecondStruct) -{ - PVOID First = ((PSHIM_ALLOC_ENTRY)FirstStruct)->Address; - PVOID Second = ((PSHIM_ALLOC_ENTRY)SecondStruct)->Address; - - if (First < Second) - return GenericLessThan; - else if (First == Second) - return GenericEqual; - return GenericGreaterThan; -} - -static PVOID NTAPI ShimAllocAllocateRoutine(_In_ PRTL_AVL_TABLE Table, _In_ CLONG ByteSize) -{ - return HeapAlloc(SdbpHeap(), HEAP_ZERO_MEMORY, ByteSize); -} - -static VOID NTAPI ShimAllocFreeRoutine(_In_ PRTL_AVL_TABLE Table, _In_ PVOID Buffer) -{ - HeapFree(SdbpHeap(), 0, Buffer); -} - -static void SdbpInsertAllocation(PVOID address, SIZE_T size, int line, const char* file) -{ - SHIM_ALLOC_ENTRY Entry = {0}; - - Entry.Address = address; - Entry.Size = size; - Entry.Line = line; - Entry.File = file; - RtlInsertElementGenericTableAvl(&g_SdbpAllocationTable, &Entry, sizeof(Entry), NULL); -} - -static void SdbpUpdateAllocation(PVOID address, PVOID newaddress, SIZE_T size, int line, const char* file) -{ - SHIM_ALLOC_ENTRY Lookup = {0}; - PSHIM_ALLOC_ENTRY Entry; - Lookup.Address = address; - Entry = RtlLookupElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup); - - if (address == newaddress) - { - Entry->Size = size; - } - else - { - Lookup.Address = newaddress; - Lookup.Size = size; - Lookup.Line = line; - Lookup.File = file; - Lookup.Prev = address; - RtlInsertElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup, sizeof(Lookup), NULL); - Entry->Next = newaddress; - } -} - -static void SdbpRemoveAllocation(PVOID address, int line, const char* file) -{ - SHIM_ALLOC_ENTRY Lookup = {0}; - PSHIM_ALLOC_ENTRY Entry; - - DbgPrint("\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line); - - Lookup.Address = address; - while (Lookup.Address) - { - Entry = RtlLookupElementGenericTableAvl(&g_SdbpAllocationTable, &Lookup); - if (Entry) - { - Lookup = *Entry; - RtlDeleteElementGenericTableAvl(&g_SdbpAllocationTable, Entry); - - DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Lookup.File, Lookup.Line, - Lookup.Next ? "Invalidated " : "", Lookup.Prev ? "Re" : "", Lookup.Size, Lookup.Address); - Lookup.Address = Lookup.Prev; - } - else - { - Lookup.Address = NULL; - } - } - DbgPrint("===============\r\n"); -} +/* dbgheap.c */ +void SdbpInsertAllocation(PVOID address, SIZE_T size, int line, const char* file); +void SdbpUpdateAllocation(PVOID address, PVOID newaddress, SIZE_T size, int line, const char* file); +void SdbpRemoveAllocation(PVOID address, int line, const char* file); +void SdbpDebugHeapInit(HANDLE privateHeapPtr); +void SdbpDebugHeapDeinit(void); #endif static HANDLE g_Heap; void SdbpHeapInit(void) { -#if SDBAPI_DEBUG_ALLOC - RtlInitializeGenericTableAvl(&g_SdbpAllocationTable, ShimAllocCompareRoutine, - ShimAllocAllocateRoutine, ShimAllocFreeRoutine, NULL); -#endif - g_Heap = HeapCreate(0, 0x10000, 0); + g_Heap = RtlCreateHeap(HEAP_GROWABLE, NULL, 0, 0x10000, NULL, NULL); +#if SDBAPI_DEBUG_ALLOC + SdbpDebugHeapInit(g_Heap); +#endif } void SdbpHeapDeinit(void) { #if SDBAPI_DEBUG_ALLOC - if (g_SdbpAllocationTable.NumberGenericTableElements != 0) - { - PSHIM_ALLOC_ENTRY Entry; - - DbgPrint("\r\n===============\r\n===============\r\nSdbpHeapDeinit: Dumping leaks\r\n"); - Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, TRUE); - - while (Entry) - { - DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Entry->File, Entry->Line, - Entry->Next ? "Invalidated " : "", Entry->Prev ? "Re" : "", Entry->Size, Entry->Address); - - Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, FALSE); - } - DbgPrint("===============\r\n===============\r\n"); - } - /*__debugbreak();*/ -#endif - HeapDestroy(g_Heap); + SdbpDebugHeapDeinit(); +#endif + RtlDestroyHeap(g_Heap); } static HANDLE SdbpHeap(void) @@ -182,7 +69,7 @@ #endif ) { - LPVOID mem = HeapAlloc(SdbpHeap(), HEAP_ZERO_MEMORY, size); + LPVOID mem = RtlAllocateHeap(SdbpHeap(), HEAP_ZERO_MEMORY, size); #if SDBAPI_DEBUG_ALLOC SdbpInsertAllocation(mem, size, line, file); #endif @@ -195,7 +82,7 @@ #endif ) { - LPVOID newmem = HeapReAlloc(SdbpHeap(), HEAP_ZERO_MEMORY, mem, size); + LPVOID newmem = RtlReAllocateHeap(SdbpHeap(), HEAP_ZERO_MEMORY, mem, size); #if SDBAPI_DEBUG_ALLOC SdbpUpdateAllocation(mem, newmem, size, line, file); #endif @@ -211,7 +98,7 @@ #if SDBAPI_DEBUG_ALLOC SdbpRemoveAllocation(mem, line, file); #endif - HeapFree(SdbpHeap(), 0, mem); + RtlFreeHeap(SdbpHeap(), 0, mem); } PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write) @@ -228,7 +115,9 @@ return NULL; } else + { RtlInitUnicodeString(&str, path); + } /* SdbAlloc zeroes the memory. */ db = (PDB)SdbAlloc(sizeof(DB)); @@ -268,7 +157,7 @@ DWORD SdbpStrlen(PCWSTR string) { - return lstrlenW(string); + return wcslen(string); } DWORD SdbpStrsize(PCWSTR string) @@ -279,7 +168,7 @@ PWSTR SdbpStrDup(LPCWSTR string) { PWSTR ret = SdbAlloc(SdbpStrsize(string)); - lstrcpyW(ret, string); + wcscpy(ret, string); return ret; } @@ -379,6 +268,7 @@ PDB SdbpOpenDatabase(LPCWSTR path, PATH_TYPE type, PDWORD major, PDWORD minor) { IO_STATUS_BLOCK io; + FILE_STANDARD_INFORMATION fsi; PDB db; NTSTATUS Status; BYTE header[12]; @@ -387,7 +277,15 @@ if (!db) return NULL; - db->size = GetFileSize(db->file, NULL); + Status = NtQueryInformationFile(db->file, &io, &fsi, sizeof(FILE_STANDARD_INFORMATION), FileStandardInformation); + if (!NT_SUCCESS(Status)) + { + SdbCloseDatabase(db); + SHIM_ERR("Failed to get shim database size: 0x%lx\n", Status); + return NULL; + } + + db->size = fsi.EndOfFile.u.LowPart; db->data = SdbAlloc(db->size); Status = NtReadFile(db->file, NULL, NULL, NULL, &io, db->data, db->size, NULL, NULL); @@ -597,7 +495,7 @@ if (tmp != TAGID_NULL) { LPCWSTR name = SdbGetStringTagPtr(db, tmp); - if (name && !lstrcmpiW(name, find_name)) + if (name && !wcsicmp(name, find_name)) return iter; } iter = SdbFindNextTag(db, root, iter); Modified: trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbf…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -20,13 +20,11 @@ #define WIN32_NO_STATUS #include "windef.h" -#include "winbase.h" #include "apphelp.h" -#include "imagehlp.h" +#include "strsafe.h" #include "winver.h" #include "rtlfuncs.h" -#include "wine/unicode.h" #define NUM_ATTRIBUTES 28 enum APPHELP_MODULETYPE @@ -79,7 +77,7 @@ if (!file_info) return NULL; - snprintfW(value, 128, translation, attr); + StringCchPrintfW(value, ARRAYSIZE(value), translation, attr); if (VerQueryValueW(file_info, value, &buffer, &size) && size != 0) return (WCHAR*)buffer; @@ -309,7 +307,7 @@ file_info = SdbAlloc(info_size); GetFileVersionInfoW(path, 0, info_size, file_info); VerQueryValueW(file_info, str_tinfo, (LPVOID)&lang_page, &page_size); - snprintfW(translation, 128, str_trans, lang_page->language, lang_page->code_page); + StringCchPrintfW(translation, ARRAYSIZE(translation), str_trans, lang_page->language, lang_page->code_page); } /* Handles 2, 3, 12, 13, 14, 15, 21, 22 */ Modified: trunk/reactos/dll/appcompat/apphelp/sdbread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbr…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbread.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbread.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav Blaevic - * Copyright 2015,2016 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,10 +19,7 @@ */ #include "windef.h" -#include "winbase.h" #include "apphelp.h" - -#include "wine/unicode.h" DWORD WINAPI SdbGetTagDataSize(PDB db, TAGID tagid); Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Fri Jul 28 19:00:27 2017 @@ -20,7 +20,7 @@ #if !defined(SDBWRITE_HOSTTOOL) #define WIN32_NO_STATUS -#include "windows.h" +#include "windef.h" #include "ntndk.h" #else #include <typedefs.h>
7 years, 4 months
1
0
0
0
[ssawant] 75431: [STOBJECT] -Added hotplug.cpp for handling removable devices notification icon. -Modified CMakeLists.txt et al to plugin this hotplug to stobject. -Added basic code to test the hot...
by ssawant@svn.reactos.org
Author: ssawant Date: Fri Jul 28 17:33:38 2017 New Revision: 75431 URL:
http://svn.reactos.org/svn/reactos?rev=75431&view=rev
Log: [STOBJECT] -Added hotplug.cpp for handling removable devices notification icon. -Modified CMakeLists.txt et al to plugin this hotplug to stobject. -Added basic code to test the hotplug icon and integrate it with stobject. -Tested in xpvm, needs further testing. Added: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/hotplug.cpp (with props) Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/CMakeLists.txt branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/csystray.cpp branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/precomp.h Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/CMakeLists.txt [iso-8859-1] Fri Jul 28 17:33:38 2017 @@ -23,6 +23,7 @@ stobject.rc power.cpp volume.cpp + hotplug.cpp ${CMAKE_CURRENT_BINARY_DIR}/stobject.def) set_module_type(stobject win32dll UNICODE) Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/csystray.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/csystray.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/csystray.cpp [iso-8859-1] Fri Jul 28 17:33:38 2017 @@ -12,7 +12,8 @@ SysTrayIconHandlers_t g_IconHandlers [] = { { Volume_Init, Volume_Shutdown, Volume_Update, Volume_Message }, - { Power_Init, Power_Shutdown, Power_Update, Power_Message } + { Power_Init, Power_Shutdown, Power_Update, Power_Message }, + { Hotplug_Init, Hotplug_Shutdown, Hotplug_Update, Hotplug_Message } }; const int g_NumIcons = _countof(g_IconHandlers); Added: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/hotplug.cpp URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/hotplug.cpp (added) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/hotplug.cpp [iso-8859-1] Fri Jul 28 17:33:38 2017 @@ -0,0 +1,137 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/shellext/stobject/hotplug.cpp + * PURPOSE: Removable devices notification icon handler + * PROGRAMMERS: Shriraj Sawant a.k.a SR13 <sr.official(a)hotmail.com> + */ + +#include "precomp.h" +#include <mmsystem.h> +#include <mmddk.h> +#include <atlstr.h> + +WINE_DEFAULT_DEBUG_CHANNEL(stobject); + +static HICON g_hIconHotplug = NULL; +static LPWSTR g_strTooltip = L"Safely Remove Hardware and Eject Media"; +static BOOL g_IsRunning = FALSE; + +HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray * pSysTray) +{ + TRACE("Hotplug_Init\n"); + g_hIconHotplug = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_EXTRACT)); + g_IsRunning = TRUE; + + return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip); +} + +HRESULT STDMETHODCALLTYPE Hotplug_Update(_In_ CSysTray * pSysTray) +{ + TRACE("Hotplug_Update\n"); + //g_hIconHotplug = DynamicLoadIcon(g_hInstance); + + return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_HOTPLUG, g_hIconHotplug, g_strTooltip); +} + +HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray * pSysTray) +{ + TRACE("Hotplug_Shutdown\n"); + g_IsRunning = FALSE; + + return pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_HOTPLUG, NULL, NULL); +} + +static void _RunHotplug() +{ + ShellExecuteW(NULL, NULL, L"hotplug.cpl", NULL, NULL, SW_SHOWNORMAL); +} + +static void _ShowContextMenu(CSysTray * pSysTray) +{ + CString strOpen((LPCSTR)IDS_HOTPLUG_REMOVE_2); + HMENU hPopup = CreatePopupMenu(); + AppendMenuW(hPopup, MF_STRING, IDS_HOTPLUG_REMOVE_2, strOpen); + + SetForegroundWindow(pSysTray->GetHWnd()); + DWORD flags = TPM_RETURNCMD | TPM_NONOTIFY | TPM_RIGHTALIGN | TPM_BOTTOMALIGN; + POINT pt; + GetCursorPos(&pt); + + DWORD id = TrackPopupMenuEx(hPopup, flags, + pt.x, pt.y, + pSysTray->GetHWnd(), NULL); + + switch (id) + { + case IDS_HOTPLUG_REMOVE_2: + _RunHotplug(); + break; + } + DestroyMenu(hPopup); +} + +HRESULT STDMETHODCALLTYPE Hotplug_Message(_In_ CSysTray * pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult) +{ + TRACE("Hotplug_Message uMsg=%d, wParam=%x, lParam=%x\n", uMsg, wParam, lParam); + + switch (uMsg) + { + case WM_USER + 220: + TRACE("Hotplug_Message: WM_USER+220\n"); + if (wParam == 1) + { + if (lParam == FALSE) + return Hotplug_Init(pSysTray); + else + return Hotplug_Shutdown(pSysTray); + } + return S_FALSE; + + case WM_USER + 221: + TRACE("Hotplug_Message: WM_USER+221\n"); + if (wParam == 1) + { + lResult = (LRESULT)g_IsRunning; + return S_OK; + } + return S_FALSE; + + case ID_ICON_HOTPLUG: + Hotplug_Update(pSysTray); + + switch (lParam) + { + case WM_LBUTTONDOWN: + break; + + case WM_LBUTTONUP: + MessageBox(0, L"Safely Remove Hardware", L"Test", MB_OKCANCEL | MB_ICONINFORMATION); + break; + + case WM_LBUTTONDBLCLK: + _RunHotplug(); + break; + + case WM_RBUTTONDOWN: + break; + + case WM_RBUTTONUP: + _ShowContextMenu(pSysTray); + break; + + case WM_RBUTTONDBLCLK: + break; + + case WM_MOUSEMOVE: + break; + } + return S_OK; + + default: + TRACE("Hotplug_Message received for unknown ID %d, ignoring.\n"); + return S_FALSE; + } + + return S_FALSE; +} Propchange: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/hotplug.cpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/precomp.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/shellext/reactos/dll/…
============================================================================== --- branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/precomp.h [iso-8859-1] (original) +++ branches/GSoC_2017/shellext/reactos/dll/shellext/stobject/precomp.h [iso-8859-1] Fri Jul 28 17:33:38 2017 @@ -40,6 +40,7 @@ #define ID_ICON_VOLUME (WM_APP + 0x4CB) #define ID_ICON_POWER (WM_APP + 0x4CC) +#define ID_ICON_HOTPLUG (WM_APP + 0x4CD) #include "csystray.h" @@ -70,3 +71,8 @@ extern HRESULT STDMETHODCALLTYPE Power_Shutdown(_In_ CSysTray * pSysTray); extern HRESULT STDMETHODCALLTYPE Power_Update(_In_ CSysTray * pSysTray); extern HRESULT STDMETHODCALLTYPE Power_Message(_In_ CSysTray * pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult); + +extern HRESULT STDMETHODCALLTYPE Hotplug_Init(_In_ CSysTray * pSysTray); +extern HRESULT STDMETHODCALLTYPE Hotplug_Shutdown(_In_ CSysTray * pSysTray); +extern HRESULT STDMETHODCALLTYPE Hotplug_Update(_In_ CSysTray * pSysTray); +extern HRESULT STDMETHODCALLTYPE Hotplug_Message(_In_ CSysTray * pSysTray, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult);
7 years, 4 months
1
0
0
0
[gadamopoulos] 75430: [EXPLORER] -Implement changing the size of the icons in the notification area when the non client metrics change. Now they always have the size of the title bar icon. Center v...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Jul 28 10:04:38 2017 New Revision: 75430 URL:
http://svn.reactos.org/svn/reactos?rev=75430&view=rev
Log: [EXPLORER] -Implement changing the size of the icons in the notification area when the non client metrics change. Now they always have the size of the title bar icon. Center vertically or horizontally the notification area in the taskbar. Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp trunk/reactos/base/shell/explorer/traywnd.cpp Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traynt…
============================================================================== --- trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] Fri Jul 28 10:04:38 2017 @@ -36,8 +36,6 @@ class CNotifyToolbar : public CWindowImplBaseT< CToolbar<NOTIFYICONDATA>, CControlWinTraits > { - static const int ICON_SIZE = 16; - HIMAGELIST m_ImageList; int m_VisibleButtonCount; @@ -110,6 +108,7 @@ if (iconData->uFlags & NIF_ICON) { + notifyItem->hIcon = (HICON)CopyImage(iconData->hIcon, IMAGE_ICON, 0, 0, 0); tbBtn.iBitmap = ImageList_AddIcon(m_ImageList, iconData->hIcon); } @@ -133,7 +132,7 @@ /* TODO: support NIF_INFO, NIF_GUID, NIF_REALTIME, NIF_SHOWTIP */ CToolbar::AddButton(&tbBtn); - SetButtonSize(ICON_SIZE, ICON_SIZE); + SetButtonSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); return TRUE; } @@ -160,6 +159,8 @@ if (iconData->uFlags & NIF_ICON) { + DestroyIcon(notifyItem->hIcon); + notifyItem->hIcon = (HICON)CopyImage(iconData->hIcon, IMAGE_ICON, 0, 0, 0); tbbi.dwMask |= TBIF_IMAGE; tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, index, iconData->hIcon); } @@ -211,6 +212,8 @@ m_VisibleButtonCount--; } + DestroyIcon(notifyItem->hIcon); + delete notifyItem; ImageList_Remove(m_ImageList, index); @@ -241,6 +244,37 @@ { StringCchCopy(szTip, cchTip, notifyItem->szTip); } + } + + VOID ResizeImagelist() + { + int cx, cy; + HIMAGELIST iml; + + if (!ImageList_GetIconSize(m_ImageList, &cx, &cy)) + return; + + if (cx == GetSystemMetrics(SM_CXSMICON) && cy == GetSystemMetrics(SM_CYSMICON)) + return; + + iml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 1000); + if (!iml) + return; + + ImageList_Destroy(m_ImageList); + m_ImageList = iml; + SetImageList(m_ImageList); + + int count = GetButtonCount(); + for (int i = 0; i < count; i++) + { + NOTIFYICONDATA * data = GetItemData(i); + INT iIcon = ImageList_AddIcon(iml, data->hIcon); + TBBUTTONINFO tbbi = { sizeof(tbbi), TBIF_BYINDEX | TBIF_IMAGE, 0, iIcon}; + SetButtonInfo(i, &tbbi); + } + + SetButtonSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); } private: @@ -402,10 +436,18 @@ SetWindowTheme(m_hWnd, L"TrayNotify", NULL); - m_ImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); + m_ImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 1000); SetImageList(m_ImageList); - SetButtonSize(ICON_SIZE, ICON_SIZE); + TBMETRICS tbm = {sizeof(tbm)}; + tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING | TBMF_PAD; + tbm.cxPad = 1; + tbm.cyPad = 1; + tbm.cxButtonSpacing = 1; + tbm.cyButtonSpacing = 1; + SetMetrics(&tbm); + + SetButtonSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); } }; @@ -500,25 +542,39 @@ return TRUE; } - void GetSize(IN WPARAM wParam, IN PSIZE size) - { + void GetSize(IN BOOL IsHorizontal, IN PSIZE size) + { + /* Get the ideal height or width */ +#if 0 + /* Unfortunately this doens't work correctly in ros */ + Toolbar.GetIdealSize(!IsHorizontal, size); + + /* Make the reference dimension an exact multiple of the icon size */ + if (IsHorizontal) + size->cy -= size->cy % GetSystemMetrics(SM_CYSMICON); + else + size->cx -= size->cx % GetSystemMetrics(SM_CXSMICON); + +#else INT rows = 0; + INT columns = 0; + INT cyButton = GetSystemMetrics(SM_CYSMICON) + 2; + INT cxButton = GetSystemMetrics(SM_CXSMICON) + 2; int VisibleButtonCount = Toolbar.GetVisibleButtonCount(); - if (wParam) /* horizontal */ - { - rows = size->cy / 24; - if (rows == 0) - rows++; - size->cx = (VisibleButtonCount + rows - 1) / rows * 24; + if (IsHorizontal) + { + rows = max(size->cy / cyButton, 1); + columns = max((VisibleButtonCount + rows) / rows, 1); } else { - rows = size->cx / 24; - if (rows == 0) - rows++; - size->cy = (VisibleButtonCount + rows - 1) / rows * 24; - } + columns = max(size->cx / cxButton, 1); + rows = max((VisibleButtonCount + columns) / columns, 1); + } + size->cx = columns * cxButton; + size->cy = rows * cyButton; +#endif } LRESULT OnGetInfoTip(INT uCode, LPNMHDR hdr, BOOL& bHandled) @@ -553,15 +609,6 @@ if (Toolbar) { - TBMETRICS tbm; - tbm.cbSize = sizeof(tbm); - tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; - tbm.cxBarPad = tbm.cyBarPad = 0; - tbm.cxButtonSpacing = 0; - tbm.cyButtonSpacing = 0; - - Toolbar.SetMetrics(&tbm); - Toolbar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER); Toolbar.AutoSize(); @@ -582,6 +629,11 @@ { bHandled = TRUE; return 0; + } + + void ResizeImagelist() + { + Toolbar.ResizeImagelist(); } DECLARE_WND_CLASS_EX(szSysPagerWndClass, CS_DBLCLKS, COLOR_3DFACE) @@ -1239,8 +1291,8 @@ static const WCHAR szTrayNotifyWndClass [] = TEXT("TrayNotifyWnd"); -#define TRAY_NOTIFY_WND_SPACING_X 2 -#define TRAY_NOTIFY_WND_SPACING_Y 2 +#define TRAY_NOTIFY_WND_SPACING_X 1 +#define TRAY_NOTIFY_WND_SPACING_Y 1 class CTrayNotifyWnd : public CComObjectRootEx<CComMultiThreadModelNoCS>, @@ -1430,19 +1482,23 @@ szClock.cy, SWP_NOZORDER); + POINT ptPager; + if (IsHorizontal) { - ptClock.x -= szTrayNotify.cx; + ptPager.x = ptClock.x - szTrayNotify.cx; + ptPager.y = (pszClient->cy - szTrayNotify.cy)/2; } else { - ptClock.y -= szTrayNotify.cy; + ptPager.x = (pszClient->cx - szTrayNotify.cx)/2; + ptPager.y = ptClock.y - szTrayNotify.cy; } m_pager->SetWindowPos( NULL, - ptClock.x, - ptClock.y, + ptPager.x, + ptPager.y, szTrayNotify.cx, szTrayNotify.cy, SWP_NOZORDER); @@ -1586,12 +1642,22 @@ return 0; } + LRESULT OnSettingChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + if (wParam == SPI_SETNONCLIENTMETRICS) + { + m_pager->ResizeImagelist(); + } + return 0; + } + DECLARE_WND_CLASS_EX(szTrayNotifyWndClass, CS_DBLCLKS, COLOR_3DFACE) BEGIN_MSG_MAP(CTrayNotifyWnd) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) + MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChanged) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) MESSAGE_HANDLER(WM_NOTIFY, OnNotify) Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywn…
============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Fri Jul 28 10:04:38 2017 @@ -2241,6 +2241,7 @@ { if (wParam == SPI_SETNONCLIENTMETRICS) { + SendMessage(m_TrayNotify, uMsg, wParam, lParam); SendMessage(m_TaskSwitch, uMsg, wParam, lParam); UpdateFonts(); AlignControls(NULL); @@ -2457,6 +2458,8 @@ InSizeMove = FALSE; if (!Locked) { + FitToRebar(&m_TrayRects[m_Position]); + /* Apply clipping */ PostMessage(WM_SIZE, SIZE_RESTORED, 0); }
7 years, 4 months
1
0
0
0
[mjansen] 75429: [APPHELP] Use DbgPrint instead of OutputDebugString + fix SDBAPI_DEBUG_ALLOC
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Jul 27 20:36:51 2017 New Revision: 75429 URL:
http://svn.reactos.org/svn/reactos?rev=75429&view=rev
Log: [APPHELP] Use DbgPrint instead of OutputDebugString + fix SDBAPI_DEBUG_ALLOC Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt trunk/reactos/dll/appcompat/apphelp/apphelp.c trunk/reactos/dll/appcompat/apphelp/sdbapi.c trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c trunk/reactos/dll/appcompat/apphelp/sdbwrite.c Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMak…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] Thu Jul 27 20:36:51 2017 @@ -3,6 +3,7 @@ remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502) add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601) +#add_definitions(-DSDBAPI_DEBUG_ALLOC) spec2def(apphelp.dll apphelp.spec ADD_IMPORTLIB) Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] Thu Jul 27 20:36:51 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav BlaževiÄ - * Copyright 2015-2017 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -152,7 +152,7 @@ #if defined(APPCOMPAT_USE_DBGPRINTEX) && APPCOMPAT_USE_DBGPRINTEX return NT_SUCCESS(DbgPrintEx(DPFLTR_APPCOMPAT_ID, Level, "%s", Buffer)); #else - OutputDebugStringA(Buffer); + DbgPrint("%s", Buffer); return TRUE; #endif } Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Thu Jul 27 20:36:51 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav BlaževiÄ - * Copyright 2015,2016 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -46,7 +46,7 @@ PVOID Prev; } SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY; - +/* FIXME: This is not threadsafe */ static RTL_AVL_TABLE g_SdbpAllocationTable; @@ -109,12 +109,10 @@ static void SdbpRemoveAllocation(PVOID address, int line, const char* file) { - char buf[512]; SHIM_ALLOC_ENTRY Lookup = {0}; PSHIM_ALLOC_ENTRY Entry; - sprintf(buf, "\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line); - OutputDebugStringA(buf); + DbgPrint("\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line); Lookup.Address = address; while (Lookup.Address) @@ -125,9 +123,8 @@ Lookup = *Entry; RtlDeleteElementGenericTableAvl(&g_SdbpAllocationTable, Entry); - sprintf(buf, " > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Lookup.File, Lookup.Line, + DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Lookup.File, Lookup.Line, Lookup.Next ? "Invalidated " : "", Lookup.Prev ? "Re" : "", Lookup.Size, Lookup.Address); - OutputDebugStringA(buf); Lookup.Address = Lookup.Prev; } else @@ -135,8 +132,7 @@ Lookup.Address = NULL; } } - sprintf(buf, "\r\n===============\r\n"); - OutputDebugStringA(buf); + DbgPrint("===============\r\n"); } #endif @@ -155,7 +151,22 @@ { #if SDBAPI_DEBUG_ALLOC if (g_SdbpAllocationTable.NumberGenericTableElements != 0) - __debugbreak(); + { + PSHIM_ALLOC_ENTRY Entry; + + DbgPrint("\r\n===============\r\n===============\r\nSdbpHeapDeinit: Dumping leaks\r\n"); + Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, TRUE); + + while (Entry) + { + DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Entry->File, Entry->Line, + Entry->Next ? "Invalidated " : "", Entry->Prev ? "Re" : "", Entry->Size, Entry->Address); + + Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, FALSE); + } + DbgPrint("===============\r\n===============\r\n"); + } + /*__debugbreak();*/ #endif HeapDestroy(g_Heap); } @@ -267,7 +278,7 @@ PWSTR SdbpStrDup(LPCWSTR string) { - PWSTR ret = SdbpAlloc(SdbpStrsize(string)); + PWSTR ret = SdbAlloc(SdbpStrsize(string)); lstrcpyW(ret, string); return ret; } Modified: trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbf…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] Thu Jul 27 20:36:51 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav Blaevic - * Copyright 2015 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -97,7 +97,7 @@ attr->type = tag; attr->flags = ATTRIBUTE_AVAILABLE; - dest = attr->lpattr = SdbpAlloc((len+1) * sizeof(WCHAR)); + dest = attr->lpattr = SdbAlloc((len+1) * sizeof(WCHAR)); while (len--) *(dest++) = *(string++); *dest = 0; Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Thu Jul 27 20:36:51 2017 @@ -1,7 +1,7 @@ /* * Copyright 2011 André Hentschel * Copyright 2013 Mislav BlaževiÄ - * Copyright 2015,2016 Mark Jansen + * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -62,7 +62,7 @@ PDB buf = db->string_buffer; if (db->string_buffer == NULL) { - db->string_buffer = buf = SdbpAlloc(sizeof(DB)); + db->string_buffer = buf = SdbAlloc(sizeof(DB)); if (buf == NULL) return FALSE; buf->size = 128;
7 years, 4 months
1
0
0
0
[tthompson] 75428: [NTFS] - Add some improvements to B-Tree support. Add preliminary support for trees of arbitrary depth. Add support for creating files in directories which have an index allocati...
by tthompson@svn.reactos.org
Author: tthompson Date: Thu Jul 27 19:52:33 2017 New Revision: 75428 URL:
http://svn.reactos.org/svn/reactos?rev=75428&view=rev
Log: [NTFS] - Add some improvements to B-Tree support. Add preliminary support for trees of arbitrary depth. Add support for creating files in directories which have an index allocation, provided there aren't too many files and the node doesn't need to be split. -CreateBTreeFromIndex() - Fix memory allocation; allocate sizeof(B_TREE_KEY) bytes for the key, not the size of the pointer. Add support for child nodes. Update parameter list. -CreateIndexRootFromBTree() - Update Header->Flags if any of index root's keys have sub-nodes. +CreateIndexBufferFromBTreeNode() - Converts a B-Tree node to an index buffer to be written to the index allocation. +UpdateIndexAllocation() - Updates all of the stale nodes in an index allocation based on a PB_TREE. +UpdateIndexNode() - Writes a B-Tree node into the index allocation. +CreateBTreeKeyFromFilename() - Creates a PB_TREE_KEY based on a FILENAME_ATTRIBUTE. -DestroyBTreeKey() - Destroy a child node, if present. -DumpBTreeKey() - Dump a child node, if present. -DumpBTreeNode() - Include Node->KeyCount in output. -NtfsAddFilenameToDirectory() - Call UpdateIndexAllocation() prior to CreateIndexRootFromBTree(). -Update B_TREE_FILENAME_NODE with members to keep track of its existence on disk. Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c [iso-8859-1] Thu Jul 27 19:52:33 2017 @@ -42,12 +42,13 @@ ULONGLONG CurrentOffset = 0; PINDEX_BUFFER CurrentNode, Buffer; ULONGLONG BufferSize = AttributeDataLength(&IndexAllocationContext->Record); + ULONG BytesRead; ULONGLONG i; int Count = 0; Buffer = ExAllocatePoolWithTag(NonPagedPool, BufferSize, TAG_NTFS); - ULONG BytesRead = ReadAttribute(Vcb, IndexAllocationContext, 0, (PCHAR)Buffer, BufferSize); + BytesRead = ReadAttribute(Vcb, IndexAllocationContext, 0, (PCHAR)Buffer, BufferSize); ASSERT(BytesRead = BufferSize); @@ -150,6 +151,175 @@ } return Comparison; +} + +PB_TREE_FILENAME_NODE +CreateBTreeNodeFromIndexNode(PDEVICE_EXTENSION Vcb, + PINDEX_ROOT_ATTRIBUTE IndexRoot, + PNTFS_ATTR_CONTEXT IndexAllocationAttributeCtx, + PINDEX_ENTRY_ATTRIBUTE NodeEntry) +{ + PB_TREE_FILENAME_NODE NewNode; + PINDEX_ENTRY_ATTRIBUTE CurrentNodeEntry; + PINDEX_ENTRY_ATTRIBUTE FirstNodeEntry; + ULONG CurrentEntryOffset = 0; + PINDEX_BUFFER NodeBuffer; + ULONG IndexBufferSize = Vcb->NtfsInfo.BytesPerIndexRecord; + PULONGLONG NodeNumber; + PB_TREE_KEY CurrentKey; + NTSTATUS Status; + ULONGLONG IndexNodeOffset; + ULONG BytesRead; + + if (IndexAllocationAttributeCtx == NULL) + { + DPRINT1("ERROR: Couldn't find index allocation attribute even though there should be one!\n"); + return NULL; + } + + // Get the node number from the end of the node entry + NodeNumber = (PULONGLONG)((ULONG_PTR)NodeEntry + NodeEntry->Length - sizeof(ULONGLONG)); + + // Create the new tree node + DPRINT1("About to allocate %ld for NewNode\n", sizeof(B_TREE_FILENAME_NODE)); + NewNode = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_FILENAME_NODE), TAG_NTFS); + if (!NewNode) + { + DPRINT1("ERROR: Couldn't allocate memory for new filename node.\n"); + return NULL; + } + RtlZeroMemory(NewNode, sizeof(B_TREE_FILENAME_NODE)); + + // Create the first key + CurrentKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); + if (!CurrentKey) + { + DPRINT1("ERROR: Failed to allocate memory for key!\n"); + ExFreePoolWithTag(NewNode, TAG_NTFS); + return NULL; + } + RtlZeroMemory(CurrentKey, sizeof(B_TREE_KEY)); + NewNode->FirstKey = CurrentKey; + + // Allocate memory for the node buffer + NodeBuffer = ExAllocatePoolWithTag(NonPagedPool, IndexBufferSize, TAG_NTFS); + if (!NodeBuffer) + { + DPRINT1("ERROR: Couldn't allocate memory for node buffer!\n"); + ExFreePoolWithTag(CurrentKey, TAG_NTFS); + ExFreePoolWithTag(NewNode, TAG_NTFS); + return NULL; + } + + // Calculate offset into index allocation + IndexNodeOffset = GetAllocationOffsetFromVCN(Vcb, IndexBufferSize, *NodeNumber); + + // TODO: Confirm index bitmap has this node marked as in-use + + // Read the node + BytesRead = ReadAttribute(Vcb, + IndexAllocationAttributeCtx, + IndexNodeOffset, + (PCHAR)NodeBuffer, + IndexBufferSize); + + ASSERT(BytesRead == IndexBufferSize); + NT_ASSERT(NodeBuffer->Ntfs.Type == NRH_INDX_TYPE); + NT_ASSERT(NodeBuffer->VCN == *NodeNumber); + + // Apply the fixup array to the node buffer + Status = FixupUpdateSequenceArray(Vcb, &NodeBuffer->Ntfs); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ERROR: Couldn't apply fixup array to index node buffer!\n"); + ExFreePoolWithTag(NodeBuffer, TAG_NTFS); + ExFreePoolWithTag(CurrentKey, TAG_NTFS); + ExFreePoolWithTag(NewNode, TAG_NTFS); + return NULL; + } + + // Walk through the index and create keys for all the entries + FirstNodeEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)(&NodeBuffer->Header) + + NodeBuffer->Header.FirstEntryOffset); + CurrentNodeEntry = FirstNodeEntry; + while (CurrentEntryOffset < NodeBuffer->Header.TotalSizeOfEntries) + { + // Allocate memory for the current entry + CurrentKey->IndexEntry = ExAllocatePoolWithTag(NonPagedPool, CurrentNodeEntry->Length, TAG_NTFS); + if (!CurrentKey->IndexEntry) + { + DPRINT1("ERROR: Couldn't allocate memory for next key!\n"); + DestroyBTreeNode(NewNode); + ExFreePoolWithTag(NodeBuffer, TAG_NTFS); + return NULL; + } + + NewNode->KeyCount++; + + // If this isn't the last entry + if (!(CurrentNodeEntry->Flags & NTFS_INDEX_ENTRY_END)) + { + // Create the next key + PB_TREE_KEY NextKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); + if (!NextKey) + { + DPRINT1("ERROR: Couldn't allocate memory for next key!\n"); + DestroyBTreeNode(NewNode); + ExFreePoolWithTag(NodeBuffer, TAG_NTFS); + return NULL; + } + RtlZeroMemory(NextKey, sizeof(B_TREE_KEY)); + + // Add NextKey to the end of the list + CurrentKey->NextKey = NextKey; + + // Copy the current entry to its key + RtlCopyMemory(CurrentKey->IndexEntry, CurrentNodeEntry, CurrentNodeEntry->Length); + + // See if the current key has a sub-node + if (CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE) + { + DPRINT1("TODO: Only a node with a single-level is supported right now!\n"); + // Needs debugging: + /*CurrentKey->LesserChild = CreateBTreeNodeFromIndexNode(Vcb, + IndexRoot, + IndexAllocationAttributeCtx, + CurrentNodeEntry);*/ + } + + CurrentKey = NextKey; + } + else + { + // Copy the final entry to its key + RtlCopyMemory(CurrentKey->IndexEntry, CurrentNodeEntry, CurrentNodeEntry->Length); + CurrentKey->NextKey = NULL; + + // See if the current key has a sub-node + if (CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE) + { + DPRINT1("TODO: Only a node with a single-level is supported right now!\n"); + // Needs debugging: + /*CurrentKey->LesserChild = CreateBTreeNodeFromIndexNode(Vcb, + IndexRoot, + IndexAllocationAttributeCtx, + CurrentNodeEntry);*/ + } + + break; + } + + // Advance to the next entry + CurrentEntryOffset += CurrentNodeEntry->Length; + CurrentNodeEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)CurrentNodeEntry + CurrentNodeEntry->Length); + } + + NewNode->NodeNumber = *NodeNumber; + NewNode->ExistsOnDisk = TRUE; + + ExFreePoolWithTag(NodeBuffer, TAG_NTFS); + + return NewNode; } /** @@ -172,7 +342,10 @@ * Allocates memory for the entire tree. Caller is responsible for destroying the tree with DestroyBTree(). */ NTSTATUS -CreateBTreeFromIndex(PNTFS_ATTR_CONTEXT IndexRootContext, +CreateBTreeFromIndex(PDEVICE_EXTENSION Vcb, + PFILE_RECORD_HEADER FileRecordWithIndex, + /*PCWSTR IndexName,*/ + PNTFS_ATTR_CONTEXT IndexRootContext, PINDEX_ROOT_ATTRIBUTE IndexRoot, PB_TREE *NewTree) { @@ -181,8 +354,10 @@ PB_TREE_FILENAME_NODE RootNode = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_FILENAME_NODE), TAG_NTFS); PB_TREE_KEY CurrentKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); ULONG CurrentOffset = IndexRoot->Header.FirstEntryOffset; - - DPRINT1("CreateBTreeFromIndex(%p, %p, %p)\n", IndexRootContext, IndexRoot, NewTree); + PNTFS_ATTR_CONTEXT IndexAllocationContext = NULL; + NTSTATUS Status; + + DPRINT1("CreateBTreeFromIndex(%p, %p)\n", IndexRoot, NewTree); if (!Tree || !RootNode || !CurrentKey) { @@ -200,6 +375,19 @@ RtlZeroMemory(RootNode, sizeof(B_TREE_FILENAME_NODE)); RtlZeroMemory(CurrentKey, sizeof(B_TREE_KEY)); + // See if the file record has an attribute allocation + Status = FindAttribute(Vcb, + FileRecordWithIndex, + AttributeIndexAllocation, + L"$I30", + 4, + &IndexAllocationContext, + NULL); + if (!NT_SUCCESS(Status)) + IndexAllocationContext = NULL; + else + PrintAllVCNs(Vcb, IndexAllocationContext, IndexRoot->SizeOfEntry); + // Setup the Tree RootNode->FirstKey = CurrentKey; Tree->RootNode = RootNode; @@ -235,7 +423,7 @@ if (!(CurrentNodeEntry->Flags & NTFS_INDEX_ENTRY_END)) { // Create the next key - PB_TREE_KEY NextKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(PB_TREE_KEY), TAG_NTFS); + PB_TREE_KEY NextKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); if (!NextKey) { DPRINT1("ERROR: Couldn't allocate memory for next key!\n"); @@ -243,7 +431,7 @@ return STATUS_INSUFFICIENT_RESOURCES; } - RtlZeroMemory(NextKey, sizeof(PB_TREE_KEY)); + RtlZeroMemory(NextKey, sizeof(B_TREE_KEY)); // Add NextKey to the end of the list CurrentKey->NextKey = NextKey; @@ -251,12 +439,20 @@ // Copy the current entry to its key RtlCopyMemory(CurrentKey->IndexEntry, CurrentNodeEntry, CurrentNodeEntry->Length); - // Make sure this B-Tree is only one level deep (flat list) + // Does this key have a sub-node? if (CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE) { - DPRINT1("TODO: Only directories with single-level B-Trees are supported right now!\n"); - DestroyBTree(Tree); - return STATUS_NOT_IMPLEMENTED; + // Create the child node + CurrentKey->LesserChild = CreateBTreeNodeFromIndexNode(Vcb, + IndexRoot, + IndexAllocationContext, + CurrentKey->IndexEntry); + if (!CurrentKey->LesserChild) + { + DPRINT1("ERROR: Couldn't create child node!\n"); + DestroyBTree(Tree); + return STATUS_NOT_IMPLEMENTED; + } } // Advance to the next entry @@ -270,12 +466,20 @@ RtlCopyMemory(CurrentKey->IndexEntry, CurrentNodeEntry, CurrentNodeEntry->Length); CurrentKey->NextKey = NULL; - // Make sure this B-Tree is only one level deep (flat list) + // Does this key have a sub-node? if (CurrentKey->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE) { - DPRINT1("TODO: Only directories with single-level B-Trees are supported right now!\n"); - DestroyBTree(Tree); - return STATUS_NOT_IMPLEMENTED; + // Create the child node + CurrentKey->LesserChild = CreateBTreeNodeFromIndexNode(Vcb, + IndexRoot, + IndexAllocationContext, + CurrentKey->IndexEntry); + if (!CurrentKey->LesserChild) + { + DPRINT1("ERROR: Couldn't create child node!\n"); + DestroyBTree(Tree); + return STATUS_NOT_IMPLEMENTED; + } } break; @@ -283,6 +487,9 @@ } *NewTree = Tree; + + if (IndexAllocationContext) + ReleaseAttributeContext(IndexAllocationContext); return STATUS_SUCCESS; } @@ -387,6 +594,10 @@ CurrentNodeEntry->KeyLength, CurrentNodeEntry->Length); + // Does the current key have any sub-nodes? + if (CurrentKey->LesserChild) + NewIndexRoot->Header.Flags = INDEX_ROOT_LARGE; + // Add Length of Current Entry to Total Size of Entries NewIndexRoot->Header.TotalSizeOfEntries += CurrentNodeEntry->Length; @@ -404,13 +615,253 @@ return STATUS_SUCCESS; } +NTSTATUS +CreateIndexBufferFromBTreeNode(PDEVICE_EXTENSION DeviceExt, + PB_TREE_FILENAME_NODE Node, + ULONG BufferSize, + PINDEX_BUFFER IndexBuffer) +{ + ULONG i; + PB_TREE_KEY CurrentKey; + PINDEX_ENTRY_ATTRIBUTE CurrentNodeEntry; + NTSTATUS Status; + + // TODO: Fix magic, do math + RtlZeroMemory(IndexBuffer, BufferSize); + IndexBuffer->Ntfs.Type = NRH_INDX_TYPE; + IndexBuffer->Ntfs.UsaOffset = 0x28; + IndexBuffer->Ntfs.UsaCount = 9; + + // TODO: Check bitmap for VCN + ASSERT(Node->ExistsOnDisk); + IndexBuffer->VCN = Node->NodeNumber; + + IndexBuffer->Header.FirstEntryOffset = 0x28; + IndexBuffer->Header.AllocatedSize = BufferSize - FIELD_OFFSET(INDEX_BUFFER, Header); + + // Start summing the total size of this node's entries + IndexBuffer->Header.TotalSizeOfEntries = IndexBuffer->Header.FirstEntryOffset; + + CurrentKey = Node->FirstKey; + CurrentNodeEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&(IndexBuffer->Header) + + IndexBuffer->Header.FirstEntryOffset); + for (i = 0; i < Node->KeyCount; i++) + { + // Would adding the current entry to the index increase the node size beyond the allocation size? + ULONG IndexSize = FIELD_OFFSET(INDEX_BUFFER, Header) + + IndexBuffer->Header.FirstEntryOffset + + IndexBuffer->Header.TotalSizeOfEntries + + CurrentNodeEntry->Length; + if (IndexSize > BufferSize) + { + DPRINT1("TODO: Adding file would require creating a new node!\n"); + return STATUS_NOT_IMPLEMENTED; + } + + ASSERT(CurrentKey->IndexEntry->Length != 0); + + // Copy the index entry + RtlCopyMemory(CurrentNodeEntry, CurrentKey->IndexEntry, CurrentKey->IndexEntry->Length); + + DPRINT1("Index Node Entry Stream Length: %u\nIndex Node Entry Length: %u\n", + CurrentNodeEntry->KeyLength, + CurrentNodeEntry->Length); + + // Add Length of Current Entry to Total Size of Entries + IndexBuffer->Header.TotalSizeOfEntries += CurrentNodeEntry->Length; + + // TODO: Check for child nodes + + // Go to the next node entry + CurrentNodeEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)CurrentNodeEntry + CurrentNodeEntry->Length); + CurrentKey = CurrentKey->NextKey; + } + + Status = AddFixupArray(DeviceExt, &IndexBuffer->Ntfs); + + return Status; +} + +NTSTATUS +UpdateIndexAllocation(PDEVICE_EXTENSION DeviceExt, + PB_TREE Tree, + ULONG IndexBufferSize, + PFILE_RECORD_HEADER FileRecord) +{ + // Find the index allocation and bitmap + PNTFS_ATTR_CONTEXT IndexAllocationContext, BitmapContext; + PB_TREE_KEY CurrentKey; + NTSTATUS Status; + BOOLEAN HasIndexAllocation = FALSE; + ULONG i; + + DPRINT1("UpdateIndexAllocations() called.\n"); + + Status = FindAttribute(DeviceExt, FileRecord, AttributeIndexAllocation, L"$I30", 4, &IndexAllocationContext, NULL); + if (NT_SUCCESS(Status)) + HasIndexAllocation = TRUE; + + // TODO: Handle bitmap + BitmapContext = NULL; + + // Walk through the root node and update all the sub-nodes + CurrentKey = Tree->RootNode->FirstKey; + for (i = 0; i < Tree->RootNode->KeyCount; i++) + { + if (CurrentKey->LesserChild) + { + if (!HasIndexAllocation) + { + DPRINT1("FIXME: Need to add index allocation\n"); + return STATUS_NOT_IMPLEMENTED; + } + else + { + Status = UpdateIndexNode(DeviceExt, CurrentKey->LesserChild, IndexBufferSize, IndexAllocationContext, BitmapContext); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ERROR: Failed to update index node!\n"); + ReleaseAttributeContext(IndexAllocationContext); + return Status; + } + } + + } + CurrentKey = CurrentKey->NextKey; + } + + if(HasIndexAllocation) + ReleaseAttributeContext(IndexAllocationContext); + + return STATUS_SUCCESS; +} + +NTSTATUS +UpdateIndexNode(PDEVICE_EXTENSION DeviceExt, + PB_TREE_FILENAME_NODE Node, + ULONG IndexBufferSize, + PNTFS_ATTR_CONTEXT IndexAllocationContext, + PNTFS_ATTR_CONTEXT BitmapContext) +{ + ULONG i; + PB_TREE_KEY CurrentKey = Node->FirstKey; + NTSTATUS Status; + + DPRINT1("UpdateIndexNode(%p, %p, %lu, %p, %p) called for index node with VCN %I64u\n", DeviceExt, Node, IndexBufferSize, IndexAllocationContext, BitmapContext, Node->NodeNumber); + + // Do we need to write this node to disk? + if (Node->DiskNeedsUpdating) + { + ULONGLONG NodeOffset; + ULONG LengthWritten; + + // Allocate memory for an index buffer + PINDEX_BUFFER IndexBuffer = ExAllocatePoolWithTag(NonPagedPool, IndexBufferSize, TAG_NTFS); + if (!IndexBuffer) + { + DPRINT1("ERROR: Failed to allocate %lu bytes for index buffer!\n", IndexBufferSize); + return STATUS_INSUFFICIENT_RESOURCES; + } + + // Create the index buffer we'll be writing to disk to represent this node + Status = CreateIndexBufferFromBTreeNode(DeviceExt, Node, IndexBufferSize, IndexBuffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ERROR: Failed to create index buffer from node!\n"); + ExFreePoolWithTag(IndexBuffer, TAG_NTFS); + return Status; + } + + // Get Offset of index buffer in index allocation + NodeOffset = GetAllocationOffsetFromVCN(DeviceExt, IndexBufferSize, Node->NodeNumber); + + // Write the buffer to the index allocation + Status = WriteAttribute(DeviceExt, IndexAllocationContext, NodeOffset, (const PUCHAR)IndexBuffer, IndexBufferSize, &LengthWritten); + if (!NT_SUCCESS(Status) || LengthWritten != IndexBufferSize) + { + DPRINT1("ERROR: Failed to update index allocation!\n"); + ExFreePoolWithTag(IndexBuffer, TAG_NTFS); + if (!NT_SUCCESS(Status)) + return Status; + else + return STATUS_END_OF_FILE; + } + + Node->DiskNeedsUpdating = FALSE; + + // Free the index buffer + ExFreePoolWithTag(IndexBuffer, TAG_NTFS); + } + + // Walk through the node and look for children to update + for (i = 0; i < Node->KeyCount; i++) + { + ASSERT(CurrentKey); + + // If there's a child node + if (CurrentKey->LesserChild) + { + // Update the child node on disk + Status = UpdateIndexNode(DeviceExt, CurrentKey->LesserChild, IndexBufferSize, IndexAllocationContext, BitmapContext); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ERROR: Failed to update child node!\n"); + return Status; + } + } + + CurrentKey = CurrentKey->NextKey; + } + + return STATUS_SUCCESS; +} + +PB_TREE_KEY +CreateBTreeKeyFromFilename(ULONGLONG FileReference, PFILENAME_ATTRIBUTE FileNameAttribute) +{ + PB_TREE_KEY NewKey; + ULONG AttributeSize = GetFileNameAttributeLength(FileNameAttribute); + ULONG EntrySize = ALIGN_UP_BY(AttributeSize + FIELD_OFFSET(INDEX_ENTRY_ATTRIBUTE, FileName), 8); + + // Create a new Index Entry for the file + PINDEX_ENTRY_ATTRIBUTE NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_NTFS); + if (!NewEntry) + { + DPRINT1("ERROR: Failed to allocate memory for Index Entry!\n"); + return NULL; + } + + // Setup the Index Entry + RtlZeroMemory(NewEntry, EntrySize); + NewEntry->Data.Directory.IndexedFile = FileReference; + NewEntry->Length = EntrySize; + NewEntry->KeyLength = AttributeSize; + + // Copy the FileNameAttribute + RtlCopyMemory(&NewEntry->FileName, FileNameAttribute, AttributeSize); + + // Setup the New Key + NewKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); + if (!NewKey) + { + DPRINT1("ERROR: Failed to allocate memory for new key!\n"); + ExFreePoolWithTag(NewEntry, TAG_NTFS); + return NULL; + } + NewKey->IndexEntry = NewEntry; + NewKey->NextKey = NULL; + + return NewKey; +} + VOID DestroyBTreeKey(PB_TREE_KEY Key) { if (Key->IndexEntry) ExFreePoolWithTag(Key->IndexEntry, TAG_NTFS); - // We'll destroy Key->LesserChild here after we start using it + if (Key->LesserChild) + DestroyBTreeNode(Key->LesserChild); ExFreePoolWithTag(Key, TAG_NTFS); } @@ -473,6 +924,18 @@ { DbgPrint(" (Dummy Key)\n"); } + + // Is there a child node? + if (Key->IndexEntry->Flags & NTFS_INDEX_ENTRY_NODE) + { + if (Key->LesserChild) + DumpBTreeNode(Key->LesserChild, Number, Depth + 1); + else + { + // This will be an assert once nodes with arbitrary depth are debugged + DPRINT1("DRIVER ERROR: No Key->LesserChild despite Key->IndexEntry->Flags indicating this is a node!\n"); + } + } } VOID @@ -482,7 +945,7 @@ ULONG i; for (i = 0; i < Depth; i++) DbgPrint(" "); - DbgPrint("Node #%d, Depth %d\n", Number, Depth); + DbgPrint("Node #%d, Depth %d, has %d keys\n", Number, Depth, Node->KeyCount); CurrentKey = Node->FirstKey; for (i = 0; i < Node->KeyCount; i++) @@ -551,46 +1014,23 @@ PB_TREE_FILENAME_NODE Node, BOOLEAN CaseSensitive) { - // Calculate size of Attribute and Index Entry - ULONG AttributeSize = GetFileNameAttributeLength(FileNameAttribute); - ULONG EntrySize = ALIGN_UP_BY(AttributeSize + FIELD_OFFSET(INDEX_ENTRY_ATTRIBUTE, FileName), 8); - PINDEX_ENTRY_ATTRIBUTE NewEntry; PB_TREE_KEY NewKey, CurrentKey, PreviousKey; + NTSTATUS Status = STATUS_SUCCESS; + ULONG NodeSize; + ULONG AllocatedNodeSize; + ULONG MaxNodeSizeWithoutHeader; ULONG i; - DPRINT1("NtfsInsertKey(0x%02I64, %p, %p, %s)\n", + DPRINT1("NtfsInsertKey(0x%I64x, %p, %p, %s)\n", FileReference, FileNameAttribute, Node, CaseSensitive ? "TRUE" : "FALSE"); - // Create a new Index Entry for the file - NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_NTFS); - if (!NewEntry) - { - DPRINT1("ERROR: Failed to allocate memory for Index Entry!\n"); + // Create the key for the filename attribute + NewKey = CreateBTreeKeyFromFilename(FileReference, FileNameAttribute); + if (!NewKey) return STATUS_INSUFFICIENT_RESOURCES; - } - - // Setup the Index Entry - RtlZeroMemory(NewEntry, EntrySize); - NewEntry->Data.Directory.IndexedFile = FileReference; - NewEntry->Length = EntrySize; - NewEntry->KeyLength = AttributeSize; - - // Copy the FileNameAttribute - RtlCopyMemory(&NewEntry->FileName, FileNameAttribute, AttributeSize); - - // Setup the New Key - NewKey = ExAllocatePoolWithTag(NonPagedPool, sizeof(B_TREE_KEY), TAG_NTFS); - if (!NewKey) - { - DPRINT1("ERROR: Failed to allocate memory for new key!\n"); - ExFreePoolWithTag(NewEntry, TAG_NTFS); - return STATUS_INSUFFICIENT_RESOURCES; - } - NewKey->IndexEntry = NewEntry; - NewKey->NextKey = NULL; // Find where to insert the key CurrentKey = Node->FirstKey; @@ -605,24 +1045,57 @@ // Is NewKey < CurrentKey? if (Comparison < 0) { - // Insert New Key before Current Key - NewKey->NextKey = CurrentKey; - - // was CurrentKey the first key? - if (CurrentKey == Node->FirstKey) - Node->FirstKey = NewKey; + + // Does CurrentKey have a sub-node? + if (CurrentKey->LesserChild) + { + // Insert the key into the child node + Status = NtfsInsertKey(FileReference, FileNameAttribute, CurrentKey->LesserChild, CaseSensitive); + } else - PreviousKey->NextKey = NewKey; - break; + { + // Insert New Key before Current Key + NewKey->NextKey = CurrentKey; + + // Increase KeyCount and mark node as dirty + Node->KeyCount++; + Node->DiskNeedsUpdating = TRUE; + + // was CurrentKey the first key? + if (CurrentKey == Node->FirstKey) + Node->FirstKey = NewKey; + else + PreviousKey->NextKey = NewKey; + break; + } } PreviousKey = CurrentKey; CurrentKey = CurrentKey->NextKey; } - Node->KeyCount++; + // Is the node larger than its allocated size? + NodeSize = 0; + CurrentKey = Node->FirstKey; + for (i = 0; i < Node->KeyCount; i++) + { + NodeSize += CurrentKey->IndexEntry->Length; + CurrentKey = CurrentKey->NextKey; + } + + // TEMPTEMP: TODO: MATH + AllocatedNodeSize = 0xfe8; + MaxNodeSizeWithoutHeader = AllocatedNodeSize - 0x28; + + if (NodeSize > MaxNodeSizeWithoutHeader) + { + DPRINT1("FIXME: Splitting a node is still a WIP!\n"); + //SplitBTreeNode(NULL, Node); + //DumpBTree(Tree); + return STATUS_NOT_IMPLEMENTED; + } // NewEntry and NewKey will be destroyed later by DestroyBTree() - return STATUS_SUCCESS; + return Status; } Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] Thu Jul 27 19:52:33 2017 @@ -1969,7 +1969,11 @@ } // Convert the index to a B*Tree - Status = CreateBTreeFromIndex(IndexRootContext, I30IndexRoot, &NewTree); + Status = CreateBTreeFromIndex(DeviceExt, + ParentFileRecord, + IndexRootContext, + I30IndexRoot, + &NewTree); if (!NT_SUCCESS(Status)) { DPRINT1("ERROR: Failed to create B-Tree from Index!\n"); @@ -1995,7 +1999,19 @@ DumpBTree(NewTree); - // Convert B*Tree back to Index Root + // Convert B*Tree back to Index + Status = UpdateIndexAllocation(DeviceExt, NewTree, I30IndexRoot->SizeOfEntry, ParentFileRecord); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ERROR: Failed to update index allocation from B-Tree!\n"); + DestroyBTree(NewTree); + ReleaseAttributeContext(IndexRootContext); + ExFreePoolWithTag(I30IndexRoot, TAG_NTFS); + ExFreePoolWithTag(ParentFileRecord, TAG_NTFS); + return Status; + } + + // Create the Index Root from the B*Tree Status = CreateIndexRootFromBTree(DeviceExt, NewTree, MaxIndexSize, &NewIndexRoot, &BtreeIndexLength); if (!NT_SUCCESS(Status)) { Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Thu Jul 27 19:52:33 2017 @@ -406,20 +406,26 @@ FILENAME_ATTRIBUTE FileName; } INDEX_ENTRY_ATTRIBUTE, *PINDEX_ENTRY_ATTRIBUTE; +struct _B_TREE_FILENAME_NODE; +typedef struct _B_TREE_FILENAME_NODE B_TREE_FILENAME_NODE; + // Keys are arranged in nodes as an ordered, linked list typedef struct _B_TREE_KEY { struct _B_TREE_KEY *NextKey; - // PB_TREE_FILENAME_NODE LesserChild; // we aren't worried about multi-level trees yet - PINDEX_ENTRY_ATTRIBUTE IndexEntry; // must be last member for FIELD_OFFSET + B_TREE_FILENAME_NODE *LesserChild; // Child-Node. All the keys in this node will be sorted before IndexEntry + PINDEX_ENTRY_ATTRIBUTE IndexEntry; // must be last member for FIELD_OFFSET }B_TREE_KEY, *PB_TREE_KEY; // Every Node is just an ordered list of keys. // Sub-nodes can be found attached to a key (if they exist). // A key's sub-node precedes that key in the ordered list. -typedef struct +typedef struct _B_TREE_FILENAME_NODE { ULONG KeyCount; + BOOLEAN ExistsOnDisk; + BOOLEAN DiskNeedsUpdating; + ULONGLONG NodeNumber; PB_TREE_KEY FirstKey; } B_TREE_FILENAME_NODE, *PB_TREE_FILENAME_NODE; @@ -688,7 +694,9 @@ BOOLEAN CaseSensitive); NTSTATUS -CreateBTreeFromIndex(/*PDEVICE_EXTENSION Vcb,*/ +CreateBTreeFromIndex(PDEVICE_EXTENSION Vcb, + PFILE_RECORD_HEADER FileRecordWithIndex, + /*PCWSTR IndexName,*/ PNTFS_ATTR_CONTEXT IndexRootContext, PINDEX_ROOT_ATTRIBUTE IndexRoot, PB_TREE *NewTree); @@ -724,6 +732,19 @@ PFILENAME_ATTRIBUTE FileNameAttribute, PB_TREE_FILENAME_NODE Node, BOOLEAN CaseSensitive); + +NTSTATUS +UpdateIndexAllocation(PDEVICE_EXTENSION DeviceExt, + PB_TREE Tree, + ULONG IndexBufferSize, + PFILE_RECORD_HEADER FileRecord); + +NTSTATUS +UpdateIndexNode(PDEVICE_EXTENSION DeviceExt, + PB_TREE_FILENAME_NODE Node, + ULONG IndexBufferSize, + PNTFS_ATTR_CONTEXT IndexAllocationContext, + PNTFS_ATTR_CONTEXT BitmapContext); /* close.c */
7 years, 4 months
1
0
0
0
[hbelusca] 75427: [ATL]: - Both the CAtlList class and its helper class CNode do not support copy construction. - Remove a redundant call to GetFreeNode(). CORE-13597
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jul 27 19:08:55 2017 New Revision: 75427 URL:
http://svn.reactos.org/svn/reactos?rev=75427&view=rev
Log: [ATL]: - Both the CAtlList class and its helper class CNode do not support copy construction. - Remove a redundant call to GetFreeNode(). CORE-13597 Modified: trunk/reactos/sdk/lib/atl/atlcoll.h Modified: trunk/reactos/sdk/lib/atl/atlcoll.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/atl/atlcoll.h?rev=…
============================================================================== --- trunk/reactos/sdk/lib/atl/atlcoll.h [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/atl/atlcoll.h [iso-8859-1] Thu Jul 27 19:08:55 2017 @@ -155,6 +155,11 @@ m_Element(Element) { } + + /* The CNode class does not support construction by copy */ + private: + CNode(_In_ const CNode&); + CNode& operator=(_In_ const CNode&); }; private: @@ -165,6 +170,11 @@ CNode* m_FreeNode; size_t m_NumElements; +/* The CAtlList class does not support construction by copy */ +private: + CAtlList(_In_ const CAtlList&); + CAtlList& operator=(_In_ const CAtlList&); + public: CAtlList(_In_ UINT nBlockSize = 10); ~CAtlList(); @@ -481,7 +491,7 @@ { GetFreeNode(); - CNode* NewNode = GetFreeNode(); + CNode* NewNode = m_FreeNode; CNode* NextFree = m_FreeNode->m_Next; NewNode = new CNode(element);
7 years, 4 months
1
0
0
0
[tfaber] 75426: [DLLS] - Fix import order - Remove unnecessary imports
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jul 27 18:48:19 2017 New Revision: 75426 URL:
http://svn.reactos.org/svn/reactos?rev=75426&view=rev
Log: [DLLS] - Fix import order - Remove unnecessary imports Modified: trunk/reactos/dll/cpl/powercfg/CMakeLists.txt trunk/reactos/dll/win32/security/CMakeLists.txt trunk/reactos/subsystems/win32/csrsrv/CMakeLists.txt Modified: trunk/reactos/dll/cpl/powercfg/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/CMakeList…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/powercfg/CMakeLists.txt [iso-8859-1] Thu Jul 27 18:48:19 2017 @@ -18,6 +18,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/powercfg.def) set_module_type(powercfg cpl UNICODE) -add_importlibs(powercfg user32 powrprof comctl32 shell32 advapi32 msvcrt kernel32 ntdll shlwapi) +add_importlibs(powercfg shlwapi user32 powrprof comctl32 shell32 advapi32 msvcrt kernel32 ntdll) add_pch(powercfg powercfg.h SOURCE) add_cd_file(TARGET powercfg DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/security/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/security/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/security/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/security/CMakeLists.txt [iso-8859-1] Thu Jul 27 18:48:19 2017 @@ -8,5 +8,5 @@ add_library(security SHARED ${SOURCE}) set_module_type(security win32dll ENTRYPOINT 0 UNICODE) -add_importlibs(security secur32 advapi32 ntdll kernel32) +add_importlibs(security secur32) add_cd_file(TARGET security DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/subsystems/win32/csrsrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrsrv/CM…
============================================================================== --- trunk/reactos/subsystems/win32/csrsrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrsrv/CMakeLists.txt [iso-8859-1] Thu Jul 27 18:48:19 2017 @@ -21,7 +21,7 @@ set_module_type(csrsrv nativedll) target_link_libraries(csrsrv ${PSEH_LIB} smlib) -add_importlibs(csrsrv ntdll smdll) +add_importlibs(csrsrv smdll ntdll) add_pch(csrsrv srv.h SOURCE) add_dependencies(csrsrv psdk bugcodes) add_cd_file(TARGET csrsrv DESTINATION reactos/system32 FOR all)
7 years, 4 months
1
0
0
0
[tthompson] 75425: [NTFS] - Add GetAllocationOffsetFromVCN() function, which was mistakenly left out of the last commit.
by tthompson@svn.reactos.org
Author: tthompson Date: Thu Jul 27 18:34:23 2017 New Revision: 75425 URL:
http://svn.reactos.org/svn/reactos?rev=75425&view=rev
Log: [NTFS] - Add GetAllocationOffsetFromVCN() function, which was mistakenly left out of the last commit. Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/btree.c [iso-8859-1] Thu Jul 27 18:34:23 2017 @@ -511,6 +511,18 @@ DumpBTreeNode(Tree->RootNode, 0, 0); } +// Calculates start of Index Buffer relative to the index allocation, given the node's VCN +ULONGLONG +GetAllocationOffsetFromVCN(PDEVICE_EXTENSION DeviceExt, + ULONG IndexBufferSize, + ULONGLONG Vcn) +{ + if (IndexBufferSize < DeviceExt->NtfsInfo.BytesPerCluster) + return Vcn * DeviceExt->NtfsInfo.BytesPerSector; + + return Vcn * DeviceExt->NtfsInfo.BytesPerCluster; +} + /** * @name NtfsInsertKey * @implemented
7 years, 4 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
22
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
Results per page:
10
25
50
100
200