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 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
22 participants
262 discussions
Start a n
N
ew thread
[hbelusca] 75526: [USETUP]: Move the files in ./interface/ back into the main directory, since (almost) all of the usetup source files concerns the user interface of the setup program...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Aug 11 11:31:46 2017 New Revision: 75526 URL:
http://svn.reactos.org/svn/reactos?rev=75526&view=rev
Log: [USETUP]: Move the files in ./interface/ back into the main directory, since (almost) all of the usetup source files concerns the user interface of the setup program... Added: branches/setup_improvements/base/setup/usetup/consup.c - copied, changed from r75525, branches/setup_improvements/base/setup/usetup/interface/consup.c branches/setup_improvements/base/setup/usetup/consup.h - copied, changed from r75525, branches/setup_improvements/base/setup/usetup/interface/consup.h branches/setup_improvements/base/setup/usetup/devinst.c - copied, changed from r75525, branches/setup_improvements/base/setup/usetup/interface/devinst.c branches/setup_improvements/base/setup/usetup/usetup.c - copied, changed from r75525, branches/setup_improvements/base/setup/usetup/interface/usetup.c Removed: branches/setup_improvements/base/setup/usetup/interface/ Modified: branches/setup_improvements/base/setup/usetup/CMakeLists.txt branches/setup_improvements/base/setup/usetup/usetup.h Modified: branches/setup_improvements/base/setup/usetup/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/CMakeLists.txt [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -10,9 +10,6 @@ ${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers) list(APPEND SOURCE - interface/usetup.c - interface/devinst.c - interface/consup.c native/console.c native/keytrans.c native/host_native.c @@ -20,6 +17,8 @@ cabinet.c chkdsk.c cmdcons.c + consup.c + devinst.c filesup.c filequeue.c format.c @@ -30,6 +29,7 @@ partlist.c progress.c settings.c + usetup.c usetup.h) if(CMAKE_C_COMPILER_ID STREQUAL "Clang") Copied: branches/setup_improvements/base/setup/usetup/consup.c (from r75525, branches/setup_improvements/base/setup/usetup/interface/consup.c) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/consup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/consup.c [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -19,7 +19,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup - * FILE: base/setup/usetup/interface/consup.c + * FILE: base/setup/usetup/consup.c * PURPOSE: Console support functions * PROGRAMMER: Eric Kohl */ Copied: branches/setup_improvements/base/setup/usetup/consup.h (from r75525, branches/setup_improvements/base/setup/usetup/interface/consup.h) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/consup.h [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/consup.h [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -19,7 +19,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup - * FILE: base/setup/usetup/interface/consup.h + * FILE: base/setup/usetup/consup.h * PURPOSE: Console support functions * PROGRAMMER: Eric Kohl */ Copied: branches/setup_improvements/base/setup/usetup/devinst.c (from r75525, branches/setup_improvements/base/setup/usetup/interface/devinst.c) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/devinst.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/devinst.c [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup - * FILE: base/setup/usetup/interface/devinst.c + * FILE: base/setup/usetup/devinst.c * PURPOSE: Device installation * PROGRAMMER: Hervé Poussineau (hpoussin(a)reactos.org) */ Copied: branches/setup_improvements/base/setup/usetup/usetup.c (from r75525, branches/setup_improvements/base/setup/usetup/interface/usetup.c) URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/usetup.c [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -19,7 +19,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup - * FILE: base/setup/usetup/interface/usetup.c + * FILE: base/setup/usetup/usetup.c * PURPOSE: Text-mode setup * PROGRAMMER: Eric Kohl * Casper S. Hornstrup (chorns(a)users.sourceforge.net) Modified: branches/setup_improvements/base/setup/usetup/usetup.h URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/usetup.h [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/usetup.h [iso-8859-1] Fri Aug 11 11:31:46 2017 @@ -59,7 +59,7 @@ // #include "errorcode.h" /* Internal Headers */ -#include "interface/consup.h" +#include "consup.h" #include "inffile.h" #include "progress.h" #ifdef __REACTOS__
7 years, 4 months
1
0
0
0
[hbelusca] 75525: [USETUP]: Fix the keyboard selection in the list of OS installations that can be updated.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Aug 11 11:07:33 2017 New Revision: 75525 URL:
http://svn.reactos.org/svn/reactos?rev=75525&view=rev
Log: [USETUP]: Fix the keyboard selection in the list of OS installations that can be updated. Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Fri Aug 11 11:07:33 2017 @@ -827,57 +827,62 @@ { CONSOLE_ConInKey(Ir); - if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */ - { - ScrollDownGenericList(&ListUi); - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */ - { - ScrollUpGenericList(&ListUi); - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */ - { - ScrollPageDownGenericList(&ListUi); - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */ - { - ScrollPageUpGenericList(&ListUi); - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ - { - if (ConfirmQuit(Ir) == TRUE) - return QUIT_PAGE; - else - RedrawGenericList(&ListUi); - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && - (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */ - { - RestoreGenericListState(NtOsInstallsList); - // return nextPage; // prevPage; - } - // else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ - else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */ - { - /* Retrieve the current installation */ - CurrentInstallation = (PNTOS_INSTALLATION)GetListEntryUserData(GetCurrentListEntry(NtOsInstallsList)); - DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n", - CurrentInstallation->InstallationName, CurrentInstallation->DiskNumber, CurrentInstallation->PartitionNumber); - - RepairUpdateFlag = TRUE; - - // return nextPage; - /***/return INSTALL_INTRO_PAGE;/***/ - } - else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) - { - /* a-z */ - GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar); + if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) + { + switch (Ir->Event.KeyEvent.wVirtualKeyCode) + { + case VK_DOWN: /* DOWN */ + ScrollDownGenericList(&ListUi); + break; + case VK_UP: /* UP */ + ScrollUpGenericList(&ListUi); + break; + case VK_NEXT: /* PAGE DOWN */ + ScrollPageDownGenericList(&ListUi); + break; + case VK_PRIOR: /* PAGE UP */ + ScrollPageUpGenericList(&ListUi); + break; + case VK_F3: /* F3 */ + { + if (ConfirmQuit(Ir) == TRUE) + return QUIT_PAGE; + else + RedrawGenericList(&ListUi); + break; + } + case VK_ESCAPE: /* ESC */ + { + RestoreGenericListState(NtOsInstallsList); + // return nextPage; // prevPage; + + // return INSTALL_INTRO_PAGE; + return DEVICE_SETTINGS_PAGE; + // return SCSI_CONTROLLER_PAGE; + } + } + } + else + { + // switch (toupper(Ir->Event.KeyEvent.uChar.AsciiChar)) + // if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ + if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */ + { + /* Retrieve the current installation */ + CurrentInstallation = (PNTOS_INSTALLATION)GetListEntryUserData(GetCurrentListEntry(NtOsInstallsList)); + DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n", + CurrentInstallation->InstallationName, CurrentInstallation->DiskNumber, CurrentInstallation->PartitionNumber); + + RepairUpdateFlag = TRUE; + + // return nextPage; + /***/return INSTALL_INTRO_PAGE;/***/ + } + else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) && + (Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) /* a-z */ + { + GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar); + } } }
7 years, 4 months
1
0
0
0
[hbelusca] 75524: [SYSSETUP]: Following r75518, we use the $winnt$.inf file (created in System32 by the 1st-stage installer) as the setup information file for the 2nd-stage setup for: - retrieving ...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Aug 10 19:21:08 2017 New Revision: 75524 URL:
http://svn.reactos.org/svn/reactos?rev=75524&view=rev
Log: [SYSSETUP]: Following r75518, we use the $winnt$.inf file (created in System32 by the 1st-stage installer) as the setup information file for the 2nd-stage setup for: - retrieving the installation source media path; - retrieving the unattended information that was copied from the unattend.inf file from the installation source media. The installation source media path is converted from NT format to Win32 format for usage with Win32 functions and storage in the registry: this is done by GetInstallSourceWin32(), which replaces the hackish GetRosInstallCD() function. The $winnt$.inf file is also updated, and the values "SourcePath" and "ServicePackSourcePath" in HKLM\Software\Microsoft\Windows\CurrentVersion\Setup are created / updated. In addition, delete the created fonts where needed. Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c branches/setup_improvements/sdk/include/reactos/libs/syssetup/syssetup.h Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/dll/win32/sy…
============================================================================== --- branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] (original) +++ branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] Thu Aug 10 19:21:08 2017 @@ -49,9 +49,6 @@ /* FUNCTIONS ****************************************************************/ extern void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow); - -BOOL -GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax); static VOID @@ -982,16 +979,9 @@ PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT); if (SetupData->UnattendSetup) { - WCHAR wszPath[MAX_PATH]; - if (GetRosInstallCD(wszPath, _countof(wszPath))) + // if (!*SetupData->SourcePath) { - WCHAR wszParams[1024]; - swprintf(wszParams, L"intl.cpl,,/f:\"%sreactos\\unattend.inf\"", wszPath); - RunControlPanelApplet(hwndDlg, wszParams); - } - else - { - RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"unattend.inf\""); + RunControlPanelApplet(hwndDlg, L"intl.cpl,,/f:\"$winnt$.inf\""); // Should be in System32 } SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_OWNERPAGE); @@ -2175,9 +2165,70 @@ } +/* + * GetInstallSourceWin32 retrieves the path to the ReactOS installation medium + * in Win32 format, for later use by syssetup and storage in the registry. + */ +static BOOL +GetInstallSourceWin32( + OUT PWSTR pwszPath, + IN DWORD cchPathMax, + IN PCWSTR pwszNTPath) +{ + WCHAR wszDrives[512]; + WCHAR wszNTPath[512]; // MAX_PATH ? + DWORD cchDrives; + PWCHAR pwszDrive; + + *pwszPath = UNICODE_NULL; + + cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives); + if (cchDrives == 0 || cchDrives >= _countof(wszDrives)) + { + /* Buffer too small or failure */ + LogItem(NULL, L"GetLogicalDriveStringsW failed"); + return FALSE; + } + + for (pwszDrive = wszDrives; *pwszDrive; pwszDrive += wcslen(pwszDrive) + 1) + { + WCHAR wszBuf[MAX_PATH]; + + /* Retrieve the NT path corresponding to the current Win32 DOS path */ + pwszDrive[2] = UNICODE_NULL; // Temporarily remove the backslash + QueryDosDeviceW(pwszDrive, wszNTPath, _countof(wszNTPath)); + pwszDrive[2] = L'\\'; // Restore the backslash + + wcscat(wszNTPath, L"\\"); // Concat a backslash + + /* Logging */ + wsprintf(wszBuf, L"Testing '%s' --> '%s' %s a CD", + pwszDrive, wszNTPath, + (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) ? L"is" : L"is not"); + LogItem(NULL, wszBuf); + + /* Check whether the NT path corresponds to the NT installation source path */ + if (!_wcsicmp(wszNTPath, pwszNTPath)) + { + /* Found it! */ + wcscpy(pwszPath, pwszDrive); // cchPathMax + + /* Logging */ + wsprintf(wszBuf, L"GetInstallSourceWin32: %s", pwszPath); + LogItem(NULL, wszBuf); + wcscat(wszBuf, L"\n"); + OutputDebugStringW(wszBuf); + + return TRUE; + } + } + + return FALSE; +} + VOID -ProcessUnattendInf( - PSETUPDATA pSetupData) +ProcessUnattendSection( + IN OUT PSETUPDATA pSetupData) { INFCONTEXT InfContext; WCHAR szName[256]; @@ -2185,7 +2236,7 @@ DWORD LineLength; HKEY hKey; - if (!SetupFindFirstLineW(pSetupData->hUnattendedInf, + if (!SetupFindFirstLineW(pSetupData->hSetupInf, L"Unattend", L"UnattendSetupEnabled", &InfContext)) @@ -2212,7 +2263,7 @@ pSetupData->UnattendSetup = TRUE; - if (!SetupFindFirstLineW(pSetupData->hUnattendedInf, + if (!SetupFindFirstLineW(pSetupData->hSetupInf, L"Unattend", NULL, &InfContext)) @@ -2289,7 +2340,7 @@ } while (SetupFindNextLine(&InfContext, &InfContext)); - if (SetupFindFirstLineW(pSetupData->hUnattendedInf, + if (SetupFindFirstLineW(pSetupData->hSetupInf, L"Display", NULL, &InfContext)) @@ -2362,7 +2413,7 @@ return; } - if (SetupFindFirstLineW(pSetupData->hUnattendedInf, + if (SetupFindFirstLineW(pSetupData->hSetupInf, L"GuiRunOnce", NULL, &InfContext)) @@ -2400,87 +2451,137 @@ RegCloseKey(hKey); } -/* - * GetRosInstallCD should find the path to ros installation medium - * BUG 1 - * If there are more than one CDDrive in it containing a ReactOS - * installation cd, then it will pick the first one regardless if - * it is really the installation cd - * - * The best way to implement this is to set the key - * HKLM\Software\Microsoft\Windows NT\CurrentVersion\SourcePath (REG_SZ) - */ - -BOOL -GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax) -{ - WCHAR wszDrives[512]; - DWORD cchDrives; - WCHAR *pwszDrive; - - cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives); - if (cchDrives == 0 || cchDrives >= _countof(wszDrives)) - { - /* buffer too small or failure */ - LogItem(NULL, L"GetLogicalDriveStringsW failed"); +VOID +ProcessSetupInf( + IN OUT PSETUPDATA pSetupData) +{ + WCHAR szPath[MAX_PATH]; + WCHAR szValue[MAX_PATH]; + INFCONTEXT InfContext; + DWORD LineLength; + HKEY hKey; + LONG res; + + pSetupData->hSetupInf = INVALID_HANDLE_VALUE; + + /* Retrieve the path of the setup INF */ + GetSystemDirectoryW(szPath, _countof(szPath)); + wcscat(szPath, L"\\$winnt$.inf"); + + /* Open the setup INF */ + pSetupData->hSetupInf = SetupOpenInfFileW(szPath, + NULL, + INF_STYLE_OLDNT, + NULL); + if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE) + { + DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError()); + return; + } + + + /* Retrieve the NT source path from which the 1st-stage installer was run */ + if (!SetupFindFirstLineW(pSetupData->hSetupInf, + L"data", + L"sourcepath", + &InfContext)) + { + DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError()); + return; + } + + if (!SetupGetStringFieldW(&InfContext, + 1, + szValue, + ARRAYSIZE(szValue), + &LineLength)) + { + DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); + return; + } + + *pSetupData->SourcePath = UNICODE_NULL; + + /* Close the setup INF as we are going to modify it manually */ + if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE) + SetupCloseInfFile(pSetupData->hSetupInf); + + + /* Find the installation source path in Win32 format */ + if (!GetInstallSourceWin32(pSetupData->SourcePath, + _countof(pSetupData->SourcePath), + szValue)) + { + *pSetupData->SourcePath = UNICODE_NULL; + } + + /* Save the path in Win32 format in the setup INF */ + swprintf(szValue, L"\"%s\"", pSetupData->SourcePath); + WritePrivateProfileStringW(L"data", L"dospath", szValue, szPath); + + /* + * Save it also in the registry, in the following keys: + * - HKLM\Software\Microsoft\Windows\CurrentVersion\Setup , + * values "SourcePath" and "ServicePackSourcePath" (REG_SZ); + * - HKLM\Software\Microsoft\Windows NT\CurrentVersion , + * value "SourcePath" (REG_SZ); set to the full path (e.g. D:\I386). + */ +#if 0 + res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows NT\\CurrentVersion", + 0, + KEY_ALL_ACCESS, + &hKey); + + if (res != ERROR_SUCCESS) + { return FALSE; } - - for (pwszDrive = wszDrives; pwszDrive[0]; pwszDrive += wcslen(pwszDrive) + 1) - { - if (GetDriveTypeW(pwszDrive) == DRIVE_CDROM) - { - WCHAR wszBuf[MAX_PATH]; - wsprintf(wszBuf, L"%sreactos\\system32\\ntoskrnl.exe", pwszDrive); - LogItem(NULL, wszBuf); - if (GetFileAttributesW(wszBuf) != INVALID_FILE_ATTRIBUTES) - { - /* the file exists, so this is the right drive */ - wcsncpy(pwszPath, pwszDrive, cchPathMax); - OutputDebugStringW(L"GetRosInstallCD: ");OutputDebugStringW(pwszPath);OutputDebugStringW(L"\n"); - return TRUE; - } - } - } - return FALSE; -} - - -VOID -ProcessUnattendSetup( - PSETUPDATA pSetupData) -{ - WCHAR szPath[MAX_PATH]; - DWORD dwLength; - - if (!GetRosInstallCD(szPath, MAX_PATH)) - { - /* no cd drive found */ +#endif + + res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Setup", + 0, NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, // KEY_WRITE + NULL, + &hKey, + NULL); + if (res == ERROR_SUCCESS) + { + res = RegSetValueExW(hKey, + L"SourcePath", + 0, + REG_SZ, + (LPBYTE)pSetupData->SourcePath, + (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR)); + + res = RegSetValueExW(hKey, + L"ServicePackSourcePath", + 0, + REG_SZ, + (LPBYTE)pSetupData->SourcePath, + (wcslen(pSetupData->SourcePath) + 1) * sizeof(WCHAR)); + + RegCloseKey(hKey); + } + + + /* Now, re-open the setup INF (this must succeed) */ + pSetupData->hSetupInf = SetupOpenInfFileW(szPath, + NULL, + INF_STYLE_OLDNT, + NULL); + if (pSetupData->hSetupInf == INVALID_HANDLE_VALUE) + { + DPRINT1("Error: Cannot open the setup information file %S with error %d\n", szPath, GetLastError()); return; } - dwLength = wcslen(szPath); - if (dwLength + 21 > MAX_PATH) - { - /* FIXME - * allocate bigger buffer - */ - return; - } - - wcscat(szPath, L"reactos\\unattend.inf"); - - pSetupData->hUnattendedInf = SetupOpenInfFileW(szPath, - NULL, - INF_STYLE_OLDNT, - NULL); - if (pSetupData->hUnattendedInf != INVALID_HANDLE_VALUE) - { - ProcessUnattendInf(pSetupData); - } -} - -typedef DWORD(WINAPI *PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA); + /* Process the unattended section of the setup file */ + ProcessUnattendSection(pSetupData); +} + BOOL ActivateComctl32v6ActCtx(ULONG_PTR *cookie, HANDLE* hActCtx) { @@ -2500,6 +2601,9 @@ return ActivateActCtx(*hActCtx, cookie); } + + +typedef DWORD(WINAPI *PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA); VOID InstallWizard(VOID) @@ -2514,6 +2618,7 @@ HMODULE hNetShell = NULL; PFNREQUESTWIZARDPAGES pfn = NULL; DWORD dwPageCount = 8, dwNetworkPageCount = 0; + BOOL bActCtxActivated; ULONG_PTR cookie; HANDLE hActCtx; @@ -2568,8 +2673,8 @@ goto done; } - pSetupData->hUnattendedInf = INVALID_HANDLE_VALUE; - ProcessUnattendSetup(pSetupData); + /* Process the $winnt$.inf setup file */ + ProcessSetupInf(pSetupData); /* Create the Welcome page */ psp.dwSize = sizeof(PROPSHEETPAGE); @@ -2679,8 +2784,11 @@ } } - if (pSetupData->hUnattendedInf != INVALID_HANDLE_VALUE) - SetupCloseInfFile(pSetupData->hUnattendedInf); + DeleteObject(pSetupData->hBoldFont); + DeleteObject(pSetupData->hTitleFont); + + if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE) + SetupCloseInfFile(pSetupData->hSetupInf); done: if (phpage != NULL) @@ -2696,11 +2804,7 @@ } if (pSetupData != NULL) - { - DeleteObject(pSetupData->hBoldFont); - DeleteObject(pSetupData->hTitleFont); HeapFree(GetProcessHeap(), 0, pSetupData); - } LogItem(L"END_SECTION", L"InstallWizard"); } Modified: branches/setup_improvements/sdk/include/reactos/libs/syssetup/syssetup.h URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/sdk/include/…
============================================================================== --- branches/setup_improvements/sdk/include/reactos/libs/syssetup/syssetup.h [iso-8859-1] (original) +++ branches/setup_improvements/sdk/include/reactos/libs/syssetup/syssetup.h [iso-8859-1] Thu Aug 10 19:21:08 2017 @@ -44,15 +44,19 @@ ULONG Index; } TIMEZONE_ENTRY, *PTIMEZONE_ENTRY; +/* Private Setup data shared between syssetup.dll and netshell.dll */ typedef struct _SETUPDATA { HFONT hTitleFont; HFONT hBoldFont; + WCHAR SourcePath[MAX_PATH]; // PCWSTR + WCHAR UnattendFile[MAX_PATH]; // PCWSTR + WCHAR OwnerName[51]; WCHAR OwnerOrganization[51]; WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; /* max. 15 characters */ - WCHAR AdminPassword[128]; /* max. 127 characters */ + WCHAR AdminPassword[128]; /* max. 127 characters */ BOOL UnattendSetup; BOOL DisableGeckoInst; @@ -63,7 +67,7 @@ DWORD DisableAutoDaylightTimeSet; LCID LocaleID; - HINF hUnattendedInf; + HINF hSetupInf; UINT uFirstNetworkWizardPage; UINT uPostNetworkWizardPage;
7 years, 4 months
1
0
0
0
[hbelusca] 75523: [SYSSETUP]: Use ARRAYSIZE / _countof instead of sizeof ratios.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Aug 10 18:59:26 2017 New Revision: 75523 URL:
http://svn.reactos.org/svn/reactos?rev=75523&view=rev
Log: [SYSSETUP]: Use ARRAYSIZE / _countof instead of sizeof ratios. Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/dll/win32/sy…
============================================================================== --- branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] (original) +++ branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] Thu Aug 10 18:59:26 2017 @@ -488,11 +488,11 @@ OwnerName[0] = 0; if (GetDlgItemTextW(hwndDlg, IDC_OWNERNAME, OwnerName, 50) == 0) { - if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) + if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title))) { wcscpy(Title, L"ReactOS Setup"); } - if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, sizeof(ErrorName) / sizeof(ErrorName[0]))) + if (0 == LoadStringW(hDllInstance, IDS_WZD_NAME, ErrorName, ARRAYSIZE(ErrorName))) { wcscpy(ErrorName, L"Setup cannot continue until you enter your name."); } @@ -542,12 +542,12 @@ { if (hwndDlg != NULL) { - if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) + if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title))) { wcscpy(Title, L"ReactOS Setup"); } if (0 == LoadStringW(hDllInstance, IDS_WZD_SETCOMPUTERNAME, ErrorComputerName, - sizeof(ErrorComputerName) / sizeof(ErrorComputerName[0]))) + ARRAYSIZE(ErrorComputerName))) { wcscpy(ErrorComputerName, L"Setup failed to set the computer name."); } @@ -578,7 +578,7 @@ if (LoadStringW(hDllInstance, IDS_ADMINISTRATOR_NAME, szAdministratorName, - sizeof(szAdministratorName) / sizeof(WCHAR)) == 0) + ARRAYSIZE(szAdministratorName)) == 0) { wcscpy(szAdministratorName, L"Administrator"); } @@ -655,7 +655,7 @@ pSetupData = (PSETUPDATA)GetWindowLongPtr(hwndDlg, DWLP_USER); - if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) + if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title))) { wcscpy(Title, L"ReactOS Setup"); } @@ -713,7 +713,7 @@ if (0 == GetDlgItemTextW(hwndDlg, IDC_COMPUTERNAME, ComputerName, MAX_COMPUTERNAME_LENGTH + 1)) { if (0 == LoadStringW(hDllInstance, IDS_WZD_COMPUTERNAME, EmptyComputerName, - sizeof(EmptyComputerName) / sizeof(EmptyComputerName[0]))) + ARRAYSIZE(EmptyComputerName))) { wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer."); } @@ -739,7 +739,7 @@ (GetDlgItemText(hwndDlg, IDC_ADMINPASSWORD2, Password2, 128) == 0)) { if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDEMPTY, EmptyPassword, - sizeof(EmptyPassword) / sizeof(EmptyPassword[0]))) + ARRAYSIZE(EmptyPassword))) { wcscpy(EmptyPassword, L"You must enter a password !"); } @@ -755,7 +755,7 @@ if (wcscmp(Password1, Password2)) { if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDMATCH, NotMatchPassword, - sizeof(NotMatchPassword) / sizeof(NotMatchPassword[0]))) + ARRAYSIZE(NotMatchPassword))) { wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again."); } @@ -771,7 +771,7 @@ if (!isprint(*Password)) { if (0 == LoadStringW(hDllInstance, IDS_WZD_PASSWORDCHAR, WrongPassword, - sizeof(WrongPassword) / sizeof(WrongPassword[0]))) + ARRAYSIZE(WrongPassword))) { wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password."); } @@ -918,7 +918,7 @@ lcid = GetSystemDefaultLCID(); - if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, sizeof(Locale) / sizeof(Locale[0])) != 0) + if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, ARRAYSIZE(Locale)) != 0) { if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International", 0, NULL, REG_OPTION_NON_VOLATILE, @@ -1499,12 +1499,12 @@ SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT)); if (!SetSystemLocalTime(hwndDlg, SetupData)) { - if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) + if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, ARRAYSIZE(Title))) { wcscpy(Title, L"ReactOS Setup"); } if (0 == LoadStringW(hDllInstance, IDS_WZD_LOCALTIME, ErrorLocalTime, - sizeof(ErrorLocalTime) / sizeof(ErrorLocalTime[0]))) + ARRAYSIZE(ErrorLocalTime))) { wcscpy(ErrorLocalTime, L"Setup was unable to set the local time."); } @@ -1752,8 +1752,7 @@ } if (0 == LoadStringW(hDllInstance, MessageID, ErrorMessage, - sizeof(ErrorMessage) / - sizeof(ErrorMessage[0]))) + ARRAYSIZE(ErrorMessage))) { ErrorMessage[0] = L'\0'; } @@ -1762,8 +1761,8 @@ FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, StatusInfo->Win32Error, 0, ErrorMessage + wcslen(ErrorMessage), - sizeof(ErrorMessage) / sizeof(ErrorMessage[0]) - - wcslen(ErrorMessage), NULL); + ARRAYSIZE(ErrorMessage) - wcslen(ErrorMessage), + NULL); } RegistrationNotify.ErrorMessage = ErrorMessage; } @@ -1846,8 +1845,7 @@ { if (0 == LoadStringW(hDllInstance, IDS_UNKNOWN_ERROR, UnknownError, - sizeof(UnknownError) / sizeof(UnknownError[0]) - - 20)) + ARRAYSIZE(UnknownError) - 20)) { wcscpy(UnknownError, L"Unknown error"); } @@ -1897,7 +1895,7 @@ return FALSE; } if (!SetupGetStringFieldW(&Context, 1, SectionName, - sizeof(SectionName) / sizeof(SectionName[0]), + ARRAYSIZE(SectionName), NULL)) { DPRINT1("Unable to retrieve section name\n"); @@ -2012,7 +2010,7 @@ { if (0 != LoadStringW(hDllInstance, RegistrationNotify->ActivityID, Activity, - sizeof(Activity) / sizeof(Activity[0]))) + ARRAYSIZE(Activity))) { SendDlgItemMessageW(hwndDlg, IDC_ACTIVITY, WM_SETTEXT, 0, (LPARAM) Activity); @@ -2027,7 +2025,7 @@ if (NULL != RegistrationNotify->ErrorMessage) { if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, - Title, sizeof(Title) / sizeof(Title[0]))) + Title, ARRAYSIZE(Title))) { wcscpy(Title, L"ReactOS Setup"); } @@ -2199,14 +2197,14 @@ if (!SetupGetStringFieldW(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(WCHAR), + ARRAYSIZE(szValue), &LineLength)) { DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); return; } - if (wcscmp(szValue, L"yes") != 0) + if (_wcsicmp(szValue, L"yes") != 0) { DPRINT("Unattend setup was disabled by UnattendSetupEnabled key.\n"); return; @@ -2228,7 +2226,7 @@ if (!SetupGetStringFieldW(&InfContext, 0, szName, - sizeof(szName) / sizeof(WCHAR), + ARRAYSIZE(szName), &LineLength)) { DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); @@ -2238,52 +2236,52 @@ if (!SetupGetStringFieldW(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(WCHAR), + ARRAYSIZE(szValue), &LineLength)) { DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); return; } DPRINT1("Name %S Value %S\n", szName, szValue); - if (!wcscmp(szName, L"FullName")) - { - if ((sizeof(pSetupData->OwnerName) / sizeof(TCHAR)) > LineLength) + if (!_wcsicmp(szName, L"FullName")) + { + if (ARRAYSIZE(pSetupData->OwnerName) > LineLength) { wcscpy(pSetupData->OwnerName, szValue); } } - else if (!wcscmp(szName, L"OrgName")) - { - if ((sizeof(pSetupData->OwnerOrganization) / sizeof(WCHAR)) > LineLength) + else if (!_wcsicmp(szName, L"OrgName")) + { + if (ARRAYSIZE(pSetupData->OwnerOrganization) > LineLength) { wcscpy(pSetupData->OwnerOrganization, szValue); } } - else if (!wcscmp(szName, L"ComputerName")) - { - if ((sizeof(pSetupData->ComputerName) / sizeof(WCHAR)) > LineLength) + else if (!_wcsicmp(szName, L"ComputerName")) + { + if (ARRAYSIZE(pSetupData->ComputerName) > LineLength) { wcscpy(pSetupData->ComputerName, szValue); } } - else if (!wcscmp(szName, L"AdminPassword")) - { - if ((sizeof(pSetupData->AdminPassword) / sizeof(WCHAR)) > LineLength) + else if (!_wcsicmp(szName, L"AdminPassword")) + { + if (ARRAYSIZE(pSetupData->AdminPassword) > LineLength) { wcscpy(pSetupData->AdminPassword, szValue); } } - else if (!wcscmp(szName, L"TimeZoneIndex")) + else if (!_wcsicmp(szName, L"TimeZoneIndex")) { pSetupData->TimeZoneIndex = _wtoi(szValue); } - else if (!wcscmp(szName, L"DisableAutoDaylightTimeSet")) + else if (!_wcsicmp(szName, L"DisableAutoDaylightTimeSet")) { pSetupData->DisableAutoDaylightTimeSet = _wtoi(szValue); } - else if (!wcscmp(szName, L"DisableGeckoInst")) - { - if(!wcscmp(szValue, L"yes")) + else if (!_wcsicmp(szName, L"DisableGeckoInst")) + { + if (!_wcsicmp(szValue, L"yes")) pSetupData->DisableGeckoInst = TRUE; else pSetupData->DisableGeckoInst = FALSE; @@ -2306,7 +2304,7 @@ if (!SetupGetStringFieldW(&InfContext, 0, szName, - sizeof(szName) / sizeof(WCHAR), + ARRAYSIZE(szName), &LineLength)) { DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); @@ -2316,7 +2314,7 @@ if (!SetupGetStringFieldW(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(WCHAR), + ARRAYSIZE(szValue), &LineLength)) { DPRINT1("Error: SetupGetStringField failed with %d\n", GetLastError()); @@ -2328,22 +2326,22 @@ if (!iValue) continue; - if (!wcscmp(szName, L"BitsPerPel")) + if (!_wcsicmp(szName, L"BitsPerPel")) { dm.dmFields |= DM_BITSPERPEL; dm.dmBitsPerPel = iValue; } - else if (!wcscmp(szName, L"XResolution")) + else if (!_wcsicmp(szName, L"XResolution")) { dm.dmFields |= DM_PELSWIDTH; dm.dmPelsWidth = iValue; } - else if (!wcscmp(szName, L"YResolution")) + else if (!_wcsicmp(szName, L"YResolution")) { dm.dmFields |= DM_PELSHEIGHT; dm.dmPelsHeight = iValue; } - else if (!wcscmp(szName, L"VRefresh")) + else if (!_wcsicmp(szName, L"VRefresh")) { dm.dmFields |= DM_DISPLAYFREQUENCY; dm.dmDisplayFrequency = iValue; @@ -2375,7 +2373,7 @@ if (SetupGetStringFieldW(&InfContext, 0, szValue, - sizeof(szValue) / sizeof(WCHAR), + ARRAYSIZE(szValue), NULL)) { WCHAR szPath[MAX_PATH]; @@ -2491,7 +2489,7 @@ *hActCtx = INVALID_HANDLE_VALUE; - if (!GetModuleFileName(hDllInstance, fileBuffer, MAX_PATH)) + if (!GetModuleFileNameW(hDllInstance, fileBuffer, ARRAYSIZE(fileBuffer))) return FALSE; ActCtx.lpSource = fileBuffer;
7 years, 4 months
1
0
0
0
[hbelusca] 75522: [SYSSETUP]: Code formatting.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Aug 10 18:56:15 2017 New Revision: 75522 URL:
http://svn.reactos.org/svn/reactos?rev=75522&view=rev
Log: [SYSSETUP]: Code formatting. Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c Modified: branches/setup_improvements/dll/win32/syssetup/wizard.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/dll/win32/sy…
============================================================================== --- branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] (original) +++ branches/setup_improvements/dll/win32/syssetup/wizard.c [iso-8859-1] Thu Aug 10 18:56:15 2017 @@ -296,7 +296,7 @@ Projects = NULL; ProjectsSize = 256; - do + while (TRUE) { Projects = HeapAlloc(GetProcessHeap(), 0, ProjectsSize * sizeof(WCHAR)); if (NULL == Projects) @@ -316,9 +316,9 @@ HeapFree(GetProcessHeap(), 0, Projects); ProjectsSize *= 2; } - while (1); + CurrentProject = Projects; - while (L'\0' != *CurrentProject) + while (*CurrentProject != L'\0') { End = wcschr(CurrentProject, L'\n'); if (NULL != End) @@ -387,8 +387,6 @@ { HKEY hKey; LONG res; - - res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", @@ -867,50 +865,48 @@ RunControlPanelApplet(HWND hwnd, PCWSTR pwszCPLParameters) { MSG msg; - if (pwszCPLParameters) - { - STARTUPINFOW StartupInfo; - PROCESS_INFORMATION ProcessInformation; - WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL "; - - ZeroMemory(&StartupInfo, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(StartupInfo); - - ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters)); - wcscat(CmdLine, pwszCPLParameters); - - if (!CreateProcessW(NULL, - CmdLine, - NULL, - NULL, - FALSE, - 0, - NULL, - NULL, - &StartupInfo, - &ProcessInformation)) - { - MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR); - return FALSE; - } - - while((MsgWaitForMultipleObjects(1, &ProcessInformation.hProcess, FALSE, INFINITE, QS_ALLINPUT|QS_ALLPOSTMESSAGE )) != WAIT_OBJECT_0) - { - while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessageW(&msg); - } - } - CloseHandle(ProcessInformation.hThread); - CloseHandle(ProcessInformation.hProcess); - return TRUE; - } - else + STARTUPINFOW StartupInfo; + PROCESS_INFORMATION ProcessInformation; + WCHAR CmdLine[MAX_PATH] = L"rundll32.exe shell32.dll,Control_RunDLL "; + + if (!pwszCPLParameters) { MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR); return FALSE; } + + ZeroMemory(&StartupInfo, sizeof(StartupInfo)); + StartupInfo.cb = sizeof(StartupInfo); + + ASSERT(_countof(CmdLine) > wcslen(CmdLine) + wcslen(pwszCPLParameters)); + wcscat(CmdLine, pwszCPLParameters); + + if (!CreateProcessW(NULL, + CmdLine, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &StartupInfo, + &ProcessInformation)) + { + MessageBoxW(hwnd, L"Error: Failed to launch the Control Panel Applet.", NULL, MB_ICONERROR); + return FALSE; + } + + while ((MsgWaitForMultipleObjects(1, &ProcessInformation.hProcess, FALSE, INFINITE, QS_ALLINPUT|QS_ALLPOSTMESSAGE )) != WAIT_OBJECT_0) + { + while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + } + CloseHandle(ProcessInformation.hThread); + CloseHandle(ProcessInformation.hProcess); + return TRUE; } static VOID @@ -1501,7 +1497,7 @@ SetupData); SetAutoDaylightInfo(GetDlgItem(hwndDlg, IDC_AUTODAYLIGHT)); - if(!SetSystemLocalTime(hwndDlg, SetupData)) + if (!SetSystemLocalTime(hwndDlg, SetupData)) { if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP, Title, sizeof(Title) / sizeof(Title[0]))) { @@ -1894,15 +1890,15 @@ PREGISTRATIONDATA RegistrationData; DllCount = -1; - if (! SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2", - L"RegisterDlls", &Context)) + if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2", + L"RegisterDlls", &Context)) { DPRINT1("No RegistrationPhase2 section found\n"); return FALSE; } - if (! SetupGetStringFieldW(&Context, 1, SectionName, - sizeof(SectionName) / sizeof(SectionName[0]), - NULL)) + if (!SetupGetStringFieldW(&Context, 1, SectionName, + sizeof(SectionName) / sizeof(SectionName[0]), + NULL)) { DPRINT1("Unable to retrieve section name\n"); return FALSE; @@ -2196,7 +2192,7 @@ L"UnattendSetupEnabled", &InfContext)) { - DPRINT1("Error: Cant find UnattendSetupEnabled Key! %d\n", GetLastError()); + DPRINT1("Error: Cannot find UnattendSetupEnabled Key! %d\n", GetLastError()); return; } @@ -2288,13 +2284,12 @@ else if (!wcscmp(szName, L"DisableGeckoInst")) { if(!wcscmp(szValue, L"yes")) - pSetupData->DisableGeckoInst = 1; + pSetupData->DisableGeckoInst = TRUE; else - pSetupData->DisableGeckoInst = 0; - } - - } - while (SetupFindNextLine(&InfContext, &InfContext)); + pSetupData->DisableGeckoInst = FALSE; + } + + } while (SetupFindNextLine(&InfContext, &InfContext)); if (SetupFindFirstLineW(pSetupData->hUnattendedInf, L"Display", @@ -2353,8 +2348,7 @@ dm.dmFields |= DM_DISPLAYFREQUENCY; dm.dmDisplayFrequency = iValue; } - } - while (SetupFindNextLine(&InfContext, &InfContext)); + } while (SetupFindNextLine(&InfContext, &InfContext)); ChangeDisplaySettingsW(&dm, CDS_UPDATEREGISTRY); } @@ -2375,15 +2369,14 @@ NULL, &InfContext)) { - int i = 0; do { - if(SetupGetStringFieldW(&InfContext, - 0, - szValue, - sizeof(szValue) / sizeof(WCHAR), - NULL)) + if (SetupGetStringFieldW(&InfContext, + 0, + szValue, + sizeof(szValue) / sizeof(WCHAR), + NULL)) { WCHAR szPath[MAX_PATH]; swprintf(szName, L"%d", i); @@ -2403,7 +2396,7 @@ } } } - } while(SetupFindNextLine(&InfContext, &InfContext)); + } while (SetupFindNextLine(&InfContext, &InfContext)); } RegCloseKey(hKey); @@ -2605,7 +2598,6 @@ psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE); phpage[nPages++] = CreatePropertySheetPage(&psp); - /* Create the Owner page */ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE); @@ -2622,7 +2614,6 @@ psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE); phpage[nPages++] = CreatePropertySheetPage(&psp); - /* Create the DateTime page */ psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE); @@ -2655,7 +2646,6 @@ psp.pfnDlgProc = ProcessPageDlgProc; psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE); phpage[nPages++] = CreatePropertySheetPage(&psp); - /* Create the Finish page */ psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; @@ -2676,7 +2666,7 @@ /* Create title font */ pSetupData->hTitleFont = CreateTitleFont(); - pSetupData->hBoldFont = CreateBoldFont(); + pSetupData->hBoldFont = CreateBoldFont(); /* Display the wizard */ hWnd = (HWND)PropertySheet(&psh);
7 years, 4 months
1
0
0
0
[mjansen] 75521: [RAPPS] Delete uTorrent until CORE-13666 is cleared up.
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Aug 10 17:09:58 2017 New Revision: 75521 URL:
http://svn.reactos.org/svn/reactos?rev=75521&view=rev
Log: [RAPPS] Delete uTorrent until CORE-13666 is cleared up. Removed: trunk/reactos/media/rapps/utorrent.txt Removed: trunk/reactos/media/rapps/utorrent.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/rapps/utorrent.txt?r…
============================================================================== --- trunk/reactos/media/rapps/utorrent.txt [iso-8859-1] (original) +++ trunk/reactos/media/rapps/utorrent.txt (removed) @@ -1,64 +0,0 @@ -[Section] -Name = µTorrent -Version = CURRENT -License = Freeware for non-commercial uses -Description = Small and fast BitTorrent Client. -Size = 1.7 MiB -Category = 5 -URLSite =
http://www.utorrent.com/
-URLDownload =
http://download-new.utorrent.com/endpoint/utorrent/os/windows/track/stable/…
-CDPath = none - -[Section.0407] -License = Freeware für nichtkommerzielle Nutzung -Description = Kleiner und schneller BitTorrent Client. -Size = 1,7 MiB - -[Section.0a] -License = Gratuito para uso no comercial -Description = Un cliente BitTorrent pequeño y rápido. - -[Section.040c] -License = Gratuit pour une utilisation non-commerciale -Description = Client BitTorrent petit et rapide. -Size = 1,7 Mio - -[Section.0410] -License = Gratuita per un uso non-commerciale -Description = Piccolo e rapido Client BitTorrent. - -[Section.0413] -License = Freeware voor niet-commerciëel gebruik -Description = Kleine en snelle BitTorrent afnemer. - -[Section.0415] -License = Freeware (do użytku domowego) -Description = MaÅy i szybki klient BitTorrent. - -[Section.0418] -License = GratuitÄ pentru uz necomercial -Description = Client BitTorrent, mic Èi rapid. -Size = 1,7 Mio - -[Section.0419] -License = ÐеÑплаÑÐ½Ð°Ñ Ð´Ð»Ñ Ð½ÐµÐºÐ¾Ð¼Ð¼ÐµÑÑеÑкого иÑполÑÐ·Ð¾Ð²Ð°Ð½Ð¸Ñ -Description = ÐаленÑкий и бÑÑÑÑÑй ÐºÐ»Ð¸ÐµÐ½Ñ BitTorrent. -Size = 1,7 ÐиР- -[Section.041f] -License = Tecimlik olmayan kullanımlar için ücretsiz. -Description = Küçük ve hızlı BitTorrent istemcisi. -Size = 1,7 MiB - -[Section.0422] -License = ÐезплаÑна Ð´Ð»Ñ Ð½ÐµÐºÐ¾Ð¼ÐµÑÑÑйного викоÑиÑÑÐ°Ð½Ð½Ñ -Description = ÐаленÑкий Ñ Ñвидкий клÑÑÐ½Ñ BitTorrent. - -[Section.0804] -License = éåä¸ç¨éçå 费软件 -Description = å°èå¿«ç BitTorrent 客æ·ç«¯ã - -[Section.0813] -License = Freeware voor niet-commerciëel gebruik -Description = Kleine en snelle BitTorrent afnemer. -
7 years, 4 months
1
0
0
0
[rgampa] 75520: [USBXHCI] - written two functions sendCommand and ProcessEvent - SendCommand will be used to place a command trb on the command ring and activate doorbell - ProcessEvent will be cal...
by rgampa@svn.reactos.org
Author: rgampa Date: Thu Aug 10 11:20:45 2017 New Revision: 75520 URL:
http://svn.reactos.org/svn/reactos?rev=75520&view=rev
Log: [USBXHCI] - written two functions sendCommand and ProcessEvent - SendCommand will be used to place a command trb on the command ring and activate doorbell - ProcessEvent will be called every time we get an interrupt. this function processes all the valid event trbs. CORE-13344 Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c [iso-8859-1] Thu Aug 10 11:20:45 2017 @@ -247,7 +247,24 @@ IN USHORT Port) { DPRINT1("XHCI_RH_ClearFeaturePortEnable: function initiated\n"); - return 0; + PXHCI_EXTENSION XhciExtension; + PULONG PortStatusRegPointer; + XHCI_PORT_STATUS_CONTROL PortStatusRegister; + + XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); + PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); + PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; + + PortStatusRegister.AsULONG = PortStatusRegister.AsULONG & PORT_STATUS_MASK; + PortStatusRegister.PortEnableDisable = 1; + + WRITE_REGISTER_ULONG(PortStatusRegPointer , PortStatusRegister.AsULONG ); + + PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; + + ASSERT(PortStatusRegister.PortEnableDisable == 0); + return MP_STATUS_SUCCESS; } MPSTATUS Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] Thu Aug 10 11:20:45 2017 @@ -12,7 +12,7 @@ XHCI_Write64bitReg(IN PULONG baseAddr, IN ULONGLONG data) { - DPRINT1("XHCI_Write64bitReg: function initiated\n"); + //DPRINT1("XHCI_Write64bitReg: function initiated\n"); WRITE_REGISTER_ULONG(baseAddr, data); WRITE_REGISTER_ULONG(baseAddr+1, data >> 32); } @@ -44,6 +44,47 @@ IN PULONG EndpointRequirements) { DPRINT1("XHCI_QueryEndpointRequirements: function initiated\n"); + PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties = endpointParameters; + ULONG TransferType; + + TransferType = EndpointProperties->TransferType; + + switch (TransferType) + { + case USBPORT_TRANSFER_TYPE_ISOCHRONOUS: + DPRINT1("XHCI_QueryEndpointRequirements: IsoTransfer\n"); + //EndpointRequirements[1] = OHCI_MAX_ISO_TRANSFER_SIZE; + //EndpointRequirements[0] = sizeof(OHCI_HCD_ED) + + // OHCI_MAX_ISO_TD_COUNT * sizeof(OHCI_HCD_TD); + break; + + case USBPORT_TRANSFER_TYPE_CONTROL: + DPRINT1("XHCI_QueryEndpointRequirements: ControlTransfer\n"); + //EndpointRequirements[1] = 0; //OHCI_MAX_CONTROL_TRANSFER_SIZE; + //EndpointRequirements[0] = 0; //sizeof(OHCI_HCD_ED) + + // OHCI_MAX_CONTROL_TD_COUNT * sizeof(OHCI_HCD_TD); + break; + + case USBPORT_TRANSFER_TYPE_BULK: + DPRINT1("XHCI_QueryEndpointRequirements: BulkTransfer\n"); + //EndpointRequirements[1] = OHCI_MAX_BULK_TRANSFER_SIZE; + //EndpointRequirements[0] = sizeof(OHCI_HCD_ED) + + // OHCI_MAX_BULK_TD_COUNT * sizeof(OHCI_HCD_TD); + break; + + case USBPORT_TRANSFER_TYPE_INTERRUPT: + DPRINT1("XHCI_QueryEndpointRequirements: InterruptTransfer\n"); + //EndpointRequirements[1] = OHCI_MAX_INTERRUPT_TRANSFER_SIZE; + //EndpointRequirements[0] = sizeof(OHCI_HCD_ED) + + // OHCI_MAX_INTERRUPT_TD_COUNT * sizeof(OHCI_HCD_TD); + break; + + default: + DPRINT1("XHCI_QueryEndpointRequirements: Unknown TransferType - %x\n", + TransferType); + DbgBreakPoint(); + break; + } } VOID @@ -54,6 +95,130 @@ { DPRINT1("XHCI_CloseEndpoint: UNIMPLEMENTED. FIXME\n"); } +MPSTATUS +NTAPI +XHCI_ProcessEvent (IN PXHCI_EXTENSION XhciExtension) +{ + PXHCI_HC_RESOURCES HcResourcesVA; + PHYSICAL_ADDRESS HcResourcesPA; + XHCI_EVENT_RING_DEQUEUE_POINTER erstdp; + PULONG RunTimeRegisterBase; + PXHCI_TRB dequeue_pointer; + ULONG TRBType; + XHCI_EVENT_TRB eventTRB; + + HcResourcesVA = XhciExtension -> HcResourcesVA; + HcResourcesPA = XhciExtension -> HcResourcesPA; + + RunTimeRegisterBase = XhciExtension-> RunTimeRegisterBase; + dequeue_pointer = HcResourcesVA-> EventRing.dequeue_pointer; + while (TRUE) { + eventTRB = (*dequeue_pointer).EventTRB; + if (eventTRB.EventGenericTRB.CycleBit != HcResourcesVA-> EventRing.ConsumerCycleState){ + DPRINT1("XHCI_ProcessEvent: cycle bit mismatch. end of processing\n"); + DPRINT("XHCI_ProcessEvent: eventtrb word0 - %p\n", eventTRB.EventGenericTRB.Word0); + DPRINT("XHCI_ProcessEvent: eventtrb word1 - %p\n", eventTRB.EventGenericTRB.Word1); + DPRINT("XHCI_ProcessEvent: eventtrb word2 - %p\n", eventTRB.EventGenericTRB.Word2); + DPRINT("XHCI_ProcessEvent: eventtrb cycle bit - %x\n", eventTRB.EventGenericTRB.CycleBit); + break; + } + TRBType = eventTRB.EventGenericTRB.TRBType; + switch (TRBType){ + case TRANSFER_EVENT: + case COMMAND_COMPLETION_EVENT: + case PORT_STATUS_CHANGE_EVENT: + DPRINT1("XHCI_ProcessEvent: Port Status change event\n"); + case BANDWIDTH_RESET_REQUEST_EVENT: + case DOORBELL_EVENT: + case HOST_CONTROLLER_EVENT: + case DEVICE_NOTIFICATION_EVENT: + case MF_INDEX_WARP_EVENT: + default: + DPRINT1("XHCI_ProcessEvent: Unknown TRBType - %x\n", + TRBType); + DbgBreakPoint(); + } + if (dequeue_pointer == &(HcResourcesVA->EventRing.firstSeg.XhciTrb[255])){ + HcResourcesVA-> EventRing.ConsumerCycleState = ~(HcResourcesVA-> EventRing.ConsumerCycleState); + HcResourcesVA-> EventRing.ProducerCycleState = ~(HcResourcesVA-> EventRing.ProducerCycleState); + dequeue_pointer = &(HcResourcesVA->EventRing.firstSeg.XhciTrb[0]); + } + dequeue_pointer = dequeue_pointer + 1; + } + //erstdp.AsULONGLONG = READ_REGISTER_ULONG(RunTimeRegisterBase + XHCI_ERSTDP + 1); + //erstdp.AsULONGLONG = erstdp.AsULONGLONG <<32; + //erstdp.AsULONGLONG = erstdp.AsULONGLONG + READ_REGISTER_ULONG(RunTimeRegisterBase + XHCI_ERSTDP); + HcResourcesVA-> EventRing.dequeue_pointer = dequeue_pointer; + HcResourcesVA-> EventRing.enqueue_pointer = dequeue_pointer; + + erstdp.AsULONGLONG = HcResourcesPA.QuadPart + ((ULONG_PTR)dequeue_pointer - (ULONG_PTR)HcResourcesVA); + ASSERT(erstdp.AsULONGLONG >= HcResourcesPA.QuadPart && erstdp.AsULONGLONG < HcResourcesPA.QuadPart + sizeof(XHCI_HC_RESOURCES)) ; + erstdp.DequeueERSTIndex =0; + XHCI_Write64bitReg (RunTimeRegisterBase + XHCI_ERSTDP, erstdp.AsULONGLONG); + return MP_STATUS_SUCCESS; +} + +MPSTATUS +NTAPI +XHCI_SendCommand (IN XHCI_TRB CommandTRB, + IN PXHCI_EXTENSION XhciExtension) +{ + PXHCI_HC_RESOURCES HcResourcesVA; + PHYSICAL_ADDRESS HcResourcesPA; + PULONG DoorBellRegisterBase; + XHCI_DOORBELL Doorbell_0; + PXHCI_TRB enqueue_pointer; + PXHCI_TRB enqueue_pointer_prev; + PXHCI_TRB dequeue_pointer; + XHCI_TRB CheckLink; + PHYSICAL_ADDRESS LinkPointer; + + HcResourcesVA = XhciExtension -> HcResourcesVA; + HcResourcesPA = XhciExtension -> HcResourcesPA; + enqueue_pointer = HcResourcesVA -> CommandRing.enqueue_pointer; + dequeue_pointer = HcResourcesVA -> CommandRing.dequeue_pointer; + // check if ring is full + if ((enqueue_pointer + 1) == dequeue_pointer) { + DPRINT1 ("XHCI_SendCommand : Command ring is full"); + return MP_STATUS_FAILURE; + } + // check if the trb is link trb. + CheckLink = *enqueue_pointer; + if (CheckLink.LinkTRB.TRBType == LINK){ + LinkPointer.QuadPart = CheckLink.GenericTRB.Word1; + LinkPointer.QuadPart = LinkPointer.QuadPart << 32; + LinkPointer.QuadPart = LinkPointer.QuadPart + CheckLink.GenericTRB.Word0; + ASSERT(LinkPointer.QuadPart >= HcResourcesPA.QuadPart && LinkPointer.QuadPart < HcResourcesPA.QuadPart + sizeof(XHCI_HC_RESOURCES)) ; + enqueue_pointer_prev = enqueue_pointer; + enqueue_pointer = (PXHCI_TRB)(HcResourcesVA + LinkPointer.QuadPart - HcResourcesPA.QuadPart); + + if ((enqueue_pointer == dequeue_pointer) || (enqueue_pointer == dequeue_pointer + 1)){ // it can't move ahead break out of function + DPRINT1 ("XHCI_SendCommand : Command ring is full"); + return MP_STATUS_FAILURE; + } + // now the link trb is valid. set its cycle state to Producer cycle state for the command ring to read + CheckLink.LinkTRB.CycleBit = HcResourcesVA -> CommandRing.ProducerCycleState; + // write the link trb back. + *enqueue_pointer_prev = CheckLink; + // now we can go ahead to the next pointer where we want to write the new trb. before that check and toggle if necessaary. + if (CheckLink.LinkTRB.ToggleCycle == 1){ + HcResourcesVA -> CommandRing.ProducerCycleState = ~ (HcResourcesVA -> CommandRing.ProducerCycleState); + //HcResourcesVA -> CommandRing.ConsumerCycleState = ~ (HcResourcesVA -> CommandRing.ConsumerCycleState); update this when the xHC reaches link trb + } + } + // place trb on the command ring + *enqueue_pointer = CommandTRB; + enqueue_pointer = enqueue_pointer+1; + HcResourcesVA -> CommandRing.enqueue_pointer = enqueue_pointer; + // ring doorbell + DoorBellRegisterBase = XhciExtension->DoorBellRegisterBase; + Doorbell_0.DoorBellTarget = 0; + Doorbell_0.RsvdZ = 0; + Doorbell_0.AsULONG = 0; + WRITE_REGISTER_ULONG(DoorBellRegisterBase, Doorbell_0.AsULONG); + + return MP_STATUS_SUCCESS; +} MPSTATUS NTAPI XHCI_ControllerWorkTest(IN PXHCI_EXTENSION XhciExtension, @@ -108,10 +273,10 @@ } // check for event completion trb eventtrb = HcResourcesVA -> EventRing.firstSeg.XhciTrb[0]; - DPRINT("XHCI_ControllerWorkTest: eventtrb word0 - %p\n", eventtrb.EventTRB.Word0); - DPRINT("XHCI_ControllerWorkTest: eventtrb word1 - %p\n", eventtrb.EventTRB.Word1); - DPRINT("XHCI_ControllerWorkTest: eventtrb word2 - %p\n", eventtrb.EventTRB.Word2); - DPRINT("XHCI_ControllerWorkTest: eventtrb word3 - %p\n", eventtrb.EventTRB.Word3); + DPRINT("XHCI_ControllerWorkTest: eventtrb word0 - %p\n", eventtrb.GenericTRB.Word0); + DPRINT("XHCI_ControllerWorkTest: eventtrb word1 - %p\n", eventtrb.GenericTRB.Word1); + DPRINT("XHCI_ControllerWorkTest: eventtrb word2 - %p\n", eventtrb.GenericTRB.Word2); + DPRINT("XHCI_ControllerWorkTest: eventtrb word3 - %p\n", eventtrb.GenericTRB.Word3); // status check code Status.AsULONG = READ_REGISTER_ULONG(XhciExtension->OperationalRegs + XHCI_USBSTS); DPRINT("XHCI_ControllerWorkTest: Status HCHalted - %p\n", Status.HCHalted); @@ -167,8 +332,8 @@ USHORT MaxScratchPadBuffers; PULONG RunTimeRegisterBase; - XHCI_INTERRUPTER_MANAGEMENT Iman; - XHCI_INTERRUPTER_MODERATION Imod; + //XHCI_INTERRUPTER_MANAGEMENT Iman; + //XHCI_INTERRUPTER_MODERATION Imod; XHCI_EVENT_RING_TABLE_SIZE erstz; XHCI_EVENT_RING_TABLE_BASE_ADDR erstba; XHCI_EVENT_RING_DEQUEUE_POINTER erstdp; @@ -185,7 +350,9 @@ HcResourcesVA = (PXHCI_HC_RESOURCES)resourcesStartVA; ASSERT((ULONG_PTR)HcResourcesVA % PAGE_SIZE == 0); XhciExtension->HcResourcesVA = HcResourcesVA; + HcResourcesPA.QuadPart = (ULONG_PTR)resourcesStartPA; + XhciExtension->HcResourcesPA = HcResourcesPA; BaseIoAdress = XhciExtension->BaseIoAdress; OperationalRegs = XhciExtension->OperationalRegs; @@ -196,17 +363,42 @@ XHCI_Write64bitReg (OperationalRegs + XHCI_DCBAAP,DCBAAPointer.AsULONGLONG); // command ring intialisation. + HcResourcesVA->CommandRing.enqueue_pointer = &(HcResourcesVA->CommandRing.firstSeg.XhciTrb[0]); + HcResourcesVA->CommandRing.dequeue_pointer = &(HcResourcesVA->CommandRing.firstSeg.XhciTrb[0]); for(int i=0; i<256; i++){ - HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].CommandTRB.GenericTRB.Word0=0; - HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].CommandTRB.GenericTRB.Word1=0; - HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].CommandTRB.GenericTRB.Word2=0; - HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].CommandTRB.GenericTRB.Word3=0; + HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].GenericTRB.Word0=0; + HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].GenericTRB.Word1=0; + HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].GenericTRB.Word2=0; + HcResourcesVA->CommandRing.firstSeg.XhciTrb[i].GenericTRB.Word3=0; } CommandRingControlRegister.AsULONGLONG = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, CommandRing.firstSeg); CommandRingControlRegister_temp.AsULONGLONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_CRCR + 1) | READ_REGISTER_ULONG(OperationalRegs + XHCI_CRCR); - CommandRingControlRegister.RsvdP = CommandRingControlRegister_temp.RsvdP; + CommandRingControlRegister.RingCycleState = 1; + HcResourcesVA->CommandRing.ProducerCycleState = 1; + HcResourcesVA->CommandRing.ConsumerCycleState = 1; + CommandRingControlRegister.RsvdP = CommandRingControlRegister_temp.RsvdP; DPRINT1("XHCI_InitializeResources : CommandRingControlRegister %p\n",CommandRingControlRegister.AsULONGLONG ); XHCI_Write64bitReg (OperationalRegs + XHCI_CRCR, CommandRingControlRegister.AsULONGLONG); + + // Place link trb with toggle cycle state in the last link trb. + XHCI_TRB CommandLinkTRB; + CommandLinkTRB.GenericTRB.Word0 = 0; + CommandLinkTRB.GenericTRB.Word1 = 0; + CommandLinkTRB.GenericTRB.Word2 = 0; + CommandLinkTRB.GenericTRB.Word3 = 0; + ULONGLONG RingStartAddr; + + RingStartAddr = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, CommandRing.firstSeg); + CommandLinkTRB.GenericTRB.Word0 = RingStartAddr & 0x00000000FFFFFFF0; // physical addr is needed. but recheck assignment + CommandLinkTRB.LinkTRB.RingSegmentPointerHi = (RingStartAddr & 0xFFFFFFFF00000000) >>32; + CommandLinkTRB.LinkTRB.InterrupterTarget = 0; + CommandLinkTRB.LinkTRB.CycleBit = ~(HcResourcesVA->CommandRing.ProducerCycleState); + CommandLinkTRB.LinkTRB.ToggleCycle = 1; //impt + CommandLinkTRB.LinkTRB.ChainBit = 0; + CommandLinkTRB.LinkTRB.InterruptOnCompletion = 1; // NOT NECESSARY + CommandLinkTRB.LinkTRB.TRBType = LINK; + + HcResourcesVA->CommandRing.firstSeg.XhciTrb[255] = CommandLinkTRB; // end of command ring init //Primary Interrupter init @@ -219,6 +411,12 @@ WRITE_REGISTER_ULONG (RunTimeRegisterBase + XHCI_ERSTSZ , erstz.AsULONG); // event ring dequeue pointer. erstdp.AsULONGLONG = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, EventRing.firstSeg); + + HcResourcesVA->EventRing.enqueue_pointer = &(HcResourcesVA->EventRing.firstSeg.XhciTrb[0]); + HcResourcesVA->EventRing.dequeue_pointer = &(HcResourcesVA->EventRing.firstSeg.XhciTrb[0]); + + HcResourcesVA->EventRing.ProducerCycleState = 1; + HcResourcesVA->EventRing.ConsumerCycleState = 1; //ASSERT(erstdp.AsULONGLONG & 0x0F == 0); erstdp.DequeueERSTIndex =0; DPRINT1("XHCI_InitializeResources : erstdp.AsULONGLONG %p\n",erstdp.AsULONGLONG ); @@ -227,7 +425,7 @@ erstba.AsULONGLONG = HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, EventRingSegTable); EventRingSegTable.RingSegmentBaseAddr = (ULONGLONG)HcResourcesPA.QuadPart + FIELD_OFFSET(XHCI_HC_RESOURCES, EventRing.firstSeg.XhciTrb[0]); - EventRingSegTable.RingSegmentSize = 16; + EventRingSegTable.RingSegmentSize = 256; EventRingSegTable.RsvdZ = 0; HcResourcesVA->EventRingSegTable = EventRingSegTable; DPRINT1("XHCI_InitializeResources : erstba.AsULONGLONG %p\n",erstba.AsULONGLONG ); @@ -236,12 +434,12 @@ for(int i=0; i<256; i++){ - HcResourcesVA->EventRing.firstSeg.XhciTrb[i].EventTRB.Word0=0; - HcResourcesVA->EventRing.firstSeg.XhciTrb[i].EventTRB.Word1=0; - HcResourcesVA->EventRing.firstSeg.XhciTrb[i].EventTRB.Word2=0; - HcResourcesVA->EventRing.firstSeg.XhciTrb[i].EventTRB.Word3=0; - } - + HcResourcesVA->EventRing.firstSeg.XhciTrb[i].GenericTRB.Word0=0; + HcResourcesVA->EventRing.firstSeg.XhciTrb[i].GenericTRB.Word1=0; + HcResourcesVA->EventRing.firstSeg.XhciTrb[i].GenericTRB.Word2=0; + HcResourcesVA->EventRing.firstSeg.XhciTrb[i].GenericTRB.Word3=0; + } + // check if the controller supports 4k page size or quit. PageSize = XhciExtension-> PageSize; MaxScratchPadBuffers = XhciExtension->MaxScratchPadBuffers; @@ -532,12 +730,10 @@ XHCI_InterruptService(IN PVOID xhciExtension) { DPRINT1("XHCI_InterruptService: function initiated\n"); - XHCI_RT_REGISTER_SPACE_OFFSET RTSOffsetRegister; PULONG RunTimeRegisterBase; XHCI_INTERRUPTER_MANAGEMENT Iman; PXHCI_EXTENSION XhciExtension; XhciExtension = (PXHCI_EXTENSION)xhciExtension; - XHCI_EVENT_RING_DEQUEUE_POINTER erstdp; RunTimeRegisterBase = XhciExtension-> RunTimeRegisterBase; @@ -551,22 +747,11 @@ WRITE_REGISTER_ULONG(RunTimeRegisterBase + XHCI_IMAN, Iman.AsULONG); DPRINT1("XHCI_InterruptService: Succesful Interupt\n"); // changing the enque pointer - erstdp.AsULONGLONG = READ_REGISTER_ULONG(RunTimeRegisterBase + XHCI_ERSTDP + 1); - erstdp.AsULONGLONG = erstdp.AsULONGLONG <<32; - erstdp.AsULONGLONG = erstdp.AsULONGLONG + READ_REGISTER_ULONG(RunTimeRegisterBase + XHCI_ERSTDP); - - erstdp.EventRingSegDequeuePointer = erstdp.EventRingSegDequeuePointer +1; - erstdp.DequeueERSTIndex =0; - XHCI_Write64bitReg (RunTimeRegisterBase + XHCI_ERSTDP, erstdp.AsULONGLONG); - - /*PXHCI_HC_RESOURCES HcResourcesVA; - XHCI_TRB eventtrb; - HcResourcesVA = XhciExtension->HcResourcesVA; - eventtrb = HcResourcesVA -> EventRing.firstSeg.XhciTrb[0]; - DPRINT("XHCI_ControllerWorkTest: eventtrb word0 - %p\n", eventtrb.EventTRB.Word0); - DPRINT("XHCI_ControllerWorkTest: eventtrb word1 - %p\n", eventtrb.EventTRB.Word1); - DPRINT("XHCI_ControllerWorkTest: eventtrb word2 - %p\n", eventtrb.EventTRB.Word2); - DPRINT("XHCI_ControllerWorkTest: eventtrb word3 - %p\n", eventtrb.EventTRB.Word3);*/ + + XHCI_ProcessEvent(XhciExtension); + + + return TRUE; } @@ -688,7 +873,7 @@ PULONG OperationalRegs; PULONG RunTimeRegisterBase; XHCI_INTERRUPTER_MANAGEMENT Iman; - XHCI_USB_COMMAND usbCommand; + //XHCI_USB_COMMAND usbCommand; XhciExtension = (PXHCI_EXTENSION)xhciExtension; @@ -714,7 +899,7 @@ PULONG OperationalRegs; PULONG RunTimeRegisterBase; XHCI_INTERRUPTER_MANAGEMENT Iman; - XHCI_USB_COMMAND usbCommand; + //XHCI_USB_COMMAND usbCommand; XhciExtension = (PXHCI_EXTENSION)xhciExtension; Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drive…
============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] Thu Aug 10 11:20:45 2017 @@ -13,6 +13,83 @@ extern USBPORT_REGISTRATION_PACKET RegPacket; #define XHCI_FLAGS_CONTROLLER_SUSPEND 0x01 + +// TRB Types +// transfer TRBs ids +#define NORMAL 1 +#define SETUP_STAGE 2 +#define DATA_STAGE 3 +#define STATUS_STAGE 4 +#define ISOCH 5 +#define LINK 6 // BOTH TRNASFER AND COMMAND TRB TYPE +#define EVENT_DATA 7 +#define NO_OP 8 + +// COMMAND TRB IDs +#define ENABLE_SLOT_COMMAND 9 +#define DISABLE_SLOT_COMMAND 10 +#define ADDRESS_DEVICE_COMMAND 11 +#define CONFIGURE_ENDPOINT_COMMAND 12 +#define EVALUATE_CONTEXT_COMMAND 13 +#define RESET_ENDPOINT_COMMAND 14 +#define STOP_ENDPOINT_COMMAND 15 +#define SET_TR_DEQUEUE_COMMAND 16 +#define RESET_DEVICE_COMMAND 17 +#define FORCE_EVENT_COMMMAND 18 +#define NEGOTIATE_BANDWIDTH_COMMAND 19 +#define SET_LATENCY_TOLERANCE_COMMAND 20 +#define GET_PORT_BANDWIDTH_COMMAND 21 +#define FORCE_HEADER_COMMAND 22 +#define NO_OP_COMMAND 23 + +// EVENT TRB IDs +#define TRANSFER_EVENT 32 +#define COMMAND_COMPLETION_EVENT 33 +#define PORT_STATUS_CHANGE_EVENT 34 +#define BANDWIDTH_RESET_REQUEST_EVENT 35 +#define DOORBELL_EVENT 36 +#define HOST_CONTROLLER_EVENT 37 +#define DEVICE_NOTIFICATION_EVENT 38 +#define MF_INDEX_WARP_EVENT 39 + + +// TRB COMPLETION CODES +#define INVALID 0 +#define SUCCESS 1 +#define DATA_BUFFER_ERROR 2 +#define BABBLLE_DETECTED_ERROR 3 +#define USB_TRNASACTION_ERROR 4 +#define TRB_ERROR 5 +#define STALL_ERROR 6 +#define RESOURCE_ERROR 7 +#define BANDWIDTH_ERROR 8 +#define NO_SLOTS_AVAILABLE_ERROR 9 +#define INVALID_STREAM_TYPE_ERROR 10 +#define SLOT_NOT_ENABLED_ERROR 11 +#define ENDPOINT_NOT_ENABLED_ERROR 12 +#define SHORT_PACKET 13 +#define RING_UNDERRUN 14 +#define RING_OVERRUN 15 +#define VF_EVENT_RING_FULL_ERROR 16 +#define PARAMETER_ERROR 17 +#define BANDWIDTH_OVERRUN_ERROR 18 +#define CONTEXT_STATE_ERROR 19 +#define NO_PING_RESPONSE_ERROR 20 +#define EVENT_RING_FULL_ERROR 21 +#define INCOMPATIBLE_DEVICE_ERROR 22 +#define MISSED_SERVICE_ERROR 23 +#define COMMAND_RING_STOPPED 24 +#define COMMAND_ABORTED 25 +#define STOPPED 26 +#define STOPPED_LENGTH_INVALID 27 +#define STOPPED_SHORT_PACKET 28 +#define MAX_EXIT_LATENCY_ERROR 29 +#define ISOCH_BUFFER_OVERRUN 31 +#define EVENT_LOST_ERROR 32 +#define UNDEFINED_ERROR 33 +#define INVALID_STREAM_ID_ERROR 34 +#define SECONDARY_BANDWIDTH_ERROR 35 +#define SPLIT_TRNASACTION_ERROR 36 //Data structures typedef struct _XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY { @@ -67,8 +144,8 @@ C_ASSERT(sizeof(XHCI_COMMAND_NO_OP_TRB) == 16); typedef union _XHCI_COMMAND_TRB { XHCI_COMMAND_NO_OP_TRB NoOperation; - XHCI_LINK_TRB Link; - XHCI_GENERIC_TRB GenericTRB; + //XHCI_LINK_TRB Link; + //XHCI_GENERIC_TRB GenericTRB; }XHCI_COMMAND_TRB, *PXHCI_COMMAND_TRB; C_ASSERT(sizeof(XHCI_COMMAND_TRB) == 16); /*typedef struct _XHCI_COMMAND_RING { @@ -77,7 +154,6 @@ PXHCI_COMMAND_TRB CRDequePointer; } XHCI_COMMAND_RING;*/ //----------------------------------------CONTROL TRANSFER DATA STRUCTUERS-------------------------------------------- - typedef struct _XHCI_CONTROL_SETUP_TRB { struct { ULONG bmRequestType : 8; @@ -166,13 +242,66 @@ } XHCI_CONTROL_TRB, *PXHCI_CONTROL_TRB; C_ASSERT(sizeof(XHCI_CONTROL_TRB) == 16); //----------------event strucs------------------- -typedef struct _XHCI_EVENT_TRB { +typedef struct _XHCI_EVENT_COMMAND_COMPLETION_TRB{ + struct { + ULONG RsvdZ1 : 4; + ULONG CommandTRBPointerLo : 28; + }; + ULONG CommandTRBPointerHi; + struct { + ULONG CommandCompletionParam : 24; + ULONG CompletionCode : 8; + }; + struct { + ULONG CycleBit : 1; + ULONG RsvdZ2 : 9; + ULONG TRBType : 6; + ULONG VFID : 8; + ULONG SlotID : 8; + }; +} XHCI_EVENT_COMMAND_COMPLETION_TRB; +C_ASSERT(sizeof(XHCI_EVENT_COMMAND_COMPLETION_TRB) == 16); + +typedef struct _XHCI_EVENT_PORT_STATUS_CHANGE_TRB{ + struct { + ULONG RsvdZ1 : 24; + ULONG PortID : 8; + }; + ULONG RsvdZ2; + struct { + ULONG RsvdZ3 : 24; + ULONG CompletionCode : 8; + }; + struct { + ULONG CycleBit : 1; + ULONG RsvdZ4 : 9; + ULONG TRBType : 6; + ULONG RsvdZ5 : 16; + }; +} XHCI_EVENT_PORT_STATUS_CHANGE_TRB; +C_ASSERT(sizeof(XHCI_EVENT_PORT_STATUS_CHANGE_TRB) == 16); + +typedef struct _XHCI_EVENT_GENERIC_TRB{ ULONG Word0; ULONG Word1; ULONG Word2; - ULONG Word3; + struct { + ULONG CycleBit : 1; + ULONG RsvdZ1 : 9; + ULONG TRBType : 6; + ULONG RsvdZ2 : 8; + ULONG SlotID : 8; + }; +}XHCI_EVENT_GENERIC_TRB; +C_ASSERT(sizeof(XHCI_EVENT_GENERIC_TRB) == 16); + +typedef union _XHCI_EVENT_TRB { + XHCI_EVENT_COMMAND_COMPLETION_TRB CommandCompletionTRB; + XHCI_EVENT_PORT_STATUS_CHANGE_TRB PortStatusChangeTRB; + XHCI_EVENT_GENERIC_TRB EventGenericTRB; }XHCI_EVENT_TRB, *PXHCI_EVENT_TRB; C_ASSERT(sizeof(XHCI_EVENT_TRB) == 16); + typedef struct _XHCI_EVENT_RING_SEGMENT_TABLE{ ULONGLONG RingSegmentBaseAddr; struct { @@ -187,6 +316,7 @@ XHCI_LINK_TRB LinkTRB; XHCI_CONTROL_TRB ControlTRB; XHCI_EVENT_TRB EventTRB; + XHCI_GENERIC_TRB GenericTRB; } XHCI_TRB, *PXHCI_TRB; typedef struct _XHCI_SEGMENT { @@ -201,7 +331,11 @@ PXHCI_TRB enqueue_pointer; PXHCI_SEGMENT enqueue_segment; PXHCI_SEGMENT dequeue_segment; - ULONGLONG Padding; + struct { + UCHAR ProducerCycleState : 1; + UCHAR ConsumerCycleState : 1; + }; + //ULONGLONG Padding; } XHCI_RING, *PXHCI_RING; typedef struct _XHCI_HC_RESOURCES { XHCI_DEVICE_CONTEXT_BASE_ADD_ARRAY DCBAA; @@ -230,6 +364,7 @@ PMDL ScratchPadArrayMDL; PMDL ScratchPadBufferMDL; PXHCI_HC_RESOURCES HcResourcesVA; + PHYSICAL_ADDRESS HcResourcesPA; } XHCI_EXTENSION, *PXHCI_EXTENSION;
7 years, 4 months
1
0
0
0
[hbelusca] 75519: [USETUP]: NT RTL thread functions use 'NULL' (instead of 'INVALID_HANDLE_VALUE' which is a Win32 thing) for thread handles that are "invalid" / uninitialized.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Aug 9 20:43:02 2017 New Revision: 75519 URL:
http://svn.reactos.org/svn/reactos?rev=75519&view=rev
Log: [USETUP]: NT RTL thread functions use 'NULL' (instead of 'INVALID_HANDLE_VALUE' which is a Win32 thing) for thread handles that are "invalid" / uninitialized. Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Wed Aug 9 20:43:02 2017 @@ -629,10 +629,10 @@ } /* Start the PnP thread */ - if (hPnpThread != INVALID_HANDLE_VALUE) + if (hPnpThread != NULL) { NtResumeThread(hPnpThread, NULL); - hPnpThread = INVALID_HANDLE_VALUE; + hPnpThread = NULL; } CheckUnattendedSetup(&USetupData); @@ -4605,7 +4605,7 @@ &hPnpThread, NULL); if (!NT_SUCCESS(Status)) - hPnpThread = INVALID_HANDLE_VALUE; + hPnpThread = NULL; if (!CONSOLE_Init()) {
7 years, 4 months
1
0
0
0
[hbelusca] 75518: [USETUP][SETUPLIB]: Code refactoring: - Move several global setup variables into a structure "USETUP_DATA", similar to the syssetup structure "SETUPDATA" (or the WIP 1st-stage ins...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Aug 9 20:39:45 2017 New Revision: 75518 URL:
http://svn.reactos.org/svn/reactos?rev=75518&view=rev
Log: [USETUP][SETUPLIB]: Code refactoring: - Move several global setup variables into a structure "USETUP_DATA", similar to the syssetup structure "SETUPDATA" (or the WIP 1st-stage installer structure of the same name), so that these variables can be set easily by different helper setup functions; - Move CheckUnattendedSetup() and GetSourcePaths() to setuplib and make CheckUnattendedSetup() use the USETUP_DATA structure; - Add a LoadSetupInf() function that loads the txtsetup.sif file (factoring out the corresponding code in usetup); - Add a InstallSetupInfFile() function (that I'll certainly rename later on) whose purpose is to create a valid "$winnt$.inf" setup installation file in the ReactOS\system32 directory, which should help the 2nd-stage installer to correctly retrieve the source installation media we used during 1st-stage, and contain the unattended setup lines copied from unattend.inf. This is done in a Windows-compatible way. - Add the lib/infsupp.c and lib/setuplib.c to compilation. Added: branches/setup_improvements/base/setup/lib/setuplib.c (with props) Modified: branches/setup_improvements/base/setup/lib/CMakeLists.txt branches/setup_improvements/base/setup/lib/setuplib.h branches/setup_improvements/base/setup/usetup/interface/usetup.c Modified: branches/setup_improvements/base/setup/lib/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
============================================================================== --- branches/setup_improvements/base/setup/lib/CMakeLists.txt [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/lib/CMakeLists.txt [iso-8859-1] Wed Aug 9 20:39:45 2017 @@ -5,12 +5,14 @@ filesup.c fsutil.c genlist.c + infsupp.c inicache.c ntverrsrc.c osdetect.c partlist.c registry.c regutil.c + setuplib.c precomp.h) add_library(setuplib ${SOURCE}) Added: branches/setup_improvements/base/setup/lib/setuplib.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
============================================================================== --- branches/setup_improvements/base/setup/lib/setuplib.c (added) +++ branches/setup_improvements/base/setup/lib/setuplib.c [iso-8859-1] Wed Aug 9 20:39:45 2017 @@ -0,0 +1,512 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Setup Library + * FILE: base/setup/lib/setuplib.c + * PURPOSE: Setup Library - Main initialization helpers + * PROGRAMMERS: Casper S. Hornstrup (chorns(a)users.sourceforge.net) + * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr) + */ + +/* INCLUDES *****************************************************************/ + +#include "precomp.h" +#include "filesup.h" +#include "infsupp.h" +#include "inicache.h" + +#include "setuplib.h" + +#define NDEBUG +#include <debug.h> + + +/* GLOBALS ******************************************************************/ + +/* FUNCTIONS ****************************************************************/ + +VOID +CheckUnattendedSetup( + IN OUT PUSETUP_DATA pSetupData) +{ + INFCONTEXT Context; + HINF UnattendInf; + UINT ErrorLine; + INT IntValue; + PWCHAR Value; + WCHAR UnattendInfPath[MAX_PATH]; + + CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, + pSetupData->SourcePath.Buffer, L"unattend.inf"); + + if (DoesFileExist(NULL, UnattendInfPath) == FALSE) + { + DPRINT("Does not exist: %S\n", UnattendInfPath); + return; + } + + /* Load 'unattend.inf' from installation media */ + UnattendInf = SetupOpenInfFileExW(UnattendInfPath, + NULL, + INF_STYLE_WIN4, + pSetupData->LanguageId, + &ErrorLine); + + if (UnattendInf == INVALID_HANDLE_VALUE) + { + DPRINT("SetupOpenInfFileExW() failed\n"); + return; + } + + /* Open 'Unattend' section */ + if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"Signature", &Context)) + { + DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n"); + goto Quit; + } + + /* Get pointer 'Signature' key */ + if (!INF_GetData(&Context, NULL, &Value)) + { + DPRINT("INF_GetData() failed for key 'Signature'\n"); + goto Quit; + } + + /* Check 'Signature' string */ + if (_wcsicmp(Value, L"$ReactOS$") != 0) + { + DPRINT("Signature not $ReactOS$\n"); + INF_FreeData(Value); + goto Quit; + } + + INF_FreeData(Value); + + /* Check if Unattend setup is enabled */ + if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context)) + { + DPRINT("Can't find key 'UnattendSetupEnabled'\n"); + goto Quit; + } + + if (!INF_GetData(&Context, NULL, &Value)) + { + DPRINT("Can't read key 'UnattendSetupEnabled'\n"); + goto Quit; + } + + if (_wcsicmp(Value, L"yes") != 0) + { + DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n"); + INF_FreeData(Value); + goto Quit; + } + + INF_FreeData(Value); + + /* Search for 'DestinationDiskNumber' in the 'Unattend' section */ + if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context)) + { + DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n"); + goto Quit; + } + + if (!SetupGetIntField(&Context, 1, &IntValue)) + { + DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n"); + goto Quit; + } + + pSetupData->DestinationDiskNumber = (LONG)IntValue; + + /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */ + if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context)) + { + DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n"); + goto Quit; + } + + if (!SetupGetIntField(&Context, 1, &IntValue)) + { + DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n"); + goto Quit; + } + + pSetupData->DestinationPartitionNumber = (LONG)IntValue; + + /* Search for 'InstallationDirectory' in the 'Unattend' section (optional) */ + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"InstallationDirectory", &Context)) + { + /* Get pointer 'InstallationDirectory' key */ + if (!INF_GetData(&Context, NULL, &Value)) + { + DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n"); + goto Quit; + } + wcscpy(pSetupData->InstallationDirectory, Value); + INF_FreeData(Value); + } + + IsUnattendedSetup = TRUE; + DPRINT("Running unattended setup\n"); + + /* Search for 'MBRInstallType' in the 'Unattend' section */ + pSetupData->MBRInstallType = -1; + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context)) + { + if (SetupGetIntField(&Context, 1, &IntValue)) + { + pSetupData->MBRInstallType = IntValue; + } + } + + /* Search for 'FormatPartition' in the 'Unattend' section */ + pSetupData->FormatPartition = 0; + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context)) + { + if (SetupGetIntField(&Context, 1, &IntValue)) + { + pSetupData->FormatPartition = IntValue; + } + } + + pSetupData->AutoPartition = 0; + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context)) + { + if (SetupGetIntField(&Context, 1, &IntValue)) + { + pSetupData->AutoPartition = IntValue; + } + } + + /* Search for LocaleID in the 'Unattend' section */ + if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"LocaleID", &Context)) + { + if (INF_GetData(&Context, NULL, &Value)) + { + LONG Id = wcstol(Value, NULL, 16); + swprintf(pSetupData->LocaleID, L"%08lx", Id); + INF_FreeData(Value); + } + } + +Quit: + SetupCloseInfFile(UnattendInf); +} + +VOID +InstallSetupInfFile( + IN OUT PUSETUP_DATA pSetupData) +{ + NTSTATUS Status; + PINICACHE IniCache; + +#if 0 // HACK FIXME! + PINICACHE UnattendCache; + PINICACHEITERATOR Iterator; +#else + // PCWSTR CrLf = L"\r\n"; + PCSTR CrLf = "\r\n"; + HANDLE FileHandle, UnattendFileHandle, SectionHandle; + FILE_STANDARD_INFORMATION FileInfo; + ULONG FileSize; + PVOID ViewBase; + UNICODE_STRING FileName; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; +#endif + + PINICACHESECTION IniSection; + WCHAR PathBuffer[MAX_PATH]; + WCHAR UnattendInfPath[MAX_PATH]; + + /* Create a $winnt$.inf file with default entries */ + IniCache = IniCacheCreate(); + if (!IniCache) + return; + + IniSection = IniCacheAppendSection(IniCache, L"SetupParams"); + if (IniSection) + { + /* Key "skipmissingfiles" */ + // StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), + // L"\"%s\"", L"WinNt5.2"); + // IniCacheInsertKey(IniSection, NULL, INSERT_LAST, + // L"Version", PathBuffer); + } + + IniSection = IniCacheAppendSection(IniCache, L"Data"); + if (IniSection) + { + StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), + L"\"%s\"", IsUnattendedSetup ? L"yes" : L"no"); + IniCacheInsertKey(IniSection, NULL, INSERT_LAST, + L"UnattendedInstall", PathBuffer); + + // "floppylessbootpath" (yes/no) + + StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), + L"\"%s\"", L"winnt"); + IniCacheInsertKey(IniSection, NULL, INSERT_LAST, + L"ProductType", PathBuffer); + + StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), + L"\"%s\\\"", pSetupData->SourceRootPath.Buffer); + IniCacheInsertKey(IniSection, NULL, INSERT_LAST, + L"SourcePath", PathBuffer); + + // "floppyless" ("0") + } + +#if 0 + + /* TODO: Append the standard unattend.inf file */ + CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, pSetupData->SourcePath.Buffer, L"unattend.inf"); + if (DoesFileExist(NULL, UnattendInfPath) == FALSE) + { + DPRINT("Does not exist: %S\n", UnattendInfPath); + goto Quit; + } + + Status = IniCacheLoad(&UnattendCache, UnattendInfPath, FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Cannot load %S as an INI file!\n", UnattendInfPath); + goto Quit; + } + + IniCacheDestroy(UnattendCache); + +Quit: + CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, + pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf"); + IniCacheSave(IniCache, PathBuffer); + IniCacheDestroy(IniCache); + +#else + + CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, + pSetupData->DestinationPath.Buffer, L"System32\\$winnt$.inf"); + IniCacheSave(IniCache, PathBuffer); + IniCacheDestroy(IniCache); + + /* TODO: Append the standard unattend.inf file */ + CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, + pSetupData->SourcePath.Buffer, L"unattend.inf"); + if (DoesFileExist(NULL, UnattendInfPath) == FALSE) + { + DPRINT("Does not exist: %S\n", UnattendInfPath); + return; + } + + RtlInitUnicodeString(&FileName, PathBuffer); + InitializeObjectAttributes(&ObjectAttributes, + &FileName, + OBJ_CASE_INSENSITIVE | OBJ_OPENIF, + NULL, + NULL); + Status = NtOpenFile(&FileHandle, + FILE_APPEND_DATA | SYNCHRONIZE, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Cannot load %S as an INI file!\n", PathBuffer); + return; + } + + /* Query the file size */ + Status = NtQueryInformationFile(FileHandle, + &IoStatusBlock, + &FileInfo, + sizeof(FileInfo), + FileStandardInformation); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status); + FileInfo.EndOfFile.QuadPart = 0ULL; + } + + Status = OpenAndMapFile(NULL, + UnattendInfPath, + &UnattendFileHandle, + &SectionHandle, + &ViewBase, + &FileSize, + FALSE); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Cannot load %S !\n", UnattendInfPath); + NtClose(FileHandle); + return; + } + + /* Write to the INI file */ + + /* "\r\n" */ + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + (PVOID)CrLf, + 2 * sizeof(CHAR), // 2 * sizeof(WCHAR), + &FileInfo.EndOfFile, + NULL); + + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + ViewBase, + FileSize, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtWriteFile() failed (Status %lx)\n", Status); + } + + /* Finally, unmap and close the file */ + UnMapFile(SectionHandle, ViewBase); + NtClose(UnattendFileHandle); + + NtClose(FileHandle); +#endif +} + + + +NTSTATUS +GetSourcePaths( + OUT PUNICODE_STRING SourcePath, + OUT PUNICODE_STRING SourceRootPath, + OUT PUNICODE_STRING SourceRootDir) +{ + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); + UNICODE_STRING SourceName; + WCHAR SourceBuffer[MAX_PATH] = L""; + HANDLE Handle; + ULONG Length; + PWCHAR Ptr; + + InitializeObjectAttributes(&ObjectAttributes, + &LinkName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenSymbolicLinkObject(&Handle, + SYMBOLIC_LINK_ALL_ACCESS, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + return Status; + + RtlInitEmptyUnicodeString(&SourceName, SourceBuffer, sizeof(SourceBuffer)); + + Status = NtQuerySymbolicLinkObject(Handle, + &SourceName, + &Length); + NtClose(Handle); + + if (!NT_SUCCESS(Status)) + return Status; + + RtlCreateUnicodeString(SourcePath, + SourceName.Buffer); + + /* Strip trailing directory */ + Ptr = wcsrchr(SourceName.Buffer, OBJ_NAME_PATH_SEPARATOR); + if (Ptr) + { + RtlCreateUnicodeString(SourceRootDir, Ptr); + *Ptr = UNICODE_NULL; + } + else + { + RtlCreateUnicodeString(SourceRootDir, L""); + } + + RtlCreateUnicodeString(SourceRootPath, + SourceName.Buffer); + + return STATUS_SUCCESS; +} + + +ERROR_NUMBER +LoadSetupInf( + OUT HINF* SetupInf, + IN OUT PUSETUP_DATA pSetupData) +{ + INFCONTEXT Context; + UINT ErrorLine; + INT IntValue; + PWCHAR Value; + WCHAR FileNameBuffer[MAX_PATH]; + + CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2, + pSetupData->SourcePath.Buffer, L"txtsetup.sif"); + + *SetupInf = SetupOpenInfFileExW(FileNameBuffer, + NULL, + INF_STYLE_WIN4, + pSetupData->LanguageId, + &ErrorLine); + + if (*SetupInf == INVALID_HANDLE_VALUE) + return ERROR_LOAD_TXTSETUPSIF; + + /* Open 'Version' section */ + if (!SetupFindFirstLineW(*SetupInf, L"Version", L"Signature", &Context)) + return ERROR_CORRUPT_TXTSETUPSIF; + + /* Get pointer 'Signature' key */ + if (!INF_GetData(&Context, NULL, &Value)) + return ERROR_CORRUPT_TXTSETUPSIF; + + /* Check 'Signature' string */ + if (_wcsicmp(Value, L"$ReactOS$") != 0) + { + INF_FreeData(Value); + return ERROR_SIGNATURE_TXTSETUPSIF; + } + + INF_FreeData(Value); + + /* Open 'DiskSpaceRequirements' section */ + if (!SetupFindFirstLineW(*SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context)) + return ERROR_CORRUPT_TXTSETUPSIF; + + pSetupData->RequiredPartitionDiskSpace = ~0; + + /* Get the 'FreeSysPartDiskSpace' value */ + if (!SetupGetIntField(&Context, 1, &IntValue)) + return ERROR_CORRUPT_TXTSETUPSIF; + + pSetupData->RequiredPartitionDiskSpace = (ULONG)IntValue; + + // + // TODO: Support "SetupSourceDevice" and "SetupSourcePath" in txtsetup.sif + // See CORE-9023 + // + + /* Search for 'DefaultPath' in the 'SetupData' section */ + if (SetupFindFirstLineW(*SetupInf, L"SetupData", L"DefaultPath", &Context)) + { + /* Get pointer 'DefaultPath' key */ + if (!INF_GetData(&Context, NULL, &Value)) + return ERROR_CORRUPT_TXTSETUPSIF; + + wcscpy(pSetupData->InstallationDirectory, Value); + INF_FreeData(Value); + } + + return ERROR_SUCCESS; +} + +/* EOF */ Propchange: branches/setup_improvements/base/setup/lib/setuplib.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/setup_improvements/base/setup/lib/setuplib.h URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
============================================================================== --- branches/setup_improvements/base/setup/lib/setuplib.h [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/lib/setuplib.h [iso-8859-1] Wed Aug 9 20:39:45 2017 @@ -33,6 +33,7 @@ #include "filesup.h" #include "fsutil.h" #include "genlist.h" +#include "infsupp.h" #include "inicache.h" #include "partlist.h" #include "arcname.h" @@ -50,4 +51,74 @@ // #define PB (KB*KB*KB*KB*KB) +/* TYPEDEFS *****************************************************************/ + +typedef struct _USETUP_DATA +{ +/* SOURCE Paths *****/ + UNICODE_STRING SourceRootPath; + UNICODE_STRING SourceRootDir; + UNICODE_STRING SourcePath; + +/* DESTINATION Paths *****/ + /* + * Path to the system partition, where the boot manager resides. + * On x86 PCs, this is usually the active partition. + * On ARC, (u)EFI, ... platforms, this is a dedicated partition. + * + * For more information, see: + *
https://en.wikipedia.org/wiki/System_partition_and_boot_partition
+ *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-vo…
+ *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.h…
+ *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.h…
+ *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system…
+ *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-v…
+ */ + UNICODE_STRING SystemRootPath; + + /* Path to the installation directory inside the ReactOS boot partition */ + UNICODE_STRING DestinationPath; /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/ + UNICODE_STRING DestinationArcPath; /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/ + UNICODE_STRING DestinationRootPath; + + LONG DestinationDiskNumber; + LONG DestinationPartitionNumber; + LONG MBRInstallType; + + LONG FormatPartition; + LONG AutoPartition; + + WCHAR LocaleID[9]; + LANGID LanguageId; + + ULONG RequiredPartitionDiskSpace; + WCHAR InstallationDirectory[MAX_PATH]; +} USETUP_DATA, *PUSETUP_DATA; + +// HACK!! +extern BOOLEAN IsUnattendedSetup; + + +/* FUNCTIONS ****************************************************************/ + +VOID +CheckUnattendedSetup( + IN OUT PUSETUP_DATA pSetupData); + +VOID +InstallSetupInfFile( + IN OUT PUSETUP_DATA pSetupData); + +NTSTATUS +GetSourcePaths( + OUT PUNICODE_STRING SourcePath, + OUT PUNICODE_STRING SourceRootPath, + OUT PUNICODE_STRING SourceRootDir); + +ERROR_NUMBER +LoadSetupInf( + OUT HINF* SetupInf, + IN OUT PUSETUP_DATA pSetupData); + + /* EOF */ Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Wed Aug 9 20:39:45 2017 @@ -38,36 +38,12 @@ #include <debug.h> -/* GLOBALS ******************************************************************/ +/* GLOBALS & LOCALS *********************************************************/ HANDLE ProcessHeap; -static UNICODE_STRING SourceRootPath; -static UNICODE_STRING SourceRootDir; -static UNICODE_STRING SourcePath; - BOOLEAN IsUnattendedSetup = FALSE; -LONG UnattendDestinationDiskNumber; -LONG UnattendDestinationPartitionNumber; -LONG UnattendMBRInstallType = -1; -LONG UnattendFormatPartition = 0; -LONG AutoPartition = 0; -WCHAR UnattendInstallationDirectory[MAX_PATH]; -PWCHAR SelectedLanguageId; -WCHAR LocaleID[9]; -WCHAR DefaultLanguage[20]; -WCHAR DefaultKBLayout[20]; -static BOOLEAN RepairUpdateFlag = FALSE; -static HANDLE hPnpThread = INVALID_HANDLE_VALUE; - -static PPARTLIST PartitionList = NULL; -static PPARTENTRY TempPartition = NULL; -static FORMATMACHINESTATE FormatState = Start; - - -/* LOCALS *******************************************************************/ - -static PFILE_SYSTEM_LIST FileSystemList = NULL; +static USETUP_DATA USetupData; /* * NOTE: Technically only used for the COPYCONTEXT InstallPath member @@ -75,28 +51,26 @@ */ static UNICODE_STRING InstallPath; -/* - * Path to the system partition, where the boot manager resides. - * On x86 PCs, this is usually the active partition. - * On ARC, (u)EFI, ... platforms, this is a dedicated partition. - * - * For more information, see: - *
https://en.wikipedia.org/wiki/System_partition_and_boot_partition
- *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-vo…
- *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.h…
- *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.h…
- *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system…
- *
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-v…
- */ -static UNICODE_STRING SystemRootPath; - -/* Path to the installation directory inside the ReactOS boot partition */ -static UNICODE_STRING DestinationPath; -static UNICODE_STRING DestinationArcPath; -static UNICODE_STRING DestinationRootPath; - // FIXME: Is it really useful?? Just used for SetDefaultPagefile... static WCHAR DestinationDriveLetter; + + +/* OTHER Stuff *****/ + +PWCHAR SelectedLanguageId; +static WCHAR DefaultLanguage[20]; // Copy of string inside LanguageList +static WCHAR DefaultKBLayout[20]; // Copy of string inside KeyboardList + +static BOOLEAN RepairUpdateFlag = FALSE; + +static HANDLE hPnpThread = NULL; + +static PPARTLIST PartitionList = NULL; +static PPARTENTRY TempPartition = NULL; +static PFILE_SYSTEM_LIST FileSystemList = NULL; +static FORMATMACHINESTATE FormatState = Start; + +/*****************************************************/ static HINF SetupInf; @@ -111,9 +85,6 @@ static PGENERIC_LIST LayoutList = NULL; static PGENERIC_LIST LanguageList = NULL; -static LANGID LanguageId = 0; - -static ULONG RequiredPartitionDiskSpace = ~0; /* FUNCTIONS ****************************************************************/ @@ -427,178 +398,6 @@ static VOID -CheckUnattendedSetup(VOID) -{ - WCHAR UnattendInfPath[MAX_PATH]; - INFCONTEXT Context; - HINF UnattendInf; - UINT ErrorLine; - INT IntValue; - PWCHAR Value; - - CombinePaths(UnattendInfPath, ARRAYSIZE(UnattendInfPath), 2, SourcePath.Buffer, L"unattend.inf"); - - if (DoesFileExist(NULL, UnattendInfPath) == FALSE) - { - DPRINT("Does not exist: %S\n", UnattendInfPath); - return; - } - - /* Load 'unattend.inf' from install media. */ - UnattendInf = SetupOpenInfFileExW(UnattendInfPath, - NULL, - INF_STYLE_WIN4, - LanguageId, - &ErrorLine); - - if (UnattendInf == INVALID_HANDLE_VALUE) - { - DPRINT("SetupOpenInfFileExW() failed\n"); - return; - } - - /* Open 'Unattend' section */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"Signature", &Context)) - { - DPRINT("SetupFindFirstLineW() failed for section 'Unattend'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - /* Get pointer 'Signature' key */ - if (!INF_GetData(&Context, NULL, &Value)) - { - DPRINT("INF_GetData() failed for key 'Signature'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - /* Check 'Signature' string */ - if (_wcsicmp(Value, L"$ReactOS$") != 0) - { - DPRINT("Signature not $ReactOS$\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - /* Check if Unattend setup is enabled */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"UnattendSetupEnabled", &Context)) - { - DPRINT("Can't find key 'UnattendSetupEnabled'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - if (!INF_GetData(&Context, NULL, &Value)) - { - DPRINT("Can't read key 'UnattendSetupEnabled'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - if (_wcsicmp(Value, L"yes") != 0) - { - DPRINT("Unattend setup is disabled by 'UnattendSetupEnabled' key!\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - /* Search for 'DestinationDiskNumber' in the 'Unattend' section */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationDiskNumber", &Context)) - { - DPRINT("SetupFindFirstLine() failed for key 'DestinationDiskNumber'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - if (!SetupGetIntField(&Context, 1, &IntValue)) - { - DPRINT("SetupGetIntField() failed for key 'DestinationDiskNumber'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - UnattendDestinationDiskNumber = (LONG)IntValue; - - /* Search for 'DestinationPartitionNumber' in the 'Unattend' section */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"DestinationPartitionNumber", &Context)) - { - DPRINT("SetupFindFirstLine() failed for key 'DestinationPartitionNumber'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - if (!SetupGetIntField(&Context, 1, &IntValue)) - { - DPRINT("SetupGetIntField() failed for key 'DestinationPartitionNumber'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - UnattendDestinationPartitionNumber = (LONG)IntValue; - - /* Search for 'InstallationDirectory' in the 'Unattend' section */ - if (!SetupFindFirstLineW(UnattendInf, L"Unattend", L"InstallationDirectory", &Context)) - { - DPRINT("SetupFindFirstLine() failed for key 'InstallationDirectory'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - /* Get pointer 'InstallationDirectory' key */ - if (!INF_GetData(&Context, NULL, &Value)) - { - DPRINT("INF_GetData() failed for key 'InstallationDirectory'\n"); - SetupCloseInfFile(UnattendInf); - return; - } - - wcscpy(UnattendInstallationDirectory, Value); - - IsUnattendedSetup = TRUE; - DPRINT("Running unattended setup\n"); - - /* Search for 'MBRInstallType' in the 'Unattend' section */ - if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"MBRInstallType", &Context)) - { - if (SetupGetIntField(&Context, 1, &IntValue)) - { - UnattendMBRInstallType = IntValue; - } - } - - /* Search for 'FormatPartition' in the 'Unattend' section */ - if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"FormatPartition", &Context)) - { - if (SetupGetIntField(&Context, 1, &IntValue)) - { - UnattendFormatPartition = IntValue; - } - } - - if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"AutoPartition", &Context)) - { - if (SetupGetIntField(&Context, 1, &IntValue)) - { - AutoPartition = IntValue; - } - } - - /* search for LocaleID in the 'Unattend' section*/ - if (SetupFindFirstLineW(UnattendInf, L"Unattend", L"LocaleID", &Context)) - { - if (INF_GetData(&Context, NULL, &Value)) - { - LONG Id = wcstol(Value, NULL, 16); - swprintf(LocaleID, L"%08lx", Id); - } - } - - SetupCloseInfFile(UnattendInf); -} - - -static VOID UpdateKBLayout(VOID) { PGENERIC_LIST_ENTRY ListEntry; @@ -642,7 +441,7 @@ * * SIDEEFFECTS * Init SelectedLanguageId - * Init LanguageId + * Init USetupData.LanguageId * * RETURNS * Number of the next page. @@ -666,6 +465,7 @@ } /* Load the font */ + USetupData.LanguageId = 0; SelectedLanguageId = DefaultLanguage; SetConsoleCodePage(); UpdateKBLayout(); @@ -674,7 +474,7 @@ * the language selection process altogether! */ if (GenericListHasSingleEntry(LanguageList)) { - LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); + USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); return WELCOME_PAGE; } @@ -729,7 +529,7 @@ { SelectedLanguageId = (PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList)); - LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); + USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); if (wcscmp(SelectedLanguageId, DefaultLanguage)) { @@ -771,65 +571,6 @@ } return WELCOME_PAGE; -} - - -static NTSTATUS -GetSourcePaths( - OUT PUNICODE_STRING SourcePath, - OUT PUNICODE_STRING SourceRootPath, - OUT PUNICODE_STRING SourceRootDir) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING LinkName = RTL_CONSTANT_STRING(L"\\SystemRoot"); - UNICODE_STRING SourceName; - WCHAR SourceBuffer[MAX_PATH] = L""; - HANDLE Handle; - ULONG Length; - PWCHAR Ptr; - - InitializeObjectAttributes(&ObjectAttributes, - &LinkName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenSymbolicLinkObject(&Handle, - SYMBOLIC_LINK_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - return Status; - - RtlInitEmptyUnicodeString(&SourceName, SourceBuffer, sizeof(SourceBuffer)); - - Status = NtQuerySymbolicLinkObject(Handle, - &SourceName, - &Length); - NtClose(Handle); - - if (!NT_SUCCESS(Status)) - return Status; - - RtlCreateUnicodeString(SourcePath, - SourceName.Buffer); - - /* Strip trailing directory */ - Ptr = wcsrchr(SourceName.Buffer, OBJ_NAME_PATH_SEPARATOR); - if (Ptr) - { - RtlCreateUnicodeString(SourceRootDir, Ptr); - *Ptr = UNICODE_NULL; - } - else - { - RtlCreateUnicodeString(SourceRootDir, L""); - } - - RtlCreateUnicodeString(SourceRootPath, - SourceName.Buffer); - - return STATUS_SUCCESS; } @@ -843,15 +584,15 @@ * * SIDEEFFECTS * Init Sdi - * Init SourcePath - * Init SourceRootPath - * Init SourceRootDir + * Init USetupData.SourcePath + * Init USetupData.SourceRootPath + * Init USetupData.SourceRootDir * Init SetupInf - * Init RequiredPartitionDiskSpace + * Init USetupData.RequiredPartitionDiskSpace * Init IsUnattendedSetup * If unattended, init *List and sets the Codepage * If unattended, init SelectedLanguageId - * If unattended, init LanguageId + * If unattended, init USetupData.LanguageId * * RETURNS * Number of the next page. @@ -860,79 +601,32 @@ SetupStartPage(PINPUT_RECORD Ir) { NTSTATUS Status; - WCHAR FileNameBuffer[MAX_PATH]; - INFCONTEXT Context; - PWCHAR Value; - UINT ErrorLine; + ULONG Error; PGENERIC_LIST_ENTRY ListEntry; - INT IntValue; CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); /* Get the source path and source root path */ - Status = GetSourcePaths(&SourcePath, - &SourceRootPath, - &SourceRootDir); + Status = GetSourcePaths(&USetupData.SourcePath, + &USetupData.SourceRootPath, + &USetupData.SourceRootDir); if (!NT_SUCCESS(Status)) { CONSOLE_PrintTextXY(6, 15, "GetSourcePaths() failed (Status 0x%08lx)", Status); MUIDisplayError(ERROR_NO_SOURCE_DRIVE, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } - DPRINT1("SourcePath: '%wZ'\n", &SourcePath); - DPRINT1("SourceRootPath: '%wZ'\n", &SourceRootPath); - DPRINT1("SourceRootDir: '%wZ'\n", &SourceRootDir); - - /* Load txtsetup.sif from install media. */ - CombinePaths(FileNameBuffer, ARRAYSIZE(FileNameBuffer), 2, SourcePath.Buffer, L"txtsetup.sif"); - SetupInf = SetupOpenInfFileExW(FileNameBuffer, - NULL, - INF_STYLE_WIN4, - LanguageId, - &ErrorLine); - - if (SetupInf == INVALID_HANDLE_VALUE) - { - MUIDisplayError(ERROR_LOAD_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); + DPRINT1("SourcePath: '%wZ'\n", &USetupData.SourcePath); + DPRINT1("SourceRootPath: '%wZ'\n", &USetupData.SourceRootPath); + DPRINT1("SourceRootDir: '%wZ'\n", &USetupData.SourceRootDir); + + /* Load 'txtsetup.sif' from the installation media */ + Error = LoadSetupInf(&SetupInf, &USetupData); + if (Error != ERROR_SUCCESS) + { + MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER); return QUIT_PAGE; } - - /* Open 'Version' section */ - if (!SetupFindFirstLineW(SetupInf, L"Version", L"Signature", &Context)) - { - MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - - /* Get pointer 'Signature' key */ - if (!INF_GetData(&Context, NULL, &Value)) - { - MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - - /* Check 'Signature' string */ - if (_wcsicmp(Value, L"$ReactOS$") != 0) - { - MUIDisplayError(ERROR_SIGNATURE_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - - /* Open 'DiskSpaceRequirements' section */ - if (!SetupFindFirstLineW(SetupInf, L"DiskSpaceRequirements", L"FreeSysPartDiskSpace", &Context)) - { - MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - - /* Get the 'FreeSysPartDiskSpace' value */ - if (!SetupGetIntField(&Context, 1, &IntValue)) - { - MUIDisplayError(ERROR_CORRUPT_TXTSETUPSIF, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - - RequiredPartitionDiskSpace = (ULONG)IntValue; /* Start the PnP thread */ if (hPnpThread != INVALID_HANDLE_VALUE) @@ -941,7 +635,7 @@ hPnpThread = INVALID_HANDLE_VALUE; } - CheckUnattendedSetup(); + CheckUnattendedSetup(&USetupData); if (IsUnattendedSetup) { @@ -953,14 +647,14 @@ LanguageList = CreateLanguageList(SetupInf, DefaultLanguage); /* new part */ - wcscpy(SelectedLanguageId, LocaleID); - LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); + wcscpy(SelectedLanguageId, USetupData.LocaleID); + USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); /* first we hack LanguageList */ ListEntry = GetFirstListEntry(LanguageList); while (ListEntry != NULL) { - if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) + if (!wcsicmp(USetupData.LocaleID, GetListEntryUserData(ListEntry))) { DPRINT("found %S in LanguageList\n",GetListEntryUserData(ListEntry)); SetCurrentListEntry(LanguageList, ListEntry); @@ -974,7 +668,7 @@ ListEntry = GetFirstListEntry(LayoutList); while (ListEntry != NULL) { - if (!wcsicmp(LocaleID, GetListEntryUserData(ListEntry))) + if (!wcsicmp(USetupData.LocaleID, GetListEntryUserData(ListEntry))) { DPRINT("found %S in LayoutList\n",GetListEntryUserData(ListEntry)); SetCurrentListEntry(LayoutList, ListEntry); @@ -1651,10 +1345,10 @@ size = PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector; size = (size + (512 * KB)) / MB; /* in MBytes */ - if (size < RequiredPartitionDiskSpace) + if (size < USetupData.RequiredPartitionDiskSpace) { /* Partition is too small so ask for another one */ - DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, RequiredPartitionDiskSpace); + DPRINT1("Partition is too small (size: %I64u MB), required disk space is %lu MB\n", size, USetupData.RequiredPartitionDiskSpace); return FALSE; } else @@ -1733,9 +1427,11 @@ if (IsUnattendedSetup) { - if (!SelectPartition(PartitionList, UnattendDestinationDiskNumber, UnattendDestinationPartitionNumber)) - { - if (AutoPartition) + if (!SelectPartition(PartitionList, + USetupData.DestinationDiskNumber, + USetupData.DestinationPartitionNumber)) + { + if (USetupData.AutoPartition) { if (PartitionList->CurrentPartition->LogicalPartition) { @@ -1754,7 +1450,7 @@ if (!IsDiskSizeValid(PartitionList->CurrentPartition)) { MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY, - RequiredPartitionDiskSpace); + USetupData.RequiredPartitionDiskSpace); return SELECT_PARTITION_PAGE; /* let the user select another partition */ } @@ -1769,7 +1465,7 @@ if (!IsDiskSizeValid(PartitionList->CurrentPartition)) { MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY, - RequiredPartitionDiskSpace); + USetupData.RequiredPartitionDiskSpace); return SELECT_PARTITION_PAGE; /* let the user select another partition */ } @@ -1863,7 +1559,7 @@ if (!IsDiskSizeValid(PartitionList->CurrentPartition)) { MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY, - RequiredPartitionDiskSpace); + USetupData.RequiredPartitionDiskSpace); return SELECT_PARTITION_PAGE; /* let the user select another partition */ } @@ -2726,8 +2422,8 @@ * * Next pages: * CheckFileSystemPage (At once if RepairUpdate is selected) - * CheckFileSystemPage (At once if Unattended and not UnattendFormatPartition) - * FormatPartitionPage (At once if Unattended and UnattendFormatPartition) + * CheckFileSystemPage (At once if Unattended and not USetupData.FormatPartition) + * FormatPartitionPage (At once if Unattended and USetupData.FormatPartition) * SelectPartitionPage (If the user aborts) * FormatPartitionPage (Default) * QuitPage @@ -2995,7 +2691,7 @@ if (IsUnattendedSetup) { - if (UnattendFormatPartition) + if (USetupData.FormatPartition) { /* * We use whatever currently selected file system we have @@ -3065,7 +2761,7 @@ * * SIDEEFFECTS * Sets PartitionList->CurrentPartition->FormatState - * Sets DestinationRootPath + * Sets USetupData.DestinationRootPath * * RETURNS * Number of the next page. @@ -3319,9 +3015,9 @@ * PrepareCopyPage (At once) * * SIDEEFFECTS - * Inits DestinationRootPath - * Inits DestinationPath - * Inits DestinationArcPath + * Inits USetupData.DestinationRootPath + * Inits USetupData.DestinationPath + * Inits USetupData.DestinationArcPath * Inits DestinationDriveLetter * * RETURNS @@ -3339,31 +3035,31 @@ RtlFreeUnicodeString(&InstallPath); RtlCreateUnicodeString(&InstallPath, InstallDir); - /* Create 'DestinationRootPath' string */ - RtlFreeUnicodeString(&DestinationRootPath); + /* Create 'USetupData.DestinationRootPath' string */ + RtlFreeUnicodeString(&USetupData.DestinationRootPath); StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"\\Device\\Harddisk%lu\\Partition%lu\\", DiskEntry->DiskNumber, PartEntry->PartitionNumber); - RtlCreateUnicodeString(&DestinationRootPath, PathBuffer); - DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath); + RtlCreateUnicodeString(&USetupData.DestinationRootPath, PathBuffer); + DPRINT("DestinationRootPath: %wZ\n", &USetupData.DestinationRootPath); /** Equivalent of 'NTOS_INSTALLATION::SystemNtPath' **/ - /* Create 'DestinationPath' string */ - RtlFreeUnicodeString(&DestinationPath); + /* Create 'USetupData.DestinationPath' string */ + RtlFreeUnicodeString(&USetupData.DestinationPath); CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, - DestinationRootPath.Buffer, InstallDir); - RtlCreateUnicodeString(&DestinationPath, PathBuffer); + USetupData.DestinationRootPath.Buffer, InstallDir); + RtlCreateUnicodeString(&USetupData.DestinationPath, PathBuffer); /** Equivalent of 'NTOS_INSTALLATION::SystemArcPath' **/ - /* Create 'DestinationArcPath' */ - RtlFreeUnicodeString(&DestinationArcPath); + /* Create 'USetupData.DestinationArcPath' */ + RtlFreeUnicodeString(&USetupData.DestinationArcPath); StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\", DiskEntry->BiosDiskNumber, PartEntry->PartitionNumber); ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallDir); - RtlCreateUnicodeString(&DestinationArcPath, PathBuffer); + RtlCreateUnicodeString(&USetupData.DestinationArcPath, PathBuffer); /* Initialize DestinationDriveLetter */ DestinationDriveLetter = (WCHAR)PartEntry->DriveLetter; @@ -3387,7 +3083,7 @@ { PDISKENTRY DiskEntry; PPARTENTRY PartEntry; - WCHAR InstallDir[51]; + WCHAR InstallDir[MAX_PATH]; WCHAR c; ULONG Length; @@ -3409,10 +3105,11 @@ DiskEntry = PartitionList->CurrentDisk; PartEntry = PartitionList->CurrentPartition; - if (IsUnattendedSetup) - wcscpy(InstallDir, UnattendInstallationDirectory); - else if (RepairUpdateFlag) + // if (IsUnattendedSetup) + if (RepairUpdateFlag) wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath + else if (USetupData.InstallationDirectory[0]) + wcscpy(InstallDir, USetupData.InstallationDirectory); else wcscpy(InstallDir, L"\\ReactOS"); @@ -3564,8 +3261,8 @@ if (!SetupQueueCopy(SetupFileQueue, SourceCabinet, - SourceRootPath.Buffer, - SourceRootDir.Buffer, + USetupData.SourceRootPath.Buffer, + USetupData.SourceRootDir.Buffer, FileKeyName, DirKeyValue, TargetFileName)) @@ -3673,7 +3370,7 @@ DPRINT("InstallationPath: '%S'\n", DirKeyValue); StringCchCopyW(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), - SourceRootDir.Buffer); + USetupData.SourceRootDir.Buffer); DPRINT("InstallationPath(2): '%S'\n", CompleteOrigDirName); } @@ -3693,14 +3390,14 @@ DPRINT("RelativePath: '%S'\n", DirKeyValue); CombinePaths(CompleteOrigDirName, ARRAYSIZE(CompleteOrigDirName), 2, - SourceRootDir.Buffer, DirKeyValue); + USetupData.SourceRootDir.Buffer, DirKeyValue); DPRINT("RelativePath(2): '%S'\n", CompleteOrigDirName); } if (!SetupQueueCopy(SetupFileQueue, SourceCabinet, - SourceRootPath.Buffer, + USetupData.SourceRootPath.Buffer, CompleteOrigDirName, FileKeyName, DirKeyValue, @@ -3731,7 +3428,7 @@ WCHAR PathBuffer[MAX_PATH]; /* Add common files */ - if (!AddSectionToCopyQueue(InfFile, L"SourceDisksFiles", SourceCabinet, &DestinationPath, Ir)) + if (!AddSectionToCopyQueue(InfFile, L"SourceDisksFiles", SourceCabinet, &USetupData.DestinationPath, Ir)) return FALSE; /* Add specific files depending of computer type */ @@ -3742,7 +3439,7 @@ if (AdditionalSectionName) { - if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &DestinationPath, Ir)) + if (!AddSectionToCopyQueue(InfFile, AdditionalSectionName, SourceCabinet, &USetupData.DestinationPath, Ir)) return FALSE; } } @@ -3751,14 +3448,14 @@ /* * FIXME: - * Copying files to DestinationRootPath should be done from within + * Copying files to USetupData.DestinationRootPath should be done from within * the SystemPartitionFiles section. * At the moment we check whether we specify paths like '\foo' or '\\' for that. - * For installing to DestinationPath specify just '\' . + * For installing to USetupData.DestinationPath specify just '\' . */ /* Get destination path */ - StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), DestinationPath.Buffer); + StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), USetupData.DestinationPath.Buffer); DPRINT("FullPath(1): '%S'\n", PathBuffer); @@ -3801,7 +3498,7 @@ DPRINT("InstallationPath: '%S'\n", DirKeyValue); StringCchCopyW(PathBuffer, ARRAYSIZE(PathBuffer), - DestinationPath.Buffer); + USetupData.DestinationPath.Buffer); DPRINT("InstallationPath(2): '%S'\n", PathBuffer); } @@ -3811,7 +3508,7 @@ DPRINT("AbsolutePath: '%S'\n", DirKeyValue); CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, - DestinationRootPath.Buffer, DirKeyValue); + USetupData.DestinationRootPath.Buffer, DirKeyValue); DPRINT("AbsolutePath(2): '%S'\n", PathBuffer); @@ -3830,7 +3527,7 @@ DPRINT("RelativePath: '%S'\n", DirKeyValue); CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, - DestinationPath.Buffer, DirKeyValue); + USetupData.DestinationPath.Buffer, DirKeyValue); DPRINT("RelativePath(2): '%S'\n", PathBuffer); @@ -3908,7 +3605,7 @@ break; CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2, - SourcePath.Buffer, KeyValue); + USetupData.SourcePath.Buffer, KeyValue); #ifdef __REACTOS__ CabinetInitialize(); @@ -3937,7 +3634,7 @@ InfFileSize, NULL, INF_STYLE_WIN4, - LanguageId, + USetupData.LanguageId, &ErrorLine); if (InfHandle == INVALID_HANDLE_VALUE) @@ -4053,7 +3750,7 @@ MUIDisplayPage(FILE_COPY_PAGE); /* Create context for the copy process */ - CopyContext.DestinationRootPath = DestinationRootPath.Buffer; + CopyContext.DestinationRootPath = USetupData.DestinationRootPath.Buffer; CopyContext.InstallPath = InstallPath.Buffer; CopyContext.TotalOperations = 0; CopyContext.CompletedOperations = 0; @@ -4114,6 +3811,9 @@ DestroyProgressBar(CopyContext.MemoryBars[0]); DestroyProgressBar(CopyContext.MemoryBars[1]); DestroyProgressBar(CopyContext.MemoryBars[2]); + + /* Create the $winnt$.inf file */ + InstallSetupInfFile(&USetupData); /* Go display the next page */ return REGISTRY_PAGE; @@ -4156,7 +3856,7 @@ DPRINT1("TODO: Updating / repairing the registry is not completely implemented yet!\n"); /* Verify the registry hives and check whether we need to update or repair any of them */ - Status = VerifyRegistryHives(&DestinationPath, &ShouldRepairRegistry); + Status = VerifyRegistryHives(&USetupData.DestinationPath, &ShouldRepairRegistry); if (!NT_SUCCESS(Status)) { DPRINT1("VerifyRegistryHives failed, Status 0x%08lx\n", Status); @@ -4171,7 +3871,7 @@ CONSOLE_SetStatusText(MUIGetString(STRING_REGHIVEUPDATE)); /* Initialize the registry and setup the registry hives */ - Status = RegInitializeRegistry(&DestinationPath); + Status = RegInitializeRegistry(&USetupData.DestinationPath); if (!NT_SUCCESS(Status)) { DPRINT1("RegInitializeRegistry() failed\n"); @@ -4260,7 +3960,7 @@ CONSOLE_SetStatusText(MUIGetString(STRING_IMPORTFILE), File); - if (!ImportRegistryFile(SourcePath.Buffer, File, Section, LanguageId, Delete)) + if (!ImportRegistryFile(USetupData.SourcePath.Buffer, File, Section, USetupData.LanguageId, Delete)) { DPRINT1("Importing %S failed\n", File); INF_FreeData(File); @@ -4337,7 +4037,7 @@ // TODO: Unload all the registry stuff, perform cleanup, // and copy the created hive files into .sav files. // - RegCleanupRegistry(&DestinationPath); + RegCleanupRegistry(&USetupData.DestinationPath); /* * Check whether we were in update/repair mode but we were actually @@ -4393,28 +4093,30 @@ CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - RtlFreeUnicodeString(&SystemRootPath); + RtlFreeUnicodeString(&USetupData.SystemRootPath); StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer), L"\\Device\\Harddisk%lu\\Partition%lu\\", PartitionList->SystemPartition->DiskEntry->DiskNumber, PartitionList->SystemPartition->PartitionNumber); - RtlCreateUnicodeString(&SystemRootPath, PathBuffer); - DPRINT1("SystemRootPath: %wZ\n", &SystemRootPath); + RtlCreateUnicodeString(&USetupData.SystemRootPath, PathBuffer); + DPRINT1("SystemRootPath: %wZ\n", &USetupData.SystemRootPath); PartitionType = PartitionList->SystemPartition->PartitionType; + /* For unattended setup, skip MBR installation or install on floppy if needed */ if (IsUnattendedSetup) { - if (UnattendMBRInstallType == 0) /* skip MBR installation */ - { - return SUCCESS_PAGE; - } - else if (UnattendMBRInstallType == 1) /* install on floppy */ - { - return BOOT_LOADER_FLOPPY_PAGE; - } - } - + if ((USetupData.MBRInstallType == 0) || + (USetupData.MBRInstallType == 1)) + { + goto Quit; + } + } + + /* + * We may install an MBR or VBR, but before that, check whether + * we need to actually install the VBR on floppy. + */ if (PartitionType == PARTITION_ENTRY_UNUSED) { DPRINT("Error: system partition invalid (unused)\n"); @@ -4457,15 +4159,21 @@ InstallOnFloppy = TRUE; } - if (InstallOnFloppy == TRUE) - { - return BOOT_LOADER_FLOPPY_PAGE; - } - - /* Unattended install on hdd? */ - if (IsUnattendedSetup && UnattendMBRInstallType == 2) - { - return BOOT_LOADER_HARDDISK_MBR_PAGE; + /* We should install on floppy */ + if (InstallOnFloppy) + { + USetupData.MBRInstallType = 1; + goto Quit; + } + + /* Is it an unattended install on hdd? */ + if (IsUnattendedSetup) + { + if ((USetupData.MBRInstallType == 2) || + (USetupData.MBRInstallType == 3)) + { + goto Quit; + } } MUIDisplayPage(BOOT_LOADER_PAGE); @@ -4515,23 +4223,51 @@ { if (Line == 12) { - return BOOT_LOADER_HARDDISK_MBR_PAGE; + /* Install on both MBR and VBR */ + USetupData.MBRInstallType = 2; + break; } else if (Line == 13) { - return BOOT_LOADER_HARDDISK_VBR_PAGE; + /* Install on VBR only */ + USetupData.MBRInstallType = 3; + break; } else if (Line == 14) { - return BOOT_LOADER_FLOPPY_PAGE; + /* Install on floppy */ + USetupData.MBRInstallType = 1; + break; } else if (Line == 15) { - return SUCCESS_PAGE; + /* Skip MBR installation */ + USetupData.MBRInstallType = 0; + break; } return BOOT_LOADER_PAGE; } + } + +Quit: + switch (USetupData.MBRInstallType) + { + /* Skip MBR installation */ + case 0: + return SUCCESS_PAGE; + + /* Install on floppy */ + case 1: + return BOOT_LOADER_FLOPPY_PAGE; + + /* Install on both MBR and VBR */ + case 2: + return BOOT_LOADER_HARDDISK_MBR_PAGE; + + /* Install on VBR only */ + case 3: + return BOOT_LOADER_HARDDISK_VBR_PAGE; } return BOOT_LOADER_PAGE; @@ -4580,7 +4316,7 @@ return BOOT_LOADER_FLOPPY_PAGE; } - Status = InstallFatBootcodeToFloppy(&SourceRootPath, &DestinationArcPath); + Status = InstallFatBootcodeToFloppy(&USetupData.SourceRootPath, &USetupData.DestinationArcPath); if (!NT_SUCCESS(Status)) { /* Print error message */ @@ -4613,9 +4349,9 @@ { NTSTATUS Status; - Status = InstallVBRToPartition(&SystemRootPath, - &SourceRootPath, - &DestinationArcPath, + Status = InstallVBRToPartition(&USetupData.SystemRootPath, + &USetupData.SourceRootPath, + &USetupData.DestinationArcPath, PartitionList->SystemPartition->PartitionType); if (!NT_SUCCESS(Status)) { @@ -4650,9 +4386,9 @@ WCHAR DstPath[MAX_PATH]; /* Step 1: Write the VBR */ - Status = InstallVBRToPartition(&SystemRootPath, - &SourceRootPath, - &DestinationArcPath, + Status = InstallVBRToPartition(&USetupData.SystemRootPath, + &USetupData.SourceRootPath, + &USetupData.DestinationArcPath, PartitionList->SystemPartition->PartitionType); if (!NT_SUCCESS(Status)) { @@ -4665,12 +4401,12 @@ L"\\Device\\Harddisk%d\\Partition0", PartitionList->SystemPartition->DiskEntry->DiskNumber); - CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2, SourceRootPath.Buffer, L"\\loader\\dosmbr.bin"); + CombinePaths(SourceMbrPathBuffer, ARRAYSIZE(SourceMbrPathBuffer), 2, USetupData.SourceRootPath.Buffer, L"\\loader\\dosmbr.bin"); if (IsThereAValidBootSector(DestinationDevicePathBuffer)) { /* Save current MBR */ - CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath.Buffer, L"mbr.old"); + CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, USetupData.SystemRootPath.Buffer, L"mbr.old"); DPRINT1("Save MBR: %S ==> %S\n", DestinationDevicePathBuffer, DstPath); Status = SaveBootSector(DestinationDevicePathBuffer, DstPath, sizeof(PARTITION_SECTOR)); @@ -4882,14 +4618,14 @@ } /* Initialize global unicode strings */ - RtlInitUnicodeString(&SourcePath, NULL); - RtlInitUnicodeString(&SourceRootPath, NULL); - RtlInitUnicodeString(&SourceRootDir, NULL); + RtlInitUnicodeString(&USetupData.SourcePath, NULL); + RtlInitUnicodeString(&USetupData.SourceRootPath, NULL); + RtlInitUnicodeString(&USetupData.SourceRootDir, NULL); RtlInitUnicodeString(&InstallPath, NULL); - RtlInitUnicodeString(&DestinationPath, NULL); - RtlInitUnicodeString(&DestinationArcPath, NULL); - RtlInitUnicodeString(&DestinationRootPath, NULL); - RtlInitUnicodeString(&SystemRootPath, NULL); + RtlInitUnicodeString(&USetupData.DestinationPath, NULL); + RtlInitUnicodeString(&USetupData.DestinationArcPath, NULL); + RtlInitUnicodeString(&USetupData.DestinationRootPath, NULL); + RtlInitUnicodeString(&USetupData.SystemRootPath, NULL); /* Hide the cursor */ CONSOLE_SetCursorType(TRUE, FALSE);
7 years, 4 months
1
0
0
0
[hbelusca] 75517: [USETUP]: Minor code formatting only.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Wed Aug 9 20:29:07 2017 New Revision: 75517 URL:
http://svn.reactos.org/svn/reactos?rev=75517&view=rev
Log: [USETUP]: Minor code formatting only. Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c Modified: branches/setup_improvements/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
============================================================================== --- branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/interface/usetup.c [iso-8859-1] Wed Aug 9 20:29:07 2017 @@ -106,9 +106,9 @@ static PGENERIC_LIST NtOsInstallsList = NULL; static PGENERIC_LIST ComputerList = NULL; -static PGENERIC_LIST DisplayList = NULL; +static PGENERIC_LIST DisplayList = NULL; static PGENERIC_LIST KeyboardList = NULL; -static PGENERIC_LIST LayoutList = NULL; +static PGENERIC_LIST LayoutList = NULL; static PGENERIC_LIST LanguageList = NULL; static LANGID LanguageId = 0; @@ -145,7 +145,7 @@ COORD coPos; DWORD Written; - /* draw upper left corner */ + /* Draw upper left corner */ coPos.X = xLeft; coPos.Y = yTop; FillConsoleOutputCharacterA(StdOutput, @@ -154,7 +154,7 @@ coPos, &Written); - /* draw upper edge */ + /* Draw upper edge */ coPos.X = xLeft + 1; coPos.Y = yTop; FillConsoleOutputCharacterA(StdOutput, @@ -163,7 +163,7 @@ coPos, &Written); - /* draw upper right corner */ + /* Draw upper right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop; FillConsoleOutputCharacterA(StdOutput, @@ -197,7 +197,7 @@ &Written); } - /* draw lower left corner */ + /* Draw lower left corner */ coPos.X = xLeft; coPos.Y = yTop + Height - 1; FillConsoleOutputCharacterA(StdOutput, @@ -206,7 +206,7 @@ coPos, &Written); - /* draw lower edge */ + /* Draw lower edge */ coPos.X = xLeft + 1; coPos.Y = yTop + Height - 1; FillConsoleOutputCharacterA(StdOutput, @@ -215,7 +215,7 @@ coPos, &Written); - /* draw lower right corner */ + /* Draw lower right corner */ coPos.X = xLeft + Width - 1; coPos.Y = yTop + Height - 1; FillConsoleOutputCharacterA(StdOutput, @@ -4442,9 +4442,9 @@ } else if ((PartitionType == PARTITION_FAT_12) || (PartitionType == PARTITION_FAT_16) || - (PartitionType == PARTITION_HUGE) || + (PartitionType == PARTITION_HUGE) || (PartitionType == PARTITION_XINT13) || - (PartitionType == PARTITION_FAT32) || + (PartitionType == PARTITION_FAT32) || (PartitionType == PARTITION_FAT32_XINT13)) { DPRINT("Found FAT partition\n"); @@ -4481,11 +4481,11 @@ CONSOLE_NormalTextXY(8, Line, 60, 1); Line++; - if (Line<12) - Line=15; - - if (Line>15) - Line=12; + if (Line < 12) + Line = 15; + + if (Line > 15) + Line = 12; CONSOLE_InvertTextXY(8, Line, 60, 1); } @@ -4495,11 +4495,11 @@ CONSOLE_NormalTextXY(8, Line, 60, 1); Line--; - if (Line<12) - Line=15; - - if (Line>15) - Line=12; + if (Line < 12) + Line = 15; + + if (Line > 15) + Line = 12; CONSOLE_InvertTextXY(8, Line, 60, 1); }
7 years, 4 months
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
...
27
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
Results per page:
10
25
50
100
200