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