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