mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +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)
|
||||
set_module_type(setup win32gui UNICODE)
|
||||
set_module_type(setup win32gui UNICODE ENTRYPOINT wmainCRTStartup)
|
||||
add_importlibs(setup userenv msvcrt kernel32 ntdll)
|
||||
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
|
||||
* PROJECT: ReactOS GUI/console setup
|
||||
|
@ -27,124 +9,70 @@
|
|||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
typedef DWORD (WINAPI *PINSTALL_REACTOS)(HINSTANCE hInstance);
|
||||
typedef INT (WINAPI *PINSTALL_REACTOS)(INT argc, WCHAR** argv);
|
||||
|
||||
/* 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
|
||||
VOID
|
||||
RunNewSetup(
|
||||
HINSTANCE hInstance)
|
||||
INT
|
||||
RunInstallReactOS(INT argc, WCHAR* argv[])
|
||||
{
|
||||
INT RetVal;
|
||||
HMODULE hDll;
|
||||
PINSTALL_REACTOS InstallReactOS;
|
||||
|
||||
hDll = LoadLibrary(TEXT("syssetup"));
|
||||
hDll = LoadLibraryW(L"syssetup.dll");
|
||||
if (hDll == NULL)
|
||||
{
|
||||
DPRINT("Failed to load 'syssetup'!\n");
|
||||
return;
|
||||
DPRINT("Failed to load 'syssetup.dll'!\n");
|
||||
return GetLastError();
|
||||
}
|
||||
DPRINT("Loaded 'syssetup.dll'!\n");
|
||||
|
||||
DPRINT("Loaded 'syssetup'!\n");
|
||||
InstallReactOS = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallReactOS");
|
||||
/* Call the standard Windows-compatible export */
|
||||
InstallReactOS = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallWindowsNt");
|
||||
if (InstallReactOS == NULL)
|
||||
{
|
||||
DPRINT("Failed to get address for 'InstallReactOS()'!\n");
|
||||
FreeLibrary(hDll);
|
||||
return;
|
||||
RetVal = GetLastError();
|
||||
DPRINT("Failed to get address for 'InstallWindowsNt()'!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
RetVal = InstallReactOS(argc, argv);
|
||||
}
|
||||
|
||||
InstallReactOS(hInstance);
|
||||
|
||||
FreeLibrary(hDll);
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
RunLiveCD(
|
||||
HINSTANCE hInstance)
|
||||
/* Called from wmainCRTStartup */
|
||||
INT wmain(INT argc, WCHAR* argv[])
|
||||
{
|
||||
HMODULE hDll;
|
||||
PINSTALL_REACTOS InstallLiveCD;
|
||||
LPWSTR CmdLine, p;
|
||||
|
||||
hDll = LoadLibrary(TEXT("syssetup"));
|
||||
if (hDll == NULL)
|
||||
{
|
||||
DPRINT("Failed to load 'syssetup'!\n");
|
||||
return;
|
||||
}
|
||||
// NOTE: Temporary, until we correctly use argc/argv.
|
||||
CmdLine = GetCommandLineW();
|
||||
DPRINT("CmdLine: <%S>\n", CmdLine);
|
||||
|
||||
DPRINT("Loaded 'syssetup'!\n");
|
||||
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('-'));
|
||||
p = wcschr(CmdLine, L'-');
|
||||
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);
|
||||
}
|
||||
else if (!lstrcmpi(p, TEXT("-mini")))
|
||||
{
|
||||
RunLiveCD(hInstance);
|
||||
RunInstallReactOS(argc, argv);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Add new setup types here */
|
||||
/* Add new setup types here */
|
||||
else if (...)
|
||||
{
|
||||
|
||||
|
|
|
@ -814,8 +814,9 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
DWORD WINAPI
|
||||
InstallLiveCD(IN HINSTANCE hInstance)
|
||||
static
|
||||
DWORD
|
||||
InstallLiveCD(VOID)
|
||||
{
|
||||
STARTUPINFOW StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInformation;
|
||||
|
@ -1193,9 +1194,9 @@ done:
|
|||
}
|
||||
|
||||
|
||||
static
|
||||
DWORD
|
||||
WINAPI
|
||||
InstallReactOS(HINSTANCE hInstance)
|
||||
InstallReactOS(VOID)
|
||||
{
|
||||
WCHAR szBuffer[MAX_PATH];
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
@ stub GenerateName
|
||||
@ stdcall HdcClassInstaller(long ptr ptr)
|
||||
@ stdcall InitializeSetupActionLog(long)
|
||||
@ stdcall InstallLiveCD(ptr)
|
||||
@ stdcall InstallReactOS(ptr)
|
||||
@ stdcall InstallWindowsNt(long ptr)
|
||||
@ stub InvokeExternalApplicationEx
|
||||
@ stdcall KeyboardClassInstaller(long ptr ptr)
|
||||
@ stub LegacyDriverPropPageProvider
|
||||
|
|
|
@ -72,11 +72,6 @@ typedef struct _SETUPDATA
|
|||
|
||||
/* System setup APIs */
|
||||
|
||||
DWORD
|
||||
WINAPI
|
||||
InstallReactOS(
|
||||
HINSTANCE hInstance);
|
||||
|
||||
NTSTATUS
|
||||
WINAPI
|
||||
SetAccountsDomainSid(
|
||||
|
|
Loading…
Reference in a new issue