[2] | 1 | //
|
---|
| 2 | // MINSTALL.DLL (c) Copyright 2002-2005 Martin Kiewitz
|
---|
| 3 | //
|
---|
| 4 | // This file is part of MINSTALL.DLL for OS/2 / eComStation
|
---|
| 5 | //
|
---|
| 6 | // MINSTALL.DLL is free software: you can redistribute it and/or modify
|
---|
| 7 | // it under the terms of the GNU General Public License as published by
|
---|
| 8 | // the Free Software Foundation, either version 3 of the License, or
|
---|
| 9 | // (at your option) any later version.
|
---|
| 10 | //
|
---|
| 11 | // MINSTALL.DLL is distributed in the hope that it will be useful,
|
---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | // GNU General Public License for more details.
|
---|
| 15 | //
|
---|
| 16 | // You should have received a copy of the GNU General Public License
|
---|
| 17 | // along with MINSTALL.DLL. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 18 | //
|
---|
| 19 |
|
---|
| 20 | #define INCL_NOPMAPI
|
---|
| 21 | #define INCL_BASE
|
---|
| 22 | #define INCL_DOSMODULEMGR
|
---|
| 23 | #define INCL_OS2MM
|
---|
| 24 | #include <os2.h>
|
---|
| 25 | #include <os2me.h>
|
---|
| 26 | #include <malloc.h>
|
---|
| 27 |
|
---|
| 28 | #include <global.h>
|
---|
| 29 | #include <cfgsys.h>
|
---|
| 30 | #include <crcs.h>
|
---|
| 31 | #include <dll.h>
|
---|
| 32 | #include <file.h>
|
---|
| 33 | #include <globstr.h>
|
---|
| 34 | #include <msg.h>
|
---|
| 35 | #include <mmi_public.h>
|
---|
| 36 | #include <mmi_types.h>
|
---|
| 37 | #include <mmi_main.h>
|
---|
| 38 | #include <mmi_helper.h>
|
---|
| 39 | #include <mmi_msg.h>
|
---|
| 40 |
|
---|
| 41 | BOOL MINSTALL_ExtractDirOptions (PMINSTDIR CurDirPtr) {
|
---|
| 42 | PCHAR CurPos = CurDirPtr->Name;
|
---|
| 43 | PCHAR StartPos = 0;
|
---|
| 44 | ULONG VarID = 0;
|
---|
| 45 |
|
---|
| 46 | while ((*CurPos==0x24) && (*(CurPos+1)==0x28)) { // Check for '$('
|
---|
| 47 | CurPos += 2; StartPos = CurPos;
|
---|
| 48 | while (*CurPos!=0x29) { // Wait till ')'
|
---|
| 49 | if (*CurPos==0) // EOS? -> Exit, due error
|
---|
| 50 | return FALSE;
|
---|
| 51 | CurPos++;
|
---|
| 52 | }
|
---|
| 53 | VarID = CRC32_GetFromString (StartPos, CurPos-StartPos);
|
---|
| 54 | switch (VarID) {
|
---|
| 55 | case 0x70784370: // BOOT
|
---|
| 56 | CurDirPtr->Flags |= MINSTDIR_Flags_Boot;
|
---|
| 57 | break;
|
---|
| 58 | case 0xCAEABB01: // DELETE
|
---|
| 59 | CurDirPtr->Flags |= MINSTDIR_Flags_Delete;
|
---|
| 60 | break;
|
---|
| 61 | case 0x1A2A0F17: // LOCKED
|
---|
| 62 | CurDirPtr->Flags |= MINSTDIR_Flags_Locked;
|
---|
| 63 | break;
|
---|
| 64 | default:
|
---|
| 65 | return FALSE; // Unknown -> Exit, due error
|
---|
| 66 | }
|
---|
| 67 | CurPos++;
|
---|
| 68 | }
|
---|
| 69 | if ((CurDirPtr->Flags & MINSTDIR_Flags_Delete) && (CurDirPtr->Flags & MINSTDIR_Flags_Locked))
|
---|
| 70 | return FALSE; // Delete & Locked set? -> Error
|
---|
| 71 | if (CurPos!=CurDirPtr->Name)
|
---|
| 72 | strcpy (CurDirPtr->Name, CurPos);
|
---|
| 73 | return TRUE;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | BOOL MINSTALL_BuildDestinDir (PCHAR DestString, ULONG DestMaxLength, PMINSTDIR CurDirPtr) {
|
---|
| 77 | if (CurDirPtr->Flags & MINSTDIR_Flags_Locked) {
|
---|
| 78 | if (!(DestString = STRING_BuildEscaped(DestString, &DestMaxLength, "$(LOCKED)")))
|
---|
| 79 | return FALSE;
|
---|
| 80 | }
|
---|
| 81 | if (CurDirPtr->Flags & MINSTDIR_Flags_Delete) {
|
---|
| 82 | if (!(DestString = STRING_BuildEscaped(DestString, &DestMaxLength, "$(DELETE)")))
|
---|
| 83 | return FALSE;
|
---|
| 84 | }
|
---|
| 85 | if (CurDirPtr->Flags & MINSTDIR_Flags_Boot) {
|
---|
| 86 | if (!(DestString = STRING_BuildEscaped(DestString, &DestMaxLength, "$(BOOT)")))
|
---|
| 87 | return FALSE;
|
---|
| 88 | } else if (CurDirPtr->Flags & MINSTDIR_Flags_MMBase) {
|
---|
| 89 | if (!(DestString = STRING_BuildEscaped(DestString, &DestMaxLength, MINSTALL_MMBase+2)))
|
---|
| 90 | return FALSE;
|
---|
| 91 | }
|
---|
| 92 | if (!(DestString = STRING_BuildEscaped(DestString, &DestMaxLength, CurDirPtr->Name)))
|
---|
| 93 | return FALSE;
|
---|
| 94 | return TRUE;
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | // Finalizes MINSTALL-Directory Names (detailed logic please look at comments)
|
---|
| 98 | BOOL MINSTALL_FillDirFQName (PMINSTDIR CurDirPtr) {
|
---|
| 99 | if (CurDirPtr->Flags & MINSTDIR_Flags_Source) {
|
---|
| 100 | // We will ignore any flags here, but just add Source-Directory to the
|
---|
| 101 | // whole mess...
|
---|
| 102 | if (!STRING_CombinePSZ((PCHAR)CurDirPtr->FQName, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourcePath, (PCHAR)CurDirPtr->Name))
|
---|
| 103 | return FALSE; // due buffer-overflow...
|
---|
| 104 | } else {
|
---|
| 105 | // No Flags Set BOOT MMBASE
|
---|
| 106 | // \DLL -> M:\DLL -> C:\DLL -> M:\MMOS2\DLL
|
---|
| 107 | if (CurDirPtr->Flags & MINSTDIR_Flags_Boot) {
|
---|
| 108 | if (!STRING_CombinePSZ((PCHAR)CurDirPtr->FQName, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_BootDrive, (PCHAR)CurDirPtr->Name))
|
---|
| 109 | return FALSE; // due buffer-overflow...
|
---|
| 110 | } else if (CurDirPtr->Flags & MINSTDIR_Flags_MMBase) {
|
---|
| 111 | if (!STRING_CombinePSZ((PCHAR)CurDirPtr->FQName, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_MMBase, (PCHAR)CurDirPtr->Name))
|
---|
| 112 | return FALSE; // due buffer-overflow...
|
---|
| 113 | } else {
|
---|
| 114 | if (!STRING_CombinePSZ((PCHAR)CurDirPtr->FQName, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_MMBaseDrive, (PCHAR)CurDirPtr->Name))
|
---|
| 115 | return FALSE; // due buffer-overflow...
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | return TRUE;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | // ****************************************************************************
|
---|
| 122 |
|
---|
| 123 | // This will pre-process a Master-Control-File (MCF)
|
---|
| 124 | // It will count any occurance of Groups and Source/Destination directories
|
---|
| 125 | // This is done, cause we do not rely on variables to be valid *and* we dont
|
---|
| 126 | // want to hard-limit any buffers.
|
---|
| 127 | VOID MINSTALL_PreProcessMasterControlFile (PFILECONTROL ControlFile) {
|
---|
| 128 | PCHAR CurPos = ControlFile->BufferPtr;
|
---|
| 129 | PCHAR EndPos = ControlFile->BufferEndPtr;
|
---|
| 130 | PCHAR LineStartPos = 0;
|
---|
| 131 | PCHAR LineEndPos = 0;
|
---|
| 132 | CHAR CurChar = 0;
|
---|
| 133 | ULONG ValueID = 0;
|
---|
| 134 | ULONG CurLineNo = 1;
|
---|
| 135 |
|
---|
| 136 | // Reset Count-variables...
|
---|
| 137 | MCF_GroupCount = 0;
|
---|
| 138 | MCF_SourceDirCount = 0;
|
---|
| 139 | MCF_DestinDirCount = 0;
|
---|
| 140 |
|
---|
| 141 | while (CurPos<EndPos) {
|
---|
| 142 | if (!(CurChar = STRING_GetValidChar(&CurPos, EndPos, &CurLineNo)))
|
---|
| 143 | break;
|
---|
| 144 | LineStartPos = CurPos;
|
---|
| 145 | LineEndPos = STRING_GetEndOfLinePtr (CurPos, EndPos);
|
---|
| 146 | while (CurPos<LineEndPos) {
|
---|
| 147 | CurChar = *CurPos;
|
---|
| 148 | if (CurChar=='=') {
|
---|
| 149 | // Found an equal sign... Seek back over spaces...
|
---|
| 150 | do {
|
---|
| 151 | CurPos--;
|
---|
| 152 | } while ((CurPos>LineStartPos) && (*CurPos==' '));
|
---|
| 153 | CurPos++;
|
---|
| 154 | ValueID = CRC32_GetFromString(LineStartPos, CurPos-LineStartPos);
|
---|
| 155 | switch (ValueID) {
|
---|
| 156 | case 0x0D14BDAE: // sourcedir
|
---|
| 157 | MCF_SourceDirCount++; break;
|
---|
| 158 | case 0x7C4DC759: // destindir
|
---|
| 159 | MCF_DestinDirCount++; break;
|
---|
| 160 | case 0x59FD2765: // ssgroup
|
---|
| 161 | MCF_GroupCount++; break;
|
---|
| 162 | default:
|
---|
| 163 | break;
|
---|
| 164 | }
|
---|
| 165 | break;
|
---|
| 166 | }
|
---|
| 167 | *CurPos = toupper(CurChar);
|
---|
| 168 | CurPos++;
|
---|
| 169 | }
|
---|
| 170 | CurPos = LineEndPos; CurLineNo++;
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | if (MCF_SourceDirCount==0) {
|
---|
| 174 | // If no Sources defined, assume 1 source directory (current directory)
|
---|
| 175 | MCF_SourceDirCount = 1;
|
---|
| 176 | }
|
---|
| 177 | }
|
---|
| 178 |
|
---|
| 179 | // This one processes a Master-Control-File (MCF).
|
---|
| 180 | // It will load all required variables into memory for later processing.
|
---|
| 181 | // Please note that some variables are not loaded, because they are calculated
|
---|
| 182 | // later (e.g. sssize).
|
---|
| 183 | BOOL MINSTALL_ProcessMasterControlFile (PFILECONTROL ControlFile) {
|
---|
| 184 | PCHAR CurPos = ControlFile->BufferPtr;
|
---|
| 185 | PCHAR EndPos = ControlFile->BufferEndPtr;
|
---|
| 186 | PCHAR LineStartPos = 0;
|
---|
| 187 | PCHAR LineEquPos = 0;
|
---|
| 188 | PCHAR LineEndPos = 0;
|
---|
| 189 | PCHAR TmpPos = 0;
|
---|
| 190 | CHAR CurChar = 0;
|
---|
| 191 | ULONG TmpLen = 0;
|
---|
| 192 | ULONG CurArray = 0;
|
---|
| 193 | ULONG ValueID = 0;
|
---|
| 194 | ULONG VarID = 0;
|
---|
| 195 | ULONG CurLineNo = 1;
|
---|
| 196 | PMINSTGRP CurGroupPtr = MCF_GroupArrayPtr;
|
---|
| 197 | PMINSTDIR CurSourceDirPtr = MCF_SourceDirArrayPtr;
|
---|
| 198 | PMINSTDIR CurDestinDirPtr = MCF_DestinDirArrayPtr;
|
---|
| 199 | CHAR TempString[MINSTMAX_PATHLENGTH];
|
---|
| 200 |
|
---|
| 201 | // Reset some variables...
|
---|
| 202 | MCF_PackageName[0] = 0;
|
---|
| 203 | MCF_Medianame[0] = 0;
|
---|
| 204 | MCF_CodePage = 0;
|
---|
| 205 | MCF_MUnitCount = 0;
|
---|
| 206 | MCF_GroupCount = 0;
|
---|
| 207 | MCF_SourceDirCount = 0;
|
---|
| 208 | MCF_DestinDirCount = 0;
|
---|
| 209 |
|
---|
| 210 | FILELISTSCR.Name[0] = 0;
|
---|
| 211 |
|
---|
| 212 | while (CurPos<EndPos) {
|
---|
| 213 | if (!(CurChar = STRING_GetValidChar(&CurPos, EndPos, &CurLineNo)))
|
---|
| 214 | break;
|
---|
| 215 | LineStartPos = CurPos;
|
---|
| 216 | LineEndPos = STRING_GetEndOfLinePtr (CurPos, EndPos);
|
---|
| 217 | LineEquPos = 0;
|
---|
| 218 | while (CurPos<LineEndPos) {
|
---|
| 219 | CurChar = *CurPos;
|
---|
| 220 | if (CurChar=='=') {
|
---|
| 221 | // Found an equal sign... Seek back over spaces...
|
---|
| 222 | LineEquPos = CurPos;
|
---|
| 223 | do {
|
---|
| 224 | CurPos--;
|
---|
| 225 | } while ((CurPos>LineStartPos) && (*CurPos==' '));
|
---|
| 226 | CurPos++;
|
---|
| 227 | break;
|
---|
| 228 | }
|
---|
| 229 | *CurPos = toupper(CurChar);
|
---|
| 230 | CurPos++;
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | if (LineEquPos) {
|
---|
| 234 | // We found an '=', so identify value and extract contents...
|
---|
| 235 | ValueID = CRC32_GetFromString(LineStartPos, CurPos-LineStartPos);
|
---|
| 236 | CurPos = LineEquPos+1;
|
---|
| 237 | if (!(CurChar = STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo))) {
|
---|
| 238 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break; }
|
---|
| 239 | switch (ValueID) {
|
---|
| 240 | case 0xE12D998F: // package
|
---|
| 241 | if (!STRING_GetString(MCF_PackageName, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 242 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 243 | break;
|
---|
| 244 | case 0x7772043C: // codepage
|
---|
| 245 | if (!STRING_GetNumericValue(&MCF_CodePage, CurPos, EndPos))
|
---|
| 246 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric;
|
---|
| 247 | break;
|
---|
| 248 | case 0xE0D3F337: // filelist
|
---|
| 249 | if (!STRING_GetString(TempString, MINSTMAX_PATHLENGTH, CurPos, EndPos)) {
|
---|
| 250 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 251 | if (!STRING_CombinePSZ ((PCHAR)&FILELISTSCR.Name, MINSTMAX_PATHLENGTH, MINSTALL_SourceDir, (PCHAR)&TempString))
|
---|
| 252 | MINSTALL_ErrorMsgID = MINSTMSG_StringTooLong;
|
---|
| 253 | break;
|
---|
| 254 | case 0x7E3F3B04: // munitcount
|
---|
| 255 | if (!STRING_GetNumericValue(&MCF_MUnitCount, CurPos, EndPos))
|
---|
| 256 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric;
|
---|
| 257 | break;
|
---|
| 258 | case 0x1CDB0BEE: // medianame
|
---|
| 259 | if (!STRING_GetString(MCF_Medianame, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 260 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 261 | break;
|
---|
| 262 | case 0x0D14BDAE: // sourcedir
|
---|
| 263 | if (!(CurPos = STRING_GetString(CurSourceDirPtr->Name, MINSTMAX_PATHLENGTH, CurPos, EndPos))) {
|
---|
| 264 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 265 | if (STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)!='=') {
|
---|
| 266 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 267 | CurPos++;
|
---|
| 268 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 269 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break; }
|
---|
| 270 | // We upper-case all directory-names...
|
---|
| 271 | strupr (CurSourceDirPtr->Name);
|
---|
| 272 | if (!(CurPos = STRING_GetNumericValue(&VarID, CurPos, EndPos))) {
|
---|
| 273 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break; }
|
---|
| 274 |
|
---|
| 275 | CurSourceDirPtr->Flags = MINSTDIR_Flags_Source;
|
---|
| 276 | if (!MINSTALL_ExtractDirOptions (CurSourceDirPtr)) {
|
---|
| 277 | MSG_SetInsertViaPSZ (2, CurSourceDirPtr->Name);
|
---|
| 278 | MINSTALL_ErrorMsgID = MINSTMSG_BadDirectoryFlags; break; }
|
---|
| 279 |
|
---|
| 280 | if (MINSTALL_SearchSourceDirID(VarID)) {
|
---|
| 281 | MSG_SetInsertViaPSZ (2, TempString);
|
---|
| 282 | MINSTALL_ErrorMsgID = MINSTMSG_DuplicateDirectoryID; break; }
|
---|
| 283 | CurSourceDirPtr->ID = VarID;
|
---|
| 284 | CurSourceDirPtr++; MCF_SourceDirCount++;
|
---|
| 285 | break;
|
---|
| 286 | case 0x7C4DC759: // destindir
|
---|
| 287 | if (!(CurPos = STRING_GetString(CurDestinDirPtr->Name, MINSTMAX_PATHLENGTH, CurPos, EndPos))) {
|
---|
| 288 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 289 | if (STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)!='=') {
|
---|
| 290 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 291 | CurPos++;
|
---|
| 292 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 293 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break; }
|
---|
| 294 | // We upper-case all directory-names...
|
---|
| 295 | strupr (CurDestinDirPtr->Name);
|
---|
| 296 | if (!(CurPos = STRING_GetNumericValue(&VarID, CurPos, EndPos))) {
|
---|
| 297 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break; }
|
---|
| 298 |
|
---|
| 299 | CurDestinDirPtr->Flags = 0;
|
---|
| 300 | if (!MINSTALL_ExtractDirOptions (CurDestinDirPtr)) {
|
---|
| 301 | MSG_SetInsertViaPSZ (2, CurDestinDirPtr->Name);
|
---|
| 302 | MINSTALL_ErrorMsgID = MINSTMSG_BadDirectoryFlags; break; }
|
---|
| 303 |
|
---|
| 304 | if (MINSTALL_SearchDestinDirID(VarID)) {
|
---|
| 305 | MSG_SetInsertViaPSZ (2, TempString);
|
---|
| 306 | MINSTALL_ErrorMsgID = MINSTMSG_DuplicateDirectoryID; break; }
|
---|
| 307 | CurDestinDirPtr->ID = VarID;
|
---|
| 308 | CurDestinDirPtr++; MCF_DestinDirCount++;
|
---|
| 309 | break;
|
---|
| 310 | case 0x59FD2765: // ssgroup
|
---|
| 311 | if (!(CurPos = STRING_GetNumericValue(&VarID, CurPos, EndPos))) {
|
---|
| 312 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break; }
|
---|
| 313 | if (MINSTALL_SearchGroupID(VarID)) {
|
---|
| 314 | MSG_SetInsertViaPSZ (2, TempString);
|
---|
| 315 | MINSTALL_ErrorMsgID = MINSTMSG_DuplicateGroupID; break; }
|
---|
| 316 | if (MCF_GroupCount>0) CurGroupPtr++;
|
---|
| 317 | MCF_GroupCount++;
|
---|
| 318 | // Reset that structure to NUL
|
---|
| 319 | memset (CurGroupPtr, 0, sizeof(MINSTGRP));
|
---|
| 320 | CurGroupPtr->ID = VarID;
|
---|
| 321 | break;
|
---|
| 322 | case 0xD99224F: // ssname
|
---|
| 323 | if (MCF_GroupCount==0) break;
|
---|
| 324 | if (!STRING_GetString(CurGroupPtr->Name, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 325 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 326 | break;
|
---|
| 327 | case 0x6B4A6F9F: // ssversion
|
---|
| 328 | if (MCF_GroupCount==0) break;
|
---|
| 329 | if (!STRING_GetString(CurGroupPtr->Version, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 330 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 331 | CurGroupPtr->VersionCode = MINSTALL_GetVersionCode (CurGroupPtr->Version);
|
---|
| 332 | break;
|
---|
| 333 | case 0x362E7592: // ssicon
|
---|
| 334 | if (MCF_GroupCount==0) break;
|
---|
| 335 | if (!STRING_GetString(CurGroupPtr->Icon, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 336 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 337 | break;
|
---|
| 338 | case 0xA67E5483: // ssselect
|
---|
| 339 | if (MCF_GroupCount==0) break;
|
---|
| 340 | if (!STRING_GetString(TempString, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 341 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 342 | strupr (TempString);
|
---|
| 343 | VarID = CRC32_GetFromPSZ(TempString);
|
---|
| 344 | switch (VarID) {
|
---|
| 345 | case 0x00000000:
|
---|
| 346 | case 0x565CFB9D: CurGroupPtr->AutoSelect = MINSTGRP_Select_Always; break;
|
---|
| 347 | case 0x26A83945: CurGroupPtr->AutoSelect = MINSTGRP_Select_Required; break;
|
---|
| 348 | case 0x80592DD9: CurGroupPtr->AutoSelect = MINSTGRP_Select_Version; break;
|
---|
| 349 | case 0xE3407723: CurGroupPtr->AutoSelect = MINSTGRP_Select_Yes; break;
|
---|
| 350 | case 0xC9402C75: CurGroupPtr->AutoSelect = MINSTGRP_Select_No; break;
|
---|
| 351 | case 0x94636823: CurGroupPtr->AutoSelect = MINSTGRP_Select_BaseNewer; break;
|
---|
| 352 | case 0x598EB31F: CurGroupPtr->AutoSelect = MINSTGRP_Select_OnlyNewer; break;
|
---|
| 353 | default:
|
---|
| 354 | MSG_SetInsertViaPSZ (2, TempString);
|
---|
| 355 | MINSTALL_ErrorMsgID = MINSTMSG_BadSelectValue;
|
---|
| 356 | return FALSE; // If Select unknown -> exit
|
---|
| 357 | }
|
---|
| 358 | break;
|
---|
| 359 | case 0x3D5C7773: // ssconfigch
|
---|
| 360 | if (MCF_GroupCount==0) break;
|
---|
| 361 | if (!STRING_GetString(CurGroupPtr->ConfigFileName, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 362 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 363 | strlwr (CurGroupPtr->ConfigFileName);
|
---|
| 364 | break;
|
---|
| 365 | case 0xF77B2010: // ssinich
|
---|
| 366 | if (MCF_GroupCount==0) break;
|
---|
| 367 | if (!STRING_GetString(CurGroupPtr->INIFileName, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 368 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 369 | strlwr (CurGroupPtr->INIFileName);
|
---|
| 370 | break;
|
---|
| 371 | case 0xB94E8B65: // sscoreqs
|
---|
| 372 | if (MCF_GroupCount==0) break;
|
---|
| 373 | if (!STRING_GetString(CurGroupPtr->CoReqs, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 374 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 375 | break;
|
---|
| 376 | case 0x9E43B251: // ssodinst
|
---|
| 377 | if (MCF_GroupCount==0) break;
|
---|
| 378 | if (!STRING_GetString(CurGroupPtr->ODInst, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 379 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 380 | break;
|
---|
| 381 | case 0x341CCAE4: // ssdll
|
---|
| 382 | if (MCF_GroupCount==0) break;
|
---|
| 383 | if (!STRING_GetString(CurGroupPtr->DLLFileName, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 384 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 385 | strlwr (CurGroupPtr->DLLFileName); // Lowercase value
|
---|
| 386 | break;
|
---|
| 387 | case 0x81E8FFA6: // sstermdll
|
---|
| 388 | if (MCF_GroupCount==0) break;
|
---|
| 389 | if (!STRING_GetString(CurGroupPtr->TermDLLFileName, MINSTMAX_STRLENGTH, CurPos, EndPos)) {
|
---|
| 390 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break; }
|
---|
| 391 | strlwr (CurGroupPtr->TermDLLFileName); // Lowercase value
|
---|
| 392 | break;
|
---|
| 393 | case 0xB6C7995E: // ssdllentry
|
---|
| 394 | if (MCF_GroupCount==0) break;
|
---|
| 395 | if (!STRING_GetString(CurGroupPtr->DLLEntry, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 396 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 397 | break;
|
---|
| 398 | case 0x787E1B15: // sstermdllentry
|
---|
| 399 | if (MCF_GroupCount==0) break;
|
---|
| 400 | if (!STRING_GetString(CurGroupPtr->TermDLLEntry, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 401 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 402 | break;
|
---|
| 403 | case 0x834F590D: // ssdllinputparms
|
---|
| 404 | if (MCF_GroupCount==0) break;
|
---|
| 405 | if (!STRING_GetString(CurGroupPtr->DLLParms, MINSTMAX_STRLENGTH, CurPos, EndPos))
|
---|
| 406 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine;
|
---|
| 407 | break;
|
---|
| 408 | default:
|
---|
| 409 | break;
|
---|
| 410 | }
|
---|
| 411 | if (MINSTALL_ErrorMsgID) break;
|
---|
| 412 | }
|
---|
| 413 | CurPos = LineEndPos+1; CurLineNo++;
|
---|
| 414 | }
|
---|
| 415 | if (MCF_SourceDirCount==0) {
|
---|
| 416 | // If no Sources defined, assume 1 source directory (current)
|
---|
| 417 | MCF_SourceDirCount = 1;
|
---|
| 418 | CurSourceDirPtr->ID = 0;
|
---|
| 419 | CurSourceDirPtr->Flags = MINSTDIR_Flags_Source;
|
---|
| 420 | strcpy (CurSourceDirPtr->Name, "\\");
|
---|
| 421 | }
|
---|
| 422 |
|
---|
| 423 | if (MINSTALL_ErrorMsgID) { // If Error-found during parsing...
|
---|
| 424 | MSG_SetInsertFileLocation (1, ControlFile->Name, CurLineNo);
|
---|
| 425 | MINSTALL_TrappedError (MINSTALL_ErrorMsgID);
|
---|
| 426 | return FALSE;
|
---|
| 427 | }
|
---|
| 428 | return TRUE;
|
---|
| 429 | }
|
---|
| 430 |
|
---|
| 431 | BOOL MINSTALL_LoadMasterControl (void) {
|
---|
| 432 | // Remember this action for cleanup...
|
---|
| 433 | MINSTALL_Done |= MINSTDONE_LOADMASTERCTRLSCR;
|
---|
| 434 |
|
---|
| 435 | // Open CONTROL.scr file in SourcePath
|
---|
| 436 | if (!FILE_LoadFileControl(&CONTROLSCR, 131767)) {
|
---|
| 437 | MSG_SetInsertViaPSZ (1, CONTROLSCR.Name);
|
---|
| 438 | MINSTALL_TrappedError (MINSTMSG_CouldNotLoad);
|
---|
| 439 | return FALSE;
|
---|
| 440 | }
|
---|
| 441 | FILE_PreProcessControlFile(&CONTROLSCR);
|
---|
| 442 |
|
---|
| 443 | // Now we process the control-file contents in 2 steps. First we count
|
---|
| 444 | // every "sourcedir", "destindir" and "ssgroup"-element.
|
---|
| 445 | MINSTALL_PreProcessMasterControlFile(&CONTROLSCR);
|
---|
| 446 |
|
---|
| 447 | // Check, if we got at least one of everything...
|
---|
| 448 | if (MCF_GroupCount==0) {
|
---|
| 449 | MINSTALL_TrappedError (MINSTMSG_NoGroupsSpecified); return FALSE;
|
---|
| 450 | } else if ((MCF_SourceDirCount==0) | (MCF_DestinDirCount==0)) {
|
---|
| 451 | MINSTALL_TrappedError (MINSTMSG_NoDirectoriesSpecified); return FALSE;
|
---|
| 452 | }
|
---|
| 453 |
|
---|
| 454 | // Now we allocate buffers for those variables...
|
---|
| 455 | MCF_GroupArrayPtr = malloc(MCF_GroupCount*MINSTGRP_Length);
|
---|
| 456 | if (MCF_GroupArrayPtr==NULL) {
|
---|
| 457 | MINSTALL_TrappedError (MINSTMSG_OutOfMemory); return FALSE; }
|
---|
| 458 | MCF_SourceDirArrayPtr = malloc(MCF_SourceDirCount*MINSTDIR_Length);
|
---|
| 459 | if (MCF_SourceDirArrayPtr==NULL) {
|
---|
| 460 | MINSTALL_TrappedError (MINSTMSG_OutOfMemory); return FALSE; }
|
---|
| 461 | MCF_DestinDirArrayPtr = malloc(MCF_DestinDirCount*MINSTDIR_Length);
|
---|
| 462 | if (MCF_DestinDirArrayPtr==NULL) {
|
---|
| 463 | MINSTALL_TrappedError (MINSTMSG_OutOfMemory); return FALSE; }
|
---|
| 464 |
|
---|
| 465 | // ...and read all variables in the actual pass
|
---|
| 466 | if (!MINSTALL_ProcessMasterControlFile(&CONTROLSCR)) return FALSE;
|
---|
| 467 | return TRUE;
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 | // ****************************************************************************
|
---|
| 471 |
|
---|
| 472 | BOOL MINSTALL_LoadFileControl (void) {
|
---|
| 473 | PCHAR CurPos = 0;
|
---|
| 474 | PCHAR EndPos = 0;
|
---|
| 475 | PCHAR LineStartPos = 0;
|
---|
| 476 | PCHAR LineEndPos = 0;
|
---|
| 477 | PCHAR TmpPos = 0;
|
---|
| 478 | CHAR CurChar = 0;
|
---|
| 479 | CHAR TempString[MINSTMAX_STRLENGTH];
|
---|
| 480 | ULONG SupposedFileCount = 0;
|
---|
| 481 | ULONG CurLineNo = 1;
|
---|
| 482 | BOOL GotCount = FALSE;
|
---|
| 483 | PMINSTFILE CurFilePtr = 0;
|
---|
| 484 | ULONG CurID = 0;
|
---|
| 485 |
|
---|
| 486 | // Reset some variables...
|
---|
| 487 | FCF_FileCount = 0;
|
---|
| 488 |
|
---|
| 489 | // Remember this action for cleanup...
|
---|
| 490 | MINSTALL_Done |= MINSTDONE_LOADFILECTRLSCR;
|
---|
| 491 |
|
---|
| 492 | // Open FILELIST
|
---|
| 493 | if (!FILE_LoadFileControl(&FILELISTSCR, 131767)) {
|
---|
| 494 | MSG_SetInsertViaPSZ (1, FILELISTSCR.Name);
|
---|
| 495 | MINSTALL_TrappedError (MINSTMSG_CouldNotLoad);
|
---|
| 496 | return FALSE;
|
---|
| 497 | }
|
---|
| 498 | FILE_PreProcessControlFile(&FILELISTSCR);
|
---|
| 499 |
|
---|
| 500 | // Count lines of Control-File (lines with content only)
|
---|
| 501 | SupposedFileCount = FILE_CountControlFileLines (&FILELISTSCR);
|
---|
| 502 | if (SupposedFileCount>0) SupposedFileCount--; // Ignore first-line...
|
---|
| 503 | if (SupposedFileCount==0) {
|
---|
| 504 | FILE_UnLoadFileControl(&FILELISTSCR);
|
---|
| 505 | MINSTALL_TrappedError (MINSTMSG_NoFilesSpecified); return FALSE;
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | // Compatibility fix - include 4 extra file entries per group just in case
|
---|
| 509 | // 29.05.2005 cardinfo/installation DLLs/scripts are not specified
|
---|
| 510 | SupposedFileCount += MCF_GroupCount*4;
|
---|
| 511 |
|
---|
| 512 | // Now we allocate buffers for File-Array...
|
---|
| 513 | FCF_FileArrayPtr = malloc(SupposedFileCount*MINSTFILE_Length);
|
---|
| 514 | if (FCF_FileArrayPtr==NULL) {
|
---|
| 515 | FILE_UnLoadFileControl(&FILELISTSCR);
|
---|
| 516 | MINSTALL_TrappedError (MINSTMSG_OutOfMemory); return FALSE;
|
---|
| 517 | }
|
---|
| 518 |
|
---|
| 519 | // ...now read the actual data...
|
---|
| 520 | CurPos = FILELISTSCR.BufferPtr; EndPos = FILELISTSCR.BufferEndPtr;
|
---|
| 521 | CurFilePtr = FCF_FileArrayPtr;
|
---|
| 522 | while (CurPos<EndPos) {
|
---|
| 523 | if (!(CurChar = STRING_GetValidChar(&CurPos, EndPos, &CurLineNo)))
|
---|
| 524 | break;
|
---|
| 525 | LineStartPos = CurPos;
|
---|
| 526 | LineEndPos = STRING_GetEndOfLinePtr (CurPos, EndPos);
|
---|
| 527 |
|
---|
| 528 | // Reset MINSTFILE-Structure...
|
---|
| 529 | memset (CurFilePtr, 0, MINSTFILE_Length);
|
---|
| 530 |
|
---|
| 531 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 532 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break;
|
---|
| 533 | }
|
---|
| 534 | if (!(CurPos = STRING_GetNumericValue(&CurID, CurPos, LineEndPos))) {
|
---|
| 535 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break;
|
---|
| 536 | }
|
---|
| 537 | if (!GotCount)
|
---|
| 538 | GotCount = TRUE; // <- skip first valid value...
|
---|
| 539 | else {
|
---|
| 540 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 541 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break;
|
---|
| 542 | }
|
---|
| 543 | if (!(CurPos = STRING_GetNumericValue(&CurID, CurPos, LineEndPos))) {
|
---|
| 544 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break;
|
---|
| 545 | }
|
---|
| 546 | if (!(CurFilePtr->GroupPtr = MINSTALL_SearchGroupID(CurID))) {
|
---|
| 547 | MINSTALL_ErrorMsgID = MINSTMSG_UnknownGroupID; break;
|
---|
| 548 | }
|
---|
| 549 | CurFilePtr->GroupID = CurID;
|
---|
| 550 |
|
---|
| 551 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 552 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break;
|
---|
| 553 | }
|
---|
| 554 | if (!(CurPos = STRING_GetNumericValue(&CurID, CurPos, LineEndPos))) {
|
---|
| 555 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break;
|
---|
| 556 | }
|
---|
| 557 | if (!(CurFilePtr->DestinPtr = MINSTALL_SearchDestinDirID(CurID))) {
|
---|
| 558 | MINSTALL_ErrorMsgID = MINSTMSG_UnknownDestinID; break;
|
---|
| 559 | }
|
---|
| 560 | CurFilePtr->DestinID = CurID;
|
---|
| 561 |
|
---|
| 562 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 563 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break;
|
---|
| 564 | }
|
---|
| 565 | if (!(CurPos = STRING_GetNumericValue(&CurID, CurPos, LineEndPos))) {
|
---|
| 566 | MINSTALL_ErrorMsgID = MINSTMSG_InvalidNumeric; break;
|
---|
| 567 | }
|
---|
| 568 | if (!(CurFilePtr->SourcePtr = MINSTALL_SearchSourceDirID(CurID))) {
|
---|
| 569 | MINSTALL_ErrorMsgID = MINSTMSG_UnknownSourceID; break;
|
---|
| 570 | }
|
---|
| 571 | CurFilePtr->SourceID = CurID;
|
---|
| 572 |
|
---|
| 573 | if (!STRING_GetValidChar(&CurPos, LineEndPos, &CurLineNo)) {
|
---|
| 574 | MINSTALL_ErrorMsgID = MINSTMSG_ValueExpected; break;
|
---|
| 575 | }
|
---|
| 576 | if (!(CurPos = STRING_GetString((PCHAR)CurFilePtr->Name, MINSTMAX_PATHLENGTH, CurPos, LineEndPos))) {
|
---|
| 577 | MINSTALL_ErrorMsgID = MINSTMSG_UnexpectedEndOfLine; break;
|
---|
| 578 | }
|
---|
| 579 |
|
---|
| 580 | // We lower-case all filenames...
|
---|
| 581 | strlwr (CurFilePtr->Name);
|
---|
| 582 | CurFilePtr->NameCRC32 = CRC32_GetFromPSZ(CurFilePtr->Name);
|
---|
| 583 |
|
---|
| 584 | FCF_FileCount++;
|
---|
| 585 | // pointer to next file, cause we are done...
|
---|
| 586 | CurFilePtr++;
|
---|
| 587 | }
|
---|
| 588 |
|
---|
| 589 | // Set CurPos to end
|
---|
| 590 | CurPos = LineEndPos;
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | // Remove that file from memory...
|
---|
| 594 | FILE_UnLoadFileControl(&FILELISTSCR);
|
---|
| 595 |
|
---|
| 596 | if (MINSTALL_ErrorMsgID) { // If Error-found during parsing...
|
---|
| 597 | MSG_SetInsertFileLocation (1, FILELISTSCR.Name, CurLineNo);
|
---|
| 598 | MINSTALL_TrappedError (MINSTALL_ErrorMsgID);
|
---|
| 599 | return FALSE;
|
---|
| 600 | }
|
---|
| 601 | return TRUE;
|
---|
| 602 | }
|
---|
| 603 |
|
---|
| 604 | // ****************************************************************************
|
---|
| 605 |
|
---|
| 606 | // Will analyse and included all valid and used files/groups/directories
|
---|
| 607 | BOOL MINSTALL_FilterControlFileData (VOID) {
|
---|
| 608 | USHORT CurNo = 0;
|
---|
| 609 | PMINSTFILE CurFilePtr = FCF_FileArrayPtr;
|
---|
| 610 | PMINSTGRP CurGroupPtr = 0;
|
---|
| 611 | PMINSTDIR CurSourceDirPtr = 0;
|
---|
| 612 | PMINSTDIR CurDestinDirPtr = MCF_DestinDirArrayPtr;
|
---|
| 613 | ULONG CRC32 = 0;
|
---|
| 614 | CHAR TempSourceFile[MINSTMAX_PATHLENGTH];
|
---|
| 615 | FILESTATUS3 CurFileInfo;
|
---|
| 616 | BOOL IsBannedFile = FALSE;
|
---|
| 617 | PCHAR CurPos = 0;
|
---|
| 618 | PMINSTFILE InsertFilePtr = NULL;
|
---|
| 619 | PMINSTDIR InsertDirPtr = NULL;
|
---|
| 620 |
|
---|
| 621 | /* obsolete code 13.6.2004 */
|
---|
| 622 | /* FCF_CARDINFOFilePtr = 0; */
|
---|
| 623 | /* FCF_CARDINFOHandle = 0; */
|
---|
| 624 | MINSTALL_GeninUsed = FALSE;
|
---|
| 625 | MINSTALL_IsBaseInstallation = FALSE;
|
---|
| 626 |
|
---|
| 627 | // Check, if minstall.dll, minstall.msg, minstall.exe & genin.dll are included
|
---|
| 628 | if ((MINSTALL_SearchFileCRC32(0x44E1F798)) && (MINSTALL_SearchFileCRC32(0x11B81B01)) &&
|
---|
| 629 | (MINSTALL_SearchFileCRC32(0x1251F25E)) && (MINSTALL_SearchFileCRC32(0x160F4433)))
|
---|
| 630 | MINSTALL_IsBaseInstallation = TRUE;
|
---|
| 631 |
|
---|
| 632 | // Check, if path-flags needs to get fixed...
|
---|
| 633 | while (CurNo<MCF_DestinDirCount) {
|
---|
| 634 | // Destination-Directory fixups:
|
---|
| 635 | if (strncmp(CurDestinDirPtr->Name, "\\OS2\\", 5)==0) {
|
---|
| 636 | // "\OS2\*" -> Set BOOT-Flag
|
---|
| 637 | CurDestinDirPtr->Flags |= MINSTDIR_Flags_Boot;
|
---|
| 638 | } else if (strncmp(CurDestinDirPtr->Name, "\\MMOS2\\", 7)==0) {
|
---|
| 639 | // "\MMOS2\* -> Reset BOOT-Flag, set MMBASE-Flag, remove "\MMOS2\"
|
---|
| 640 | CurDestinDirPtr->Flags &= !MINSTDIR_Flags_Boot;
|
---|
| 641 | CurDestinDirPtr->Flags |= MINSTDIR_Flags_MMBase;
|
---|
| 642 | strcpy (CurDestinDirPtr->Name, CurDestinDirPtr->Name+6);
|
---|
| 643 | }
|
---|
| 644 | if (!MINSTALL_FillDirFQName(CurDestinDirPtr))
|
---|
| 645 | return FALSE; // Due Buffer-Overflow
|
---|
| 646 | // Include all Destination directories...
|
---|
| 647 | CurDestinDirPtr->Flags |= MINSTDIR_Flags_Included;
|
---|
| 648 |
|
---|
| 649 | CurDestinDirPtr++; CurNo++;
|
---|
| 650 | }
|
---|
| 651 |
|
---|
| 652 | // We are processing contents of FILELIST-Script (for error logging)...
|
---|
| 653 | MSG_SetInsertViaPSZ (1, FILELISTSCR.Name);
|
---|
| 654 |
|
---|
| 655 | // Go through the whole file-listing and check the specified files
|
---|
| 656 | CurNo = 0;
|
---|
| 657 | while (CurNo<FCF_FileCount) {
|
---|
| 658 | // Get Pointer from FILE->GROUP/DIR
|
---|
| 659 | CurGroupPtr = CurFilePtr->GroupPtr;
|
---|
| 660 | CurSourceDirPtr = CurFilePtr->SourcePtr;
|
---|
| 661 | CurDestinDirPtr = CurFilePtr->DestinPtr;
|
---|
| 662 |
|
---|
| 663 | // Filter out some files by checking their CRC32
|
---|
| 664 | switch (CurFilePtr->NameCRC32) {
|
---|
| 665 | case 0x46C5EEDD: // geninmri.dll (Generic Installer Text)
|
---|
| 666 | case 0xDBD15D0E: // ibmoptns.dll (??)
|
---|
| 667 | case 0x426A7266: // iterm.dll (Responsible To Generate WPS-Objects)
|
---|
| 668 | case 0xB8E85432: // timer0.sys (Timing PDD)
|
---|
| 669 | case 0x84F52EBF: // clock01.sys (Timing PDD)
|
---|
| 670 | case 0xC355546F: // clock02.sys (Timing PDD)
|
---|
| 671 | case 0x6DDDA492: // resource.sys (Resource Manager)
|
---|
| 672 | case 0x6EE2C9DC: // mmpm2.ini (thx to the morons that did uniaud)
|
---|
| 673 | IsBannedFile = TRUE;
|
---|
| 674 | break;
|
---|
| 675 | case 0x160F4433: // genin.dll (Generic Installer Code)
|
---|
| 676 | case 0x1251F25E: // minstall.exe
|
---|
| 677 | case 0xE29E8FAA: // audioif.dll
|
---|
| 678 | case 0xFD7E670C: // ampmxmcd.dll
|
---|
| 679 | case 0xFFE31036: // audiosh.dll
|
---|
| 680 | // Install those one only, when being on base installation
|
---|
| 681 | if (!MINSTALL_IsBaseInstallation)
|
---|
| 682 | IsBannedFile = TRUE;
|
---|
| 683 | break;
|
---|
| 684 | default:
|
---|
| 685 | IsBannedFile = FALSE;
|
---|
| 686 | break;
|
---|
| 687 | }
|
---|
| 688 |
|
---|
| 689 | if (!IsBannedFile) {
|
---|
| 690 | // Source-Directory Pre-Processing
|
---|
| 691 | //========================================
|
---|
| 692 | // We check, if specified directory exists and fix bad directories
|
---|
| 693 | if (!(CurSourceDirPtr->Flags & MINSTDIR_Flags_Included)) {
|
---|
| 694 | if (!MINSTALL_FillDirFQName(CurSourceDirPtr))
|
---|
| 695 | return FALSE; // Due Buffer-Overflow
|
---|
| 696 | }
|
---|
| 697 |
|
---|
| 698 | switch (CurFilePtr->NameCRC32) {
|
---|
| 699 | case 0x15ED86B8: // cardinfo.dll (Generic Installer Custom Data)
|
---|
| 700 | // This file won't get copied, but used by GENIN-compatibility code */
|
---|
| 701 | /* obsolete code 13.6.2004 */
|
---|
| 702 | /* // Remember this file for later, but it wont get copied... */
|
---|
| 703 | /* FCF_CARDINFOFilePtr = CurFilePtr; */
|
---|
| 704 | break;
|
---|
| 705 |
|
---|
| 706 | default:
|
---|
| 707 | CurFilePtr->Flags |= MINSTFILE_Flags_Included;
|
---|
| 708 | CurSourceDirPtr->Flags |= MINSTDIR_Flags_Included;
|
---|
| 709 |
|
---|
| 710 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, CurSourceDirPtr->FQName, CurFilePtr->Name))
|
---|
| 711 | return FALSE;
|
---|
| 712 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 713 | MSG_SetInsertViaPSZ (2, TempSourceFile);
|
---|
| 714 | MINSTALL_TrappedError (MINSTMSG_CouldNotFindSourceFile);
|
---|
| 715 | return FALSE; // File not found or problem
|
---|
| 716 | }
|
---|
| 717 | CurGroupPtr->SpaceNeeded += CurFileInfo.cbFile;
|
---|
| 718 | }
|
---|
| 719 | }
|
---|
| 720 | CurFilePtr++; CurNo++;
|
---|
| 721 | }
|
---|
| 722 |
|
---|
| 723 | // We are processing contents of CONTROL-Script (for error logging)...
|
---|
| 724 | MSG_SetInsertViaPSZ (1, CONTROLSCR.Name);
|
---|
| 725 |
|
---|
| 726 | CurGroupPtr = MCF_GroupArrayPtr; CurNo = 0;
|
---|
| 727 | while (CurNo<MCF_GroupCount) {
|
---|
| 728 | // GroupID Processing
|
---|
| 729 | // ====================
|
---|
| 730 |
|
---|
| 731 | if (CurGroupPtr->ID==0) {
|
---|
| 732 | // If we find group 0, we will set some defaults and automatic select
|
---|
| 733 | // that group for installation (so the files of group 0 will get
|
---|
| 734 | // copied anytime). We also set some hard-coded values for safety.
|
---|
| 735 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 736 | CurGroupPtr->Flags |= MINSTGRP_Flags_DontListPublic;
|
---|
| 737 | strcpy (CurGroupPtr->Name, "mmbase");
|
---|
| 738 | strcpy (CurGroupPtr->Version, "1.1.5");
|
---|
| 739 | CurGroupPtr->VersionCode = 0x010105;
|
---|
| 740 | } else {
|
---|
| 741 | // Installed-Version Checking and Pre-Selection
|
---|
| 742 | // ==============================================
|
---|
| 743 | // If the group id is not 0, we check if the group is already
|
---|
| 744 | // installed and process CurGroupPtr->Select to find out, if this
|
---|
| 745 | // group shall be shown in Public-Group. Also check, if it needs to
|
---|
| 746 | // get preselected.
|
---|
| 747 |
|
---|
| 748 | MINSTALL_GetInstalledVersion (CurGroupPtr->Name, CurGroupPtr->VersionInstalled);
|
---|
| 749 | CurGroupPtr->VersionInstalledCode = MINSTALL_GetVersionCode (CurGroupPtr->VersionInstalled);
|
---|
| 750 |
|
---|
| 751 | switch (CurGroupPtr->AutoSelect) {
|
---|
| 752 | case MINSTGRP_Select_Always:
|
---|
| 753 | // Preselect, user may not choose
|
---|
| 754 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 755 | CurGroupPtr->Flags |= MINSTGRP_Flags_SelectionForced;
|
---|
| 756 | break;
|
---|
| 757 | case MINSTGRP_Select_Required:
|
---|
| 758 | // Preselect, user may only choose, if package was not installed
|
---|
| 759 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 760 | if (strlen(CurGroupPtr->VersionInstalled)>0)
|
---|
| 761 | CurGroupPtr->Flags |= MINSTGRP_Flags_SelectionForced;
|
---|
| 762 | break;
|
---|
| 763 | case MINSTGRP_Select_Version:
|
---|
| 764 | // Preselected, if already installed and version older, user may
|
---|
| 765 | // choose anyway.
|
---|
| 766 | if (strlen(CurGroupPtr->VersionInstalled)>0)
|
---|
| 767 | // 10.02.2006 - Fixed, did only check if anything is already
|
---|
| 768 | // installed and then preselected the package.
|
---|
| 769 | if (CurGroupPtr->VersionInstalledCode<CurGroupPtr->VersionCode)
|
---|
| 770 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 771 | break;
|
---|
| 772 | case MINSTGRP_Select_Yes:
|
---|
| 773 | // Preselected, but let user choose
|
---|
| 774 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 775 | break;
|
---|
| 776 | case MINSTGRP_Select_No:
|
---|
| 777 | // Not preselected, user may choose
|
---|
| 778 | break;
|
---|
| 779 | case MINSTGRP_Select_BaseNewer:
|
---|
| 780 | // Preselected only if group not installed or installed version
|
---|
| 781 | // older. Otherwise group will get forced to deselect-state
|
---|
| 782 | if (strlen(CurGroupPtr->VersionInstalled)==0) {
|
---|
| 783 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 784 | } else if (CurGroupPtr->VersionInstalledCode<CurGroupPtr->VersionCode) {
|
---|
| 785 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 786 | } else {
|
---|
| 787 | CurGroupPtr->Flags |= MINSTGRP_Flags_SelectionForced;
|
---|
| 788 | }
|
---|
| 789 | break;
|
---|
| 790 | case MINSTGRP_Select_OnlyNewer:
|
---|
| 791 | // Preselected only, if group already installed, but version older
|
---|
| 792 | // or equal to current version. Otherwise forced-deselect.
|
---|
| 793 | if ((strlen(CurGroupPtr->VersionInstalled)!=0) && (CurGroupPtr->VersionInstalledCode<=CurGroupPtr->VersionCode)) {
|
---|
| 794 | CurGroupPtr->Flags |= MINSTGRP_Flags_Selected;
|
---|
| 795 | } else {
|
---|
| 796 | CurGroupPtr->Flags |= MINSTGRP_Flags_SelectionForced;
|
---|
| 797 | }
|
---|
| 798 | }
|
---|
| 799 | }
|
---|
| 800 |
|
---|
| 801 | // DLL and TermDLL Processing
|
---|
| 802 | //============================
|
---|
| 803 | // This code checks for specific DLLs and aborts installation if a banned
|
---|
| 804 | // one was found. Also it will check for the DLL(s) to be listed in file-
|
---|
| 805 | // listing and fail, if it isn't found.
|
---|
| 806 |
|
---|
| 807 | CRC32 = CRC32_GetFromPSZ(CurGroupPtr->DLLFileName);
|
---|
| 808 | switch (CRC32) {
|
---|
| 809 | // case 0x160F4432: // genin.dll (Generic Installation)
|
---|
| 810 | // DEBUGDEBUGDEBUG
|
---|
| 811 | case 0x160F4433: // genin.dll (Generic Installation)
|
---|
| 812 | if (strcmp(CurGroupPtr->DLLEntry, "InitGenin")==0) {
|
---|
| 813 | CurGroupPtr->GeninID = atol(CurGroupPtr->DLLParms);
|
---|
| 814 | /* Extract "cardinfo.dll" name, if available as well (13.06.2004) */
|
---|
| 815 | /* Undocumented feature by IBM */
|
---|
| 816 | CurPos = CurGroupPtr->DLLParms;
|
---|
| 817 | while ((*CurPos!=0) && (*CurPos!=','))
|
---|
| 818 | CurPos++; /* Search for ';' */
|
---|
| 819 | if (*CurPos==',') {
|
---|
| 820 | /* We found a "cardinfo.dll" name */
|
---|
| 821 | CurPos++;
|
---|
| 822 | /* Append '.dll' to name and lookup in files.scr table */
|
---|
| 823 | STRING_CombinePSZ(CurGroupPtr->GeninDLLFileName, MINSTMAX_PATHLENGTH, CurPos, ".dll");
|
---|
| 824 | strlwr(CurGroupPtr->GeninDLLFileName);
|
---|
| 825 | } else {
|
---|
| 826 | strcpy(CurGroupPtr->GeninDLLFileName, "cardinfo.dll");
|
---|
| 827 | }
|
---|
| 828 | /* Now search the "cardinfo.dll" file in file-listing */
|
---|
| 829 | CRC32 = CRC32_GetFromPSZ(CurGroupPtr->GeninDLLFileName);
|
---|
| 830 | if ((CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))!=0) {
|
---|
| 831 | // Got that file, set pointer to file...
|
---|
| 832 | CurGroupPtr->GeninDLLFilePtr = CurFilePtr;
|
---|
| 833 | } else {
|
---|
| 834 | MSG_SetInsertViaPSZ (1, CurGroupPtr->GeninDLLFileName);
|
---|
| 835 | // Check, if that file exists in source directory...
|
---|
| 836 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourceDir, CurGroupPtr->GeninDLLFileName))
|
---|
| 837 | return FALSE;
|
---|
| 838 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 839 | MINSTALL_TrappedError (MINSTMSG_CARDINFOnotFound); return FALSE;
|
---|
| 840 | }
|
---|
| 841 | // Compatibility fix - we add "cardinfo.dll" files to our
|
---|
| 842 | // file-listing manually if they are not
|
---|
| 843 | // mentioned.
|
---|
| 844 | InsertFilePtr = FCF_FileArrayPtr;
|
---|
| 845 | InsertFilePtr += FCF_FileCount; // Seek over last entry
|
---|
| 846 | strcpy(InsertFilePtr->Name, CurGroupPtr->GeninDLLFileName);
|
---|
| 847 | InsertFilePtr->NameCRC32 = CRC32;
|
---|
| 848 | InsertFilePtr->Flags = 0; // Not included nor selected
|
---|
| 849 | InsertFilePtr->DiskID = 0;
|
---|
| 850 | InsertFilePtr->GroupID = CurGroupPtr->ID;
|
---|
| 851 | InsertFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 852 | // We just use first Destin-Dir - don't care, because the file
|
---|
| 853 | // is never copied...
|
---|
| 854 | InsertFilePtr->DestinID = MCF_DestinDirArrayPtr->ID;
|
---|
| 855 | InsertFilePtr->DestinPtr = MCF_DestinDirArrayPtr;
|
---|
| 856 | // We search for the '\' source directory here and use that
|
---|
| 857 | if (!(InsertDirPtr = MINSTALL_SearchRootSourceDirID())) {
|
---|
| 858 | // Really bad case, root directory was not found, so abort
|
---|
| 859 | MINSTALL_TrappedError (MINSTMSG_CARDINFOnotFound); return FALSE;
|
---|
| 860 | }
|
---|
| 861 | InsertFilePtr->SourceID = InsertDirPtr->ID;
|
---|
| 862 | InsertFilePtr->SourcePtr = InsertDirPtr;
|
---|
| 863 | FCF_FileCount++;
|
---|
| 864 |
|
---|
| 865 | MINSTALL_TrappedWarning (MINSTMSG_CARDINFOunlistedWarning);
|
---|
| 866 | }
|
---|
| 867 | MINSTALL_GeninUsed = TRUE;
|
---|
| 868 | }
|
---|
| 869 | break;
|
---|
| 870 | case 0x5A2E7E78: // cwinst.dll <-- Bad-ass Crystal drivers found
|
---|
| 871 | if (strcmp(CurGroupPtr->DLLEntry, "CWINSTENTRY")==0) {
|
---|
| 872 | MINSTALL_TrappedError (MINSTMSG_BannedDriverSet); return FALSE;
|
---|
| 873 | }
|
---|
| 874 | break;
|
---|
| 875 | // Don't check those DLLs...
|
---|
| 876 | case 0x00000000: // no DLL
|
---|
| 877 | // F6F9DE7D qrycd.dll?!?!?
|
---|
| 878 | break;
|
---|
| 879 | case 0xCBDED9CC: // dialog.dll <-- Bad-ass OPTi drivers found
|
---|
| 880 | if (strcmp(CurGroupPtr->DLLEntry, "Dialog")==0) {
|
---|
| 881 | // This is OPTi at work, so use the DLLParms as GeninID
|
---|
| 882 | // this custom DLL calls genin directly and this won't work here
|
---|
| 883 | // so we have to know it now and process it, still we also run
|
---|
| 884 | // the custom DLL as well.
|
---|
| 885 | CurGroupPtr->GeninID = atol(CurGroupPtr->DLLParms);
|
---|
| 886 | MINSTALL_GeninUsed = TRUE;
|
---|
| 887 | }
|
---|
| 888 | default:
|
---|
| 889 | if (!(CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))) {
|
---|
| 890 | MSG_SetInsertViaPSZ (2, CurGroupPtr->DLLFileName);
|
---|
| 891 | // Check, if that file exists in source directory...
|
---|
| 892 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourceDir, CurGroupPtr->DLLFileName))
|
---|
| 893 | return FALSE;
|
---|
| 894 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 895 | MINSTALL_TrappedError (MINSTMSG_InstallDLLnotFound); return FALSE;
|
---|
| 896 | }
|
---|
| 897 | // Compatibility fix - we add the Term-DLL to our file-listing
|
---|
| 898 | // manually if they are not mentioned.
|
---|
| 899 | InsertFilePtr = FCF_FileArrayPtr;
|
---|
| 900 | InsertFilePtr += FCF_FileCount; // Seek over last entry
|
---|
| 901 | strcpy(InsertFilePtr->Name, CurGroupPtr->DLLFileName);
|
---|
| 902 | InsertFilePtr->NameCRC32 = CRC32;
|
---|
| 903 | InsertFilePtr->Flags = 0; // Not included nor selected
|
---|
| 904 | InsertFilePtr->DiskID = 0;
|
---|
| 905 | InsertFilePtr->GroupID = CurGroupPtr->ID;
|
---|
| 906 | InsertFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 907 | // We just use first Destin-Dir - don't care, because the file
|
---|
| 908 | // is never copied...
|
---|
| 909 | InsertFilePtr->DestinID = MCF_DestinDirArrayPtr->ID;
|
---|
| 910 | InsertFilePtr->DestinPtr = MCF_DestinDirArrayPtr;
|
---|
| 911 | // We search for the '\' source directory here and use that
|
---|
| 912 | if (!(InsertDirPtr = MINSTALL_SearchRootSourceDirID())) {
|
---|
| 913 | // Really bad case, root directory was not found, so abort
|
---|
| 914 | MINSTALL_TrappedError (MINSTMSG_InstallDLLnotFound); return FALSE;
|
---|
| 915 | }
|
---|
| 916 | InsertFilePtr->SourceID = InsertDirPtr->ID;
|
---|
| 917 | InsertFilePtr->SourcePtr = InsertDirPtr;
|
---|
| 918 | CurFilePtr = InsertFilePtr;
|
---|
| 919 | FCF_FileCount++;
|
---|
| 920 |
|
---|
| 921 | MINSTALL_TrappedWarning (MINSTMSG_InstallDLLunlistedWarning);
|
---|
| 922 | }
|
---|
| 923 | switch (CRC32) {
|
---|
| 924 | case 0x0178000F: // mmsnd.dll (base installation)
|
---|
| 925 | break;
|
---|
| 926 | default:
|
---|
| 927 | CurFilePtr->Flags &= !MINSTFILE_Flags_Included;
|
---|
| 928 | }
|
---|
| 929 | CurFilePtr->Flags |= MINSTFILE_Flags_INSTDLL;
|
---|
| 930 | CurGroupPtr->DLLFilePtr = CurFilePtr;
|
---|
| 931 | }
|
---|
| 932 |
|
---|
| 933 | CRC32 = CRC32_GetFromPSZ(CurGroupPtr->TermDLLFileName);
|
---|
| 934 | switch (CRC32) {
|
---|
| 935 | case 0x426A7266: // iterm.dll
|
---|
| 936 | if (strcmp(CurGroupPtr->TermDLLEntry, "ITermEntry")==0) {
|
---|
| 937 | // Filter out that DLL. It issues WPS-object regeneration of all
|
---|
| 938 | // the stupid players and stuff that we want to get rid off.
|
---|
| 939 | CurGroupPtr->TermDLLFileName[0] = 0;
|
---|
| 940 | }
|
---|
| 941 | // Don't check those DLLs...
|
---|
| 942 | case 0x00000000: // no DLL
|
---|
| 943 | break;
|
---|
| 944 | default:
|
---|
| 945 | if (!(CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))) {
|
---|
| 946 | MSG_SetInsertViaPSZ (2, CurGroupPtr->TermDLLFileName);
|
---|
| 947 | // Check, if that file exists in source directory...
|
---|
| 948 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourceDir, CurGroupPtr->TermDLLFileName))
|
---|
| 949 | return FALSE;
|
---|
| 950 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 951 | MINSTALL_TrappedError (MINSTMSG_InstallDLLnotFound); return FALSE;
|
---|
| 952 | }
|
---|
| 953 | // Compatibility fix - we add the Term-DLL to our file-listing
|
---|
| 954 | // manually if they are not mentioned.
|
---|
| 955 | InsertFilePtr = FCF_FileArrayPtr;
|
---|
| 956 | InsertFilePtr += FCF_FileCount; // Seek over last entry
|
---|
| 957 | strcpy(InsertFilePtr->Name, CurGroupPtr->GeninDLLFileName);
|
---|
| 958 | InsertFilePtr->NameCRC32 = CRC32;
|
---|
| 959 | InsertFilePtr->Flags = 0; // Not included nor selected
|
---|
| 960 | InsertFilePtr->DiskID = 0;
|
---|
| 961 | InsertFilePtr->GroupID = CurGroupPtr->ID;
|
---|
| 962 | InsertFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 963 | // We just use first Destin-Dir - don't care, because the file
|
---|
| 964 | // is never copied...
|
---|
| 965 | InsertFilePtr->DestinID = MCF_DestinDirArrayPtr->ID;
|
---|
| 966 | InsertFilePtr->DestinPtr = MCF_DestinDirArrayPtr;
|
---|
| 967 | // We search for the '\' source directory here and use that
|
---|
| 968 | if (!(InsertDirPtr = MINSTALL_SearchRootSourceDirID())) {
|
---|
| 969 | // Really bad case, root directory was not found, so abort
|
---|
| 970 | MINSTALL_TrappedError (MINSTMSG_InstallDLLnotFound); return FALSE;
|
---|
| 971 | }
|
---|
| 972 | InsertFilePtr->SourceID = InsertDirPtr->ID;
|
---|
| 973 | InsertFilePtr->SourcePtr = InsertDirPtr;
|
---|
| 974 | CurFilePtr = InsertFilePtr;
|
---|
| 975 | FCF_FileCount++;
|
---|
| 976 |
|
---|
| 977 | MINSTALL_TrappedWarning (MINSTMSG_InstallDLLunlistedWarning);
|
---|
| 978 | }
|
---|
| 979 | CurFilePtr->Flags &= !MINSTFILE_Flags_Included;
|
---|
| 980 | CurFilePtr->Flags |= MINSTFILE_Flags_INSTTermDLL;
|
---|
| 981 | CurGroupPtr->TermDLLFilePtr = CurFilePtr;
|
---|
| 982 | }
|
---|
| 983 |
|
---|
| 984 | // INI & Config Control File Processing
|
---|
| 985 | // ======================================
|
---|
| 986 | // If Control Files are specified, we remove "Included", so they wont get
|
---|
| 987 | // copied to the given destination. We tag both types with special
|
---|
| 988 | // flags so that they can get processed separately later.
|
---|
| 989 |
|
---|
| 990 | CRC32 = CRC32_GetFromPSZ(CurGroupPtr->ConfigFileName);
|
---|
| 991 | if (CRC32) {
|
---|
| 992 | if (!(CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))) {
|
---|
| 993 | MSG_SetInsertViaPSZ (2, CurGroupPtr->ConfigFileName);
|
---|
| 994 | // Check, if that file exists in source directory...
|
---|
| 995 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourceDir, CurGroupPtr->ConfigFileName))
|
---|
| 996 | return FALSE;
|
---|
| 997 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 998 | MINSTALL_TrappedError (MINSTMSG_UnlistedScript); return FALSE;
|
---|
| 999 | }
|
---|
| 1000 | // Compatibility fix - we add the Config-File to our file-listing
|
---|
| 1001 | // manually if they are not mentioned.
|
---|
| 1002 | InsertFilePtr = FCF_FileArrayPtr;
|
---|
| 1003 | InsertFilePtr += FCF_FileCount; // Seek over last entry
|
---|
| 1004 | strcpy(InsertFilePtr->Name, CurGroupPtr->ConfigFileName);
|
---|
| 1005 | InsertFilePtr->NameCRC32 = CRC32;
|
---|
| 1006 | InsertFilePtr->Flags = 0; // Not included nor selected
|
---|
| 1007 | InsertFilePtr->DiskID = 0;
|
---|
| 1008 | InsertFilePtr->GroupID = CurGroupPtr->ID;
|
---|
| 1009 | InsertFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 1010 | // We just use first Destin-Dir - don't care, because the file
|
---|
| 1011 | // is never copied...
|
---|
| 1012 | InsertFilePtr->DestinID = MCF_DestinDirArrayPtr->ID;
|
---|
| 1013 | InsertFilePtr->DestinPtr = MCF_DestinDirArrayPtr;
|
---|
| 1014 | // We search for the '\' source directory here and use that
|
---|
| 1015 | if (!(InsertDirPtr = MINSTALL_SearchRootSourceDirID())) {
|
---|
| 1016 | // Really bad case, root directory was not found, so abort
|
---|
| 1017 | MINSTALL_TrappedError (MINSTMSG_UnlistedScript); return FALSE;
|
---|
| 1018 | }
|
---|
| 1019 | InsertFilePtr->SourceID = InsertDirPtr->ID;
|
---|
| 1020 | InsertFilePtr->SourcePtr = InsertDirPtr;
|
---|
| 1021 | CurFilePtr = InsertFilePtr;
|
---|
| 1022 | FCF_FileCount++;
|
---|
| 1023 |
|
---|
| 1024 | MINSTALL_TrappedWarning (MINSTMSG_UnlistedScriptWarning);
|
---|
| 1025 | }
|
---|
| 1026 | CurGroupPtr->ConfigFilePtr = CurFilePtr;
|
---|
| 1027 | CurFilePtr->Flags &= !MINSTFILE_Flags_Included;
|
---|
| 1028 | CurFilePtr->Flags |= MINSTFILE_Flags_CFGCF;
|
---|
| 1029 | /* We set the group of that file to the current group */
|
---|
| 1030 | /* Normally files.scr should contain the correct group already! */
|
---|
| 1031 | CurFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 1032 | }
|
---|
| 1033 |
|
---|
| 1034 | CRC32 = CRC32_GetFromPSZ(CurGroupPtr->INIFileName);
|
---|
| 1035 | if (CRC32) {
|
---|
| 1036 | if (!(CurFilePtr = MINSTALL_SearchFileCRC32(CRC32))) {
|
---|
| 1037 | MSG_SetInsertViaPSZ (2, CurGroupPtr->INIFileName);
|
---|
| 1038 | // Check, if that file exists in source directory...
|
---|
| 1039 | if (!STRING_CombinePSZ ((PCHAR)&TempSourceFile, MINSTMAX_PATHLENGTH, (PCHAR)MINSTALL_SourceDir, CurGroupPtr->INIFileName))
|
---|
| 1040 | return FALSE;
|
---|
| 1041 | if (DosQueryPathInfo (TempSourceFile, FIL_STANDARD, &CurFileInfo, sizeof(CurFileInfo))) {
|
---|
| 1042 | MINSTALL_TrappedError (MINSTMSG_UnlistedScript); return FALSE;
|
---|
| 1043 | }
|
---|
| 1044 | // Compatibility fix - we add the INI-File to our file-listing
|
---|
| 1045 | // manually if they are not mentioned.
|
---|
| 1046 | InsertFilePtr = FCF_FileArrayPtr;
|
---|
| 1047 | InsertFilePtr += FCF_FileCount; // Seek over last entry
|
---|
| 1048 | strcpy(InsertFilePtr->Name, CurGroupPtr->INIFileName);
|
---|
| 1049 | InsertFilePtr->NameCRC32 = CRC32;
|
---|
| 1050 | InsertFilePtr->Flags = 0; // Not included nor selected
|
---|
| 1051 | InsertFilePtr->DiskID = 0;
|
---|
| 1052 | InsertFilePtr->GroupID = CurGroupPtr->ID;
|
---|
| 1053 | InsertFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 1054 | // We just use first Destin-Dir - don't care, because the file
|
---|
| 1055 | // is never copied...
|
---|
| 1056 | InsertFilePtr->DestinID = MCF_DestinDirArrayPtr->ID;
|
---|
| 1057 | InsertFilePtr->DestinPtr = MCF_DestinDirArrayPtr;
|
---|
| 1058 | // We search for the '\' source directory here and use that
|
---|
| 1059 | if (!(InsertDirPtr = MINSTALL_SearchRootSourceDirID())) {
|
---|
| 1060 | // Really bad case, root directory was not found, so abort
|
---|
| 1061 | MINSTALL_TrappedError (MINSTMSG_UnlistedScript); return FALSE;
|
---|
| 1062 | }
|
---|
| 1063 | InsertFilePtr->SourceID = InsertDirPtr->ID;
|
---|
| 1064 | InsertFilePtr->SourcePtr = InsertDirPtr;
|
---|
| 1065 | CurFilePtr = InsertFilePtr;
|
---|
| 1066 | FCF_FileCount++;
|
---|
| 1067 |
|
---|
| 1068 | MINSTALL_TrappedWarning (MINSTMSG_UnlistedScriptWarning);
|
---|
| 1069 | }
|
---|
| 1070 | CurGroupPtr->INIFilePtr = CurFilePtr;
|
---|
| 1071 | CurFilePtr->Flags &= !MINSTFILE_Flags_Included;
|
---|
| 1072 | CurFilePtr->Flags |= MINSTFILE_Flags_INICF;
|
---|
| 1073 | /* We set the group of that file to the current group */
|
---|
| 1074 | /* Normally files.scr should contain the correct group already! */
|
---|
| 1075 | CurFilePtr->GroupPtr = CurGroupPtr;
|
---|
| 1076 | }
|
---|
| 1077 |
|
---|
| 1078 | // Include all groups...
|
---|
| 1079 | CurGroupPtr->Flags |= MINSTGRP_Flags_Included;
|
---|
| 1080 | CurGroupPtr++; CurNo++;
|
---|
| 1081 | }
|
---|
| 1082 |
|
---|
| 1083 | /* Obsolete code 13.6.2004 */
|
---|
| 1084 | /* if ((!FCF_CARDINFOFilePtr) && (MINSTALL_GeninUsed)) { */
|
---|
| 1085 | /* MINSTALL_TrappedError (MINSTMSG_CARDINFOrequiredForGENIN); */
|
---|
| 1086 | /* return FALSE; // if DLL not found, but GENIN used... */
|
---|
| 1087 | /* } */
|
---|
| 1088 |
|
---|
| 1089 | return TRUE;
|
---|
| 1090 | }
|
---|
| 1091 |
|
---|
| 1092 | BOOL MINSTALL_GeneratePublicGroup (void) {
|
---|
| 1093 | PMINSTPUBGROUP CurPublicGroup = 0;
|
---|
| 1094 | PMINSTGRP CurGroupPtr = MCF_GroupArrayPtr;
|
---|
| 1095 | ULONG CurGroupNo = 0;
|
---|
| 1096 | ULONG CurPromptNo = 0;
|
---|
| 1097 | ULONG RequiredSpace = 0;
|
---|
| 1098 |
|
---|
| 1099 | MINSTALL_PublicGroupCount = 0;
|
---|
| 1100 |
|
---|
| 1101 | // Count all groups that are listed in Public-Groups
|
---|
| 1102 | while (CurGroupNo<MCF_GroupCount) {
|
---|
| 1103 | if (!(CurGroupPtr->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
| 1104 | MINSTALL_PublicGroupCount++;
|
---|
| 1105 | }
|
---|
| 1106 | CurGroupNo++; CurGroupPtr++;
|
---|
| 1107 | }
|
---|
| 1108 |
|
---|
| 1109 | if (MINSTALL_PublicGroupCount) {
|
---|
| 1110 | RequiredSpace = MINSTALL_PublicGroupCount*sizeof(MINSTPUBGROUP);
|
---|
| 1111 | CurPublicGroup = malloc(RequiredSpace);
|
---|
| 1112 | if (!CurPublicGroup) {
|
---|
| 1113 | MINSTALL_TrappedError (MINSTMSG_OutOfMemory); return FALSE; }
|
---|
| 1114 |
|
---|
| 1115 | MINSTALL_PublicGroupArrayPtr = CurPublicGroup;
|
---|
| 1116 | memset (CurPublicGroup, 0, RequiredSpace);
|
---|
| 1117 |
|
---|
| 1118 | // Take data into Public-Group...
|
---|
| 1119 | CurGroupNo = 0; CurGroupPtr = MCF_GroupArrayPtr;
|
---|
| 1120 | while (CurGroupNo<MCF_GroupCount) {
|
---|
| 1121 | if (!(CurGroupPtr->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
| 1122 | CurPublicGroup->ID = CurGroupPtr->ID;
|
---|
| 1123 | if (CurGroupPtr->Flags & MINSTGRP_Flags_Selected)
|
---|
| 1124 | CurPublicGroup->Selected = TRUE;
|
---|
| 1125 | if (CurGroupPtr->Flags & MINSTGRP_Flags_SelectionForced)
|
---|
| 1126 | CurPublicGroup->SelectionForced = TRUE;
|
---|
| 1127 | strcpy (CurPublicGroup->Name, CurGroupPtr->Name);
|
---|
| 1128 | strcpy (CurPublicGroup->Version, CurGroupPtr->Version);
|
---|
| 1129 | strcpy (CurPublicGroup->VersionInstalled, CurGroupPtr->VersionInstalled);
|
---|
| 1130 | CurPublicGroup->SpaceNeeded = CurGroupPtr->SpaceNeeded;
|
---|
| 1131 | if (CurGroupPtr->GeninPtr) {
|
---|
| 1132 | CurPublicGroup->MaxCardCount = CurGroupPtr->GeninPtr->MaxCardCount;
|
---|
| 1133 | CurPublicGroup->PromptsCount = CurGroupPtr->GeninPtr->PromptsCount;
|
---|
| 1134 | for (CurPromptNo=0; CurPromptNo<MINSTMAX_GENINPROMPTS; CurPromptNo++) {
|
---|
| 1135 | CurPublicGroup->PromptTitlePtr[CurPromptNo] = CurGroupPtr->GeninPtr->PromptTitlePtr[CurPromptNo];
|
---|
| 1136 | CurPublicGroup->PromptChoiceCount[CurPromptNo] = CurGroupPtr->GeninPtr->PromptChoiceCount[CurPromptNo];
|
---|
| 1137 | CurPublicGroup->PromptChoiceDefault[CurPromptNo] = CurGroupPtr->GeninPtr->PromptChoiceDefault[CurPromptNo];
|
---|
| 1138 | CurPublicGroup->PromptChoiceStrings[CurPromptNo] = CurGroupPtr->GeninPtr->PromptChoiceStrings[CurPromptNo];
|
---|
| 1139 | }
|
---|
| 1140 | }
|
---|
| 1141 | CurPublicGroup++;
|
---|
| 1142 | }
|
---|
| 1143 | CurGroupNo++; CurGroupPtr++;
|
---|
| 1144 | }
|
---|
| 1145 | MINSTALL_Done |= MINSTDONE_PUBLICGROUP;
|
---|
| 1146 | }
|
---|
| 1147 | return TRUE;
|
---|
| 1148 | }
|
---|
| 1149 |
|
---|
| 1150 | // Simply cycles through all selected groups and saves version information into
|
---|
| 1151 | // COMPLIST.INI file. Returning a BOOL is done to remain in overall design,
|
---|
| 1152 | // also if this function is later extended, one may abort installation this
|
---|
| 1153 | // way.
|
---|
| 1154 | BOOL MINSTALL_SaveInstalledVersions (void) {
|
---|
| 1155 | PMINSTGRP CurGroupPtr = MCF_GroupArrayPtr;
|
---|
| 1156 | ULONG CurGroupNo = 0;
|
---|
| 1157 |
|
---|
| 1158 | while (CurGroupNo<MCF_GroupCount) {
|
---|
| 1159 | if (CurGroupPtr->Flags & MINSTGRP_Flags_Selected) {
|
---|
| 1160 | MINSTALL_SetInstalledVersion(CurGroupPtr->Name, CurGroupPtr->Version);
|
---|
| 1161 | }
|
---|
| 1162 | CurGroupNo++; CurGroupPtr++;
|
---|
| 1163 | }
|
---|
| 1164 | return TRUE;
|
---|
| 1165 | }
|
---|
| 1166 |
|
---|
| 1167 | VOID MINSTALL_CleanUpMasterControl (void) {
|
---|
| 1168 | // Just release all memory-blocks...
|
---|
| 1169 | free (MCF_GroupArrayPtr); MCF_GroupCount = 0;
|
---|
| 1170 | free (MCF_SourceDirArrayPtr); MCF_SourceDirCount = 0;
|
---|
| 1171 | free (MCF_DestinDirArrayPtr); MCF_DestinDirCount = 0;
|
---|
| 1172 |
|
---|
| 1173 | // Remove this action from cleanup...
|
---|
| 1174 | MINSTALL_Done &= !MINSTDONE_LOADMASTERCTRLSCR;
|
---|
| 1175 | }
|
---|
| 1176 |
|
---|
| 1177 | VOID MINSTALL_CleanUpFileControl (VOID) {
|
---|
| 1178 | // Just release all memory-blocks...
|
---|
| 1179 | free (FCF_FileArrayPtr); FCF_FileCount = 0;
|
---|
| 1180 |
|
---|
| 1181 | // Remove this action from cleanup...
|
---|
| 1182 | MINSTALL_Done &= !MINSTDONE_LOADFILECTRLSCR;
|
---|
| 1183 | }
|
---|
| 1184 |
|
---|
| 1185 | VOID MINSTALL_CleanUpPublicGroup (void) {
|
---|
| 1186 | free (MINSTALL_PublicGroupArrayPtr); MINSTALL_PublicGroupArrayPtr = 0;
|
---|
| 1187 |
|
---|
| 1188 | // Remove this action from cleanup...
|
---|
| 1189 | MINSTALL_Done &= !MINSTDONE_PUBLICGROUP;
|
---|
| 1190 | }
|
---|