Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

arcinst.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1991-1996 Microsoft Corporation 00004 Copyright (c) 1992, 1992 Digital Equipment Corporation 00005 00006 Module Name: 00007 00008 arcinst.c 00009 00010 Abstract: 00011 00012 This module contains the code that prepares a ARC compliant platform 00013 for OS installation. It creates system partitions and formats system 00014 partitions 00015 00016 --*/ 00017 00018 00019 #include "precomp.h" 00020 #pragma hdrstop 00021 00022 00023 PCHAR Banner1 = " Arc Installation Program Version 4.00"; 00024 PCHAR Banner2 = " Copyright (c) 1991-1996 Microsoft Corporation"; 00025 00026 // 00027 // Menu definitions 00028 // 00029 00030 PCHAR rgszMainMenu[] = { 00031 "Configure Partitions", 00032 "Exit" 00033 00034 }; 00035 00036 00037 // 00038 // NOTE! This must be the number of entries in rgszMainMenu. It is used 00039 // to tell AddMenuItems the number of menu items to add. 00040 // 00041 00042 #define CSZMENUITEMS 2 00043 00044 00045 // 00046 // NOTE! These must be kept in sync with the indices for rgszMainMenu 00047 // The main menu is created by AddMenuItems which will generated 00048 // associated data values based upon the index into the array of 00049 // strings passed in. These #defines must match those values 00050 // or the switch statement used to handle the menu selection will 00051 // dispatch to the wrong code. 00052 // 00053 00054 #define CONFIG_SYS_PARTITION 0 00055 #define EXIT 1 00056 00057 #define MENU_START_ROW 4 00058 #define ERROR_ROW_TOP 13 00059 #define ERROR_ROW_BOTTOM 16 00060 00061 // 00062 // Max size for a path or environment variable 00063 // 00064 00065 #define MAX_PATH 256 00066 00067 // 00068 // Max bytes in a line 00069 // 00070 00071 #define CBMAXLINE 120 00072 00073 // 00074 // Define constants to generate a 2 meg stack and a 2 meg heap. 00075 // 00076 #define ARCINST_STACK_PAGES (2*1024*1024 / PAGE_SIZE) 00077 #define ARCINST_HEAP_PAGES (2*1024*1024 / PAGE_SIZE) 00078 00079 ARC_STATUS GetTitlesAndPaths ( PCHAR, PCHAR, ULONG, ULONG, PCHAR **,PULONG, PCHAR **, PULONG); 00080 ARC_STATUS GetSectionElementList ( PCHAR, PCHAR, ULONG, PCHAR **, PULONG ); 00081 ARC_STATUS CopySection( PCHAR, PCHAR, PCHAR, PCHAR ); 00082 ARC_STATUS UpdateOSFiles( PCHAR, PCHAR, PCHAR ); 00083 00084 VOID PrintError( PCHAR, ... ); 00085 00086 // Needed for C string functions 00087 int errno; 00088 00089 ARC_STATUS __cdecl 00090 main( 00091 IN ULONG argc, 00092 IN PCHAR argv[], 00093 IN PCHAR envp[] 00094 ) 00095 { 00096 PCHAR szSysPartition = NULL; 00097 PCHAR szInfPath = NULL; 00098 PVOID hdMenuId; 00099 ULONG MenuChoice; 00100 00101 DBG_UNREFERENCED_PARAMETER( argc ); 00102 DBG_UNREFERENCED_PARAMETER( argv ); 00103 DBG_UNREFERENCED_PARAMETER( envp ); 00104 00105 if (AlMemoryInitialize (ARCINST_STACK_PAGES, ARCINST_HEAP_PAGES) != ESUCCESS) { 00106 00107 PrintError(NULL, "Failed to initialize the heap"); 00108 return( ESUCCESS ); 00109 } 00110 00111 if (!AlInitializeMenuPackage()) { 00112 00113 PrintError(NULL, "Could not initialize menu package"); 00114 return( ESUCCESS ); 00115 00116 } 00117 00118 if (FdiskInitialize() != ESUCCESS) { 00119 00120 PrintError(NULL, "Failed to initialize the FDISK package"); 00121 return( ESUCCESS ); 00122 00123 } 00124 00125 if (!AlNewMenu(&hdMenuId)) { 00126 00127 PrintError(NULL, "Could not create main menu"); 00128 return( ESUCCESS ); 00129 00130 } 00131 00132 // 00133 // Initialize the main ArcInst menu. 00134 // 00135 // Not that when you add items in this way the associated data becomes 00136 // the index in the array of strings. Make sure the values used for 00137 // associated data the predefined values CHANGE_ENV etc. 00138 // 00139 00140 if (!AlAddMenuItems(hdMenuId, rgszMainMenu, CSZMENUITEMS)) { 00141 00142 PrintError(NULL, "Failed to Initialize Main Menu"); 00143 return( ESUCCESS ); 00144 } 00145 00146 // 00147 // Loop till Exit or an ESC key is it. 00148 // 00149 while (TRUE) { 00150 00151 // 00152 // Print Banner 00153 // 00154 AlClearScreen(); 00155 AlSetPosition(1, 0); 00156 AlPrint(Banner1); 00157 AlPrint("\r\n"); 00158 AlPrint(Banner2); 00159 00160 if (!AlDisplayMenu(hdMenuId, 00161 FALSE, 00162 CONFIG_SYS_PARTITION, 00163 &MenuChoice, 00164 MENU_START_ROW, 00165 0)) { 00166 00167 // 00168 // User hit ESC key 00169 // 00170 return( ESUCCESS ); 00171 00172 } 00173 00174 switch (MenuChoice) { 00175 00176 case CONFIG_SYS_PARTITION: 00177 00178 ConfigureSystemPartitions(); 00179 break; 00180 00181 case EXIT: 00182 00183 return(ESUCCESS); 00184 break; 00185 00186 } 00187 } 00188 } 00189 00190 VOID 00191 PrintError( 00192 IN PCHAR szFormat, 00193 ... 00194 ) 00195 00196 /*++ 00197 00198 Routine Description: 00199 00200 This routine prints a error or information message at a specific 00201 location the screen (ERROR_ROW_TOP) and waits for the user to hit 00202 any key. 00203 00204 Arguments: 00205 00206 szFormat - Format string, if NULL then "%s" is used. 00207 szErrorMessage - Text of string to print 00208 00209 Return Value: 00210 00211 none 00212 00213 --*/ 00214 00215 { 00216 va_list ArgList; 00217 00218 va_start(ArgList,szFormat); 00219 if (szFormat == NULL ) { 00220 szFormat = "%s"; 00221 } 00222 vAlStatusMsg(ERROR_ROW_TOP, TRUE, szFormat, ArgList); 00223 00224 AlWaitKey(NULL); 00225 AlClearStatusArea(ERROR_ROW_TOP, ERROR_ROW_BOTTOM); 00226 } 00227 00228 VOID 00229 JzShowTime ( 00230 BOOLEAN First 00231 ) 00232 { 00233 return; 00234 }

Generated on Sat May 15 19:39:16 2004 for test by doxygen 1.3.7