Changeset 849


Ignore:
Timestamp:
Sep 30, 2007, 7:10:59 PM (13 years ago)
Author:
Gregg Young
Message:

Initial attempt at wrapper functions for large file support. fNoLargeFileSupport is set to TRUE in init.c for testing. The code builds but isn't functional Setting fNoLargeFileSupport FALSE will yield working code.

Location:
trunk/dll
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/fm3dll.h

    r841 r849  
    14021402  fFM2Deletes, fAutoAddAllDirs, fConfirmTarget, fChangeTarget,
    14031403  fFirstTime, fShowTarget, fNoFinger, fDrivebarHelp, fCheckMM,
    1404   fSubjectLengthMax;
     1404  fSubjectLengthMax, fNoLargeFileSupport;
    14051405DATADEF BOOL detailsladate, detailslatime, detailscrdate, detailscrtime,
    14061406  detailslongname, detailsea, detailssize, detailssubject,
  • trunk/dll/init.c

    r843 r849  
    8282  CHAR *pp;
    8383  FILE *fp;
    84   FILEFINDBUF3 ffb;
     84  FILEFINDBUF3L ffb;
    8585  ULONG nm;
    8686  ULONG size = sizeof(SwapperDat);
     
    9797                      FILE_NORMAL | FILE_ARCHIVED |
    9898                      FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
    99                       &ffb, sizeof(ffb), &nm, FIL_STANDARD);
     99                      &ffb, sizeof(ffb), &nm, FIL_STANDARDL);
     100    if (rc && rc != 2 && rc !=3){
     101      FILEFINDBUF3 ffb;
     102      rc = DosFindFirst(SwapperDat,
     103                        &hdir,
     104                        FILE_NORMAL | FILE_ARCHIVED |
     105                        FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
     106                        &ffb, sizeof(ffb), &nm, FIL_STANDARD);
     107      fNoLargeFileSupport = TRUE;
     108    }
    100109    if (!rc) {
    101110      DosFindClose(hdir);
     
    154163              hdir = HDIR_CREATE;
    155164              nm = 1;
    156               if (!DosFindFirst(SwapperDat,
     165              rc = DosFindFirst(SwapperDat,
    157166                                &hdir,
    158167                                FILE_NORMAL | FILE_ARCHIVED |
    159168                                FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
    160                                 &ffb, sizeof(ffb), &nm, FIL_STANDARD)) {
     169                                &ffb, sizeof(ffb), &nm, FIL_STANDARD);
     170              if (rc){
     171                FILEFINDBUF3 ffb;
     172                rc = DosFindFirst(SwapperDat,
     173                                  &hdir,
     174                                  FILE_NORMAL | FILE_ARCHIVED |
     175                                  FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,
     176                                  &ffb, sizeof(ffb), &nm, FIL_STANDARD);
     177                fNoLargeFileSupport = TRUE;
     178              }
     179              if (!rc) {
    161180                DosFindClose(hdir);
    162181                PrfWriteProfileString(fmprof,
     
    182201  CHAR *env;
    183202  CHAR stringfile[CCHMAXPATH];
    184   FILESTATUS3L fsa;
     203  FILESTATUS3 fsa;
    185204  APIRET rc;
    186205
     
    195214    if (env) {
    196215      DosError(FERR_DISABLEHARDERR);
    197       rc = DosQueryPathInfo(env, FIL_STANDARDL, &fsa, sizeof(fsa));
     216      rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
    198217      if (!rc) {
    199218        if (fsa.attrFile & FILE_DIRECTORY) {
    200219          BldFullPathName(stringfile, env, "FM3RES.STR");
    201220          DosError(FERR_DISABLEHARDERR);
    202           if (DosQueryPathInfo(stringfile, FIL_STANDARDL, &fsa, sizeof(fsa)))
     221          if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
    203222            strcpy(stringfile, "FM3RES.STR");
    204223        }
     
    296315  CHAR *env;
    297316  CHAR stringfile[CCHMAXPATH];
    298   FILESTATUS3L fsa;
     317  FILESTATUS3 fsa;
    299318  APIRET rc;
    300319
     
    308327    if (env) {
    309328      DosError(FERR_DISABLEHARDERR);
    310       rc = DosQueryPathInfo(env, FIL_STANDARDL, &fsa, sizeof(fsa));
     329      rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
    311330      if (!rc) {
    312331        if (fsa.attrFile & FILE_DIRECTORY) {
    313332          BldFullPathName(stringfile, env, "FM3RES.STR");
    314333          DosError(FERR_DISABLEHARDERR);
    315           if (DosQueryPathInfo(stringfile, FIL_STANDARDL, &fsa, sizeof(fsa)))
     334          if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
    316335            strcpy(stringfile, "FM3RES.STR");
    317336        }
     
    516535  ULONG RVMinor = 0;
    517536  ULONG ret = 0;
    518   FILESTATUS3L fs3;                     // 25 Aug 07 SHL
     537  FILESTATUS3 fs3;                      // 25 Aug 07 SHL
    519538  PSZ env;
    520539  CHAR dllfile[CCHMAXPATH];
     
    534553  if (env) {
    535554    DosError(FERR_DISABLEHARDERR);
    536     rc = DosQueryPathInfo(env, FIL_STANDARDL, &fs3, sizeof(fs3));
     555    rc = DosQueryPathInfo(env, FIL_STANDARD, &fs3, sizeof(fs3));
    537556    if (!rc) {
    538557      if (fs3.attrFile & FILE_DIRECTORY) {
    539558        BldFullPathName(dllfile, env, "FM3RES");        // 23 Aug 07 SHL
    540559        DosError(FERR_DISABLEHARDERR);
    541         if (DosQueryPathInfo(dllfile, FIL_STANDARDL, (PVOID)&fs3, (ULONG)sizeof(fs3)))
     560        if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3)))
    542561          strcpy(dllfile, "FM3RES");
    543562      }
     
    649668      strcpy(inipath, env);
    650669      DosError(FERR_DISABLEHARDERR);
    651       rc = DosQueryPathInfo(inipath, FIL_STANDARDL, &fs3, sizeof(fs3));
     670      rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
    652671      if (!rc) {
    653672        if (fs3.attrFile & FILE_DIRECTORY)
     
    668687    DosError(FERR_DISABLEHARDERR);
    669688
    670     if (!DosQueryPathInfo(inipath, FIL_STANDARDL, &fs3, sizeof(fs3))) {
     689    if (!DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3))) {
    671690      fIniExisted = TRUE;
    672691      if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
    673692        fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
    674         rc = xDosSetPathInfo(inipath, FIL_STANDARDL, &fs3, sizeof(fs3), 0);
     693        rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
    675694        if (rc) {
    676695          Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     
    708727  memset(&hini, 0, sizeof(HELPINIT));
    709728  hini.cb = sizeof(HELPINIT);
    710   hini.ulReturnCode = 0L;
     729  hini.ulReturnCode = 0;
    711730  hini.pszTutorialName = NULL;
    712731  hini.phtHelpTable = (PHELPTABLE) MAKELONG(ID_HELPTABLE, 0xffff);
     
    725744      strcpy(helppath, env);
    726745      DosError(FERR_DISABLEHARDERR);
    727       rc = DosQueryPathInfo(helppath, FIL_STANDARDL, &fs3, sizeof(fs3));
     746      rc = DosQueryPathInfo(helppath, FIL_STANDARD, &fs3, sizeof(fs3));
    728747      if (!rc) {
    729748        if (fs3.attrFile & FILE_DIRECTORY) {
     
    904923    fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp =
    905924    fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget =
    906     fShowTarget = fDrivebarHelp = fCheckMM = TRUE;
     925    fShowTarget = fDrivebarHelp = fCheckMM = fNoLargeFileSupport = TRUE;
    907926  ulCnrType = CCS_EXTENDSEL;
    908927  FilesToGet = FILESTOGET_MIN;
  • trunk/dll/wrappers.c

    r847 r849  
    4040{
    4141    APIRET rc;
    42 
     42    if (fNoLargeFileSupport) {
     43        switch (ulInfoLevel) {
     44    case FIL_STANDARDL: {
     45      FILEFINDBUF3 ff3;
     46      ff3 = *(PFILEFINDBUF3)pfindbuf;
     47      ulInfoLevel = FIL_STANDARD;
     48      rc = DosFindFirst(pszFileSpec, phdir, flAttribute, &ff3, cbBuf,
     49                        pcFileNames, ulInfoLevel);
     50      *(PFILEFINDBUF3)pfindbuf = ff3;   // Copy aligned data
     51      ((PFILEFINDBUF3L)pfindbuf) -> cbFile = ff3.cbFile;  // Copy unaligned data
     52      ((PFILEFINDBUF3L)pfindbuf) -> cbFileAlloc = ff3.cbFileAlloc;
     53      ((PFILEFINDBUF3L)pfindbuf) -> attrFile = ff3.attrFile;
     54      ((PFILEFINDBUF3L)pfindbuf) -> cchName = ff3.cchName;
     55      ((PFILEFINDBUF3L)pfindbuf) -> achName[CCHMAXPATHCOMP] = *ff3.achName;
     56      break;
     57    }
     58    case  FIL_QUERYEASIZEL:{
     59      FILEFINDBUF4 ff4;
     60      ff4 = *(PFILEFINDBUF4)pfindbuf;
     61      ulInfoLevel = FIL_QUERYEASIZE;
     62      rc = DosFindFirst(pszFileSpec, phdir, flAttribute, &ff4, cbBuf,
     63                        pcFileNames, ulInfoLevel);
     64      //(PFILEFINDBUF4L)pfindbuf = (PFILEFINDBUF4L)pff4;   // Copy aligned data
     65      ((PFILEFINDBUF4L)pfindbuf) -> oNextEntryOffset = ff4.oNextEntryOffset;
     66      ((PFILEFINDBUF4L)pfindbuf) -> fdateCreation = ff4.fdateCreation;
     67      ((PFILEFINDBUF4L)pfindbuf) -> ftimeCreation = ff4.ftimeCreation;
     68      ((PFILEFINDBUF4L)pfindbuf) -> fdateLastAccess = ff4.fdateLastAccess;
     69      ((PFILEFINDBUF4L)pfindbuf) -> ftimeLastAccess = ff4.ftimeLastAccess;
     70      ((PFILEFINDBUF4L)pfindbuf) -> fdateLastWrite = ff4.fdateLastWrite;
     71      ((PFILEFINDBUF4L)pfindbuf) -> ftimeLastWrite = ff4.ftimeLastWrite;
     72      ((PFILEFINDBUF4L)pfindbuf) -> cbFile = ff4.cbFile;  // Copy unaligned data
     73      ((PFILEFINDBUF4L)pfindbuf) -> cbFileAlloc = ff4.cbFileAlloc;
     74      ((PFILEFINDBUF4L)pfindbuf) -> attrFile = ff4.attrFile;
     75      ((PFILEFINDBUF4L)pfindbuf) -> cbList = ff4.cbList;
     76      ((PFILEFINDBUF4L)pfindbuf) -> cchName = ff4.cchName;
     77      ((PFILEFINDBUF4L)pfindbuf) -> achName[CCHMAXPATHCOMP] = *ff4.achName;
     78      break;
     79    }
     80    default:
     81        Runtime_Error(pszSrcFile, __LINE__, "ulInfoLevel %u unexpected", ulInfoLevel);
     82        rc = ERROR_INVALID_PARAMETER;
     83        }
     84    }
     85    else
    4386    rc = DosFindFirst(pszFileSpec, phdir, flAttribute, pfindbuf, cbBuf,
    4487                      pcFileNames, ulInfoLevel);
     
    5295{
    5396  APIRET rc;
    54 
    55   rc = DosFindNext(hDir, pfindbuf, cbfindbuf, pcFilenames);
     97  if (fNoLargeFileSupport) {
     98    if (((PFILEFINDBUF4L)pfindbuf)->cbList) {
     99      FILEFINDBUF4 ff4;
     100      ff4 = *(PFILEFINDBUF4)pfindbuf;
     101      rc = DosFindNext(hDir, &ff4, cbfindbuf, pcFilenames);
     102      *(PFILEFINDBUF4)pfindbuf = ff4;   // Copy aligned data
     103      ((PFILEFINDBUF4L)pfindbuf) -> cbFile = ff4.cbFile;  // Copy unaligned data
     104      ((PFILEFINDBUF4L)pfindbuf) -> cbFileAlloc = ff4.cbFileAlloc;
     105      ((PFILEFINDBUF4L)pfindbuf) -> attrFile = ff4.attrFile;
     106      ((PFILEFINDBUF4L)pfindbuf) -> cbList = ff4.cbList;
     107      ((PFILEFINDBUF4L)pfindbuf) -> cchName = ff4.cchName;
     108      ((PFILEFINDBUF4L)pfindbuf) -> achName[CCHMAXPATHCOMP] = *ff4.achName;
     109    }
     110    else {
     111      FILEFINDBUF3 ff3;
     112      ff3 = *(PFILEFINDBUF3)pfindbuf;
     113      rc = DosFindNext(hDir, &ff3, cbfindbuf, pcFilenames);
     114      *(PFILEFINDBUF3)pfindbuf = ff3;   // Copy aligned data
     115      ((PFILEFINDBUF3L)pfindbuf) -> cbFile = ff3.cbFile;  // Copy unaligned data
     116      ((PFILEFINDBUF3L)pfindbuf) -> cbFileAlloc = ff3.cbFileAlloc;
     117      ((PFILEFINDBUF3L)pfindbuf) -> attrFile = ff3.attrFile;
     118      ((PFILEFINDBUF3L)pfindbuf) -> cchName = ff3.cchName;
     119      ((PFILEFINDBUF3L)pfindbuf) -> achName[CCHMAXPATHCOMP] = *ff3.achName;
     120    }
     121  }
     122  else
     123    rc = DosFindNext(hDir, pfindbuf, cbfindbuf, pcFilenames);
     124
    56125  return rc;
    57126}
     
    75144                       PVOID pInfoBuf,
    76145                       ULONG cbInfoBuf,
    77                        ULONG flOptions)
    78 {
    79     APIRET rc = DosSetPathInfo(pszPathName, ulInfoLevel, pInfoBuf, cbInfoBuf, flOptions);
     146                       ULONG flOptions)
     147{
    80148    FILESTATUS3 alt_fs3;
    81149    FILESTATUS3L alt_fs3L;
    82150    EAOP2 alt_eaop2;
     151    BOOL large = FALSE;
     152    APIRET rc;
     153    if (fNoLargeFileSupport && ulInfoLevel == FIL_STANDARDL){
     154      large = TRUE;
     155      ulInfoLevel = FIL_STANDARD;
     156    }
     157    rc = DosSetPathInfo(pszPathName, ulInfoLevel, pInfoBuf, cbInfoBuf, flOptions);
    83158    if (rc == ERROR_INVALID_NAME) {
    84159      switch (ulInfoLevel) {
    85160        case FIL_STANDARD:
    86161          alt_fs3 = *(PFILESTATUS3)pInfoBuf;    // Copy
    87           rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_fs3, sizeof(alt_fs3), flOptions);
     162          rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_fs3, cbInfoBuf, flOptions);
     163          if (fNoLargeFileSupport && large) {
     164            *(PFILESTATUS3)pInfoBuf = alt_fs3;   // Copy aligned data
     165            ((PFILESTATUS3L)pInfoBuf) -> cbFile = alt_fs3.cbFile;  // Copy unaligned data
     166            ((PFILESTATUS3L)pInfoBuf) -> cbFileAlloc = alt_fs3.cbFileAlloc;
     167            ((PFILESTATUS3L)pInfoBuf) -> attrFile = alt_fs3.attrFile;
     168          }
    88169          break;
    89170        case FIL_STANDARDL:
    90171          alt_fs3L = *(PFILESTATUS3L)pInfoBuf;  // Copy
    91           rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_fs3L, sizeof(alt_fs3L), flOptions);
     172          rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_fs3L, cbInfoBuf, flOptions);
    92173          break;
    93174        case FIL_QUERYEASIZE:
    94175          alt_eaop2 = *(PEAOP2)pInfoBuf;        // Copy
    95           rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_eaop2, sizeof(alt_eaop2), flOptions);
     176          rc = DosSetPathInfo(pszPathName, ulInfoLevel, &alt_eaop2, cbInfoBuf, flOptions);
    96177          break;
    97178      default:
     
    103184}
    104185
     186APIRET xDosQueryPathInfo (PSZ pszPathName, ULONG ulInfoLevel, PVOID pInfoBuf, ULONG cbInfoBuf)
     187{
     188  FILESTATUS3 alt_fs3;
     189  FILESTATUS4 alt_fs4;
     190  APIRET rc;
     191  if (fNoLargeFileSupport){
     192  switch (ulInfoLevel) {
     193    case FIL_STANDARDL:
     194          alt_fs3 = *(PFILESTATUS3)pInfoBuf;    // Copy
     195          rc = DosQueryPathInfo(pszPathName, ulInfoLevel, &alt_fs3, cbInfoBuf);
     196          *(PFILESTATUS3)pInfoBuf = alt_fs3;   // Copy aligned data
     197          ((PFILESTATUS3L)pInfoBuf) -> cbFile = alt_fs3.cbFile;  // Copy unaligned data
     198          ((PFILESTATUS3L)pInfoBuf) -> cbFileAlloc = alt_fs3.cbFileAlloc;
     199          ((PFILESTATUS3L)pInfoBuf) -> attrFile = alt_fs3.attrFile;
     200          break;
     201    case FIL_QUERYEASIZEL:
     202          alt_fs4 = *(PFILESTATUS4)pInfoBuf;    // Copy
     203          rc = DosQueryPathInfo(pszPathName, ulInfoLevel, &alt_fs4, cbInfoBuf);
     204          *(PFILESTATUS4)pInfoBuf = alt_fs4;   // Copy aligned data
     205          ((PFILESTATUS4L)pInfoBuf) -> cbFile = alt_fs4.cbFile;  // Copy unaligned data
     206          ((PFILESTATUS4L)pInfoBuf) -> cbFileAlloc = alt_fs4.cbFileAlloc;
     207          ((PFILESTATUS4L)pInfoBuf) -> attrFile = alt_fs4.attrFile;
     208          ((PFILESTATUS4L)pInfoBuf) -> cbList = alt_fs4.cbList;
     209          break;
     210      default:
     211        Runtime_Error(pszSrcFile, __LINE__, "ulInfoLevel %u unexpected", ulInfoLevel);
     212        rc = ERROR_INVALID_PARAMETER;
     213      } // switch
     214  }
     215  else
     216    DosQueryPathInfo (pszPathName, ulInfoLevel, pInfoBuf, cbInfoBuf);
     217  return rc;
     218}
    105219PSZ xfgets(PSZ pszBuf, size_t cMaxBytes, FILE * fp, PCSZ pszSrcFile,
    106220           UINT uiLineNumber)
Note: See TracChangeset for help on using the changeset viewer.