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
August 2019
----- 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
36 participants
281 discussions
Start a n
N
ew thread
[reactos] 07/17: [RAPPS] CMainWindow: move RemoveAppFromRegistry in it
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ba80f057c581bd886eb78…
commit ba80f057c581bd886eb78a298c41fe51c606d1f6 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:45:12 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:47 2019 +0200 [RAPPS] CMainWindow: move RemoveAppFromRegistry in it --- base/applications/rapps/gui.cpp | 40 ++++++++++++++++++++++++++++++++++- base/applications/rapps/installed.cpp | 37 -------------------------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 89eb62efb24..064ec4ee463 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -1094,6 +1094,44 @@ private: } + VOID RemoveSelectedAppFromRegistry() + { + PINSTALLED_INFO Info; + WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"; + ATL::CStringW szMsgText, szMsgTitle; + INT ItemIndex = m_ListView->GetNextItem(-1, LVNI_FOCUSED); + + if (!IsInstalledEnum(SelectedEnumType)) + return; + + Info = reinterpret_cast<PINSTALLED_INFO>(m_ListView->GetItemData(ItemIndex)); + if (!Info || !Info->hSubKey || (ItemIndex == -1)) + return; + + if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) || + !szMsgTitle.LoadStringW(IDS_INFORMATION)) + return; + + if (MessageBoxW(szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES) + { + ATL::CStringW::CopyChars(szFullName, + MAX_PATH, + Info->szKeyName.GetString(), + MAX_PATH - wcslen(szFullName)); + + if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS) + { + m_ListView->DeleteItem(ItemIndex); + return; + } + + if (!szMsgText.LoadStringW(IDS_UNABLE_TO_REMOVE)) + return; + + MessageBoxW(szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); + } + } + BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId) { theResult = 0; @@ -1563,7 +1601,7 @@ private: break; case ID_REGREMOVE: - RemoveAppFromRegistry(-1); + RemoveSelectedAppFromRegistry(); break; case ID_REFRESH: diff --git a/base/applications/rapps/installed.cpp b/base/applications/rapps/installed.cpp index fb0bf03219f..cb53b88be7f 100644 --- a/base/applications/rapps/installed.cpp +++ b/base/applications/rapps/installed.cpp @@ -92,43 +92,6 @@ BOOL UninstallApplication(INT Index, BOOL bModify) return StartProcess(szPath, TRUE); } -VOID RemoveAppFromRegistry(INT Index) -{ - PINSTALLED_INFO Info; - WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"; - ATL::CStringW szMsgText, szMsgTitle; - INT ItemIndex = SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); - - if (!IsInstalledEnum(SelectedEnumType)) - return; - - Info = (PINSTALLED_INFO) ListViewGetlParam(Index); - if (!Info || !Info->hSubKey || (ItemIndex == -1)) return; - - if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) || - !szMsgTitle.LoadStringW(IDS_INFORMATION)) - return; - - if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES) - { - ATL::CStringW::CopyChars(szFullName, - MAX_PATH, - Info->szKeyName.GetString(), - MAX_PATH - wcslen(szFullName)); - - if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS) - { - ListView_DeleteItem(hListView, ItemIndex); - return; - } - - if (!szMsgText.LoadStringW(IDS_UNABLE_TO_REMOVE)) - return; - - MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); - } -} - BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param) { DWORD dwSize = MAX_PATH, dwType, dwValue;
5 years, 4 months
1
0
0
0
[reactos] 06/17: [RAPPS] CMainWindow: Make EnumInstalledAppProc and EnumAvailableAppProc methods
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=700f54c37b64427f807c0…
commit 700f54c37b64427f807c0ff95d7fffe95888c4d9 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:39:02 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:46 2019 +0200 [RAPPS] CMainWindow: Make EnumInstalledAppProc and EnumAvailableAppProc methods --- base/applications/rapps/available.cpp | 4 +-- base/applications/rapps/gui.cpp | 43 ++++++++++++++++++----------- base/applications/rapps/include/available.h | 4 +-- base/applications/rapps/include/installed.h | 4 +-- base/applications/rapps/installed.cpp | 4 +-- base/applications/rapps/unattended.cpp | 2 +- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/base/applications/rapps/available.cpp b/base/applications/rapps/available.cpp index 9a67aba42c0..16e4fc00775 100644 --- a/base/applications/rapps/available.cpp +++ b/base/applications/rapps/available.cpp @@ -320,7 +320,7 @@ BOOL CAvailableApps::ForceUpdateAppsDB() return UpdateAppsDB(); } -BOOL CAvailableApps::Enum(INT EnumType, AVAILENUMPROC lpEnumProc) +BOOL CAvailableApps::Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param) { HANDLE hFind = INVALID_HANDLE_VALUE; @@ -381,7 +381,7 @@ skip_if_cached: Info->RefreshAppInfo(); if (lpEnumProc) - lpEnumProc(Info, m_Strings.szAppsPath.GetString()); + lpEnumProc(Info, m_Strings.szAppsPath.GetString(), param); } } while (FindNextFileW(hFind, &FindFileData) != 0); diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index cf8ef0f3126..89eb62efb24 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -554,14 +554,14 @@ public: return (InsertColumn(Index, &Column) == -1) ? FALSE : TRUE; } - INT AddItem(INT ItemIndex, INT IconIndex, LPWSTR lpText, LPARAM lParam) + INT AddItem(INT ItemIndex, INT IconIndex, LPCWSTR lpText, LPARAM lParam) { LVITEMW Item; ZeroMemory(&Item, sizeof(Item)); Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE; - Item.pszText = lpText; + Item.pszText = const_cast<LPWSTR>(lpText); Item.lParam = lParam; Item.iItem = ItemIndex; Item.iImage = IconIndex; @@ -1614,7 +1614,7 @@ private: return StrStrIW(szHaystack, szNeedle) != NULL; } - static BOOL CALLBACK s_EnumInstalledAppProc(INT ItemIndex, ATL::CStringW &m_szName, PINSTALLED_INFO Info) + BOOL CALLBACK EnumInstalledAppProc(INT ItemIndex, ATL::CStringW &m_szName, PINSTALLED_INFO Info) { PINSTALLED_INFO ItemInfo; ATL::CStringW szText; @@ -1633,20 +1633,20 @@ private: return FALSE; } - Index = ListViewAddItem(ItemIndex, 0, m_szName, (LPARAM) ItemInfo); + Index = m_ListView->AddItem(ItemIndex, 0, m_szName.GetString(), (LPARAM) ItemInfo); /* Get version info */ ItemInfo->GetApplicationString(L"DisplayVersion", szText); - ListView_SetItemText(hListView, Index, 1, const_cast<LPWSTR>(szText.GetString())); + m_ListView->SetItemText(Index, 1, szText.GetString()); /* Get comments */ ItemInfo->GetApplicationString(L"Comments", szText); - ListView_SetItemText(hListView, Index, 2, const_cast<LPWSTR>(szText.GetString())); + m_ListView->SetItemText(Index, 2, szText.GetString()); return TRUE; } - static BOOL CALLBACK s_EnumAvailableAppProc(CAvailableApplicationInfo* Info, LPCWSTR szFolderPath) + BOOL EnumAvailableAppProc(CAvailableApplicationInfo* Info, LPCWSTR szFolderPath) { INT Index; HICON hIcon = NULL; @@ -1678,16 +1678,27 @@ private: Index = ImageList_AddIcon(hImageListView, hIcon); DestroyIcon(hIcon); - Index = ListViewAddItem(Info->m_Category, Index, Info->m_szName.GetString(), (LPARAM) Info); - ListView_SetImageList(hListView, hImageListView, LVSIL_SMALL); - - ListView_SetItemText(hListView, Index, 1, const_cast<LPWSTR>(Info->m_szVersion.GetString())); - ListView_SetItemText(hListView, Index, 2, const_cast<LPWSTR>(Info->m_szDesc.GetString())); - ListView_SetCheckState(hListView, Index, Info->m_IsSelected); + Index = m_ListView->AddItem(Info->m_Category, Index, Info->m_szName.GetString(), (LPARAM) Info); + m_ListView->SetImageList(hImageListView, LVSIL_SMALL); + m_ListView->SetItemText(Index, 1, Info->m_szVersion.GetString()); + m_ListView->SetItemText(Index, 2, Info->m_szDesc.GetString()); + m_ListView->SetCheckState(Index, Info->m_IsSelected); return TRUE; } + static BOOL CALLBACK s_EnumInstalledAppProc(INT ItemIndex, ATL::CStringW &m_szName, PINSTALLED_INFO Info, PVOID param) + { + CMainWindow* pThis = (CMainWindow*)param; + return pThis->EnumInstalledAppProc(ItemIndex, m_szName, Info); + } + + static BOOL CALLBACK s_EnumAvailableAppProc(CAvailableApplicationInfo* Info, LPCWSTR szFolderPath, PVOID param) + { + CMainWindow* pThis = (CMainWindow*)param; + return pThis->EnumAvailableAppProc(Info, szFolderPath); + } + VOID UpdateStatusBarText() { if (m_StatusBar) @@ -1745,8 +1756,8 @@ private: DestroyIcon(hIcon); // Enum installed applications and updates - EnumInstalledApplications(EnumType, TRUE, s_EnumInstalledAppProc); - EnumInstalledApplications(EnumType, FALSE, s_EnumInstalledAppProc); + EnumInstalledApplications(EnumType, TRUE, s_EnumInstalledAppProc, this); + EnumInstalledApplications(EnumType, FALSE, s_EnumInstalledAppProc, this); } else if (IsAvailableEnum(EnumType)) { @@ -1756,7 +1767,7 @@ private: } // Enum available applications - m_AvailableApps.Enum(EnumType, s_EnumAvailableAppProc); + m_AvailableApps.Enum(EnumType, s_EnumAvailableAppProc, this); } SelectedEnumType = EnumType; diff --git a/base/applications/rapps/include/available.h b/base/applications/rapps/include/available.h index c0b0f2017fb..f5beb9e44cf 100644 --- a/base/applications/rapps/include/available.h +++ b/base/applications/rapps/include/available.h @@ -79,7 +79,7 @@ private: inline BOOL FindInLanguages(LCID what) const; }; -typedef BOOL(CALLBACK *AVAILENUMPROC)(CAvailableApplicationInfo *Info, LPCWSTR szFolderPath); +typedef BOOL(CALLBACK *AVAILENUMPROC)(CAvailableApplicationInfo *Info, LPCWSTR szFolderPath, PVOID param); struct AvailableStrings { @@ -106,7 +106,7 @@ public: static VOID DeleteCurrentAppsDB(); VOID FreeCachedEntries(); - BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc); + BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param); CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName) const; ATL::CSimpleArray<CAvailableApplicationInfo> FindInfoList(const ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const; diff --git a/base/applications/rapps/include/installed.h b/base/applications/rapps/include/installed.h index e5293c2761b..876c7423522 100644 --- a/base/applications/rapps/include/installed.h +++ b/base/applications/rapps/include/installed.h @@ -13,9 +13,9 @@ struct INSTALLED_INFO }; typedef INSTALLED_INFO *PINSTALLED_INFO; -typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALLED_INFO Info); +typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALLED_INFO Info, PVOID param); -BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc); +BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param); BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString); BOOL UninstallApplication(INT Index, BOOL bModify); diff --git a/base/applications/rapps/installed.cpp b/base/applications/rapps/installed.cpp index 83fdbe4e8a1..fb0bf03219f 100644 --- a/base/applications/rapps/installed.cpp +++ b/base/applications/rapps/installed.cpp @@ -129,7 +129,7 @@ VOID RemoveAppFromRegistry(INT Index) } } -BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc) +BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param) { DWORD dwSize = MAX_PATH, dwType, dwValue; BOOL bIsSystemComponent, bIsUpdate; @@ -199,7 +199,7 @@ BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumP ((EnumType == ENUM_INSTALLED_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */ ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */ { - if (!lpEnumProc(ItemIndex, szDisplayName, &Info)) + if (!lpEnumProc(ItemIndex, szDisplayName, &Info, param)) break; } else diff --git a/base/applications/rapps/unattended.cpp b/base/applications/rapps/unattended.cpp index 2988ff68c44..d5428cae410 100644 --- a/base/applications/rapps/unattended.cpp +++ b/base/applications/rapps/unattended.cpp @@ -62,7 +62,7 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine) CAvailableApps apps; apps.UpdateAppsDB(); - apps.Enum(ENUM_ALL_AVAILABLE, NULL); + apps.Enum(ENUM_ALL_AVAILABLE, NULL, NULL); ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo = apps.FindInfoList(arrNames); if (arrAppInfo.GetSize() > 0)
5 years, 4 months
1
0
0
0
[reactos] 05/17: [RAPPS] CAppRichEdit: Add a new class that handles filling the richtext control
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d8b773b19062cbb9466dd…
commit d8b773b19062cbb9466dde17c92e518c4510f7f3 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:27:53 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:46 2019 +0200 [RAPPS] CAppRichEdit: Add a new class that handles filling the richtext control --- base/applications/rapps/gui.cpp | 168 ++++++++++++++++++++-------- base/applications/rapps/include/installed.h | 4 +- base/applications/rapps/installed.cpp | 45 +------- base/applications/rapps/misc.cpp | 14 --- 4 files changed, 123 insertions(+), 108 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 3695ca73a54..cf8ef0f3126 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -55,60 +55,62 @@ INT GetSystemColorDepth() return ColorDepth; } -class CAvailableAppView +class CAppRichEdit: + public CUiWindow<CRichEdit> { - static inline VOID InsertTextAfterLoaded_RichEdit(UINT uStringID, - const ATL::CStringW& szText, - DWORD StringFlags, - DWORD TextFlags) +private: + VOID LoadAndInsertText(UINT uStringID, + const ATL::CStringW& szText, + DWORD StringFlags, + DWORD TextFlags) { ATL::CStringW szLoadedText; if (!szText.IsEmpty() && szLoadedText.LoadStringW(uStringID)) { - InsertRichEditText(szLoadedText, StringFlags); - InsertRichEditText(szText, TextFlags); + InsertText(szLoadedText, StringFlags); + InsertText(szText, TextFlags); } } - static inline VOID InsertLoadedTextNewl_RichEdit(UINT uStringID, - DWORD StringFlags) + VOID LoadAndInsertText(UINT uStringID, + DWORD StringFlags) { ATL::CStringW szLoadedText; if (szLoadedText.LoadStringW(uStringID)) { - InsertRichEditText(L"\n", 0); - InsertRichEditText(szLoadedText, StringFlags); - InsertRichEditText(L"\n", 0); + InsertText(L"\n", 0); + InsertText(szLoadedText, StringFlags); + InsertText(L"\n", 0); } } - static VOID InsertVersionInfo_RichEdit(CAvailableApplicationInfo* Info) + VOID InsertVersionInfo(CAvailableApplicationInfo* Info) { if (Info->IsInstalled()) { if (Info->HasInstalledVersion()) { if (Info->HasUpdate()) - InsertLoadedTextNewl_RichEdit(IDS_STATUS_UPDATE_AVAILABLE, CFE_ITALIC); + LoadAndInsertText(IDS_STATUS_UPDATE_AVAILABLE, CFE_ITALIC); else - InsertLoadedTextNewl_RichEdit(IDS_STATUS_INSTALLED, CFE_ITALIC); + LoadAndInsertText(IDS_STATUS_INSTALLED, CFE_ITALIC); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_VERSION, Info->m_szInstalledVersion, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_VERSION, Info->m_szInstalledVersion, CFE_BOLD, 0); } else { - InsertLoadedTextNewl_RichEdit(IDS_STATUS_INSTALLED, CFE_ITALIC); + LoadAndInsertText(IDS_STATUS_INSTALLED, CFE_ITALIC); } } else { - InsertLoadedTextNewl_RichEdit(IDS_STATUS_NOTINSTALLED, CFE_ITALIC); + LoadAndInsertText(IDS_STATUS_NOTINSTALLED, CFE_ITALIC); } - InsertTextAfterLoaded_RichEdit(IDS_AINFO_AVAILABLEVERSION, Info->m_szVersion, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_AVAILABLEVERSION, Info->m_szVersion, CFE_BOLD, 0); } - static VOID InsertLicenseInfo_RichEdit(CAvailableApplicationInfo* Info) + VOID InsertLicenseInfo(CAvailableApplicationInfo* Info) { ATL::CStringW szLicense; switch (Info->m_LicenseType) @@ -123,15 +125,15 @@ class CAvailableAppView szLicense.LoadStringW(IDS_LICENSE_TRIAL); break; default: - InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, Info->m_szLicense, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_LICENSE, Info->m_szLicense, CFE_BOLD, 0); return; } szLicense += L" (" + Info->m_szLicense + L")"; - InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, szLicense, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_LICENSE, szLicense, CFE_BOLD, 0); } - static VOID InsertLanguageInfo_RichEdit(CAvailableApplicationInfo* Info) + VOID InsertLanguageInfo(CAvailableApplicationInfo* Info) { if (!Info->HasLanguageInfo()) { @@ -180,29 +182,81 @@ class CAvailableAppView szLoadedTextAvailability.LoadStringW(IDS_LANGUAGE_NO_TRANSLATION); } - InsertRichEditText(szLoadedAInfoText, CFE_BOLD); - InsertRichEditText(szLoadedTextAvailability, NULL); - InsertRichEditText(szLangInfo, CFE_ITALIC); + InsertText(szLoadedAInfoText, CFE_BOLD); + InsertText(szLoadedTextAvailability, NULL); + InsertText(szLangInfo, CFE_ITALIC); } public: - static BOOL ShowAvailableAppInfo(INT Index) + BOOL ShowAvailableAppInfo(CAvailableApplicationInfo* Info) { - CAvailableApplicationInfo* Info = (CAvailableApplicationInfo*) ListViewGetlParam(Index); if (!Info) return FALSE; - NewRichEditText(Info->m_szName, CFE_BOLD); - InsertVersionInfo_RichEdit(Info); - InsertLicenseInfo_RichEdit(Info); - InsertLanguageInfo_RichEdit(Info); + SetText(Info->m_szName, CFE_BOLD); + InsertVersionInfo(Info); + InsertLicenseInfo(Info); + InsertLanguageInfo(Info); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_SIZE, Info->m_szSize, CFE_BOLD, 0); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLSITE, Info->m_szUrlSite, CFE_BOLD, CFE_LINK); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_DESCRIPTION, Info->m_szDesc, CFE_BOLD, 0); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLDOWNLOAD, Info->m_szUrlDownload, CFE_BOLD, CFE_LINK); + LoadAndInsertText(IDS_AINFO_SIZE, Info->m_szSize, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_URLSITE, Info->m_szUrlSite, CFE_BOLD, CFE_LINK); + LoadAndInsertText(IDS_AINFO_DESCRIPTION, Info->m_szDesc, CFE_BOLD, 0); + LoadAndInsertText(IDS_AINFO_URLDOWNLOAD, Info->m_szUrlDownload, CFE_BOLD, CFE_LINK); return TRUE; } + + BOOL ShowInstalledAppInfo(PINSTALLED_INFO Info) + { + ATL::CStringW szText; + ATL::CStringW szInfo; + + if (!Info || !Info->hSubKey) + return FALSE; + + Info->GetApplicationString(L"DisplayName", szText); + SetText(szText, CFE_BOLD); + InsertText(L"\n", 0); + +#define GET_INFO(a, b, c, d) \ + if (Info->GetApplicationString(a, szInfo)) \ + { \ + LoadAndInsertText(b, szInfo, c, d); \ + } + + GET_INFO(L"DisplayVersion", IDS_INFO_VERSION, CFE_BOLD, 0); + GET_INFO(L"Publisher", IDS_INFO_PUBLISHER, CFE_BOLD, 0); + GET_INFO(L"RegOwner", IDS_INFO_REGOWNER, CFE_BOLD, 0); + GET_INFO(L"ProductID", IDS_INFO_PRODUCTID, CFE_BOLD, 0); + GET_INFO(L"HelpLink", IDS_INFO_HELPLINK, CFE_BOLD, CFM_LINK); + GET_INFO(L"HelpTelephone", IDS_INFO_HELPPHONE, CFE_BOLD, 0); + GET_INFO(L"Readme", IDS_INFO_README, CFE_BOLD, 0); + GET_INFO(L"Contact", IDS_INFO_CONTACT, CFE_BOLD, 0); + GET_INFO(L"URLUpdateInfo", IDS_INFO_UPDATEINFO, CFE_BOLD, CFM_LINK); + GET_INFO(L"URLInfoAbout", IDS_INFO_INFOABOUT, CFE_BOLD, CFM_LINK); + GET_INFO(L"Comments", IDS_INFO_COMMENTS, CFE_BOLD, 0); + GET_INFO(L"InstallDate", IDS_INFO_INSTALLDATE, CFE_BOLD, 0); + GET_INFO(L"InstallLocation", IDS_INFO_INSTLOCATION, CFE_BOLD, 0); + GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0); + GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0); + GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0); + GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0); + + return TRUE; + } + + VOID SetWelcomeText() + { + ATL::CStringW szText; + + szText.LoadStringW(IDS_WELCOME_TITLE); + SetText(szText, CFE_BOLD); + + szText.LoadStringW(IDS_WELCOME_TEXT); + InsertText(szText, 0); + + szText.LoadStringW(IDS_WELCOME_URL); + InsertText(szText, CFM_LINK); + } }; class CMainToolbar : @@ -733,7 +787,7 @@ class CMainWindow : CSideTreeView* m_TreeView; CUiWindow<CStatusBar>* m_StatusBar; - CUiWindow<CRichEdit>* m_RichEdit; + CAppRichEdit* m_RichEdit; CUiWindow<CSearchBar>* m_SearchBar; CAvailableApps m_AvailableApps; @@ -854,7 +908,7 @@ private: BOOL CreateRichEdit() { - m_RichEdit = new CUiWindow<CRichEdit>(); + m_RichEdit = new CAppRichEdit(); m_RichEdit->m_VerticalAlignment = UiAlign_Stretch; m_RichEdit->m_HorizontalAlignment = UiAlign_Stretch; m_HSplitter->Second().Append(m_RichEdit); @@ -965,6 +1019,28 @@ private: return FALSE; } + VOID ShowAppInfo(INT Index) + { + if (IsInstalledEnum(SelectedEnumType)) + { + if (Index == -1) + Index = m_ListView->GetSelectionMark(); + + PINSTALLED_INFO Info = (PINSTALLED_INFO) m_ListView->GetItemData(Index); + + m_RichEdit->ShowInstalledAppInfo(Info); + } + else if (IsAvailableEnum(SelectedEnumType)) + { + if (Index == -1) + return; + + CAvailableApplicationInfo* Info = (CAvailableApplicationInfo*) m_ListView->GetItemData(Index); + + m_RichEdit->ShowAvailableAppInfo(Info); + } + } + VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam) { if (wParam == SIZE_MINIMIZED) @@ -1208,10 +1284,7 @@ private: (pnic->uNewState & LVIS_FOCUSED) && !(pnic->uOldState & LVIS_FOCUSED)) { - if (IsInstalledEnum(SelectedEnumType)) - ShowInstalledAppInfo(ItemIndex); - if (IsAvailableEnum(SelectedEnumType)) - CAvailableAppView::ShowAvailableAppInfo(ItemIndex); + ShowAppInfo(ItemIndex); } /* Check if the item is checked */ if ((pnic->uNewState & LVIS_STATEIMAGEMASK) && !bUpdating) @@ -1250,10 +1323,7 @@ private: { if (data->hwndFrom == m_ListView->m_hWnd && ((LPNMLISTVIEW) lParam)->iItem != -1) { - if (IsInstalledEnum(SelectedEnumType)) - ShowInstalledAppInfo(-1); - if (IsAvailableEnum(SelectedEnumType)) - CAvailableAppView::ShowAvailableAppInfo(-1); + ShowAppInfo(-1); } } break; @@ -1566,11 +1636,11 @@ private: Index = ListViewAddItem(ItemIndex, 0, m_szName, (LPARAM) ItemInfo); /* Get version info */ - GetApplicationString(ItemInfo->hSubKey, L"DisplayVersion", szText); + ItemInfo->GetApplicationString(L"DisplayVersion", szText); ListView_SetItemText(hListView, Index, 1, const_cast<LPWSTR>(szText.GetString())); /* Get comments */ - GetApplicationString(ItemInfo->hSubKey, L"Comments", szText); + ItemInfo->GetApplicationString(L"Comments", szText); ListView_SetItemText(hListView, Index, 2, const_cast<LPWSTR>(szText.GetString())); return TRUE; @@ -1691,7 +1761,7 @@ private: SelectedEnumType = EnumType; UpdateStatusBarText(); - SetWelcomeText(); + m_RichEdit->SetWelcomeText(); // Set automatic column width for program names if the list is not empty if (m_ListView->GetItemCount() > 0) diff --git a/base/applications/rapps/include/installed.h b/base/applications/rapps/include/installed.h index bd916d806f8..e5293c2761b 100644 --- a/base/applications/rapps/include/installed.h +++ b/base/applications/rapps/include/installed.h @@ -8,6 +8,8 @@ struct INSTALLED_INFO HKEY hRootKey; HKEY hSubKey; ATL::CStringW szKeyName; + + BOOL GetApplicationString(LPCWSTR lpKeyName, ATL::CStringW& String); }; typedef INSTALLED_INFO *PINSTALLED_INFO; @@ -15,8 +17,6 @@ typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALL BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc); BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString); -BOOL GetApplicationString(HKEY hKey, LPCWSTR RegName, ATL::CStringW &String); -BOOL ShowInstalledAppInfo(INT Index); BOOL UninstallApplication(INT Index, BOOL bModify); VOID RemoveAppFromRegistry(INT Index); diff --git a/base/applications/rapps/installed.cpp b/base/applications/rapps/installed.cpp index c8418dca93c..83fdbe4e8a1 100644 --- a/base/applications/rapps/installed.cpp +++ b/base/applications/rapps/installed.cpp @@ -13,9 +13,9 @@ #include "gui.h" #include "misc.h" -BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, ATL::CStringW& String) +BOOL INSTALLED_INFO::GetApplicationString(LPCWSTR lpKeyName, ATL::CStringW& String) { - BOOL result = GetApplicationString(hKey, lpKeyName, String.GetBuffer(MAX_PATH)); + BOOL result = ::GetApplicationString(hSubKey, lpKeyName, String.GetBuffer(MAX_PATH)); String.ReleaseBuffer(); return result; } @@ -92,47 +92,6 @@ BOOL UninstallApplication(INT Index, BOOL bModify) return StartProcess(szPath, TRUE); } -BOOL ShowInstalledAppInfo(INT Index) -{ - ATL::CStringW szText; - ATL::CStringW szInfo; - PINSTALLED_INFO Info = (PINSTALLED_INFO) ListViewGetlParam(Index); - - if (!Info || !Info->hSubKey) return FALSE; - - GetApplicationString(Info->hSubKey, L"DisplayName", szText); - NewRichEditText(szText, CFE_BOLD); - InsertRichEditText(L"\n", 0); - -#define GET_INFO(a, b, c, d) \ - if (GetApplicationString(Info->hSubKey, a, szInfo)) \ - { \ - szText.LoadStringW(b); \ - InsertRichEditText(szText, c); \ - InsertRichEditText(szInfo, d); \ - } \ - - GET_INFO(L"DisplayVersion", IDS_INFO_VERSION, CFE_BOLD, 0); - GET_INFO(L"Publisher", IDS_INFO_PUBLISHER, CFE_BOLD, 0); - GET_INFO(L"RegOwner", IDS_INFO_REGOWNER, CFE_BOLD, 0); - GET_INFO(L"ProductID", IDS_INFO_PRODUCTID, CFE_BOLD, 0); - GET_INFO(L"HelpLink", IDS_INFO_HELPLINK, CFE_BOLD, CFM_LINK); - GET_INFO(L"HelpTelephone", IDS_INFO_HELPPHONE, CFE_BOLD, 0); - GET_INFO(L"Readme", IDS_INFO_README, CFE_BOLD, 0); - GET_INFO(L"Contact", IDS_INFO_CONTACT, CFE_BOLD, 0); - GET_INFO(L"URLUpdateInfo", IDS_INFO_UPDATEINFO, CFE_BOLD, CFM_LINK); - GET_INFO(L"URLInfoAbout", IDS_INFO_INFOABOUT, CFE_BOLD, CFM_LINK); - GET_INFO(L"Comments", IDS_INFO_COMMENTS, CFE_BOLD, 0); - GET_INFO(L"InstallDate", IDS_INFO_INSTALLDATE, CFE_BOLD, 0); - GET_INFO(L"InstallLocation", IDS_INFO_INSTLOCATION, CFE_BOLD, 0); - GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0); - GET_INFO(L"UninstallString", IDS_INFO_UNINSTALLSTR, CFE_BOLD, 0); - GET_INFO(L"InstallSource", IDS_INFO_INSTALLSRC, CFE_BOLD, 0); - GET_INFO(L"ModifyPath", IDS_INFO_MODIFYPATH, CFE_BOLD, 0); - - return TRUE; -} - VOID RemoveAppFromRegistry(INT Index) { PINSTALLED_INFO Info; diff --git a/base/applications/rapps/misc.cpp b/base/applications/rapps/misc.cpp index cc1dc6541fa..cb18503cc13 100644 --- a/base/applications/rapps/misc.cpp +++ b/base/applications/rapps/misc.cpp @@ -72,20 +72,6 @@ VOID CopyTextToClipboard(LPCWSTR lpszText) CloseClipboard(); } -VOID SetWelcomeText() -{ - ATL::CStringW szText; - - szText.LoadStringW(IDS_WELCOME_TITLE); - NewRichEditText(szText, CFE_BOLD); - - szText.LoadStringW(IDS_WELCOME_TEXT); - InsertRichEditText(szText, 0); - - szText.LoadStringW(IDS_WELCOME_URL); - InsertRichEditText(szText, CFM_LINK); -} - VOID ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem) { HMENU hMenu = NULL;
5 years, 4 months
1
0
0
0
[reactos] 04/17: [RAPPS] Don't use CDownloadManager outside loaddlg.cpp
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1807dbfd6da9b6c3fa5c6…
commit 1807dbfd6da9b6c3fa5c6a6e2006be7543734b1e Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:19:43 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:46 2019 +0200 [RAPPS] Don't use CDownloadManager outside loaddlg.cpp --- base/applications/rapps/available.cpp | 2 +- base/applications/rapps/gui.cpp | 4 +- base/applications/rapps/include/dialogs.h | 34 +++--------- base/applications/rapps/loaddlg.cpp | 87 ++++++++++++++++++++++--------- base/applications/rapps/unattended.cpp | 2 +- 5 files changed, 71 insertions(+), 58 deletions(-) diff --git a/base/applications/rapps/available.cpp b/base/applications/rapps/available.cpp index c6ee68f7f27..9a67aba42c0 100644 --- a/base/applications/rapps/available.cpp +++ b/base/applications/rapps/available.cpp @@ -300,7 +300,7 @@ BOOL CAvailableApps::UpdateAppsDB() return TRUE; } - CDownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL); + DownloadApplicationsDB(APPLICATION_DATABASE_URL); if (!ExtractFilesFromCab(m_Strings.szCabName, m_Strings.szCabDir, diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index f5151433bf2..3695ca73a54 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -1470,11 +1470,11 @@ private: { if (nSelectedApps > 0) { - CDownloadManager::DownloadListOfApplications(m_AvailableApps.GetSelected()); + DownloadListOfApplications(m_AvailableApps.GetSelected(), FALSE); UpdateApplicationsList(-1); m_ListView->SetSelected(-1, FALSE); } - else if (CDownloadManager::DownloadApplication(m_ListView->GetSelectedData())) + else if (DownloadApplication(m_ListView->GetSelectedData(), FALSE)) { UpdateApplicationsList(-1); } diff --git a/base/applications/rapps/include/dialogs.h b/base/applications/rapps/include/dialogs.h index f05b223f535..5247462d59f 100644 --- a/base/applications/rapps/include/dialogs.h +++ b/base/applications/rapps/include/dialogs.h @@ -5,38 +5,16 @@ #include <windef.h> #include <atlsimpcoll.h> -// Download dialog (loaddlg.cpp) -class CDowloadingAppsListView; -struct DownloadInfo; - -class CDownloadManager -{ - static ATL::CSimpleArray<DownloadInfo> AppsToInstallList; - static CDowloadingAppsListView DownloadsListView; - - static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); - static VOID SetProgressMarquee(HWND Item, BOOL Enable); - -public: - static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); - static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam, - UINT_PTR uIdSubclass, - DWORD_PTR dwRefData); - - static DWORD WINAPI ThreadFunc(LPVOID Context); - static BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE); - static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal = FALSE); - static VOID DownloadApplicationsDB(LPCWSTR lpUrl); - static VOID LaunchDownloadDialog(BOOL); -}; - // Settings dialog (settingsdlg.cpp) VOID CreateSettingsDlg(HWND hwnd); // About dialog (aboutdlg.cpp) VOID ShowAboutDialog(); +//Main window VOID ShowMainWindow(INT nShowCmd); + +// Download dialogs +VOID DownloadApplicationsDB(LPCWSTR lpUrl); +BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal); +BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal); diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp index 4016aa550cd..c4de1e29eec 100644 --- a/base/applications/rapps/loaddlg.cpp +++ b/base/applications/rapps/loaddlg.cpp @@ -384,10 +384,43 @@ inline VOID MessageBox_LoadString(HWND hMainWnd, INT StringID) } } + +// Download dialog (loaddlg.cpp) +class CDownloadManager +{ + static ATL::CSimpleArray<DownloadInfo> AppsToInstallList; + static CDowloadingAppsListView DownloadsListView; + + static VOID SetProgressMarquee(HWND Item, BOOL Enable); + +public: + static VOID Add(DownloadInfo info); + static VOID Download(const DownloadInfo& DLInfo, BOOL bIsModal = FALSE); + static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData); + + static DWORD WINAPI ThreadFunc(LPVOID Context); + static BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE); + static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal = FALSE); + static VOID DownloadApplicationsDB(LPCWSTR lpUrl); + static VOID LaunchDownloadDialog(BOOL); +}; + + // CDownloadManager ATL::CSimpleArray<DownloadInfo> CDownloadManager::AppsToInstallList; CDowloadingAppsListView CDownloadManager::DownloadsListView; +VOID CDownloadManager::Add(DownloadInfo info) +{ + AppsToInstallList.Add(info); +} + VOID CDownloadManager::Download(const DownloadInfo &DLInfo, BOOL bIsModal) { AppsToInstallList.RemoveAll(); @@ -927,7 +960,28 @@ end: return 0; } -BOOL CDownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal) +//TODO: Reuse the dialog +VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal) +{ + if (bIsModal) + { + DialogBoxW(hInst, + MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), + hMainWnd, + DownloadDlgProc); + } + else + { + CreateDialogW(hInst, + MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), + hMainWnd, + DownloadDlgProc); + } +} +// CDownloadManager + + +BOOL DownloadListOfApplications(const ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal) { if (AppsList.GetSize() == 0) return FALSE; @@ -935,48 +989,29 @@ BOOL CDownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<CAvail // Initialize shared variables for (INT i = 0; i < AppsList.GetSize(); ++i) { - AppsToInstallList.Add(AppsList[i]); // implicit conversion to DownloadInfo + CDownloadManager::Add(AppsList[i]); // implicit conversion to DownloadInfo } // Create a dialog and issue a download process - LaunchDownloadDialog(bIsModal); + CDownloadManager::LaunchDownloadDialog(bIsModal); return TRUE; } -BOOL CDownloadManager::DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal) +BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal) { if (!pAppInfo) return FALSE; - Download(*pAppInfo, bIsModal); + CDownloadManager::Download(*pAppInfo, bIsModal); return TRUE; } -VOID CDownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) +VOID DownloadApplicationsDB(LPCWSTR lpUrl) { static DownloadInfo DatabaseDLInfo; DatabaseDLInfo.szUrl = lpUrl; DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP); - Download(DatabaseDLInfo, TRUE); + CDownloadManager::Download(DatabaseDLInfo, TRUE); } -//TODO: Reuse the dialog -VOID CDownloadManager::LaunchDownloadDialog(BOOL bIsModal) -{ - if (bIsModal) - { - DialogBoxW(hInst, - MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), - hMainWnd, - DownloadDlgProc); - } - else - { - CreateDialogW(hInst, - MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), - hMainWnd, - DownloadDlgProc); - } -} -// CDownloadManager diff --git a/base/applications/rapps/unattended.cpp b/base/applications/rapps/unattended.cpp index 7f7f3510f67..2988ff68c44 100644 --- a/base/applications/rapps/unattended.cpp +++ b/base/applications/rapps/unattended.cpp @@ -67,7 +67,7 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine) ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo = apps.FindInfoList(arrNames); if (arrAppInfo.GetSize() > 0) { - CDownloadManager::DownloadListOfApplications(arrAppInfo, TRUE); + DownloadListOfApplications(arrAppInfo, TRUE); return TRUE; }
5 years, 4 months
1
0
0
0
[reactos] 03/17: [RAPPS] move the message proc to gui.cpp
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2c965f67d5c960e0fd191…
commit 2c965f67d5c960e0fd19158d3fd406d2a8c1d015 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 06:10:45 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:46 2019 +0200 [RAPPS] move the message proc to gui.cpp --- base/applications/rapps/gui.cpp | 28 ++++++++++++++++++++++++++++ base/applications/rapps/include/dialogs.h | 2 ++ base/applications/rapps/winmain.cpp | 24 +----------------------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 852be19bf18..f5151433bf2 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -1829,3 +1829,31 @@ VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags) { InsertRichEditText(szText.GetString(), flags); } + +VOID ShowMainWindow(INT nShowCmd) +{ + HACCEL KeyBrd; + MSG Msg; + + hMainWnd = CreateMainWindow(); + + if (hMainWnd) + { + /* Maximize it if we must */ + ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); + UpdateWindow(hMainWnd); + + /* Load the menu hotkeys */ + KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); + + /* Message Loop */ + while (GetMessageW(&Msg, NULL, 0, 0)) + { + if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) + { + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } + } + } +} diff --git a/base/applications/rapps/include/dialogs.h b/base/applications/rapps/include/dialogs.h index 69e07640869..f05b223f535 100644 --- a/base/applications/rapps/include/dialogs.h +++ b/base/applications/rapps/include/dialogs.h @@ -38,3 +38,5 @@ VOID CreateSettingsDlg(HWND hwnd); // About dialog (aboutdlg.cpp) VOID ShowAboutDialog(); + +VOID ShowMainWindow(INT nShowCmd); diff --git a/base/applications/rapps/winmain.cpp b/base/applications/rapps/winmain.cpp index 98f44a19e06..5660db81acd 100644 --- a/base/applications/rapps/winmain.cpp +++ b/base/applications/rapps/winmain.cpp @@ -126,8 +126,6 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi { LPCWSTR szWindowClass = L"ROSAPPMGR"; HANDLE hMutex; - HACCEL KeyBrd; - MSG Msg; BOOL bIsFirstLaunch; InitializeAtlModule(hInstance, TRUE); @@ -165,27 +163,7 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch) CAvailableApps::ForceUpdateAppsDB(); - hMainWnd = CreateMainWindow(); - - if (hMainWnd) - { - /* Maximize it if we must */ - ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); - UpdateWindow(hMainWnd); - - /* Load the menu hotkeys */ - KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); - - /* Message Loop */ - while (GetMessageW(&Msg, NULL, 0, 0)) - { - if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) - { - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } - } - } + ShowMainWindow(nShowCmd); } if (hMutex)
5 years, 4 months
1
0
0
0
[reactos] 02/17: [RAPPS] remove the old splitter code that was not used
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2bcc31a1872ea38eb7584…
commit 2bcc31a1872ea38eb7584e424ffea1c10d84b27d Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 18:01:27 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:46 2019 +0200 [RAPPS] remove the old splitter code that was not used --- base/applications/rapps/splitter.cpp | 300 ----------------------------------- 1 file changed, 300 deletions(-) diff --git a/base/applications/rapps/splitter.cpp b/base/applications/rapps/splitter.cpp deleted file mode 100644 index d1f1bb00803..00000000000 --- a/base/applications/rapps/splitter.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/* - * PROJECT: ReactOS Applications Manager - * LICENSE: GPL - See COPYING in the top level directory - * FILE: base/applications/rapps/splitter.cpp - * PURPOSE: SplitterBar functions - * PROGRAMMERS: Dmitry Chapyshev (dmitry(a)reactos.org) - */ - -#include "rapps.h" - -HWND hVSplitter = NULL; -HWND hHSplitter = NULL; - -static int HSplitterPos = 0; - -int -GetHSplitterPos(VOID) -{ - return HSplitterPos; -} - -VOID -SetHSplitterPos(int Pos) -{ - HSplitterPos = Pos; -} - -/* Callback for horizontal splitter bar */ -LRESULT CALLBACK -HSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - switch (Msg) - { - case WM_CREATE: - { - SetHSplitterPos(GetWindowHeight(hListView)); - } - break; - - case WM_LBUTTONDOWN: - { - SetCapture(hwnd); - } - break; - - case WM_LBUTTONUP: - case WM_RBUTTONDOWN: - if (GetCapture() == hwnd) - { - ReleaseCapture(); - } - break; - - case WM_MOUSEMOVE: - if (GetCapture() == hwnd) - { - int Width = GetClientWindowWidth(hMainWnd) - GetWindowWidth(hTreeView) - SPLIT_WIDTH; - int NewPos; - HDWP hdwp; - POINT Point; - - GetCursorPos(&Point); - ScreenToClient(hMainWnd, &Point); - - NewPos = Point.y; - - if ((GetClientWindowHeight(hMainWnd) - GetWindowHeight(hStatusBar) - SPLIT_WIDTH) < NewPos) - break; - - if ((GetWindowHeight(hToolBar) + SPLIT_WIDTH) > NewPos) - break; - - SetHSplitterPos(NewPos); - - hdwp = BeginDeferWindowPos(3); - - /* Size HSplitBar */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hHSplitter, - 0, - GetWindowWidth(hTreeView) + SPLIT_WIDTH, - Point.y, - Width, - SPLIT_WIDTH, - SWP_NOZORDER|SWP_NOACTIVATE); - - /* Size ListView */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hListView, - 0, - GetWindowWidth(hTreeView) + SPLIT_WIDTH, - GetWindowHeight(hToolBar), - Width, - Point.y - GetWindowHeight(hToolBar), - SWP_NOZORDER|SWP_NOACTIVATE); - - /* Size RichEdit */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hRichEdit, - 0, - GetWindowWidth(hTreeView) + SPLIT_WIDTH, - Point.y + SPLIT_WIDTH, - Width, - GetClientWindowHeight(hMainWnd) - (Point.y + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), - SWP_NOZORDER|SWP_NOACTIVATE); - - if (hdwp) - EndDeferWindowPos(hdwp); - } - break; - } - - return DefWindowProc(hwnd, Msg, wParam, lParam); -} - -/* Create horizontal splitter bar */ -BOOL -CreateHSplitBar(HWND hwnd) -{ - WCHAR szWindowClass[] = L"HSplitterWindowClass"; - WNDCLASSEXW WndClass = {0}; - - WndClass.cbSize = sizeof(WndClass); - WndClass.lpszClassName = szWindowClass; - WndClass.lpfnWndProc = HSplitterWindowProc; - WndClass.hInstance = hInst; - WndClass.style = CS_HREDRAW | CS_VREDRAW; - WndClass.hCursor = LoadCursor(0, IDC_SIZENS); - WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - - if (RegisterClassExW(&WndClass) == (ATOM) 0) - { - /* TODO: Show error message */ - return FALSE; - } - - hHSplitter = CreateWindowExW(WS_EX_TRANSPARENT, - szWindowClass, - NULL, - WS_CHILD | WS_VISIBLE, - 205, 180, 465, SPLIT_WIDTH, - hwnd, - NULL, - hInst, - NULL); - - if (hHSplitter == NULL) - { - /* TODO: Show error message */ - return FALSE; - } - - ShowWindow(hHSplitter, SW_SHOW); - UpdateWindow(hHSplitter); - - return TRUE; -} - -/* Callback for vertical splitter bar */ -LRESULT CALLBACK -VSplitterWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - switch (Msg) - { - case WM_LBUTTONDOWN: - SetCapture(hwnd); - break; - - case WM_LBUTTONUP: - case WM_RBUTTONDOWN: - if (GetCapture() == hwnd) - { - ReleaseCapture(); - } - break; - - case WM_MOUSEMOVE: - if (GetCapture() == hwnd) - { - HDWP hdwp; - POINT Point; - - GetCursorPos(&Point); - ScreenToClient(hMainWnd, &Point); - - if ((GetClientWindowWidth(hMainWnd) - SPLIT_WIDTH) < Point.x) - break; - - if (SPLIT_WIDTH > Point.x) - break; - - hdwp = BeginDeferWindowPos(5); - - /* Size VSplitBar */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hwnd, - 0, - Point.x, - GetWindowHeight(hToolBar), - SPLIT_WIDTH, - GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), - SWP_NOZORDER|SWP_NOACTIVATE); - - /* Size TreeView */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hTreeView, - 0, - 0, - GetWindowHeight(hToolBar), - Point.x, - GetClientWindowHeight(hMainWnd) - GetWindowHeight(hToolBar) - GetWindowHeight(hStatusBar), - SWP_NOZORDER|SWP_NOACTIVATE); - - /* Size ListView */ - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hListView, - 0, - Point.x + SPLIT_WIDTH, - GetWindowHeight(hToolBar), - GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), - GetHSplitterPos() - GetWindowHeight(hToolBar), - SWP_NOZORDER|SWP_NOACTIVATE); - - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hRichEdit, - 0, - Point.x + SPLIT_WIDTH, - GetHSplitterPos() + SPLIT_WIDTH, - GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), - GetClientWindowHeight(hMainWnd) - (GetHSplitterPos() + SPLIT_WIDTH + GetWindowHeight(hStatusBar)), - SWP_NOZORDER|SWP_NOACTIVATE); - - if (hdwp) - hdwp = DeferWindowPos(hdwp, - hHSplitter, - 0, - Point.x + SPLIT_WIDTH, - GetHSplitterPos(), - GetClientWindowWidth(hMainWnd) - (Point.x + SPLIT_WIDTH), - SPLIT_WIDTH, - SWP_NOZORDER|SWP_NOACTIVATE); - - if (hdwp) - EndDeferWindowPos(hdwp); - } - break; - } - - return DefWindowProc(hwnd, Msg, wParam, lParam); -} - -/* Create vertical splitter bar */ -BOOL -CreateVSplitBar(HWND hwnd) -{ - WCHAR szWindowClass[] = L"VSplitterWindowClass"; - WNDCLASSEXW WndClass = {0}; - - WndClass.cbSize = sizeof(WndClass); - WndClass.lpszClassName = szWindowClass; - WndClass.lpfnWndProc = VSplitterWindowProc; - WndClass.hInstance = hInst; - WndClass.style = CS_HREDRAW | CS_VREDRAW; - WndClass.hCursor = LoadCursor(0, IDC_SIZEWE); - WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - - if (RegisterClassExW(&WndClass) == (ATOM) 0) - { - /* TODO: Show error message */ - return FALSE; - } - - hVSplitter = CreateWindowExW(WS_EX_TRANSPARENT, - szWindowClass, - NULL, - WS_CHILD | WS_VISIBLE, - 201, 28, SPLIT_WIDTH, 350, - hwnd, - NULL, - hInst, - NULL); - - if (!hVSplitter) - { - /* TODO: Show error message */ - return FALSE; - } - - ShowWindow(hVSplitter, SW_SHOW); - UpdateWindow(hVSplitter); - - return TRUE; -}
5 years, 4 months
1
0
0
0
[reactos] 01/17: [ROSCTRLS.H] Add CListView::SetItemText and CListView::SetCheckState
by Giannis Adamopoulos
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=94112698411c873d1d45b…
commit 94112698411c873d1d45bd36a0cb2dd86f2f37c2 Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org> AuthorDate: Sun Apr 28 15:55:12 2019 +0300 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Tue Aug 20 00:43:37 2019 +0200 [ROSCTRLS.H] Add CListView::SetItemText and CListView::SetCheckState --- sdk/include/reactos/rosctrls.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sdk/include/reactos/rosctrls.h b/sdk/include/reactos/rosctrls.h index e81a0c4cfbb..6dd4ba9fa39 100644 --- a/sdk/include/reactos/rosctrls.h +++ b/sdk/include/reactos/rosctrls.h @@ -183,6 +183,19 @@ public: SendMessage(LVM_SETITEMSTATE, i, reinterpret_cast<LPARAM>(&item)); } + BOOL SetItemText(int i, int subItem, LPCWSTR text) + { + LVITEMW item; + item.iSubItem = subItem; + item.pszText = (LPWSTR)text; + return SendMessage(LVM_SETITEMTEXT, i, (LPARAM)&item); + } + + void SetCheckState(int i, BOOL check) + { + SetItemState(i, INDEXTOSTATEIMAGEMASK((check)?2:1), LVIS_STATEIMAGEMASK); + } + int HitTest(LV_HITTESTINFO * phtInfo) { return (int)SendMessage(LVM_HITTEST, 0, reinterpret_cast<LPARAM>(phtInfo));
5 years, 4 months
1
0
0
0
[reactos] 01/01: [USB] Enable *_new usb stack
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88cf5b0a3c429437d8ddd…
commit 88cf5b0a3c429437d8dddb2f2759812b99683087 Author: Victor Perevertkin <victor(a)perevertkin.ru> AuthorDate: Tue Aug 20 01:34:58 2019 +0300 Commit: Victor Perevertkin <victor(a)perevertkin.ru> CommitDate: Tue Aug 20 01:34:58 2019 +0300 [USB] Enable *_new usb stack --- boot/bootdata/txtsetup.sif | 1 + drivers/usb/CMakeLists.txt | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index 22d0b045a41..f3f6ba6185f 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -112,6 +112,7 @@ hidusb.sys = 1,,,,,,,4,,,,1,4 usbccgp.sys = 1,,,,,,x,4,,,,1,4 usbd.sys = 1,,,,,,x,4,,,,1,4 usbhub.sys = 1,,,,,,x,4,,,,1,4 +usbport.sys = 1,,,,,,x,4,,,,1,4 usbuhci.sys = 1,,,,,,x,4,,,,1,4 usbohci.sys = 1,,,,,,x,4,,,,1,4 usbehci.sys = 1,,,,,,x,4,,,,1,4 diff --git a/drivers/usb/CMakeLists.txt b/drivers/usb/CMakeLists.txt index ec555bbedb5..1315f1a571e 100644 --- a/drivers/usb/CMakeLists.txt +++ b/drivers/usb/CMakeLists.txt @@ -1,13 +1,13 @@ add_subdirectory(usbccgp) add_subdirectory(usbd) -add_subdirectory(usbehci) -#add_subdirectory(usbehci_new) -add_subdirectory(usbhub) -#add_subdirectory(usbhub_new) -add_subdirectory(usbohci) -#add_subdirectory(usbohci_new) +#add_subdirectory(usbehci) +add_subdirectory(usbehci_new) +#add_subdirectory(usbhub) +add_subdirectory(usbhub_new) +#add_subdirectory(usbohci) +add_subdirectory(usbohci_new) add_subdirectory(usbport) add_subdirectory(usbstor) #add_subdirectory(usbstor_new) -add_subdirectory(usbuhci) -#add_subdirectory(usbuhci_new) +#add_subdirectory(usbuhci) +add_subdirectory(usbuhci_new)
5 years, 4 months
1
0
0
0
[reactos] 01/01: [USBPORT] Fix endless loop, occasionally happened on real hardware
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fc14c095f58d7d9174913…
commit fc14c095f58d7d917491367e12af514743753c7f Author: Victor Perevertkin <victor(a)perevertkin.ru> AuthorDate: Thu Aug 1 21:17:44 2019 +0300 Commit: Victor Perevertkin <victor(a)perevertkin.ru> CommitDate: Tue Aug 20 01:30:52 2019 +0300 [USBPORT] Fix endless loop, occasionally happened on real hardware --- drivers/usb/usbport/queue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/queue.c b/drivers/usb/usbport/queue.c index 9635de1ef8f..df70e5f0286 100644 --- a/drivers/usb/usbport/queue.c +++ b/drivers/usb/usbport/queue.c @@ -1261,7 +1261,7 @@ USBPORT_FlushController(IN PDEVICE_OBJECT FdoDevice) PUSBPORT_DEVICE_EXTENSION FdoExtension; PLIST_ENTRY Entry; PUSBPORT_ENDPOINT Endpoint; - ULONG KilledTransfers = 0; + ULONG KilledTransfers; PLIST_ENTRY EndpointList; KIRQL OldIrql; LIST_ENTRY FlushList; @@ -1301,6 +1301,7 @@ USBPORT_FlushController(IN PDEVICE_OBJECT FdoDevice) KeReleaseSpinLock(&FdoExtension->EndpointListSpinLock, OldIrql); + KilledTransfers = 0; while (!IsListEmpty(&FlushList)) { Endpoint = CONTAINING_RECORD(FlushList.Flink, @@ -1355,7 +1356,7 @@ USBPORT_AbortEndpoint(IN PDEVICE_OBJECT FdoDevice, IN PIRP Irp) { PLIST_ENTRY PendingList; - PUSBPORT_TRANSFER PendingTransfer; + PUSBPORT_TRANSFER PendingTransfer; PLIST_ENTRY ActiveList; PUSBPORT_TRANSFER ActiveTransfer;
5 years, 4 months
1
0
0
0
[reactos] 01/01: Add support for save and restore reg.exe subcommands (#1565)
by William Kent
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9daaed32569901d53e78…
commit d9daaed32569901d53e78390f8b595468670eb51 Author: William Kent <wjk011(a)gmail.com> AuthorDate: Mon Aug 19 18:29:58 2019 -0400 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Tue Aug 20 00:29:58 2019 +0200 Add support for save and restore reg.exe subcommands (#1565) * [REG] Add save and restore help strings * [REG] Implement REG SAVE * [REG] Assert the BACKUP privilege With this change applied, reg.exe correctly saves a key on Windows 10. * [REG] Use RegSaveKeyEx() * [REG] Implement REG RESTORE * [REG] Close the process token * [REG] Remove duplicate string * [REG] Add missing comma * [REG] Copy new strings into translation files * [REG] Update STRING_USAGE translations "Should be submitted to wine" (tm) --- base/applications/cmdutils/reg/lang/bg-BG.rc | 4 +- base/applications/cmdutils/reg/lang/cs-CZ.rc | 4 +- base/applications/cmdutils/reg/lang/da-DK.rc | 4 +- base/applications/cmdutils/reg/lang/de-DE.rc | 4 +- base/applications/cmdutils/reg/lang/en-US.rc | 4 +- base/applications/cmdutils/reg/lang/es-ES.rc | 4 +- base/applications/cmdutils/reg/lang/fr-FR.rc | 4 +- base/applications/cmdutils/reg/lang/it-IT.rc | 4 +- base/applications/cmdutils/reg/lang/ja-JP.rc | 4 +- base/applications/cmdutils/reg/lang/ko-KR.rc | 4 +- base/applications/cmdutils/reg/lang/lt-LT.rc | 4 +- base/applications/cmdutils/reg/lang/nl-NL.rc | 4 +- base/applications/cmdutils/reg/lang/no-NO.rc | 4 +- base/applications/cmdutils/reg/lang/pl-PL.rc | 4 +- base/applications/cmdutils/reg/lang/pt-PT.rc | 4 +- base/applications/cmdutils/reg/lang/ro-RO.rc | 4 +- base/applications/cmdutils/reg/lang/ru-RU.rc | 4 +- base/applications/cmdutils/reg/lang/sl-SI.rc | 4 +- base/applications/cmdutils/reg/lang/sq-AL.rc | 4 +- base/applications/cmdutils/reg/lang/sv-SE.rc | 4 +- base/applications/cmdutils/reg/lang/tr-TR.rc | 4 +- base/applications/cmdutils/reg/lang/uk-UA.rc | 4 +- base/applications/cmdutils/reg/lang/zh-CN.rc | 4 +- base/applications/cmdutils/reg/lang/zh-TW.rc | 4 +- base/applications/cmdutils/reg/reg.c | 164 +++++++++++++++++++++++++++ base/applications/cmdutils/reg/resource.h | 2 + 26 files changed, 238 insertions(+), 24 deletions(-) diff --git a/base/applications/cmdutils/reg/lang/bg-BG.rc b/base/applications/cmdutils/reg/lang/bg-BG.rc index 51303d004cb..0ea098c3a44 100644 --- a/base/applications/cmdutils/reg/lang/bg-BG.rc +++ b/base/applications/cmdutils/reg/lang/bg-BG.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD ключ_име [/v стойност_име | /ve] [/t вид] [/s разделител] [/d данни] [/f]\n" STRING_DELETE_USAGE, "REG DELETE ключ_име [/v стойност_име | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY ключ_име [/v стойност_име | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/cs-CZ.rc b/base/applications/cmdutils/reg/lang/cs-CZ.rc index 3b5e7a17548..e4413cbce02 100644 --- a/base/applications/cmdutils/reg/lang/cs-CZ.rc +++ b/base/applications/cmdutils/reg/lang/cs-CZ.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD název_klíče [/v název_hodnoty | /ve] [/t type] [/s oddělovač] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE název_klíče [/v název_hodnoty | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY název_klíče [/v název_hodnoty | /ve] [/s]\n" @@ -45,4 +45,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/da-DK.rc b/base/applications/cmdutils/reg/lang/da-DK.rc index b4c34686842..a7bf9e9361a 100644 --- a/base/applications/cmdutils/reg/lang/da-DK.rc +++ b/base/applications/cmdutils/reg/lang/da-DK.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nøgle_navn [/v værdi | /ve] [/t type] [/s separator] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nøgle_navn [/v værdi | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nøgle_navn [/v værdi | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/de-DE.rc b/base/applications/cmdutils/reg/lang/de-DE.rc index 927e7ba48c8..dba7ed54791 100644 --- a/base/applications/cmdutils/reg/lang/de-DE.rc +++ b/base/applications/cmdutils/reg/lang/de-DE.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD Schlüssel [/v Wert | /ve] [/t Typ] [/s Trenner] [/d Daten] [/f]\n" STRING_DELETE_USAGE, "REG DELETE Schlüssel [/v Wert | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY Schlüssel [/v Wert | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/en-US.rc b/base/applications/cmdutils/reg/lang/en-US.rc index 26ce1697f08..65c37f1a803 100644 --- a/base/applications/cmdutils/reg/lang/en-US.rc +++ b/base/applications/cmdutils/reg/lang/en-US.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD key_name [/v value_name | /ve] [/t type] [/s separator] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE key_name [/v value_name | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY key_name [/v value_name | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/es-ES.rc b/base/applications/cmdutils/reg/lang/es-ES.rc index ad2b984e411..5e6d9ed4cd5 100644 --- a/base/applications/cmdutils/reg/lang/es-ES.rc +++ b/base/applications/cmdutils/reg/lang/es-ES.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nombre_clave [/v nombre_valor | /ve] [/t tipo] [/s separador] [/d datos] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nombre_clave [/v nombre_valor | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nombre_clave [/v nombre_valor | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/fr-FR.rc b/base/applications/cmdutils/reg/lang/fr-FR.rc index 757169f1636..0419d350e80 100644 --- a/base/applications/cmdutils/reg/lang/fr-FR.rc +++ b/base/applications/cmdutils/reg/lang/fr-FR.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nom_de_clé [/v nom_de_valeur | /ve] [/t type] [/s séparateur] [/d données] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nom_de_clé [/v nom_de_valeur | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nom_de_clé [/v nom_de_valeur | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/it-IT.rc b/base/applications/cmdutils/reg/lang/it-IT.rc index ed268d36989..84417873ed1 100644 --- a/base/applications/cmdutils/reg/lang/it-IT.rc +++ b/base/applications/cmdutils/reg/lang/it-IT.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nome_della_chiave [/v nome_del_valore | /ve] [/t tipo] [/s separatore] [/d dati] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nome_della_chiave [/v nome_del_valore | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nome_della_chiave [/v nome_del_valore | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/ja-JP.rc b/base/applications/cmdutils/reg/lang/ja-JP.rc index 3dc044cf0d2..cbaeb46f7fd 100644 --- a/base/applications/cmdutils/reg/lang/ja-JP.rc +++ b/base/applications/cmdutils/reg/lang/ja-JP.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD キー名 [/v 値名 | /ve] [/t type] [/s セパレータ] [/d データ] [/f]\n" STRING_DELETE_USAGE, "REG DELETE キー名 [/v 値名 | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY キー名 [/v 値名 | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/ko-KR.rc b/base/applications/cmdutils/reg/lang/ko-KR.rc index 552a031c9ce..1ba6c381f31 100644 --- a/base/applications/cmdutils/reg/lang/ko-KR.rc +++ b/base/applications/cmdutils/reg/lang/ko-KR.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD 값 [/v 값 | /ve] [/t 형식] [/s 분리기호] [/d 데이타] [/f]\n" STRING_DELETE_USAGE, "REG DELETE 키 이름 [/v 값 | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY 키 이름 [/v 값| /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/lt-LT.rc b/base/applications/cmdutils/reg/lang/lt-LT.rc index 70f2786b67b..48e96d23c97 100644 --- a/base/applications/cmdutils/reg/lang/lt-LT.rc +++ b/base/applications/cmdutils/reg/lang/lt-LT.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD rakto_vardas [/v reikšmės_vardas | /ve] [/t tipas] [/s skirtukas] [/d duomenys] [/f]\n" STRING_DELETE_USAGE, "REG DELETE rakto_vardas [/v reikšmės_vardas | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY rakto_vardas [/v reikšmės_vardas | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/nl-NL.rc b/base/applications/cmdutils/reg/lang/nl-NL.rc index a24806ef3ec..1cf44949866 100644 --- a/base/applications/cmdutils/reg/lang/nl-NL.rc +++ b/base/applications/cmdutils/reg/lang/nl-NL.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD sleutel_naam [/v waarde_naam | /ve] [/t type] [/s scheidingsteken] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE sleutel_naam [/v waarde_naam | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY sleutel_naam [/v waarde_naam | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/no-NO.rc b/base/applications/cmdutils/reg/lang/no-NO.rc index cfef4d43233..2046fad5278 100644 --- a/base/applications/cmdutils/reg/lang/no-NO.rc +++ b/base/applications/cmdutils/reg/lang/no-NO.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nøkkelnavn [/v verdi | /ve] [/t type] [/s separator] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nøkkelnavn [/v verdi | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nøkkelnavn [/v verdi | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/pl-PL.rc b/base/applications/cmdutils/reg/lang/pl-PL.rc index 3f587fc57c6..c8d9768df0b 100644 --- a/base/applications/cmdutils/reg/lang/pl-PL.rc +++ b/base/applications/cmdutils/reg/lang/pl-PL.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Sposób użycia:\n REG [operacja] [parametry]\n\nWspierane operacje:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nAby uzyskać pomoc dotyczącą określonej operacji, wpisz:\n REG [operacja] /?\n\n" + STRING_USAGE, "Sposób użycia:\n REG [operacja] [parametry]\n\nWspierane operacje:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nAby uzyskać pomoc dotyczącą określonej operacji, wpisz:\n REG [operacja] /?\n\n" STRING_ADD_USAGE, "REG ADD nazwa_klucza [/v nazwa_wartości | /ve] [/t typ] [/s separator] [/d dane] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nazwa_klucza [/v nazwa_wartości | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nazwa_klucza [/v nazwa_wartości | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT nazwa_klucza plik.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Nieprawidłowy klucz systemowy [%1]\n" STRING_OVERWRITE_FILE, "Plik '%1' już istnieje. Czy chcesz go zastąpić?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/pt-PT.rc b/base/applications/cmdutils/reg/lang/pt-PT.rc index 5e3d477e334..58e8752324e 100644 --- a/base/applications/cmdutils/reg/lang/pt-PT.rc +++ b/base/applications/cmdutils/reg/lang/pt-PT.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nome_chave [/v nome_valor | /ve] [/t tipo] [/s separador] [/d dados] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nome_chave [/v nome_valor | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nome_chave [/v nome_valor | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/ro-RO.rc b/base/applications/cmdutils/reg/lang/ro-RO.rc index d2405ab2ea5..3ee1f903895 100644 --- a/base/applications/cmdutils/reg/lang/ro-RO.rc +++ b/base/applications/cmdutils/reg/lang/ro-RO.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Sintaxa comenzii:\n REG [operație] [parametri]\n\nOperații disponibile:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nPentru informații despre o anume operație, tastați:\n REG [operație] /?\n\n" + STRING_USAGE, "Sintaxa comenzii:\n REG [operație] [parametri]\n\nOperații disponibile:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nPentru informații despre o anume operație, tastați:\n REG [operație] /?\n\n" STRING_ADD_USAGE, "REG ADD nume_cheie [/v nume_valoare | /ve] [/t tip] [/s separator] [/d date] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nume_cheie [/v nume_valoare | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nume_cheie [/v nume_valoare | /ve] [/s]\n" @@ -46,4 +46,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT nume_cheie fișier.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Cheia de sistem [%1] nu este una validă.\n" STRING_OVERWRITE_FILE, "Fișierul «%1» deja există. Doriți suprascrierea lui?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/ru-RU.rc b/base/applications/cmdutils/reg/lang/ru-RU.rc index e75ad5c0a79..757926b9b68 100644 --- a/base/applications/cmdutils/reg/lang/ru-RU.rc +++ b/base/applications/cmdutils/reg/lang/ru-RU.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD <имя_раздела> [/v <имя_параметра> | /ve] [/t <тип>] [/s <разделитель>] [/d <данные>] [/f]\n" STRING_DELETE_USAGE, "REG DELETE <имя_раздела> [/v <имя_параметра> | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY <имя_раздела> [/v [имя_параметра] | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/sl-SI.rc b/base/applications/cmdutils/reg/lang/sl-SI.rc index 134a398ec04..d0f4b37e82c 100644 --- a/base/applications/cmdutils/reg/lang/sl-SI.rc +++ b/base/applications/cmdutils/reg/lang/sl-SI.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD ime_ključa [/v ime_vrednosti | /ve] [/t vrsta] [/s ločilo] [/d podatki] [/f]\n" STRING_DELETE_USAGE, "REG DELETE ime_ključa [/v ime_vrednosti | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY ime_ključa [/v ime_vrednosti | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/sq-AL.rc b/base/applications/cmdutils/reg/lang/sq-AL.rc index ed63303e4cd..a94677b8c6c 100644 --- a/base/applications/cmdutils/reg/lang/sq-AL.rc +++ b/base/applications/cmdutils/reg/lang/sq-AL.rc @@ -6,7 +6,7 @@ LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD emri_çelsit [/v value_name | /ve] [/t tipi] [/s ndares] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE emri_çelsit [/v value_name | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY emri_çelsit [/v value_name | /ve] [/s]\n" @@ -44,4 +44,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/sv-SE.rc b/base/applications/cmdutils/reg/lang/sv-SE.rc index 70b59a2775f..c015bd9d6f9 100644 --- a/base/applications/cmdutils/reg/lang/sv-SE.rc +++ b/base/applications/cmdutils/reg/lang/sv-SE.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD nyckelnamn [/v värdenamn | /ve] [/t typ] [/s separator] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE nyckelnamn [/v värdenamn | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY nyckelnamn [/v värdenamn | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/tr-TR.rc b/base/applications/cmdutils/reg/lang/tr-TR.rc index 742923183b2..47abfc54bf8 100644 --- a/base/applications/cmdutils/reg/lang/tr-TR.rc +++ b/base/applications/cmdutils/reg/lang/tr-TR.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_TURKISH, SUBLANG_NEUTRAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD dizin adı [/v değer adı | /ve] [/t tür] [/s ayırıcı] [/d veri] [/f]\n" STRING_DELETE_USAGE, "REG DELETE dizin adı [/v değer adı | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY dizin adı [/v değer adı | /ve] [/s]\n" @@ -42,4 +42,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/uk-UA.rc b/base/applications/cmdutils/reg/lang/uk-UA.rc index a2c2b6a3736..f2fff4f5e67 100644 --- a/base/applications/cmdutils/reg/lang/uk-UA.rc +++ b/base/applications/cmdutils/reg/lang/uk-UA.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD <ключ> [/v <параметр> | /ve] [/t <тип>] [/s <розділювач>] [/d дані] [/f]\n" STRING_DELETE_USAGE, "REG DELETE <ключ> [/v <параметр> | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY <ключ> [/v <параметр> | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/zh-CN.rc b/base/applications/cmdutils/reg/lang/zh-CN.rc index 4c65c03424f..08f92516977 100644 --- a/base/applications/cmdutils/reg/lang/zh-CN.rc +++ b/base/applications/cmdutils/reg/lang/zh-CN.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD key_name [/v value_name | /ve] [/t type] [/s separator] [/d data] [/f]\n" STRING_DELETE_USAGE, "REG DELETE key_name [/v value_name | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY key_name [/v value_name | /ve] [/s]\n" @@ -40,4 +40,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: 无效的系统键 [%1]\n" STRING_OVERWRITE_FILE, "文件 '%1' 已经存在。您是否要覆盖它?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/lang/zh-TW.rc b/base/applications/cmdutils/reg/lang/zh-TW.rc index 1dbd4d0f349..7771b9ea401 100644 --- a/base/applications/cmdutils/reg/lang/zh-TW.rc +++ b/base/applications/cmdutils/reg/lang/zh-TW.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL STRINGTABLE { - STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" + STRING_USAGE, "Usage:\n REG [operation] [parameters]\n\nSupported operations:\n ADD | DELETE | IMPORT | EXPORT | QUERY | SAVE | RESTORE\n\nFor help on a specific operation, type:\n REG [operation] /?\n\n" STRING_ADD_USAGE, "REG ADD 金鑰名稱 [/v 值名稱 | /ve] [/t 類型] [/s 分隔符] [/d 資料] [/f]\n" STRING_DELETE_USAGE, "REG DELETE 金鑰名稱 [/v 值名稱 | /ve | /va] [/f]\n" STRING_QUERY_USAGE, "REG QUERY 金鑰名稱 [/v 值名稱 | /ve] [/s]\n" @@ -42,4 +42,6 @@ STRINGTABLE STRING_EXPORT_USAGE, "REG EXPORT key_name file.reg [/y]\n" STRING_INVALID_SYSTEM_KEY, "reg: Invalid system key [%1]\n" STRING_OVERWRITE_FILE, "The file '%1' already exists. Do you want to overwrite it?" + STRING_SAVE_USAGE, "REG SAVE key_name file_name [/y]" + STRING_RESTORE_USAGE, "REG RESTORE key_name file_name" } diff --git a/base/applications/cmdutils/reg/reg.c b/base/applications/cmdutils/reg/reg.c index 455d3dd96a4..5e65aee269b 100644 --- a/base/applications/cmdutils/reg/reg.c +++ b/base/applications/cmdutils/reg/reg.c @@ -144,6 +144,23 @@ static void output_formatstring(const WCHAR *fmt, __ms_va_list va_args) LocalFree(str); } +static void output_error(LSTATUS status) +{ + WCHAR* str; + DWORD len; + + SetLastError(NO_ERROR); + len = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, status, 0, (WCHAR*)&str, 0, NULL); + if (len == 0 && GetLastError() != NO_ERROR) + { + WINE_FIXME("Could not format error code: le=%u, error=%u", GetLastError(), status); + return; + } + + output_writeconsole(str, len); + LocalFree(str); +} + void WINAPIV output_message(unsigned int id, ...) { WCHAR fmt[1024]; @@ -892,6 +909,141 @@ static BOOL is_switch(const WCHAR *s, const WCHAR c) return FALSE; } +static BOOL set_privilege(LPCWSTR privilegeName, BOOL enabled) +{ + HANDLE hToken = INVALID_HANDLE_VALUE; + TOKEN_PRIVILEGES tp; + DWORD error = ERROR_SUCCESS; + + if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) + { + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = (enabled ? SE_PRIVILEGE_ENABLED : 0); + + if (LookupPrivilegeValueW(NULL, privilegeName, &tp.Privileges[0].Luid)) + { + if (AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL)) + { + if (GetLastError() == ERROR_NOT_ALL_ASSIGNED) + { + error = ERROR_NOT_ALL_ASSIGNED; + goto fail; + } + } + else + { + error = GetLastError(); + goto fail; + } + } + else + { + error = GetLastError(); + goto fail; + } + } + else + { + error = GetLastError(); + goto fail; + } + + CloseHandle(hToken); + return TRUE; + +fail: + // Don't allow a success error to be printed, as that would confuse the user. + // "Access denied" seems like a reasonable default. + if (error == ERROR_SUCCESS) error = ERROR_ACCESS_DENIED; + if (hToken != INVALID_HANDLE_VALUE) CloseHandle(hToken); + + output_error(error); + return FALSE; +} + +static int reg_save(int argc, WCHAR* argv[]) { + HKEY root, hkey; + LSTATUS status; + WCHAR* path, *long_key; + + if (argc < 4 || argc > 5) goto error; + + if (!parse_registry_key(argv[2], &root, &path, &long_key)) + return 1; + + if (GetFileAttributes(argv[3]) != INVALID_FILE_ATTRIBUTES) + { + if (argc == 5 && !strcmpiW(argv[4], L"/y")) + { + DeleteFile(argv[3]); + } + else + { + if (ask_confirm(STRING_OVERWRITE_FILE, argv[3])) + DeleteFile(argv[3]); + } + } + + if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey)) + { + output_message(STRING_INVALID_KEY); + return 1; + } + + if (!set_privilege(SE_BACKUP_NAME, TRUE)) return 1; + + status = RegSaveKeyExW(hkey, argv[3], NULL, REG_LATEST_FORMAT); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + output_error(status); + return 1; + } + + return 0; + +error: + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, struprW(argv[1])); + return 1; +} + +static int reg_restore(int argc, WCHAR* argv[]) +{ + HKEY root, hkey; + LSTATUS status; + WCHAR* path, * long_key; + + if (argc != 4) goto error; + + if (!parse_registry_key(argv[2], &root, &path, &long_key)) + return 1; + + if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey)) + { + output_message(STRING_INVALID_KEY); + return 1; + } + + if (!set_privilege(SE_BACKUP_NAME, TRUE)) return 1; + if (!set_privilege(SE_RESTORE_NAME, TRUE)) return 1; + + status = RegRestoreKeyW(hkey, argv[3], 0); + RegCloseKey(hkey); + + if (status != ERROR_SUCCESS) { + output_error(status); + return 1; + } + + return 0; + +error: + output_message(STRING_INVALID_SYNTAX); + output_message(STRING_FUNC_HELP, struprW(argv[1])); + return 1; +} + static BOOL is_help_switch(const WCHAR *s) { if (is_switch(s, '?') || is_switch(s, 'h')) @@ -906,6 +1058,8 @@ enum operations { REG_IMPORT, REG_EXPORT, REG_QUERY, + REG_SAVE, + REG_RESTORE, REG_INVALID }; @@ -918,6 +1072,8 @@ static enum operations get_operation(const WCHAR *str, int *op_help) static const WCHAR import[] = {'i','m','p','o','r','t',0}; static const WCHAR export[] = {'e','x','p','o','r','t',0}; static const WCHAR query[] = {'q','u','e','r','y',0}; + static const WCHAR save[] = L"save"; + static const WCHAR restore[] = L"restore"; static const struct op_info op_array[] = { @@ -926,6 +1082,8 @@ static enum operations get_operation(const WCHAR *str, int *op_help) { import, REG_IMPORT, STRING_IMPORT_USAGE }, { export, REG_EXPORT, STRING_EXPORT_USAGE }, { query, REG_QUERY, STRING_QUERY_USAGE }, + { save, REG_SAVE, STRING_SAVE_USAGE }, + { restore, REG_RESTORE, STRING_RESTORE_USAGE }, { NULL, -1, 0 } }; @@ -996,6 +1154,12 @@ int wmain(int argc, WCHAR *argvW[]) if (op == REG_EXPORT) return reg_export(argc, argvW); + if (op == REG_SAVE) + return reg_save(argc, argvW); + + if (op == REG_RESTORE) + return reg_restore(argc, argvW); + if (!parse_registry_key(argvW[2], &root, &path, &key_name)) return 1; diff --git a/base/applications/cmdutils/reg/resource.h b/base/applications/cmdutils/reg/resource.h index 3658adc1556..06848ca4eca 100644 --- a/base/applications/cmdutils/reg/resource.h +++ b/base/applications/cmdutils/reg/resource.h @@ -61,3 +61,5 @@ #define STRING_EXPORT_USAGE 136 #define STRING_INVALID_SYSTEM_KEY 137 #define STRING_OVERWRITE_FILE 138 +#define STRING_SAVE_USAGE 139 +#define STRING_RESTORE_USAGE 140
5 years, 4 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
29
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Results per page:
10
25
50
100
200