| [32] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: init.c 1786 2014-08-30 20:03:35Z gyoung $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Initialization | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [1498] | 9 | Copyright (c) 2001, 2010 Steven H. Levine | 
|---|
| [32] | 10 |  | 
|---|
| [133] | 11 | 11 Jun 02 SHL Add CheckVersion | 
|---|
|  | 12 | 11 Jun 03 SHL Add JFS and FAT32 support | 
|---|
|  | 13 | 25 Nov 03 SHL InitFM3DLL: correct strings error mesage | 
|---|
|  | 14 | 23 May 05 SHL Use datamin.h | 
|---|
| [179] | 15 | 26 May 05 SHL Comments | 
|---|
| [189] | 16 | 06 Jun 05 SHL indent -i2 | 
|---|
| [201] | 17 | 06 Jun 05 SHL Rework FindSwapperDat for VAC3.65 compat | 
|---|
| [339] | 18 | 13 Jul 06 SHL Use Runtime_Error | 
|---|
|  | 19 | 13 Jul 06 SHL Sync with current style | 
|---|
| [404] | 20 | 29 Jul 06 SHL Use xfgets | 
|---|
| [526] | 21 | 22 Oct 06 GKY Add NDFS32 support | 
|---|
| [552] | 22 | 18 Feb 07 GKY Add ISOFS, RAMFS support | 
|---|
| [593] | 23 | 30 Mar 07 GKY Defined golbals for removing GetPString for window class names | 
|---|
| [627] | 24 | 21 Apr 07 GKY Find FM2Utils by path or utils directory eleminate fAddUtils global | 
|---|
| [690] | 25 | 15 Jun 07 SHL Make OpenWatcom compatible | 
|---|
| [705] | 26 | 23 Jun 07 GKY Fix WORPLACE_PROCESS enviroment check logic | 
|---|
| [718] | 27 | 28 Jun 07 SHL Rework WORKPLACE_PROCESS check to match reality | 
|---|
| [756] | 28 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading) | 
|---|
| [775] | 29 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148) | 
|---|
| [783] | 30 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat | 
|---|
| [784] | 31 | 18 Aug 07 JBS Added code to read Details* keys from the INI file (Ticket 118) | 
|---|
| [789] | 32 | 19 Aug 07 SHL Ensure FilesToGet in valid range | 
|---|
| [796] | 33 | 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane | 
|---|
| [803] | 34 | 23 Aug 07 SHL InitFM3DLL: report INI file DosSetPathInfo error correctly | 
|---|
|  | 35 | 23 Aug 07 SHL Use BldFullPathName | 
|---|
|  | 36 | 25 Aug 07 SHL Work around DosSetPathInfo kernel defect | 
|---|
| [827] | 37 | 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry | 
|---|
| [860] | 38 | 10 Nov 07 GKY Get thousands separator from country info for file sizes. | 
|---|
| [878] | 39 | 26 Nov 07 GKY Eliminate check of ext path on start up | 
|---|
| [888] | 40 | 17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun | 
|---|
| [940] | 41 | 13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector. | 
|---|
| [952] | 42 | 12 Feb 08 SHL Compile OpenWatcom version into binary | 
|---|
| [985] | 43 | 29 Feb 08 GKY Changes to enable user settable command line length | 
|---|
|  | 44 | 29 Feb 08 GKY Refactor global command line variables to notebook.h | 
|---|
| [998] | 45 | 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with | 
|---|
| [1335] | 46 | keys using a "DirCnr." prefix | 
|---|
| [1004] | 47 | 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it. | 
|---|
| [1065] | 48 | 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating | 
|---|
| [1335] | 49 | all the details view settings (both the global variables and those in the | 
|---|
|  | 50 | DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. | 
|---|
| [1075] | 51 | 16 JUL 08 GKY Use TMP directory for temp files | 
|---|
| [1074] | 52 | 17 Jul 08 SHL Reduce code bulk in fUseTmp setup | 
|---|
| [1082] | 53 | 19 Jul 08 GKY Use pFM2SaveDirectory, MakeTempName and move temp files to TMP subdirectory if (TMP). | 
|---|
| [1083] | 54 | 20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container. | 
|---|
| [1089] | 55 | 20 Jul 08 GKY Add support to delete orphaned tmp directories without deleting tmp of other | 
|---|
| [1335] | 56 | running sessions | 
|---|
| [1112] | 57 | 23 Aug 08 GKY Check that space on TMP & FM2 save drives exceed 5 GiB; Done to allow user setting of | 
|---|
| [1335] | 58 | minimum size in future | 
|---|
| [1303] | 59 | 29 Nov 08 GKY Remove or replace with a mutex semaphore DosEnterCriSec where appropriate. | 
|---|
| [1306] | 60 | 30 Nov 08 GKY Add the option of creating a subdirectory from the arcname | 
|---|
| [1335] | 61 | for the extract path to arc container. | 
|---|
|  | 62 | 10 Dec 08 SHL Integrate exception handler support | 
|---|
| [1358] | 63 | 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis | 
|---|
| [1360] | 64 | 28 Dec 08 GKY Check for LVM.EXE and remove Refresh removable media menu item as appropriate | 
|---|
|  | 65 | 28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files) | 
|---|
| [1394] | 66 | and have no default choice. | 
|---|
| [1375] | 67 | 01 Jan 09 GKY Add option to rescan tree container on eject of removable media | 
|---|
|  | 68 | 03 Jan 09 GKY Avoid dbl scan of drive on startup by checking for first rescan drive. | 
|---|
|  | 69 | 03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent | 
|---|
| [1394] | 70 | Dos/Win programs from being inserted into the execute dialog with message why. | 
|---|
| [1391] | 71 | 11 Jan 09 GKY Move strings that shouldn't be translated (font names etc) compile time variables | 
|---|
| [1394] | 72 | 03 Feb 09 SHL Switch to STRINGTABLE | 
|---|
| [1395] | 73 | 07 Feb 09 GKY Move repeated strings to PCSZs. | 
|---|
|  | 74 | 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale | 
|---|
|  | 75 | 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error | 
|---|
| [1400] | 76 | 08 Mar 09 GKY Additional strings move to PCSZs in init.c | 
|---|
| [1402] | 77 | 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used) | 
|---|
|  | 78 | 14 Mar 09 GKY PCSZ strings moved to compile time initialization | 
|---|
|  | 79 | 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring replaces check for | 
|---|
| [1471] | 80 | saved drive containers. | 
|---|
| [1429] | 81 | 06 Jun 09 GKY Add option to show file system type or drive label in tree | 
|---|
| [1438] | 82 | 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. | 
|---|
| [1480] | 83 | 12 Jul 09 GKY Add xDosQueryAppType and xDosAlloc... to allow FM/2 to load in high memory | 
|---|
| [1444] | 84 | 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning | 
|---|
|  | 85 | 22 Jul 09 GKY Fix failure to restore the notebook setting for saving container states or not | 
|---|
| [1452] | 86 | 12 Sep 09 GKY Change protectonly check to check for VKBD being loaded instead of starting | 
|---|
| [1471] | 87 | command.com. Prevents hang (at least until a Dos program is started) on a system | 
|---|
|  | 88 | that has a broken MDOS install. | 
|---|
| [1479] | 89 | 15 Nov 09 GKY Add more PCSZs | 
|---|
| [1480] | 90 | 22 Nov 09 GKY Fix FindSwapperDat so the check for large file support actually occurs if the | 
|---|
|  | 91 | fall back to config.sys is used to find it; use bstripcr to streamline code. | 
|---|
| [1482] | 92 | 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in | 
|---|
|  | 93 | profile calls for user settings that work and are setable in more than one | 
|---|
|  | 94 | miniapp; FM3Str should be used for setting only relavent to FM/2 or that | 
|---|
|  | 95 | aren't user settable; realappname should be used for setting applicable to | 
|---|
|  | 96 | one or more miniapp but not to FM/2 | 
|---|
| [1604] | 97 | 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR | 
|---|
|  | 98 | CONSTANT * as CHAR *. | 
|---|
| [1522] | 99 | 09 MAY 10 JBS Ticket 434: Make fDontSuggestAgain a "global" flag, not a per app flag | 
|---|
| [1546] | 100 | 23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help | 
|---|
| [1553] | 101 | 20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory | 
|---|
|  | 102 | entries in the tree container, fix related semaphore performance using | 
|---|
|  | 103 | combination of event and mutex semaphores | 
|---|
| [1554] | 104 | 20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused | 
|---|
|  | 105 | by temp file creation failures. | 
|---|
| [1560] | 106 | 03 Mar 11 SHL Try using FM3INI to create help instance if fm3.hlp not in current directory | 
|---|
| [1604] | 107 | 06 Aug 11 GKY Fixed failure to initalize pFM2SaveDirectory if TEMP and TMP were not present | 
|---|
|  | 108 | or invalid | 
|---|
| [1642] | 109 | 22 Oct 11 GKY Thread notes dialog now reopens on startup if it was open on shutdown. | 
|---|
| [1654] | 110 | 08 Jan 12 GKY Add support for changing PresParams in the notify status window | 
|---|
| [1664] | 111 | 04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of | 
|---|
|  | 112 | copy, move and delete operations | 
|---|
|  | 113 | 04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog | 
|---|
|  | 114 | for delete of readonly files | 
|---|
| [1711] | 115 | 09 Feb 14 GKY Fix separate parameters. Moved to general page renamed separate settings | 
|---|
|  | 116 | for apps. | 
|---|
| [1712] | 117 | 09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete | 
|---|
|  | 118 | of temporary files | 
|---|
| [1720] | 119 | 16 Feb 14 GKY Add "#" command line switch to workaround problem with blank command shell | 
|---|
|  | 120 | started from fm2 after fm2 has been started with stdout and stderr | 
|---|
|  | 121 | redirected to a file. | 
|---|
| [1739] | 122 | 22 Feb 14 GKY Cleanup of readonly check code suppress spurious error on blocked directory | 
|---|
|  | 123 | delete and eliminated the check on additional temp file deletes | 
|---|
| [1743] | 124 | 23 Feb 14 JBS Ticket #515: Corrected a mis-coded call to strtol which was causing the traps | 
|---|
|  | 125 | described in this ticket. (Also changed it to strtoul.) | 
|---|
| [1750] | 126 | 01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed. | 
|---|
|  | 127 | So calls to these functions had to be changed. | 
|---|
| [1753] | 128 | 02 Mar 14 GKY Fixed typo that reversed the function of the saymsg dialog g/bzip check. | 
|---|
|  | 129 | Added option to suppress message regarding missing bzip2.exe | 
|---|
|  | 130 | or gzip.exe on TAR.B/GZ archives. | 
|---|
| [1786] | 131 | 30 Aug 14 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents | 
|---|
|  | 132 | a trap when FM2 is shutdown while directory containers are still populating | 
|---|
| [32] | 133 |  | 
|---|
|  | 134 | ***********************************************************************/ | 
|---|
|  | 135 |  | 
|---|
| [2] | 136 | #include <stdlib.h> | 
|---|
|  | 137 | #include <string.h> | 
|---|
|  | 138 | #include <share.h> | 
|---|
| [1335] | 139 | #include <process.h>                    // getpid | 
|---|
| [1224] | 140 | #include <time.h> | 
|---|
| [1326] | 141 | #include <ctype.h> | 
|---|
| [133] | 142 |  | 
|---|
| [803] | 143 | #define INCL_DOS | 
|---|
|  | 144 | #define INCL_WIN | 
|---|
|  | 145 | #define INCL_MMIOOS2 | 
|---|
|  | 146 | #define INCL_GPI | 
|---|
|  | 147 | #define INCL_DOSERRORS | 
|---|
| [841] | 148 | #define INCL_LONGLONG | 
|---|
| [860] | 149 | #define INCL_DOSNLS | 
|---|
| [803] | 150 | #include <os2.h> | 
|---|
|  | 151 | #include <os2me.h> | 
|---|
|  | 152 |  | 
|---|
|  | 153 | #define DEFINE_GLOBALS 1 | 
|---|
|  | 154 |  | 
|---|
| [1177] | 155 | #include "fm3dll.h" | 
|---|
| [1224] | 156 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc. | 
|---|
|  | 157 | #include "init.h" | 
|---|
| [1209] | 158 | #include "mkdir.h"                      // Data declaration(s) | 
|---|
|  | 159 | #include "dircnrs.h"                    // Data declaration(s) | 
|---|
|  | 160 | #include "comp.h"                       // Data declaration(s) | 
|---|
|  | 161 | #include "cmdline.h"                    // Data declaration(s) | 
|---|
|  | 162 | #include "fm2cmd.h"                     // Data declaration(s) | 
|---|
| [1471] | 163 | #include "printer.h"                    // Data declaration(s) | 
|---|
|  | 164 | #include "flesh.h"                      // Data declaration(s) | 
|---|
|  | 165 | #include "worker.h"                     // Data declaration(s) | 
|---|
|  | 166 | #include "filldir.h"                    // Data declaration(s) | 
|---|
|  | 167 | #include "defview.h"                    // Data declaration(s) | 
|---|
|  | 168 | #include "draglist.h"                   // Data declaration(s) | 
|---|
| [2] | 169 | #include "fm3dlg.h" | 
|---|
| [133] | 170 | #include "datamin.h" | 
|---|
| [2] | 171 | #include "tools.h" | 
|---|
|  | 172 | #include "fm3str.h" | 
|---|
|  | 173 | #include "version.h" | 
|---|
| [1471] | 174 | #include "pathutil.h"                   // BldFullPathName | 
|---|
|  | 175 | #include "arccnrs.h"                    // ArcClientWndProc | 
|---|
|  | 176 | #include "errutil.h"                    // Dos_Error... | 
|---|
|  | 177 | #include "strutil.h"                    // GetPString | 
|---|
|  | 178 | #include "valid.h"                      // ArgDriveFlags | 
|---|
|  | 179 | #include "autoview.h"                   // AutoViewProc | 
|---|
| [1156] | 180 | #include "mainwnd.h"                    // BubbleProc, ChildButtonProc, DriveBackProc, | 
|---|
| [1335] | 181 | // DriveProc, LEDProc, MainWndProc, StatusProc | 
|---|
|  | 182 | // ToolBackProc | 
|---|
| [1156] | 183 | #include "collect.h"                    // CollectorClientWndProc, CollectorTextProc | 
|---|
|  | 184 | #include "getnames.h"                   // CustomFileDlg | 
|---|
|  | 185 | #include "notify.h"                     // EndNote | 
|---|
|  | 186 | #include "valid.h"                      // FillInDriveFlags, IsValidDir | 
|---|
|  | 187 | #include "inis.h"                       // IniProc | 
|---|
|  | 188 | #include "viewer.h"                     // MLEEditorProc | 
|---|
|  | 189 | #include "mainwnd2.h"                   // MainWndProc2 | 
|---|
|  | 190 | #include "notify.h"                     // NotifyWndProc | 
|---|
|  | 191 | #include "treecnr.h"                    // OpenButtonProc | 
|---|
| [1209] | 192 | #include "seeall.h"                     // SeeAllWndProc, SeeStatusProc | 
|---|
|  | 193 | #include "timer.h"                      // StartTimer, StopTimer | 
|---|
|  | 194 | #include "treecnr.h"                    // TreeClientWndProc, TreeStatProc | 
|---|
|  | 195 | #include "newview.h"                    // ViewStatusProc, ViewWndProc | 
|---|
|  | 196 | #include "subj.h"                       // Subject | 
|---|
|  | 197 | #include "select.h"                     // UnHilite | 
|---|
|  | 198 | #include "dirs.h"                       // save_dir | 
|---|
|  | 199 | #include "copyf.h"                      // unlinkf | 
|---|
|  | 200 | #include "wrappers.h"                   // xDosSetPathInfo | 
|---|
| [1156] | 201 | #include "misc.h"                       // HeapThread, LoadDetailsSwitches | 
|---|
|  | 202 | #include "notebook.h"                   // command line variables (editor etc) | 
|---|
| [1209] | 203 | #include "strips.h"                     // bstrip | 
|---|
|  | 204 | #include "killproc.h"                   // GetDosPgmName | 
|---|
| [1750] | 205 | #include "srchpath.h"                   // Search*Path*ForFile | 
|---|
| [1012] | 206 | #include "fortify.h" | 
|---|
| [1335] | 207 | #include "excputil.h"                   // xbeginthread | 
|---|
| [1369] | 208 | #include "systemf.h"                    // runemf2 | 
|---|
| [2] | 209 |  | 
|---|
| [189] | 210 | extern int _CRT_init(void); | 
|---|
| [2] | 211 | extern void _CRT_term(void); | 
|---|
|  | 212 |  | 
|---|
| [952] | 213 | #ifdef __WATCOMC__ | 
|---|
|  | 214 | #define a(x) #x | 
|---|
|  | 215 | #define b(x) a(x) | 
|---|
|  | 216 | // Must be global to prevent warnings | 
|---|
|  | 217 | PSZ pszBuiltWith = "Built with OpenWatcom version " b(__WATCOMC__); | 
|---|
|  | 218 | #undef b | 
|---|
|  | 219 | #undef a | 
|---|
|  | 220 | #endif | 
|---|
|  | 221 |  | 
|---|
| [1224] | 222 | static VOID FindSwapperDat(VOID); | 
|---|
| [1217] | 223 |  | 
|---|
| [1209] | 224 | // Data definitions | 
|---|
| [339] | 225 | static PSZ pszSrcFile = __FILE__; | 
|---|
| [1377] | 226 | unsigned __MaxThreads = {48}; | 
|---|
| [2] | 227 |  | 
|---|
| [1209] | 228 | #pragma data_seg(GLOBAL1) | 
|---|
| [1313] | 229 | HMTX hmtxFM2Delete; | 
|---|
| [1303] | 230 | HMTX hmtxFM2Globals; | 
|---|
| [1553] | 231 | HMTX hmtxScanning; | 
|---|
| [1786] | 232 | HMTX hmtxFiltering; | 
|---|
| [1551] | 233 | HEV  hevTreeCnrScanComplete; | 
|---|
| [1209] | 234 | ULONG OS2ver[2]; | 
|---|
|  | 235 | PFNWP PFNWPCnr; | 
|---|
|  | 236 | PFNWP PFNWPMLE; | 
|---|
|  | 237 | CHAR ThousandsSeparator[2]; | 
|---|
| [1395] | 238 | CHAR DateSeparator[2]; | 
|---|
|  | 239 | CHAR TimeSeparator[2]; | 
|---|
|  | 240 | ULONG ulTimeFmt; | 
|---|
|  | 241 | ULONG ulDateFmt; | 
|---|
| [1551] | 242 | ULONG ulScanPostCnt; | 
|---|
| [1451] | 243 | BOOL fDontSuggestAgain; | 
|---|
| [1320] | 244 | BOOL fInitialDriveScan; | 
|---|
| [1209] | 245 | BOOL fAmAV2; | 
|---|
|  | 246 | BOOL fChangeTarget; | 
|---|
|  | 247 | BOOL fIniExisted; | 
|---|
|  | 248 | BOOL fLogFile; | 
|---|
| [1369] | 249 | BOOL fProtectOnly; | 
|---|
| [1209] | 250 | BOOL fReminimize; | 
|---|
|  | 251 | BOOL fWantFirstTimeInit; | 
|---|
| [1720] | 252 | BOOL fUseShellEnv; | 
|---|
| [1753] | 253 | BOOL fDontAskBzip; | 
|---|
|  | 254 | BOOL fDontAskGzip; | 
|---|
| [1402] | 255 | //BOOL fDrivetoSkip[26]; | 
|---|
| [1209] | 256 | HPOINTER hptrApp; | 
|---|
|  | 257 | HPOINTER hptrArc; | 
|---|
|  | 258 | HPOINTER hptrArrow; | 
|---|
|  | 259 | HPOINTER hptrArt; | 
|---|
|  | 260 | HPOINTER hptrBusy; | 
|---|
|  | 261 | HPOINTER hptrCDROM; | 
|---|
|  | 262 | HPOINTER hptrDrive; | 
|---|
|  | 263 | HPOINTER hptrEW; | 
|---|
|  | 264 | HPOINTER hptrFloppy; | 
|---|
|  | 265 | HPOINTER hptrNS; | 
|---|
|  | 266 | HPOINTER hptrRamdisk; | 
|---|
|  | 267 | HPOINTER hptrRemote; | 
|---|
|  | 268 | HPOINTER hptrRemovable; | 
|---|
|  | 269 | HPOINTER hptrVirtual; | 
|---|
|  | 270 | HPOINTER hptrZipstrm; | 
|---|
|  | 271 | CHAR *pFM2SaveDirectory; | 
|---|
|  | 272 | CHAR *pTmpDir; | 
|---|
|  | 273 |  | 
|---|
|  | 274 | #pragma data_seg(GLOBAL2) | 
|---|
| [1402] | 275 | PCSZ PCSZ_ARCHIVERBB2 = "ARCHIVER.BB2"; | 
|---|
|  | 276 | PCSZ PCSZ_ASSOCDAT    = "ASSOC.DAT"; | 
|---|
|  | 277 | PCSZ PCSZ_CMDLINESDAT = "CMDLINES.DAT"; | 
|---|
|  | 278 | PCSZ PCSZ_CMDMINIDAT  = "CMDMINI.DAT"; | 
|---|
|  | 279 | PCSZ PCSZ_COMMANDSDAT = "COMMANDS.DAT"; | 
|---|
|  | 280 | PCSZ PCSZ_FILTERSDAT  = "FILTERS.DAT"; | 
|---|
|  | 281 | PCSZ PCSZ_GREPMASKDAT = "GREPMASK.DAT"; | 
|---|
|  | 282 | PCSZ PCSZ_PATTERNSDAT = "PATTERNS.DAT"; | 
|---|
|  | 283 | PCSZ PCSZ_RESOURCEDAT = "RESOURCE.DAT"; | 
|---|
|  | 284 | PCSZ PCSZ_QUICKTLSDAT = "QUICKTLS.DAT"; | 
|---|
|  | 285 | PCSZ PCSZ_FM3TOOLSDAT = "FM3TOOLS.DAT"; | 
|---|
|  | 286 | PCSZ PCSZ_USERDIRSDAT = "USERDIRS.DAT"; | 
|---|
|  | 287 | PCSZ PCSZ_FM2PLAYEXE  = "FM2PLAY.EXE"; | 
|---|
| [1479] | 288 | PCSZ PCSZ_IMAGEEXE    = "IMAGE.EXE"; | 
|---|
| [1402] | 289 | PCSZ PCSZ_FM2PLAYTEMP = "$FM2PLAY.$$$"; | 
|---|
|  | 290 | PCSZ PCSZ_LVMGUICMD   = "LVMGUI.CMD"; | 
|---|
|  | 291 | PCSZ PCSZ_DFSOS2EXE   = "DFSOS2.EXE"; | 
|---|
|  | 292 | PCSZ PCSZ_MINILVMEXE  = "MINILVM.EXE"; | 
|---|
|  | 293 | PCSZ PCSZ_FDISKPMEXE  = "FDISKPM.EXE"; | 
|---|
|  | 294 | PCSZ PCSZ_LVMEXE      = "LVM.EXE"; | 
|---|
| [1664] | 295 | PCSZ PCSZ_UNLOCKEXE   = "UNLOCK.EXE"; | 
|---|
| [1402] | 296 | PCSZ PCSZ_ARCCNR      = "ArcCnr"; | 
|---|
|  | 297 | PCSZ PCSZ_COLLECTOR   = "Collector"; | 
|---|
|  | 298 | PCSZ PCSZ_DIRCNR      = "DirCnr"; | 
|---|
| [1409] | 299 | PCSZ PCSZ_DIRCMP      = "DirCmp"; | 
|---|
| [1402] | 300 | PCSZ PCSZ_DIRSIZES    = "DirSizes"; | 
|---|
| [1654] | 301 | PCSZ PCSZ_NOTIFYWND   = "NotifyWnd"; | 
|---|
| [1402] | 302 | PCSZ PCSZ_TOOLBAR     = "ToolBar"; | 
|---|
|  | 303 | PCSZ PCSZ_TREECNR     = "TreeCnr"; | 
|---|
|  | 304 | PCSZ PCSZ_SHUTDOWNSTATE    =  "FM2Shutdown"; | 
|---|
|  | 305 | PCSZ PCSZ_FM2TEMPTEXT      =  "FM/2_Temp"; | 
|---|
|  | 306 | PCSZ DRF_FM2ARCHIVE   = "DRF_FM2ARCHIVE"; | 
|---|
|  | 307 | PCSZ DRMDRFFM2ARC     = "<DRM_FM2ARCMEMBER,DRF_FM2ARCHIVE>"; | 
|---|
|  | 308 | PCSZ DRMDRFOS2FILE    = "<DRM_OS2FILE,DRF_UNKNOWN>"; | 
|---|
|  | 309 | PCSZ DRM_FM2ARCMEMBER = "DRM_FM2ARCMEMBER"; | 
|---|
|  | 310 | PCSZ DRM_OS2FILE      = "DRM_OS2FILE"; | 
|---|
|  | 311 | PCSZ FM2Str           = "FM/2"; | 
|---|
| [1209] | 312 | HMODULE FM3DllHandle; | 
|---|
| [1402] | 313 | PCSZ FM3Folder        = "<FM3_Folder>"; | 
|---|
| [1436] | 314 | PCSZ FNT_HELVETICA        =  "Helvetica"; | 
|---|
| [1402] | 315 | PCSZ FNT_6HELVETICA       =  "6.Helvetica"; | 
|---|
|  | 316 | PCSZ FNT_8HELVETICA       =  "8.Helvetica"; | 
|---|
|  | 317 | PCSZ FNT_8HELVETICABOLD   =  "8.Helvetica.Bold"; | 
|---|
|  | 318 | PCSZ FNT_10SYSTEMMONOTEXT =  "10.System Monospaced"; | 
|---|
|  | 319 | PCSZ FNT_10SYSTEMPROPORT  =  "10.System Proportional"; | 
|---|
|  | 320 | PCSZ FNT_2SYSTEMVIO       =  "2.System VIO"; | 
|---|
|  | 321 | PCSZ FNT_4SYSTEMVIO       =  "4.System VIO"; | 
|---|
|  | 322 | PCSZ FNT_10SYSTEMVIO      =  "10.System VIO"; | 
|---|
|  | 323 | PCSZ FNT_8TIMESNEWROMAN   =  "8.Times New Roman"; | 
|---|
| [1209] | 324 | CHAR HomePath[CCHMAXPATH]; | 
|---|
| [1402] | 325 | PCSZ LONGNAME             = ".LONGNAME"; | 
|---|
|  | 326 | CHAR *NullStr             = ""; | 
|---|
|  | 327 | PCSZ PCSZ_CM_ALLOCRECORD  = "CM_ALLOCRECORD"; | 
|---|
| [1673] | 328 | PCSZ PCSZ_QUERYCNRINFO    = "CM_QUERYCNRINFO"; | 
|---|
| [1402] | 329 | PCSZ PCSZ_DOSCREATEMUTEXSEM =  "DosCreateMutexSem"; | 
|---|
| [1450] | 330 | PCSZ PCSZ_DOSCREATEEVENTSEM =  "DosCreateEventSem"; | 
|---|
| [1402] | 331 | PCSZ PCSZ_DOSDUPHANDLE    =  "DosDupHandle"; | 
|---|
|  | 332 | PCSZ PCSZ_DOSGETINFOBLOCKS = "DosGetInfoBlocks"; | 
|---|
|  | 333 | PCSZ PCSZ_DOSQUERYPATHINFO = "DosQueryPathInfo"; | 
|---|
|  | 334 | PCSZ PCSZ_DOSSEARCHPATH    = "DosSearchPath"; | 
|---|
|  | 335 | PCSZ PCSZ_DRGACCESSDRAGINFO = "DrgAccessDraginfo"; | 
|---|
|  | 336 | PCSZ PCSZ_POSTMSG          = "PostMsg"; | 
|---|
|  | 337 | PCSZ PCSZ_WINCREATEWINDOW  = "WinCreateWindow"; | 
|---|
|  | 338 | PCSZ PCSZ_WINLOADACCELTABLE  = "WinLoadAccelTable"; | 
|---|
|  | 339 | PCSZ PCSZ_WINSETACCELTABLE  =  "WinSetAccelTable"; | 
|---|
|  | 340 | PCSZ PCSZ_INIQUERYPRFTEXT =  "PrfQueryProfile"; | 
|---|
|  | 341 | PCSZ PCSZ_PRFOPENPROFILEFAILED = "PrfOpenProfile failed for %s"; | 
|---|
|  | 342 | PCSZ PCSZ_PRFQUERYPROFILEDATA = "PrfQueryProfileData"; | 
|---|
|  | 343 | PCSZ PCSZ_PRFQUERYPROFILESIZE = "PrfQueryProfileSize"; | 
|---|
|  | 344 | PCSZ PCSZ_PRFQUERYPROFILESTRING = "PrfQueryProfileString"; | 
|---|
|  | 345 | PCSZ PCSZ_FILLDIRQCURERRTEXT = "DosQCurDisk"; | 
|---|
|  | 346 | PCSZ PCSZ_NODATA  =  "No Data"; | 
|---|
| [1438] | 347 | PCSZ PCSZ_BACKSLASH     = "\\"; | 
|---|
| [1402] | 348 | PCSZ PCSZ_STARDOTEXE    =  "*.EXE"; | 
|---|
|  | 349 | PCSZ PCSZ_STARDOTINI    =  "*.INI"; | 
|---|
|  | 350 | PCSZ PCSZ_STARDOTLST    =  "*.LST"; | 
|---|
|  | 351 | PCSZ PCSZ_STARDOTPMD    =  "*.PMD"; | 
|---|
|  | 352 | PCSZ PCSZ_STARDOTTXT    =  "*.TXT"; | 
|---|
| [1607] | 353 | PCSZ PCSZ_FM3DOTINI     =  "FM3.INI"; | 
|---|
|  | 354 | PCSZ PCSZ_FM3INI        =  "FM3INI"; | 
|---|
|  | 355 | PCSZ PCSZ_FM3INIDOTBAK  =  "FM3INI.BAK"; | 
|---|
|  | 356 | PCSZ PCSZ_FM3INIDOTBAD  =  "FM3INI.BAD"; | 
|---|
|  | 357 | PCSZ PCSZ_FM3INIDOTBAD2 =  "FM3INI.BAD2"; | 
|---|
|  | 358 | PCSZ PCSZ_FM3RES        =  "FM3RES"; | 
|---|
|  | 359 | PCSZ PCSZ_FM3DOTHLP     =  "FM3.HLP"; | 
|---|
| [1402] | 360 | PCSZ PCSZ_DOTEXE   =  ".EXE"; | 
|---|
|  | 361 | PCSZ PCSZ_DOTCOM   =  ".COM"; | 
|---|
|  | 362 | PCSZ PCSZ_DOTCMD   =  ".CMD"; | 
|---|
|  | 363 | PCSZ PCSZ_DOTBTM   =  ".BTM"; | 
|---|
|  | 364 | PCSZ PCSZ_DOTBAT   =  ".BAT"; | 
|---|
|  | 365 | PCSZ PCSZ_DOTLST   =  ".LST"; | 
|---|
|  | 366 | PCSZ PCSZ_DOTTLS   =  ".TLS"; | 
|---|
|  | 367 | PCSZ PCSZ_DOTHLP   =  ".HLP"; | 
|---|
|  | 368 | PCSZ PCSZ_DOTINF   =  ".INF"; | 
|---|
|  | 369 | PCSZ PCSZ_DOTMP3   =  ".MP3"; | 
|---|
| [1479] | 370 | PCSZ PCSZ_DOTMPG   =  ".MPG"; | 
|---|
|  | 371 | PCSZ PCSZ_DOTMPEG  =  ".MPEG"; | 
|---|
| [1402] | 372 | PCSZ PCSZ_DOTOGG   =  ".OGG"; | 
|---|
|  | 373 | PCSZ PCSZ_DOTFLAC  =  ".FLAC"; | 
|---|
|  | 374 | PCSZ PCSZ_DOTJPEG  =  ".JPEG"; | 
|---|
|  | 375 | PCSZ PCSZ_DOTJPG   =  ".JPG"; | 
|---|
|  | 376 | PCSZ PCSZ_DOTICO   =  ".ICO"; | 
|---|
|  | 377 | PCSZ PCSZ_DOTPTR   =  ".PTR"; | 
|---|
|  | 378 | PCSZ PCSZ_DOTBB2   =  ".BB2"; | 
|---|
|  | 379 | PCSZ PCSZ_DOTBMP   =  ".BMP"; | 
|---|
|  | 380 | PCSZ PCSZ_DOTCOMMENTS   =  ".COMMENTS"; | 
|---|
|  | 381 | PCSZ PCSZ_PATH     =  "PATH"; | 
|---|
|  | 382 | PCSZ PCSZ_LIBPATH       =  "LIBPATH"; | 
|---|
|  | 383 | CHAR *pLibPathStrict = "SET LIBPATHSTRICT=TRUE"; | 
|---|
|  | 384 | PCSZ PCSZ_WPURLDEFAULTSETTINGS = "WPURLDEFAULTSETTINGS"; | 
|---|
|  | 385 | PCSZ Settings      = "SETTINGS"; | 
|---|
|  | 386 | PCSZ Details       = "DETAILS"; | 
|---|
|  | 387 | PCSZ PCSZ_TREE     = "TREE"; | 
|---|
|  | 388 | PCSZ PCSZ_ICON     = "ICON"; | 
|---|
| [1209] | 389 | CHAR SwapperDat[CCHMAXPATH]; | 
|---|
| [1402] | 390 | PCSZ WC_OBJECTWINDOW    =  "WC_OBJECTWINDOW"; | 
|---|
|  | 391 | PCSZ WC_BUBBLE          =  "WC_BUBBLE"; | 
|---|
|  | 392 | PCSZ WC_TOOLBUTTONS     =  "WC_TOOLBUTTONS"; | 
|---|
|  | 393 | PCSZ WC_DRIVEBUTTONS    =  "WC_DRIVEBUTTONS"; | 
|---|
|  | 394 | PCSZ WC_DIRCONTAINER    =  "WC_DIRCONTAINER"; | 
|---|
|  | 395 | PCSZ WC_DIRSTATUS       =  "WC_DIRSTATUS"; | 
|---|
|  | 396 | PCSZ WC_TREECONTAINER   =  "WC_TREECONTAINER"; | 
|---|
|  | 397 | PCSZ WC_TREEOPENBUTTON  =  "WC_TREEOPENBUTTON"; | 
|---|
|  | 398 | PCSZ WC_TREESTATUS      =  "WC_TREESTATUS"; | 
|---|
|  | 399 | PCSZ WC_MAINWND         =  "WC_MAINWND"; | 
|---|
|  | 400 | PCSZ WC_MAINWND2        =  "WC_MAINWND2"; | 
|---|
|  | 401 | PCSZ WC_AUTOVIEW        =  "WC_AUTOVIEW"; | 
|---|
|  | 402 | PCSZ WC_LED             =  "WC_LED"; | 
|---|
|  | 403 | PCSZ WC_COLLECTOR       =  "WC_COLLECTOR"; | 
|---|
|  | 404 | PCSZ WC_COLSTATUS       =  "WC_COLSTATUS"; | 
|---|
|  | 405 | PCSZ WC_STATUS          =  "WC_STATUS"; | 
|---|
|  | 406 | PCSZ WC_TOOLBACK        =  "WC_TOOLBACK"; | 
|---|
|  | 407 | PCSZ WC_DRIVEBACK       =  "WC_DRIVEBACK"; | 
|---|
|  | 408 | PCSZ WC_ARCCONTAINER    =  "WC_ARCCONTAINER"; | 
|---|
|  | 409 | PCSZ WC_ARCSTATUS       =  "WC_ARCSTATUS"; | 
|---|
|  | 410 | PCSZ WC_MLEEDITOR       =  "WC_MLEEDITOR"; | 
|---|
|  | 411 | PCSZ WC_INIEDITOR       =  "WC_INIEDITOR"; | 
|---|
|  | 412 | PCSZ WC_SEEALL          =  "WC_SEEALL"; | 
|---|
|  | 413 | PCSZ WC_NEWVIEW         =  "WC_NEWVIEW"; | 
|---|
|  | 414 | PCSZ WC_SEESTATUS       =  "WC_SEESTATUS"; | 
|---|
|  | 415 | PCSZ WC_VIEWSTATUS      =  "WC_VIEWSTATUS"; | 
|---|
|  | 416 | PCSZ WC_ERRORWND        =  "WC_ERRORWND"; | 
|---|
|  | 417 | PCSZ WC_MINITIME        =  "WC_MINITIME"; | 
|---|
|  | 418 | PCSZ WC_DATABAR         =  "WC_DATABAR"; | 
|---|
| [1209] | 419 | CHAR profile[CCHMAXPATH]; | 
|---|
| [1482] | 420 | ULONGLONG ullTmpSpaceNeeded = 5120000; | 
|---|
| [1156] | 421 |  | 
|---|
| [985] | 422 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset); | 
|---|
|  | 423 |  | 
|---|
| [189] | 424 | VOID FindSwapperDat(VOID) | 
|---|
|  | 425 | { | 
|---|
| [201] | 426 | CHAR filename[] = "C:\\CONFIG.SYS"; | 
|---|
|  | 427 | CHAR input[8192]; | 
|---|
|  | 428 | CHAR *p; | 
|---|
|  | 429 | CHAR *pp; | 
|---|
| [189] | 430 | FILE *fp; | 
|---|
| [849] | 431 | FILEFINDBUF3L ffb; | 
|---|
| [201] | 432 | ULONG nm; | 
|---|
|  | 433 | ULONG size = sizeof(SwapperDat); | 
|---|
| [189] | 434 | HDIR hdir = HDIR_CREATE; | 
|---|
| [201] | 435 | APIRET rc = 1; | 
|---|
| [1544] | 436 | CHAR *moder = "r"; | 
|---|
| [2] | 437 |  | 
|---|
|  | 438 | *SwapperDat = 0; | 
|---|
| [201] | 439 | // Check already known | 
|---|
| [1498] | 440 | PrfQueryProfileData(fmprof, (CHAR *) FM3Str, "SwapperDat", SwapperDat, &size); | 
|---|
| [551] | 441 | if (*SwapperDat) { | 
|---|
| [201] | 442 | nm = 1; | 
|---|
| [843] | 443 | rc = DosFindFirst(SwapperDat, | 
|---|
| [1335] | 444 | &hdir, | 
|---|
|  | 445 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 446 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
|  | 447 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL); | 
|---|
| [850] | 448 | if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) { | 
|---|
| [849] | 449 | FILEFINDBUF3 ffb; | 
|---|
|  | 450 | rc = DosFindFirst(SwapperDat, | 
|---|
| [1335] | 451 | &hdir, | 
|---|
|  | 452 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 453 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
|  | 454 | &ffb, sizeof(ffb), &nm, FIL_STANDARD); | 
|---|
| [849] | 455 | fNoLargeFileSupport = TRUE; | 
|---|
|  | 456 | } | 
|---|
| [551] | 457 | if (!rc) { | 
|---|
| [2] | 458 | DosFindClose(hdir); | 
|---|
| [1544] | 459 | fp = xfopen(SwapperDat, moder, pszSrcFile, __LINE__, TRUE); | 
|---|
| [551] | 460 | if (fp) { | 
|---|
| [1335] | 461 | fclose(fp); | 
|---|
|  | 462 | *SwapperDat = 0; | 
|---|
|  | 463 | rc = 1;                         // Force config.sys scan | 
|---|
| [2] | 464 | } | 
|---|
|  | 465 | } | 
|---|
|  | 466 | else | 
|---|
|  | 467 | *SwapperDat = 0; | 
|---|
|  | 468 | } | 
|---|
| [201] | 469 | // If not defined in INI or INI wrong, scan config.sys for SWAPPATH statement | 
|---|
| [551] | 470 | if (rc) { | 
|---|
| [189] | 471 | if (DosQuerySysInfo(QSV_BOOT_DRIVE, | 
|---|
| [1335] | 472 | QSV_BOOT_DRIVE, | 
|---|
|  | 473 | &nm, | 
|---|
|  | 474 | sizeof(ULONG))) { | 
|---|
| [1156] | 475 | nm = 3;                           // Assume drive C: | 
|---|
| [201] | 476 | } | 
|---|
| [551] | 477 | *filename = (CHAR) nm + '@'; | 
|---|
| [1544] | 478 | fp = xfsopen(filename, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE); | 
|---|
| [551] | 479 | if (fp) { | 
|---|
| [404] | 480 | while (!feof(fp)) { | 
|---|
| [1335] | 481 | if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__)) | 
|---|
|  | 482 | break; | 
|---|
|  | 483 | lstrip(input); | 
|---|
|  | 484 | if (!strnicmp(input, "SWAPPATH", 8)) { | 
|---|
|  | 485 | p = input + 8; | 
|---|
|  | 486 | while (*p == ' ') | 
|---|
|  | 487 | p++; | 
|---|
|  | 488 | if (*p == '=') { | 
|---|
|  | 489 | p++; | 
|---|
| [1480] | 490 | bstripcr(p); | 
|---|
| [1335] | 491 | if (*p == '\"') { | 
|---|
|  | 492 | p++; | 
|---|
|  | 493 | pp = p; | 
|---|
|  | 494 | while (*pp && *pp != '\"') | 
|---|
|  | 495 | *pp += 1; | 
|---|
|  | 496 | if (*pp) | 
|---|
|  | 497 | *pp = 0; | 
|---|
|  | 498 | } | 
|---|
|  | 499 | else { | 
|---|
|  | 500 | pp = strchr(p, ' '); | 
|---|
|  | 501 | if (pp) | 
|---|
|  | 502 | *pp = 0; | 
|---|
|  | 503 | } | 
|---|
|  | 504 | if (*p) { | 
|---|
|  | 505 | strncpy(SwapperDat, p, CCHMAXPATH); | 
|---|
|  | 506 | SwapperDat[CCHMAXPATH - 1] = 0; | 
|---|
|  | 507 | BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT"); | 
|---|
|  | 508 | hdir = HDIR_CREATE; | 
|---|
|  | 509 | nm = 1; | 
|---|
|  | 510 | rc = DosFindFirst(SwapperDat, | 
|---|
|  | 511 | &hdir, | 
|---|
|  | 512 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 513 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
| [1480] | 514 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL); | 
|---|
| [1335] | 515 | if (rc){ | 
|---|
|  | 516 | FILEFINDBUF3 ffb; | 
|---|
|  | 517 | rc = DosFindFirst(SwapperDat, | 
|---|
|  | 518 | &hdir, | 
|---|
|  | 519 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 520 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
|  | 521 | &ffb, sizeof(ffb), &nm, FIL_STANDARD); | 
|---|
|  | 522 | fNoLargeFileSupport = TRUE; | 
|---|
|  | 523 | } | 
|---|
|  | 524 | if (!rc) { | 
|---|
|  | 525 | DosFindClose(hdir); | 
|---|
|  | 526 | PrfWriteProfileString(fmprof, | 
|---|
| [1505] | 527 | FM3Str, "SwapperDat", SwapperDat); | 
|---|
| [1335] | 528 | } | 
|---|
|  | 529 | else | 
|---|
|  | 530 | *SwapperDat = 0; | 
|---|
|  | 531 | break; | 
|---|
|  | 532 | } | 
|---|
|  | 533 | } | 
|---|
|  | 534 | }                               // if SWAPPATH | 
|---|
| [1156] | 535 | }                                 // while | 
|---|
| [2] | 536 | fclose(fp); | 
|---|
|  | 537 | } | 
|---|
|  | 538 | } | 
|---|
|  | 539 | } | 
|---|
|  | 540 |  | 
|---|
| [690] | 541 | unsigned APIENTRY LibMain(unsigned hModule, | 
|---|
| [1335] | 542 | unsigned ulFlag) | 
|---|
| [690] | 543 | { | 
|---|
|  | 544 | switch (ulFlag) { | 
|---|
|  | 545 | case 0: | 
|---|
|  | 546 | FM3DllHandle = hModule; | 
|---|
|  | 547 |  | 
|---|
|  | 548 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 549 | memset(&RGBBLACK, 0, sizeof(RGB2)); | 
|---|
|  | 550 | RGBGREY.bRed = RGBGREY.bGreen = RGBGREY.bBlue = (BYTE)204; | 
|---|
|  | 551 | RGBGREY.fcOptions = 0; | 
|---|
| [1505] | 552 | FM3UL = *(ULONG *) FM3Str; | 
|---|
| [690] | 553 | break; | 
|---|
|  | 554 | case 1: | 
|---|
|  | 555 | StopPrinting = 1; | 
|---|
|  | 556 | if (fmprof) | 
|---|
|  | 557 | PrfCloseProfile(fmprof); | 
|---|
|  | 558 | DosError(FERR_ENABLEHARDERR); | 
|---|
|  | 559 | break; | 
|---|
|  | 560 | default: | 
|---|
|  | 561 | return 0UL; | 
|---|
|  | 562 | } | 
|---|
|  | 563 | return 1UL; | 
|---|
|  | 564 | } | 
|---|
|  | 565 |  | 
|---|
| [189] | 566 | VOID APIENTRY DeInitFM3DLL(ULONG why) | 
|---|
|  | 567 | { | 
|---|
| [1673] | 568 | // cleanup | 
|---|
| [189] | 569 | static CHAR s[CCHMAXPATH]; | 
|---|
| [1075] | 570 | CHAR *enddir, szTempFile[CCHMAXPATH]; | 
|---|
| [189] | 571 | HDIR search_handle; | 
|---|
|  | 572 | ULONG num_matches; | 
|---|
| [843] | 573 | FILEFINDBUF3 ffb; | 
|---|
| [2] | 574 |  | 
|---|
|  | 575 | StopTimer(); | 
|---|
|  | 576 | StopPrinting = 1; | 
|---|
|  | 577 |  | 
|---|
| [189] | 578 | if (LogFileHandle) | 
|---|
| [2] | 579 | fclose(LogFileHandle); | 
|---|
|  | 580 |  | 
|---|
| [551] | 581 | if (fmprof) { | 
|---|
| [2] | 582 | PrfCloseProfile(fmprof); | 
|---|
| [189] | 583 | fmprof = (HINI) 0; | 
|---|
| [551] | 584 | if (fIniExisted) { | 
|---|
| [2] | 585 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [1607] | 586 | DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAK, DCPY_EXISTING); | 
|---|
| [2] | 587 | } | 
|---|
|  | 588 | } | 
|---|
|  | 589 |  | 
|---|
| [189] | 590 | if (fToolsChanged) | 
|---|
| [2] | 591 | save_tools(NULL); | 
|---|
| [689] | 592 | fcloseall(); | 
|---|
| [2] | 593 | save_dir(s); | 
|---|
| [1438] | 594 | AddBackslashToPath(s); | 
|---|
| [2] | 595 | enddir = &s[strlen(s)]; | 
|---|
| [551] | 596 | if (*ArcTempRoot) { | 
|---|
| [189] | 597 | strcat(s, ArcTempRoot); | 
|---|
|  | 598 | strcat(s, "*"); | 
|---|
| [2] | 599 | search_handle = HDIR_CREATE; | 
|---|
|  | 600 | num_matches = 1L; | 
|---|
| [843] | 601 | if (!DosFindFirst(s, | 
|---|
| [1335] | 602 | &search_handle, | 
|---|
|  | 603 | FILE_NORMAL | FILE_DIRECTORY | | 
|---|
|  | 604 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | | 
|---|
|  | 605 | FILE_ARCHIVED, | 
|---|
|  | 606 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { | 
|---|
| [551] | 607 | do { | 
|---|
| [1335] | 608 | strcpy(enddir, ffb.achName); | 
|---|
|  | 609 | if (ffb.attrFile & FILE_DIRECTORY) { | 
|---|
| [1739] | 610 | wipeallf(TRUE, "%s\\*", s); | 
|---|
| [1335] | 611 | DosDeleteDir(s); | 
|---|
|  | 612 | } | 
|---|
|  | 613 | else | 
|---|
| [1402] | 614 | unlinkf(s); | 
|---|
| [189] | 615 | } | 
|---|
| [843] | 616 | while (!DosFindNext(search_handle, | 
|---|
| [1335] | 617 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
| [2] | 618 | DosFindClose(search_handle); | 
|---|
|  | 619 | } | 
|---|
|  | 620 | } | 
|---|
| [1082] | 621 | if (pTmpDir) | 
|---|
|  | 622 | strcpy(s, pTmpDir); | 
|---|
|  | 623 | else | 
|---|
| [1104] | 624 | strcpy(s, pFM2SaveDirectory); | 
|---|
| [1438] | 625 | AddBackslashToPath(s); | 
|---|
| [2] | 626 | enddir = &s[strlen(s)]; | 
|---|
| [1089] | 627 | strcat(s, "$FM2LI$T."); | 
|---|
| [189] | 628 | strcat(s, "???"); | 
|---|
| [2] | 629 | search_handle = HDIR_CREATE; | 
|---|
| [838] | 630 | num_matches = 1; | 
|---|
| [843] | 631 | if (!DosFindFirst(s, | 
|---|
| [1335] | 632 | &search_handle, | 
|---|
|  | 633 | FILE_NORMAL | FILE_DIRECTORY | | 
|---|
|  | 634 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | | 
|---|
|  | 635 | FILE_ARCHIVED, | 
|---|
|  | 636 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { | 
|---|
| [551] | 637 | do { | 
|---|
| [843] | 638 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
| [1335] | 639 | strcpy(enddir, ffb.achName); | 
|---|
| [1402] | 640 | unlinkf(s); | 
|---|
| [2] | 641 | } | 
|---|
| [189] | 642 | } | 
|---|
| [843] | 643 | while (!DosFindNext(search_handle, | 
|---|
| [1335] | 644 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
| [2] | 645 | DosFindClose(search_handle); | 
|---|
|  | 646 | } | 
|---|
| [1398] | 647 | BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP); | 
|---|
| [1075] | 648 | DosForceDelete(szTempFile); | 
|---|
| [1082] | 649 | if (pTmpDir) { | 
|---|
| [1739] | 650 | wipeallf(TRUE, "%s\\*", pTmpDir); | 
|---|
| [1082] | 651 | DosDeleteDir(pTmpDir); | 
|---|
|  | 652 | } | 
|---|
| [2] | 653 | EndNote(); | 
|---|
| [189] | 654 | if (FM3ModHandle) | 
|---|
| [2] | 655 | DosFreeModule(FM3ModHandle); | 
|---|
|  | 656 |  | 
|---|
| [551] | 657 | DosExitList(EXLST_REMOVE, DeInitFM3DLL); | 
|---|
| [2] | 658 | } | 
|---|
|  | 659 |  | 
|---|
| [189] | 660 | BOOL InitFM3DLL(HAB hab, int argc, char **argv) | 
|---|
|  | 661 | { | 
|---|
| [1673] | 662 | /** | 
|---|
| [2] | 663 | * this function should be called by any application using this DLL right | 
|---|
|  | 664 | * after setting up a message queue | 
|---|
|  | 665 | */ | 
|---|
|  | 666 |  | 
|---|
|  | 667 | CLASSINFO clinfo; | 
|---|
| [201] | 668 | APIRET rc; | 
|---|
| [1369] | 669 | APIRET rcl; | 
|---|
|  | 670 | APIRET rcq; | 
|---|
|  | 671 | PFN pfnResVersion; | 
|---|
|  | 672 | ULONG RVMajor; | 
|---|
|  | 673 | ULONG RVMinor; | 
|---|
|  | 674 | ULONG ret; | 
|---|
|  | 675 | FILESTATUS3 fs3; | 
|---|
| [803] | 676 | PSZ env; | 
|---|
| [201] | 677 | CHAR dllfile[CCHMAXPATH]; | 
|---|
| [1603] | 678 | CHAR temp[CCHMAXPATH]; | 
|---|
| [1604] | 679 | CHAR *p; | 
|---|
| [201] | 680 | ULONG size; | 
|---|
| [2] | 681 |  | 
|---|
| [1607] | 682 | strcpy(dllfile, PCSZ_FM3RES); | 
|---|
|  | 683 | env = getenv(PCSZ_FM3INI); | 
|---|
| [551] | 684 | if (env) { | 
|---|
| [201] | 685 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [849] | 686 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| [551] | 687 | if (!rc) { | 
|---|
| [803] | 688 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| [1607] | 689 | BldFullPathName(dllfile, env, PCSZ_FM3RES);        // 23 Aug 07 SHL | 
|---|
| [1335] | 690 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 691 | if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3))) | 
|---|
| [1607] | 692 | strcpy(dllfile, PCSZ_FM3RES); | 
|---|
| [2] | 693 | } | 
|---|
|  | 694 | } | 
|---|
| [201] | 695 | } | 
|---|
| [1369] | 696 |  | 
|---|
| [551] | 697 | rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle); | 
|---|
|  | 698 | if (rcl) { | 
|---|
| [339] | 699 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
| [1335] | 700 | HWND_DESKTOP, | 
|---|
|  | 701 | GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT)); | 
|---|
| [339] | 702 | return FALSE; | 
|---|
|  | 703 | } | 
|---|
| [1369] | 704 |  | 
|---|
| [339] | 705 | rc = DosExitList(EXLST_ADD, DeInitFM3DLL); | 
|---|
| [551] | 706 | if (rc) { | 
|---|
| [803] | 707 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1335] | 708 | "DosExitList"); | 
|---|
| [339] | 709 | } | 
|---|
| [1369] | 710 |  | 
|---|
| [551] | 711 | rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion); | 
|---|
| [201] | 712 | if (!rcq) | 
|---|
|  | 713 | ret = pfnResVersion(&RVMajor, &RVMinor); | 
|---|
| [1369] | 714 | else { | 
|---|
|  | 715 | ret = 0; | 
|---|
|  | 716 | RVMajor = 0; | 
|---|
|  | 717 | RVMinor = 0; | 
|---|
| [201] | 718 | } | 
|---|
| [1369] | 719 |  | 
|---|
| [551] | 720 | if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) { | 
|---|
| [201] | 721 | saymsg(MB_ENTER, | 
|---|
| [1335] | 722 | HWND_DESKTOP, | 
|---|
|  | 723 | GetPString(IDS_ERRORTEXT), | 
|---|
|  | 724 | GetPString(IDS_FM3RESERROR2TEXT), | 
|---|
|  | 725 | !rcq ? | 
|---|
|  | 726 | GetPString(IDS_FM3RESERROR3TEXT) : | 
|---|
|  | 727 | !rcl ? | 
|---|
|  | 728 | GetPString(IDS_FM3RESERROR4TEXT) : | 
|---|
|  | 729 | GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret); | 
|---|
| [201] | 730 | return FALSE; | 
|---|
| [2] | 731 | } | 
|---|
|  | 732 |  | 
|---|
| [189] | 733 | if (!*profile) | 
|---|
| [1607] | 734 | strcpy(profile, PCSZ_FM3DOTINI); | 
|---|
| [2] | 735 | mypid = getpid(); | 
|---|
| [1673] | 736 | // give default appname if none set by caller | 
|---|
| [189] | 737 | if (!*appname) | 
|---|
| [1505] | 738 | strcpy(appname, FM3Str); | 
|---|
| [1673] | 739 | // save appname; may be reset below | 
|---|
| [189] | 740 | strcpy(realappname, appname); | 
|---|
| [1505] | 741 | if (!strcmp(appname, FM3Str)) | 
|---|
| [803] | 742 | DosSetMaxFH(100); | 
|---|
| [189] | 743 | else if (!strcmp(appname, "VDir") || | 
|---|
| [1335] | 744 | !strcmp(appname, "VTree") || | 
|---|
|  | 745 | !strcmp(appname, "VCollect") || | 
|---|
|  | 746 | !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4")) | 
|---|
| [803] | 747 | DosSetMaxFH(60); | 
|---|
| [2] | 748 | else | 
|---|
| [803] | 749 | DosSetMaxFH(40); | 
|---|
| [2] | 750 |  | 
|---|
| [189] | 751 | if (DosQuerySysInfo(QSV_VERSION_MAJOR, | 
|---|
| [1335] | 752 | QSV_VERSION_MINOR, | 
|---|
|  | 753 | OS2ver, | 
|---|
|  | 754 | sizeof(OS2ver))) { | 
|---|
| [2] | 755 | OS2ver[0] = 2; | 
|---|
|  | 756 | OS2ver[1] = 1; | 
|---|
|  | 757 | } | 
|---|
|  | 758 |  | 
|---|
| [1603] | 759 | //Save the FM2 save directory name. This is the location of the ini, dat files etc. | 
|---|
| [1604] | 760 | rc = save_dir2(temp); | 
|---|
|  | 761 | if (rc) { | 
|---|
|  | 762 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
|  | 763 | HWND_DESKTOP, | 
|---|
|  | 764 | GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3SAVEDIRERROR1TEXT)); | 
|---|
|  | 765 | return FALSE; | 
|---|
|  | 766 | } | 
|---|
| [1603] | 767 | pFM2SaveDirectory = xstrdup(temp, pszSrcFile, __LINE__); | 
|---|
| [1604] | 768 | if (!pFM2SaveDirectory) | 
|---|
|  | 769 | return FALSE; // already complained | 
|---|
| [1082] | 770 | // set up default root names for temp file storage and archive goodies | 
|---|
| [1604] | 771 | env = getenv("TEMP"); | 
|---|
| [1069] | 772 | if (env != NULL) { | 
|---|
| [1604] | 773 | rc = 0; | 
|---|
| [1069] | 774 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 775 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| [1604] | 776 | } | 
|---|
|  | 777 | if (rc || env == NULL) | 
|---|
|  | 778 | env = getenv("TMP"); | 
|---|
|  | 779 | if (env != NULL) { | 
|---|
|  | 780 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 781 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| [1069] | 782 | if (!rc) { | 
|---|
| [1604] | 783 | CHAR *enddir, szTempName[CCHMAXPATH]; | 
|---|
| [1089] | 784 | FILEFINDBUF3 ffb; | 
|---|
|  | 785 | HDIR search_handle; | 
|---|
|  | 786 | ULONG num_matches, ul; | 
|---|
|  | 787 |  | 
|---|
|  | 788 | strcpy(szTempName, env); | 
|---|
| [1438] | 789 | AddBackslashToPath(szTempName); | 
|---|
| [1089] | 790 | enddir = &szTempName[strlen(szTempName)]; | 
|---|
|  | 791 | strcat(szTempName, "$FM2????."); | 
|---|
|  | 792 | strcat(szTempName, "???"); | 
|---|
|  | 793 | search_handle = HDIR_CREATE; | 
|---|
|  | 794 | num_matches = 1; | 
|---|
|  | 795 | if (!DosFindFirst(szTempName, | 
|---|
| [1335] | 796 | &search_handle, | 
|---|
|  | 797 | FILE_NORMAL | FILE_DIRECTORY | | 
|---|
|  | 798 | FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | | 
|---|
|  | 799 | FILE_ARCHIVED, | 
|---|
| [1603] | 800 | &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { | 
|---|
|  | 801 | do { | 
|---|
| [1335] | 802 | strcpy(enddir, ffb.achName); | 
|---|
|  | 803 | p = strrchr(szTempName, '.'); | 
|---|
|  | 804 | if (p) { | 
|---|
|  | 805 | p++; | 
|---|
| [1777] | 806 | ul = strtoul(p, NULL, 16); | 
|---|
| [1335] | 807 | GetDosPgmName(ul, temp); | 
|---|
|  | 808 | if (!strstr(temp, "FM/2") && | 
|---|
|  | 809 | !strstr(temp, "AV/2")) { | 
|---|
| [1710] | 810 | wipeallf(TRUE, "%s\\*", szTempName); | 
|---|
| [1335] | 811 | DosDeleteDir(szTempName); | 
|---|
|  | 812 | } | 
|---|
|  | 813 | } | 
|---|
| [1603] | 814 | } | 
|---|
|  | 815 | while (!DosFindNext(search_handle, | 
|---|
|  | 816 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
|  | 817 | DosFindClose(search_handle); | 
|---|
|  | 818 | } | 
|---|
| [1069] | 819 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| [1335] | 820 | strcpy(szTempName, env); | 
|---|
|  | 821 | MakeTempName(szTempName, NULL, 1); | 
|---|
| [1369] | 822 | rc = DosCreateDir(szTempName, 0); | 
|---|
|  | 823 | if (!rc) | 
|---|
| [1554] | 824 | pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);  // if writable | 
|---|
|  | 825 | else | 
|---|
| [1603] | 826 | pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__); | 
|---|
| [1069] | 827 | } | 
|---|
|  | 828 | } | 
|---|
| [1603] | 829 | } | 
|---|
|  | 830 | else | 
|---|
|  | 831 | pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__); | 
|---|
| [1120] | 832 | // Check free space on TMP and FM2 Save drives | 
|---|
| [1112] | 833 | { | 
|---|
|  | 834 | if (pTmpDir && CheckDriveSpaceAvail(pTmpDir, ullTmpSpaceNeeded, 0) == 1) { | 
|---|
|  | 835 | if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 0){ | 
|---|
| [1335] | 836 | ret = saymsg(MB_YESNO, | 
|---|
|  | 837 | HWND_DESKTOP, | 
|---|
|  | 838 | NullStr, | 
|---|
|  | 839 | GetPString(IDS_TMPDRIVESPACELIMITED), | 
|---|
|  | 840 | pTmpDir); | 
|---|
|  | 841 | if (ret == MBID_YES) | 
|---|
|  | 842 | pTmpDir = pFM2SaveDirectory; | 
|---|
| [1112] | 843 | } | 
|---|
|  | 844 | else | 
|---|
| [1335] | 845 | saymsg(MB_OK, | 
|---|
|  | 846 | HWND_DESKTOP, | 
|---|
|  | 847 | NullStr, | 
|---|
|  | 848 | GetPString(IDS_SAVETMPDRIVESPACELIMITED), | 
|---|
|  | 849 | pTmpDir, | 
|---|
|  | 850 | pFM2SaveDirectory); | 
|---|
| [1112] | 851 | } | 
|---|
|  | 852 | else if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 1) | 
|---|
|  | 853 | saymsg(MB_OK, | 
|---|
| [1335] | 854 | HWND_DESKTOP, | 
|---|
|  | 855 | NullStr, | 
|---|
|  | 856 | GetPString(IDS_SAVEDRIVESPACELIMITED), | 
|---|
|  | 857 | pFM2SaveDirectory); | 
|---|
| [1112] | 858 | } | 
|---|
|  | 859 | BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$"); | 
|---|
|  | 860 |  | 
|---|
| [1082] | 861 | // initialize random number generator | 
|---|
| [2] | 862 | srand(time(NULL) + clock()); | 
|---|
|  | 863 |  | 
|---|
|  | 864 | priority_bumped(); | 
|---|
|  | 865 |  | 
|---|
| [1673] | 866 | // _heapmin() is done in a separate thread -- start it | 
|---|
| [1335] | 867 | if (xbeginthread(HeapThread, | 
|---|
|  | 868 | 32768, | 
|---|
|  | 869 | MPVOID, | 
|---|
|  | 870 | pszSrcFile, | 
|---|
|  | 871 | __LINE__) == -1) { | 
|---|
| [339] | 872 | return FALSE; | 
|---|
|  | 873 | } | 
|---|
| [917] | 874 |  | 
|---|
| [1673] | 875 | // timer messages are sent from a separate thread -- start it | 
|---|
| [803] | 876 | if (!StartTimer()) { | 
|---|
|  | 877 | Runtime_Error(pszSrcFile, __LINE__, | 
|---|
| [1335] | 878 | GetPString(IDS_COULDNTSTARTTHREADTEXT)); | 
|---|
| [2] | 879 | return FALSE; | 
|---|
| [803] | 880 | } | 
|---|
| [2] | 881 |  | 
|---|
| [1673] | 882 | // Are we the workplace shell? | 
|---|
| [705] | 883 | env = getenv("WORKPLACE_PROCESS"); | 
|---|
| [718] | 884 | fWorkPlace = env != NULL && | 
|---|
| [1335] | 885 | (stricmp(env, "YES") == 0 || atoi(env) == 1); | 
|---|
| [718] | 886 |  | 
|---|
| [189] | 887 | if ((!strchr(profile, '\\') && !strchr(profile, ':')) || | 
|---|
| [1604] | 888 | !(fmprof = PrfOpenProfile((HAB)0, profile))) { | 
|---|
| [1607] | 889 | // figure out where to put INI file... | 
|---|
| [803] | 890 | CHAR inipath[CCHMAXPATH]; | 
|---|
| [2] | 891 |  | 
|---|
|  | 892 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [1104] | 893 | strcpy(HomePath, pFM2SaveDirectory); | 
|---|
| [2] | 894 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [189] | 895 | memset(driveserial, -1, sizeof(driveserial)); | 
|---|
| [2] | 896 | *inipath = 0; | 
|---|
| [1607] | 897 | env = getenv(PCSZ_FM3INI); | 
|---|
| [551] | 898 | if (env) { | 
|---|
| [189] | 899 | strcpy(inipath, env); | 
|---|
| [2] | 900 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [849] | 901 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| [551] | 902 | if (!rc) { | 
|---|
| [1335] | 903 | if (fs3.attrFile & FILE_DIRECTORY) | 
|---|
|  | 904 | BldFullPathName(inipath, inipath, profile); | 
|---|
| [2] | 905 | } | 
|---|
|  | 906 | } | 
|---|
| [1604] | 907 | else { | 
|---|
| [1750] | 908 | CHAR szFullFilename[CCHMAXPATH]; | 
|---|
|  | 909 | if (!SearchMultiplePathsForFile(profile, szFullFilename)) { | 
|---|
|  | 910 | strcpy(inipath, szFullFilename); | 
|---|
|  | 911 | } else { | 
|---|
|  | 912 | strcpy(inipath, profile); | 
|---|
|  | 913 | } | 
|---|
| [1604] | 914 | } //fixme the DosCopies probably fail if the INI isn't in the FM2 directory GKY 06 Aug 11 | 
|---|
| [201] | 915 | if (!*inipath) | 
|---|
|  | 916 | strcpy(inipath, profile); | 
|---|
|  | 917 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [917] | 918 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
|  | 919 | if (rc) { | 
|---|
| [1604] | 920 | if (rc == ERROR_FILE_NOT_FOUND) { | 
|---|
| [1607] | 921 | DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, 0); | 
|---|
| [1604] | 922 | } | 
|---|
|  | 923 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
|  | 924 | if (rc) | 
|---|
|  | 925 | fWantFirstTimeInit = TRUE; | 
|---|
| [917] | 926 | } | 
|---|
| [1604] | 927 | if (!fWantFirstTimeInit) { //Check the ini file header and restore from backup if corupted | 
|---|
| [989] | 928 | if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { | 
|---|
| [1604] | 929 | saymsg(MB_ENTER,HWND_DESKTOP, GetPString(IDS_DEBUG_STRING), | 
|---|
|  | 930 | GetPString(IDS_INIFAILURETEXT)); | 
|---|
| [1607] | 931 | DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD, DCPY_EXISTING); | 
|---|
|  | 932 | DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, DCPY_EXISTING); | 
|---|
| [1604] | 933 | if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { | 
|---|
| [1607] | 934 | DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD2, DCPY_EXISTING); | 
|---|
| [1604] | 935 | fWantFirstTimeInit = TRUE; | 
|---|
|  | 936 | } | 
|---|
| [2] | 937 | } | 
|---|
| [1604] | 938 | } | 
|---|
|  | 939 | // in some odd cases the INI file can get set to readonly status | 
|---|
|  | 940 | // here we test it and reset the readonly bit if necessary | 
|---|
|  | 941 | if (!fWantFirstTimeInit) { | 
|---|
|  | 942 | fIniExisted = TRUE; | 
|---|
|  | 943 | if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { | 
|---|
|  | 944 | fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); | 
|---|
|  | 945 | rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); | 
|---|
|  | 946 | if (rc) { | 
|---|
|  | 947 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 948 | GetPString(IDS_INIREADONLYTEXT), inipath); | 
|---|
|  | 949 | } | 
|---|
| [989] | 950 | } | 
|---|
| [2] | 951 | } | 
|---|
| [803] | 952 | fmprof = PrfOpenProfile((HAB)0, inipath); | 
|---|
| [551] | 953 | if (!fmprof) { | 
|---|
| [1607] | 954 | strcpy(inipath, PCSZ_FM3DOTINI); | 
|---|
| [803] | 955 | fmprof = PrfOpenProfile((HAB)0, inipath); | 
|---|
| [2] | 956 | } | 
|---|
| [201] | 957 |  | 
|---|
| [917] | 958 | // 10 Jan 08 SHL fixme to do first time if new ini | 
|---|
|  | 959 | // 10 Jan 08 SHL post UM_FIRSTTIME to main window | 
|---|
| [551] | 960 | if (!fmprof) { | 
|---|
|  | 961 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, | 
|---|
| [1402] | 962 | PCSZ_PRFOPENPROFILEFAILED, inipath); | 
|---|
| [2] | 963 | return FALSE; | 
|---|
|  | 964 | } | 
|---|
|  | 965 | } | 
|---|
|  | 966 |  | 
|---|
| [1363] | 967 | ArgDriveFlags(argc, argv); | 
|---|
|  | 968 | FillInDriveFlags(NULL); | 
|---|
|  | 969 |  | 
|---|
| [2] | 970 | FindSwapperDat(); | 
|---|
|  | 971 |  | 
|---|
| [1673] | 972 | // start help | 
|---|
| [189] | 973 | memset(&hini, 0, sizeof(HELPINIT)); | 
|---|
| [2] | 974 | hini.cb = sizeof(HELPINIT); | 
|---|
| [189] | 975 | hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff); | 
|---|
|  | 976 | hini.hmodAccelActionBarModule = (HMODULE) 0; | 
|---|
| [1394] | 977 | hini.pszHelpWindowTitle = (PSZ)GetPString(IDS_FM2HELPTITLETEXT); | 
|---|
| [1546] | 978 | hini.hmodHelpTableModule = FM3ModHandle; | 
|---|
| [2] | 979 | hini.fShowPanelId = CMIC_HIDE_PANEL_ID; | 
|---|
| [1607] | 980 | hini.pszHelpLibraryName = (CHAR *) PCSZ_FM3DOTHLP; | 
|---|
| [189] | 981 | hwndHelp = WinCreateHelpInstance(hab, &hini); | 
|---|
| [551] | 982 | if (!hwndHelp) { | 
|---|
| [1560] | 983 | CHAR helppath[CCHMAXPATH]; | 
|---|
| [1607] | 984 | env = getenv(PCSZ_FM3INI); | 
|---|
| [551] | 985 | if (env) { | 
|---|
| [189] | 986 | strcpy(helppath, env); | 
|---|
| [2] | 987 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [849] | 988 | rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| [551] | 989 | if (!rc) { | 
|---|
| [1335] | 990 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| [1607] | 991 | BldFullPathName(helppath, helppath, PCSZ_FM3DOTHLP); | 
|---|
| [1335] | 992 | hini.pszHelpLibraryName = helppath; | 
|---|
|  | 993 | hwndHelp = WinCreateHelpInstance(hab, &hini); | 
|---|
| [1560] | 994 | if (!hwndHelp) | 
|---|
| [1607] | 995 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 996 | "WinCreateHelpInstance failed for %s with error 0x%x", | 
|---|
|  | 997 | hini.pszHelpLibraryName, hini.ulReturnCode); | 
|---|
| [1335] | 998 | } | 
|---|
| [2] | 999 | } | 
|---|
|  | 1000 | } | 
|---|
|  | 1001 | } | 
|---|
| [551] | 1002 | if (!hwndHelp) { | 
|---|
| [2] | 1003 | saymsg(MB_ENTER | MB_ICONEXCLAMATION, | 
|---|
| [1335] | 1004 | HWND_DESKTOP, | 
|---|
|  | 1005 | GetPString(IDS_FM2TROUBLETEXT), | 
|---|
|  | 1006 | GetPString(IDS_CANTLOADHELPTEXT), | 
|---|
|  | 1007 | GetPString(IDS_NOHELPACCEPTTEXT)); | 
|---|
| [2] | 1008 | } | 
|---|
|  | 1009 |  | 
|---|
| [1365] | 1010 | // a couple of default window procs so we don't have to look them up later | 
|---|
| [189] | 1011 | if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo)) | 
|---|
| [2] | 1012 | PFNWPCnr = clinfo.pfnWindowProc; | 
|---|
| [189] | 1013 | if (WinQueryClassInfo(hab, WC_FRAME, &clinfo)) | 
|---|
| [2] | 1014 | PFNWPFrame = clinfo.pfnWindowProc; | 
|---|
| [189] | 1015 | if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo)) | 
|---|
| [2] | 1016 | PFNWPButton = clinfo.pfnWindowProc; | 
|---|
| [189] | 1017 | if (WinQueryClassInfo(hab, WC_STATIC, &clinfo)) | 
|---|
| [2] | 1018 | PFNWPStatic = clinfo.pfnWindowProc; | 
|---|
| [189] | 1019 | if (WinQueryClassInfo(hab, WC_MLE, &clinfo)) | 
|---|
| [2] | 1020 | PFNWPMLE = clinfo.pfnWindowProc; | 
|---|
| [551] | 1021 | if (!PFNWPCnr || !PFNWPFrame || !PFNWPButton || !PFNWPStatic || !PFNWPMLE) { | 
|---|
| [339] | 1022 | Runtime_Error(pszSrcFile, __LINE__, "WinQueryClassInfo"); | 
|---|
| [2] | 1023 | return FALSE; | 
|---|
|  | 1024 | } | 
|---|
|  | 1025 |  | 
|---|
| [1673] | 1026 | // register window classes we use | 
|---|
| [2] | 1027 | WinRegisterClass(hab, | 
|---|
| [1498] | 1028 | (CHAR *) WC_MAINWND, | 
|---|
| [1335] | 1029 | MainWndProc, | 
|---|
|  | 1030 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8); | 
|---|
| [2] | 1031 | WinRegisterClass(hab, | 
|---|
| [1498] | 1032 | (CHAR *) WC_MAINWND2, | 
|---|
| [1335] | 1033 | MainWndProc2, | 
|---|
|  | 1034 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4); | 
|---|
| [2] | 1035 | WinRegisterClass(hab, | 
|---|
| [1498] | 1036 | (CHAR *) WC_TREECONTAINER, | 
|---|
| [1335] | 1037 | TreeClientWndProc, | 
|---|
|  | 1038 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1039 | WinRegisterClass(hab, | 
|---|
| [1498] | 1040 | (CHAR *) WC_DIRCONTAINER, | 
|---|
| [1335] | 1041 | DirClientWndProc, | 
|---|
|  | 1042 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1043 | WinRegisterClass(hab, | 
|---|
| [1498] | 1044 | (CHAR *) WC_COLLECTOR, | 
|---|
| [1335] | 1045 | CollectorClientWndProc, | 
|---|
|  | 1046 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1047 | WinRegisterClass(hab, | 
|---|
| [1498] | 1048 | (CHAR *) WC_ARCCONTAINER, | 
|---|
| [1335] | 1049 | ArcClientWndProc, | 
|---|
|  | 1050 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1051 | WinRegisterClass(hab, | 
|---|
| [1498] | 1052 | (CHAR *) WC_MLEEDITOR, | 
|---|
| [1335] | 1053 | MLEEditorProc, | 
|---|
|  | 1054 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1055 | WinRegisterClass(hab, | 
|---|
| [1498] | 1056 | (CHAR *) WC_INIEDITOR, | 
|---|
| [1335] | 1057 | IniProc, | 
|---|
|  | 1058 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| [2] | 1059 | WinRegisterClass(hab, | 
|---|
| [1498] | 1060 | (CHAR *) WC_TOOLBACK, | 
|---|
| [1335] | 1061 | ToolBackProc, | 
|---|
|  | 1062 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1063 | sizeof(PVOID)); | 
|---|
| [2] | 1064 | WinRegisterClass(hab, | 
|---|
| [1498] | 1065 | (CHAR *) WC_DRIVEBACK, | 
|---|
| [1335] | 1066 | DriveBackProc, | 
|---|
|  | 1067 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1068 | sizeof(PVOID)); | 
|---|
| [2] | 1069 | WinRegisterClass(hab, | 
|---|
| [1498] | 1070 | (CHAR *) WC_SEEALL, | 
|---|
| [1335] | 1071 | SeeAllWndProc, | 
|---|
|  | 1072 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); | 
|---|
| [2] | 1073 | WinRegisterClass(hab, | 
|---|
| [1498] | 1074 | (CHAR *) WC_NEWVIEW, | 
|---|
| [1335] | 1075 | ViewWndProc, | 
|---|
|  | 1076 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); | 
|---|
| [2] | 1077 | WinRegisterClass(hab, | 
|---|
| [1498] | 1078 | (CHAR *) WC_TOOLBUTTONS, | 
|---|
| [1335] | 1079 | ChildButtonProc, | 
|---|
|  | 1080 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1081 | sizeof(PVOID)); | 
|---|
| [2] | 1082 | WinRegisterClass(hab, | 
|---|
| [1498] | 1083 | (CHAR *) WC_DRIVEBUTTONS, | 
|---|
| [1335] | 1084 | DriveProc, | 
|---|
|  | 1085 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1086 | sizeof(PVOID)); | 
|---|
| [2] | 1087 | WinRegisterClass(hab, | 
|---|
| [1498] | 1088 | (CHAR *) WC_BUBBLE, | 
|---|
| [1335] | 1089 | BubbleProc, | 
|---|
|  | 1090 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1091 | sizeof(ULONG) * 2); | 
|---|
| [2] | 1092 | WinRegisterClass(hab, | 
|---|
| [1498] | 1093 | (CHAR *) WC_STATUS, | 
|---|
| [1335] | 1094 | StatusProc, | 
|---|
|  | 1095 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1096 | sizeof(ULONG)); | 
|---|
| [2] | 1097 | WinRegisterClass(hab, | 
|---|
| [1498] | 1098 | (CHAR *) WC_DIRSTATUS, | 
|---|
| [1335] | 1099 | DirTextProc, | 
|---|
|  | 1100 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1101 | sizeof(ULONG)); | 
|---|
| [2] | 1102 | WinRegisterClass(hab, | 
|---|
| [1498] | 1103 | (CHAR *) WC_TREESTATUS, | 
|---|
| [1335] | 1104 | TreeStatProc, | 
|---|
|  | 1105 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1106 | sizeof(ULONG)); | 
|---|
| [2] | 1107 | WinRegisterClass(hab, | 
|---|
| [1498] | 1108 | (CHAR *) WC_ARCSTATUS, | 
|---|
| [1335] | 1109 | ArcTextProc, | 
|---|
|  | 1110 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1111 | sizeof(ULONG)); | 
|---|
| [2] | 1112 | WinRegisterClass(hab, | 
|---|
| [1498] | 1113 | (CHAR *) WC_COLSTATUS, | 
|---|
| [1335] | 1114 | CollectorTextProc, | 
|---|
|  | 1115 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1116 | sizeof(ULONG)); | 
|---|
| [2] | 1117 | WinRegisterClass(hab, | 
|---|
| [1498] | 1118 | (CHAR *) WC_SEESTATUS, | 
|---|
| [1335] | 1119 | SeeStatusProc, | 
|---|
|  | 1120 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1121 | sizeof(ULONG)); | 
|---|
| [2] | 1122 | WinRegisterClass(hab, | 
|---|
| [1498] | 1123 | (CHAR *) WC_VIEWSTATUS, | 
|---|
| [1335] | 1124 | ViewStatusProc, | 
|---|
|  | 1125 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1126 | sizeof(ULONG)); | 
|---|
| [2] | 1127 | WinRegisterClass(hab, | 
|---|
| [1498] | 1128 | (CHAR *) WC_ERRORWND, | 
|---|
| [1335] | 1129 | NotifyWndProc, | 
|---|
|  | 1130 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1131 | sizeof(PVOID)); | 
|---|
| [2] | 1132 | WinRegisterClass(hab, | 
|---|
| [1498] | 1133 | (CHAR *) WC_MINITIME, | 
|---|
| [1335] | 1134 | MiniTimeProc, | 
|---|
|  | 1135 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1136 | sizeof(PVOID) * 2); | 
|---|
| [2] | 1137 | WinRegisterClass(hab, | 
|---|
| [1498] | 1138 | (CHAR *) WC_DATABAR, | 
|---|
| [1335] | 1139 | DataProc, CS_SIZEREDRAW, sizeof(PVOID)); | 
|---|
| [2] | 1140 | WinRegisterClass(hab, | 
|---|
| [1498] | 1141 | (CHAR *) WC_TREEOPENBUTTON, | 
|---|
| [1335] | 1142 | OpenButtonProc, | 
|---|
|  | 1143 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1144 | sizeof(PVOID)); | 
|---|
| [2] | 1145 | WinRegisterClass(hab, | 
|---|
| [1498] | 1146 | (CHAR *) WC_AUTOVIEW, | 
|---|
| [1335] | 1147 | AutoViewProc, | 
|---|
|  | 1148 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1149 | sizeof(PVOID)); | 
|---|
| [2] | 1150 | WinRegisterClass(hab, | 
|---|
| [1498] | 1151 | (CHAR *) WC_LED, | 
|---|
| [1335] | 1152 | LEDProc, | 
|---|
|  | 1153 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
|  | 1154 | sizeof(PVOID)); | 
|---|
| [2] | 1155 |  | 
|---|
| [1333] | 1156 | if (DosCreateMutexSem(NULL, &hmtxFM2Globals, 0L, FALSE)) | 
|---|
| [1312] | 1157 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1553] | 1158 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| [1555] | 1159 | if (DosCreateMutexSem(NULL, &hmtxScanning, 0L, TRUE)) | 
|---|
| [1553] | 1160 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1398] | 1161 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| [1333] | 1162 | if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE)) | 
|---|
| [1312] | 1163 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1786] | 1164 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
|  | 1165 | if (DosCreateMutexSem(NULL, &hmtxFiltering, 0L, FALSE)) | 
|---|
|  | 1166 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 1167 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| [1551] | 1168 | if (DosCreateEventSem(NULL, &hevTreeCnrScanComplete, 0L, TRUE)) | 
|---|
| [1444] | 1169 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1471] | 1170 | PCSZ_DOSCREATEEVENTSEM); | 
|---|
| [1320] | 1171 |  | 
|---|
| [1475] | 1172 | /** | 
|---|
| [201] | 1173 | * set some defaults (note: everything else automatically initialized | 
|---|
| [2] | 1174 | * to 0) | 
|---|
|  | 1175 | */ | 
|---|
| [1065] | 1176 | dsDirCnrDefault.detailssize = dsDirCnrDefault.detailsea = dsDirCnrDefault.detailslwdate = | 
|---|
|  | 1177 | dsDirCnrDefault.detailslwtime = dsDirCnrDefault.detailsattr = dsDirCnrDefault.detailsicon = | 
|---|
|  | 1178 | fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite = | 
|---|
| [189] | 1179 | fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp = | 
|---|
| [1482] | 1180 | fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives = fDataMin = | 
|---|
| [189] | 1181 | fSplitStatus = fDragndropDlg = fQuickArcFind = fKeepCmdLine = | 
|---|
| [1778] | 1182 | fMoreButtons = fDrivebar = fCollapseFirst = fSwitchTreeOnDirChg = | 
|---|
| [189] | 1183 | fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp = | 
|---|
|  | 1184 | fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget = | 
|---|
| [1376] | 1185 | fShowTarget = fDrivebarHelp = fCheckMM = fInitialDriveScan = | 
|---|
|  | 1186 | fEjectRemovableScan = fRScanLocal = TRUE; | 
|---|
| [2] | 1187 | ulCnrType = CCS_EXTENDSEL; | 
|---|
| [1482] | 1188 | FilesToGet = FILESTOGET_MAX; | 
|---|
| [985] | 1189 | MaxComLineStrg = MAXCOMLINESTRGDEFAULT; | 
|---|
| [752] | 1190 | AutoviewHeight = 48; | 
|---|
| [1333] | 1191 | //strcpy(printer, "PRN"); | 
|---|
| [2] | 1192 | prnwidth = 80; | 
|---|
|  | 1193 | prnlength = 66; | 
|---|
|  | 1194 | prntmargin = 6; | 
|---|
|  | 1195 | prnbmargin = 6; | 
|---|
|  | 1196 | prnlmargin = 6; | 
|---|
|  | 1197 | prnrmargin = 3; | 
|---|
|  | 1198 | prnspacing = 1; | 
|---|
|  | 1199 | prntabspaces = 8; | 
|---|
| [1482] | 1200 | CollectorsortFlags = sortFlags = SORT_FILENAME | SORT_DIRSFIRST; | 
|---|
|  | 1201 | //ullDATFileSpaceNeeded = 10000; | 
|---|
| [2] | 1202 |  | 
|---|
| [860] | 1203 | //Get default Country info | 
|---|
|  | 1204 | { | 
|---|
| [1777] | 1205 | COUNTRYCODE Country    = {0}; | 
|---|
|  | 1206 | ULONG ulInfoLen  = 0; | 
|---|
|  | 1207 | COUNTRYINFO CtryInfo   = {0}; | 
|---|
| [860] | 1208 |  | 
|---|
| [1777] | 1209 | if (!DosQueryCtryInfo(sizeof(CtryInfo), &Country, &CtryInfo, &ulInfoLen)) { | 
|---|
|  | 1210 | *ThousandsSeparator = CtryInfo.szThousandsSeparator[0]; | 
|---|
|  | 1211 | strcpy(DateSeparator, CtryInfo.szDateSeparator); | 
|---|
|  | 1212 | strcpy(TimeSeparator, CtryInfo.szTimeSeparator); | 
|---|
|  | 1213 | ulDateFmt = CtryInfo.fsDateFmt; | 
|---|
|  | 1214 | ulTimeFmt = CtryInfo.fsTimeFmt; | 
|---|
|  | 1215 | //DbgMsg(pszSrcFile, __LINE__, "Date Fmt %x", ulDateFmt); | 
|---|
|  | 1216 | } | 
|---|
|  | 1217 | else { | 
|---|
|  | 1218 | strcpy(ThousandsSeparator, ","); | 
|---|
|  | 1219 | strcpy(DateSeparator, "/"); | 
|---|
|  | 1220 | strcpy(TimeSeparator, ":"); | 
|---|
|  | 1221 | ulDateFmt = 0; | 
|---|
|  | 1222 | ulTimeFmt = 0; | 
|---|
|  | 1223 | } | 
|---|
| [860] | 1224 | } | 
|---|
| [1777] | 1225 | { | 
|---|
|  | 1226 | // Check for the existance of various partitioning tools to set up menu items | 
|---|
| [1360] | 1227 | ULONG ulAppType; | 
|---|
| [860] | 1228 |  | 
|---|
| [1750] | 1229 | if (!SearchPathForFile(PCSZ_PATH, PCSZ_LVMGUICMD, NULL)) | 
|---|
| [1369] | 1230 | fLVMGui = TRUE; | 
|---|
| [1439] | 1231 | if (!xDosQueryAppType(PCSZ_DFSOS2EXE, &ulAppType)) | 
|---|
| [1360] | 1232 | fDFSee = TRUE; | 
|---|
| [1439] | 1233 | if (!xDosQueryAppType(PCSZ_MINILVMEXE, &ulAppType)) | 
|---|
| [1369] | 1234 | fMiniLVM = TRUE; | 
|---|
| [1439] | 1235 | if (!xDosQueryAppType(PCSZ_FDISKPMEXE, &ulAppType)) | 
|---|
| [1369] | 1236 | fFDisk = TRUE; | 
|---|
| [1439] | 1237 | if (!xDosQueryAppType(PCSZ_LVMEXE, &ulAppType)) | 
|---|
| [1369] | 1238 | fLVM = TRUE; | 
|---|
|  | 1239 |  | 
|---|
| [1664] | 1240 | //Check for unlock.exe | 
|---|
|  | 1241 | if (!xDosQueryAppType(PCSZ_UNLOCKEXE, &ulAppType)) | 
|---|
|  | 1242 | fUnlock = TRUE; | 
|---|
|  | 1243 |  | 
|---|
| [1369] | 1244 | // Check to see if we are running protect only | 
|---|
| [1439] | 1245 | if (!xDosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) { | 
|---|
| [1452] | 1246 | HMODULE hmod; | 
|---|
|  | 1247 | APIRET rc; | 
|---|
|  | 1248 |  | 
|---|
|  | 1249 | rc = DosQueryModuleHandle("VKBD", &hmod); | 
|---|
|  | 1250 | if (rc != NO_ERROR) { | 
|---|
| [1471] | 1251 | fProtectOnly = TRUE; | 
|---|
| [1475] | 1252 | //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly); | 
|---|
| [1452] | 1253 | } | 
|---|
|  | 1254 | else { | 
|---|
| [1471] | 1255 | rc = DosQueryModuleHandle("VMOUSE", &hmod); | 
|---|
|  | 1256 | if (rc != NO_ERROR) { | 
|---|
|  | 1257 | fProtectOnly = TRUE; | 
|---|
| [1475] | 1258 | //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VMOUSE returned %d fProtectOnly=%d", rc, fProtectOnly); | 
|---|
| [1471] | 1259 | } | 
|---|
| [1452] | 1260 | } | 
|---|
| [1369] | 1261 | } | 
|---|
|  | 1262 | else | 
|---|
|  | 1263 | fProtectOnly = TRUE; | 
|---|
| [1360] | 1264 | } | 
|---|
|  | 1265 |  | 
|---|
| [201] | 1266 | // load preferences from profile (INI) file | 
|---|
| [1482] | 1267 | /** | 
|---|
|  | 1268 | * Separate paramenters -- Please note that appname should be used in | 
|---|
|  | 1269 | * profile calls for user settings that work and are setable in more than one | 
|---|
| [1505] | 1270 | * miniapp; FM3Str should be used for setting only relavent to FM/2 or that | 
|---|
| [1482] | 1271 | * aren't user settable; realappname should be used for setting applicable to | 
|---|
|  | 1272 | * one or more miniapp but not to FM/2 | 
|---|
|  | 1273 | */ | 
|---|
| [1743] | 1274 | size = sizeof(BOOL); | 
|---|
| [1713] | 1275 | PrfQueryProfileData(fmprof, realappname, "SeparateParms", &fAppSeparateSettings, &size); | 
|---|
| [1711] | 1276 | if (!fAppSeparateSettings) | 
|---|
|  | 1277 | strcpy(appname, FM3Str); | 
|---|
|  | 1278 | else | 
|---|
|  | 1279 | strcpy(appname, realappname); | 
|---|
| [1328] | 1280 | size = sizeof(ULONG); | 
|---|
|  | 1281 | PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size); | 
|---|
| [1004] | 1282 | // Give user one chance to reset the default command line length to 1024 (4os2's unexpanded max) | 
|---|
|  | 1283 | if (MaxComLineStrg == 2048) { | 
|---|
|  | 1284 | BOOL MaxComLineChecked = FALSE; | 
|---|
|  | 1285 |  | 
|---|
| [1328] | 1286 | size = sizeof(BOOL); | 
|---|
|  | 1287 | PrfQueryProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, &size); | 
|---|
| [1004] | 1288 | if (!MaxComLineChecked) { | 
|---|
|  | 1289 | ret = saymsg(MB_YESNO, | 
|---|
| [1335] | 1290 | HWND_DESKTOP, | 
|---|
|  | 1291 | NullStr, | 
|---|
|  | 1292 | GetPString(IDS_CHANGECMDLINELENGTHDEFAULT)); | 
|---|
| [1004] | 1293 | if (ret == MBID_YES) | 
|---|
| [1335] | 1294 | MaxComLineStrg = 1024; | 
|---|
| [1004] | 1295 | MaxComLineChecked = TRUE; | 
|---|
| [1333] | 1296 | PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL)); | 
|---|
| [1004] | 1297 | } | 
|---|
|  | 1298 | } | 
|---|
| [985] | 1299 | if (MaxComLineStrg < CMDLNLNGTH_MIN) | 
|---|
|  | 1300 | MaxComLineStrg = CMDLNLNGTH_MIN; | 
|---|
|  | 1301 | else if (MaxComLineStrg > CMDLNLNGTH_MAX) | 
|---|
|  | 1302 | MaxComLineStrg = CMDLNLNGTH_MAX; | 
|---|
|  | 1303 | editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1304 | if (!editor) | 
|---|
|  | 1305 | return 0; //already complained | 
|---|
|  | 1306 | viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1307 | if (!viewer) | 
|---|
|  | 1308 | return 0; //already complained | 
|---|
|  | 1309 | virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1310 | if (!virus) | 
|---|
|  | 1311 | return 0; //already complained | 
|---|
|  | 1312 | compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1313 | if (!compare) | 
|---|
|  | 1314 | return 0; //already complained | 
|---|
|  | 1315 | binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1316 | if (!binview) | 
|---|
|  | 1317 | return 0; //already complained | 
|---|
|  | 1318 | bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1319 | if (!bined) | 
|---|
|  | 1320 | return 0; //already complained | 
|---|
|  | 1321 | dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1322 | if (!dircompare) | 
|---|
|  | 1323 | return 0; //already complained | 
|---|
|  | 1324 | ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1325 | if (!ftprun) | 
|---|
|  | 1326 | return 0; //already complained | 
|---|
|  | 1327 | httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1328 | if (!httprun) | 
|---|
|  | 1329 | return 0; //already complained | 
|---|
|  | 1330 | mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1331 | if (!mailrun) | 
|---|
|  | 1332 | return 0; //already complained | 
|---|
| [1083] | 1333 | pszTreeEnvVarList = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
|  | 1334 | if (!pszTreeEnvVarList) | 
|---|
|  | 1335 | return 0; //already complained | 
|---|
| [1333] | 1336 | size = sizeof(BOOL); | 
|---|
| [1522] | 1337 | PrfQueryProfileData(fmprof, FM3Str, "DontSuggestAgain", &fDontSuggestAgain, &size); | 
|---|
| [1451] | 1338 | size = sizeof(BOOL); | 
|---|
| [1328] | 1339 | PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size); | 
|---|
| [1333] | 1340 | size = sizeof(BOOL); | 
|---|
| [1328] | 1341 | PrfQueryProfileData(fmprof, appname, "CheckMM", &fCheckMM, &size); | 
|---|
| [1333] | 1342 | size = sizeof(BOOL); | 
|---|
| [1328] | 1343 | PrfQueryProfileData(fmprof, appname, "ChangeTarget", &fChangeTarget, &size); | 
|---|
| [1333] | 1344 | size = sizeof(BOOL); | 
|---|
| [1328] | 1345 | PrfQueryProfileData(fmprof, appname, "ConfirmTarget", &fConfirmTarget, &size); | 
|---|
| [1333] | 1346 | size = sizeof(BOOL); | 
|---|
| [1482] | 1347 | PrfQueryProfileData(fmprof, appname, "CustomFileDlg", &fCustomFileDlg, &size); | 
|---|
| [1333] | 1348 | size = sizeof(BOOL); | 
|---|
| [1482] | 1349 | PrfQueryProfileData(fmprof, appname, "SaveMiniCmds", &fSaveMiniCmds, &size); | 
|---|
| [1333] | 1350 | size = sizeof(BOOL); | 
|---|
| [1328] | 1351 | PrfQueryProfileData(fmprof, appname, "SaveBigCmds", &fSaveBigCmds, &size); | 
|---|
| [1333] | 1352 | size = sizeof(BOOL); | 
|---|
| [1328] | 1353 | PrfQueryProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, &size); | 
|---|
| [1333] | 1354 | size = sizeof(BOOL); | 
|---|
| [1505] | 1355 | PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", &prnpagenums, &size); | 
|---|
| [1333] | 1356 | size = sizeof(BOOL); | 
|---|
| [1505] | 1357 | PrfQueryProfileData(fmprof, FM3Str, "Prnalt", &prnalt, &size); | 
|---|
| [1333] | 1358 | size = sizeof(BOOL); | 
|---|
| [1505] | 1359 | PrfQueryProfileData(fmprof, FM3Str, "Prnformat", &prnformat, &size); | 
|---|
| [1333] | 1360 | size = sizeof(BOOL); | 
|---|
| [1505] | 1361 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore", &prnformfeedbefore, &size); | 
|---|
| [1333] | 1362 | size = sizeof(BOOL); | 
|---|
| [1505] | 1363 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedafter",&prnformfeedafter, &size); | 
|---|
| [1328] | 1364 | size = sizeof(ULONG); | 
|---|
| [1505] | 1365 | PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size); | 
|---|
| [1333] | 1366 | size = sizeof(ULONG); | 
|---|
| [1505] | 1367 | PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", &prnwidth, &size); | 
|---|
| [1333] | 1368 | size = sizeof(ULONG); | 
|---|
| [1505] | 1369 | PrfQueryProfileData(fmprof, FM3Str, "Prnlength", &prnlength, &size); | 
|---|
| [1333] | 1370 | size = sizeof(ULONG); | 
|---|
| [1505] | 1371 | PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", &prntmargin, &size); | 
|---|
| [1333] | 1372 | size = sizeof(ULONG); | 
|---|
| [1505] | 1373 | PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", &prnbmargin, &size); | 
|---|
| [1333] | 1374 | size = sizeof(ULONG); | 
|---|
| [1505] | 1375 | PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", &prnlmargin, &size); | 
|---|
| [1333] | 1376 | size = sizeof(ULONG); | 
|---|
| [1505] | 1377 | PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", &prnrmargin, &size); | 
|---|
| [1333] | 1378 | size = sizeof(ULONG); | 
|---|
| [1505] | 1379 | PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", &prnspacing, &size); | 
|---|
| [1328] | 1380 | size = sizeof(BOOL); | 
|---|
| [1482] | 1381 | PrfQueryProfileData(fmprof, appname, "NoDead", &fNoDead, &size); | 
|---|
| [1333] | 1382 | size = sizeof(BOOL); | 
|---|
| [1482] | 1383 | PrfQueryProfileData(fmprof, appname, "NoFinger", &fNoFinger, &size); | 
|---|
| [1333] | 1384 | size = sizeof(BOOL); | 
|---|
| [1482] | 1385 | PrfQueryProfileData(fmprof, appname, "AlertBeepOff", &fAlertBeepOff, &size); | 
|---|
| [1395] | 1386 | size = sizeof(BOOL); | 
|---|
| [1482] | 1387 | PrfQueryProfileData(fmprof, appname, "ErrorBeepOff", &fErrorBeepOff, &size); | 
|---|
| [1395] | 1388 | size = sizeof(BOOL); | 
|---|
| [1778] | 1389 | PrfQueryProfileData(fmprof, appname, "SwitchTree", &fSwitchTreeOnDirChg, &size); | 
|---|
| [1333] | 1390 | size = sizeof(BOOL); | 
|---|
|  | 1391 | PrfQueryProfileData(fmprof, appname, "SwitchTreeExpand", &fSwitchTreeExpand, &size); | 
|---|
|  | 1392 | size = sizeof(BOOL); | 
|---|
|  | 1393 | PrfQueryProfileData(fmprof, appname, "SwitchTreeOnFocus", &fSwitchTreeOnFocus, &size); | 
|---|
|  | 1394 | size = sizeof(BOOL); | 
|---|
|  | 1395 | PrfQueryProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst, &size); | 
|---|
|  | 1396 | size = sizeof(BOOL); | 
|---|
|  | 1397 | PrfQueryProfileData(fmprof, appname, "FilesInTree", &fFilesInTree, &size); | 
|---|
|  | 1398 | size = sizeof(BOOL); | 
|---|
| [1482] | 1399 | PrfQueryProfileData(fmprof, appname, "TopDir", &fTopDir, &size); | 
|---|
| [1333] | 1400 | size = sizeof(BOOL); | 
|---|
| [1482] | 1401 | PrfQueryProfileData(fmprof, appname, "LookInDir", &fLookInDir, &size); | 
|---|
| [1333] | 1402 | PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, sizeof(szDefArc)); | 
|---|
| [1328] | 1403 | size = sizeof(ULONG); | 
|---|
| [1482] | 1404 | PrfQueryProfileData(fmprof, appname, "AutoviewHeight", | 
|---|
| [1335] | 1405 | &AutoviewHeight, &size); | 
|---|
| [1328] | 1406 | size = sizeof(BOOL); | 
|---|
| [1482] | 1407 | PrfQueryProfileData(fmprof, appname, "KeepCmdLine", &fKeepCmdLine, &size); | 
|---|
| [551] | 1408 | if (strcmp(realappname, "FM/4")) { | 
|---|
| [1333] | 1409 | size = sizeof(BOOL); | 
|---|
| [1505] | 1410 | PrfQueryProfileData(fmprof, FM3Str, "MoreButtons", &fMoreButtons, &size); | 
|---|
| [1333] | 1411 | size = sizeof(BOOL); | 
|---|
| [1505] | 1412 | PrfQueryProfileData(fmprof, FM3Str, "Drivebar", &fDrivebar, &size); | 
|---|
| [201] | 1413 | } | 
|---|
| [1333] | 1414 | size = sizeof(BOOL); | 
|---|
| [1328] | 1415 | PrfQueryProfileData(fmprof, appname, "NoSearch", &fNoSearch, &size); | 
|---|
| [1333] | 1416 | size = sizeof(BOOL); | 
|---|
| [1328] | 1417 | PrfQueryProfileData(fmprof, appname, "GuessType", &fGuessType, &size); | 
|---|
| [1333] | 1418 | size = sizeof(BOOL); | 
|---|
| [1328] | 1419 | PrfQueryProfileData(fmprof, appname, "ViewChild", &fViewChild, &size); | 
|---|
| [1333] | 1420 | size = sizeof(BOOL); | 
|---|
| [1328] | 1421 | PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size); | 
|---|
| [1333] | 1422 | PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;", | 
|---|
| [1777] | 1423 | pszTreeEnvVarList, MaxComLineStrg); | 
|---|
| [1328] | 1424 | size = sizeof(BOOL); | 
|---|
| [1482] | 1425 | PrfQueryProfileData(fmprof, appname, "ShowDriveOnly", &fShowDriveOnly, &size); | 
|---|
| [1431] | 1426 | size = sizeof(BOOL); | 
|---|
| [1482] | 1427 | PrfQueryProfileData(fmprof, appname, "ShowFSTypeInTree", &fShowFSTypeInTree, &size); | 
|---|
| [1424] | 1428 | size = sizeof(BOOL); | 
|---|
| [1482] | 1429 | PrfQueryProfileData(fmprof, appname, "ShowDriveLabelInTree", &fShowDriveLabelInTree, &size); | 
|---|
| [1434] | 1430 | if (!fShowDriveOnly && !fShowFSTypeInTree && !fShowDriveLabelInTree) | 
|---|
|  | 1431 | fShowDriveOnly = TRUE; | 
|---|
| [1424] | 1432 | size = sizeof(BOOL); | 
|---|
| [1328] | 1433 | PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size); | 
|---|
| [1333] | 1434 | size = sizeof(BOOL); | 
|---|
| [1482] | 1435 | PrfQueryProfileData(fmprof, appname, "Comments", &fComments, &size); | 
|---|
| [1328] | 1436 | size = sizeof(ULONG); | 
|---|
|  | 1437 | PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", &fwsAnimate, &size); | 
|---|
| [201] | 1438 | if (fwsAnimate) | 
|---|
|  | 1439 | fwsAnimate = WS_ANIMATE; | 
|---|
| [1328] | 1440 | size = sizeof(BOOL); | 
|---|
| [1333] | 1441 | PrfQueryProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways, &size); | 
|---|
|  | 1442 | size = sizeof(BOOL); | 
|---|
| [1482] | 1443 | PrfQueryProfileData(fmprof, appname, "ToolbarHelp", &fToolbarHelp, &size); | 
|---|
| [1333] | 1444 | size = sizeof(BOOL); | 
|---|
| [1482] | 1445 | PrfQueryProfileData(fmprof, appname, "OtherHelp", &fOtherHelp, &size); | 
|---|
| [1333] | 1446 | size = sizeof(BOOL); | 
|---|
| [1482] | 1447 | PrfQueryProfileData(fmprof, appname, "DrivebarHelp", &fDrivebarHelp, &size); | 
|---|
| [1333] | 1448 | size = sizeof(BOOL); | 
|---|
| [1328] | 1449 | PrfQueryProfileData(fmprof, appname, "AutoAddDirs", &fAutoAddDirs, &size); | 
|---|
| [1333] | 1450 | size = sizeof(BOOL); | 
|---|
|  | 1451 | PrfQueryProfileData(fmprof, appname, "AutoAddAllDirs", &fAutoAddAllDirs, &size); | 
|---|
|  | 1452 | size = sizeof(BOOL); | 
|---|
| [1505] | 1453 | PrfQueryProfileData(fmprof, FM3Str, "UserListSwitches", &fUserListSwitches, &size); | 
|---|
| [1333] | 1454 | size = sizeof(BOOL); | 
|---|
|  | 1455 | PrfQueryProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer, &size); | 
|---|
|  | 1456 | size = sizeof(BOOL); | 
|---|
|  | 1457 | PrfQueryProfileData(fmprof, appname, "DefaultDeletePerm", &fDefaultDeletePerm, &size); | 
|---|
|  | 1458 | size = sizeof(BOOL); | 
|---|
| [1505] | 1459 | PrfQueryProfileData(fmprof, FM3Str, "ExternalINIs", &fExternalINIs, &size); | 
|---|
| [1333] | 1460 | size = sizeof(BOOL); | 
|---|
| [1505] | 1461 | PrfQueryProfileData(fmprof, FM3Str, "ExternalCollector", &fExternalCollector, &size); | 
|---|
| [1333] | 1462 | size = sizeof(BOOL); | 
|---|
| [1505] | 1463 | PrfQueryProfileData(fmprof, FM3Str, "ExternalArcboxes", &fExternalArcboxes, &size); | 
|---|
| [1333] | 1464 | size = sizeof(BOOL); | 
|---|
| [1505] | 1465 | PrfQueryProfileData(fmprof, FM3Str, "ExternalViewer", &fExternalViewer, &size); | 
|---|
| [1333] | 1466 | size = sizeof(BOOL); | 
|---|
| [1505] | 1467 | PrfQueryProfileData(fmprof, FM3Str, "UseQProcStat", &fUseQProcStat, &size); | 
|---|
| [1333] | 1468 | size = sizeof(BOOL); | 
|---|
| [1505] | 1469 | PrfQueryProfileData(fmprof, FM3Str, "UseQSysState", &fUseQSysState, &size); | 
|---|
| [1333] | 1470 | size = sizeof(BOOL); | 
|---|
| [1482] | 1471 | PrfQueryProfileData(fmprof, appname, "DataMin", &fDataMin, &size); | 
|---|
| [1333] | 1472 | size = sizeof(BOOL); | 
|---|
| [1328] | 1473 | PrfQueryProfileData(fmprof, appname, "DataToFore", &fDataToFore, &size); | 
|---|
| [1333] | 1474 | size = sizeof(BOOL); | 
|---|
|  | 1475 | PrfQueryProfileData(fmprof, appname, "DataShowDrives", &fDataShowDrives, &size); | 
|---|
|  | 1476 | size = sizeof(BOOL); | 
|---|
|  | 1477 | PrfQueryProfileData(fmprof, appname, "DataInclRemote", &fDataInclRemote, &size); | 
|---|
|  | 1478 | size = sizeof(BOOL); | 
|---|
| [1505] | 1479 | PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size); | 
|---|
| [1333] | 1480 | size = sizeof(BOOL); | 
|---|
|  | 1481 | PrfQueryProfileData(fmprof, appname, "FolderAfterExtract", &fFolderAfterExtract, &size); | 
|---|
|  | 1482 | size = sizeof(BOOL); | 
|---|
| [1482] | 1483 | PrfQueryProfileData(fmprof, appname, "DullDatabar", &fDullMin, &size); | 
|---|
| [1333] | 1484 | size = sizeof(BOOL); | 
|---|
| [1328] | 1485 | PrfQueryProfileData(fmprof, appname, "BlueLED", &fBlueLED, &size); | 
|---|
| [1333] | 1486 | size = sizeof(BOOL); | 
|---|
|  | 1487 | PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size); | 
|---|
| [1471] | 1488 | size = sizeof(BOOL); | 
|---|
| [1505] | 1489 | PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size); | 
|---|
| [1328] | 1490 | size = sizeof(BOOL); | 
|---|
|  | 1491 | PrfQueryProfileData(fmprof, appname, "SyncUpdates", &fSyncUpdates, &size); | 
|---|
| [1333] | 1492 | size = sizeof(BOOL); | 
|---|
| [1328] | 1493 | PrfQueryProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, &size); | 
|---|
| [1333] | 1494 | size = sizeof(BOOL); | 
|---|
| [1328] | 1495 | PrfQueryProfileData(fmprof, appname, "UnHilite", &fUnHilite, &size); | 
|---|
| [1333] | 1496 | size = sizeof(BOOL); | 
|---|
| [1505] | 1497 | PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", &fTileBackwards, &size); | 
|---|
| [1333] | 1498 | size = sizeof(BOOL); | 
|---|
| [1328] | 1499 | PrfQueryProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, &size); | 
|---|
| [1333] | 1500 | size = sizeof(BOOL); | 
|---|
| [1328] | 1501 | PrfQueryProfileData(fmprof, appname, "VerifyWrites", &fVerify, &size); | 
|---|
| [201] | 1502 | DosSetVerify(fVerify); | 
|---|
| [1333] | 1503 | size = sizeof(BOOL); | 
|---|
| [1328] | 1504 | PrfQueryProfileData(fmprof, appname, "DontMoveMouse", &fDontMoveMouse, &size); | 
|---|
| [1333] | 1505 | size = sizeof(BOOL); | 
|---|
| [1328] | 1506 | PrfQueryProfileData(fmprof, appname, "NoIconsFiles", &fNoIconsFiles, &size); | 
|---|
| [1333] | 1507 | size = sizeof(BOOL); | 
|---|
| [1328] | 1508 | PrfQueryProfileData(fmprof, appname, "NoIconsDirs", &fNoIconsDirs, &size); | 
|---|
| [1333] | 1509 | size = sizeof(BOOL); | 
|---|
| [1328] | 1510 | PrfQueryProfileData(fmprof, appname, "ForceUpper", &fForceUpper, &size); | 
|---|
| [1333] | 1511 | size = sizeof(BOOL); | 
|---|
| [1328] | 1512 | PrfQueryProfileData(fmprof, appname, "ForceLower", &fForceLower, &size); | 
|---|
| [1333] | 1513 | size = sizeof(BOOL); | 
|---|
| [1482] | 1514 | PrfQueryProfileData(fmprof, appname, "TextTools", &fTextTools, &size); | 
|---|
| [1333] | 1515 | size = sizeof(BOOL); | 
|---|
| [1482] | 1516 | PrfQueryProfileData(fmprof, appname, "ToolTitles", &fToolTitles, &size); | 
|---|
| [1333] | 1517 | size = sizeof(BOOL); | 
|---|
| [1328] | 1518 | PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", &fDCOpens, &size); | 
|---|
| [1333] | 1519 | size = sizeof(BOOL); | 
|---|
| [1328] | 1520 | PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", &fLinkSetsIcon, &size); | 
|---|
| [1664] | 1521 | size = sizeof(BOOL); | 
|---|
|  | 1522 | PrfQueryProfileData(fmprof, appname, "WarnReadOnly", &fWarnReadOnly, &size); | 
|---|
| [1328] | 1523 | size = sizeof(INT); | 
|---|
|  | 1524 | PrfQueryProfileData(fmprof, appname, "Sort", &sortFlags, &size); | 
|---|
| [1333] | 1525 | size = sizeof(INT); | 
|---|
| [1328] | 1526 | PrfQueryProfileData(fmprof, appname, "TreeSort", &TreesortFlags, &size); | 
|---|
| [1333] | 1527 | size = sizeof(INT); | 
|---|
|  | 1528 | PrfQueryProfileData(fmprof, appname, "CollectorSort", &CollectorsortFlags, &size); | 
|---|
|  | 1529 | PrfQueryProfileString(fmprof, appname, "Targetdir", NULL, targetdir, sizeof(targetdir)); | 
|---|
| [201] | 1530 | if (!IsValidDir(targetdir)) | 
|---|
|  | 1531 | *targetdir = 0; | 
|---|
| [1333] | 1532 | PrfQueryProfileString(fmprof, appname, "ExtractPath", NULL, extractpath, sizeof(extractpath)); | 
|---|
| [1328] | 1533 | size = sizeof(BOOL); | 
|---|
| [1482] | 1534 | PrfQueryProfileData(fmprof, appname, "FileNamePathCnr", &fFileNameCnrPath, &size); | 
|---|
| [1333] | 1535 | PrfQueryProfileString(fmprof, appname, "Printer", "PRN", printer, sizeof(printer)); | 
|---|
|  | 1536 | PrfQueryProfileString(fmprof, appname, "DirCompare", NULL, dircompare, MaxComLineStrg); | 
|---|
|  | 1537 | PrfQueryProfileString(fmprof, appname, "Viewer", NULL, viewer, MaxComLineStrg); | 
|---|
|  | 1538 | PrfQueryProfileString(fmprof, appname, "Editor", NULL, editor, MaxComLineStrg); | 
|---|
|  | 1539 | PrfQueryProfileString(fmprof, appname, "BinView", NULL, binview, MaxComLineStrg); | 
|---|
|  | 1540 | PrfQueryProfileString(fmprof, appname, "BinEd", NULL, bined, MaxComLineStrg); | 
|---|
|  | 1541 | PrfQueryProfileString(fmprof, appname, "Compare", NULL, compare, MaxComLineStrg); | 
|---|
|  | 1542 | PrfQueryProfileString(fmprof, appname, "Virus", NULL, virus, MaxComLineStrg); | 
|---|
| [1328] | 1543 | size = sizeof(BOOL); | 
|---|
|  | 1544 | PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size); | 
|---|
| [1333] | 1545 | PrfQueryProfileString(fmprof, appname, "FTPRun", NULL, ftprun, MaxComLineStrg); | 
|---|
| [917] | 1546 | if (!*ftprun) | 
|---|
| [892] | 1547 | fFtpRunWPSDefault = TRUE; | 
|---|
| [1328] | 1548 | size = sizeof(BOOL); | 
|---|
|  | 1549 | PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size); | 
|---|
| [1333] | 1550 | PrfQueryProfileString(fmprof, appname, "HTTPRun", NULL, httprun, MaxComLineStrg); | 
|---|
| [917] | 1551 | if (!*httprun) | 
|---|
| [892] | 1552 | fHttpRunWPSDefault = TRUE; | 
|---|
| [1333] | 1553 | PrfQueryProfileString(fmprof, appname, "MailRun", NULL, mailrun, MaxComLineStrg); | 
|---|
|  | 1554 | PrfQueryProfileString(fmprof, appname, "FtpRunDir", NULL, ftprundir, sizeof(ftprundir)); | 
|---|
|  | 1555 | PrfQueryProfileString(fmprof, appname, "HttpRunDir", NULL, httprundir, sizeof(httprundir)); | 
|---|
|  | 1556 | PrfQueryProfileString(fmprof, appname, "MailRunDir", NULL, mailrundir, sizeof(mailrundir)); | 
|---|
|  | 1557 | PrfQueryProfileString(fmprof, appname, "LastToolbar", NULL, lasttoolbar, sizeof(lasttoolbar)); | 
|---|
| [1328] | 1558 | size = sizeof(BOOL); | 
|---|
| [1333] | 1559 | PrfQueryProfileData(fmprof, appname, "LibPathStrictHttpRun", &fLibPathStrictHttpRun, &size); | 
|---|
|  | 1560 | size = sizeof(BOOL); | 
|---|
|  | 1561 | PrfQueryProfileData(fmprof, appname, "LibPathStrictFtpRun", &fLibPathStrictFtpRun, &size); | 
|---|
|  | 1562 | size = sizeof(BOOL); | 
|---|
|  | 1563 | PrfQueryProfileData(fmprof, appname, "LibPathStrictMailRun", &fLibPathStrictMailRun, &size); | 
|---|
|  | 1564 | size = sizeof(BOOL); | 
|---|
|  | 1565 | PrfQueryProfileData(fmprof, appname, "NoMailtoMailRun", &fNoMailtoMailRun, &size); | 
|---|
|  | 1566 | size = sizeof(BOOL); | 
|---|
|  | 1567 | PrfQueryProfileData(fmprof, appname, "FollowTree", &fFollowTree, &size); | 
|---|
|  | 1568 | size = sizeof(BOOL); | 
|---|
|  | 1569 | PrfQueryProfileData(fmprof, appname, "StartMaximized", &fStartMaximized, &size); | 
|---|
| [551] | 1570 | if (!fStartMaximized) { | 
|---|
| [1333] | 1571 | size = sizeof(BOOL); | 
|---|
|  | 1572 | PrfQueryProfileData(fmprof, appname, "StartMinimized", &fStartMinimized, &size); | 
|---|
| [2] | 1573 | } | 
|---|
| [1333] | 1574 | size = sizeof(BOOL); | 
|---|
| [1328] | 1575 | PrfQueryProfileData(fmprof, appname, "DefaultCopy", &fCopyDefault, &size); | 
|---|
| [1333] | 1576 | size = sizeof(BOOL); | 
|---|
| [1328] | 1577 | PrfQueryProfileData(fmprof, appname, "IdleCopy", &fRealIdle, &size); | 
|---|
| [1333] | 1578 | size = sizeof(BOOL); | 
|---|
|  | 1579 | PrfQueryProfileData(fmprof, appname, "ArcStuffVisible", &fArcStuffVisible, &size); | 
|---|
|  | 1580 | size = sizeof(BOOL); | 
|---|
| [1482] | 1581 | PrfQueryProfileData(fmprof, appname, "NoTreeGap", &fNoTreeGap, &size); | 
|---|
| [1333] | 1582 | size = sizeof(BOOL); | 
|---|
| [1505] | 1583 | PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS, &size); | 
|---|
| [1333] | 1584 | size = sizeof(BOOL); | 
|---|
| [1328] | 1585 | PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size); | 
|---|
| [1333] | 1586 | size = sizeof(BOOL); | 
|---|
| [1354] | 1587 | PrfQueryProfileData(fmprof, appname, "RScanLocal", &fRScanLocal, &size); | 
|---|
|  | 1588 | size = sizeof(BOOL); | 
|---|
|  | 1589 | PrfQueryProfileData(fmprof, appname, "RScanRemote", &fRScanRemote, &size); | 
|---|
|  | 1590 | size = sizeof(BOOL); | 
|---|
|  | 1591 | PrfQueryProfileData(fmprof, appname, "RScanVirtual", &fRScanVirtual, &size); | 
|---|
|  | 1592 | size = sizeof(BOOL); | 
|---|
|  | 1593 | PrfQueryProfileData(fmprof, appname, "RScanSlow", &fRScanSlow, &size); | 
|---|
|  | 1594 | size = sizeof(BOOL); | 
|---|
|  | 1595 | PrfQueryProfileData(fmprof, appname, "RScanNoWrite", &fRScanNoWrite, &size); | 
|---|
|  | 1596 | size = sizeof(BOOL); | 
|---|
| [1365] | 1597 | PrfQueryProfileData(fmprof, appname, "EjectRemovableScan", &fEjectRemovableScan, &size); | 
|---|
|  | 1598 | size = sizeof(BOOL); | 
|---|
|  | 1599 | PrfQueryProfileData(fmprof, appname, "EjectCDScan", &fEjectCDScan, &size); | 
|---|
|  | 1600 | size = sizeof(BOOL); | 
|---|
|  | 1601 | PrfQueryProfileData(fmprof, appname, "EjectFlpyScan", &fEjectFlpyScan, &size); | 
|---|
|  | 1602 | size = sizeof(BOOL); | 
|---|
| [1333] | 1603 | PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", &fDragndropDlg, &size); | 
|---|
|  | 1604 | size = sizeof(BOOL); | 
|---|
| [1505] | 1605 | PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size); | 
|---|
| [1333] | 1606 | size = sizeof(BOOL); | 
|---|
| [1505] | 1607 | PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, &size); | 
|---|
| [1333] | 1608 | size = sizeof(BOOL); | 
|---|
|  | 1609 | PrfQueryProfileData(fmprof, appname, "QuickArcFind", &fQuickArcFind, &size); | 
|---|
|  | 1610 | size = sizeof(BOOL); | 
|---|
| [1482] | 1611 | PrfQueryProfileData(fmprof, appname, "NoRemovableScan", &fNoRemovableScan, &size); | 
|---|
| [1328] | 1612 | size = sizeof(ULONG); | 
|---|
| [1505] | 1613 | PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", &NoBrokenNotify, &size); | 
|---|
| [1333] | 1614 | size = sizeof(ULONG); | 
|---|
|  | 1615 | PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType, &size); | 
|---|
|  | 1616 | size = sizeof(ULONG); | 
|---|
| [1328] | 1617 | PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size); | 
|---|
| [789] | 1618 | if (FilesToGet < FILESTOGET_MIN) | 
|---|
|  | 1619 | FilesToGet = FILESTOGET_MIN; | 
|---|
|  | 1620 | else if (FilesToGet > FILESTOGET_MAX) | 
|---|
|  | 1621 | FilesToGet = FILESTOGET_MAX; | 
|---|
| [1328] | 1622 | size = sizeof(BOOL); | 
|---|
| [1482] | 1623 | PrfQueryProfileData(fmprof, appname, "AutoView", &fAutoView, &size); | 
|---|
| [1333] | 1624 | size = sizeof(BOOL); | 
|---|
| [1482] | 1625 | PrfQueryProfileData(fmprof, appname, "FM2Deletes", &fFM2Deletes, &size); | 
|---|
| [1333] | 1626 | size = sizeof(BOOL); | 
|---|
| [1482] | 1627 | PrfQueryProfileData(fmprof, appname, "TrashCan", &fTrashCan, &size); | 
|---|
| [1642] | 1628 | size = sizeof(BOOL); | 
|---|
|  | 1629 | PrfQueryProfileData(fmprof, appname, "ThreadNotes", &fThreadNotes, &size); | 
|---|
|  | 1630 | if (fThreadNotes) | 
|---|
|  | 1631 | ShowNote(); | 
|---|
| [1753] | 1632 | size = sizeof(BOOL); | 
|---|
|  | 1633 | PrfQueryProfileData(fmprof, FM3Str, "DontAskBzip", &fDontAskBzip, &size); | 
|---|
|  | 1634 | size = sizeof(BOOL); | 
|---|
|  | 1635 | PrfQueryProfileData(fmprof, FM3Str, "DontAskGzip", &fDontAskGzip, &size); | 
|---|
| [2] | 1636 |  | 
|---|
| [1409] | 1637 | LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE); | 
|---|
| [784] | 1638 |  | 
|---|
| [1673] | 1639 | // load pointers and icons we use | 
|---|
| [189] | 1640 | hptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE); | 
|---|
|  | 1641 | hptrBusy = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE); | 
|---|
|  | 1642 | hptrNS = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZENS, FALSE); | 
|---|
|  | 1643 | hptrEW = WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, FALSE); | 
|---|
|  | 1644 | hptrFloppy = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FLOPPY_ICON); | 
|---|
|  | 1645 | hptrDrive = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DRIVE_ICON); | 
|---|
|  | 1646 | hptrRemovable = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOVABLE_ICON); | 
|---|
|  | 1647 | hptrCDROM = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, CDROM_ICON); | 
|---|
|  | 1648 | hptrFile = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_ICON); | 
|---|
|  | 1649 | hptrDir = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIR_FRAME); | 
|---|
|  | 1650 | hptrArc = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ARC_FRAME); | 
|---|
|  | 1651 | hptrArt = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ART_ICON); | 
|---|
|  | 1652 | hptrSystem = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_SYSTEM_ICON); | 
|---|
|  | 1653 | hptrHidden = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_HIDDEN_ICON); | 
|---|
| [552] | 1654 | hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON); | 
|---|
| [189] | 1655 | hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON); | 
|---|
|  | 1656 | hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON); | 
|---|
| [552] | 1657 | hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON); | 
|---|
|  | 1658 | hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON); | 
|---|
| [189] | 1659 | if (!fNoDead) | 
|---|
|  | 1660 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON); | 
|---|
| [2] | 1661 | else | 
|---|
| [189] | 1662 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON); | 
|---|
|  | 1663 | hptrApp = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, APP_ICON); | 
|---|
|  | 1664 | hptrDunno = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DUNNO_ICON); | 
|---|
|  | 1665 | hptrEnv = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ENV_ICON); | 
|---|
|  | 1666 | hptrZipstrm = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, ZIPSTREAM_ICON); | 
|---|
| [2] | 1667 |  | 
|---|
| [201] | 1668 | // set up color array used by seeall.c and newview.c color dialog | 
|---|
|  | 1669 |  | 
|---|
| [189] | 1670 | standardcolors[0] = CLR_WHITE; | 
|---|
|  | 1671 | standardcolors[1] = CLR_BLACK; | 
|---|
|  | 1672 | standardcolors[2] = CLR_BLUE; | 
|---|
|  | 1673 | standardcolors[3] = CLR_RED; | 
|---|
|  | 1674 | standardcolors[4] = CLR_PINK; | 
|---|
|  | 1675 | standardcolors[5] = CLR_GREEN; | 
|---|
|  | 1676 | standardcolors[6] = CLR_CYAN; | 
|---|
|  | 1677 | standardcolors[7] = CLR_YELLOW; | 
|---|
|  | 1678 | standardcolors[8] = CLR_DARKGRAY; | 
|---|
|  | 1679 | standardcolors[9] = CLR_DARKBLUE; | 
|---|
| [2] | 1680 | standardcolors[10] = CLR_DARKRED; | 
|---|
|  | 1681 | standardcolors[11] = CLR_DARKPINK; | 
|---|
|  | 1682 | standardcolors[12] = CLR_DARKGREEN; | 
|---|
|  | 1683 | standardcolors[13] = CLR_DARKCYAN; | 
|---|
|  | 1684 | standardcolors[14] = CLR_BROWN; | 
|---|
|  | 1685 | standardcolors[15] = CLR_PALEGRAY; | 
|---|
|  | 1686 |  | 
|---|
|  | 1687 | return TRUE; | 
|---|
|  | 1688 | } | 
|---|
|  | 1689 |  | 
|---|
| [189] | 1690 | HWND StartFM3(HAB hab, INT argc, CHAR ** argv) | 
|---|
|  | 1691 | { | 
|---|
| [201] | 1692 | HWND hwndFrame; | 
|---|
|  | 1693 | HWND hwndClient; | 
|---|
|  | 1694 | UINT x; | 
|---|
| [189] | 1695 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU | | 
|---|
| [551] | 1696 | FCF_SIZEBORDER | FCF_MINMAX | | 
|---|
|  | 1697 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN; | 
|---|
| [2] | 1698 |  | 
|---|
| [551] | 1699 | for (x = 1; x < argc; x++) { | 
|---|
| [201] | 1700 | if (*argv[x] == '~' && !argv[x][1]) | 
|---|
|  | 1701 | fReminimize = TRUE; | 
|---|
|  | 1702 | if (*argv[x] == '+' && !argv[x][1]) | 
|---|
|  | 1703 | fLogFile = TRUE; | 
|---|
| [551] | 1704 | if (*argv[x] == '-') { | 
|---|
| [201] | 1705 | if (!argv[x][1]) | 
|---|
| [1335] | 1706 | fNoSaveState = TRUE; | 
|---|
| [201] | 1707 | else | 
|---|
| [1335] | 1708 | strcpy(profile, &argv[x][1]); | 
|---|
| [2] | 1709 | } | 
|---|
| [1720] | 1710 | if (*argv[x] == '#' && !argv[x][1]) | 
|---|
|  | 1711 | fUseShellEnv = TRUE; | 
|---|
| [2] | 1712 | } | 
|---|
|  | 1713 |  | 
|---|
|  | 1714 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP, | 
|---|
| [1335] | 1715 | WS_VISIBLE, | 
|---|
|  | 1716 | &FrameFlags, | 
|---|
| [1498] | 1717 | (CHAR *) WC_MAINWND, | 
|---|
| [1335] | 1718 | NULL, | 
|---|
|  | 1719 | WS_VISIBLE | WS_ANIMATE, | 
|---|
|  | 1720 | FM3ModHandle, MAIN_FRAME, &hwndClient); | 
|---|
| [551] | 1721 | if (hwndFrame) { | 
|---|
|  | 1722 | WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME); | 
|---|
| [875] | 1723 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU); | 
|---|
| [1498] | 1724 | if (!WinRestoreWindowPos((CHAR *) FM2Str, "MainWindowPos", hwndFrame)) { | 
|---|
| [2] | 1725 |  | 
|---|
|  | 1726 | ULONG fl = SWP_MOVE | SWP_SIZE; | 
|---|
|  | 1727 | RECTL rcl; | 
|---|
| [189] | 1728 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L; | 
|---|
|  | 1729 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER); | 
|---|
| [2] | 1730 |  | 
|---|
| [551] | 1731 | WinQueryWindowRect(HWND_DESKTOP, &rcl); | 
|---|
| [2] | 1732 | rcl.yBottom += icz; | 
|---|
|  | 1733 | rcl.yTop -= bsz; | 
|---|
|  | 1734 | rcl.xLeft += bsz; | 
|---|
|  | 1735 | rcl.xRight -= bsz; | 
|---|
|  | 1736 | WinSetWindowPos(hwndFrame, | 
|---|
| [1335] | 1737 | HWND_TOP, | 
|---|
|  | 1738 | rcl.xLeft, | 
|---|
|  | 1739 | rcl.yBottom, | 
|---|
|  | 1740 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl); | 
|---|
| [2] | 1741 | } | 
|---|
| [1544] | 1742 | if (fLogFile) { | 
|---|
|  | 1743 | CHAR *modea = "a+"; | 
|---|
|  | 1744 |  | 
|---|
|  | 1745 | LogFileHandle = xfsopen("FM2.LOG", modea, SH_DENYWR, pszSrcFile, __LINE__, TRUE); | 
|---|
|  | 1746 | } | 
|---|
| [189] | 1747 | if (hwndHelp) | 
|---|
| [551] | 1748 | WinAssociateHelpInstance(hwndHelp, hwndFrame); | 
|---|
|  | 1749 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv)); | 
|---|
| [2] | 1750 | } | 
|---|
|  | 1751 | return hwndFrame; | 
|---|
|  | 1752 | } | 
|---|
| [32] | 1753 |  | 
|---|
| [985] | 1754 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset) | 
|---|
|  | 1755 | { | 
|---|
|  | 1756 | HFILE handle; | 
|---|
|  | 1757 | ULONG action; | 
|---|
|  | 1758 | ULONG len = strlen(signature); | 
|---|
|  | 1759 | ULONG l; | 
|---|
| [1156] | 1760 | CHAR buffer[4096];                    // 06 Oct 07 SHL Protect against NTFS defect | 
|---|
| [985] | 1761 | BOOL ret = FALSE; | 
|---|
|  | 1762 |  | 
|---|
|  | 1763 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1764 | if (DosOpen(filespec, | 
|---|
| [1335] | 1765 | &handle, | 
|---|
|  | 1766 | &action, | 
|---|
|  | 1767 | 0, | 
|---|
|  | 1768 | 0, | 
|---|
|  | 1769 | OPEN_ACTION_FAIL_IF_NEW | | 
|---|
|  | 1770 | OPEN_ACTION_OPEN_IF_EXISTS, | 
|---|
|  | 1771 | OPEN_FLAGS_FAIL_ON_ERROR | | 
|---|
|  | 1772 | OPEN_FLAGS_NOINHERIT | | 
|---|
|  | 1773 | OPEN_FLAGS_RANDOMSEQUENTIAL | | 
|---|
|  | 1774 | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0)) | 
|---|
| [985] | 1775 | ret = FALSE; | 
|---|
|  | 1776 | else { | 
|---|
|  | 1777 | // Try signature match | 
|---|
|  | 1778 | l = len; | 
|---|
|  | 1779 | l = min(l, 79); | 
|---|
|  | 1780 | if (!DosChgFilePtr(handle, | 
|---|
| [1335] | 1781 | abs(offset), | 
|---|
|  | 1782 | (offset >= 0) ? | 
|---|
|  | 1783 | FILE_BEGIN : FILE_END, &len)) { | 
|---|
| [985] | 1784 | if (!DosRead(handle, buffer, l, &len) && len == l) { | 
|---|
| [1335] | 1785 | if (!memcmp(signature, buffer, l)) | 
|---|
|  | 1786 | ret = TRUE;                   // Matched | 
|---|
| [985] | 1787 | } | 
|---|
|  | 1788 | } | 
|---|
|  | 1789 | } | 
|---|
| [1673] | 1790 | DosClose(handle);                     // Either way, we're done for now | 
|---|
|  | 1791 | return ret;                           // Return TRUE if matched | 
|---|
| [985] | 1792 | } | 
|---|
|  | 1793 |  | 
|---|
| [189] | 1794 | int CheckVersion(int vermajor, int verminor) | 
|---|
|  | 1795 | { | 
|---|
| [179] | 1796 | int ok = 0; | 
|---|
| [32] | 1797 |  | 
|---|
| [179] | 1798 | // fixme to do useful check - was missing in base source | 
|---|
|  | 1799 |  | 
|---|
| [32] | 1800 | #if 0 | 
|---|
| [551] | 1801 | if (vermajor && verminor) { | 
|---|
| [32] | 1802 | *vermajor = VERMAJOR; | 
|---|
|  | 1803 | *verminor = VERMINOR; | 
|---|
| [179] | 1804 | ok = 1; | 
|---|
| [32] | 1805 | } | 
|---|
|  | 1806 | #endif | 
|---|
| [189] | 1807 |  | 
|---|
| [179] | 1808 | ok = 1; | 
|---|
| [32] | 1809 |  | 
|---|
| [179] | 1810 | return ok; | 
|---|
| [32] | 1811 | } | 
|---|
| [783] | 1812 |  | 
|---|
|  | 1813 | #ifdef __WATCOMC__ | 
|---|
|  | 1814 | #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL) | 
|---|
|  | 1815 | #pragma alloc_text(INIT1,StartFM3,FindSwapperDat) | 
|---|
|  | 1816 | #endif | 
|---|