ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

setup.c
Go to the documentation of this file.
00001 /*
00002  *  ReactOS kernel
00003  *  Copyright (C) 2003 ReactOS Team
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License along
00016  *  with this program; if not, write to the Free Software Foundation, Inc.,
00017  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 /*
00020  * COPYRIGHT:       See COPYING in the top level directory
00021  * PROJECT:         ReactOS GUI/console setup
00022  * FILE:            subsys/system/setup/setup.c
00023  * PURPOSE:         Second stage setup
00024  * PROGRAMMER:      Eric Kohl
00025  */
00026 #define WIN32_NO_STATUS
00027 #include <windows.h>
00028 #include <tchar.h>
00029 #include <syssetup/syssetup.h>
00030 #include <userenv.h>
00031 #include <tchar.h>
00032 
00033 #define NDEBUG
00034 #include <debug.h>
00035 
00036 
00037 typedef DWORD (WINAPI *PINSTALL_REACTOS)(HINSTANCE hInstance);
00038 
00039 
00040 /* FUNCTIONS ****************************************************************/
00041 
00042 LPTSTR lstrchr(LPCTSTR s, TCHAR c)
00043 {
00044   while (*s)
00045     {
00046       if (*s == c)
00047         return (LPTSTR)s;
00048       s++;
00049     }
00050 
00051   if (c == (TCHAR)0)
00052     return (LPTSTR)s;
00053 
00054   return (LPTSTR)NULL;
00055 }
00056 
00057 static VOID
00058 RunNewSetup (HINSTANCE hInstance)
00059 {
00060   HMODULE hDll;
00061   PINSTALL_REACTOS InstallReactOS;
00062 
00063   hDll = LoadLibrary (TEXT("syssetup"));
00064   if (hDll == NULL)
00065     {
00066       DPRINT("Failed to load 'syssetup'!\n");
00067       return;
00068     }
00069 
00070   DPRINT("Loaded 'syssetup'!\n");
00071   InstallReactOS = (PINSTALL_REACTOS)GetProcAddress (hDll, "InstallReactOS");
00072 
00073   if (InstallReactOS == NULL)
00074     {
00075       DPRINT("Failed to get address for 'InstallReactOS()'!\n");
00076       FreeLibrary (hDll);
00077       return;
00078     }
00079 
00080   InstallReactOS (hInstance);
00081 
00082   FreeLibrary (hDll);
00083 }
00084 
00085 static VOID
00086 RunLiveCD (HINSTANCE hInstance)
00087 {
00088   HMODULE hDll;
00089   PINSTALL_REACTOS InstallLiveCD;
00090 
00091   hDll = LoadLibrary (TEXT("syssetup"));
00092   if (hDll == NULL)
00093     {
00094       DPRINT("Failed to load 'syssetup'!\n");
00095       return;
00096     }
00097 
00098   DPRINT("Loaded 'syssetup'!\n");
00099   InstallLiveCD = (PINSTALL_REACTOS)GetProcAddress (hDll, "InstallLiveCD");
00100 
00101   if (InstallLiveCD == NULL)
00102     {
00103       DPRINT("Failed to get address for 'InstallReactOS()'!\n");
00104       FreeLibrary (hDll);
00105       return;
00106     }
00107 
00108   InstallLiveCD (hInstance);
00109 
00110   FreeLibrary (hDll);
00111 }
00112 
00113 int WINAPI
00114 _tWinMain (HINSTANCE hInstance,
00115      HINSTANCE hPrevInstance,
00116      LPTSTR lpCmdLine,
00117      int nShowCmd)
00118 {
00119   LPTSTR CmdLine;
00120   LPTSTR p;
00121 
00122   CmdLine = GetCommandLine ();
00123 
00124   DPRINT("CmdLine: <%s>\n",CmdLine);
00125 
00126   p = lstrchr (CmdLine, TEXT('-'));
00127   if (p == NULL)
00128     return 0;
00129 
00130   if (!lstrcmpi (p, TEXT("-newsetup")))
00131     {
00132       RunNewSetup (hInstance);
00133     }
00134   else if (!lstrcmpi (p, TEXT("-mini")))
00135     {
00136       RunLiveCD (hInstance);
00137     }
00138 
00139 #if 0
00140   /* Add new setup types here */
00141   else if (...)
00142     {
00143 
00144     }
00145 #endif
00146 
00147   return 0;
00148 }
00149 
00150 /* EOF */

Generated on Sun May 27 2012 04:17:56 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.