mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[SETUP][SYSSETUP]: Export a 'InstallWindowsNt' function from syssetup.dll (with Windows-compatible signature) instead of our private 'InstallReactOS' and 'InstallLiveCD', and call it from setup.exe. This allows using our setup.exe on Windows & vice-versa for testing purposes. In syssetup.dll, the choice of installing ReactOS or starting the LiveCD interface is done by checking the command-line given to 'InstallWindowsNt' (using the existing switches).
Inspired from Jared's patch in CORE-12615. svn path=/trunk/; revision=73519
This commit is contained in:
parent
c24dcb3ff2
commit
e8127690bb
5 changed files with 71 additions and 115 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
add_executable(setup setup.c setup.rc)
|
add_executable(setup setup.c setup.rc)
|
||||||
set_module_type(setup win32gui UNICODE)
|
set_module_type(setup win32gui UNICODE ENTRYPOINT wmainCRTStartup)
|
||||||
add_importlibs(setup userenv msvcrt kernel32 ntdll)
|
add_importlibs(setup userenv msvcrt kernel32 ntdll)
|
||||||
add_cd_file(TARGET setup DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET setup DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -1,21 +1,3 @@
|
||||||
/*
|
|
||||||
* ReactOS kernel
|
|
||||||
* Copyright (C) 2003 ReactOS Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS GUI/console setup
|
* PROJECT: ReactOS GUI/console setup
|
||||||
|
@ -27,120 +9,66 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
typedef DWORD (WINAPI *PINSTALL_REACTOS)(HINSTANCE hInstance);
|
typedef INT (WINAPI *PINSTALL_REACTOS)(INT argc, WCHAR** argv);
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
LPTSTR
|
|
||||||
lstrchr(
|
|
||||||
LPCTSTR s,
|
|
||||||
TCHAR c)
|
|
||||||
{
|
|
||||||
while (*s)
|
|
||||||
{
|
|
||||||
if (*s == c)
|
|
||||||
return (LPTSTR)s;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c == (TCHAR)0)
|
|
||||||
return (LPTSTR)s;
|
|
||||||
|
|
||||||
return (LPTSTR)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
VOID
|
INT
|
||||||
RunNewSetup(
|
RunInstallReactOS(INT argc, WCHAR* argv[])
|
||||||
HINSTANCE hInstance)
|
|
||||||
{
|
{
|
||||||
|
INT RetVal;
|
||||||
HMODULE hDll;
|
HMODULE hDll;
|
||||||
PINSTALL_REACTOS InstallReactOS;
|
PINSTALL_REACTOS InstallReactOS;
|
||||||
|
|
||||||
hDll = LoadLibrary(TEXT("syssetup"));
|
hDll = LoadLibraryW(L"syssetup.dll");
|
||||||
if (hDll == NULL)
|
if (hDll == NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Failed to load 'syssetup'!\n");
|
DPRINT("Failed to load 'syssetup.dll'!\n");
|
||||||
return;
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
DPRINT("Loaded 'syssetup.dll'!\n");
|
||||||
|
|
||||||
DPRINT("Loaded 'syssetup'!\n");
|
/* Call the standard Windows-compatible export */
|
||||||
InstallReactOS = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallReactOS");
|
InstallReactOS = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallWindowsNt");
|
||||||
if (InstallReactOS == NULL)
|
if (InstallReactOS == NULL)
|
||||||
{
|
{
|
||||||
DPRINT("Failed to get address for 'InstallReactOS()'!\n");
|
RetVal = GetLastError();
|
||||||
FreeLibrary(hDll);
|
DPRINT("Failed to get address for 'InstallWindowsNt()'!\n");
|
||||||
return;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RetVal = InstallReactOS(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallReactOS(hInstance);
|
|
||||||
|
|
||||||
FreeLibrary(hDll);
|
FreeLibrary(hDll);
|
||||||
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
/* Called from wmainCRTStartup */
|
||||||
VOID
|
INT wmain(INT argc, WCHAR* argv[])
|
||||||
RunLiveCD(
|
|
||||||
HINSTANCE hInstance)
|
|
||||||
{
|
{
|
||||||
HMODULE hDll;
|
LPWSTR CmdLine, p;
|
||||||
PINSTALL_REACTOS InstallLiveCD;
|
|
||||||
|
|
||||||
hDll = LoadLibrary(TEXT("syssetup"));
|
// NOTE: Temporary, until we correctly use argc/argv.
|
||||||
if (hDll == NULL)
|
CmdLine = GetCommandLineW();
|
||||||
{
|
DPRINT("CmdLine: <%S>\n", CmdLine);
|
||||||
DPRINT("Failed to load 'syssetup'!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Loaded 'syssetup'!\n");
|
p = wcschr(CmdLine, L'-');
|
||||||
InstallLiveCD = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallLiveCD");
|
|
||||||
if (InstallLiveCD == NULL)
|
|
||||||
{
|
|
||||||
DPRINT("Failed to get address for 'InstallReactOS()'!\n");
|
|
||||||
FreeLibrary(hDll);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
InstallLiveCD(hInstance);
|
|
||||||
|
|
||||||
FreeLibrary(hDll);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
WINAPI
|
|
||||||
_tWinMain(
|
|
||||||
HINSTANCE hInstance,
|
|
||||||
HINSTANCE hPrevInstance,
|
|
||||||
LPTSTR lpCmdLine,
|
|
||||||
int nShowCmd)
|
|
||||||
{
|
|
||||||
LPTSTR CmdLine;
|
|
||||||
LPTSTR p;
|
|
||||||
|
|
||||||
CmdLine = GetCommandLine();
|
|
||||||
|
|
||||||
DPRINT("CmdLine: <%s>\n",CmdLine);
|
|
||||||
|
|
||||||
p = lstrchr(CmdLine, TEXT('-'));
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return 0;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
p++;
|
||||||
|
|
||||||
if (!lstrcmpi(p, TEXT("-newsetup")))
|
// NOTE: On Windows, "mini" means "minimal UI", and can be used
|
||||||
|
// in addition to "newsetup"; these options are not exclusive.
|
||||||
|
if (_wcsicmp(p, L"newsetup") == 0 || _wcsicmp(p, L"mini") == 0)
|
||||||
{
|
{
|
||||||
RunNewSetup(hInstance);
|
RunInstallReactOS(argc, argv);
|
||||||
}
|
|
||||||
else if (!lstrcmpi(p, TEXT("-mini")))
|
|
||||||
{
|
|
||||||
RunLiveCD(hInstance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -814,8 +814,9 @@ cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI
|
static
|
||||||
InstallLiveCD(IN HINSTANCE hInstance)
|
DWORD
|
||||||
|
InstallLiveCD(VOID)
|
||||||
{
|
{
|
||||||
STARTUPINFOW StartupInfo;
|
STARTUPINFOW StartupInfo;
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
PROCESS_INFORMATION ProcessInformation;
|
||||||
|
@ -1193,9 +1194,9 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
DWORD
|
DWORD
|
||||||
WINAPI
|
InstallReactOS(VOID)
|
||||||
InstallReactOS(HINSTANCE hInstance)
|
|
||||||
{
|
{
|
||||||
WCHAR szBuffer[MAX_PATH];
|
WCHAR szBuffer[MAX_PATH];
|
||||||
HANDLE token;
|
HANDLE token;
|
||||||
|
@ -1353,6 +1354,39 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Standard Windows-compatible export, which dispatches
|
||||||
|
* to either 'InstallReactOS' or 'InstallLiveCD'.
|
||||||
|
*/
|
||||||
|
INT
|
||||||
|
WINAPI
|
||||||
|
InstallWindowsNt(INT argc, WCHAR** argv)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
PWSTR p;
|
||||||
|
|
||||||
|
for (i = 0; i < argc; ++i)
|
||||||
|
{
|
||||||
|
p = argv[i];
|
||||||
|
if (*p == L'-')
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
|
||||||
|
// NOTE: On Windows, "mini" means "minimal UI", and can be used
|
||||||
|
// in addition to "newsetup"; these options are not exclusive.
|
||||||
|
if (_wcsicmp(p, L"newsetup") == 0)
|
||||||
|
return (INT)InstallReactOS();
|
||||||
|
else if (_wcsicmp(p, L"mini") == 0)
|
||||||
|
return (INT)InstallLiveCD();
|
||||||
|
|
||||||
|
/* Add support for other switches */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
@ stub GenerateName
|
@ stub GenerateName
|
||||||
@ stdcall HdcClassInstaller(long ptr ptr)
|
@ stdcall HdcClassInstaller(long ptr ptr)
|
||||||
@ stdcall InitializeSetupActionLog(long)
|
@ stdcall InitializeSetupActionLog(long)
|
||||||
@ stdcall InstallLiveCD(ptr)
|
@ stdcall InstallWindowsNt(long ptr)
|
||||||
@ stdcall InstallReactOS(ptr)
|
|
||||||
@ stub InvokeExternalApplicationEx
|
@ stub InvokeExternalApplicationEx
|
||||||
@ stdcall KeyboardClassInstaller(long ptr ptr)
|
@ stdcall KeyboardClassInstaller(long ptr ptr)
|
||||||
@ stub LegacyDriverPropPageProvider
|
@ stub LegacyDriverPropPageProvider
|
||||||
|
|
|
@ -72,11 +72,6 @@ typedef struct _SETUPDATA
|
||||||
|
|
||||||
/* System setup APIs */
|
/* System setup APIs */
|
||||||
|
|
||||||
DWORD
|
|
||||||
WINAPI
|
|
||||||
InstallReactOS(
|
|
||||||
HINSTANCE hInstance);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
WINAPI
|
WINAPI
|
||||||
SetAccountsDomainSid(
|
SetAccountsDomainSid(
|
||||||
|
|
Loading…
Reference in a new issue