| 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 | 
|---|
| 9 | Copyright (c) 2001, 2009 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 |  | 
|---|
| 98 | ***********************************************************************/ | 
|---|
| 99 |  | 
|---|
| 100 | #include <stdlib.h> | 
|---|
| 101 | #include <string.h> | 
|---|
| 102 | #include <share.h> | 
|---|
| 103 | #include <process.h>                    // getpid | 
|---|
| 104 | #include <time.h> | 
|---|
| 105 | #include <ctype.h> | 
|---|
| 106 |  | 
|---|
| 107 | #define INCL_DOS | 
|---|
| 108 | #define INCL_WIN | 
|---|
| 109 | #define INCL_MMIOOS2 | 
|---|
| 110 | #define INCL_GPI | 
|---|
| 111 | #define INCL_DOSERRORS | 
|---|
| 112 | #define INCL_LONGLONG | 
|---|
| 113 | #define INCL_DOSNLS | 
|---|
| 114 | #include <os2.h> | 
|---|
| 115 | #include <os2me.h> | 
|---|
| 116 |  | 
|---|
| 117 | #define DEFINE_GLOBALS 1 | 
|---|
| 118 |  | 
|---|
| 119 | #include "fm3dll.h" | 
|---|
| 120 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc. | 
|---|
| 121 | #include "init.h" | 
|---|
| 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) | 
|---|
| 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) | 
|---|
| 133 | #include "fm3dlg.h" | 
|---|
| 134 | #include "datamin.h" | 
|---|
| 135 | #include "tools.h" | 
|---|
| 136 | #include "fm3str.h" | 
|---|
| 137 | #include "version.h" | 
|---|
| 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 | 
|---|
| 144 | #include "mainwnd.h"                    // BubbleProc, ChildButtonProc, DriveBackProc, | 
|---|
| 145 | // DriveProc, LEDProc, MainWndProc, StatusProc | 
|---|
| 146 | // ToolBackProc | 
|---|
| 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 | 
|---|
| 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 | 
|---|
| 165 | #include "misc.h"                       // HeapThread, LoadDetailsSwitches | 
|---|
| 166 | #include "notebook.h"                   // command line variables (editor etc) | 
|---|
| 167 | #include "strips.h"                     // bstrip | 
|---|
| 168 | #include "killproc.h"                   // GetDosPgmName | 
|---|
| 169 | #include "srchpath.h"                   // searchpath | 
|---|
| 170 | #include "fortify.h" | 
|---|
| 171 | #include "excputil.h"                   // xbeginthread | 
|---|
| 172 | #include "systemf.h"                    // runemf2 | 
|---|
| 173 |  | 
|---|
| 174 | extern int _CRT_init(void); | 
|---|
| 175 | extern void _CRT_term(void); | 
|---|
| 176 |  | 
|---|
| 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 |  | 
|---|
| 186 | static VOID FindSwapperDat(VOID); | 
|---|
| 187 |  | 
|---|
| 188 | // Data definitions | 
|---|
| 189 | static PSZ pszSrcFile = __FILE__; | 
|---|
| 190 | unsigned __MaxThreads = {48}; | 
|---|
| 191 |  | 
|---|
| 192 | #pragma data_seg(GLOBAL1) | 
|---|
| 193 | HMTX hmtxFM2Delete; | 
|---|
| 194 | HMTX hmtxFM2Globals; | 
|---|
| 195 | HMTX hmtFillingTreeCnr; | 
|---|
| 196 | HEV  hevInitialCnrScanComplete; | 
|---|
| 197 | ULONG OS2ver[2]; | 
|---|
| 198 | PFNWP PFNWPCnr; | 
|---|
| 199 | PFNWP PFNWPMLE; | 
|---|
| 200 | CHAR ThousandsSeparator[2]; | 
|---|
| 201 | CHAR DateSeparator[2]; | 
|---|
| 202 | CHAR TimeSeparator[2]; | 
|---|
| 203 | ULONG ulTimeFmt; | 
|---|
| 204 | ULONG ulDateFmt; | 
|---|
| 205 | BOOL fDontSuggestAgain; | 
|---|
| 206 | BOOL fInitialDriveScan; | 
|---|
| 207 | BOOL fAmAV2; | 
|---|
| 208 | BOOL fChangeTarget; | 
|---|
| 209 | BOOL fIniExisted; | 
|---|
| 210 | BOOL fLogFile; | 
|---|
| 211 | BOOL fProtectOnly; | 
|---|
| 212 | BOOL fReminimize; | 
|---|
| 213 | BOOL fWantFirstTimeInit; | 
|---|
| 214 | //BOOL fDrivetoSkip[26]; | 
|---|
| 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) | 
|---|
| 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"; | 
|---|
| 247 | PCSZ PCSZ_IMAGEEXE    = "IMAGE.EXE"; | 
|---|
| 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"; | 
|---|
| 257 | PCSZ PCSZ_DIRCMP      = "DirCmp"; | 
|---|
| 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"; | 
|---|
| 269 | HMODULE FM3DllHandle; | 
|---|
| 270 | PCSZ FM3Folder        = "<FM3_Folder>"; | 
|---|
| 271 | PCSZ FNT_HELVETICA        =  "Helvetica"; | 
|---|
| 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"; | 
|---|
| 281 | CHAR HomePath[CCHMAXPATH]; | 
|---|
| 282 | PCSZ LONGNAME             = ".LONGNAME"; | 
|---|
| 283 | CHAR *NullStr             = ""; | 
|---|
| 284 | PCSZ PCSZ_CM_ALLOCRECORD  = "CM_ALLOCRECORD"; | 
|---|
| 285 | PCSZ PCSZ_DOSCREATEMUTEXSEM =  "DosCreateMutexSem"; | 
|---|
| 286 | PCSZ PCSZ_DOSCREATEEVENTSEM =  "DosCreateEventSem"; | 
|---|
| 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"; | 
|---|
| 303 | PCSZ PCSZ_BACKSLASH     = "\\"; | 
|---|
| 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"; | 
|---|
| 319 | PCSZ PCSZ_DOTMPG   =  ".MPG"; | 
|---|
| 320 | PCSZ PCSZ_DOTMPEG  =  ".MPEG"; | 
|---|
| 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"; | 
|---|
| 338 | CHAR SwapperDat[CCHMAXPATH]; | 
|---|
| 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"; | 
|---|
| 368 | CHAR profile[CCHMAXPATH]; | 
|---|
| 369 | ULONGLONG ullTmpSpaceNeeded = 5120000; | 
|---|
| 370 |  | 
|---|
| 371 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset); | 
|---|
| 372 |  | 
|---|
| 373 | VOID FindSwapperDat(VOID) | 
|---|
| 374 | { | 
|---|
| 375 | CHAR filename[] = "C:\\CONFIG.SYS"; | 
|---|
| 376 | CHAR input[8192]; | 
|---|
| 377 | CHAR *p; | 
|---|
| 378 | CHAR *pp; | 
|---|
| 379 | FILE *fp; | 
|---|
| 380 | FILEFINDBUF3L ffb; | 
|---|
| 381 | ULONG nm; | 
|---|
| 382 | ULONG size = sizeof(SwapperDat); | 
|---|
| 383 | HDIR hdir = HDIR_CREATE; | 
|---|
| 384 | APIRET rc = 1; | 
|---|
| 385 |  | 
|---|
| 386 | *SwapperDat = 0; | 
|---|
| 387 | // Check already known | 
|---|
| 388 | PrfQueryProfileData(fmprof, FM3Str, "SwapperDat", SwapperDat, &size); | 
|---|
| 389 | if (*SwapperDat) { | 
|---|
| 390 | nm = 1; | 
|---|
| 391 | rc = DosFindFirst(SwapperDat, | 
|---|
| 392 | &hdir, | 
|---|
| 393 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| 394 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
| 395 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL); | 
|---|
| 396 | if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) { | 
|---|
| 397 | FILEFINDBUF3 ffb; | 
|---|
| 398 | rc = DosFindFirst(SwapperDat, | 
|---|
| 399 | &hdir, | 
|---|
| 400 | FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| 401 | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, | 
|---|
| 402 | &ffb, sizeof(ffb), &nm, FIL_STANDARD); | 
|---|
| 403 | fNoLargeFileSupport = TRUE; | 
|---|
| 404 | } | 
|---|
| 405 | if (!rc) { | 
|---|
| 406 | DosFindClose(hdir); | 
|---|
| 407 | fp = fopen(SwapperDat, "r"); | 
|---|
| 408 | if (fp) { | 
|---|
| 409 | fclose(fp); | 
|---|
| 410 | *SwapperDat = 0; | 
|---|
| 411 | rc = 1;                         // Force config.sys scan | 
|---|
| 412 | } | 
|---|
| 413 | } | 
|---|
| 414 | else | 
|---|
| 415 | *SwapperDat = 0; | 
|---|
| 416 | } | 
|---|
| 417 | // If not defined in INI or INI wrong, scan config.sys for SWAPPATH statement | 
|---|
| 418 | if (rc) { | 
|---|
| 419 | if (DosQuerySysInfo(QSV_BOOT_DRIVE, | 
|---|
| 420 | QSV_BOOT_DRIVE, | 
|---|
| 421 | &nm, | 
|---|
| 422 | sizeof(ULONG))) { | 
|---|
| 423 | nm = 3;                           // Assume drive C: | 
|---|
| 424 | } | 
|---|
| 425 | *filename = (CHAR) nm + '@'; | 
|---|
| 426 | fp = xfsopen(filename, "r", SH_DENYNO, pszSrcFile, __LINE__); | 
|---|
| 427 | if (fp) { | 
|---|
| 428 | while (!feof(fp)) { | 
|---|
| 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++; | 
|---|
| 438 | bstripcr(p); | 
|---|
| 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, | 
|---|
| 462 | &ffb, sizeof(ffb), &nm, FIL_STANDARDL); | 
|---|
| 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 | 
|---|
| 483 | }                                 // while | 
|---|
| 484 | fclose(fp); | 
|---|
| 485 | } | 
|---|
| 486 | } | 
|---|
| 487 | } | 
|---|
| 488 |  | 
|---|
| 489 | unsigned APIENTRY LibMain(unsigned hModule, | 
|---|
| 490 | unsigned ulFlag) | 
|---|
| 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; | 
|---|
| 500 | FM3UL = *(ULONG *)FM3Str; | 
|---|
| 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 |  | 
|---|
| 514 | VOID APIENTRY DeInitFM3DLL(ULONG why) | 
|---|
| 515 | { | 
|---|
| 516 | /* cleanup */ | 
|---|
| 517 | static CHAR s[CCHMAXPATH]; | 
|---|
| 518 | CHAR *enddir, szTempFile[CCHMAXPATH]; | 
|---|
| 519 | HDIR search_handle; | 
|---|
| 520 | ULONG num_matches; | 
|---|
| 521 | FILEFINDBUF3 ffb; | 
|---|
| 522 |  | 
|---|
| 523 | StopTimer(); | 
|---|
| 524 | StopPrinting = 1; | 
|---|
| 525 |  | 
|---|
| 526 | if (LogFileHandle) | 
|---|
| 527 | fclose(LogFileHandle); | 
|---|
| 528 |  | 
|---|
| 529 | if (fmprof) { | 
|---|
| 530 | PrfCloseProfile(fmprof); | 
|---|
| 531 | fmprof = (HINI) 0; | 
|---|
| 532 | if (fIniExisted) { | 
|---|
| 533 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 534 | DosCopy("FM3.INI", "FM3INI.BAK", DCPY_EXISTING); | 
|---|
| 535 | } | 
|---|
| 536 | } | 
|---|
| 537 |  | 
|---|
| 538 | if (fToolsChanged) | 
|---|
| 539 | save_tools(NULL); | 
|---|
| 540 | fcloseall(); | 
|---|
| 541 | save_dir(s); | 
|---|
| 542 | AddBackslashToPath(s); | 
|---|
| 543 | //if (s[strlen(s) - 1] != '\\') | 
|---|
| 544 | //  strcat(s, "\\"); | 
|---|
| 545 | enddir = &s[strlen(s)]; | 
|---|
| 546 | if (*ArcTempRoot) { | 
|---|
| 547 | strcat(s, ArcTempRoot); | 
|---|
| 548 | strcat(s, "*"); | 
|---|
| 549 | search_handle = HDIR_CREATE; | 
|---|
| 550 | num_matches = 1L; | 
|---|
| 551 | if (!DosFindFirst(s, | 
|---|
| 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)) { | 
|---|
| 557 | do { | 
|---|
| 558 | strcpy(enddir, ffb.achName); | 
|---|
| 559 | if (ffb.attrFile & FILE_DIRECTORY) { | 
|---|
| 560 | wipeallf("%s\\*", s); | 
|---|
| 561 | DosDeleteDir(s); | 
|---|
| 562 | } | 
|---|
| 563 | else | 
|---|
| 564 | unlinkf(s); | 
|---|
| 565 | } | 
|---|
| 566 | while (!DosFindNext(search_handle, | 
|---|
| 567 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
| 568 | DosFindClose(search_handle); | 
|---|
| 569 | } | 
|---|
| 570 | } | 
|---|
| 571 | if (pTmpDir) | 
|---|
| 572 | strcpy(s, pTmpDir); | 
|---|
| 573 | else | 
|---|
| 574 | strcpy(s, pFM2SaveDirectory); | 
|---|
| 575 | AddBackslashToPath(s); | 
|---|
| 576 | //if (s[strlen(s) - 1] != '\\') | 
|---|
| 577 | //  strcat(s, "\\"); | 
|---|
| 578 | enddir = &s[strlen(s)]; | 
|---|
| 579 | strcat(s, "$FM2LI$T."); | 
|---|
| 580 | strcat(s, "???"); | 
|---|
| 581 | search_handle = HDIR_CREATE; | 
|---|
| 582 | num_matches = 1; | 
|---|
| 583 | if (!DosFindFirst(s, | 
|---|
| 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)) { | 
|---|
| 589 | do { | 
|---|
| 590 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
| 591 | strcpy(enddir, ffb.achName); | 
|---|
| 592 | unlinkf(s); | 
|---|
| 593 | } | 
|---|
| 594 | } | 
|---|
| 595 | while (!DosFindNext(search_handle, | 
|---|
| 596 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
| 597 | DosFindClose(search_handle); | 
|---|
| 598 | } | 
|---|
| 599 | BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP); | 
|---|
| 600 | DosForceDelete(szTempFile); | 
|---|
| 601 | if (pTmpDir) { | 
|---|
| 602 | wipeallf("%s\\*", pTmpDir); | 
|---|
| 603 | DosDeleteDir(pTmpDir); | 
|---|
| 604 | } | 
|---|
| 605 | EndNote(); | 
|---|
| 606 | if (FM3ModHandle) | 
|---|
| 607 | DosFreeModule(FM3ModHandle); | 
|---|
| 608 |  | 
|---|
| 609 | DosExitList(EXLST_REMOVE, DeInitFM3DLL); | 
|---|
| 610 | } | 
|---|
| 611 |  | 
|---|
| 612 | BOOL InitFM3DLL(HAB hab, int argc, char **argv) | 
|---|
| 613 | { | 
|---|
| 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; | 
|---|
| 620 | APIRET rc; | 
|---|
| 621 | APIRET rcl; | 
|---|
| 622 | APIRET rcq; | 
|---|
| 623 | PFN pfnResVersion; | 
|---|
| 624 | ULONG RVMajor; | 
|---|
| 625 | ULONG RVMinor; | 
|---|
| 626 | ULONG ret; | 
|---|
| 627 | FILESTATUS3 fs3; | 
|---|
| 628 | PSZ env; | 
|---|
| 629 | CHAR dllfile[CCHMAXPATH]; | 
|---|
| 630 | ULONG size; | 
|---|
| 631 | BOOL fSeparateParmsApp; | 
|---|
| 632 |  | 
|---|
| 633 | strcpy(dllfile, "FM3RES"); | 
|---|
| 634 | env = getenv("FM3INI"); | 
|---|
| 635 | if (env) { | 
|---|
| 636 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 637 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| 638 | if (!rc) { | 
|---|
| 639 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| 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"); | 
|---|
| 644 | } | 
|---|
| 645 | } | 
|---|
| 646 | } | 
|---|
| 647 |  | 
|---|
| 648 | rcl = DosLoadModule(NULL, 0, dllfile, &FM3ModHandle); | 
|---|
| 649 | if (rcl) { | 
|---|
| 650 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
| 651 | HWND_DESKTOP, | 
|---|
| 652 | GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT)); | 
|---|
| 653 | return FALSE; | 
|---|
| 654 | } | 
|---|
| 655 |  | 
|---|
| 656 | rc = DosExitList(EXLST_ADD, DeInitFM3DLL); | 
|---|
| 657 | if (rc) { | 
|---|
| 658 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 659 | "DosExitList"); | 
|---|
| 660 | } | 
|---|
| 661 |  | 
|---|
| 662 | rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion); | 
|---|
| 663 | if (!rcq) | 
|---|
| 664 | ret = pfnResVersion(&RVMajor, &RVMinor); | 
|---|
| 665 | else { | 
|---|
| 666 | ret = 0; | 
|---|
| 667 | RVMajor = 0; | 
|---|
| 668 | RVMinor = 0; | 
|---|
| 669 | } | 
|---|
| 670 |  | 
|---|
| 671 | if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) { | 
|---|
| 672 | saymsg(MB_ENTER, | 
|---|
| 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); | 
|---|
| 681 | return FALSE; | 
|---|
| 682 | } | 
|---|
| 683 |  | 
|---|
| 684 | if (!*profile) | 
|---|
| 685 | strcpy(profile, "FM3.INI"); | 
|---|
| 686 | mypid = getpid(); | 
|---|
| 687 | /* give default appname if none set by caller */ | 
|---|
| 688 | if (!*appname) | 
|---|
| 689 | strcpy(appname, FM3Str); | 
|---|
| 690 | /* save appname; may be reset below */ | 
|---|
| 691 | strcpy(realappname, appname); | 
|---|
| 692 | if (!strcmp(appname, FM3Str)) | 
|---|
| 693 | DosSetMaxFH(100); | 
|---|
| 694 | else if (!strcmp(appname, "VDir") || | 
|---|
| 695 | !strcmp(appname, "VTree") || | 
|---|
| 696 | !strcmp(appname, "VCollect") || | 
|---|
| 697 | !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4")) | 
|---|
| 698 | DosSetMaxFH(60); | 
|---|
| 699 | else | 
|---|
| 700 | DosSetMaxFH(40); | 
|---|
| 701 |  | 
|---|
| 702 | if (DosQuerySysInfo(QSV_VERSION_MAJOR, | 
|---|
| 703 | QSV_VERSION_MINOR, | 
|---|
| 704 | OS2ver, | 
|---|
| 705 | sizeof(OS2ver))) { | 
|---|
| 706 | OS2ver[0] = 2; | 
|---|
| 707 | OS2ver[1] = 1; | 
|---|
| 708 | } | 
|---|
| 709 |  | 
|---|
| 710 | // set up default root names for temp file storage and archive goodies | 
|---|
| 711 | env = getenv("TMP"); | 
|---|
| 712 | if (env == NULL) | 
|---|
| 713 | env = getenv("TEMP"); | 
|---|
| 714 | if (env != NULL) { | 
|---|
| 715 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 716 | rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| 717 | if (!rc) { | 
|---|
| 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); | 
|---|
| 724 | AddBackslashToPath(szTempName); | 
|---|
| 725 | //if (szTempName[strlen(szTempName) - 1] != '\\') | 
|---|
| 726 | //  strcat(szTempName, "\\"); | 
|---|
| 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, | 
|---|
| 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 | } | 
|---|
| 752 | while (!DosFindNext(search_handle, | 
|---|
| 753 | &ffb, sizeof(ffb), &num_matches)); | 
|---|
| 754 | DosFindClose(search_handle); | 
|---|
| 755 | } | 
|---|
| 756 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| 757 | strcpy(szTempName, env); | 
|---|
| 758 | MakeTempName(szTempName, NULL, 1); | 
|---|
| 759 | rc = DosCreateDir(szTempName, 0); | 
|---|
| 760 | if (!rc) | 
|---|
| 761 | pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);  // if writable | 
|---|
| 762 | } | 
|---|
| 763 | } | 
|---|
| 764 | } | 
|---|
| 765 |  | 
|---|
| 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 | } | 
|---|
| 772 | // Check free space on TMP and FM2 Save drives | 
|---|
| 773 | { | 
|---|
| 774 | //ullTmpSpaceNeeded = 5120000; | 
|---|
| 775 | if (pTmpDir && CheckDriveSpaceAvail(pTmpDir, ullTmpSpaceNeeded, 0) == 1) { | 
|---|
| 776 | if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 0){ | 
|---|
| 777 | ret = saymsg(MB_YESNO, | 
|---|
| 778 | HWND_DESKTOP, | 
|---|
| 779 | NullStr, | 
|---|
| 780 | GetPString(IDS_TMPDRIVESPACELIMITED), | 
|---|
| 781 | pTmpDir); | 
|---|
| 782 | if (ret == MBID_YES) | 
|---|
| 783 | pTmpDir = pFM2SaveDirectory; | 
|---|
| 784 | } | 
|---|
| 785 | else | 
|---|
| 786 | saymsg(MB_OK, | 
|---|
| 787 | HWND_DESKTOP, | 
|---|
| 788 | NullStr, | 
|---|
| 789 | GetPString(IDS_SAVETMPDRIVESPACELIMITED), | 
|---|
| 790 | pTmpDir, | 
|---|
| 791 | pFM2SaveDirectory); | 
|---|
| 792 | } | 
|---|
| 793 | else if (CheckDriveSpaceAvail(pFM2SaveDirectory, ullTmpSpaceNeeded, 0) == 1) | 
|---|
| 794 | saymsg(MB_OK, | 
|---|
| 795 | HWND_DESKTOP, | 
|---|
| 796 | NullStr, | 
|---|
| 797 | GetPString(IDS_SAVEDRIVESPACELIMITED), | 
|---|
| 798 | pFM2SaveDirectory); | 
|---|
| 799 | } | 
|---|
| 800 | BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$"); | 
|---|
| 801 |  | 
|---|
| 802 | // initialize random number generator | 
|---|
| 803 | srand(time(NULL) + clock()); | 
|---|
| 804 |  | 
|---|
| 805 | priority_bumped(); | 
|---|
| 806 |  | 
|---|
| 807 | /* _heapmin() is done in a separate thread -- start it */ | 
|---|
| 808 | if (xbeginthread(HeapThread, | 
|---|
| 809 | 32768, | 
|---|
| 810 | MPVOID, | 
|---|
| 811 | pszSrcFile, | 
|---|
| 812 | __LINE__) == -1) { | 
|---|
| 813 | return FALSE; | 
|---|
| 814 | } | 
|---|
| 815 |  | 
|---|
| 816 | /* timer messages are sent from a separate thread -- start it */ | 
|---|
| 817 | if (!StartTimer()) { | 
|---|
| 818 | Runtime_Error(pszSrcFile, __LINE__, | 
|---|
| 819 | GetPString(IDS_COULDNTSTARTTHREADTEXT)); | 
|---|
| 820 | return FALSE; | 
|---|
| 821 | } | 
|---|
| 822 |  | 
|---|
| 823 | /* Are we the workplace shell? */ | 
|---|
| 824 | env = getenv("WORKPLACE_PROCESS"); | 
|---|
| 825 | fWorkPlace = env != NULL && | 
|---|
| 826 | (stricmp(env, "YES") == 0 || atoi(env) == 1); | 
|---|
| 827 |  | 
|---|
| 828 | if ((!strchr(profile, '\\') && !strchr(profile, ':')) || | 
|---|
| 829 | !(fmprof = PrfOpenProfile((HAB)0, profile))) | 
|---|
| 830 | { | 
|---|
| 831 | /* figure out where to put INI file... */ | 
|---|
| 832 | CHAR inipath[CCHMAXPATH]; | 
|---|
| 833 |  | 
|---|
| 834 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 835 | strcpy(HomePath, pFM2SaveDirectory); | 
|---|
| 836 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 837 | memset(driveserial, -1, sizeof(driveserial)); | 
|---|
| 838 | *inipath = 0; | 
|---|
| 839 | env = getenv("FM3INI"); | 
|---|
| 840 | if (env) { | 
|---|
| 841 | strcpy(inipath, env); | 
|---|
| 842 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 843 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| 844 | if (!rc) { | 
|---|
| 845 | if (fs3.attrFile & FILE_DIRECTORY) | 
|---|
| 846 | BldFullPathName(inipath, inipath, profile); | 
|---|
| 847 | } | 
|---|
| 848 | } | 
|---|
| 849 | if (!env) { | 
|---|
| 850 | env = searchpath(profile); | 
|---|
| 851 | if (!env) | 
|---|
| 852 | env = profile; | 
|---|
| 853 | strcpy(inipath, env); | 
|---|
| 854 | } | 
|---|
| 855 |  | 
|---|
| 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 */ | 
|---|
| 858 | if (!*inipath) | 
|---|
| 859 | strcpy(inipath, profile); | 
|---|
| 860 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 861 | // fixme to check for backup if ini not found GKY 1-30-09 | 
|---|
| 862 | rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| 863 | if (rc) { | 
|---|
| 864 | if (rc == ERROR_FILE_NOT_FOUND) | 
|---|
| 865 | fWantFirstTimeInit = TRUE; | 
|---|
| 866 | } | 
|---|
| 867 | else { //Check the ini file header and restore from backup if corupted | 
|---|
| 868 | if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { | 
|---|
| 869 | saymsg(MB_ENTER,HWND_DESKTOP, GetPString(IDS_DEBUG_STRING), | 
|---|
| 870 | GetPString(IDS_INIFAILURETEXT)); | 
|---|
| 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 | } | 
|---|
| 877 | } | 
|---|
| 878 | if (!fWantFirstTimeInit) { | 
|---|
| 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 | } | 
|---|
| 888 | } | 
|---|
| 889 | } | 
|---|
| 890 | fmprof = PrfOpenProfile((HAB)0, inipath); | 
|---|
| 891 | if (!fmprof) { | 
|---|
| 892 | strcpy(inipath, "FM3.INI"); | 
|---|
| 893 | fmprof = PrfOpenProfile((HAB)0, inipath); | 
|---|
| 894 | } | 
|---|
| 895 |  | 
|---|
| 896 | // 10 Jan 08 SHL fixme to do first time if new ini | 
|---|
| 897 | // 10 Jan 08 SHL post UM_FIRSTTIME to main window | 
|---|
| 898 | if (!fmprof) { | 
|---|
| 899 | Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, | 
|---|
| 900 | PCSZ_PRFOPENPROFILEFAILED, inipath); | 
|---|
| 901 | return FALSE; | 
|---|
| 902 | } | 
|---|
| 903 | } | 
|---|
| 904 |  | 
|---|
| 905 | ArgDriveFlags(argc, argv); | 
|---|
| 906 | FillInDriveFlags(NULL); | 
|---|
| 907 |  | 
|---|
| 908 | FindSwapperDat(); | 
|---|
| 909 |  | 
|---|
| 910 | size = sizeof(BOOL); | 
|---|
| 911 | PrfQueryProfileData(fmprof, FM3Str, "SeparateParms", | 
|---|
| 912 | &fSeparateParms, &size); | 
|---|
| 913 | size = sizeof(BOOL); | 
|---|
| 914 | PrfQueryProfileData(fmprof, appname, "SeparateParms", | 
|---|
| 915 | &fSeparateParmsApp, &size); | 
|---|
| 916 | if (!fSeparateParms && !fSeparateParmsApp) | 
|---|
| 917 | strcpy(appname, FM3Str); | 
|---|
| 918 |  | 
|---|
| 919 | /* start help */ | 
|---|
| 920 | memset(&hini, 0, sizeof(HELPINIT)); | 
|---|
| 921 | hini.cb = sizeof(HELPINIT); | 
|---|
| 922 | hini.ulReturnCode = 0; | 
|---|
| 923 | hini.pszTutorialName = NULL; | 
|---|
| 924 | hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff); | 
|---|
| 925 | hini.hmodAccelActionBarModule = (HMODULE) 0; | 
|---|
| 926 | hini.idAccelTable = 0; | 
|---|
| 927 | hini.idActionBar = 0; | 
|---|
| 928 | hini.pszHelpWindowTitle = (PSZ)GetPString(IDS_FM2HELPTITLETEXT); | 
|---|
| 929 | hini.fShowPanelId = CMIC_HIDE_PANEL_ID; | 
|---|
| 930 | hini.pszHelpLibraryName = "FM3.HLP"; | 
|---|
| 931 | hwndHelp = WinCreateHelpInstance(hab, &hini); | 
|---|
| 932 | if (!hwndHelp) { | 
|---|
| 933 | static CHAR helppath[CCHMAXPATH];   // fixme to be local? | 
|---|
| 934 |  | 
|---|
| 935 | env = getenv("FM3INI"); | 
|---|
| 936 | if (env) { | 
|---|
| 937 | strcpy(helppath, env); | 
|---|
| 938 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 939 | rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3)); | 
|---|
| 940 | if (!rc) { | 
|---|
| 941 | if (fs3.attrFile & FILE_DIRECTORY) { | 
|---|
| 942 | BldFullPathName(helppath, helppath, "FM3.HLP"); | 
|---|
| 943 | hini.pszHelpLibraryName = helppath; | 
|---|
| 944 | hwndHelp = WinCreateHelpInstance(hab, &hini); | 
|---|
| 945 | } | 
|---|
| 946 | } | 
|---|
| 947 | } | 
|---|
| 948 | } | 
|---|
| 949 | if (!hwndHelp) { | 
|---|
| 950 | saymsg(MB_ENTER | MB_ICONEXCLAMATION, | 
|---|
| 951 | HWND_DESKTOP, | 
|---|
| 952 | GetPString(IDS_FM2TROUBLETEXT), | 
|---|
| 953 | GetPString(IDS_CANTLOADHELPTEXT), | 
|---|
| 954 | GetPString(IDS_NOHELPACCEPTTEXT)); | 
|---|
| 955 | } | 
|---|
| 956 |  | 
|---|
| 957 | // a couple of default window procs so we don't have to look them up later | 
|---|
| 958 | if (WinQueryClassInfo(hab, WC_CONTAINER, &clinfo)) | 
|---|
| 959 | PFNWPCnr = clinfo.pfnWindowProc; | 
|---|
| 960 | if (WinQueryClassInfo(hab, WC_FRAME, &clinfo)) | 
|---|
| 961 | PFNWPFrame = clinfo.pfnWindowProc; | 
|---|
| 962 | if (WinQueryClassInfo(hab, WC_BUTTON, &clinfo)) | 
|---|
| 963 | PFNWPButton = clinfo.pfnWindowProc; | 
|---|
| 964 | if (WinQueryClassInfo(hab, WC_STATIC, &clinfo)) | 
|---|
| 965 | PFNWPStatic = clinfo.pfnWindowProc; | 
|---|
| 966 | if (WinQueryClassInfo(hab, WC_MLE, &clinfo)) | 
|---|
| 967 | PFNWPMLE = clinfo.pfnWindowProc; | 
|---|
| 968 | if (!PFNWPCnr || !PFNWPFrame || !PFNWPButton || !PFNWPStatic || !PFNWPMLE) { | 
|---|
| 969 | Runtime_Error(pszSrcFile, __LINE__, "WinQueryClassInfo"); | 
|---|
| 970 | return FALSE; | 
|---|
| 971 | } | 
|---|
| 972 |  | 
|---|
| 973 | /* register window classes we use */ | 
|---|
| 974 | WinRegisterClass(hab, | 
|---|
| 975 | WC_MAINWND, | 
|---|
| 976 | MainWndProc, | 
|---|
| 977 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 8); | 
|---|
| 978 | WinRegisterClass(hab, | 
|---|
| 979 | WC_MAINWND2, | 
|---|
| 980 | MainWndProc2, | 
|---|
| 981 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 4); | 
|---|
| 982 | WinRegisterClass(hab, | 
|---|
| 983 | WC_TREECONTAINER, | 
|---|
| 984 | TreeClientWndProc, | 
|---|
| 985 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 986 | WinRegisterClass(hab, | 
|---|
| 987 | WC_DIRCONTAINER, | 
|---|
| 988 | DirClientWndProc, | 
|---|
| 989 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 990 | WinRegisterClass(hab, | 
|---|
| 991 | WC_COLLECTOR, | 
|---|
| 992 | CollectorClientWndProc, | 
|---|
| 993 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 994 | WinRegisterClass(hab, | 
|---|
| 995 | WC_ARCCONTAINER, | 
|---|
| 996 | ArcClientWndProc, | 
|---|
| 997 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 998 | WinRegisterClass(hab, | 
|---|
| 999 | WC_MLEEDITOR, | 
|---|
| 1000 | MLEEditorProc, | 
|---|
| 1001 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 1002 | WinRegisterClass(hab, | 
|---|
| 1003 | WC_INIEDITOR, | 
|---|
| 1004 | IniProc, | 
|---|
| 1005 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID) * 2); | 
|---|
| 1006 | WinRegisterClass(hab, | 
|---|
| 1007 | WC_TOOLBACK, | 
|---|
| 1008 | ToolBackProc, | 
|---|
| 1009 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1010 | sizeof(PVOID)); | 
|---|
| 1011 | WinRegisterClass(hab, | 
|---|
| 1012 | WC_DRIVEBACK, | 
|---|
| 1013 | DriveBackProc, | 
|---|
| 1014 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1015 | sizeof(PVOID)); | 
|---|
| 1016 | WinRegisterClass(hab, | 
|---|
| 1017 | WC_SEEALL, | 
|---|
| 1018 | SeeAllWndProc, | 
|---|
| 1019 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); | 
|---|
| 1020 | WinRegisterClass(hab, | 
|---|
| 1021 | WC_NEWVIEW, | 
|---|
| 1022 | ViewWndProc, | 
|---|
| 1023 | CS_SIZEREDRAW | CS_CLIPCHILDREN, sizeof(PVOID)); | 
|---|
| 1024 | WinRegisterClass(hab, | 
|---|
| 1025 | WC_TOOLBUTTONS, | 
|---|
| 1026 | ChildButtonProc, | 
|---|
| 1027 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1028 | sizeof(PVOID)); | 
|---|
| 1029 | WinRegisterClass(hab, | 
|---|
| 1030 | WC_DRIVEBUTTONS, | 
|---|
| 1031 | DriveProc, | 
|---|
| 1032 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1033 | sizeof(PVOID)); | 
|---|
| 1034 | WinRegisterClass(hab, | 
|---|
| 1035 | WC_BUBBLE, | 
|---|
| 1036 | BubbleProc, | 
|---|
| 1037 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1038 | sizeof(ULONG) * 2); | 
|---|
| 1039 | WinRegisterClass(hab, | 
|---|
| 1040 | WC_STATUS, | 
|---|
| 1041 | StatusProc, | 
|---|
| 1042 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1043 | sizeof(ULONG)); | 
|---|
| 1044 | WinRegisterClass(hab, | 
|---|
| 1045 | WC_DIRSTATUS, | 
|---|
| 1046 | DirTextProc, | 
|---|
| 1047 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1048 | sizeof(ULONG)); | 
|---|
| 1049 | WinRegisterClass(hab, | 
|---|
| 1050 | WC_TREESTATUS, | 
|---|
| 1051 | TreeStatProc, | 
|---|
| 1052 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1053 | sizeof(ULONG)); | 
|---|
| 1054 | WinRegisterClass(hab, | 
|---|
| 1055 | WC_ARCSTATUS, | 
|---|
| 1056 | ArcTextProc, | 
|---|
| 1057 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1058 | sizeof(ULONG)); | 
|---|
| 1059 | WinRegisterClass(hab, | 
|---|
| 1060 | WC_COLSTATUS, | 
|---|
| 1061 | CollectorTextProc, | 
|---|
| 1062 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1063 | sizeof(ULONG)); | 
|---|
| 1064 | WinRegisterClass(hab, | 
|---|
| 1065 | WC_SEESTATUS, | 
|---|
| 1066 | SeeStatusProc, | 
|---|
| 1067 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1068 | sizeof(ULONG)); | 
|---|
| 1069 | WinRegisterClass(hab, | 
|---|
| 1070 | WC_VIEWSTATUS, | 
|---|
| 1071 | ViewStatusProc, | 
|---|
| 1072 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1073 | sizeof(ULONG)); | 
|---|
| 1074 | WinRegisterClass(hab, | 
|---|
| 1075 | WC_ERRORWND, | 
|---|
| 1076 | NotifyWndProc, | 
|---|
| 1077 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1078 | sizeof(PVOID)); | 
|---|
| 1079 | WinRegisterClass(hab, | 
|---|
| 1080 | WC_MINITIME, | 
|---|
| 1081 | MiniTimeProc, | 
|---|
| 1082 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1083 | sizeof(PVOID) * 2); | 
|---|
| 1084 | WinRegisterClass(hab, | 
|---|
| 1085 | WC_DATABAR, | 
|---|
| 1086 | DataProc, CS_SIZEREDRAW, sizeof(PVOID)); | 
|---|
| 1087 | WinRegisterClass(hab, | 
|---|
| 1088 | WC_TREEOPENBUTTON, | 
|---|
| 1089 | OpenButtonProc, | 
|---|
| 1090 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1091 | sizeof(PVOID)); | 
|---|
| 1092 | WinRegisterClass(hab, | 
|---|
| 1093 | WC_AUTOVIEW, | 
|---|
| 1094 | AutoViewProc, | 
|---|
| 1095 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1096 | sizeof(PVOID)); | 
|---|
| 1097 | WinRegisterClass(hab, | 
|---|
| 1098 | WC_LED, | 
|---|
| 1099 | LEDProc, | 
|---|
| 1100 | CS_SYNCPAINT | CS_SIZEREDRAW | CS_PARENTCLIP, | 
|---|
| 1101 | sizeof(PVOID)); | 
|---|
| 1102 |  | 
|---|
| 1103 | if (DosCreateMutexSem(NULL, &hmtxFM2Globals, 0L, FALSE)) | 
|---|
| 1104 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 1105 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| 1106 | if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE)) | 
|---|
| 1107 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 1108 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| 1109 | if (DosCreateMutexSem(NULL, &hmtFillingTreeCnr, 0L, FALSE)) | 
|---|
| 1110 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 1111 | PCSZ_DOSCREATEMUTEXSEM); | 
|---|
| 1112 | if (DosCreateEventSem(NULL, &hevInitialCnrScanComplete, 0L, FALSE)) | 
|---|
| 1113 | Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| 1114 | PCSZ_DOSCREATEEVENTSEM); | 
|---|
| 1115 |  | 
|---|
| 1116 | /** | 
|---|
| 1117 | * set some defaults (note: everything else automatically initialized | 
|---|
| 1118 | * to 0) | 
|---|
| 1119 | */ | 
|---|
| 1120 | dsDirCnrDefault.detailssize = dsDirCnrDefault.detailsea = dsDirCnrDefault.detailslwdate = | 
|---|
| 1121 | dsDirCnrDefault.detailslwtime = dsDirCnrDefault.detailsattr = dsDirCnrDefault.detailsicon = | 
|---|
| 1122 | fAutoTile = fConfirmDelete = fLoadSubject = fUnHilite = | 
|---|
| 1123 | fLoadLongnames = fToolbar = fSaveState = fGuessType = fToolbarHelp = | 
|---|
| 1124 | fAutoAddDirs = fUseNewViewer = fDataToFore = fDataShowDrives = fDataMin = | 
|---|
| 1125 | fSplitStatus = fDragndropDlg = fQuickArcFind = fKeepCmdLine = | 
|---|
| 1126 | fMoreButtons = fDrivebar = fCollapseFirst = fSwitchTree = | 
|---|
| 1127 | fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp = | 
|---|
| 1128 | fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget = | 
|---|
| 1129 | fShowTarget = fDrivebarHelp = fCheckMM = fInitialDriveScan = | 
|---|
| 1130 | fEjectRemovableScan = fRScanLocal = TRUE; | 
|---|
| 1131 | ulCnrType = CCS_EXTENDSEL; | 
|---|
| 1132 | FilesToGet = FILESTOGET_MAX; | 
|---|
| 1133 | MaxComLineStrg = MAXCOMLINESTRGDEFAULT; | 
|---|
| 1134 | AutoviewHeight = 48; | 
|---|
| 1135 | //strcpy(printer, "PRN"); | 
|---|
| 1136 | prnwidth = 80; | 
|---|
| 1137 | prnlength = 66; | 
|---|
| 1138 | prntmargin = 6; | 
|---|
| 1139 | prnbmargin = 6; | 
|---|
| 1140 | prnlmargin = 6; | 
|---|
| 1141 | prnrmargin = 3; | 
|---|
| 1142 | prnspacing = 1; | 
|---|
| 1143 | prntabspaces = 8; | 
|---|
| 1144 | CollectorsortFlags = sortFlags = SORT_FILENAME | SORT_DIRSFIRST; | 
|---|
| 1145 | //ullDATFileSpaceNeeded = 10000; | 
|---|
| 1146 |  | 
|---|
| 1147 | //Get default Country info | 
|---|
| 1148 | { | 
|---|
| 1149 | COUNTRYCODE Country    = {0}; | 
|---|
| 1150 | ULONG ulInfoLen  = 0; | 
|---|
| 1151 | COUNTRYINFO CtryInfo   = {0}; | 
|---|
| 1152 |  | 
|---|
| 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); | 
|---|
| 1160 | } | 
|---|
| 1161 | else { | 
|---|
| 1162 | strcpy(ThousandsSeparator, ","); | 
|---|
| 1163 | strcpy(DateSeparator, "/"); | 
|---|
| 1164 | strcpy(TimeSeparator, ":"); | 
|---|
| 1165 | ulDateFmt = 0; | 
|---|
| 1166 | ulTimeFmt = 0; | 
|---|
| 1167 | } | 
|---|
| 1168 | } | 
|---|
| 1169 | { // Check for the existance of various partitioning tools to set up menu items | 
|---|
| 1170 | CHAR *FullPath; | 
|---|
| 1171 | ULONG ulAppType; | 
|---|
| 1172 |  | 
|---|
| 1173 | FullPath = searchapath(PCSZ_PATH, PCSZ_LVMGUICMD); | 
|---|
| 1174 | if (*FullPath) | 
|---|
| 1175 | fLVMGui = TRUE; | 
|---|
| 1176 | if (!xDosQueryAppType(PCSZ_DFSOS2EXE, &ulAppType)) | 
|---|
| 1177 | fDFSee = TRUE; | 
|---|
| 1178 | if (!xDosQueryAppType(PCSZ_MINILVMEXE, &ulAppType)) | 
|---|
| 1179 | fMiniLVM = TRUE; | 
|---|
| 1180 | if (!xDosQueryAppType(PCSZ_FDISKPMEXE, &ulAppType)) | 
|---|
| 1181 | fFDisk = TRUE; | 
|---|
| 1182 | if (!xDosQueryAppType(PCSZ_LVMEXE, &ulAppType)) | 
|---|
| 1183 | fLVM = TRUE; | 
|---|
| 1184 |  | 
|---|
| 1185 | // Check to see if we are running protect only | 
|---|
| 1186 | if (!xDosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) { | 
|---|
| 1187 | HMODULE hmod; | 
|---|
| 1188 | APIRET rc; | 
|---|
| 1189 |  | 
|---|
| 1190 | rc = DosQueryModuleHandle("VKBD", &hmod); | 
|---|
| 1191 | if (rc != NO_ERROR) { | 
|---|
| 1192 | fProtectOnly = TRUE; | 
|---|
| 1193 | //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VKBD returned %d fProtectOnly=%d", rc, fProtectOnly); | 
|---|
| 1194 | } | 
|---|
| 1195 | else { | 
|---|
| 1196 | rc = DosQueryModuleHandle("VMOUSE", &hmod); | 
|---|
| 1197 | if (rc != NO_ERROR) { | 
|---|
| 1198 | fProtectOnly = TRUE; | 
|---|
| 1199 | //DbgMsg(pszSrcFile, __LINE__, "DosQModuleHandle VMOUSE returned %d fProtectOnly=%d", rc, fProtectOnly); | 
|---|
| 1200 | } | 
|---|
| 1201 | } | 
|---|
| 1202 | } | 
|---|
| 1203 | else | 
|---|
| 1204 | fProtectOnly = TRUE; | 
|---|
| 1205 | } | 
|---|
| 1206 |  | 
|---|
| 1207 | // load preferences from profile (INI) file | 
|---|
| 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 | */ | 
|---|
| 1215 | size = sizeof(ULONG); | 
|---|
| 1216 | PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size); | 
|---|
| 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 |  | 
|---|
| 1221 | size = sizeof(BOOL); | 
|---|
| 1222 | PrfQueryProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, &size); | 
|---|
| 1223 | if (!MaxComLineChecked) { | 
|---|
| 1224 | ret = saymsg(MB_YESNO, | 
|---|
| 1225 | HWND_DESKTOP, | 
|---|
| 1226 | NullStr, | 
|---|
| 1227 | GetPString(IDS_CHANGECMDLINELENGTHDEFAULT)); | 
|---|
| 1228 | if (ret == MBID_YES) | 
|---|
| 1229 | MaxComLineStrg = 1024; | 
|---|
| 1230 | MaxComLineChecked = TRUE; | 
|---|
| 1231 | PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL)); | 
|---|
| 1232 | } | 
|---|
| 1233 | } | 
|---|
| 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 | 
|---|
| 1268 | pszTreeEnvVarList = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); | 
|---|
| 1269 | if (!pszTreeEnvVarList) | 
|---|
| 1270 | return 0; //already complained | 
|---|
| 1271 | size = sizeof(BOOL); | 
|---|
| 1272 | PrfQueryProfileData(fmprof, appname, "DontSuggestAgain", &fDontSuggestAgain, &size); | 
|---|
| 1273 | size = sizeof(BOOL); | 
|---|
| 1274 | PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size); | 
|---|
| 1275 | size = sizeof(BOOL); | 
|---|
| 1276 | PrfQueryProfileData(fmprof, appname, "CheckMM", &fCheckMM, &size); | 
|---|
| 1277 | size = sizeof(BOOL); | 
|---|
| 1278 | PrfQueryProfileData(fmprof, appname, "ChangeTarget", &fChangeTarget, &size); | 
|---|
| 1279 | size = sizeof(BOOL); | 
|---|
| 1280 | PrfQueryProfileData(fmprof, appname, "ConfirmTarget", &fConfirmTarget, &size); | 
|---|
| 1281 | size = sizeof(BOOL); | 
|---|
| 1282 | PrfQueryProfileData(fmprof, appname, "CustomFileDlg", &fCustomFileDlg, &size); | 
|---|
| 1283 | size = sizeof(BOOL); | 
|---|
| 1284 | PrfQueryProfileData(fmprof, appname, "SaveMiniCmds", &fSaveMiniCmds, &size); | 
|---|
| 1285 | size = sizeof(BOOL); | 
|---|
| 1286 | PrfQueryProfileData(fmprof, appname, "SaveBigCmds", &fSaveBigCmds, &size); | 
|---|
| 1287 | size = sizeof(BOOL); | 
|---|
| 1288 | PrfQueryProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, &size); | 
|---|
| 1289 | size = sizeof(BOOL); | 
|---|
| 1290 | PrfQueryProfileData(fmprof, appname, "ThreadNotes", &fThreadNotes, &size); | 
|---|
| 1291 | size = sizeof(BOOL); | 
|---|
| 1292 | PrfQueryProfileData(fmprof, FM3Str, "Prnpagenums", &prnpagenums, &size); | 
|---|
| 1293 | size = sizeof(BOOL); | 
|---|
| 1294 | PrfQueryProfileData(fmprof, FM3Str, "Prnalt", &prnalt, &size); | 
|---|
| 1295 | size = sizeof(BOOL); | 
|---|
| 1296 | PrfQueryProfileData(fmprof, FM3Str, "Prnformat", &prnformat, &size); | 
|---|
| 1297 | size = sizeof(BOOL); | 
|---|
| 1298 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedbefore", &prnformfeedbefore, &size); | 
|---|
| 1299 | size = sizeof(BOOL); | 
|---|
| 1300 | PrfQueryProfileData(fmprof, FM3Str, "Prnformfeedafter",&prnformfeedafter, &size); | 
|---|
| 1301 | size = sizeof(ULONG); | 
|---|
| 1302 | PrfQueryProfileData(fmprof, FM3Str, "Prntabspaces", &prntabspaces, &size); | 
|---|
| 1303 | size = sizeof(ULONG); | 
|---|
| 1304 | PrfQueryProfileData(fmprof, FM3Str, "Prnwidth", &prnwidth, &size); | 
|---|
| 1305 | size = sizeof(ULONG); | 
|---|
| 1306 | PrfQueryProfileData(fmprof, FM3Str, "Prnlength", &prnlength, &size); | 
|---|
| 1307 | size = sizeof(ULONG); | 
|---|
| 1308 | PrfQueryProfileData(fmprof, FM3Str, "Prntmargin", &prntmargin, &size); | 
|---|
| 1309 | size = sizeof(ULONG); | 
|---|
| 1310 | PrfQueryProfileData(fmprof, FM3Str, "Prnbmargin", &prnbmargin, &size); | 
|---|
| 1311 | size = sizeof(ULONG); | 
|---|
| 1312 | PrfQueryProfileData(fmprof, FM3Str, "Prnlmargin", &prnlmargin, &size); | 
|---|
| 1313 | size = sizeof(ULONG); | 
|---|
| 1314 | PrfQueryProfileData(fmprof, FM3Str, "Prnrmargin", &prnrmargin, &size); | 
|---|
| 1315 | size = sizeof(ULONG); | 
|---|
| 1316 | PrfQueryProfileData(fmprof, FM3Str, "Prnspacing", &prnspacing, &size); | 
|---|
| 1317 | size = sizeof(BOOL); | 
|---|
| 1318 | PrfQueryProfileData(fmprof, appname, "NoDead", &fNoDead, &size); | 
|---|
| 1319 | size = sizeof(BOOL); | 
|---|
| 1320 | PrfQueryProfileData(fmprof, appname, "NoFinger", &fNoFinger, &size); | 
|---|
| 1321 | size = sizeof(BOOL); | 
|---|
| 1322 | PrfQueryProfileData(fmprof, appname, "AlertBeepOff", &fAlertBeepOff, &size); | 
|---|
| 1323 | size = sizeof(BOOL); | 
|---|
| 1324 | PrfQueryProfileData(fmprof, appname, "ErrorBeepOff", &fErrorBeepOff, &size); | 
|---|
| 1325 | size = sizeof(BOOL); | 
|---|
| 1326 | PrfQueryProfileData(fmprof, appname, "SwitchTree", &fSwitchTree, &size); | 
|---|
| 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); | 
|---|
| 1336 | PrfQueryProfileData(fmprof, appname, "TopDir", &fTopDir, &size); | 
|---|
| 1337 | size = sizeof(BOOL); | 
|---|
| 1338 | PrfQueryProfileData(fmprof, appname, "LookInDir", &fLookInDir, &size); | 
|---|
| 1339 | PrfQueryProfileString(fmprof, appname, "DefArc", NULL, szDefArc, sizeof(szDefArc)); | 
|---|
| 1340 | size = sizeof(ULONG); | 
|---|
| 1341 | PrfQueryProfileData(fmprof, appname, "AutoviewHeight", | 
|---|
| 1342 | &AutoviewHeight, &size); | 
|---|
| 1343 | size = sizeof(BOOL); | 
|---|
| 1344 | PrfQueryProfileData(fmprof, appname, "KeepCmdLine", &fKeepCmdLine, &size); | 
|---|
| 1345 | if (strcmp(realappname, "FM/4")) { | 
|---|
| 1346 | size = sizeof(BOOL); | 
|---|
| 1347 | PrfQueryProfileData(fmprof, FM3Str, "MoreButtons", &fMoreButtons, &size); | 
|---|
| 1348 | size = sizeof(BOOL); | 
|---|
| 1349 | PrfQueryProfileData(fmprof, FM3Str, "Drivebar", &fDrivebar, &size); | 
|---|
| 1350 | } | 
|---|
| 1351 | size = sizeof(BOOL); | 
|---|
| 1352 | PrfQueryProfileData(fmprof, appname, "NoSearch", &fNoSearch, &size); | 
|---|
| 1353 | size = sizeof(BOOL); | 
|---|
| 1354 | PrfQueryProfileData(fmprof, appname, "GuessType", &fGuessType, &size); | 
|---|
| 1355 | size = sizeof(BOOL); | 
|---|
| 1356 | PrfQueryProfileData(fmprof, appname, "ViewChild", &fViewChild, &size); | 
|---|
| 1357 | size = sizeof(BOOL); | 
|---|
| 1358 | PrfQueryProfileData(fmprof, appname, "ShowEnv", &fShowEnv, &size); | 
|---|
| 1359 | PrfQueryProfileString(fmprof, appname, "TreeEnvVarList", "PATH;DPATH;LIBPATH;HELP;BOOKSHELF;", | 
|---|
| 1360 | pszTreeEnvVarList, MaxComLineStrg); | 
|---|
| 1361 | size = sizeof(BOOL); | 
|---|
| 1362 | PrfQueryProfileData(fmprof, appname, "ShowDriveOnly", &fShowDriveOnly, &size); | 
|---|
| 1363 | size = sizeof(BOOL); | 
|---|
| 1364 | PrfQueryProfileData(fmprof, appname, "ShowFSTypeInTree", &fShowFSTypeInTree, &size); | 
|---|
| 1365 | size = sizeof(BOOL); | 
|---|
| 1366 | PrfQueryProfileData(fmprof, appname, "ShowDriveLabelInTree", &fShowDriveLabelInTree, &size); | 
|---|
| 1367 | if (!fShowDriveOnly && !fShowFSTypeInTree && !fShowDriveLabelInTree) | 
|---|
| 1368 | fShowDriveOnly = TRUE; | 
|---|
| 1369 | size = sizeof(BOOL); | 
|---|
| 1370 | PrfQueryProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, &size); | 
|---|
| 1371 | size = sizeof(BOOL); | 
|---|
| 1372 | PrfQueryProfileData(fmprof, appname, "Comments", &fComments, &size); | 
|---|
| 1373 | size = sizeof(ULONG); | 
|---|
| 1374 | PrfQueryProfileData(fmprof, appname, "WS_ANIMATE", &fwsAnimate, &size); | 
|---|
| 1375 | if (fwsAnimate) | 
|---|
| 1376 | fwsAnimate = WS_ANIMATE; | 
|---|
| 1377 | size = sizeof(BOOL); | 
|---|
| 1378 | PrfQueryProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways, &size); | 
|---|
| 1379 | size = sizeof(BOOL); | 
|---|
| 1380 | PrfQueryProfileData(fmprof, appname, "ToolbarHelp", &fToolbarHelp, &size); | 
|---|
| 1381 | size = sizeof(BOOL); | 
|---|
| 1382 | PrfQueryProfileData(fmprof, appname, "OtherHelp", &fOtherHelp, &size); | 
|---|
| 1383 | size = sizeof(BOOL); | 
|---|
| 1384 | PrfQueryProfileData(fmprof, appname, "DrivebarHelp", &fDrivebarHelp, &size); | 
|---|
| 1385 | size = sizeof(BOOL); | 
|---|
| 1386 | PrfQueryProfileData(fmprof, appname, "AutoAddDirs", &fAutoAddDirs, &size); | 
|---|
| 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); | 
|---|
| 1408 | PrfQueryProfileData(fmprof, appname, "DataMin", &fDataMin, &size); | 
|---|
| 1409 | size = sizeof(BOOL); | 
|---|
| 1410 | PrfQueryProfileData(fmprof, appname, "DataToFore", &fDataToFore, &size); | 
|---|
| 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); | 
|---|
| 1416 | PrfQueryProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, &size); | 
|---|
| 1417 | size = sizeof(BOOL); | 
|---|
| 1418 | PrfQueryProfileData(fmprof, appname, "FolderAfterExtract", &fFolderAfterExtract, &size); | 
|---|
| 1419 | size = sizeof(BOOL); | 
|---|
| 1420 | PrfQueryProfileData(fmprof, appname, "DullDatabar", &fDullMin, &size); | 
|---|
| 1421 | size = sizeof(BOOL); | 
|---|
| 1422 | PrfQueryProfileData(fmprof, appname, "BlueLED", &fBlueLED, &size); | 
|---|
| 1423 | size = sizeof(BOOL); | 
|---|
| 1424 | PrfQueryProfileData(fmprof, appname, "ConfirmDelete", &fConfirmDelete, &size); | 
|---|
| 1425 | size = sizeof(BOOL); | 
|---|
| 1426 | PrfQueryProfileData(fmprof, FM3Str, "SaveState", &fSaveState, &size); | 
|---|
| 1427 | size = sizeof(BOOL); | 
|---|
| 1428 | PrfQueryProfileData(fmprof, appname, "SyncUpdates", &fSyncUpdates, &size); | 
|---|
| 1429 | size = sizeof(BOOL); | 
|---|
| 1430 | PrfQueryProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, &size); | 
|---|
| 1431 | size = sizeof(BOOL); | 
|---|
| 1432 | PrfQueryProfileData(fmprof, appname, "UnHilite", &fUnHilite, &size); | 
|---|
| 1433 | size = sizeof(BOOL); | 
|---|
| 1434 | PrfQueryProfileData(fmprof, FM3Str, "TileBackwards", &fTileBackwards, &size); | 
|---|
| 1435 | size = sizeof(BOOL); | 
|---|
| 1436 | PrfQueryProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, &size); | 
|---|
| 1437 | size = sizeof(BOOL); | 
|---|
| 1438 | PrfQueryProfileData(fmprof, appname, "VerifyWrites", &fVerify, &size); | 
|---|
| 1439 | DosSetVerify(fVerify); | 
|---|
| 1440 | size = sizeof(BOOL); | 
|---|
| 1441 | PrfQueryProfileData(fmprof, appname, "DontMoveMouse", &fDontMoveMouse, &size); | 
|---|
| 1442 | size = sizeof(BOOL); | 
|---|
| 1443 | PrfQueryProfileData(fmprof, appname, "NoIconsFiles", &fNoIconsFiles, &size); | 
|---|
| 1444 | size = sizeof(BOOL); | 
|---|
| 1445 | PrfQueryProfileData(fmprof, appname, "NoIconsDirs", &fNoIconsDirs, &size); | 
|---|
| 1446 | size = sizeof(BOOL); | 
|---|
| 1447 | PrfQueryProfileData(fmprof, appname, "ForceUpper", &fForceUpper, &size); | 
|---|
| 1448 | size = sizeof(BOOL); | 
|---|
| 1449 | PrfQueryProfileData(fmprof, appname, "ForceLower", &fForceLower, &size); | 
|---|
| 1450 | size = sizeof(BOOL); | 
|---|
| 1451 | PrfQueryProfileData(fmprof, appname, "TextTools", &fTextTools, &size); | 
|---|
| 1452 | size = sizeof(BOOL); | 
|---|
| 1453 | PrfQueryProfileData(fmprof, appname, "ToolTitles", &fToolTitles, &size); | 
|---|
| 1454 | size = sizeof(BOOL); | 
|---|
| 1455 | PrfQueryProfileData(fmprof, appname, "DoubleClickOpens", &fDCOpens, &size); | 
|---|
| 1456 | size = sizeof(BOOL); | 
|---|
| 1457 | PrfQueryProfileData(fmprof, appname, "LinkSetsIcon", &fLinkSetsIcon, &size); | 
|---|
| 1458 | size = sizeof(INT); | 
|---|
| 1459 | PrfQueryProfileData(fmprof, appname, "Sort", &sortFlags, &size); | 
|---|
| 1460 | size = sizeof(INT); | 
|---|
| 1461 | PrfQueryProfileData(fmprof, appname, "TreeSort", &TreesortFlags, &size); | 
|---|
| 1462 | size = sizeof(INT); | 
|---|
| 1463 | PrfQueryProfileData(fmprof, appname, "CollectorSort", &CollectorsortFlags, &size); | 
|---|
| 1464 | PrfQueryProfileString(fmprof, appname, "Targetdir", NULL, targetdir, sizeof(targetdir)); | 
|---|
| 1465 | if (!IsValidDir(targetdir)) | 
|---|
| 1466 | *targetdir = 0; | 
|---|
| 1467 | PrfQueryProfileString(fmprof, appname, "ExtractPath", NULL, extractpath, sizeof(extractpath)); | 
|---|
| 1468 | size = sizeof(BOOL); | 
|---|
| 1469 | PrfQueryProfileData(fmprof, appname, "FileNamePathCnr", &fFileNameCnrPath, &size); | 
|---|
| 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); | 
|---|
| 1478 | size = sizeof(BOOL); | 
|---|
| 1479 | PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size); | 
|---|
| 1480 | PrfQueryProfileString(fmprof, appname, "FTPRun", NULL, ftprun, MaxComLineStrg); | 
|---|
| 1481 | if (!*ftprun) | 
|---|
| 1482 | fFtpRunWPSDefault = TRUE; | 
|---|
| 1483 | size = sizeof(BOOL); | 
|---|
| 1484 | PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size); | 
|---|
| 1485 | PrfQueryProfileString(fmprof, appname, "HTTPRun", NULL, httprun, MaxComLineStrg); | 
|---|
| 1486 | if (!*httprun) | 
|---|
| 1487 | fHttpRunWPSDefault = TRUE; | 
|---|
| 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)); | 
|---|
| 1493 | size = sizeof(BOOL); | 
|---|
| 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); | 
|---|
| 1505 | if (!fStartMaximized) { | 
|---|
| 1506 | size = sizeof(BOOL); | 
|---|
| 1507 | PrfQueryProfileData(fmprof, appname, "StartMinimized", &fStartMinimized, &size); | 
|---|
| 1508 | } | 
|---|
| 1509 | size = sizeof(BOOL); | 
|---|
| 1510 | PrfQueryProfileData(fmprof, appname, "DefaultCopy", &fCopyDefault, &size); | 
|---|
| 1511 | size = sizeof(BOOL); | 
|---|
| 1512 | PrfQueryProfileData(fmprof, appname, "IdleCopy", &fRealIdle, &size); | 
|---|
| 1513 | size = sizeof(BOOL); | 
|---|
| 1514 | PrfQueryProfileData(fmprof, appname, "ArcStuffVisible", &fArcStuffVisible, &size); | 
|---|
| 1515 | size = sizeof(BOOL); | 
|---|
| 1516 | PrfQueryProfileData(fmprof, appname, "NoTreeGap", &fNoTreeGap, &size); | 
|---|
| 1517 | size = sizeof(BOOL); | 
|---|
| 1518 | PrfQueryProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS, &size); | 
|---|
| 1519 | size = sizeof(BOOL); | 
|---|
| 1520 | PrfQueryProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, &size); | 
|---|
| 1521 | size = sizeof(BOOL); | 
|---|
| 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); | 
|---|
| 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); | 
|---|
| 1538 | PrfQueryProfileData(fmprof, appname, "Drag&DropDlg", &fDragndropDlg, &size); | 
|---|
| 1539 | size = sizeof(BOOL); | 
|---|
| 1540 | PrfQueryProfileData(fmprof, FM3Str, "UserComboBox", &fUserComboBox, &size); | 
|---|
| 1541 | size = sizeof(BOOL); | 
|---|
| 1542 | PrfQueryProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, &size); | 
|---|
| 1543 | size = sizeof(BOOL); | 
|---|
| 1544 | PrfQueryProfileData(fmprof, appname, "QuickArcFind", &fQuickArcFind, &size); | 
|---|
| 1545 | size = sizeof(BOOL); | 
|---|
| 1546 | PrfQueryProfileData(fmprof, appname, "NoRemovableScan", &fNoRemovableScan, &size); | 
|---|
| 1547 | size = sizeof(ULONG); | 
|---|
| 1548 | PrfQueryProfileData(fmprof, FM3Str, "NoBrokenNotify", &NoBrokenNotify, &size); | 
|---|
| 1549 | size = sizeof(ULONG); | 
|---|
| 1550 | PrfQueryProfileData(fmprof, appname, "ContainerType", &ulCnrType, &size); | 
|---|
| 1551 | size = sizeof(ULONG); | 
|---|
| 1552 | PrfQueryProfileData(fmprof, appname, "FilesToGet", &FilesToGet, &size); | 
|---|
| 1553 | if (FilesToGet < FILESTOGET_MIN) | 
|---|
| 1554 | FilesToGet = FILESTOGET_MIN; | 
|---|
| 1555 | else if (FilesToGet > FILESTOGET_MAX) | 
|---|
| 1556 | FilesToGet = FILESTOGET_MAX; | 
|---|
| 1557 | size = sizeof(BOOL); | 
|---|
| 1558 | PrfQueryProfileData(fmprof, appname, "AutoView", &fAutoView, &size); | 
|---|
| 1559 | size = sizeof(BOOL); | 
|---|
| 1560 | PrfQueryProfileData(fmprof, appname, "FM2Deletes", &fFM2Deletes, &size); | 
|---|
| 1561 | size = sizeof(BOOL); | 
|---|
| 1562 | PrfQueryProfileData(fmprof, appname, "TrashCan", &fTrashCan, &size); | 
|---|
| 1563 |  | 
|---|
| 1564 | LoadDetailsSwitches(PCSZ_DIRCNR, &dsDirCnrDefault, FALSE); | 
|---|
| 1565 |  | 
|---|
| 1566 | /* load pointers and icons we use */ | 
|---|
| 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); | 
|---|
| 1581 | hptrReadonly = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FILE_READONLY_ICON); | 
|---|
| 1582 | hptrLast = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, LASTITEM_ICON); | 
|---|
| 1583 | hptrRemote = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, REMOTE_ICON); | 
|---|
| 1584 | hptrVirtual = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, VIRTUAL_ICON); | 
|---|
| 1585 | hptrRamdisk = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, RAMDISK_ICON); | 
|---|
| 1586 | if (!fNoDead) | 
|---|
| 1587 | hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON); | 
|---|
| 1588 | else | 
|---|
| 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); | 
|---|
| 1594 |  | 
|---|
| 1595 | // set up color array used by seeall.c and newview.c color dialog | 
|---|
| 1596 |  | 
|---|
| 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; | 
|---|
| 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 |  | 
|---|
| 1617 | HWND StartFM3(HAB hab, INT argc, CHAR ** argv) | 
|---|
| 1618 | { | 
|---|
| 1619 | HWND hwndFrame; | 
|---|
| 1620 | HWND hwndClient; | 
|---|
| 1621 | UINT x; | 
|---|
| 1622 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU | | 
|---|
| 1623 | FCF_SIZEBORDER | FCF_MINMAX | | 
|---|
| 1624 | FCF_ACCELTABLE | FCF_MENU | FCF_ICON | FCF_TASKLIST | FCF_NOBYTEALIGN; | 
|---|
| 1625 |  | 
|---|
| 1626 | for (x = 1; x < argc; x++) { | 
|---|
| 1627 | if (*argv[x] == '~' && !argv[x][1]) | 
|---|
| 1628 | fReminimize = TRUE; | 
|---|
| 1629 | if (*argv[x] == '+' && !argv[x][1]) | 
|---|
| 1630 | fLogFile = TRUE; | 
|---|
| 1631 | if (*argv[x] == '-') { | 
|---|
| 1632 | if (!argv[x][1]) | 
|---|
| 1633 | fNoSaveState = TRUE; | 
|---|
| 1634 | else | 
|---|
| 1635 | strcpy(profile, &argv[x][1]); | 
|---|
| 1636 | } | 
|---|
| 1637 | } | 
|---|
| 1638 |  | 
|---|
| 1639 | hwndFrame = WinCreateStdWindow(HWND_DESKTOP, | 
|---|
| 1640 | WS_VISIBLE, | 
|---|
| 1641 | &FrameFlags, | 
|---|
| 1642 | WC_MAINWND, | 
|---|
| 1643 | NULL, | 
|---|
| 1644 | WS_VISIBLE | WS_ANIMATE, | 
|---|
| 1645 | FM3ModHandle, MAIN_FRAME, &hwndClient); | 
|---|
| 1646 | if (hwndFrame) { | 
|---|
| 1647 | WinSetWindowUShort(hwndFrame, QWS_ID, MAIN_FRAME); | 
|---|
| 1648 | hwndMainMenu = WinWindowFromID(hwndFrame, FID_MENU); | 
|---|
| 1649 | if (!WinRestoreWindowPos(FM2Str, "MainWindowPos", hwndFrame)) { | 
|---|
| 1650 |  | 
|---|
| 1651 | ULONG fl = SWP_MOVE | SWP_SIZE; | 
|---|
| 1652 | RECTL rcl; | 
|---|
| 1653 | ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 3L; | 
|---|
| 1654 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER); | 
|---|
| 1655 |  | 
|---|
| 1656 | WinQueryWindowRect(HWND_DESKTOP, &rcl); | 
|---|
| 1657 | rcl.yBottom += icz; | 
|---|
| 1658 | rcl.yTop -= bsz; | 
|---|
| 1659 | rcl.xLeft += bsz; | 
|---|
| 1660 | rcl.xRight -= bsz; | 
|---|
| 1661 | WinSetWindowPos(hwndFrame, | 
|---|
| 1662 | HWND_TOP, | 
|---|
| 1663 | rcl.xLeft, | 
|---|
| 1664 | rcl.yBottom, | 
|---|
| 1665 | rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom, fl); | 
|---|
| 1666 | } | 
|---|
| 1667 | if (fLogFile) | 
|---|
| 1668 | LogFileHandle = _fsopen("FM2.LOG", "a+", SH_DENYWR); | 
|---|
| 1669 | if (hwndHelp) | 
|---|
| 1670 | WinAssociateHelpInstance(hwndHelp, hwndFrame); | 
|---|
| 1671 | PostMsg(hwndClient, UM_SETUP, MPFROMLONG(argc), MPFROMP(argv)); | 
|---|
| 1672 | } | 
|---|
| 1673 | return hwndFrame; | 
|---|
| 1674 | } | 
|---|
| 1675 |  | 
|---|
| 1676 | BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset) | 
|---|
| 1677 | { | 
|---|
| 1678 | HFILE handle; | 
|---|
| 1679 | ULONG action; | 
|---|
| 1680 | ULONG len = strlen(signature); | 
|---|
| 1681 | ULONG l; | 
|---|
| 1682 | CHAR buffer[4096];                    // 06 Oct 07 SHL Protect against NTFS defect | 
|---|
| 1683 | BOOL ret = FALSE; | 
|---|
| 1684 |  | 
|---|
| 1685 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 1686 | if (DosOpen(filespec, | 
|---|
| 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)) | 
|---|
| 1697 | ret = FALSE; | 
|---|
| 1698 | else { | 
|---|
| 1699 | // Try signature match | 
|---|
| 1700 | l = len; | 
|---|
| 1701 | l = min(l, 79); | 
|---|
| 1702 | if (!DosChgFilePtr(handle, | 
|---|
| 1703 | abs(offset), | 
|---|
| 1704 | (offset >= 0) ? | 
|---|
| 1705 | FILE_BEGIN : FILE_END, &len)) { | 
|---|
| 1706 | if (!DosRead(handle, buffer, l, &len) && len == l) { | 
|---|
| 1707 | if (!memcmp(signature, buffer, l)) | 
|---|
| 1708 | ret = TRUE;                   // Matched | 
|---|
| 1709 | } | 
|---|
| 1710 | } | 
|---|
| 1711 | } | 
|---|
| 1712 | DosClose(handle);                     /* Either way, we're done for now */ | 
|---|
| 1713 | return ret;                           /* Return TRUE if matched */ | 
|---|
| 1714 | } | 
|---|
| 1715 |  | 
|---|
| 1716 | int CheckVersion(int vermajor, int verminor) | 
|---|
| 1717 | { | 
|---|
| 1718 | int ok = 0; | 
|---|
| 1719 |  | 
|---|
| 1720 | // fixme to do useful check - was missing in base source | 
|---|
| 1721 |  | 
|---|
| 1722 | #if 0 | 
|---|
| 1723 | if (vermajor && verminor) { | 
|---|
| 1724 | *vermajor = VERMAJOR; | 
|---|
| 1725 | *verminor = VERMINOR; | 
|---|
| 1726 | ok = 1; | 
|---|
| 1727 | } | 
|---|
| 1728 | #endif | 
|---|
| 1729 |  | 
|---|
| 1730 | ok = 1; | 
|---|
| 1731 |  | 
|---|
| 1732 | return ok; | 
|---|
| 1733 | } | 
|---|
| 1734 |  | 
|---|
| 1735 | #ifdef __WATCOMC__ | 
|---|
| 1736 | #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL) | 
|---|
| 1737 | #pragma alloc_text(INIT1,StartFM3,FindSwapperDat) | 
|---|
| 1738 | #endif | 
|---|