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