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 <cid.h>
|
---|
31 | #include <crcs.h>
|
---|
32 | #include <dll.h>
|
---|
33 | #include <file.h>
|
---|
34 | #include <globstr.h>
|
---|
35 | #include <msg.h>
|
---|
36 | #include <mmi_public.h>
|
---|
37 | #include <mmi_types.h>
|
---|
38 | #include <mmi_main.h>
|
---|
39 | #include <mmi_helper.h>
|
---|
40 | #include <mmi_basescr.h>
|
---|
41 | #include <mmi_ctrlscr.h>
|
---|
42 | #include <mmi_ctrlprc.h>
|
---|
43 | #include <mmi_cardinfo.h>
|
---|
44 | #include <mmi_install.h>
|
---|
45 | #include <mmi_msg.h>
|
---|
46 |
|
---|
47 | #include <mmi_inistuff.h>
|
---|
48 | #include <mmi_imports.h>
|
---|
49 | #include <mmi_customdll.h>
|
---|
50 |
|
---|
51 | FILECONTROL CONTROLSCR;
|
---|
52 | FILECONTROL FILELISTSCR;
|
---|
53 | FILECONTROL CHANGESCR;
|
---|
54 |
|
---|
55 | HAB MINSTALL_PMHandle = NULLHANDLE;
|
---|
56 | HMQ MINSTALL_MSGQHandle = NULLHANDLE;
|
---|
57 | HMTX MINSTALL_MutexSemamorph = NULLHANDLE;
|
---|
58 | CHAR MINSTALL_MMBase[MINSTMAX_PATHLENGTH];
|
---|
59 | CHAR MINSTALL_BootDrive[3];
|
---|
60 | CHAR MINSTALL_BootLetter[2];
|
---|
61 | CHAR MINSTALL_MMBaseDrive[3];
|
---|
62 | CHAR MINSTALL_MMBaseLetter[2];
|
---|
63 | // Path means pathname, Dir means Directory (directory includes ending '\'
|
---|
64 | CHAR MINSTALL_SourcePath[MINSTMAX_PATHLENGTH];
|
---|
65 | CHAR MINSTALL_SourceDir[MINSTMAX_PATHLENGTH];
|
---|
66 | CHAR MINSTALL_InstallPath[MINSTMAX_PATHLENGTH];
|
---|
67 | CHAR MINSTALL_InstallDir[MINSTMAX_PATHLENGTH];
|
---|
68 | CHAR MINSTALL_DLLDir[MINSTMAX_PATHLENGTH];
|
---|
69 | CHAR MINSTALL_CompListINI[MINSTMAX_PATHLENGTH];
|
---|
70 |
|
---|
71 | CHAR MINSTLOG_FileName[MINSTMAX_PATHLENGTH];
|
---|
72 | FILE *MINSTLOG_FileHandle = 0;
|
---|
73 |
|
---|
74 | CHAR MINSTALL_TempMacroSpace[MINSTMAX_PATHLENGTH];
|
---|
75 |
|
---|
76 | ULONG MINSTALL_PublicGroupCount = 0;
|
---|
77 | PMINSTPUBGROUP MINSTALL_PublicGroupArrayPtr = 0;
|
---|
78 |
|
---|
79 | // Contains all processed things
|
---|
80 | ULONG MINSTALL_Done = 0;
|
---|
81 | ULONG MINSTALL_ErrorMsgID = 0;
|
---|
82 | CHAR MINSTALL_ErrorMsg[1024];
|
---|
83 | CHAR MINSTALL_CIDDescription[1024];
|
---|
84 |
|
---|
85 | // Master-Control-File Variables...
|
---|
86 | USHORT MCF_GroupCount = 0; // Total count in MCF_GroupArray
|
---|
87 | PMINSTGRP MCF_GroupArrayPtr = 0;
|
---|
88 | USHORT MCF_SourceDirCount = 0; // ... in MCF_SourceDirArray
|
---|
89 | PMINSTDIR MCF_SourceDirArrayPtr = 0;
|
---|
90 | USHORT MCF_DestinDirCount = 0; // ... in MCF_DestinDirArray
|
---|
91 | PMINSTDIR MCF_DestinDirArrayPtr = 0;
|
---|
92 | USHORT FCF_FileCount = 0; // ... in FCF_FileArray
|
---|
93 | PMINSTFILE FCF_FileArrayPtr = 0;
|
---|
94 | CHAR MCF_PackageName[MINSTMAX_STRLENGTH];
|
---|
95 | ULONG MCF_CodePage = 0;
|
---|
96 | ULONG MCF_MUnitCount = 0;
|
---|
97 | CHAR MCF_Medianame[MINSTMAX_STRLENGTH];
|
---|
98 |
|
---|
99 | BOOL MINSTALL_GeninUsed = FALSE;
|
---|
100 | BOOL MINSTALL_IsBaseInstallation = FALSE;
|
---|
101 | // This is set till first MINSTALL_Init() was completed.
|
---|
102 | BOOL MINSTALL_IsFirstInit = TRUE;
|
---|
103 | BOOL MINSTALL_SystemShouldReboot = FALSE;
|
---|
104 |
|
---|
105 | /* HMODULE FCF_CARDINFOHandle = 0; */
|
---|
106 | /* PMINSTFILE FCF_CARDINFOFilePtr = 0; */
|
---|
107 | HMODULE FCF_LastCARDINFOHandle = NULLHANDLE;
|
---|
108 |
|
---|
109 | // Custom-API related public variables...
|
---|
110 | HEV CustomAPI_InitEventHandle = 0;
|
---|
111 | TID CustomAPI_ThreadID = 0;
|
---|
112 | BOOL CustomAPI_ThreadCreated = FALSE;
|
---|
113 | HAB CustomAPI_PMHandle = 0;
|
---|
114 | HMQ CustomAPI_MSGQHandle = 0;
|
---|
115 | HWND CustomAPI_WindowHandle = 0;
|
---|
116 | ULONG CustomAPI_ConfigSysLine = 0;
|
---|
117 |
|
---|
118 | // Custom-DLL related public variables...
|
---|
119 | PVOID CustomDLL_EntryPoint = 0;
|
---|
120 | PSZ CustomDLL_EntryParms = NULL;
|
---|
121 | PSZ CustomDLL_CustomData = NULL;
|
---|
122 |
|
---|
123 | // INI-Control-File
|
---|
124 | PMINSTINI_DEFENTRY ICF_CheckFuncList = NULL;
|
---|
125 | PMINSTINI_DEFENTRY ICF_CheckParmList = NULL;
|
---|
126 | PMINSTINI_DEFENTRY ICF_CurFuncEntry = NULL;
|
---|
127 | PMINSTINI_DEFENTRY ICF_CurParmEntry = NULL;
|
---|
128 | ULONG ICF_FilledParms = 0;
|
---|
129 |
|
---|
130 |
|
---|
131 | // ****************************************************************************
|
---|
132 |
|
---|
133 | BOOL EXPENTRY MINSTALL_Init (ULONG BootDrive, HAB PMHandle, HMQ MSGQHandle, PSZ MMBase, PSZ LogFileName) {
|
---|
134 | PCHAR CurPos;
|
---|
135 | CHAR DelayedDir[MINSTMAX_PATHLENGTH];
|
---|
136 | APIRET rc;
|
---|
137 | HMODULE GeninDLLHandle = 0;
|
---|
138 |
|
---|
139 | // Remember PM and MSGQ-Handles...
|
---|
140 | MINSTALL_PMHandle = PMHandle;
|
---|
141 | MINSTALL_MSGQHandle = MSGQHandle;
|
---|
142 |
|
---|
143 | // Reset some strings...
|
---|
144 | MINSTALL_MMBase[0] = 0;
|
---|
145 | MINSTALL_MMBaseDrive[0] = 0;
|
---|
146 | MINSTALL_MMBaseLetter[0] = 0;
|
---|
147 | MINSTALL_InstallPath[0] = 0;
|
---|
148 | MINSTALL_InstallDir[0] = 0;
|
---|
149 | MINSTALL_DLLDir[0] = 0;
|
---|
150 | MINSTALL_CompListINI[0] = 0;
|
---|
151 | MINSTLOG_FileName[0] = 0;
|
---|
152 | MINSTALL_Done = 0;
|
---|
153 |
|
---|
154 | if (!MSG_Init ("minstall.msg"))
|
---|
155 | return FALSE;
|
---|
156 |
|
---|
157 | if (!MMBase[0]) {
|
---|
158 | // MMBase not set, so check environment
|
---|
159 | if (DosScanEnv("MMBASE", &MMBase)) {
|
---|
160 | MINSTALL_TrappedError (MINSTMSG_MMBaseNotFound); return FALSE; }
|
---|
161 | }
|
---|
162 | // Copy MMBase over to MINSTALL-variable...
|
---|
163 | if (!STRING_CombinePSZ ((PCHAR)&MINSTALL_MMBase, MINSTMAX_PATHLENGTH, MMBase, ""))
|
---|
164 | return FALSE;
|
---|
165 |
|
---|
166 | CurPos = MINSTALL_MMBase;
|
---|
167 | // Look till ';' or EOS...
|
---|
168 | while ((*CurPos!=0) & (*CurPos!=0x3B))
|
---|
169 | CurPos++;
|
---|
170 | if (*CurPos==0x3B)
|
---|
171 | *CurPos = 0; // Set Terminator, if ';' found
|
---|
172 |
|
---|
173 | MINSTALL_MMBaseDrive[0] = MINSTALL_MMBase[0];
|
---|
174 | MINSTALL_MMBaseDrive[1] = MINSTALL_MMBase[1];
|
---|
175 | MINSTALL_MMBaseDrive[2] = 0;
|
---|
176 | MINSTALL_MMBaseLetter[0] = MINSTALL_MMBaseDrive[0];
|
---|
177 | MINSTALL_MMBaseLetter[1] = 0;
|
---|
178 |
|
---|
179 | // Build Install/DLL-Path for MINSTALL...
|
---|
180 | if (!STRING_CombinePSZ (MINSTALL_InstallPath, MINSTMAX_PATHLENGTH, MINSTALL_MMBase, "\\INSTALL"))
|
---|
181 | return FALSE;
|
---|
182 | if (!STRING_CombinePSZ (MINSTALL_InstallDir, MINSTMAX_PATHLENGTH, MINSTALL_InstallPath, "\\"))
|
---|
183 | return FALSE;
|
---|
184 | if (!STRING_CombinePSZ (MINSTALL_DLLDir, MINSTMAX_PATHLENGTH, MINSTALL_MMBase, "\\DLL\\"))
|
---|
185 | return FALSE;
|
---|
186 | if (!STRING_CombinePSZ (MINSTALL_CompListINI, MINSTMAX_PATHLENGTH, MINSTALL_InstallDir, "COMPLIST.INI"))
|
---|
187 | return FALSE;
|
---|
188 |
|
---|
189 | if ((BootDrive==0) || (BootDrive>26)) {
|
---|
190 | if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &BootDrive, sizeof(BootDrive)) || (BootDrive<3))
|
---|
191 | return FALSE; // We only accept C: -> Z:
|
---|
192 | }
|
---|
193 | MINSTALL_BootDrive[0] = BootDrive+0x40; // 3 -> C
|
---|
194 | MINSTALL_BootDrive[1] = 0x3A; // ':'
|
---|
195 | MINSTALL_BootDrive[2] = 0; // NUL
|
---|
196 | MINSTALL_BootLetter[0] = BootDrive+0x40; // 3 -> C
|
---|
197 | MINSTALL_BootLetter[1] = 0; // NUL
|
---|
198 |
|
---|
199 | // Find out Log-filename...
|
---|
200 | if (LogFileName) {
|
---|
201 | // We are supposed to use a logfilename
|
---|
202 | if (LogFileName[0]) {
|
---|
203 | if (!STRING_CopyPSZ (MINSTLOG_FileName, MINSTMAX_PATHLENGTH, LogFileName))
|
---|
204 | return FALSE;
|
---|
205 | } else {
|
---|
206 | if (!STRING_CombinePSZ (MINSTLOG_FileName, MINSTMAX_PATHLENGTH, MINSTALL_InstallDir, "MINSTALL.LOG"))
|
---|
207 | return FALSE;
|
---|
208 | }
|
---|
209 | if (MINSTALL_IsFirstInit) { // Only on 1st MINSTALL_Init()
|
---|
210 | // Now try to delete the logfile. If this works, we use it. Otherwise
|
---|
211 | // we try to set logfile to x:\OS2\INSTALL where x: is the bootdrive
|
---|
212 | // if this also fails, we will set logfile to NULL
|
---|
213 | rc = DosDelete(MINSTLOG_FileName);
|
---|
214 | if ((rc!=NO_ERROR) && (rc!=ERROR_FILE_NOT_FOUND)) {
|
---|
215 | // Now try to put logfile into x:\OS2\INSTALL...
|
---|
216 | if (!STRING_CombinePSZ (MINSTLOG_FileName, MINSTMAX_PATHLENGTH, MINSTALL_BootDrive, "\\OS2\\INSTALL\\MINSTALL.LOG"))
|
---|
217 | return FALSE;
|
---|
218 | rc = DosDelete(MINSTLOG_FileName);
|
---|
219 | if ((rc!=NO_ERROR) && (rc!=ERROR_FILE_NOT_FOUND)) {
|
---|
220 | MINSTLOG_FileName[0] = 0; // Set LogFile to NULL
|
---|
221 | }
|
---|
222 | }
|
---|
223 | }
|
---|
224 | }
|
---|
225 |
|
---|
226 | // Detect replacement GENIN.DLL - if it's not found, bomb out...
|
---|
227 | // DEBUGDEBUGDEBUG
|
---|
228 | // if (GeninDLLHandle = DLL_Load("GENIN.DLL")) {
|
---|
229 | // if (!DLL_GetEntryPoint(GeninDLLHandle, "GeninReplacementIdentifier")) {
|
---|
230 | // MINSTALL_TrappedError (MINSTMSG_GeninReplacementRequired); return FALSE; }
|
---|
231 | // DLL_UnLoad (GeninDLLHandle);
|
---|
232 | // }
|
---|
233 |
|
---|
234 | // Init file-delaying API (even if it's not actually used)
|
---|
235 | if (!STRING_CombinePSZ (DelayedDir, MINSTMAX_PATHLENGTH, MINSTALL_InstallDir, "DELAYED"))
|
---|
236 | return FALSE;
|
---|
237 | if (CONFIGSYS_DelayInit (BootDrive, "MMLOCKED.LST", DelayedDir)!=CONFIGSYS_DONE)
|
---|
238 | return FALSE;
|
---|
239 |
|
---|
240 | // Finally generate a Mutex-Semamorph, so that we can be sure that we are
|
---|
241 | // the only instance of MINSTALL active on the system.
|
---|
242 | if (MINSTALL_MutexSemamorph==NULLHANDLE) {
|
---|
243 | if (DosCreateMutexSem("\\SEM32\\MKMULTIMEDIAINSTALLER", &MINSTALL_MutexSemamorph, 0, FALSE)) {
|
---|
244 | MINSTALL_TrappedError (MINSTMSG_AlreadyRunning); return FALSE; }
|
---|
245 | }
|
---|
246 |
|
---|
247 | MINSTALL_IsFirstInit = FALSE;
|
---|
248 | return TRUE;
|
---|
249 | }
|
---|
250 |
|
---|
251 | // This will load in the full installation of an MMOS/2 feature
|
---|
252 | // It will also parse variables and check for their validity. If it returns
|
---|
253 | // FALSE, this means that something went wrong and the installation can not
|
---|
254 | // be done. The caller is supposed to call MINSTALL_CleanUp() afterwards to
|
---|
255 | // deallocate any buffers. This has to be done manually.
|
---|
256 | BOOL EXPENTRY MINSTALL_InitPackage (PSZ SourcePath) {
|
---|
257 | ULONG Temp;
|
---|
258 |
|
---|
259 | if (MINSTALL_IsFirstInit) {
|
---|
260 | MINSTALL_TrappedError (MINSTMSG_NeedingInit); return FALSE; }
|
---|
261 | if (MINSTALL_Done & MINSTDONE_BEGANPACKAGEINIT) {
|
---|
262 | MINSTALL_TrappedError (MINSTMSG_NeedingCleanUp); return FALSE; }
|
---|
263 |
|
---|
264 | // We havent done anything yet...
|
---|
265 | MINSTALL_Done = MINSTDONE_BEGANPACKAGEINIT;
|
---|
266 |
|
---|
267 | MINSTLOG_OpenFile();
|
---|
268 | MINSTLOG_ToFile ("================================================================ MINSTALL v1.03\n");
|
---|
269 | MINSTLOG_ToFile ("MINSTALL_InitPackage()...\n");
|
---|
270 |
|
---|
271 | if (SourcePath[0]!=0) {
|
---|
272 | if (!STRING_CombinePSZ((PCHAR)MINSTALL_SourcePath, MINSTMAX_PATHLENGTH, SourcePath, ""))
|
---|
273 | return FALSE;
|
---|
274 | } else {
|
---|
275 | // Get current Path and set it as SourcePath
|
---|
276 | if (!FILE_GetCurrentPath(MINSTALL_SourcePath, MINSTMAX_PATHLENGTH))
|
---|
277 | return FALSE;
|
---|
278 | }
|
---|
279 |
|
---|
280 | if (!STRING_CombinePSZ(MINSTALL_SourceDir, MINSTMAX_PATHLENGTH, SourcePath, "\\"))
|
---|
281 | return FALSE;
|
---|
282 |
|
---|
283 | MINSTLOG_ToFile (" SourcePath = %s, TargetPath = %s\n", MINSTALL_SourcePath, MINSTALL_MMBase);
|
---|
284 |
|
---|
285 | // Load CONTROL.scr file from SourcePath...
|
---|
286 | if (!STRING_CombinePSZ((PCHAR)&CONTROLSCR.Name, MINSTMAX_PATHLENGTH, MINSTALL_SourceDir, "control.scr"))
|
---|
287 | return FALSE;
|
---|
288 | MINSTLOG_ToFile ("LoadMasterControl()...\n");
|
---|
289 | if (!MINSTALL_LoadMasterControl()) return FALSE;
|
---|
290 | MINSTLOG_ToFile ("LoadMasterControl DONE\n");
|
---|
291 |
|
---|
292 | if (MCF_MUnitCount!=1) {
|
---|
293 | MINSTALL_TrappedError (MINSTMSG_MultiDisksUnsupported); return FALSE;
|
---|
294 | }
|
---|
295 | if (FILELISTSCR.Name[0]==0) {
|
---|
296 | MINSTALL_TrappedError (MINSTMSG_NoFileControlSpecified);return FALSE;
|
---|
297 | }
|
---|
298 |
|
---|
299 | // Load in File-Control-Script...
|
---|
300 | MINSTLOG_ToFile ("LoadFileControl()...\n");
|
---|
301 | if (!MINSTALL_LoadFileControl()) return FALSE;
|
---|
302 | MINSTLOG_ToFile ("LoadFileControl DONE\n");
|
---|
303 | if (!MINSTALL_FilterControlFileData()) return FALSE;
|
---|
304 | if (!MINSTALL_LoadCARDINFO()) return FALSE;
|
---|
305 | if (!MINSTALL_LoadCustomControl()) return FALSE;
|
---|
306 | // Finally create Public Group for caller
|
---|
307 | if (!MINSTALL_GeneratePublicGroup()) return FALSE;
|
---|
308 | MINSTALL_ErrorMsgID = 0;
|
---|
309 | MINSTALL_Done |= MINSTDONE_COMPLETEDPACKAGEINIT;
|
---|
310 | MINSTLOG_ToAll (" ...Package successfully initialized!\n");
|
---|
311 | return TRUE;
|
---|
312 | }
|
---|
313 |
|
---|
314 | BOOL EXPENTRY MINSTALL_InstallPackage (VOID) {
|
---|
315 | if (MINSTALL_IsFirstInit) {
|
---|
316 | MINSTALL_TrappedError (MINSTMSG_NeedingInit); return FALSE; }
|
---|
317 | MINSTLOG_ToFile ("MINSTALL_InstallPackage()...\n");
|
---|
318 | if (!(MINSTALL_Done & MINSTDONE_COMPLETEDPACKAGEINIT)) {
|
---|
319 | MINSTALL_TrappedError (MINSTMSG_PackageNotInitialized); return FALSE; }
|
---|
320 |
|
---|
321 | // Select files&directories depending on group selection done by caller
|
---|
322 | MINSTALL_SelectFiles();
|
---|
323 |
|
---|
324 | // Generate Destination Directories, copy files and process scripts...
|
---|
325 | if (!MINSTALL_CreateDestinDirectories()) return FALSE;
|
---|
326 | MINSTLOG_ToFile ("MINSTALL_CopyFiles()...\n");
|
---|
327 | if (!MINSTALL_CopyFiles()) return FALSE;
|
---|
328 | MINSTLOG_ToFile ("MINSTALL_CopyFiles DONE\n");
|
---|
329 | MINSTLOG_ToFile ("MINSTALL_LinkInImports()...\n");
|
---|
330 | if (!MINSTALL_LinkInImports()) return FALSE;
|
---|
331 | MINSTLOG_ToFile ("MINSTALL_LinkInImports DONE\n");
|
---|
332 | // Hardcoded in MMI_IMPORTS.C
|
---|
333 | MINSTALL_MigrateMMPMMMIOFile();
|
---|
334 | MINSTLOG_ToFile ("MINSTALL_ExecuteCustomDLLs()...\n");
|
---|
335 | if (!MINSTALL_ExecuteCustomDLLs()) return FALSE;
|
---|
336 | MINSTLOG_ToFile ("MINSTALL_ExecuteCustomDLLs DONE\n");
|
---|
337 | MINSTLOG_ToFile ("MINSTALL_ProcessScripts()...\n");
|
---|
338 | if (!MINSTALL_ProcessCARDINFO()) return FALSE;
|
---|
339 | if (!MINSTALL_ProcessScripts()) return FALSE;
|
---|
340 | MINSTLOG_ToFile ("MINSTALL_ExecuteCustomTermDLLs()...\n");
|
---|
341 | if (!MINSTALL_ExecuteCustomTermDLLs()) return FALSE;
|
---|
342 | // Do special things on base installations...
|
---|
343 | if (MINSTALL_IsBaseInstallation) {
|
---|
344 | MINSTALL_LowerMasterVolume();
|
---|
345 | }
|
---|
346 | MINSTLOG_ToFile ("MINSTALL_ExecuteCustomTermDLLs DONE\n");
|
---|
347 | if (!MINSTALL_SaveInstalledVersions()) return FALSE;
|
---|
348 | MINSTALL_ErrorMsgID = 0;
|
---|
349 | MINSTALL_SystemShouldReboot = TRUE;
|
---|
350 | MINSTLOG_ToFile ("MINSTALL_InstallPackage DONE\n");
|
---|
351 | return TRUE;
|
---|
352 | }
|
---|
353 |
|
---|
354 | // Does all sorts of cleanup. May not fail in any way.
|
---|
355 | VOID EXPENTRY MINSTALL_CleanUp (VOID) {
|
---|
356 | MINSTLOG_ToFile ("MINSTALL_CleanUp()...\n");
|
---|
357 | if (MINSTALL_Done & MINSTDONE_LINKINIMPORTS)
|
---|
358 | MINSTALL_CleanUpImports();
|
---|
359 | if (MINSTALL_Done & MINSTDONE_PUBLICGROUP)
|
---|
360 | MINSTALL_CleanUpPublicGroup();
|
---|
361 | if (MINSTALL_Done & MINSTDONE_LOADCUSTOMCTRLSCR)
|
---|
362 | MINSTALL_CleanUpCustomControl();
|
---|
363 | if (MINSTALL_Done & MINSTDONE_LOADCARDINFO)
|
---|
364 | MINSTALL_CleanUpCARDINFO();
|
---|
365 | if (MINSTALL_Done & MINSTDONE_LOADFILECTRLSCR)
|
---|
366 | MINSTALL_CleanUpFileControl();
|
---|
367 | if (MINSTALL_Done & MINSTDONE_LOADMASTERCTRLSCR)
|
---|
368 | MINSTALL_CleanUpMasterControl();
|
---|
369 | MINSTLOG_ToFile ("MINSTALL_CleanUp DONE\n");
|
---|
370 |
|
---|
371 | MINSTALL_Done = 0;
|
---|
372 | MINSTALL_ErrorMsgID = 0;
|
---|
373 | MINSTLOG_CloseFile();
|
---|
374 | }
|
---|
375 |
|
---|
376 | PSZ EXPENTRY MINSTALL_GetErrorMsgPtr (void) {
|
---|
377 | if (MINSTALL_ErrorMsgID) {
|
---|
378 | return MINSTALL_ErrorMsg;
|
---|
379 | }
|
---|
380 | return NULL;
|
---|
381 | }
|
---|
382 |
|
---|
383 | USHORT EXPENTRY MINSTALL_GetErrorMsgCIDCode (void) {
|
---|
384 | switch (MINSTALL_ErrorMsgID) {
|
---|
385 | case 0:
|
---|
386 | if (MINSTALL_SystemShouldReboot) {
|
---|
387 | return CIDRET_SuccessReboot;
|
---|
388 | } else {
|
---|
389 | return CIDRET_Success;
|
---|
390 | }
|
---|
391 | case MINSTMSG_CouldNotFindSourceFile:
|
---|
392 | case MINSTMSG_CICouldNotLoadCustomDLL:
|
---|
393 | case MINSTMSG_CouldNotAccessFile:
|
---|
394 | return CIDRET_DataResourceNotFound;
|
---|
395 | case MINSTMSG_GenericError:
|
---|
396 | return CIDRET_UnexpectedCondition;
|
---|
397 | case MINSTMSG_DiskFull:
|
---|
398 | return CIDRET_NotEnoughDiskSpace;
|
---|
399 | default:
|
---|
400 | return CIDRET_SuccessErrorLogged;
|
---|
401 | }
|
---|
402 | }
|
---|
403 |
|
---|
404 | PSZ EXPENTRY MINSTALL_GetErrorMsgCIDCodeDescription (void) {
|
---|
405 | MINSTALL_CIDDescription[0] = 0;
|
---|
406 | switch (MINSTALL_ErrorMsgID) {
|
---|
407 | case 0:
|
---|
408 | if (MINSTALL_SystemShouldReboot) {
|
---|
409 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDSuccessReboot); break;
|
---|
410 | } else {
|
---|
411 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDSuccess); break;
|
---|
412 | }
|
---|
413 | case MINSTMSG_CouldNotFindSourceFile:
|
---|
414 | case MINSTMSG_CICouldNotLoadCustomDLL:
|
---|
415 | case MINSTMSG_CouldNotAccessFile:
|
---|
416 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDDataResourceNotFound); break;
|
---|
417 | case MINSTMSG_GenericError:
|
---|
418 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDUnexpectedCondition); break;
|
---|
419 | case MINSTMSG_DiskFull:
|
---|
420 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDNotEnoughDiskSpace); break;
|
---|
421 | default:
|
---|
422 | MSG_Get((PVOID)&MINSTALL_CIDDescription, 1024, MINSTMSG_CIDSuccessErrorsLogged); break;
|
---|
423 | }
|
---|
424 | return (PSZ)&MINSTALL_CIDDescription;
|
---|
425 | }
|
---|
426 |
|
---|
427 | PSZ EXPENTRY MINSTALL_GetSourcePathPtr (void) {
|
---|
428 | return MINSTALL_SourcePath;
|
---|
429 | }
|
---|
430 |
|
---|
431 | PSZ EXPENTRY MINSTALL_GetTargetPathPtr (void) {
|
---|
432 | return MINSTALL_MMBase;
|
---|
433 | }
|
---|
434 |
|
---|
435 | ULONG EXPENTRY MINSTALL_GetPublicGroupArrayPtr (PMINSTPUBGROUP *PubGroupArrayPtr) {
|
---|
436 | if (MINSTALL_Done & MINSTDONE_COMPLETEDPACKAGEINIT) {
|
---|
437 | *PubGroupArrayPtr = MINSTALL_PublicGroupArrayPtr;
|
---|
438 | return MINSTALL_PublicGroupCount;
|
---|
439 | }
|
---|
440 | return 0;
|
---|
441 | }
|
---|
442 |
|
---|
443 | PSZ EXPENTRY MINSTALL_GetPublicGroupCustomDataPtr (ULONG GroupID) {
|
---|
444 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
445 | ULONG CurGroupNo = 0;
|
---|
446 |
|
---|
447 | while (CurGroupNo<MCF_GroupCount) {
|
---|
448 | if (CurGroup->ID==GroupID) {
|
---|
449 | if (!(CurGroup->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
450 | if (CurGroup->GeninPtr) {
|
---|
451 | // If GENIN information present, calculate realtime
|
---|
452 | MINSTALL_FillCARDINFOCustomData (CurGroup);
|
---|
453 | }
|
---|
454 | return CurGroup->CustomData;
|
---|
455 | }
|
---|
456 | break;
|
---|
457 | }
|
---|
458 | CurGroupNo++; CurGroup++;
|
---|
459 | }
|
---|
460 | return NULL;
|
---|
461 | }
|
---|
462 |
|
---|
463 | BOOL EXPENTRY MINSTALL_SetPublicGroupCustomData (ULONG GroupID, PSZ CustomDataPtr) {
|
---|
464 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
465 | ULONG CurGroupNo = 0;
|
---|
466 |
|
---|
467 | while (CurGroupNo<MCF_GroupCount) {
|
---|
468 | if (CurGroup->ID==GroupID) {
|
---|
469 | if (!(CurGroup->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
470 | if (STRING_CopyPSZ(CurGroup->CustomData, MINSTMAX_CUSTOMDATALENGTH, CustomDataPtr)) {
|
---|
471 | if (CurGroup->GeninPtr) {
|
---|
472 | // If GENIN information present, automatically select
|
---|
473 | if (!MINSTALL_UseCARDINFOCustomData(CurGroup))
|
---|
474 | return FALSE;
|
---|
475 | }
|
---|
476 | }
|
---|
477 | return TRUE;
|
---|
478 | }
|
---|
479 | break;
|
---|
480 | }
|
---|
481 | CurGroupNo++; CurGroup++;
|
---|
482 | }
|
---|
483 | return TRUE;
|
---|
484 | }
|
---|
485 |
|
---|
486 | PSZ EXPENTRY MINSTALL_GetPackageTitlePtr (void) {
|
---|
487 | if (MINSTALL_Done & MINSTDONE_COMPLETEDPACKAGEINIT) {
|
---|
488 | return MCF_PackageName; // Simple, ey? ;-)
|
---|
489 | }
|
---|
490 | return NULL;
|
---|
491 | }
|
---|
492 |
|
---|
493 | VOID EXPENTRY MINSTALL_SelectGroup (ULONG GroupID) {
|
---|
494 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
495 | PMINSTPUBGROUP PubGroup = MINSTALL_PublicGroupArrayPtr;
|
---|
496 | ULONG CurGroupNo = 0;
|
---|
497 |
|
---|
498 | // Cycle through all groups and match GroupID. Selecting possible only on
|
---|
499 | // groups that are listed in PublicGroup and SelectionForced not set.
|
---|
500 | while (CurGroupNo<MCF_GroupCount) {
|
---|
501 | if (CurGroup->ID==GroupID) {
|
---|
502 | if (!(CurGroup->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
503 | CurGroup->Flags |= MINSTGRP_Flags_Selected;
|
---|
504 | }
|
---|
505 | break;
|
---|
506 | }
|
---|
507 | CurGroupNo++; CurGroup++;
|
---|
508 | }
|
---|
509 |
|
---|
510 | // Update Public-Group as well...
|
---|
511 | CurGroupNo = 0;
|
---|
512 | while (CurGroupNo<MINSTALL_PublicGroupCount) {
|
---|
513 | if (PubGroup->ID==GroupID) {
|
---|
514 | if (!(PubGroup->SelectionForced)) {
|
---|
515 | PubGroup->Selected = TRUE;
|
---|
516 | }
|
---|
517 | }
|
---|
518 | CurGroupNo++; PubGroup++;
|
---|
519 | }
|
---|
520 | }
|
---|
521 |
|
---|
522 | VOID EXPENTRY MINSTALL_DeSelectGroup (ULONG GroupID) {
|
---|
523 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
524 | PMINSTPUBGROUP PubGroup = MINSTALL_PublicGroupArrayPtr;
|
---|
525 | ULONG CurGroupNo = 0;
|
---|
526 |
|
---|
527 | // Cycle through all groups and match GroupID. Selecting possible only on
|
---|
528 | // groups that are listed in PublicGroup and SelectionForced not set.
|
---|
529 | while (CurGroupNo<MCF_GroupCount) {
|
---|
530 | if (CurGroup->ID==GroupID) {
|
---|
531 | if (!(CurGroup->Flags & MINSTGRP_Flags_DontListPublic)) {
|
---|
532 | CurGroup->Flags &= !MINSTGRP_Flags_Selected;
|
---|
533 | }
|
---|
534 | break;
|
---|
535 | }
|
---|
536 | CurGroupNo++; CurGroup++;
|
---|
537 | }
|
---|
538 |
|
---|
539 | // Update Public-Group as well...
|
---|
540 | CurGroupNo = 0;
|
---|
541 | while (CurGroupNo<MINSTALL_PublicGroupCount) {
|
---|
542 | if (PubGroup->ID==GroupID) {
|
---|
543 | if (!(PubGroup->SelectionForced)) {
|
---|
544 | PubGroup->Selected = FALSE;
|
---|
545 | }
|
---|
546 | }
|
---|
547 | CurGroupNo++; PubGroup++;
|
---|
548 | }
|
---|
549 | }
|
---|
550 |
|
---|
551 | VOID EXPENTRY MINSTALL_SetCARDINFOCardCountForGroup (ULONG GroupID, ULONG SelectedCards) {
|
---|
552 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
553 | PMINSTPUBGROUP PubGroup = MINSTALL_PublicGroupArrayPtr;
|
---|
554 | ULONG CurGroupNo = 0;
|
---|
555 |
|
---|
556 | // Cycle through all groups and match GroupID. Set SelectedCards only, if
|
---|
557 | // Genin-Information present.
|
---|
558 | while (CurGroupNo<MCF_GroupCount) {
|
---|
559 | if (CurGroup->ID==GroupID) {
|
---|
560 | if (CurGroup->GeninPtr) {
|
---|
561 | if (SelectedCards<=CurGroup->GeninPtr->MaxCardCount)
|
---|
562 | CurGroup->GeninPtr->SelectedCards = SelectedCards;
|
---|
563 | }
|
---|
564 | break;
|
---|
565 | }
|
---|
566 | CurGroupNo++; CurGroup++;
|
---|
567 | }
|
---|
568 | }
|
---|
569 |
|
---|
570 | ULONG EXPENTRY MINSTALL_GetCARDINFOChoiceForGroup (ULONG GroupID, ULONG CardNo, ULONG PromptNo) {
|
---|
571 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
572 | ULONG CurGroupNo = 0;
|
---|
573 |
|
---|
574 | if ((!CardNo) || (!PromptNo)) return; // Invalid input
|
---|
575 | CardNo--; PromptNo--;
|
---|
576 |
|
---|
577 | // Cycle through all groups and match GroupID. Set Choice only, if Genin-
|
---|
578 | // Information present.
|
---|
579 | while (CurGroupNo<MCF_GroupCount) {
|
---|
580 | if (CurGroup->ID==GroupID) {
|
---|
581 | if (CurGroup->GeninPtr) {
|
---|
582 | // Check, if CardNo/PromptNo is a valid value
|
---|
583 | if (CardNo>=CurGroup->GeninPtr->SelectedCards)
|
---|
584 | return 0;
|
---|
585 | if (PromptNo>=CurGroup->GeninPtr->PromptsCount)
|
---|
586 | return 0;
|
---|
587 | return (CurGroup->GeninPtr->PromptSelectedValueNo[CardNo][PromptNo])+1;
|
---|
588 | }
|
---|
589 | break;
|
---|
590 | }
|
---|
591 | CurGroupNo++; CurGroup++;
|
---|
592 | }
|
---|
593 | return 0;
|
---|
594 | }
|
---|
595 |
|
---|
596 | // ChoiceNo in that case is 1-based
|
---|
597 | VOID EXPENTRY MINSTALL_SetCARDINFOChoiceForGroup (ULONG GroupID, ULONG CardNo, ULONG PromptNo, ULONG ChoiceNo) {
|
---|
598 | PMINSTGRP CurGroup = MCF_GroupArrayPtr;
|
---|
599 | ULONG CurGroupNo = 0;
|
---|
600 | ULONG CurChoiceNo = 0;
|
---|
601 | PSZ CurValuePtr = 0;
|
---|
602 |
|
---|
603 | if ((!CardNo) || (!PromptNo) || (!ChoiceNo)) return; // Invalid input
|
---|
604 | CardNo--; PromptNo--; ChoiceNo--;
|
---|
605 |
|
---|
606 | // Cycle through all groups and match GroupID. Set Choice only, if Genin-
|
---|
607 | // Information present.
|
---|
608 | while (CurGroupNo<MCF_GroupCount) {
|
---|
609 | if (CurGroup->ID==GroupID) {
|
---|
610 | if (CurGroup->GeninPtr) {
|
---|
611 | // We got GroupID, so cycle through all Values and set selected
|
---|
612 | // PSZ pointer. Also check, if ChoiceNo is a valid value
|
---|
613 | // Check, if CardNo/PromptNo is a valid value
|
---|
614 | if (CardNo>=CurGroup->GeninPtr->SelectedCards)
|
---|
615 | return;
|
---|
616 | if (PromptNo>=CurGroup->GeninPtr->PromptsCount)
|
---|
617 | return;
|
---|
618 | if (ChoiceNo>=CurGroup->GeninPtr->PromptChoiceCount[PromptNo])
|
---|
619 | return;
|
---|
620 | CurValuePtr = CurGroup->GeninPtr->PromptChoiceValues[PromptNo];
|
---|
621 | while (CurChoiceNo<ChoiceNo) {
|
---|
622 | CurValuePtr = STRING_SkipASCIIZ(CurValuePtr, NULL);
|
---|
623 | CurChoiceNo++;
|
---|
624 | }
|
---|
625 | CurGroup->GeninPtr->PromptSelectedValue[CardNo][PromptNo] = CurValuePtr;
|
---|
626 | CurGroup->GeninPtr->PromptSelectedValueNo[CardNo][PromptNo] = ChoiceNo;
|
---|
627 | }
|
---|
628 | break;
|
---|
629 | }
|
---|
630 | CurGroupNo++; CurGroup++;
|
---|
631 | }
|
---|
632 | }
|
---|