Changeset 1077 for trunk/dll/init.c


Ignore:
Timestamp:
Jul 18, 2008, 8:11:54 PM (17 years ago)
Author:
Steven Levine
Message:

Enhance Fortify infrastructure
Add Fortify_SetOwner Fortify_ChangeOwner Fortify_ChangeScope
Add FORTIFY_VERBOSE_SCOPE_ENTER_EXIT support
Add more fm/2 Fortify tooling and rework existing tooling for correct nesting
Still lots to do for cross-thread allocations
Add misc.h
Add walkem.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/init.c

    r1076 r1077  
    4444  29 Feb 08 GKY Refactor global command line variables to notebook.h
    4545  08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
    46                 keys using a "DirCnr." prefix
     46                keys using a "DirCnr." prefix
    4747  20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it.
    4848  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
    49                 all the details view settings (both the global variables and those in the
    50                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
     49                all the details view settings (both the global variables and those in the
     50                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    5151  16 JUL 08 GKY Use TMP directory for temp files
    5252  17 Jul 08 SHL Reduce code bulk in fUseTmp setup
     
    8181#include "strutil.h"                    // GetPString
    8282#include "fm3dll.h"
    83 #include "notebook.h"                   // command line variables (editor etc)
     83#include "notebook.h"                   // command line variables (editor etc)
    8484#include "fortify.h"
    8585
     
    660660      if (fs3.attrFile & FILE_DIRECTORY) {
    661661        // 17 Jul 08 SHL fixme to check writable someday
    662         pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
     662        pTmpDir = xstrdup(env, pszSrcFile, __LINE__);
    663663      }
    664664    }
    665665  }
    666   BldFullPathName(ArcTempRoot, env, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
     666  BldFullPathName(ArcTempRoot, pTmpDir, fAmAV2 ? "$AV$ARC$" : "$FM$ARC$");
    667667
    668668  /* initialize random number generator */
     
    731731    else {
    732732      if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
    733         saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,
    734                "Check INI header failed will attempt to replace with backup \\
    735                if backup fails or not found will open with new ini");
    736         DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING);
    737         DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING);
    738         if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
    739           DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING);
    740           fWantFirstTimeInit = TRUE;
    741         }
     733        saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,
     734               "Check INI header failed will attempt to replace with backup \\
     735               if backup fails or not found will open with new ini");
     736        DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING);
     737        DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING);
     738        if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
     739          DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING);
     740          fWantFirstTimeInit = TRUE;
     741        }
    742742      }
    743743      if (!fWantFirstTimeInit) {
    744         fIniExisted = TRUE;
    745         if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
    746           fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
    747           rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
    748           if (rc) {
    749             Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    750                         GetPString(IDS_INIREADONLYTEXT), inipath);
    751           }
    752         }
     744        fIniExisted = TRUE;
     745        if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
     746          fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
     747          rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
     748          if (rc) {
     749            Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     750                        GetPString(IDS_INIREADONLYTEXT), inipath);
     751          }
     752        }
    753753      }
    754754    }
     
    763763    if (!fmprof) {
    764764      Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
    765                 "PrfOpenProfile");
     765                "PrfOpenProfile");
    766766      return FALSE;
    767767    }
     
    10191019    if (!MaxComLineChecked) {
    10201020      ret = saymsg(MB_YESNO,
    1021                    HWND_DESKTOP,
    1022                    NullStr,
    1023                    GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));
     1021                   HWND_DESKTOP,
     1022                   NullStr,
     1023                   GetPString(IDS_CHANGECMDLINELENGTHDEFAULT));
    10241024      if (ret == MBID_YES)
    1025         MaxComLineStrg = 1024;
     1025        MaxComLineStrg = 1024;
    10261026      MaxComLineChecked = TRUE;
    10271027      PrfWriteProfileData(fmprof, appname, "MaxComLineChecked", &MaxComLineChecked, sizeof(BOOL));
     
    15251525      if (!DosRead(handle, buffer, l, &len) && len == l) {
    15261526        if (!memcmp(signature, buffer, l))
    1527           ret = TRUE;                   // Matched
     1527          ret = TRUE;                   // Matched
    15281528      }
    15291529    }
Note: See TracChangeset for help on using the changeset viewer.