1 |
|
---|
2 | /*
|
---|
3 | * bs_config.h:
|
---|
4 | * header file for bs_config.cpp. See remarks there.
|
---|
5 | *
|
---|
6 | *@@include #define INCL_WINWORKPLACE
|
---|
7 | *@@include #include <os2.h>
|
---|
8 | *@@include #include "base\bs_errors.h"
|
---|
9 | *@@include #include "base\bs_logger.h"
|
---|
10 | *@@include #include "base\bs_config.h"
|
---|
11 | */
|
---|
12 |
|
---|
13 | /*
|
---|
14 | * This file Copyright (C) 1999-2002 Ulrich Mller.
|
---|
15 | * This program is free software; you can redistribute it and/or modify
|
---|
16 | * it under the terms of the GNU General Public License as published by
|
---|
17 | * the Free Software Foundation, in version 2 as it comes in the COPYING
|
---|
18 | * file of this distribution.
|
---|
19 | * This program is distributed in the hope that it will be useful,
|
---|
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
22 | * GNU General Public License for more details.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef WARPIN_CONFIG_HEADER_INCLUDED
|
---|
26 | #define WARPIN_CONFIG_HEADER_INCLUDED
|
---|
27 |
|
---|
28 | /* ******************************************************************
|
---|
29 | *
|
---|
30 | * BSConfigExcpt declaration
|
---|
31 | *
|
---|
32 | ********************************************************************/
|
---|
33 |
|
---|
34 | /*
|
---|
35 | *@@ BSConfigExcpt:
|
---|
36 | * exception thrown by many of the configuration
|
---|
37 | * methods.
|
---|
38 | *
|
---|
39 | * Note that the various error codes are declared in
|
---|
40 | * bs_config_impl.h.
|
---|
41 | *
|
---|
42 | *@@changed V0.9.0 (99-10-31) [umoeller]: made this a child of BSExcptBase
|
---|
43 | */
|
---|
44 |
|
---|
45 | class BSConfigExcpt : public BSExcptBase
|
---|
46 | {
|
---|
47 | public:
|
---|
48 | int _iErrorCode;
|
---|
49 | int _iData; // with CFGSYS_OPEN, this has the APIRET
|
---|
50 |
|
---|
51 | /*
|
---|
52 | *@@ BSConfigExcpt:
|
---|
53 | * constructor 1, for integer data only
|
---|
54 | */
|
---|
55 |
|
---|
56 | BSConfigExcpt(int iErrorCode_, int iData_)
|
---|
57 | {
|
---|
58 | _iErrorCode = iErrorCode_;
|
---|
59 | _iData = iData_;
|
---|
60 | }
|
---|
61 |
|
---|
62 | /*
|
---|
63 | *@@ BSConfigExcpt:
|
---|
64 | * constructor 2, report a string.
|
---|
65 | */
|
---|
66 |
|
---|
67 | BSConfigExcpt(int iErrorCode_, const ustring &ustrSubstring_)
|
---|
68 | {
|
---|
69 | _iErrorCode = iErrorCode_;
|
---|
70 | _iData = 0;
|
---|
71 | _ustrDescription = ustrSubstring_;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /*
|
---|
75 | *@@ BSConfigExcpt:
|
---|
76 | * constructor 3, both integer and string.
|
---|
77 | */
|
---|
78 |
|
---|
79 | BSConfigExcpt(int iErrorCode_, int iData_, const ustring &ustrSubstring_)
|
---|
80 | {
|
---|
81 | _iErrorCode = iErrorCode_;
|
---|
82 | _iData = iData_;
|
---|
83 | _ustrDescription = ustrSubstring_;
|
---|
84 | }
|
---|
85 | };
|
---|
86 |
|
---|
87 | /* ******************************************************************
|
---|
88 | *
|
---|
89 | * Derived logger classes
|
---|
90 | *
|
---|
91 | ********************************************************************/
|
---|
92 |
|
---|
93 | /*
|
---|
94 | *@@ BSAttrLoggerBase:
|
---|
95 | * class derived from BSMemLoggerBase for storing string attributes,
|
---|
96 | * as specified in a PCK attribute.
|
---|
97 | * This is identical to BSMemLoggerBase and not used either, only
|
---|
98 | * for deriving more logger classes.
|
---|
99 | */
|
---|
100 |
|
---|
101 | class BSAttrLoggerBase : public BSMemLoggerBase { };
|
---|
102 |
|
---|
103 | /*
|
---|
104 | *@@ BSDoneLoggerBase:
|
---|
105 | * class derived from BSMemLoggerBase for storing the actual system
|
---|
106 | * changes made according to a PCK attribute. These loggers
|
---|
107 | * are filled during system configuration (after all files
|
---|
108 | * have been unpacked) while the system is being modified.
|
---|
109 | * This data is stored in the database so that configuration
|
---|
110 | * can be undone upon de-installation.
|
---|
111 | *
|
---|
112 | * This is identical to BSMemLoggerBase and not used either, only
|
---|
113 | * for deriving more logger classes.
|
---|
114 | */
|
---|
115 |
|
---|
116 | class BSDoneLoggerBase : public BSMemLoggerBase { };
|
---|
117 |
|
---|
118 | /*
|
---|
119 | *@@ BSCfgSysAttrsLogger:
|
---|
120 | * logger for storing CONFIG.SYS manipulation attributes.
|
---|
121 | *
|
---|
122 | * This stores strings just as in the CONFIGSYS
|
---|
123 | * attribute of the PCK tag.
|
---|
124 | *
|
---|
125 | *@@added V0.9.1 (2000-01-05) [umoeller]
|
---|
126 | */
|
---|
127 |
|
---|
128 | class BSCfgSysAttrsLogger : public BSAttrLoggerBase { };
|
---|
129 |
|
---|
130 | /*
|
---|
131 | *@@ BSCfgSysDoneLogger:
|
---|
132 | * this logs changes made to CONFIG.SYS.
|
---|
133 | * This is derived from BSDoneLoggerBase and only
|
---|
134 | * declared to make sure that it's a CONFIG.SYS
|
---|
135 | * logger passed to the BSConfigSys methods.
|
---|
136 | *
|
---|
137 | * Format of the entries:
|
---|
138 | * slightly complicated, see BSCfgSysManip::AddToUndoList.
|
---|
139 | */
|
---|
140 |
|
---|
141 | class BSCfgSysDoneLogger : public BSDoneLoggerBase { };
|
---|
142 |
|
---|
143 | /*
|
---|
144 | *@@ BSRegisterAttrsLogger:
|
---|
145 | * logger for storing register-class attributes.
|
---|
146 | *
|
---|
147 | * This stores strings just as in the REGISTERCLASS
|
---|
148 | * attribute of the PCK tag.
|
---|
149 | *
|
---|
150 | *@@added V0.9.1 (2000-01-05) [umoeller]
|
---|
151 | */
|
---|
152 |
|
---|
153 | class BSRegisterAttrsLogger : public BSAttrLoggerBase { };
|
---|
154 |
|
---|
155 | /*
|
---|
156 | *@@ BSReplaceAttrsLogger:
|
---|
157 | * logger for storing replace-class attributes.
|
---|
158 | *
|
---|
159 | * This stores strings just as in the REPLACECLASS
|
---|
160 | * attribute of the PCK tag.
|
---|
161 | *
|
---|
162 | *@@added V0.9.1 (2000-01-05) [umoeller]
|
---|
163 | */
|
---|
164 |
|
---|
165 | class BSReplaceAttrsLogger : public BSAttrLoggerBase { };
|
---|
166 |
|
---|
167 | /*
|
---|
168 | *@@ BSRegisterDoneLogger:
|
---|
169 | * this logs registered WPS classes.
|
---|
170 | * This is derived from BSDoneLoggerBase and only
|
---|
171 | * declared to make sure that only a suitable
|
---|
172 | * logger is passed to the BSRegisterClass methods.
|
---|
173 | *
|
---|
174 | * Format of the entries:
|
---|
175 | * This logger stores plain WPS class names only
|
---|
176 | * so that these can be de-registered again with
|
---|
177 | * BSDeregisterClass.
|
---|
178 | */
|
---|
179 |
|
---|
180 | class BSRegisterDoneLogger : public BSDoneLoggerBase { };
|
---|
181 |
|
---|
182 | /*
|
---|
183 | *@@ BSReplaceDoneLogger:
|
---|
184 | * this logs replaced WPS classes.
|
---|
185 | * This is derived from BSDoneLoggerBase and only
|
---|
186 | * declared to make sure that only a suitable
|
---|
187 | * logger is passed to the BSReplaceClass methods.
|
---|
188 | *
|
---|
189 | * Format of the entries:
|
---|
190 | * "oldclass|newclass"
|
---|
191 | *
|
---|
192 | * That's the same as with BSReplaceAttrsLogger.
|
---|
193 | */
|
---|
194 |
|
---|
195 | class BSReplaceDoneLogger : public BSDoneLoggerBase { };
|
---|
196 |
|
---|
197 | /*
|
---|
198 | *@@ BSWPSObjectAttrsLogger:
|
---|
199 | * logger for storing create-WPS-objects attributes.
|
---|
200 | *
|
---|
201 | * This stores strings just as in the CREATEOBJECT
|
---|
202 | * attribute of the PCK tag.
|
---|
203 | *
|
---|
204 | *@@added V0.9.1 (2000-01-05) [umoeller]
|
---|
205 | */
|
---|
206 |
|
---|
207 | class BSWPSObjectAttrsLogger : public BSAttrLoggerBase { };
|
---|
208 |
|
---|
209 | /*
|
---|
210 | *@@ BSWPSObjectsDoneLogger:
|
---|
211 | * this logs created WPS objects.
|
---|
212 | * This is derived from BSDoneLoggerBase and only
|
---|
213 | * declared to make sure that only a suitable
|
---|
214 | * logger is passed to the BSCreateWPSObject methods.
|
---|
215 | *
|
---|
216 | * Format of the entries:
|
---|
217 | * This stores the WPS object ID (a la "<WP_BLAH>"
|
---|
218 | * only as specified in the setup string in the
|
---|
219 | * BSWPSObjectAttrsLogger.
|
---|
220 | */
|
---|
221 |
|
---|
222 | class BSWPSObjectsDoneLogger : public BSDoneLoggerBase { };
|
---|
223 |
|
---|
224 | /*
|
---|
225 | *@@ BSClearPrfAttrsLogger:
|
---|
226 | * logger for storing CLEARPROFILE attributes of PCK tag.
|
---|
227 | *
|
---|
228 | * This stores strings just as in the CLEARPROFILE
|
---|
229 | * attribute of the PCK tag.
|
---|
230 | *
|
---|
231 | * Note that there is no corresponding "done" logger
|
---|
232 | * for the CLEARPROFILE tag because this is used during
|
---|
233 | * de-installation only.
|
---|
234 | *
|
---|
235 | *@@added V0.9.1 (2000-02-07) [umoeller]
|
---|
236 | */
|
---|
237 |
|
---|
238 | class BSClearPrfAttrsLogger : public BSAttrLoggerBase { };
|
---|
239 |
|
---|
240 | /*
|
---|
241 | *@@ BSWritePrfAttrsLogger:
|
---|
242 | * logger for storing WRITEPROFILE attributes of PCK tag.
|
---|
243 | *
|
---|
244 | * This stores strings just as in the WRITEPROFILE
|
---|
245 | * attribute of the PCK tag.
|
---|
246 | *
|
---|
247 | *@@added V0.9.1 (2000-02-07) [umoeller]
|
---|
248 | */
|
---|
249 |
|
---|
250 | class BSWritePrfAttrsLogger : public BSAttrLoggerBase { };
|
---|
251 |
|
---|
252 | /*
|
---|
253 | *@@ BSWritePrfsDoneLogger:
|
---|
254 | * this logs "write profile" entries.
|
---|
255 | * This is derived from BSDoneLoggerBase and only
|
---|
256 | * declared to make sure that only a suitable
|
---|
257 | * logger is passed to ### methods.
|
---|
258 | *
|
---|
259 | *@@added V0.9.1 (2000-02-07) [umoeller]
|
---|
260 | */
|
---|
261 |
|
---|
262 | // class BSWritePrfsDoneLogger : public BSDoneLoggerBase { };
|
---|
263 |
|
---|
264 | /*
|
---|
265 | *@@ BSExecuteAttrsLogger:
|
---|
266 | * logger for storing EXECUTE attributes of PCK tag.
|
---|
267 | *
|
---|
268 | * This stores strings just as in the EXECUTE
|
---|
269 | * attribute of the PCK tag.
|
---|
270 | *
|
---|
271 | *@@added V0.9.1 (2000-02-01) [umoeller]
|
---|
272 | */
|
---|
273 |
|
---|
274 | class BSExecuteAttrsLogger : public BSAttrLoggerBase { };
|
---|
275 |
|
---|
276 | /*
|
---|
277 | *@@ BSExecuteDoneLogger:
|
---|
278 | * this logs executed user programs.
|
---|
279 | * This is derived from BSDoneLoggerBase and only
|
---|
280 | * declared to make sure that only a suitable
|
---|
281 | * logger is passed to ### methods.
|
---|
282 | *
|
---|
283 | *@@added V0.9.1 (2000-02-01) [umoeller]
|
---|
284 | */
|
---|
285 |
|
---|
286 | class BSExecuteDoneLogger : public BSDoneLoggerBase { };
|
---|
287 |
|
---|
288 | /*
|
---|
289 | *@@ BSDeExecuteAttrsLogger:
|
---|
290 | * logger for storing DEEXECUTE attributes of PCK tag.
|
---|
291 | *
|
---|
292 | * This stores strings just as in the DEEXECUTE
|
---|
293 | * attribute of the PCK tag.
|
---|
294 | *
|
---|
295 | *@@added V0.9.1 (2000-02-01) [umoeller]
|
---|
296 | */
|
---|
297 |
|
---|
298 | class BSDeExecuteAttrsLogger : public BSAttrLoggerBase { };
|
---|
299 |
|
---|
300 | /*
|
---|
301 | *@@ BSExecuteResolvedLogger:
|
---|
302 | * logger for storing _resolved_ DEEXECUTE attributes
|
---|
303 | * of a PCK tag. This takes the function of a "Done"
|
---|
304 | * logger, but since there is really nothing "done"
|
---|
305 | * during install except resolving macros, this
|
---|
306 | * is called a "ResolvedLogger".
|
---|
307 | *
|
---|
308 | * Executable and parameter are tightly separated by "|".
|
---|
309 | *
|
---|
310 | *@@added V0.9.9 (2001-03-27) [umoeller]
|
---|
311 | */
|
---|
312 |
|
---|
313 | class BSDeExecuteResolvedLogger : public BSDoneLoggerBase { };
|
---|
314 |
|
---|
315 | /*
|
---|
316 | *@@ BSKillProcessAttrsLogger:
|
---|
317 | * logger for storing KILLPROCESS attributes of PCK tag.
|
---|
318 | *
|
---|
319 | *@@added V0.9.1 (2000-02-12) [umoeller]
|
---|
320 | */
|
---|
321 |
|
---|
322 | class BSKillProcessAttrsLogger : public BSAttrLoggerBase { };
|
---|
323 |
|
---|
324 | /* ******************************************************************
|
---|
325 | *
|
---|
326 | * BSConfigBase class
|
---|
327 | *
|
---|
328 | ********************************************************************/
|
---|
329 |
|
---|
330 | // declare all BSConfigBase descendant classes
|
---|
331 | // so we can return pointers of them in BSConfigBase
|
---|
332 | class BSCfgSysManip;
|
---|
333 | class BSRegisterClass;
|
---|
334 | class BSDeregisterClass;
|
---|
335 | class BSReplaceClass;
|
---|
336 | class BSUnreplaceClass;
|
---|
337 | class BSCreateWPSObject;
|
---|
338 | class BSDeleteWPSObject;
|
---|
339 | class BSClearProfile;
|
---|
340 | class BSWriteProfile;
|
---|
341 | class BSExecute;
|
---|
342 | class BSDeExecute; // V0.9.9 (2001-03-27) [umoeller]
|
---|
343 | class BSKillProcess;
|
---|
344 |
|
---|
345 | // flags for BSConfigBase._ulConfigClassType;
|
---|
346 | // in that context, only one of these is used,
|
---|
347 | // however, we also use these flags in
|
---|
348 | // BSExecute._ulExecType, where these may be
|
---|
349 | // ORed
|
---|
350 | #define CFGT_CFGSYS 0x0001
|
---|
351 | #define CFGT_REGISTERCLASS 0x0002
|
---|
352 | #define CFGT_DEREGISTERCLASS 0x0004
|
---|
353 | #define CFGT_REPLACECLASS 0x0008
|
---|
354 | #define CFGT_UNREPLACECLASS 0x0010
|
---|
355 | #define CFGT_CREATEOBJECT 0x0020
|
---|
356 | #define CFGT_DELETEOBJECT 0x0040
|
---|
357 | #define CFGT_CLEARPROFILE 0x0080
|
---|
358 | #define CFGT_WRITEPROFILE 0x0100
|
---|
359 | #define CFGT_EXECUTE 0x0200
|
---|
360 | #define CFGT_KILLPROCESS 0x0400
|
---|
361 | #define CFGT_DEEXECUTE 0x0800
|
---|
362 |
|
---|
363 | /*
|
---|
364 | *@@ BSConfigBase:
|
---|
365 | * abstract parent class from which all other config
|
---|
366 | * classes are derived. This cannot be instantiated
|
---|
367 | * because the constructor is protected.
|
---|
368 | *
|
---|
369 | * We use an abstract base class for the various
|
---|
370 | * subclasses of this class so we can always use
|
---|
371 | * this abstract base class in STL lists. Everything
|
---|
372 | * else leads to terrible code bloat.
|
---|
373 | *
|
---|
374 | * Besides, this gives us a common interface for
|
---|
375 | * selecting configuration items during deinstallation.
|
---|
376 | *
|
---|
377 | * See bs_config.cpp for more on the various config
|
---|
378 | * classes.
|
---|
379 | *
|
---|
380 | *@@added V0.9.1 (2000-02-07) [umoeller]
|
---|
381 | */
|
---|
382 |
|
---|
383 | class BSConfigBase : public BSRoot
|
---|
384 | {
|
---|
385 | public:
|
---|
386 | DECLARE_CLASS(BSConfigBase);
|
---|
387 |
|
---|
388 | protected:
|
---|
389 | ULONG _ulConfigClassType;
|
---|
390 | // CFGT_* flag specifying the actual BSConfigBase
|
---|
391 | // subclass of which this is an instance; use the
|
---|
392 | // Is* methods to check this
|
---|
393 |
|
---|
394 | BOOL _fSelected;
|
---|
395 | // if TRUE, the config instance has been selected
|
---|
396 | // for installation or de-installation
|
---|
397 |
|
---|
398 | /*
|
---|
399 | *@@ BSConfigBase:
|
---|
400 | * the constructor.
|
---|
401 | */
|
---|
402 |
|
---|
403 | BSConfigBase(ULONG ulConfigType_,
|
---|
404 | BSClassID &Class)
|
---|
405 | : BSRoot(Class)
|
---|
406 | {
|
---|
407 | _ulConfigClassType = ulConfigType_;
|
---|
408 | _fSelected = TRUE;
|
---|
409 | }
|
---|
410 |
|
---|
411 | public:
|
---|
412 |
|
---|
413 | /*
|
---|
414 | *@@ DescribeType:
|
---|
415 | * describes the config object to the GUI...
|
---|
416 | * this is visible in various config dialogs.
|
---|
417 | *
|
---|
418 | * Abstract method, must be overridden by
|
---|
419 | * subclasses.
|
---|
420 | */
|
---|
421 |
|
---|
422 | virtual const char* DescribeType() = 0;
|
---|
423 |
|
---|
424 | /*
|
---|
425 | *@@ DescribeData:
|
---|
426 | * must return a description of the object's
|
---|
427 | * data, which is displayed in GUI dialogs.
|
---|
428 | *
|
---|
429 | * Abstract method, must be overridden by
|
---|
430 | * subclasses.
|
---|
431 | */
|
---|
432 |
|
---|
433 | virtual ustring DescribeData()
|
---|
434 | {
|
---|
435 | ustring ustr;
|
---|
436 | ustr.assignUtf8("unknown");
|
---|
437 | return (ustr);
|
---|
438 | }
|
---|
439 |
|
---|
440 | /*
|
---|
441 | *@@ IsSelected:
|
---|
442 | * returns the _fSelected member status.
|
---|
443 | *
|
---|
444 | *@@added V0.9.4 (2000-07-01) [umoeller]
|
---|
445 | */
|
---|
446 |
|
---|
447 | BOOL IsSelected(VOID)
|
---|
448 | {
|
---|
449 | return (_fSelected);
|
---|
450 | }
|
---|
451 |
|
---|
452 | /*
|
---|
453 | *@@ Select:
|
---|
454 | * sets the _fSelected member.
|
---|
455 | *
|
---|
456 | *@@added V0.9.4 (2000-07-01) [umoeller]
|
---|
457 | */
|
---|
458 |
|
---|
459 | VOID Select(BOOL fSelect)
|
---|
460 | {
|
---|
461 | _fSelected = fSelect;
|
---|
462 | }
|
---|
463 | };
|
---|
464 |
|
---|
465 | #endif
|
---|
466 |
|
---|