Changeset 1750 for trunk/dll/avv.c


Ignore:
Timestamp:
Mar 1, 2014, 2:55:57 PM (12 years ago)
Author:
John Small
Message:

Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.

So calls to these functions, direct and indirect, had to be changed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/avv.c

    r1746 r1750  
    3434  24 Feb 14 JBS Ticket #517: Replaced a call to DosQueryAppType to a call to the wrapped xDosQueryApptType
    3535  24 Feb 14 JBS Ticket #523: Stop considering missing "list", "create" or "extract" commands as errors
     36  01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.
     37                So calls to these functions had to be changed and checkfile's signature was changed.
    3638
    3739***********************************************************************/
     
    6466#include "strips.h"                     // bstrip
    6567#include "misc.h"                       // CheckDriveSpaceAvail
    66 #include "srchpath.h"                   // searchpath
     68#include "srchpath.h"                   // Search*Path*ForFile
    6769#include "systemf.h"                    // runemf2
    6870#include "fortify.h"
     
    7375static PSZ pszSrcFile = __FILE__;
    7476
    75 static PSZ checkfile(PSZ file, INT * error);
     77static ULONG checkfile(PSZ file);
    7678static BOOL check_archiver(HWND hwnd, ARC_TYPE * info);
    7779static INT get_int_from_window(HWND hwnd, USHORT id);
     
    393395}
    394396
    395 static PSZ checkfile(PSZ file, INT * error)
    396 {
    397   CHAR *p, *pp = NULL;
    398   INT ret;
     397/**
     398 * checkfile: Determine if a program is reachable and of an acceptable type.
     399 *
     400 * @param pFilename: the name of a program file to check (input)
     401 *
     402 * @return 0 if the program reachable and of an acceptable type
     403 *         1 if the program is unreachable (or pFilename is invalid)
     404 *         2 if the program is of an unacceptable type
     405 *         3 if pFilename is null or points to a null string
     406 *
     407 */
     408static ULONG checkfile(PSZ file)
     409{
     410  CHAR szFullFilename[CCHMAXPATH], *pp = NULL;
     411  ULONG ret;
    399412  ULONG apptype;
    400413
    401414  if (!file || !*file) {
    402     *error = 3;
    403     return NULL;
     415    return 3;
    404416  }
    405417  pp = strchr(file, ' ');
    406418  if (pp)
    407419    *pp = 0;
    408   p = searchpath(file);
    409   if (!p || !*p)
    410     *error = 1;
     420  if (SearchPathForFile(PCSZ_PATH, file, szFullFilename)) {
     421    ret = 1;
     422  }
    411423  else {
    412     ret = (INT) xDosQueryAppType(p, &apptype);
     424    ret = xDosQueryAppType(szFullFilename, &apptype);
    413425    apptype &= (~FAPPTYP_32BIT);
    414426    if (!apptype ||
     
    417429        (apptype & FAPPTYP_BOUND) ||
    418430        (apptype & FAPPTYP_WINDOWAPI) || (apptype & FAPPTYP_DOS)) {
    419        *error = 0;
     431       ret = 0;
    420432     }
    421433     else
    422        *error = 2;
     434       ret = 2;
    423435  }
    424436  if (pp)
    425437    *pp = ' ';
    426   return p;
     438  return ret;
    427439}
    428440
     
    444456    badPos = TRUE;
    445457  if (info->list)
    446     checkfile(info->list, &badList);
     458    badList = checkfile(info->list);
    447459  if (info->create)
    448     checkfile(info->create, &badCreate);
     460    badCreate = checkfile(info->create);
    449461  if (info->extract)
    450     checkfile(info->extract, &badExtract);
     462    badExtract = checkfile(info->extract);
    451463  if (!noStart && !noEnd && !badPos && !badList && !badCreate && !badExtract)
    452464    return TRUE;                        // OK
     
    927939            MBID_YES) {
    928940
    929           PSZ ab2;
    930 
    931           ab2 = searchpath(PCSZ_ARCHIVERBB2);   // Rewrite without alerting
    932           rewrite_archiverbb2(ab2);
     941//        PSZ ab2;
     942
     943//        ab2 = searchpath(PCSZ_ARCHIVERBB2);   // Rewrite without alerting
     944          rewrite_archiverbb2(archiverbb2);  // jbs: Re-use path set by load_archivers
    933945        }
    934946      }
Note: See TracChangeset for help on using the changeset viewer.